Description
I have logged this in valueflows/vf-ui#5 but am reaching out here to see if this is being attempted by anyone else. I'm unsatisfied with the provided options that increase complexity for developers integrating components into their own projects- this thread provides all necessary evidence to suggest that there is a barrier to entry present.
The user story is "As a developer, I can bring vf-ui components into my project of choice, without having to reconfigure my build system or bundler or eject from CRNA". So that means I want:
- separate NPM packages for the same component in runtime-dependant flavours (
mycomponentlib
,mycomponentlib-react
,mycomponentlib-angular
etc) - zero-config components written in the native component format of the framework (eg.
ReactComponent
) without runtime dependencies- probably adapted via small adapter modules eg. webcomponents-in-react
- pluggable styles that work "natively" (at the framework's module resolution layer)
- file separation between component DOM logic and styles, to promote re-styling
- a default export of the component which mixes in a theme that is loaded from another file on top of the "unstyled" component; yielding the option to inject a custom theme if desired
I've already started working on this, but before I go too much further I want to see what other options I have. FWIW my next steps will be dealing with the output code that Svelte generates, which I don't see an API for... so expect I am going to have to do some brittle regexing to remove the CSS injection in order that the end-developer's bundler can manage it.
While I'm here I suppose it's worth asking my related pending questions in case I need to go ahead with this:
- Is there a way to make Webpack generate sane bundle sizes and clean output that is appropriate for drop-in use in a React or Angular project?
- How heavy is the Svelte runtime, bytesize-wise? Would you advocate embedding
SvelteComponent
instances within React, Angular etc projects rather thanSvelteElement
ones? - What would be involved with doing this "properly"? It seems like a different template is used for generating the output when
customElement
is defined. Can I author my own compiler targets?