svelte-jsoneditor icon indicating copy to clipboard operation
svelte-jsoneditor copied to clipboard

Separate the svelte component and the js wrapper

Open AlexRMU opened this issue 1 year ago • 5 comments

It would be nice to bring all the functionality that is needed for use without svelte into a separate component that will be imported from js. And the pure svelte component will be imported from svelte. You also need to make native events in the svelte component (and pass them above), and use callbacks in the wrapper, etc.

AlexRMU avatar Dec 15 '23 15:12 AlexRMU

I'm not entirely sure what you mean, do you mean to move the stuff related to the vanilla-jsoneditor into a separate repo? There is no "js wrapper", it is only a build script that generates a vanilla JS bundle using rollup.

josdejong avatar Dec 15 '23 16:12 josdejong

The main component has updateProps and other things that are required for vanilla js. This can be moved to a separate component. In addition, it has a size of 500 lines, it is better to reduce it somehow. Plus, you can add a bunch of slots to be able to replace some components.

AlexRMU avatar Dec 16 '23 08:12 AlexRMU

Blocked by https://github.com/josdejong/svelte-jsoneditor/issues/373

AlexRMU avatar Dec 16 '23 08:12 AlexRMU

Yeah, that can be interesting. It would be neat to separate the stuff related to the vanilla-package from the svelte-version. It should not introduce friction though to implement a feature or fix and then deploy both packages (right now all of that goes in one go).

Is this something you would like to try out?

josdejong avatar Dec 18 '23 10:12 josdejong

I think you can just export the svelte component and the wrapper component separately https://github.com/sveltejs/kit/discussions/8825 https://github.com/sveltejs/kit/pull/8922 https://kit.svelte.dev/docs/packaging#anatomy-of-a-package-json-exports

AlexRMU avatar Dec 18 '23 15:12 AlexRMU