AnimCubeJS icon indicating copy to clipboard operation
AnimCubeJS copied to clipboard

Any plan to make a Typescript version and publish to npmjs ?

Open oscar6echo opened this issue 10 months ago • 10 comments

To ease use of AnimCubeJS, it would be convenient (even ideal) to have it available in Typescript and published on npmjs.

Is there any plan for this ? or is it out of scope ?

Btw congrats for the lib ! :+1:

oscar6echo avatar Jan 12 '25 12:01 oscar6echo

I am speaking for myself as a non-programmer / non-developer.

There is no such plan as I don't see how that change would be beneficial for the end user (i.e. for a visitor of your web page containing the AnimCubeJS simulators).

Regarding webmasters / developers, I don't see how to ease use of AnimCubeJS more than this.

bcube2 avatar Jan 20 '25 14:01 bcube2

Indeed for somebody for wants to write HTML directly, this would add not benefit, on the contrary it would make things unecessarily complex.

But today most web sites are built in frameworks like React or Vue. In this case being able to wrap AnimCubeJS in a properly package component helps - as opposed to resorting to global variables, which can become messy. Additionally these frameworks allow reactivity, ie here responding to changes in the state of a cube.

Asking the question I had in mind to use AnimCubeJS in a vitepress web site.
So I wanted to wrap AnimCubeJs in a vue component, which I have done with little change to the code in fact:

Side notes:

  • I have added the enhancements I see as most interesting: "rotate arrows" and "markers".
  • I changed the "mirror" behavior, which does not add visualisation value (in my view) but a symmetric change in perspective: In short if you look the cube slightly from the right, the modified "mirror" switch the view to slighty from the left, and vice versa.
  • The code is WIP and requires some cleaning.
  • Probably I'll add a proper interface to help input AnimCubeJS params

If some of the above would be of interest to AnimCubeJS repo, pls let me know.

oscar6echo avatar Jan 20 '25 21:01 oscar6echo

Glad to see you got AnimCubeJS working with Vue.

Here is how I look at it: to keep things as simple as possible, AnimCubeJS is not designed to directly support every JS framework or package registry there is. However, it is designed to support them indirectly - as long as webmasters are allowed to work with HTML & JS code, they should be able to get AnimCubeJS simulators to work on their web pages regardless of the tools being used to build them.

Among other tools, AnimCubeJS is already known to be working with React Native and Docusaurus - search for "CubeXpert" on App Store / Google Play to see an example for React Native, for Docusaurus example see cubinghistory.com.

bcube2 avatar Jan 21 '25 17:01 bcube2

I understand the general viewpoint.

However, I would argue there are 3 levels of 'packaging': (1) current state, good for 'flat' HTML with global variables, (2) module possibly with typescript with inputs and handler enabling manipulation of an individual widget in a 'non flat' page and (3) component in various framework (React, Vue, X, Y, Z ) indeed how of scope for AnimCubeJS.

Without (2) anybody trying to do (3) has to do (2) again and need dig quite deep into the AnimCubeJS function to understand the inputs and outputs and expose the interface properly. For example some params are documented, others can only be changed via a global acjs_* global variable. Properly and exhaustive interfaces would help use the lib in various contexts and also maintain/document the lib.

But never mind. This is only food for thought.

Thx for the link to cubinghistory: an impressive encyclopedia ! 👍

oscar6echo avatar Jan 21 '25 22:01 oscar6echo

Thank you for your suggestion and explanation.

If there is a change regarding this topic in the future, we will let you know by replying to this thread.

Closing for now.

Edit: I don´t have a permission to close this issue right now for some reason.

bcube2 avatar Jan 26 '25 12:01 bcube2

@lgarron Could you please include me back to the Cubing organization on Github now that I have enabled 2FA some time ago? When visiting https://github.com/cubing, I am seeing this: "You were removed from Cubing organization because you do not have two-factor authentication enabled."

bcube2 avatar Mar 10 '25 10:03 bcube2

@bcube2: Check your invites, you should be invited as admin for this repo now.

lgarron avatar Mar 10 '25 12:03 lgarron

@lgarron Thank you for the invitation. It says: "You must add an authenticator app as a two-factor authentication method and remove your SMS two-factor authentication method in order to accept this invitation."

Is there any chance for me to keep my 2FA method of choice (SMS) and being able to close issues in this repo, please?

bcube2 avatar Mar 10 '25 16:03 bcube2

Is there any chance for me to keep my 2FA method of choice (SMS) and being able to close issues in this repo, please?

Unfortunately not. SMS authentication is insecure, and there is no mechanism for individual exceptions.

Are you able to use any other mechanism like TOTP or passkeys?

lgarron avatar Mar 10 '25 18:03 lgarron

@lgarron Got it, thank you for an explanation.

At the moment I don´t really plan to enable any other 2FA method than SMS for my Github account.

Feel free to delete our conversation in this issue (I would do it myself but I don´t have permissions to do that).

bcube2 avatar Mar 11 '25 14:03 bcube2