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

Split the library to core + react hooks #142

Open
grobitto opened this issue Sep 15, 2024 · 7 comments
Open

Split the library to core + react hooks #142

grobitto opened this issue Sep 15, 2024 · 7 comments
Assignees

Comments

@grobitto
Copy link

grobitto commented Sep 15, 2024

Hello NoriginMedia,

We’re planning to use SolidJS for our upcoming SmartTV project and are interested in incorporating your spatial navigation library. While converting your React hooks to SolidJS isn’t too difficult, it would require cloning the entire project, which could result in missing future updates to your engine.

It would be fantastic if the core of your library could be provided as a standalone module.

@predikament predikament self-assigned this Oct 4, 2024
@predikament predikament added the wontfix This will not be worked on label Oct 4, 2024
@predikament
Copy link
Collaborator

Hello @grobitto!

Thanks for reaching out and apologies for the delayed response.

Regarding your question, it should already be possible to do this, since we're exposing most of the core logic used -
Most of the functions should already be exported and usable outside of React or any particular framework.

There's a note around this in the documentation here: https://github.com/NoriginMedia/Norigin-Spatial-Navigation?tab=readme-ov-file#navigation-service.

As such I will close this issue, but please feel free to reopen this or create any new issues that you might find as part of achieving this.

Happy coding!

@grobitto
Copy link
Author

grobitto commented Oct 4, 2024

I've tried this way, but there is an @internal annotation on SpatialNavigation export, preventing it to be used outside of your module

/** @internal */
export const SpatialNavigation = new SpatialNavigationService();

@predikament predikament reopened this Oct 4, 2024
@predikament
Copy link
Collaborator

Hello again ☺️

I've tried this way, but there is an @internal annotation on SpatialNavigation export, preventing it to be used outside of your module

/** @internal */
export const SpatialNavigation = new SpatialNavigationService();

The service (class) instance itself is contained, but we export most of the functions it has:

export const {
  init,
  setThrottle,
  destroy,
  setKeyMap,
  setFocus,
  navigateByDirection,
  pause,
  resume,
  updateAllLayouts,
  getCurrentFocusKey,
  doesFocusableExist,
  updateRtl
} = SpatialNavigation;

Or are there perhaps other parts of the service that you would expect or need to have exposed?

@grobitto
Copy link
Author

grobitto commented Oct 4, 2024

I've checked your code from useFocusable.ts, and here is the list of functions not exported from SpatialNavigation:
addFocusable
removeFocusable
updateFocusable

@predikament
Copy link
Collaborator

predikament commented Oct 4, 2024

@grobitto: Alright, then we'll have a discussion internally around what we can do to expose those.

Thanks for letting us know.

@predikament predikament removed the wontfix This will not be worked on label Oct 4, 2024
@predikament
Copy link
Collaborator

I think what we will do is remove the @internal flag on the Spatial Navigation instance itself, then you can use whatever you want.

We'll follow up and highlight it here in this issue, once that change has been made.

@grobitto
Copy link
Author

grobitto commented Oct 8, 2024

Thank you!

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