Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Open
oscar6echo opened this issue Jan 12, 2025 · 5 comments
Open

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

oscar6echo opened this issue Jan 12, 2025 · 5 comments

Comments

@oscar6echo
Copy link

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 ! 👍

@bcube2
Copy link
Contributor

bcube2 commented Jan 20, 2025

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.

@oscar6echo
Copy link
Author

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.

@bcube2
Copy link
Contributor

bcube2 commented Jan 21, 2025

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.

@oscar6echo
Copy link
Author

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 ! 👍

@bcube2
Copy link
Contributor

bcube2 commented Jan 26, 2025

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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants