Lowers a CSS import into a shared, deduped constructable stylesheet so every
component instance — and every module — shares one parse instead of an
inline <style>:
The binding is module-level (all instances that adoptedStyleSheets = [styles]
share the one sheet), and the helper's cache lives on globalThis keyed by the
CSS text, so two different modules importing the same stylesheet adopt the
sameCSSStyleSheet — the documented adoptedStyleSheets dedupe win.
adoptedStyleSheets is Baseline widely available; the CSS Module Script
with { type: 'css' } syntax is not (Safari), which is why even the standard
form is shimmed here.
Imports with no default binding, or whose CSS file can't be read, are left as-is.
Lowers a CSS import into a shared, deduped constructable stylesheet so every component instance — and every module — shares one parse instead of an inline
<style>:become, in the emitted module:
The binding is module-level (all instances that
adoptedStyleSheets = [styles]share the one sheet), and the helper's cache lives onglobalThiskeyed by the CSS text, so two different modules importing the same stylesheet adopt the sameCSSStyleSheet— the documentedadoptedStyleSheetsdedupe win.adoptedStyleSheetsis Baseline widely available; the CSS Module Scriptwith { type: 'css' }syntax is not (Safari), which is why even the standard form is shimmed here.Imports with no default binding, or whose CSS file can't be read, are left as-is.