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

Support automatic definition via <svelte:options customElement=... /> tag #44

Open
patricknelson opened this issue Dec 13, 2023 · 1 comment
Labels
enhancement New feature or request
Milestone

Comments

@patricknelson
Copy link
Owner

patricknelson commented Dec 13, 2023

Describe the problem

Right now for a developer to define their custom elements, they must explicitly call svelteRetag(...) with their custom element configuration.

Relates to #13.

Describe the proposed solution

If the user is using Vite, we could define a custom plugin which will automatically parse and transform instances of <svelte:options customElement=... />, normalizing it down to remove the customElement definition (performed in pre processing) but retaining that information in scope for later processing. Then a second transformer running in post processing can inject the necessary JS to perform the initialization automatically in the emitted JS.

This could require AST (abstract syntax tree) processing. If so, consider using zimmerframe, since that will be what is used in Svelte 5, per micantoine/svelte-preprocess-cssmodules#100 (comment).

Alternatives considered

None.

Importance

would make my life easier

@patricknelson patricknelson added the enhancement New feature or request label Dec 13, 2023
@patricknelson patricknelson added this to the v2 milestone Dec 13, 2023
@patricknelson
Copy link
Owner Author

patricknelson commented Dec 13, 2023

Tagging for v2 milestone for now, given it's more likely to be easier to implement once we are already stadardized on the customElement syntax.

@patricknelson patricknelson changed the title Support automatic definition via <svelte:options customElement=... /> tag Support automatic definition via <svelte:options customElement=... /> tag Dec 13, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

1 participant