mountWidget centralizes both classic and shadow mounting behind a single entry point. The shadow path attaches an open shadow root, injects CSS via constructable stylesheets (with a deduped <style>-tag fallback for jsdom and Safari < 16.4), and renders Preact into a stable inner wrapper so the sibling style node is not clobbered by render() diffs. applyStyles is exported separately so the fallback branch can be exercised directly in unit tests without a full mount round trip — the constructable path runs only in real browsers. Idempotency on the host element and shadow root means repeated boots (HMR, accidental double-load) do not duplicate DOM nodes. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com> |
||
|---|---|---|
| .. | ||
| config.test.ts | ||
| mount.test.ts | ||
| smoke.test.ts | ||