Slot Composition & Content Projection
The flattened tree, the assignment algorithm, and why reading projected content at connection time returns nothing.
Production-Focused Resource
A practical, implementation-heavy reference for UI engineers building resilient component systems on native web platform primitives. Every page is grounded in the normative specification, illustrated with hand-authored diagrams, and written around code you can run rather than pseudocode you cannot.
The library now spans 85 pages across three sections — component architecture, styling and theming, and distribution and testing — organised from broad overviews down to single-problem deep dives. Each section page links to its topics; each topic links to the specific failures it covers.
Recent additions cover slot composition and the flattened tree, observer teardown and memory safety, container queries inside shadow trees, custom states as a styling channel, and the manifest and type declarations a published component package needs.
The flattened tree, the assignment algorithm, and why reading projected content at connection time returns nothing.
What actually retains a detached component, one signal for every listener, and how to measure that it was released.
Making the host its own query container, the containment that comes with it, and the side effects to plan for.
A styling channel only the component can write, invisible to the DOM and immune to a framework re-render.
The generated artefacts that give consumers autocomplete, real types in JSX, and documentation that cannot drift.
Deterministic registration, retroactive upgrade, scoped registries, and separating a class from its tag.
Every attachShadow option, what each fixes permanently, and how to build a tree without re-parsing it per instance.
What each reaction may assume, why a move runs two of them, and coordinating components without relying on order.
Deciding which side owns a value, breaking reflection loops without guard flags, and the pre-upgrade shadowing trap.
The two flags that decide reach, retargeting and composedPath(), and designing an event as versioned API.
Submitting a value, declaring validity, and answering the four form lifecycle callbacks a native control handles for free.
Where semantics should live, focus delegation across the boundary, and the ID-reference problem shadow DOM creates.
The three gaps every adapter closes for React, Vue, and Angular — and why they belong outside the component.
The selector surface a shadow tree actually has, cascade layers inside it, and why tree order decides ties.
Token tiers that survive a redesign, registered properties, and reading or writing tokens from script.
Choosing between a part, a token, and nothing — plus forwarding parts through nested components.
One parse for a thousand instances, layering sheets as an array, and rebuilding across documents.
What crosses the boundary and what stops at it, and a theme switch that re-parses nothing.
The three levers that matter, budgets worth holding to, and the optimisations not worth making.
The exports map as public API, condition order, and the sideEffects entry that keeps registrations alive.
What each test layer can prove, why a DOM emulation cannot answer most of it, and deterministic screenshots.
Emitting declarative shadow roots, adopting rather than rebuilding, and deferring hydration with islands.
Detecting capabilities instead of browsers, and designing the pre-upgrade state every reader sees first.