josdejong / svelte-jsoneditor

A web-based tool to view, edit, format, repair, query, transform, and validate JSON

Home Page:https://jsoneditoronline.org

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Separate the svelte component and the js wrapper

AlexRMU opened this issue · comments

commented

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.

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.

commented

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.

commented

Blocked by #373

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?

commented

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