Custom Element registration for the Lit / Web Components adapter.
The built-in <sc-*> elements are NOT registered as a side-effect
of importing lit/registry.ts — consumers MUST call
registerSchemaComponents explicitly. This is the
established pattern for libraries that ship Custom Elements
(Shoelace, Spectrum, Carbon) and is important for two reasons:
Side-effect-free imports. Tree-shaking removes elements the
consumer doesn't use, and the import order doesn't matter — the
library never silently calls customElements.define on the
consumer's behalf.
Tag prefix collisions. Without prefix support, two libraries
that ship <sc-string> would crash on the second
customElements.define call (the browser throws a
DOMException for re-registration). Passing a prefix lets the
consumer namespace the elements out of conflict.
Custom Element registration for the Lit / Web Components adapter.
The built-in
<sc-*>elements are NOT registered as a side-effect of importinglit/registry.ts— consumers MUST call registerSchemaComponents explicitly. This is the established pattern for libraries that ship Custom Elements (Shoelace, Spectrum, Carbon) and is important for two reasons:customElements.defineon the consumer's behalf.<sc-string>would crash on the secondcustomElements.definecall (the browser throws aDOMExceptionfor re-registration). Passing a prefix lets the consumer namespace the elements out of conflict.