API Reference
Look up import paths, signatures, and configuration for v1.0.0-alpha.16.
Start with routes and components
6 supported packages
@openelement/protocol
@openelement/protocolShared types for compiled templates, rendering, routing, and errors.
Most apps import these types through the router or element package.@openelement/element
@openelement/elementRenders compiled custom elements and connects their reactive state in the browser.
Write custom elements as component functions with a configuration export.Import `signal` for reactive state and `StyleSheet` for component styles.@openelement/compiler
@openelement/compilerCompiles TSX component functions at build time.
Install it as a development dependency when building components without the router.You normally drive it through the `@openelement/router` build; the standalone plugin is `@openelement/compiler/vite`.@openelement/router
@openelement/routerThe application and build surface: pages, routes, islands, request/render semantics, Vite integration, static generation and Nitro output.
Use `definePage` and `defineIslandConfig` for application authoring.Use `openPipeline()`/`openElement()` from `@openelement/router/vite` or the generated build task for builds.Plugin ordering, manifests and content scans are router implementation details.@openelement/create
@openelement/createCreates the starter app and installs its dependencies.
Generated projects expose `dev`, `check`, `test`, `build`, `start` and `preview`.@openelement/ui
@openelement/uiOptional ready-to-use custom elements, including buttons, inputs, and dialogs.
Exported symbols
Use Page Up or Page Down to read and ↑ or ↓ to select an export. Tab reaches long signatures, notes and links. Use ← or → to read across a signature and Esc to return to the list. Turn on “Scroll this list with the page” to browse without a separate scrollbar.
@openelement/protocol
433 exportsRoute action: handles form submissions for a page route.
Action<T, Env, Platform, Route>packages/protocol/src/data.ts:64Choose the form action response: true returns serialized data and enhance returns the full HTML used without JavaScript.
"x-openelement-action"Source notes
Request header selecting the action response channel: `true` marks a programmatic caller and selects the serialized ActionResult union; `enhance` marks the built-in morph enhancement and selects the same full-HTML responses the no-JS path receives.
packages/protocol/src/data.ts:125Context passed to a route action function (extends loader context).
ActionContext<Env, Platform, Route>Options and source location
packages/protocol/src/data.ts:47Wire shape returned to the JavaScript form-enhancement path.
ActionResult<Failure>Source notes
Wire shape returned to the JavaScript form-enhancement path. The no-JS path never sees this: it gets the equivalent semantics as plain HTTP (303 on success, 422 with the re-rendered form on validation failure, redirect/error as status codes). Success carries no data envelope. The application-loop contract makes a successful non-GET action answer 303 (PRG) — the framework never answers 200 with a rendered page, or with a success document, for a successful mutation — so the fetch channel answers `{ type: 'redirect' }` naming the PRG target and the authored return value is discarded by design. Success data travels the PRG target instead (query state the loader re-runs with, which the props projector then maps; see the router guide's "Form actions" section). The union previously declared a `{ type: 'success' }` member that no code path ever emitted — removed so the type matches the wire. Error outcomes (CSRF 403, unknown action 404, unparseable body 400, unexpected 500) are NOT part of this union: since #863 they answer RFC 9457 Problem Details with the PROBLEM_JSON_MEDIA_TYPE content type — see ProblemDetails.
packages/protocol/src/data.ts:92One API route declaration in the generated entry descriptor.
ApiRouteDeclOptions and source location
packages/protocol/src/ssg.ts:163Attribute/authoring-surface failures (phase `validation`).
{ readonly INVALID_TAG_NAME: "OE_INVALID_TAG_NAME"; readonly UNSAFE_META_ATTRIBUTE: "OE_UNSAFE_META_ATTRIBUTE"; readonly UNSAFE_ATTRIBUTE_NAME: "OE_UNSAFE_ATTRIBUTE_NAME"; readonly UNSAFE_URL_SINK: "OE_UNSAFE_URL_SINK";…packages/protocol/src/errors.ts:301Result returned by the OpenElement build pipeline.
BuildArtifactsOptions and source location
packages/protocol/src/ssg.ts:565A single client asset emitted by the build pipeline.
BuildClientAssetOptions and source location
packages/protocol/src/ssg.ts:558i18n configuration for the build pipeline.
BuildI18nOptionsOptions and source location
packages/protocol/src/ssg.ts:511A single island input to the build pipeline.
BuildIslandInputOptions and source location
packages/protocol/src/ssg.ts:492Manifest produced by the build pipeline.
BuildManifestArtifactOptions and source location
packages/protocol/src/ssg.ts:547Output configuration for the build pipeline.
BuildOutputOptionsOptions and source location
packages/protocol/src/ssg.ts:501Package island configuration for the build pipeline.
BuildPackageIslandOptionsOptions and source location
packages/protocol/src/ssg.ts:517A single generated HTML page artifact.
BuildPageArtifactOptions and source location
packages/protocol/src/ssg.ts:539Framework-agnostic plan consumed by the OpenElement build pipeline.
BuildPlanOptions and source location
packages/protocol/src/ssg.ts:523A single route input to the build pipeline.
BuildRouteInputOptions and source location
packages/protocol/src/ssg.ts:474(str: string): stringSource notes
The one camelCase → kebab-case casing rule for custom-element attribute names, so `<x-el itemCount={5}>` round-trips as `item-count` on every boundary that derives an attribute name from a prop name: the compiler's property metadata, the SSR serializer, and the client attribute handling.
packages/protocol/src/forbidden-sinks.ts:95The compatibility classification report for one custom element manifest.
CemCompatibilityReportOptions and source location
packages/protocol/src/manifest.ts:146One property entry of the compiled custom-elements-manifest metadata.
CemPropertyMetadataOptions and source location
packages/protocol/src/part-program.ts:381Claim failures: the existing DOM does not match the program that would own it.
{ readonly STRUCTURE_MISMATCH: "OPEN_ELEMENT_COMPILED_CLAIM_MISMATCH"; readonly PRE_UPGRADE_EVENTS_INVALID: "OE_CLAIM_PRE_UPGRADE_EVENTS_INVALID"; readonly DYNAMIC_NODE_IN_STATIC_REGION: "OE_CLAIM_DYNAMIC_NODE_IN_STATIC…Source notes
Claim failures: the existing DOM does not match the program that would own it. The value shipped in 1.0.0-alpha.3 and is kept verbatim; consumers match on it, and `PartProgramHydrationError` is its only raiser.
packages/protocol/src/errors.ts:265The Phase 2 client build's delivery manifest, keyed by island identity.
ClientAssetManifestOptions and source location
packages/protocol/src/client-assets.ts:36The client asset one compile-time island identity resolves to.
ClientIslandAssetOptions and source location
packages/protocol/src/client-assets.ts:19Client island entry shape passed to entry generator.
ClientIslandEntryOptions and source location
packages/protocol/src/ssg.ts:105The scanner’s per-tag compatibility tier, reason, discovery source, and rendering and hydration facts.
CompatibilityClassificationSource notes
The per-tag verdict the compatibility scanner records: the tier a discovered tag was classified as, the human-readable `reason`, where the tag was found (`source`), and the SSR/DSD/hydration facts the verdict was derived from.
packages/protocol/src/framework.ts:347The tag’s build compatibility level: server-rendered, client-only, experimental, or rejected.
CompatibilityTierSource notes
How far a discovered tag may participate in the build: 'ssr-capable' renders and hydrates, 'client-only' ships to the browser without server output, 'experimental-dom' is admitted with a downgraded guarantee, and 'rejected' fails the build.
packages/protocol/src/framework.ts:340The compiled custom-elements-manifest metadata block of one component.
CompiledCemMetadataOptions and source location
packages/protocol/src/part-program.ts:390The compiled element metadata the program carries for tooling consumers.
CompiledElementMetadataOptions and source location
packages/protocol/src/part-program.ts:399The name, type, and reflection metadata for one compiled @property declaration.
CompiledPropertyMetadataSource notes
One compiled
packages/protocol/src/part-program.ts:362Compiler (build-time) failures.
{ readonly DIAGNOSTICS: "OE_COMPILER_DIAGNOSTICS"; readonly INVALID_SOURCE: "OE_COMPILER_INVALID_SOURCE"; }Source notes
Compiler (build-time) failures. The per-diagnostic `OEC####` codes stay on each diagnostic; these classify the family so a build failure is catchable as one thing.
packages/protocol/src/errors.ts:293A component’s delivery layer: static DSD, interactive DSD, a client-only island, or light DOM.
ComponentLayerSource notes
The delivery layer a component belongs to: fully static DSD markup ('dsd-static'), DSD markup with a client island ('dsd-interactive'), a client-only island with no SSR output ('pure-island'), or a light-DOM element ('light-dom'). Recorded per component in the build manifest and consumed by the hydration scheduler.
packages/protocol/src/framework.ts:23Operator/literal compatibility for when-Block tests (issue #1372).
(op: unknown, value: unknown): booleanSource notes
Operator/literal compatibility for when-Block tests (issue #1372). Both wire validators (this module and the server serializer's shared validator) close the space through this one predicate: - ordering operators require a finite numeric literal; - `equals`/`not-equals` admit a finite number, string, or boolean; - `truthy` admits exactly `true` or `false` (the recorded expectation).
packages/protocol/src/part-program.ts:260The comparison operators a program condition supports.
ConditionOperatorpackages/protocol/src/part-program.ts:236Community-context service lifecycle failures (phase `csr`).
{ readonly SERVICE_DISPOSED: "OE_CONTEXT_SERVICE_DISPOSED"; }packages/protocol/src/errors.ts:233The CORS origin policy an API route declares.
CorsOriginConfigpackages/protocol/src/ssg.ts:130The content-security-policy directives a route or document declares.
CspConfigOptions and source location
packages/protocol/src/ssg.ts:133Internal SSR provenance marker on light-mode host tags (#1148).
"data-oe-light"Source notes
Internal SSR provenance marker on light-mode host tags (#1148). Present only when the host's light subtree was server-rendered under the in-place activation contract: the client binds the existing DOM instead of clearing it, and a parent's activation walk prunes the nested host's subtree. Client rendering never writes it and it is never removed. The writer (internal/compiled/server) and readers (internal/compiled/runtime) import this constant; nothing writes the literal.
packages/protocol/src/part-program.ts:459Default code for {@linkcode RenderError }.
"RENDER_ERROR"Source notes
Default code for {@linkcode RenderError }. Deliberately NOT a member of {@linkcode ErrorCode}: that object is the scan target of the documentation site's error catalog, which requires every member to carry a phase/severity family rule. `RENDER_ERROR` is the pre-dialect value `RenderError` has always defaulted to — kept verbatim so callers that observe it keep working, and kept out of the catalogue because it is not a failure this package classifies, only a constructor default a caller may override.
packages/protocol/src/errors.ts:47The `format` discriminator every report carries.
"openelement.diagnostics/1"Source notes
The `format` discriminator every report carries. Consumers branch on it instead of guessing: a future shape change mints a new tag rather than reinterpreting old bytes.
packages/protocol/src/diagnostics.ts:84DiagnosticEnvelopeSource notes
One machine-readable diagnostic: the producer's stable code, where the failure sits (`file`, `line`, `column` — absent when the producer has no source location, e.g. a configuration refusal), what happened (`message`), and when known, the fix (`hint`). `line`/`column` are 1-based, matching the diagnostics the compiler records from TypeScript source positions. Unknown envelope fields are tolerated on the wire (forward compat); the required core is exactly these fields.
packages/protocol/src/diagnostics.ts:60DiagnosticPhaseSource notes
The pipeline phase a diagnostic was raised in — the same vocabulary the error contract's {@linkcode ErrorPhase } uses, so a producer's code, phase and envelope cannot disagree about where a failure happened.
packages/protocol/src/diagnostics.ts:39Assemble the exit's report. `ok` derives from the diagnostics' severities, never from a caller's optimism: one `error` severity is enough to fail it.
(diagnostics: DiagnosticEnvelope[]): DiagnosticReportpackages/protocol/src/diagnostics.ts:105DiagnosticReportSource notes
One build exit's diagnostics: the format tag, whether the run is clean (`ok` is false the moment any diagnostic carries severity `error`), and every diagnostic the exit collected. This is the document the CLI writes to the stream and the diagnostics file — one aggregate containing every code.
packages/protocol/src/diagnostics.ts:95One format tag value (kept as a type for the report's `format` field).
"openelement.diagnostics/1"packages/protocol/src/diagnostics.ts:87Raised by {@linkcode parseDiagnosticReport} when the text is not a consumable report.
class DiagnosticReportParseError extends ErrorSource notes
Raised by {@linkcode parseDiagnosticReport} when the text is not a consumable report. Fail closed: a consumer that catches this knows the channel answered garbage — never a half-valid report.
packages/protocol/src/diagnostics.ts:123How severe one diagnostic is. `error` fails the build, `warning` reports a recoverable defect, `info` is reserved for advisories.
DiagnosticSeveritySource notes
How severe one diagnostic is. `error` fails the build, `warning` reports a recoverable defect, `info` is reserved for advisories. The build report's `ok` flag derives from this: any `error` diagnostic makes the report not-ok.
packages/protocol/src/diagnostics.ts:32The document-level facts a build bakes into the generated entry.
DocumentConfigOptions and source location
packages/protocol/src/ssg.ts:286Keyed-list identity failures.
{ readonly ITEM_NOT_A_RECORD: "OE_EACH_ITEM_NOT_A_RECORD"; readonly KEY_NOT_ROUND_TRIPPABLE: "OE_EACH_KEY_NOT_ROUND_TRIPPABLE"; readonly DUPLICATE_KEY: "OE_EACH_KEY_DUPLICATE"; }Source notes
Keyed-list identity failures. Shared by the server serializer and the client runtime (see `internal/compiled/each-key.ts`), so both executors reject the same data with the same code.
packages/protocol/src/errors.ts:159The manifest a project without a client bundle carries.
ClientAssetManifestpackages/protocol/src/client-assets.ts:54"__openEntryDefined"Source notes
Property on the stub holding the generated entry's registration-ownership map (tag -> class it registered): a route module that self-registers its tag wins over the entry's registration, and on dev re-evaluation a fresh self-registered class must still win (#952).
packages/protocol/src/registry-markers.ts:30The full build-time description of one generated entry: routes, islands, renderers, middleware, document, and layout plans.
EntryDescriptorOptions and source location
packages/protocol/src/ssg.ts:321Error message prefix for all openElement errors.
"[openElement]"packages/protocol/src/errors.ts:50Well-known error code constants for reference. String values are always accepted.
{ readonly SSR_RENDER_ERROR: "SSR_RENDER_ERROR"; readonly BOUNDARY_CAUGHT: "BOUNDARY_CAUGHT"; readonly UNKNOWN: "UNKNOWN"; }packages/protocol/src/errors.ts:31The pipeline phase an error was raised in.
ErrorPhasepackages/protocol/src/errors.ts:80How severe a framework error is.
ErrorSeveritypackages/protocol/src/errors.ts:78Callback receiving every reported {@linkcode OpenElementError} for telemetry.
ErrorTelemetryHookpackages/protocol/src/errors.ts:132Map the one error dialect ({@linkcode OpenElementError} — every producer's raiser goes through it) onto the envelope.
(error: OpenElementError, options?: { hint?: string; }): DiagnosticEnvelopeSource notes
Map the one error dialect ({@linkcode OpenElementError} — every producer's raiser goes through it) onto the envelope. The error's code, severity and phase ARE the envelope's; the message carries verbatim. Producers with a fix pass it as `hint`.
packages/protocol/src/diagnostics.ts:256SSR/bootstrap failures raised by the public entries (phase `ssr` / `csr`).
{ readonly PROGRAM_MISSING: "OE_PROGRAM_MISSING"; readonly COMPOSITION_DEPTH: "OE_SSR_COMPOSITION_DEPTH"; readonly COMPUTED_FACTORY_MISSING: "OE_COMPUTED_FACTORY_MISSING"; readonly COMPUTED_READONLY: "OE_COMPUTED_READON…packages/protocol/src/errors.ts:328ReadonlySet<string>Source notes
Forbidden sink names — the ONE canonical deny list for every Part Program boundary: the compiler semantic core, the protocol validator (internal/protocol/part-program.ts), and the compiled server/claim validator (internal/compiled/server/shared.ts). This module is import-free and host-free by design (same base-of-graph contract as void-tags.ts): all consumers import it, so a new forbidden sink cannot be enforced on one boundary and missed on another. This module owns the named-sink deny lists and the attribute-name policy built on them (the one shared safe-attribute-name predicate and the one camelCase→kebab-case casing rule); consumers delegate so the boundary cannot diverge. The lists are fail closed and case-insensitive (attribute and property names are compared lowercase, matching the HTML parser's name folding): - `FORBIDDEN_ATTRIBUTE_NAMES`: attribute names that must never be a static attribute or an `attr`/`bool` sink. `srcdoc` smuggles a full HTML document past attribute escaping; `innerHTML` is admissible only through the dedicated trusted-HTML `html` Part, never as a plain attribute name. - `FORBIDDEN_PROPERTY_NAMES`: `prop` sink names that would re-prototype or re-construct the target element (prototype-pollution primitives). - `RAW_TEXT_TAGS`: raw-text elements are outside the compiled grammar — their content cannot be escaped by the serializer.
packages/protocol/src/forbidden-sinks.ts:28Property names the compiler refuses as @property declarations.
ReadonlySet<string>Source notes
Property names the compiler refuses as
packages/protocol/src/forbidden-sinks.ts:31Sink categories the canonical deny list classifies.
ForbiddenSinkKindpackages/protocol/src/forbidden-sinks.ts:41Return a human-readable reason when `name` is a forbidden sink of `kind`, or null when the name is admissible.
(kind: ForbiddenSinkKind, name: string): string | nullSource notes
Return a human-readable reason when `name` is a forbidden sink of `kind`, or null when the name is admissible. Unknown kinds fail closed with a reason instead of being waved through.
packages/protocol/src/forbidden-sinks.ts:48One framework failure: {@linkcode OpenElementError} with the caller's code and the phase/severity/recoverability that phase implies.
(code: string, message: string, options?: Omit<OpenElementErrorOptions, "code">): OpenElementErrorSource notes
One framework failure: {@linkcode OpenElementError} with the caller's code and the phase/severity/recoverability that phase implies. Every throw site in this package goes through this factory (or the `*ErrorCode` tables above) so a code, a phase and a recoverability answer cannot drift per site.
packages/protocol/src/errors.ts:375FrameworkOptionsSource notes
The adapter-facing framework options: where routes and islands live, the default layout and named-layout declarations, the document `<html>`/head injection channels, and the request-time middleware switches. Every field is optional; the adapter applies its documented default. This is the type an application config file's default export is checked against, so the rendered option table and the actual config surface cannot drift.
packages/protocol/src/framework.ts:180Runtime list of supported hydration strategies; the single source of truth for the `HydrationStrategy` union.
readonly ["load", "idle", "visible", "only", "none"]Source notes
Runtime list of supported hydration strategies; the single source of truth for the `HydrationStrategy` union. Consumed by island/registry validation and re-exported from the element root for app and build adapters.
packages/protocol/src/framework.ts:28The hydration delivery hint a component or route carries.
HydrationHintOptions and source location
packages/protocol/src/render.ts:26Island hydration trigger: 'load' | 'idle' | 'visible' | 'only'.
"load" | "idle" | "visible" | "only" | "none"packages/protocol/src/framework.ts:30Idle-hydration scheduling fallback (milliseconds) when neither `requestIdleCallback` nor `requestAnimationFrame` is available.
50packages/protocol/src/policy.ts:70One module import the generated entry emits.
ImportDeclOptions and source location
packages/protocol/src/ssg.ts:123The wire-validator face of the one canonical attribute-name predicate (delegates to `./forbidden-sinks.ts`); exported for parity tests.
(value: unknown): value is stringpackages/protocol/src/part-program.ts:501The static-sidecar descriptor router injects into the element compiler.
StaticSidecarDescriptorpackages/protocol/src/island-admission.ts:18One island the build admits: tag, module path, and delivery facts.
IslandDeclOptions and source location
packages/protocol/src/ssg.ts:195Adapter-owned browser delivery strategy, including media-query admission.
IslandDeliveryStrategypackages/protocol/src/ssg.ts:31Shared island module identity (CL-3 convergence: one base, three shapes).
IslandModuleIdentitySource notes
Shared island module identity (CL-3 convergence: one base, three shapes). Every island record names the same module the same way — the tag it registers as, the module path that owns it, and whether that module is a package (CEM-derived named export) rather than a local file (default export) — so a rename of the identity touches one declaration, not three. The delivery-strategy fields intentionally stay per-shape (`strategy` on the client entry vs `hydrate` on the build decls): they are different stages' vocabularies, not one field spelled two ways.
packages/protocol/src/ssg.ts:98Per-island delivery options (hydration strategy, SSR/DSD participation).
IslandOptionsOptions and source location
packages/protocol/src/island.ts:8Options for the build-time island source transform.
IslandTransformOptionsOptions and source location
packages/protocol/src/island.ts:42The island transform output: rewritten source plus extracted facts.
IslandTransformResultOptions and source location
packages/protocol/src/island.ts:64The one safe-attribute-name predicate (#1033, #602).
(name: string): booleanSource notes
The one safe-attribute-name predicate (#1033, #602). Attribute *names* are not escaped on any render path, so a name must be valid HTML attribute-name grammar (blocks quote/space injection), must not be an event handler (`on*`, case-insensitive), and must not be a forbidden sink (`innerhtml`/ `srcdoc` — case-insensitive). Every boundary that admits an attribute name — the compiler semantic core, the Part Program validator, the compiled server validator, and the SSR head/meta name checks — delegates here, so the rules cannot diverge per path.
packages/protocol/src/forbidden-sinks.ts:81An event binding scoped to each item of an `each` block.
ItemEventBindingSource notes
An event binding scoped to each item of an `each` block. The runtime attaches this listener to every item root node created by the block, making per-item handlers (onClick={this.select(row.id)}) expressible without fixed-path event parts.
packages/protocol/src/part-program.ts:295Element-lifecycle failures: the kernel was driven outside its contract (phase `csr`).
{ readonly DISPOSED: "OE_KERNEL_DISPOSED"; readonly TAG_MISMATCH: "OE_KERNEL_TAG_MISMATCH"; readonly CLAIM_EXECUTOR_MISSING: "OE_KERNEL_CLAIM_EXECUTOR_MISSING"; readonly ROOT_NOT_OWNED: "OE_KERNEL_ROOT_NOT_OWNED"; reado…packages/protocol/src/errors.ts:219Select the built-in layout, declare a custom layout with its module and props, or disable the layout.
LayoutConfigSource notes
Layout declaration: `false` disables the layout entirely, `'default'` uses the built-in layout, and the object form names a tag with the module path that defines it (`import`, resolved like a {@link FrameworkOptions.middleware.use } entry) plus the compiled layout properties the router injects per route.
packages/protocol/src/framework.ts:96The layout module a build resolves: tag, import path, and serialized props.
LayoutDeclOptions and source location
packages/protocol/src/ssg.ts:294The resolved layouts a build ships: the default layout plus named layouts.
LayoutPlanOptions and source location
packages/protocol/src/ssg.ts:315Route loader: fetches data for a page route.
Loader<T, Env, Platform, Route>packages/protocol/src/data.ts:56Context passed to a request-time ('dynamic') route loader.
LoaderContext<Env, Platform, Route>Options and source location
packages/protocol/src/data.ts:40Locale-aware resolved path contract.
LocalePathOptions and source location
packages/protocol/src/framework.ts:82Request-body bound (bytes) the generated entry applies to action POST routes; larger uploads belong on API routes with explicit limits.
numberpackages/protocol/src/policy.ts:57Nested element expansion depth bound for `renderToString`: cyclic component composition fails closed instead of recursing without end.
8packages/protocol/src/policy.ts:51Fetch middleware contract (#858): WinterCG shape, dialect-free — no Hono/h3 context object.
MiddlewareSource notes
Fetch middleware contract (#858): WinterCG shape, dialect-free — no Hono/h3 context object. Composed at the handler boundary in onion order (`use[0]` is outermost: it sees the request first and the response last), so it runs with identical semantics in the dev server, the `start` CLI, the e2e fixture server, and the Nitro production entry. A middleware may short-circuit by returning a Response without calling `next()`, or post-process the Response that `next()` returns. Module contract: a Middleware is the DEFAULT EXPORT of a module referenced from `middleware.use` by path (e.g. './app/middleware/auth.ts'). The generated server entry imports the module, so the middleware may close over module scope and import local helpers and third-party packages — it is a real module in the server module graph, never serialized source.
packages/protocol/src/framework.ts:169One middleware module the generated entry composes.
MiddlewareDeclOptions and source location
packages/protocol/src/ssg.ts:140The scope one middleware applies to (all routes or a named route set).
MiddlewareScopeDeclOptions and source location
packages/protocol/src/ssg.ts:279Describe a binding that the module scanner recognizes and the information it records for calls to that binding.
ModuleVocabularyDescriptorSource notes
One module-scan vocabulary entry the host admits: a binding identity (module specifier + exported name, aliases followed) plus the fact a canonical call of that binding contributes. Plain data — the scan consumes the descriptors without learning the caller's package vocabulary, the same direction as the compiler's {@link StaticSidecarDescriptor} admission (#1473 item 3).
packages/protocol/src/module-descriptors.ts:33The compiler-private field a render's host record carries the nested-host expander under (P-6, 2026-11-21).
"__oe_nestedHost"Source notes
The compiler-private field a render's host record carries the nested-host expander under (P-6, 2026-11-21). A generated component's SSR producer routes every custom-element tag through the runtime's ONE `nestedHost` helper, which reads the expander off this record. The LIGHT root's producer has always supplied it; the SHADOW host producer did not, so a shadow page's inner components stayed bare tags while the class lane and the light lane both expanded theirs. It lives in the protocol for the same reason the sheet keys above do: the COMPILER emits the record and the RUNTIME reads it, and the compiler must not depend on an element-internal subpath to spell it. One literal, two ends.
packages/protocol/src/style-sheet.ts:80One documented attribute of a custom element declaration.
OpenElementAttributeOptions and source location
packages/protocol/src/manifest.ts:15The optional blog content directory and URL base path in the build context.
OpenElementBlogOptionsSource notes
Blog options stored in the build context by
packages/protocol/src/framework.ts:37Minimal build context interface that sub-plugins can use.
OpenElementBuildContextLikeOptions and source location
packages/protocol/src/framework.ts:62One documented CSS part of a custom element declaration.
OpenElementCssPartOptions and source location
packages/protocol/src/manifest.ts:38One custom element declaration in a package manifest: tag, members and delivery metadata.
OpenElementDeclarationOptions and source location
packages/protocol/src/manifest.ts:116Framework error carrying a stable code, severity, phase and recoverability contract.
class OpenElementError extends Errorpackages/protocol/src/errors.ts:100Constructor options for {@linkcode OpenElementError}; every field is defaulted.
OpenElementErrorOptionsOptions and source location
packages/protocol/src/errors.ts:90One documented custom event of a custom element declaration.
OpenElementEventOptions and source location
packages/protocol/src/manifest.ts:25The openElement-specific extension block of a package manifest declaration.
OpenElementExtensionsOptions and source location
packages/protocol/src/manifest.ts:72Locale options stored in the build context by @openelement/i18n.
OpenElementI18nContextOptionsSource notes
i18n options stored in the build context by
packages/protocol/src/framework.ts:55Package manifest of component declarations (not a Custom Elements Manifest).
OpenElementPackageManifestOptions and source location
packages/protocol/src/manifest.ts:129The host-neutral request handler every runtime adapter and generated server entry exposes: a WinterCG `(request, context?)
OpenElementRequestHandler<Env>Source notes
The host-neutral request handler every runtime adapter and generated server entry exposes: a WinterCG `(request, context?) => Response` with no server engine dialect baked in.
packages/protocol/src/runtime.ts:27Host-agnostic route and asset contracts shared by app and build drivers.
OpenElementRouteKindpackages/protocol/src/app-model.ts:2One route tree entry, including the URL path, route kind, source, optional tag and params, and child routes.
OpenElementRouteNodeSource notes
One node of the host-agnostic route tree: the matched URL `path` and route kind, the source and module paths the drivers resolve, the optional registered tag and param names, and the nested `children`.
packages/protocol/src/app-model.ts:9One documented slot of a custom element declaration.
OpenElementSlotOptions and source location
packages/protocol/src/manifest.ts:32OpenElementTailwindDeclarationSource notes
A declaration's utility-compilation requirement and the package-owned style sources that requirement compiles (the declared-compilation contract; see the router's `style-plan` module for the resolution rules). `required` is the mandatory-compilation dependency: the component's presentation cannot be delivered without the compile, so an application that disables the entry (`tailwind: false`) fails the build with a coded diagnostic instead of shipping an unstyled component. Merely offering a theme source is NOT a requirement — leave `required` unset for a source a consumer may adopt on its own. `sources` are package-relative paths (e.g. `./theme.css`) resolved against THIS package, so a consumer never repeats the owner's declaration. They must exist in the installed package (i.e. ship in the tarball). `dialect` names the CLASS LANGUAGE this component's utility tokens are written in, not the engine that compiles them: the declaration stays provider-neutral, and a selected provider that does not implement the dialect fails the build before any compile. Omitted means `tailwind4` — the language every declaration written before this field existed uses.
packages/protocol/src/manifest.ts:65One page route declaration in the generated entry descriptor.
PageRouteDeclOptions and source location
packages/protocol/src/ssg.ts:172Parse one report off the wire.
(text: string): DiagnosticReportSource notes
Parse one report off the wire. Fails closed: truncated JSON, a foreign format tag, or any structurally broken diagnostic raises {@linkcode DiagnosticReportParseError} instead of returning a partial report a consumer might mistake for the truth.
packages/protocol/src/diagnostics.ts:193The Part Program IR version this package defines (currently v2).
2packages/protocol/src/part-program.ts:23The comment marker closing a part anchor in serialized program markup.
(index: number): stringOptions and source location
packages/protocol/src/part-program.ts:437Anchor marker payloads shared by seed runtime consumers.
(index: number): stringOptions and source location
packages/protocol/src/part-program.ts:432The serializable Part Program v2: one compiled component as data.
PartProgramV2Options and source location
packages/protocol/src/part-program.ts:429The one deterministic program consumed by all execution modes.
PartProgramV2Options and source location
packages/protocol/src/part-program.ts:409Media type of the RFC 9457 action error channel (#863).
"application/problem+json"packages/protocol/src/data.ts:117RFC 9457 response for action protocol errors. The media type is application/problem+json, and detail describes the failure.
ProblemDetailsSource notes
RFC 9457 Problem Details document (#863): the action error channel answers `application/problem+json` instead of the bespoke `{ type: 'error', error: { message } }` JSON, so HTTP tooling recognizes failures natively. With `type: 'about:blank'`, `title` is the HTTP reason phrase and `detail` carries the specific explanation. The wire shape is alpha-unfrozen; the 1.0 acceptance freezes it in this problem+json form.
packages/protocol/src/data.ts:105String attribute sink bound to a Signal.
ProgramAttrPartOptions and source location
packages/protocol/src/part-program.ts:154One block the program tracks: the boundaries of a dynamic subtree.
ProgramBlockRecordOptions and source location
packages/protocol/src/part-program.ts:342Boolean attribute sink bound to a Signal.
ProgramBoolPartOptions and source location
packages/protocol/src/part-program.ts:164Specialized fixed sinks make ownership explicit for class and style text.
ProgramClassPartOptions and source location
packages/protocol/src/part-program.ts:174One condition clause of a when part.
ProgramConditionOptions and source location
packages/protocol/src/part-program.ts:246One module dependency the compiled module graph records.
ProgramDependencyRecordOptions and source location
packages/protocol/src/part-program.ts:352A list part: repeats its template node per item of a bound signal.
ProgramEachPartOptions and source location
packages/protocol/src/part-program.ts:310A static element node of the program tree.
ProgramElementNodeOptions and source location
packages/protocol/src/part-program.ts:90Program-shape failures: a Part Program (or one of its records) is malformed, or carries a value the wire format cannot express.
{ readonly INVALID_PROGRAM: "OE_PROGRAM_INVALID"; readonly NOT_SERIALIZABLE: "OE_PROGRAM_NOT_SERIALIZABLE"; readonly INVALID_SLOT: "OE_PROGRAM_INVALID_SLOT"; readonly INVALID_SOURCE_SEGMENT: "OE_PROGRAM_INVALID_SOURCE_S…Source notes
Program-shape failures: a Part Program (or one of its records) is malformed, or carries a value the wire format cannot express. Phase `validation`: these reject data before any DOM work starts.
packages/protocol/src/errors.ts:141The action one event part dispatches.
ProgramEventActionpackages/protocol/src/part-program.ts:217An event binding part: listener wiring between DOM event and action.
ProgramEventPartOptions and source location
packages/protocol/src/part-program.ts:225Trusted-HTML content sink (alpha.9).
ProgramHtmlPartSource notes
Trusted-HTML content sink (alpha.9). The signal value must carry the runtime TrustedHtml capability; its HTML replaces the target element's content. The target's subtree is opaque to the claim path. The compiler emits this only for an explicit `innerHTML={this.<field>}` sink on an otherwise childless element — there is no implicit or discovery path to raw HTML.
packages/protocol/src/part-program.ts:199ProgramItemValueNodeSource notes
Item-value text slot; valid only inside an `each` item template. `field` names the item field rendered by this slot — multi-field item templates carry one slot per field, and the compiler always emits it.
packages/protocol/src/part-program.ts:123Exact compiler-owned location for one dynamic sink or range anchor.
ProgramLocationOptions and source location
packages/protocol/src/part-program.ts:76A location record also makes the identity auditable without inspecting parts.
ProgramLocationRecordpackages/protocol/src/part-program.ts:84The discriminated union of dynamic parts a program instantiates.
ProgramPartpackages/protocol/src/part-program.ts:328The anchor node marking where a part binds in the tree.
ProgramPartAnchorNodeOptions and source location
packages/protocol/src/part-program.ts:112Where a part sits relative to its anchor.
ProgramPositionOptions and source location
packages/protocol/src/part-program.ts:45DOM property sink bound to a Signal; `path` is retained for seed consumers.
ProgramPropPartOptions and source location
packages/protocol/src/part-program.ts:144A named ref slot is serializable; the generated class supplies the ref value.
ProgramRefPartOptions and source location
packages/protocol/src/part-program.ts:208The root of one program tree: element, part anchor, or text.
ProgramRootOptions and source location
packages/protocol/src/part-program.ts:29The kind of source record a program source map entry carries.
ProgramSourceKindpackages/protocol/src/part-program.ts:59The program source map: authored spans projected onto emitted records.
ProgramSourceMapOptions and source location
packages/protocol/src/part-program.ts:69A half-open [start, end) range into the authored source text.
ProgramSourceRangeOptions and source location
packages/protocol/src/part-program.ts:52One source-map record: the authored origin of one emitted node or part.
ProgramSourceRecordOptions and source location
packages/protocol/src/part-program.ts:62A style binding part.
ProgramStylePartOptions and source location
packages/protocol/src/part-program.ts:183A static text node of the program tree.
ProgramTextNodeOptions and source location
packages/protocol/src/part-program.ts:106A text interpolation part bound to one signal.
ProgramTextPartOptions and source location
packages/protocol/src/part-program.ts:136The discriminated union of static tree nodes.
ProgramTreeNodepackages/protocol/src/part-program.ts:129A conditional part: swaps template branches on a condition.
ProgramWhenPartOptions and source location
packages/protocol/src/part-program.ts:279The serialized value-type tag of a compiled property default.
PropertyValueTypepackages/protocol/src/part-program.ts:359Raise one framework failure and never return: the throwing companion of {@linkcode frameworkError}.
(phase: ErrorPhase, code: string, message: string): neverSource notes
Raise one framework failure and never return: the throwing companion of {@linkcode frameworkError}. The per-module `fail(code, message)` micro-factories bind their failure surface's fixed {@linkcode ErrorPhase} here — one implementation, the phase as a parameter — so a code and a phase cannot drift apart per throw site.
packages/protocol/src/errors.ts:396Elements whose text content must never be interpolated as markup.
ReadonlySet<string>packages/protocol/src/forbidden-sinks.ts:38Read-only signal protocol used by computed values.
ReadonlySignal<T>Options and source location
packages/protocol/src/signal.ts:26One page renderer module registration.
RendererDeclOptions and source location
packages/protocol/src/ssg.ts:271One render failure record the SSR pipeline reports.
RenderErrorOptions and source location
packages/protocol/src/render.ts:16The resolved layout for one plan slot: disabled (false) or a full declaration.
ResolvedLayoutpackages/protocol/src/ssg.ts:312How the compiled component attaches its root: light DOM or a shadow root.
RootModepackages/protocol/src/part-program.ts:26A discovered route’s URL, source, type, generated binding name, and optional custom element tag.
RouteEntrySource notes
One route admitted by the scanner: URL `path`, source `filePath`, the route `type`, the generated variable name (`varName`) the entry binds it to, and the optional registration tag. {@link RouteEntry.definePage} and {@link RouteEntry.hasEnhancedForms} carry the two source-derived admission facts the generated entries branch on.
packages/protocol/src/framework.ts:113A single route metadata entry emitted as `routeInfo` by the generated SSG entry module (see entry-render-ssg.ts).
RouteInfoEntryOptions and source location
packages/protocol/src/ssg.ts:395The module vocabulary router injects into `analyzeModuleSemantics`.
readonly ModuleVocabularyDescriptor[]packages/protocol/src/module-vocabulary.ts:17Whether the authored error prose is kept: `true` everywhere except a production client build, the one context that defines `OE_RUNTIME_MESSAGES` to `false`.
booleanSource notes
Whether the authored error prose is kept: `true` everywhere except a production client build, the one context that defines `OE_RUNTIME_MESSAGES` to `false`. Stripping is a payload decision, so it belongs to the browser bundle only — server-side failures keep their prose.
packages/protocol/src/errors.ts:72A host runtime adapter: exposes the fetch handler a server engine dispatches to.
RuntimeAdapter<Env>Options and source location
packages/protocol/src/runtime.ts:32Options one runtime adapter is constructed with.
RuntimeAdapterOptions<Env>Options and source location
packages/protocol/src/runtime.ts:39runtime.ts - Runtime adapter protocol.
RuntimeContext<Env>Source notes
runtime.ts - Runtime adapter protocol. Replacement boundary for Nitro, Workers, Node, Deno, or future fetch-compatible runtimes. Preserves openElement semantics while leaving concrete server engines outside this package.
packages/protocol/src/runtime.ts:9Runtime execution failures raised while a compiled program is serialized, built into fresh DOM, or re-read on a signal write (phase `render`).
{ readonly LIST_VALUE_NOT_ARRAY: "OE_RUNTIME_LIST_VALUE_NOT_ARRAY"; readonly HOST_SIGNAL_MISSING: "OE_RUNTIME_HOST_SIGNAL_MISSING"; readonly HOST_HANDLER_MISSING: "OE_RUNTIME_HOST_HANDLER_MISSING"; readonly HOST_REF_MIS…packages/protocol/src/errors.ts:172Branded type: a string that has been HTML-escaped (safe for text content)
SafeHtmlpackages/protocol/src/framework.ts:9The JSON-serializable value shape a compiled property default admits.
SerializableValuepackages/protocol/src/part-program.ts:36(manifest: ClientAssetManifest): stringSource notes
Serialize the manifest as the generated dist/server/client-assets.js module: pure structured data, no injection logic — consumers derive what they need from these values.
packages/protocol/src/client-assets.ts:68Serialize a report for the stream/file channel: one line, no trailing newline.
(report: DiagnosticReport): stringOptions and source location
packages/protocol/src/diagnostics.ts:114Compiled server/claim validation failures. The value shipped in 1.0.0-alpha.3 and is kept verbatim; `CompiledProgramValidationError` is its only raiser.
{ readonly PROGRAM_INVALID: "OPEN_ELEMENT_COMPILED_PROGRAM_INVALID"; readonly SINK_REFUSED: "OE_SERVER_SINK_REFUSED"; }packages/protocol/src/errors.ts:281Canonical request-time/SSG server route context.
ServerRouteContext<Env, Platform, Route>Options and source location
packages/protocol/src/data.ts:25Context passed to a request-time ('dynamic') route loader.
ServerRouteMetadataSource notes
Context passed to a request-time ('dynamic') route loader. This is the server contract: the loader runs on the server with the Web-standard request, matched route params, the host environment and the platform object, and signals validation failure via fail()/redirect().
packages/protocol/src/data.ts:19Alias for APIs that accept either writable or read-only signals.
Signal<T>packages/protocol/src/signal.ts:31Runtime/type brand for signals created by the configured reactive engine.
typeof SIGNAL_BRANDpackages/protocol/src/signal.ts:11Signal engine protocol used by the framework's built-in adapter.
SignalEngineSource notes
Signal engine protocol used by the framework's built-in adapter. This is a deliberate internal seam, not a public compatibility contract: the framework layer talks to signals only through this narrow interface so its call sites stay implementation-agnostic. The package ships and verifies exactly one engine implementation (`preact-engine`, backed by `@preact/signals-core`). Preact's own API is not Element public API, and arbitrary third-party engines are not promised; any future engine would be added behind this protocol rather than inline (charter decision — see #723).
packages/protocol/src/signal.ts:46Minimal signal-like object accepted by renderers and bindings.
SignalLike<T>Options and source location
packages/protocol/src/signal.ts:14Special file kinds the route scanner recognizes by filename: `renderer` and `middleware`.
SpecialFileTypepackages/protocol/src/framework.ts:79Speculation Rules configuration for SSG post-processing
SpeculationRulesOptionsOptions and source location
packages/protocol/src/ssg.ts:448User-facing SSG build behavior switches (OpenElementOptions['ssg']).
SsgBehaviorOptionsOptions and source location
packages/protocol/src/ssg.ts:63Per-page render diagnostics returned by renderRoute()
SsgPageOutputOptions and source location
packages/protocol/src/ssg.ts:368The per-build render evidence record the SSG engine emits for audit.
SsgRenderEvidenceOptions and source location
packages/protocol/src/ssg.ts:426Options passed to the shared SSG render pipeline.
SsgRenderOptionsOptions and source location
packages/protocol/src/ssg.ts:36Summary of an SSG render run, returned by ssgRender().
SsgRenderSummaryOptions and source location
packages/protocol/src/ssg.ts:72"__openElementGeneratedHosts"Source notes
Property on the SSR registry holding the generated-entry host pairing table (tag -> the compiler-emitted generated host renderer): written atomically by the registry guard together with the class registration (M11) and read by `@openelement/element`'s server serializer nested-composition seam. It lives on the registry (not on the class and not on the module namespace) for the same reasons the ownership markers do: one writer (the generated entry's guard), one reader (Element's serializer), no class static / suffix scan / runtime module-shape read, and the pairing survives vite dev SSR module re-evaluations together with the class it belongs to.
packages/protocol/src/registry-markers.ts:54Property on the SSR registry holding the TRUE original `define` method, captured before the generated entry installs its idempotent wrapper.
"__openElementOrigDefine"Source notes
Property on the SSR registry holding the TRUE original `define` method, captured before the generated entry installs its idempotent wrapper. The registry outlives vite dev SSR module re-evaluations, so without this the second evaluation would capture the already-wrapped `define` as its "original" and every forced re-registration would silently early-return through the previous wrapper (#952 dev re-evaluation).
packages/protocol/src/registry-markers.ts:40Marker property set to `true` on the SSR customElements stub. Readers must treat the marked registry as re-definable.
"__openElementSsrStub"packages/protocol/src/registry-markers.ts:22The build’s SSR verdict for a discovered tag, including its module, discovery source, render path, and reason.
SsrAdmissionDecisionSource notes
The build's admission verdict for one discovered tag: where the declaration lives (`modulePath`), how it was discovered (`source`), which render path it is admitted to, and the reason recorded for the manifest.
packages/protocol/src/render.ts:37The build-time SSR admission decisions per component tag.
SsrAdmissionPlanOptions and source location
packages/protocol/src/ssg.ts:253The server bundle facts the SSG engine consumes for stream rendering.
SsrBundlepackages/protocol/src/ssg.ts:417"data-oe-static-styles"Source notes
The one `<style>` element the server serializer emits as the first DSD template child when the class carries static styles (renderToString parity — pages never upgrade, so their styles must ship in the payload). The claim path skips exactly this marked node; a marked node on a style-less class is claim drift and fails closed.
packages/protocol/src/part-program.ts:448Build-host-only compiled component reached through a route's local import graph.
StaticComponentDeclSource notes
Build-host-only compiled component reached through a route's local import graph. These components participate in recursive SSR/SSG expansion but are not client islands and therefore add no hydration or browser entry.
packages/protocol/src/ssg.ts:217Identify a colocated static policy declaration for the element compiler.
StaticSidecarDescriptorSource notes
One static-sidecar descriptor the host injects into the element compiler: the admission granted is a colocated static policy statement (#1473 item 3, the static-sidecar admission pattern).
packages/protocol/src/module-descriptors.ts:16Where an island's resolved hydration strategy came from.
StrategySourcepackages/protocol/src/framework.ts:32Tags a deferred frame cannot safely install into an owned Part range: the browser installer rejects any frame whose markup carries one of these.
readonly ["script", "style", "template", "iframe", "object", "embed", "base", "meta", "link"]packages/protocol/src/stream-frame-policy.ts:26Schemes that make a URL attribute unsafe in a streamed frame.
RegExppackages/protocol/src/stream-frame-policy.ts:60URL-carrying attributes the frame check screens for script-bearing scheme obfuscation; only these attribute names are value-screened.
readonly ["href", "src", "action", "formaction", "xlink:href"]packages/protocol/src/stream-frame-policy.ts:42The highest control character code point removed before checking a URL scheme.
32Source notes
Control characters at or below this code point are stripped before the URL-scheme test, so tab/newline/control obfuscation cannot smuggle a scheme past admission.
packages/protocol/src/stream-frame-policy.ts:55Deferred fields (declared streamed properties) one stream route's manifest may carry.
32Source notes
Deferred fields (declared streamed properties) one stream route's manifest may carry. The build scan, the server executor, and the browser seed contract enforce the same bound.
packages/protocol/src/policy.ts:24Part/Block owners one stream route's manifest may address in total across all deferred fields.
64packages/protocol/src/policy.ts:30Serialized stream payload bound, as a string length in UTF-16 code units: one seed attribute or one deferred frame's markup may not exceed it.
numberSource notes
Serialized stream payload bound, as a string length in UTF-16 code units: one seed attribute or one deferred frame's markup may not exceed it. The server checks the JSON text and the rendered range before emitting; the browser checks the attribute before parsing.
packages/protocol/src/policy.ts:45Maximum number of typed properties the browser accepts in one streamed hydration seed.
64Source notes
Typed properties one streamed seed may carry: the browser seed contract rejects the WHOLE seed above this count, so an oversized component would silently fail to hydrate instead of failing loud at the server.
packages/protocol/src/policy.ts:37Milliseconds a streamed response waits for deferred fields before failing those still pending.
30000Source notes
Deferred-field resolution budget (milliseconds) for one streamed response: fields still pending when it expires are failed in place and the stream ends with the shell and whatever resolved.
packages/protocol/src/policy.ts:64Build-only route projection bound to a specific compiled page program.
StreamRouteManifestOptions and source location
packages/protocol/src/ssg.ts:13The one key marking a sheet whose bytes are a LIVE resource rather than an immutable one (alpha15 S lane, S-C1.3).
"__openElementStyleSheetLive"Source notes
The one key marking a sheet whose bytes are a LIVE resource rather than an immutable one (alpha15 S lane, S-C1.3). The dev server serves an authored sheet from a mutable endpoint that hot-updates: the sheet object is the copy the live resource re-fills through `replace()`, so every root that adopted it re-renders on an edit. A root whose serialized markup declares the same URL therefore still ADOPTS this sheet — the declarative `<link>` stays the first-paint / no-JavaScript delivery, and the adopted object is the one an edit reaches. Without that, a CSS-only edit could only be delivered by re-fetching the link, which is a DOM write this protocol does not perform. Production sheets never carry this key: their URL is content-addressed, so the link and the sheet can never disagree and one delivery is the whole story. Build-time and runtime cannot drift because the dev adapter generator interpolates this exact name.
packages/protocol/src/style-sheet.ts:64"__openElementStyleReady"Source notes
The one key under which a sheet carries its readiness promise: the generated client style adapter records it on the sheet it exports, and the element runtime reads the same key to hand styles to roots that are already connected. Build-time and runtime cannot drift because the adapter generator interpolates this exact name. The promise settles once. Fulfillment means the rules were installed through `replace()`; rejection carries the load or replacement failure and keeps its rejected state — an observer may attach its own catch, it must never convert the promise into a fulfilled one.
packages/protocol/src/style-sheet.ts:31"__openElementStyleSheetUrl"Source notes
The one key under which a sheet carries the URL of the external CSS resource that delivers its rules: the generated client style adapter records the emitted asset URL on the sheet it exports, and the element runtime compares it against the declarative `<link rel="stylesheet" data-oe-static-styles>` nodes an SSR/DSD template already carries (alpha15 S lane). A root whose serialized markup already references the sheet's URL keeps that link as the delivery and does NOT adopt a second constructable copy — one stylesheet resource, one delivery, no duplicate application. Build-time and runtime cannot drift because the adapter generator interpolates this exact name.
packages/protocol/src/style-sheet.ts:44Compiled-style application failures (phase `csr`).
{ readonly ADOPTED_STYLES_UNSUPPORTED: "OE_STYLES_ADOPTED_STYLES_UNSUPPORTED"; readonly SHEET_LOAD_FAILED: "OE_STYLES_SHEET_LOAD_FAILED"; readonly INVALID_STYLE_HREF: "OE_STYLES_INVALID_HREF"; readonly SHEET_RULES_UNREA…packages/protocol/src/errors.ts:239Minimal stylesheet contract (replaceSync + cssRules) satisfied by native and shim sheets.
StyleSheetLikeOptions and source location
packages/protocol/src/style-sheet.ts:14Cross-environment CSSStyleSheet abstraction.
StyleSheetRuleSource notes
Cross-environment CSSStyleSheet abstraction. In browsers this delegates to the native CSSStyleSheet API. In SSR runtimes it falls back to a minimal in-memory implementation that exposes the subset used by OpenElement and renderToString().
packages/protocol/src/style-sheet.ts:9Branded type: a string that is intentionally raw/untrusted HTML
UnsafeHtmlpackages/protocol/src/framework.ts:12Check whether a static attribute makes a streamed frame unsafe to install.
(name: string, value: string): booleanSource notes
Whether a static attribute (name/value as authored into the Part Program) makes a streamed frame unsafely installable: event-handler, seed-spoofing, and srcdoc names fail outright, and URL-carrying names fail when the entity-decoded, control-stripped value carries a script scheme.
packages/protocol/src/stream-frame-policy.ts:113Unsubscribe function returned by subscriptions and effects.
Unsubscribepackages/protocol/src/signal.ts:8Validate an unknown value as a Part Program v2.
(raw: unknown): asserts raw is PartProgramSource notes
Validate an unknown value as a Part Program v2. The validator is intentionally strict: unknown instruction kinds, missing ownership records and unsafe paths fail before a runtime can guess at their meaning.
packages/protocol/src/part-program.ts:911HTML void elements — the ONE canonical tag set for every serializer, validator, and compiler in the workspace (issue #1220, M4).
ReadonlySet<string>Source notes
HTML void elements — the ONE canonical tag set for every serializer, validator, and compiler in the workspace (issue #1220, M4). This module is import-free and host-free by design: it sits at the base of the module graph so the DOM runtime (internal/core/html-escape.ts), the Part Program exchange artifact (internal/protocol/part-program.ts), and the compiler semantic core can all consume the same definition without an import cycle or a second source of truth. Content is the full HTML Standard void-element list, `param` included. Do not redefine this set anywhere else; internal/core/html-escape.ts and internal/protocol/part-program.ts re-export it, and __tests__/void-tags-convergence.test.ts enforces the single owner.
packages/protocol/src/void-tags.ts:16Writable signal protocol used by openElement integrations.
WritableSignal<T>Options and source location
packages/protocol/src/signal.ts:21Host-agnostic route and asset contracts shared by app and build drivers.
OpenElementRouteKindpackages/protocol/src/app-model.ts:2One route tree entry, including the URL path, route kind, source, optional tag and params, and child routes.
OpenElementRouteNodeSource notes
One node of the host-agnostic route tree: the matched URL `path` and route kind, the source and module paths the drivers resolve, the optional registered tag and param names, and the nested `children`.
packages/protocol/src/app-model.ts:9The Phase 2 client build's delivery manifest, keyed by island identity.
ClientAssetManifestOptions and source location
packages/protocol/src/client-assets.ts:36The client asset one compile-time island identity resolves to.
ClientIslandAssetOptions and source location
packages/protocol/src/client-assets.ts:19The manifest a project without a client bundle carries.
ClientAssetManifestpackages/protocol/src/client-assets.ts:54(manifest: ClientAssetManifest): stringSource notes
Serialize the manifest as the generated dist/server/client-assets.js module: pure structured data, no injection logic — consumers derive what they need from these values.
packages/protocol/src/client-assets.ts:68Route action: handles form submissions for a page route.
Action<T, Env, Platform, Route>packages/protocol/src/data.ts:64Choose the form action response: true returns serialized data and enhance returns the full HTML used without JavaScript.
"x-openelement-action"Source notes
Request header selecting the action response channel: `true` marks a programmatic caller and selects the serialized ActionResult union; `enhance` marks the built-in morph enhancement and selects the same full-HTML responses the no-JS path receives.
packages/protocol/src/data.ts:125Context passed to a route action function (extends loader context).
ActionContext<Env, Platform, Route>Options and source location
packages/protocol/src/data.ts:47Wire shape returned to the JavaScript form-enhancement path.
ActionResult<Failure>Source notes
Wire shape returned to the JavaScript form-enhancement path. The no-JS path never sees this: it gets the equivalent semantics as plain HTTP (303 on success, 422 with the re-rendered form on validation failure, redirect/error as status codes). Success carries no data envelope. The application-loop contract makes a successful non-GET action answer 303 (PRG) — the framework never answers 200 with a rendered page, or with a success document, for a successful mutation — so the fetch channel answers `{ type: 'redirect' }` naming the PRG target and the authored return value is discarded by design. Success data travels the PRG target instead (query state the loader re-runs with, which the props projector then maps; see the router guide's "Form actions" section). The union previously declared a `{ type: 'success' }` member that no code path ever emitted — removed so the type matches the wire. Error outcomes (CSRF 403, unknown action 404, unparseable body 400, unexpected 500) are NOT part of this union: since #863 they answer RFC 9457 Problem Details with the PROBLEM_JSON_MEDIA_TYPE content type — see ProblemDetails.
packages/protocol/src/data.ts:92Route loader: fetches data for a page route.
Loader<T, Env, Platform, Route>packages/protocol/src/data.ts:56Context passed to a request-time ('dynamic') route loader.
LoaderContext<Env, Platform, Route>Options and source location
packages/protocol/src/data.ts:40Media type of the RFC 9457 action error channel (#863).
"application/problem+json"packages/protocol/src/data.ts:117RFC 9457 response for action protocol errors. The media type is application/problem+json, and detail describes the failure.
ProblemDetailsSource notes
RFC 9457 Problem Details document (#863): the action error channel answers `application/problem+json` instead of the bespoke `{ type: 'error', error: { message } }` JSON, so HTTP tooling recognizes failures natively. With `type: 'about:blank'`, `title` is the HTTP reason phrase and `detail` carries the specific explanation. The wire shape is alpha-unfrozen; the 1.0 acceptance freezes it in this problem+json form.
packages/protocol/src/data.ts:105Canonical request-time/SSG server route context.
ServerRouteContext<Env, Platform, Route>Options and source location
packages/protocol/src/data.ts:25Context passed to a request-time ('dynamic') route loader.
ServerRouteMetadataSource notes
Context passed to a request-time ('dynamic') route loader. This is the server contract: the loader runs on the server with the Web-standard request, matched route params, the host environment and the platform object, and signals validation failure via fail()/redirect().
packages/protocol/src/data.ts:19The `format` discriminator every report carries.
"openelement.diagnostics/1"Source notes
The `format` discriminator every report carries. Consumers branch on it instead of guessing: a future shape change mints a new tag rather than reinterpreting old bytes.
packages/protocol/src/diagnostics.ts:84DiagnosticEnvelopeSource notes
One machine-readable diagnostic: the producer's stable code, where the failure sits (`file`, `line`, `column` — absent when the producer has no source location, e.g. a configuration refusal), what happened (`message`), and when known, the fix (`hint`). `line`/`column` are 1-based, matching the diagnostics the compiler records from TypeScript source positions. Unknown envelope fields are tolerated on the wire (forward compat); the required core is exactly these fields.
packages/protocol/src/diagnostics.ts:60DiagnosticPhaseSource notes
The pipeline phase a diagnostic was raised in — the same vocabulary the error contract's {@linkcode ErrorPhase } uses, so a producer's code, phase and envelope cannot disagree about where a failure happened.
packages/protocol/src/diagnostics.ts:39Assemble the exit's report. `ok` derives from the diagnostics' severities, never from a caller's optimism: one `error` severity is enough to fail it.
(diagnostics: DiagnosticEnvelope[]): DiagnosticReportpackages/protocol/src/diagnostics.ts:105DiagnosticReportSource notes
One build exit's diagnostics: the format tag, whether the run is clean (`ok` is false the moment any diagnostic carries severity `error`), and every diagnostic the exit collected. This is the document the CLI writes to the stream and the diagnostics file — one aggregate containing every code.
packages/protocol/src/diagnostics.ts:95One format tag value (kept as a type for the report's `format` field).
"openelement.diagnostics/1"packages/protocol/src/diagnostics.ts:87Raised by {@linkcode parseDiagnosticReport} when the text is not a consumable report.
class DiagnosticReportParseError extends ErrorSource notes
Raised by {@linkcode parseDiagnosticReport} when the text is not a consumable report. Fail closed: a consumer that catches this knows the channel answered garbage — never a half-valid report.
packages/protocol/src/diagnostics.ts:123How severe one diagnostic is. `error` fails the build, `warning` reports a recoverable defect, `info` is reserved for advisories.
DiagnosticSeveritySource notes
How severe one diagnostic is. `error` fails the build, `warning` reports a recoverable defect, `info` is reserved for advisories. The build report's `ok` flag derives from this: any `error` diagnostic makes the report not-ok.
packages/protocol/src/diagnostics.ts:32Map the one error dialect ({@linkcode OpenElementError} — every producer's raiser goes through it) onto the envelope.
(error: OpenElementError, options?: { hint?: string; }): DiagnosticEnvelopeSource notes
Map the one error dialect ({@linkcode OpenElementError} — every producer's raiser goes through it) onto the envelope. The error's code, severity and phase ARE the envelope's; the message carries verbatim. Producers with a fix pass it as `hint`.
packages/protocol/src/diagnostics.ts:256Parse one report off the wire.
(text: string): DiagnosticReportSource notes
Parse one report off the wire. Fails closed: truncated JSON, a foreign format tag, or any structurally broken diagnostic raises {@linkcode DiagnosticReportParseError} instead of returning a partial report a consumer might mistake for the truth.
packages/protocol/src/diagnostics.ts:193Serialize a report for the stream/file channel: one line, no trailing newline.
(report: DiagnosticReport): stringOptions and source location
packages/protocol/src/diagnostics.ts:114Attribute/authoring-surface failures (phase `validation`).
{ readonly INVALID_TAG_NAME: "OE_INVALID_TAG_NAME"; readonly UNSAFE_META_ATTRIBUTE: "OE_UNSAFE_META_ATTRIBUTE"; readonly UNSAFE_ATTRIBUTE_NAME: "OE_UNSAFE_ATTRIBUTE_NAME"; readonly UNSAFE_URL_SINK: "OE_UNSAFE_URL_SINK";…packages/protocol/src/errors.ts:301Claim failures: the existing DOM does not match the program that would own it.
{ readonly STRUCTURE_MISMATCH: "OPEN_ELEMENT_COMPILED_CLAIM_MISMATCH"; readonly PRE_UPGRADE_EVENTS_INVALID: "OE_CLAIM_PRE_UPGRADE_EVENTS_INVALID"; readonly DYNAMIC_NODE_IN_STATIC_REGION: "OE_CLAIM_DYNAMIC_NODE_IN_STATIC…Source notes
Claim failures: the existing DOM does not match the program that would own it. The value shipped in 1.0.0-alpha.3 and is kept verbatim; consumers match on it, and `PartProgramHydrationError` is its only raiser.
packages/protocol/src/errors.ts:265Compiler (build-time) failures.
{ readonly DIAGNOSTICS: "OE_COMPILER_DIAGNOSTICS"; readonly INVALID_SOURCE: "OE_COMPILER_INVALID_SOURCE"; }Source notes
Compiler (build-time) failures. The per-diagnostic `OEC####` codes stay on each diagnostic; these classify the family so a build failure is catchable as one thing.
packages/protocol/src/errors.ts:293Community-context service lifecycle failures (phase `csr`).
{ readonly SERVICE_DISPOSED: "OE_CONTEXT_SERVICE_DISPOSED"; }packages/protocol/src/errors.ts:233Default code for {@linkcode RenderError }.
"RENDER_ERROR"Source notes
Default code for {@linkcode RenderError }. Deliberately NOT a member of {@linkcode ErrorCode}: that object is the scan target of the documentation site's error catalog, which requires every member to carry a phase/severity family rule. `RENDER_ERROR` is the pre-dialect value `RenderError` has always defaulted to — kept verbatim so callers that observe it keep working, and kept out of the catalogue because it is not a failure this package classifies, only a constructor default a caller may override.
packages/protocol/src/errors.ts:47Keyed-list identity failures.
{ readonly ITEM_NOT_A_RECORD: "OE_EACH_ITEM_NOT_A_RECORD"; readonly KEY_NOT_ROUND_TRIPPABLE: "OE_EACH_KEY_NOT_ROUND_TRIPPABLE"; readonly DUPLICATE_KEY: "OE_EACH_KEY_DUPLICATE"; }Source notes
Keyed-list identity failures. Shared by the server serializer and the client runtime (see `internal/compiled/each-key.ts`), so both executors reject the same data with the same code.
packages/protocol/src/errors.ts:159Error message prefix for all openElement errors.
"[openElement]"packages/protocol/src/errors.ts:50Well-known error code constants for reference. String values are always accepted.
{ readonly SSR_RENDER_ERROR: "SSR_RENDER_ERROR"; readonly BOUNDARY_CAUGHT: "BOUNDARY_CAUGHT"; readonly UNKNOWN: "UNKNOWN"; }packages/protocol/src/errors.ts:31The pipeline phase an error was raised in.
ErrorPhasepackages/protocol/src/errors.ts:80How severe a framework error is.
ErrorSeveritypackages/protocol/src/errors.ts:78Callback receiving every reported {@linkcode OpenElementError} for telemetry.
ErrorTelemetryHookpackages/protocol/src/errors.ts:132SSR/bootstrap failures raised by the public entries (phase `ssr` / `csr`).
{ readonly PROGRAM_MISSING: "OE_PROGRAM_MISSING"; readonly COMPOSITION_DEPTH: "OE_SSR_COMPOSITION_DEPTH"; readonly COMPUTED_FACTORY_MISSING: "OE_COMPUTED_FACTORY_MISSING"; readonly COMPUTED_READONLY: "OE_COMPUTED_READON…packages/protocol/src/errors.ts:328One framework failure: {@linkcode OpenElementError} with the caller's code and the phase/severity/recoverability that phase implies.
(code: string, message: string, options?: Omit<OpenElementErrorOptions, "code">): OpenElementErrorSource notes
One framework failure: {@linkcode OpenElementError} with the caller's code and the phase/severity/recoverability that phase implies. Every throw site in this package goes through this factory (or the `*ErrorCode` tables above) so a code, a phase and a recoverability answer cannot drift per site.
packages/protocol/src/errors.ts:375Element-lifecycle failures: the kernel was driven outside its contract (phase `csr`).
{ readonly DISPOSED: "OE_KERNEL_DISPOSED"; readonly TAG_MISMATCH: "OE_KERNEL_TAG_MISMATCH"; readonly CLAIM_EXECUTOR_MISSING: "OE_KERNEL_CLAIM_EXECUTOR_MISSING"; readonly ROOT_NOT_OWNED: "OE_KERNEL_ROOT_NOT_OWNED"; reado…packages/protocol/src/errors.ts:219Framework error carrying a stable code, severity, phase and recoverability contract.
class OpenElementError extends Errorpackages/protocol/src/errors.ts:100Constructor options for {@linkcode OpenElementError}; every field is defaulted.
OpenElementErrorOptionsOptions and source location
packages/protocol/src/errors.ts:90Program-shape failures: a Part Program (or one of its records) is malformed, or carries a value the wire format cannot express.
{ readonly INVALID_PROGRAM: "OE_PROGRAM_INVALID"; readonly NOT_SERIALIZABLE: "OE_PROGRAM_NOT_SERIALIZABLE"; readonly INVALID_SLOT: "OE_PROGRAM_INVALID_SLOT"; readonly INVALID_SOURCE_SEGMENT: "OE_PROGRAM_INVALID_SOURCE_S…Source notes
Program-shape failures: a Part Program (or one of its records) is malformed, or carries a value the wire format cannot express. Phase `validation`: these reject data before any DOM work starts.
packages/protocol/src/errors.ts:141Raise one framework failure and never return: the throwing companion of {@linkcode frameworkError}.
(phase: ErrorPhase, code: string, message: string): neverSource notes
Raise one framework failure and never return: the throwing companion of {@linkcode frameworkError}. The per-module `fail(code, message)` micro-factories bind their failure surface's fixed {@linkcode ErrorPhase} here — one implementation, the phase as a parameter — so a code and a phase cannot drift apart per throw site.
packages/protocol/src/errors.ts:396Whether the authored error prose is kept: `true` everywhere except a production client build, the one context that defines `OE_RUNTIME_MESSAGES` to `false`.
booleanSource notes
Whether the authored error prose is kept: `true` everywhere except a production client build, the one context that defines `OE_RUNTIME_MESSAGES` to `false`. Stripping is a payload decision, so it belongs to the browser bundle only — server-side failures keep their prose.
packages/protocol/src/errors.ts:72Runtime execution failures raised while a compiled program is serialized, built into fresh DOM, or re-read on a signal write (phase `render`).
{ readonly LIST_VALUE_NOT_ARRAY: "OE_RUNTIME_LIST_VALUE_NOT_ARRAY"; readonly HOST_SIGNAL_MISSING: "OE_RUNTIME_HOST_SIGNAL_MISSING"; readonly HOST_HANDLER_MISSING: "OE_RUNTIME_HOST_HANDLER_MISSING"; readonly HOST_REF_MIS…packages/protocol/src/errors.ts:172Compiled server/claim validation failures. The value shipped in 1.0.0-alpha.3 and is kept verbatim; `CompiledProgramValidationError` is its only raiser.
{ readonly PROGRAM_INVALID: "OPEN_ELEMENT_COMPILED_PROGRAM_INVALID"; readonly SINK_REFUSED: "OE_SERVER_SINK_REFUSED"; }packages/protocol/src/errors.ts:281Compiled-style application failures (phase `csr`).
{ readonly ADOPTED_STYLES_UNSUPPORTED: "OE_STYLES_ADOPTED_STYLES_UNSUPPORTED"; readonly SHEET_LOAD_FAILED: "OE_STYLES_SHEET_LOAD_FAILED"; readonly INVALID_STYLE_HREF: "OE_STYLES_INVALID_HREF"; readonly SHEET_RULES_UNREA…packages/protocol/src/errors.ts:239(str: string): stringSource notes
The one camelCase → kebab-case casing rule for custom-element attribute names, so `<x-el itemCount={5}>` round-trips as `item-count` on every boundary that derives an attribute name from a prop name: the compiler's property metadata, the SSR serializer, and the client attribute handling.
packages/protocol/src/forbidden-sinks.ts:95ReadonlySet<string>Source notes
Forbidden sink names — the ONE canonical deny list for every Part Program boundary: the compiler semantic core, the protocol validator (internal/protocol/part-program.ts), and the compiled server/claim validator (internal/compiled/server/shared.ts). This module is import-free and host-free by design (same base-of-graph contract as void-tags.ts): all consumers import it, so a new forbidden sink cannot be enforced on one boundary and missed on another. This module owns the named-sink deny lists and the attribute-name policy built on them (the one shared safe-attribute-name predicate and the one camelCase→kebab-case casing rule); consumers delegate so the boundary cannot diverge. The lists are fail closed and case-insensitive (attribute and property names are compared lowercase, matching the HTML parser's name folding): - `FORBIDDEN_ATTRIBUTE_NAMES`: attribute names that must never be a static attribute or an `attr`/`bool` sink. `srcdoc` smuggles a full HTML document past attribute escaping; `innerHTML` is admissible only through the dedicated trusted-HTML `html` Part, never as a plain attribute name. - `FORBIDDEN_PROPERTY_NAMES`: `prop` sink names that would re-prototype or re-construct the target element (prototype-pollution primitives). - `RAW_TEXT_TAGS`: raw-text elements are outside the compiled grammar — their content cannot be escaped by the serializer.
packages/protocol/src/forbidden-sinks.ts:28Property names the compiler refuses as @property declarations.
ReadonlySet<string>Source notes
Property names the compiler refuses as
packages/protocol/src/forbidden-sinks.ts:31Sink categories the canonical deny list classifies.
ForbiddenSinkKindpackages/protocol/src/forbidden-sinks.ts:41Return a human-readable reason when `name` is a forbidden sink of `kind`, or null when the name is admissible.
(kind: ForbiddenSinkKind, name: string): string | nullSource notes
Return a human-readable reason when `name` is a forbidden sink of `kind`, or null when the name is admissible. Unknown kinds fail closed with a reason instead of being waved through.
packages/protocol/src/forbidden-sinks.ts:48The one safe-attribute-name predicate (#1033, #602).
(name: string): booleanSource notes
The one safe-attribute-name predicate (#1033, #602). Attribute *names* are not escaped on any render path, so a name must be valid HTML attribute-name grammar (blocks quote/space injection), must not be an event handler (`on*`, case-insensitive), and must not be a forbidden sink (`innerhtml`/ `srcdoc` — case-insensitive). Every boundary that admits an attribute name — the compiler semantic core, the Part Program validator, the compiled server validator, and the SSR head/meta name checks — delegates here, so the rules cannot diverge per path.
packages/protocol/src/forbidden-sinks.ts:81Elements whose text content must never be interpolated as markup.
ReadonlySet<string>packages/protocol/src/forbidden-sinks.ts:38The scanner’s per-tag compatibility tier, reason, discovery source, and rendering and hydration facts.
CompatibilityClassificationSource notes
The per-tag verdict the compatibility scanner records: the tier a discovered tag was classified as, the human-readable `reason`, where the tag was found (`source`), and the SSR/DSD/hydration facts the verdict was derived from.
packages/protocol/src/framework.ts:347The tag’s build compatibility level: server-rendered, client-only, experimental, or rejected.
CompatibilityTierSource notes
How far a discovered tag may participate in the build: 'ssr-capable' renders and hydrates, 'client-only' ships to the browser without server output, 'experimental-dom' is admitted with a downgraded guarantee, and 'rejected' fails the build.
packages/protocol/src/framework.ts:340A component’s delivery layer: static DSD, interactive DSD, a client-only island, or light DOM.
ComponentLayerSource notes
The delivery layer a component belongs to: fully static DSD markup ('dsd-static'), DSD markup with a client island ('dsd-interactive'), a client-only island with no SSR output ('pure-island'), or a light-DOM element ('light-dom'). Recorded per component in the build manifest and consumed by the hydration scheduler.
packages/protocol/src/framework.ts:23FrameworkOptionsSource notes
The adapter-facing framework options: where routes and islands live, the default layout and named-layout declarations, the document `<html>`/head injection channels, and the request-time middleware switches. Every field is optional; the adapter applies its documented default. This is the type an application config file's default export is checked against, so the rendered option table and the actual config surface cannot drift.
packages/protocol/src/framework.ts:180Runtime list of supported hydration strategies; the single source of truth for the `HydrationStrategy` union.
readonly ["load", "idle", "visible", "only", "none"]Source notes
Runtime list of supported hydration strategies; the single source of truth for the `HydrationStrategy` union. Consumed by island/registry validation and re-exported from the element root for app and build adapters.
packages/protocol/src/framework.ts:28Island hydration trigger: 'load' | 'idle' | 'visible' | 'only'.
"load" | "idle" | "visible" | "only" | "none"packages/protocol/src/framework.ts:30Select the built-in layout, declare a custom layout with its module and props, or disable the layout.
LayoutConfigSource notes
Layout declaration: `false` disables the layout entirely, `'default'` uses the built-in layout, and the object form names a tag with the module path that defines it (`import`, resolved like a {@link FrameworkOptions.middleware.use } entry) plus the compiled layout properties the router injects per route.
packages/protocol/src/framework.ts:96Locale-aware resolved path contract.
LocalePathOptions and source location
packages/protocol/src/framework.ts:82Fetch middleware contract (#858): WinterCG shape, dialect-free — no Hono/h3 context object.
MiddlewareSource notes
Fetch middleware contract (#858): WinterCG shape, dialect-free — no Hono/h3 context object. Composed at the handler boundary in onion order (`use[0]` is outermost: it sees the request first and the response last), so it runs with identical semantics in the dev server, the `start` CLI, the e2e fixture server, and the Nitro production entry. A middleware may short-circuit by returning a Response without calling `next()`, or post-process the Response that `next()` returns. Module contract: a Middleware is the DEFAULT EXPORT of a module referenced from `middleware.use` by path (e.g. './app/middleware/auth.ts'). The generated server entry imports the module, so the middleware may close over module scope and import local helpers and third-party packages — it is a real module in the server module graph, never serialized source.
packages/protocol/src/framework.ts:169The optional blog content directory and URL base path in the build context.
OpenElementBlogOptionsSource notes
Blog options stored in the build context by
packages/protocol/src/framework.ts:37Minimal build context interface that sub-plugins can use.
OpenElementBuildContextLikeOptions and source location
packages/protocol/src/framework.ts:62Locale options stored in the build context by @openelement/i18n.
OpenElementI18nContextOptionsSource notes
i18n options stored in the build context by
packages/protocol/src/framework.ts:55A discovered route’s URL, source, type, generated binding name, and optional custom element tag.
RouteEntrySource notes
One route admitted by the scanner: URL `path`, source `filePath`, the route `type`, the generated variable name (`varName`) the entry binds it to, and the optional registration tag. {@link RouteEntry.definePage} and {@link RouteEntry.hasEnhancedForms} carry the two source-derived admission facts the generated entries branch on.
packages/protocol/src/framework.ts:113Branded type: a string that has been HTML-escaped (safe for text content)
SafeHtmlpackages/protocol/src/framework.ts:9Special file kinds the route scanner recognizes by filename: `renderer` and `middleware`.
SpecialFileTypepackages/protocol/src/framework.ts:79Where an island's resolved hydration strategy came from.
StrategySourcepackages/protocol/src/framework.ts:32Branded type: a string that is intentionally raw/untrusted HTML
UnsafeHtmlpackages/protocol/src/framework.ts:12Per-island delivery options (hydration strategy, SSR/DSD participation).
IslandOptionsOptions and source location
packages/protocol/src/island.ts:8Options for the build-time island source transform.
IslandTransformOptionsOptions and source location
packages/protocol/src/island.ts:42The island transform output: rewritten source plus extracted facts.
IslandTransformResultOptions and source location
packages/protocol/src/island.ts:64The static-sidecar descriptor router injects into the element compiler.
StaticSidecarDescriptorpackages/protocol/src/island-admission.ts:18The compatibility classification report for one custom element manifest.
CemCompatibilityReportOptions and source location
packages/protocol/src/manifest.ts:146The scanner’s per-tag compatibility tier, reason, discovery source, and rendering and hydration facts.
CompatibilityClassificationSource notes
The per-tag verdict the compatibility scanner records: the tier a discovered tag was classified as, the human-readable `reason`, where the tag was found (`source`), and the SSR/DSD/hydration facts the verdict was derived from.
packages/protocol/src/framework.ts:347The tag’s build compatibility level: server-rendered, client-only, experimental, or rejected.
CompatibilityTierSource notes
How far a discovered tag may participate in the build: 'ssr-capable' renders and hydrates, 'client-only' ships to the browser without server output, 'experimental-dom' is admitted with a downgraded guarantee, and 'rejected' fails the build.
packages/protocol/src/framework.ts:340One documented attribute of a custom element declaration.
OpenElementAttributeOptions and source location
packages/protocol/src/manifest.ts:15One documented CSS part of a custom element declaration.
OpenElementCssPartOptions and source location
packages/protocol/src/manifest.ts:38One custom element declaration in a package manifest: tag, members and delivery metadata.
OpenElementDeclarationOptions and source location
packages/protocol/src/manifest.ts:116One documented custom event of a custom element declaration.
OpenElementEventOptions and source location
packages/protocol/src/manifest.ts:25The openElement-specific extension block of a package manifest declaration.
OpenElementExtensionsOptions and source location
packages/protocol/src/manifest.ts:72Package manifest of component declarations (not a Custom Elements Manifest).
OpenElementPackageManifestOptions and source location
packages/protocol/src/manifest.ts:129One documented slot of a custom element declaration.
OpenElementSlotOptions and source location
packages/protocol/src/manifest.ts:32OpenElementTailwindDeclarationSource notes
A declaration's utility-compilation requirement and the package-owned style sources that requirement compiles (the declared-compilation contract; see the router's `style-plan` module for the resolution rules). `required` is the mandatory-compilation dependency: the component's presentation cannot be delivered without the compile, so an application that disables the entry (`tailwind: false`) fails the build with a coded diagnostic instead of shipping an unstyled component. Merely offering a theme source is NOT a requirement — leave `required` unset for a source a consumer may adopt on its own. `sources` are package-relative paths (e.g. `./theme.css`) resolved against THIS package, so a consumer never repeats the owner's declaration. They must exist in the installed package (i.e. ship in the tarball). `dialect` names the CLASS LANGUAGE this component's utility tokens are written in, not the engine that compiles them: the declaration stays provider-neutral, and a selected provider that does not implement the dialect fails the build before any compile. Omitted means `tailwind4` — the language every declaration written before this field existed uses.
packages/protocol/src/manifest.ts:65Describe a binding that the module scanner recognizes and the information it records for calls to that binding.
ModuleVocabularyDescriptorSource notes
One module-scan vocabulary entry the host admits: a binding identity (module specifier + exported name, aliases followed) plus the fact a canonical call of that binding contributes. Plain data — the scan consumes the descriptors without learning the caller's package vocabulary, the same direction as the compiler's {@link StaticSidecarDescriptor} admission (#1473 item 3).
packages/protocol/src/module-descriptors.ts:33Identify a colocated static policy declaration for the element compiler.
StaticSidecarDescriptorSource notes
One static-sidecar descriptor the host injects into the element compiler: the admission granted is a colocated static policy statement (#1473 item 3, the static-sidecar admission pattern).
packages/protocol/src/module-descriptors.ts:16The module vocabulary router injects into `analyzeModuleSemantics`.
readonly ModuleVocabularyDescriptor[]packages/protocol/src/module-vocabulary.ts:17One property entry of the compiled custom-elements-manifest metadata.
CemPropertyMetadataOptions and source location
packages/protocol/src/part-program.ts:381The compiled custom-elements-manifest metadata block of one component.
CompiledCemMetadataOptions and source location
packages/protocol/src/part-program.ts:390The compiled element metadata the program carries for tooling consumers.
CompiledElementMetadataOptions and source location
packages/protocol/src/part-program.ts:399The name, type, and reflection metadata for one compiled @property declaration.
CompiledPropertyMetadataSource notes
One compiled
packages/protocol/src/part-program.ts:362Operator/literal compatibility for when-Block tests (issue #1372).
(op: unknown, value: unknown): booleanSource notes
Operator/literal compatibility for when-Block tests (issue #1372). Both wire validators (this module and the server serializer's shared validator) close the space through this one predicate: - ordering operators require a finite numeric literal; - `equals`/`not-equals` admit a finite number, string, or boolean; - `truthy` admits exactly `true` or `false` (the recorded expectation).
packages/protocol/src/part-program.ts:260The comparison operators a program condition supports.
ConditionOperatorpackages/protocol/src/part-program.ts:236Internal SSR provenance marker on light-mode host tags (#1148).
"data-oe-light"Source notes
Internal SSR provenance marker on light-mode host tags (#1148). Present only when the host's light subtree was server-rendered under the in-place activation contract: the client binds the existing DOM instead of clearing it, and a parent's activation walk prunes the nested host's subtree. Client rendering never writes it and it is never removed. The writer (internal/compiled/server) and readers (internal/compiled/runtime) import this constant; nothing writes the literal.
packages/protocol/src/part-program.ts:459The wire-validator face of the one canonical attribute-name predicate (delegates to `./forbidden-sinks.ts`); exported for parity tests.
(value: unknown): value is stringpackages/protocol/src/part-program.ts:501An event binding scoped to each item of an `each` block.
ItemEventBindingSource notes
An event binding scoped to each item of an `each` block. The runtime attaches this listener to every item root node created by the block, making per-item handlers (onClick={this.select(row.id)}) expressible without fixed-path event parts.
packages/protocol/src/part-program.ts:295The Part Program IR version this package defines (currently v2).
2packages/protocol/src/part-program.ts:23The comment marker closing a part anchor in serialized program markup.
(index: number): stringOptions and source location
packages/protocol/src/part-program.ts:437Anchor marker payloads shared by seed runtime consumers.
(index: number): stringOptions and source location
packages/protocol/src/part-program.ts:432The serializable Part Program v2: one compiled component as data.
PartProgramV2Options and source location
packages/protocol/src/part-program.ts:429The one deterministic program consumed by all execution modes.
PartProgramV2Options and source location
packages/protocol/src/part-program.ts:409String attribute sink bound to a Signal.
ProgramAttrPartOptions and source location
packages/protocol/src/part-program.ts:154One block the program tracks: the boundaries of a dynamic subtree.
ProgramBlockRecordOptions and source location
packages/protocol/src/part-program.ts:342Boolean attribute sink bound to a Signal.
ProgramBoolPartOptions and source location
packages/protocol/src/part-program.ts:164Specialized fixed sinks make ownership explicit for class and style text.
ProgramClassPartOptions and source location
packages/protocol/src/part-program.ts:174One condition clause of a when part.
ProgramConditionOptions and source location
packages/protocol/src/part-program.ts:246One module dependency the compiled module graph records.
ProgramDependencyRecordOptions and source location
packages/protocol/src/part-program.ts:352A list part: repeats its template node per item of a bound signal.
ProgramEachPartOptions and source location
packages/protocol/src/part-program.ts:310A static element node of the program tree.
ProgramElementNodeOptions and source location
packages/protocol/src/part-program.ts:90The action one event part dispatches.
ProgramEventActionpackages/protocol/src/part-program.ts:217An event binding part: listener wiring between DOM event and action.
ProgramEventPartOptions and source location
packages/protocol/src/part-program.ts:225Trusted-HTML content sink (alpha.9).
ProgramHtmlPartSource notes
Trusted-HTML content sink (alpha.9). The signal value must carry the runtime TrustedHtml capability; its HTML replaces the target element's content. The target's subtree is opaque to the claim path. The compiler emits this only for an explicit `innerHTML={this.<field>}` sink on an otherwise childless element — there is no implicit or discovery path to raw HTML.
packages/protocol/src/part-program.ts:199ProgramItemValueNodeSource notes
Item-value text slot; valid only inside an `each` item template. `field` names the item field rendered by this slot — multi-field item templates carry one slot per field, and the compiler always emits it.
packages/protocol/src/part-program.ts:123Exact compiler-owned location for one dynamic sink or range anchor.
ProgramLocationOptions and source location
packages/protocol/src/part-program.ts:76A location record also makes the identity auditable without inspecting parts.
ProgramLocationRecordpackages/protocol/src/part-program.ts:84The discriminated union of dynamic parts a program instantiates.
ProgramPartpackages/protocol/src/part-program.ts:328The anchor node marking where a part binds in the tree.
ProgramPartAnchorNodeOptions and source location
packages/protocol/src/part-program.ts:112Where a part sits relative to its anchor.
ProgramPositionOptions and source location
packages/protocol/src/part-program.ts:45DOM property sink bound to a Signal; `path` is retained for seed consumers.
ProgramPropPartOptions and source location
packages/protocol/src/part-program.ts:144A named ref slot is serializable; the generated class supplies the ref value.
ProgramRefPartOptions and source location
packages/protocol/src/part-program.ts:208The root of one program tree: element, part anchor, or text.
ProgramRootOptions and source location
packages/protocol/src/part-program.ts:29The kind of source record a program source map entry carries.
ProgramSourceKindpackages/protocol/src/part-program.ts:59The program source map: authored spans projected onto emitted records.
ProgramSourceMapOptions and source location
packages/protocol/src/part-program.ts:69A half-open [start, end) range into the authored source text.
ProgramSourceRangeOptions and source location
packages/protocol/src/part-program.ts:52One source-map record: the authored origin of one emitted node or part.
ProgramSourceRecordOptions and source location
packages/protocol/src/part-program.ts:62A style binding part.
ProgramStylePartOptions and source location
packages/protocol/src/part-program.ts:183A static text node of the program tree.
ProgramTextNodeOptions and source location
packages/protocol/src/part-program.ts:106A text interpolation part bound to one signal.
ProgramTextPartOptions and source location
packages/protocol/src/part-program.ts:136The discriminated union of static tree nodes.
ProgramTreeNodepackages/protocol/src/part-program.ts:129A conditional part: swaps template branches on a condition.
ProgramWhenPartOptions and source location
packages/protocol/src/part-program.ts:279The serialized value-type tag of a compiled property default.
PropertyValueTypepackages/protocol/src/part-program.ts:359How the compiled component attaches its root: light DOM or a shadow root.
RootModepackages/protocol/src/part-program.ts:26The JSON-serializable value shape a compiled property default admits.
SerializableValuepackages/protocol/src/part-program.ts:36"data-oe-static-styles"Source notes
The one `<style>` element the server serializer emits as the first DSD template child when the class carries static styles (renderToString parity — pages never upgrade, so their styles must ship in the payload). The claim path skips exactly this marked node; a marked node on a style-less class is claim drift and fails closed.
packages/protocol/src/part-program.ts:448Validate an unknown value as a Part Program v2.
(raw: unknown): asserts raw is PartProgramSource notes
Validate an unknown value as a Part Program v2. The validator is intentionally strict: unknown instruction kinds, missing ownership records and unsafe paths fail before a runtime can guess at their meaning.
packages/protocol/src/part-program.ts:911HTML void elements — the ONE canonical tag set for every serializer, validator, and compiler in the workspace (issue #1220, M4).
ReadonlySet<string>Source notes
HTML void elements — the ONE canonical tag set for every serializer, validator, and compiler in the workspace (issue #1220, M4). This module is import-free and host-free by design: it sits at the base of the module graph so the DOM runtime (internal/core/html-escape.ts), the Part Program exchange artifact (internal/protocol/part-program.ts), and the compiler semantic core can all consume the same definition without an import cycle or a second source of truth. Content is the full HTML Standard void-element list, `param` included. Do not redefine this set anywhere else; internal/core/html-escape.ts and internal/protocol/part-program.ts re-export it, and __tests__/void-tags-convergence.test.ts enforces the single owner.
packages/protocol/src/void-tags.ts:16Idle-hydration scheduling fallback (milliseconds) when neither `requestIdleCallback` nor `requestAnimationFrame` is available.
50packages/protocol/src/policy.ts:70Request-body bound (bytes) the generated entry applies to action POST routes; larger uploads belong on API routes with explicit limits.
numberpackages/protocol/src/policy.ts:57Nested element expansion depth bound for `renderToString`: cyclic component composition fails closed instead of recursing without end.
8packages/protocol/src/policy.ts:51Deferred fields (declared streamed properties) one stream route's manifest may carry.
32Source notes
Deferred fields (declared streamed properties) one stream route's manifest may carry. The build scan, the server executor, and the browser seed contract enforce the same bound.
packages/protocol/src/policy.ts:24Part/Block owners one stream route's manifest may address in total across all deferred fields.
64packages/protocol/src/policy.ts:30Serialized stream payload bound, as a string length in UTF-16 code units: one seed attribute or one deferred frame's markup may not exceed it.
numberSource notes
Serialized stream payload bound, as a string length in UTF-16 code units: one seed attribute or one deferred frame's markup may not exceed it. The server checks the JSON text and the rendered range before emitting; the browser checks the attribute before parsing.
packages/protocol/src/policy.ts:45Maximum number of typed properties the browser accepts in one streamed hydration seed.
64Source notes
Typed properties one streamed seed may carry: the browser seed contract rejects the WHOLE seed above this count, so an oversized component would silently fail to hydrate instead of failing loud at the server.
packages/protocol/src/policy.ts:37Milliseconds a streamed response waits for deferred fields before failing those still pending.
30000Source notes
Deferred-field resolution budget (milliseconds) for one streamed response: fields still pending when it expires are failed in place and the stream ends with the shell and whatever resolved.
packages/protocol/src/policy.ts:64"__openEntryDefined"Source notes
Property on the stub holding the generated entry's registration-ownership map (tag -> class it registered): a route module that self-registers its tag wins over the entry's registration, and on dev re-evaluation a fresh self-registered class must still win (#952).
packages/protocol/src/registry-markers.ts:30"__openElementGeneratedHosts"Source notes
Property on the SSR registry holding the generated-entry host pairing table (tag -> the compiler-emitted generated host renderer): written atomically by the registry guard together with the class registration (M11) and read by `@openelement/element`'s server serializer nested-composition seam. It lives on the registry (not on the class and not on the module namespace) for the same reasons the ownership markers do: one writer (the generated entry's guard), one reader (Element's serializer), no class static / suffix scan / runtime module-shape read, and the pairing survives vite dev SSR module re-evaluations together with the class it belongs to.
packages/protocol/src/registry-markers.ts:54Property on the SSR registry holding the TRUE original `define` method, captured before the generated entry installs its idempotent wrapper.
"__openElementOrigDefine"Source notes
Property on the SSR registry holding the TRUE original `define` method, captured before the generated entry installs its idempotent wrapper. The registry outlives vite dev SSR module re-evaluations, so without this the second evaluation would capture the already-wrapped `define` as its "original" and every forced re-registration would silently early-return through the previous wrapper (#952 dev re-evaluation).
packages/protocol/src/registry-markers.ts:40Marker property set to `true` on the SSR customElements stub. Readers must treat the marked registry as re-definable.
"__openElementSsrStub"packages/protocol/src/registry-markers.ts:22The hydration delivery hint a component or route carries.
HydrationHintOptions and source location
packages/protocol/src/render.ts:26One render failure record the SSR pipeline reports.
RenderErrorOptions and source location
packages/protocol/src/render.ts:16The build’s SSR verdict for a discovered tag, including its module, discovery source, render path, and reason.
SsrAdmissionDecisionSource notes
The build's admission verdict for one discovered tag: where the declaration lives (`modulePath`), how it was discovered (`source`), which render path it is admitted to, and the reason recorded for the manifest.
packages/protocol/src/render.ts:37The host-neutral request handler every runtime adapter and generated server entry exposes: a WinterCG `(request, context?)
OpenElementRequestHandler<Env>Source notes
The host-neutral request handler every runtime adapter and generated server entry exposes: a WinterCG `(request, context?) => Response` with no server engine dialect baked in.
packages/protocol/src/runtime.ts:27A host runtime adapter: exposes the fetch handler a server engine dispatches to.
RuntimeAdapter<Env>Options and source location
packages/protocol/src/runtime.ts:32Options one runtime adapter is constructed with.
RuntimeAdapterOptions<Env>Options and source location
packages/protocol/src/runtime.ts:39runtime.ts - Runtime adapter protocol.
RuntimeContext<Env>Source notes
runtime.ts - Runtime adapter protocol. Replacement boundary for Nitro, Workers, Node, Deno, or future fetch-compatible runtimes. Preserves openElement semantics while leaving concrete server engines outside this package.
packages/protocol/src/runtime.ts:9Read-only signal protocol used by computed values.
ReadonlySignal<T>Options and source location
packages/protocol/src/signal.ts:26Alias for APIs that accept either writable or read-only signals.
Signal<T>packages/protocol/src/signal.ts:31Runtime/type brand for signals created by the configured reactive engine.
typeof SIGNAL_BRANDpackages/protocol/src/signal.ts:11Signal engine protocol used by the framework's built-in adapter.
SignalEngineSource notes
Signal engine protocol used by the framework's built-in adapter. This is a deliberate internal seam, not a public compatibility contract: the framework layer talks to signals only through this narrow interface so its call sites stay implementation-agnostic. The package ships and verifies exactly one engine implementation (`preact-engine`, backed by `@preact/signals-core`). Preact's own API is not Element public API, and arbitrary third-party engines are not promised; any future engine would be added behind this protocol rather than inline (charter decision — see #723).
packages/protocol/src/signal.ts:46Minimal signal-like object accepted by renderers and bindings.
SignalLike<T>Options and source location
packages/protocol/src/signal.ts:14Unsubscribe function returned by subscriptions and effects.
Unsubscribepackages/protocol/src/signal.ts:8Writable signal protocol used by openElement integrations.
WritableSignal<T>Options and source location
packages/protocol/src/signal.ts:21One API route declaration in the generated entry descriptor.
ApiRouteDeclOptions and source location
packages/protocol/src/ssg.ts:163Result returned by the OpenElement build pipeline.
BuildArtifactsOptions and source location
packages/protocol/src/ssg.ts:565A single client asset emitted by the build pipeline.
BuildClientAssetOptions and source location
packages/protocol/src/ssg.ts:558i18n configuration for the build pipeline.
BuildI18nOptionsOptions and source location
packages/protocol/src/ssg.ts:511A single island input to the build pipeline.
BuildIslandInputOptions and source location
packages/protocol/src/ssg.ts:492Manifest produced by the build pipeline.
BuildManifestArtifactOptions and source location
packages/protocol/src/ssg.ts:547Output configuration for the build pipeline.
BuildOutputOptionsOptions and source location
packages/protocol/src/ssg.ts:501Package island configuration for the build pipeline.
BuildPackageIslandOptionsOptions and source location
packages/protocol/src/ssg.ts:517A single generated HTML page artifact.
BuildPageArtifactOptions and source location
packages/protocol/src/ssg.ts:539Framework-agnostic plan consumed by the OpenElement build pipeline.
BuildPlanOptions and source location
packages/protocol/src/ssg.ts:523A single route input to the build pipeline.
BuildRouteInputOptions and source location
packages/protocol/src/ssg.ts:474Client island entry shape passed to entry generator.
ClientIslandEntryOptions and source location
packages/protocol/src/ssg.ts:105The CORS origin policy an API route declares.
CorsOriginConfigpackages/protocol/src/ssg.ts:130The content-security-policy directives a route or document declares.
CspConfigOptions and source location
packages/protocol/src/ssg.ts:133The document-level facts a build bakes into the generated entry.
DocumentConfigOptions and source location
packages/protocol/src/ssg.ts:286The full build-time description of one generated entry: routes, islands, renderers, middleware, document, and layout plans.
EntryDescriptorOptions and source location
packages/protocol/src/ssg.ts:321One module import the generated entry emits.
ImportDeclOptions and source location
packages/protocol/src/ssg.ts:123One island the build admits: tag, module path, and delivery facts.
IslandDeclOptions and source location
packages/protocol/src/ssg.ts:195Adapter-owned browser delivery strategy, including media-query admission.
IslandDeliveryStrategypackages/protocol/src/ssg.ts:31Shared island module identity (CL-3 convergence: one base, three shapes).
IslandModuleIdentitySource notes
Shared island module identity (CL-3 convergence: one base, three shapes). Every island record names the same module the same way — the tag it registers as, the module path that owns it, and whether that module is a package (CEM-derived named export) rather than a local file (default export) — so a rename of the identity touches one declaration, not three. The delivery-strategy fields intentionally stay per-shape (`strategy` on the client entry vs `hydrate` on the build decls): they are different stages' vocabularies, not one field spelled two ways.
packages/protocol/src/ssg.ts:98The layout module a build resolves: tag, import path, and serialized props.
LayoutDeclOptions and source location
packages/protocol/src/ssg.ts:294The resolved layouts a build ships: the default layout plus named layouts.
LayoutPlanOptions and source location
packages/protocol/src/ssg.ts:315One middleware module the generated entry composes.
MiddlewareDeclOptions and source location
packages/protocol/src/ssg.ts:140The scope one middleware applies to (all routes or a named route set).
MiddlewareScopeDeclOptions and source location
packages/protocol/src/ssg.ts:279One page route declaration in the generated entry descriptor.
PageRouteDeclOptions and source location
packages/protocol/src/ssg.ts:172One page renderer module registration.
RendererDeclOptions and source location
packages/protocol/src/ssg.ts:271The resolved layout for one plan slot: disabled (false) or a full declaration.
ResolvedLayoutpackages/protocol/src/ssg.ts:312A single route metadata entry emitted as `routeInfo` by the generated SSG entry module (see entry-render-ssg.ts).
RouteInfoEntryOptions and source location
packages/protocol/src/ssg.ts:395Speculation Rules configuration for SSG post-processing
SpeculationRulesOptionsOptions and source location
packages/protocol/src/ssg.ts:448User-facing SSG build behavior switches (OpenElementOptions['ssg']).
SsgBehaviorOptionsOptions and source location
packages/protocol/src/ssg.ts:63Per-page render diagnostics returned by renderRoute()
SsgPageOutputOptions and source location
packages/protocol/src/ssg.ts:368The per-build render evidence record the SSG engine emits for audit.
SsgRenderEvidenceOptions and source location
packages/protocol/src/ssg.ts:426Options passed to the shared SSG render pipeline.
SsgRenderOptionsOptions and source location
packages/protocol/src/ssg.ts:36Summary of an SSG render run, returned by ssgRender().
SsgRenderSummaryOptions and source location
packages/protocol/src/ssg.ts:72The build-time SSR admission decisions per component tag.
SsrAdmissionPlanOptions and source location
packages/protocol/src/ssg.ts:253The server bundle facts the SSG engine consumes for stream rendering.
SsrBundlepackages/protocol/src/ssg.ts:417Build-host-only compiled component reached through a route's local import graph.
StaticComponentDeclSource notes
Build-host-only compiled component reached through a route's local import graph. These components participate in recursive SSR/SSG expansion but are not client islands and therefore add no hydration or browser entry.
packages/protocol/src/ssg.ts:217Build-only route projection bound to a specific compiled page program.
StreamRouteManifestOptions and source location
packages/protocol/src/ssg.ts:13Tags a deferred frame cannot safely install into an owned Part range: the browser installer rejects any frame whose markup carries one of these.
readonly ["script", "style", "template", "iframe", "object", "embed", "base", "meta", "link"]packages/protocol/src/stream-frame-policy.ts:26Schemes that make a URL attribute unsafe in a streamed frame.
RegExppackages/protocol/src/stream-frame-policy.ts:60URL-carrying attributes the frame check screens for script-bearing scheme obfuscation; only these attribute names are value-screened.
readonly ["href", "src", "action", "formaction", "xlink:href"]packages/protocol/src/stream-frame-policy.ts:42The highest control character code point removed before checking a URL scheme.
32Source notes
Control characters at or below this code point are stripped before the URL-scheme test, so tab/newline/control obfuscation cannot smuggle a scheme past admission.
packages/protocol/src/stream-frame-policy.ts:55Check whether a static attribute makes a streamed frame unsafe to install.
(name: string, value: string): booleanSource notes
Whether a static attribute (name/value as authored into the Part Program) makes a streamed frame unsafely installable: event-handler, seed-spoofing, and srcdoc names fail outright, and URL-carrying names fail when the entity-decoded, control-stripped value carries a script scheme.
packages/protocol/src/stream-frame-policy.ts:113The compiler-private field a render's host record carries the nested-host expander under (P-6, 2026-11-21).
"__oe_nestedHost"Source notes
The compiler-private field a render's host record carries the nested-host expander under (P-6, 2026-11-21). A generated component's SSR producer routes every custom-element tag through the runtime's ONE `nestedHost` helper, which reads the expander off this record. The LIGHT root's producer has always supplied it; the SHADOW host producer did not, so a shadow page's inner components stayed bare tags while the class lane and the light lane both expanded theirs. It lives in the protocol for the same reason the sheet keys above do: the COMPILER emits the record and the RUNTIME reads it, and the compiler must not depend on an element-internal subpath to spell it. One literal, two ends.
packages/protocol/src/style-sheet.ts:80The one key marking a sheet whose bytes are a LIVE resource rather than an immutable one (alpha15 S lane, S-C1.3).
"__openElementStyleSheetLive"Source notes
The one key marking a sheet whose bytes are a LIVE resource rather than an immutable one (alpha15 S lane, S-C1.3). The dev server serves an authored sheet from a mutable endpoint that hot-updates: the sheet object is the copy the live resource re-fills through `replace()`, so every root that adopted it re-renders on an edit. A root whose serialized markup declares the same URL therefore still ADOPTS this sheet — the declarative `<link>` stays the first-paint / no-JavaScript delivery, and the adopted object is the one an edit reaches. Without that, a CSS-only edit could only be delivered by re-fetching the link, which is a DOM write this protocol does not perform. Production sheets never carry this key: their URL is content-addressed, so the link and the sheet can never disagree and one delivery is the whole story. Build-time and runtime cannot drift because the dev adapter generator interpolates this exact name.
packages/protocol/src/style-sheet.ts:64"__openElementStyleReady"Source notes
The one key under which a sheet carries its readiness promise: the generated client style adapter records it on the sheet it exports, and the element runtime reads the same key to hand styles to roots that are already connected. Build-time and runtime cannot drift because the adapter generator interpolates this exact name. The promise settles once. Fulfillment means the rules were installed through `replace()`; rejection carries the load or replacement failure and keeps its rejected state — an observer may attach its own catch, it must never convert the promise into a fulfilled one.
packages/protocol/src/style-sheet.ts:31"__openElementStyleSheetUrl"Source notes
The one key under which a sheet carries the URL of the external CSS resource that delivers its rules: the generated client style adapter records the emitted asset URL on the sheet it exports, and the element runtime compares it against the declarative `<link rel="stylesheet" data-oe-static-styles>` nodes an SSR/DSD template already carries (alpha15 S lane). A root whose serialized markup already references the sheet's URL keeps that link as the delivery and does NOT adopt a second constructable copy — one stylesheet resource, one delivery, no duplicate application. Build-time and runtime cannot drift because the adapter generator interpolates this exact name.
packages/protocol/src/style-sheet.ts:44Minimal stylesheet contract (replaceSync + cssRules) satisfied by native and shim sheets.
StyleSheetLikeOptions and source location
packages/protocol/src/style-sheet.ts:14Cross-environment CSSStyleSheet abstraction.
StyleSheetRuleSource notes
Cross-environment CSSStyleSheet abstraction. In browsers this delegates to the native CSSStyleSheet API. In SSR runtimes it falls back to a minimal in-memory implementation that exposes the subset used by OpenElement and renderToString().
packages/protocol/src/style-sheet.ts:9HTML void elements — the ONE canonical tag set for every serializer, validator, and compiler in the workspace (issue #1220, M4).
ReadonlySet<string>Source notes
HTML void elements — the ONE canonical tag set for every serializer, validator, and compiler in the workspace (issue #1220, M4). This module is import-free and host-free by design: it sits at the base of the module graph so the DOM runtime (internal/core/html-escape.ts), the Part Program exchange artifact (internal/protocol/part-program.ts), and the compiler semantic core can all consume the same definition without an import cycle or a second source of truth. Content is the full HTML Standard void-element list, `param` included. Do not redefine this set anywhere else; internal/core/html-escape.ts and internal/protocol/part-program.ts re-export it, and __tests__/void-tags-convergence.test.ts enforces the single owner.
packages/protocol/src/void-tags.ts:16↑ ↓ Select · Tab inspect · Esc return
@openelement/element
441 exportsSet the emitted stylesheet URLs for this server process.
(urls: readonly string[] | null | undefined, islandEntries?: ReadonlyArray<readonly [string, readonly string[] | null]> | null): voidSource notes
Set the emitted stylesheet URLs for this server process. Called by the router's generated SSR/SSG entry (build time and request-time startup) with the base-joined asset addresses Phase 2 emitted. The optional `islandEntries` half carries the per-tag URLs of generated SHADOW hosts (M09-2e / #1803) through the SAME channel: one setter, one entry import, no second public seam. A `null` URL list is the explicit "declared but carrier unavailable" state the nested renderer fails closed on.
packages/element/src/internal/compiled/server/style-links.ts:34Route action: handles form submissions for a page route.
Action<T, Env, Platform, Route>packages/protocol/src/data.ts:64Choose the form action response: true returns serialized data and enhance returns the full HTML used without JavaScript.
"x-openelement-action"Source notes
Request header selecting the action response channel: `true` marks a programmatic caller and selects the serialized ActionResult union; `enhance` marks the built-in morph enhancement and selects the same full-HTML responses the no-JS path receives.
packages/protocol/src/data.ts:125Context passed to a route action function (extends loader context).
ActionContext<Env, Platform, Route>Options and source location
packages/protocol/src/data.ts:47Wire shape returned to the JavaScript form-enhancement path.
ActionResult<Failure>Source notes
Wire shape returned to the JavaScript form-enhancement path. The no-JS path never sees this: it gets the equivalent semantics as plain HTTP (303 on success, 422 with the re-rendered form on validation failure, redirect/error as status codes). Success carries no data envelope. The application-loop contract makes a successful non-GET action answer 303 (PRG) — the framework never answers 200 with a rendered page, or with a success document, for a successful mutation — so the fetch channel answers `{ type: 'redirect' }` naming the PRG target and the authored return value is discarded by design. Success data travels the PRG target instead (query state the loader re-runs with, which the props projector then maps; see the router guide's "Form actions" section). The union previously declared a `{ type: 'success' }` member that no code path ever emitted — removed so the type matches the wire. Error outcomes (CSRF 403, unknown action 404, unparseable body 400, unexpected 500) are NOT part of this union: since #863 they answer RFC 9457 Problem Details with the PROBLEM_JSON_MEDIA_TYPE content type — see ProblemDetails.
packages/protocol/src/data.ts:92Assert that a tag name is a valid custom element name.
(tagName: string): voidpackages/element/src/internal/core/tag-utils.ts:50Collect all public (non-internal) own properties from a host object.
(host: object): Record<string, unknown>Source notes
Collect all public (non-internal) own properties from a host object. Keys starting with `__openElement` are framework-internal and excluded. Uses Reflect.get for safe access (respects getters); a getter that throws is skipped with a warning so one bad prop cannot take the tree down.
packages/element/src/internal/core/props-utils.ts:41The scanner’s per-tag compatibility tier, reason, discovery source, and rendering and hydration facts.
CompatibilityClassificationSource notes
The per-tag verdict the compatibility scanner records: the tier a discovered tag was classified as, the human-readable `reason`, where the tag was found (`source`), and the SSR/DSD/hydration facts the verdict was derived from.
packages/protocol/src/framework.ts:347The tag’s build compatibility level: server-rendered, client-only, experimental, or rejected.
CompatibilityTierSource notes
How far a discovered tag may participate in the build: 'ssr-capable' renders and hydrates, 'client-only' ships to the browser without server output, 'experimental-dom' is admitted with a downgraded guarantee, and 'rejected' fails the build.
packages/protocol/src/framework.ts:340A component’s delivery layer: static DSD, interactive DSD, a client-only island, or light DOM.
ComponentLayerSource notes
The delivery layer a component belongs to: fully static DSD markup ('dsd-static'), DSD markup with a client island ('dsd-interactive'), a client-only island with no SSR output ('pure-island'), or a light-DOM element ('light-dom'). Recorded per component in the build manifest and consumed by the hydration scheduler.
packages/protocol/src/framework.ts:23Create a derived read-only signal recomputed from its dependencies.
<T>(fn: () => T): ReadonlySignal<T>packages/element/src/internal/signal/framework.ts:23Consumer-local reactive projection of a protocol context value.
<T>(context: Context<T>, host?: HTMLElement): WritableSignal<T>Source notes
Consumer-local reactive projection of a protocol context value. When a `host` is given, the returned signal is bridged to the nearest provider through one Community Context Protocol subscription. That bridge is owned by the CALLER: a long-lived consumer must release it when it tears down (typically `disconnectedCallback`) with {@linkcode releaseConsumedContext}, exactly once. Releasing detaches the provider bridge, so the provider no longer retains or updates the local signal; the local signal itself stays usable with its last value. A call after a successful release is a no-op, and a signal created without a `host` has no bridge to release.
packages/element/src/internal/core/signal-context.ts:183A typed context token: protocol identity (`key`) plus its default value.
Context<T>Options and source location
packages/element/src/internal/core/signal-context.ts:13Create a typed context token shared between provider and consumer elements.
<T>(key: symbol, defaultValue: T): Context<T>Options and source location
packages/element/src/internal/core/signal-context.ts:58Create the per-render document stylesheet collection.
(): DocumentStyleResourcespackages/element/src/internal/core/html-escape.ts:133Create a {@link Logger} that prefixes every message with `[tag]`.
(tag: string): Loggerpackages/element/src/internal/core/logger.ts:18Object prototype keys that must never be injected from untrusted props.
ReadonlySet<string>packages/element/src/internal/core/security.ts:25Resolve `id` (a `#hash` or bare id) against `root` and, when the id is not in that root's own tree, recurse into every nested shadow root.
(id: string, root?: Document | ShadowRoot): HTMLElement | nullSource notes
Resolve `id` (a `#hash` or bare id) against `root` and, when the id is not in that root's own tree, recurse into every nested shadow root. Returns the first match or `null`; a malformed percent-encoded id is not an error.
packages/element/src/internal/core/deep-fragment.ts:20The same document serialization boundary, with only body wrappers left open.
(options?: DocumentWrapOptions): { prefix: string; suffix: string; }Options and source location
packages/element/src/internal/core/html-escape.ts:205The document-level stylesheet resources ONE server render discovered (alpha15 S lane, S-C1.2).
DocumentStyleResourcesSource notes
The document-level stylesheet resources ONE server render discovered (alpha15 S lane, S-C1.2). A light-root component's DOM lives in the document, so its sheet cannot ride the component's own subtree the way a shadow template's link does: the document owns it. This object is the one carrier between the two halves of that render — the compiled serializer, which discovers a component's external sheets while serializing the component, and the document serializer, which writes the head. It is created per render and never shared, so one page's stylesheets can never reach another page's head.
packages/element/src/internal/core/html-escape.ts:125Run a side effect that re-subscribes whenever its signal dependencies change.
(fn: () => void | Unsubscribe): Unsubscribepackages/element/src/internal/signal/framework.ts:27Install the bounded pre-upgrade interaction capture on an owning root (default: the document).
(root?: EventTarget, pendingTags?: readonly string[]): voidSource notes
Install the bounded pre-upgrade interaction capture on an owning root (default: the document). Generated client entries call this with their declared island tags before any compiled element upgrades; after a successful claim the element replays the captured events whose targets live inside its root (compiled claim capture/replay, internal/compiled/runtime.ts). Idempotent per root (repeat calls merge tags, never reinstall listeners) and a no-op where no DOM exists (SSR). Invariant: the capture itself — one fixed listener set per owning root, installed once per page — is page-lifetime by design and is NOT the leak. The M1 leak was retained event-target records; each element releases exactly its own records at its activation decision (success or failure), while records owned by still-pending elements survive for their delayed/lazy upgrade (#1170). Boundedness: the facade capture passes the declared-island filter, so only interactions under a still-pending DECLARED island tag enter the queue — ordinary events and undeclared third-party custom elements are skipped (nested pending declared islands still capture through their own unsettled host). With no tags declared the legacy dash heuristic applies. The shared queue carries a hard capacity cap (fail closed), detached records are swept when a claim root adopts its share (and under queue pressure), and each activation decision deterministically empties that root's own bucket, so post-hydration traffic and removals never grow retention.
packages/element/src/internal/compiled/runtime/pre-upgrade-events.ts:662Error message prefix for all openElement errors.
"[openElement]"packages/protocol/src/errors.ts:50Callback receiving every reported {@linkcode OpenElementError} for telemetry.
ErrorTelemetryHookpackages/protocol/src/errors.ts:132Escape an HTML attribute value.
(value: string): stringSource notes
Escape an HTML attribute value. Delegates to `escapeHtml` so both share the single `ESCAPE_MAP` and the same single-pass replacement (consolidated in #633). Empty-value conventions remain intentionally distinct by design: - `escapeHtml` returns '' for non-string input. - `escapeAttrValue` (below) coerces via `String()` and is the boundary meant for unknown/variable attribute values.
packages/element/src/internal/core/html-escape.ts:55Escape the five HTML-significant characters in text content.
(str: string): stringpackages/element/src/internal/core/html-escape.ts:39Format an unknown thrown value as a human-readable string.
(e: unknown): stringpackages/element/src/internal/core/errors.ts:52FrameworkOptionsSource notes
The adapter-facing framework options: where routes and islands live, the default layout and named-layout declarations, the document `<html>`/head injection channels, and the request-time middleware switches. Every field is optional; the adapter applies its documented default. This is the type an application config file's default export is checked against, so the rendered option table and the actual config surface cannot drift.
packages/protocol/src/framework.ts:180Runtime list of supported hydration strategies; the single source of truth for the `HydrationStrategy` union.
readonly ["load", "idle", "visible", "only", "none"]Source notes
Runtime list of supported hydration strategies; the single source of truth for the `HydrationStrategy` union. Consumed by island/registry validation and re-exported from the element root for app and build adapters.
packages/protocol/src/framework.ts:28Island hydration trigger: 'load' | 'idle' | 'visible' | 'only'.
"load" | "idle" | "visible" | "only" | "none"packages/protocol/src/framework.ts:30Idle-hydration scheduling fallback (milliseconds) when neither `requestIdleCallback` nor `requestAnimationFrame` is available.
50packages/protocol/src/policy.ts:70Safely assign caller-supplied props onto a target object, skipping keys that could enable prototype pollution and tolerating read-only properties.
(target: Record<string, unknown>, props: Record<string, unknown>, tagName: string, log?: { warn(message: string): void; debug(message: string): void; }): voidSource notes
Safely assign caller-supplied props onto a target object, skipping keys that could enable prototype pollution and tolerating read-only properties. The canonical guarded assigner for the canonical dangerous-key rule (#903, #1214): the
packages/element/src/internal/core/security.ts:131Shared dangerous-key predicate (#903, #1214).
(key: string): booleanSource notes
Shared dangerous-key predicate (#903, #1214). Prototype-internal keys must never be injected from untrusted props on ANY path: host prop collection (collectPublicProps / normalizePublicProps in props-utils.ts), guarded assignment (injectPropsSafe below — the SPA bootstrap page-projection write boundary in
packages/element/src/internal/core/security.ts:53Per-island delivery options (hydration strategy, SSR/DSD participation).
IslandOptionsOptions and source location
packages/protocol/src/island.ts:8Shared safe-attribute-name predicate (#1033): the SSR face of the one canonical predicate in `../protocol/forbidden-sinks.ts`.
(name: string): booleanSource notes
Shared safe-attribute-name predicate (#1033): the SSR face of the one canonical predicate in `../protocol/forbidden-sinks.ts`. A name must be valid HTML attribute-name grammar (blocks quote/space injection, #602), must not be an event handler (`on*`, case-insensitive), and must not be a forbidden sink (`innerhtml`/`srcdoc`). The compiler, protocol validator, and server serializer enforce the same predicate with their own failure strategies; every path delegates to the single implementation, so the boundary cannot diverge.
packages/element/src/internal/core/security.ts:67Check if a tag name is a valid custom element name per HTML spec.
(tagName: string): booleanpackages/element/src/internal/core/tag-utils.ts:38Select the built-in layout, declare a custom layout with its module and props, or disable the layout.
LayoutConfigSource notes
Layout declaration: `false` disables the layout entirely, `'default'` uses the built-in layout, and the object form names a tag with the module path that defines it (`import`, resolved like a {@link FrameworkOptions.middleware.use } entry) plus the compiled layout properties the router injects per route.
packages/protocol/src/framework.ts:96Route loader: fetches data for a page route.
Loader<T, Env, Platform, Route>packages/protocol/src/data.ts:56Context passed to a request-time ('dynamic') route loader.
LoaderContext<Env, Platform, Route>Options and source location
packages/protocol/src/data.ts:40Locale-aware resolved path contract.
LocalePathOptions and source location
packages/protocol/src/framework.ts:82logger.ts - Tagged console logger. Lightweight scoped logger. Returns plain functions so it is tree-shakable and has zero class overhead.
LoggerOptions and source location
packages/element/src/internal/core/logger.ts:10Request-body bound (bytes) the generated entry applies to action POST routes; larger uploads belong on API routes with explicit limits.
numberpackages/protocol/src/policy.ts:57Nested element expansion depth bound for `renderToString`: cyclic component composition fails closed instead of recursing without end.
8packages/protocol/src/policy.ts:51Fetch middleware contract (#858): WinterCG shape, dialect-free — no Hono/h3 context object.
MiddlewareSource notes
Fetch middleware contract (#858): WinterCG shape, dialect-free — no Hono/h3 context object. Composed at the handler boundary in onion order (`use[0]` is outermost: it sees the request first and the response last), so it runs with identical semantics in the dev server, the `start` CLI, the e2e fixture server, and the Nitro production entry. A middleware may short-circuit by returning a Response without calling `next()`, or post-process the Response that `next()` returns. Module contract: a Middleware is the DEFAULT EXPORT of a module referenced from `middleware.use` by path (e.g. './app/middleware/auth.ts'). The generated server entry imports the module, so the middleware may close over module scope and import local helpers and third-party packages — it is a real module in the server module graph, never serialized source.
packages/protocol/src/framework.ts:169Run a callback on each element connection. If it returns a cleanup function, run that function on disconnect.
(callback: (env: { readonly host: HTMLElement; readonly signal: AbortSignal; readonly states: CustomStateSet; }) => void | (() => void)): voidSource notes
Compiler-recognized connect intrinsic: runs the callback on every connection of the generated element (initial mount and each reconnect) and releases the optional returned cleanup at that disconnection. Erased by the compiler; calling it at runtime fails closed. The callback may keep the original zero-argument form or declare ONE `env` parameter. `env.host` is the generated element the connection belongs to (for a depth-1 retained hostless child: its nearest ancestor generated element), and `env.signal` aborts at the START of that disconnection, before any registered cleanup runs; a reconnect gets a fresh, un-aborted signal. The parameter's type is the author-facing contract only — the compiler erases it and passes the value from the connection scope the callback runs in.
packages/element/src/internal/core/compile-lifecycle.ts:58Run a callback once when the generated element is disposed, after its connection cleanups.
(callback: (env: { readonly host: HTMLElement; readonly signal: AbortSignal; readonly states: CustomStateSet; }) => void): voidSource notes
Compiler-recognized dispose intrinsic: runs the callback exactly once when the generated element instance is torn down (explicit `dispose()`), after that connection's connect-cleanups. Erased by the compiler; calling it at runtime fails closed. The callback may keep the original zero-argument form or declare ONE `env` parameter whose `signal` is the instance-lifetime teardown signal: it is aborted at the start of teardown, before this and every other disposal callback runs, so `env.signal.aborted` is `true` inside the callback.
packages/element/src/internal/core/compile-lifecycle.ts:80Compiler-recognized error intrinsic (`16b-EB`): the author-facing error boundary of ONE generated element.
(callback: (env: { readonly host: HTMLElement; readonly signal: AbortSignal; readonly states: CustomStateSet; readonly error: unknown; }) => void): voidSource notes
Compiler-recognized error intrinsic (`16b-EB`): the author-facing error boundary of ONE generated element. The callback runs when a value escapes from the element's own work — the connect/claim pass (mount, claim, setup and the `onConnect` replay) and an UPDATE-phase write (a tracked slot refresh or a DOM event handler dispatched inside the compiled body). Erased by the compiler; calling it at runtime fails closed. `env.host` is the generated element the failing work belongs to (the nearest ancestor generated element for a depth-1 retained hostless child), `env.signal` is the per-connection `LifetimeScope` signal for a connect-phase failure and the instance-lifetime teardown signal otherwise, `env.states` is the element's `CustomStateSet`, and `env.error` is the thrown value EXACTLY as it was thrown (never wrapped or replaced). The callback may keep the zero-argument form. A catching handler changes only whether the error escapes: a connect-phase failure still leaves the element in its defined post-failure state (no projection, no listeners, a later reconnect retries from scratch), and an update-phase failure leaves the previously written DOM in place with the subscription still live for the next write. A handler that itself throws REPLACES the original error — that new throw is what surfaces. With no registered handler the pre-existing rethrow/rollback behaviour is unchanged. The callback is CLIENT-owned: it is erased into the compiled module and never runs during `__ssr` (a server render has no element, no connection scope and no handler registry; a producer throw fails the render, exactly as before).
packages/element/src/internal/core/compile-lifecycle.ts:144Run a callback after a declared property changes through an attribute or property write.
(callback: (event: { readonly host: HTMLElement; readonly signal: AbortSignal; readonly states: CustomStateSet; readonly name: string; readonly value: unknown; }) => void): voidSource notes
Compiler-recognized change intrinsic: runs the callback after a DECLARED property of this generated element commits a new value, for an attribute write and for a property write, and never at setup. Erased by the compiler — the callback is registered on the element-lifetime instance owner through the compiler-private host record; calling it at runtime fails closed. `event.host` is the generated element (the nearest ancestor generated element for a depth-1 retained hostless child), `event.signal` is the instance-lifetime teardown signal, and `event.name`/`event.value` are the changed row and its committed value. The callback may keep the zero-argument form.
packages/element/src/internal/core/compile-lifecycle.ts:103One documented attribute of a custom element declaration.
OpenElementAttributeOptions and source location
packages/protocol/src/manifest.ts:15One documented CSS part of a custom element declaration.
OpenElementCssPartOptions and source location
packages/protocol/src/manifest.ts:38One custom element declaration in a package manifest: tag, members and delivery metadata.
OpenElementDeclarationOptions and source location
packages/protocol/src/manifest.ts:116Framework error carrying a stable code, severity, phase and recoverability contract.
class OpenElementError extends Errorpackages/protocol/src/errors.ts:100One documented custom event of a custom element declaration.
OpenElementEventOptions and source location
packages/protocol/src/manifest.ts:25Package manifest of component declarations (not a Custom Elements Manifest).
OpenElementPackageManifestOptions and source location
packages/protocol/src/manifest.ts:129Host-agnostic route and asset contracts shared by app and build drivers.
OpenElementRouteKindpackages/protocol/src/app-model.ts:2One route tree entry, including the URL path, route kind, source, optional tag and params, and child routes.
OpenElementRouteNodeSource notes
One node of the host-agnostic route tree: the matched URL `path` and route kind, the source and module paths the drivers resolve, the optional registered tag and param names, and the nested `children`.
packages/protocol/src/app-model.ts:9One documented slot of a custom element declaration.
OpenElementSlotOptions and source location
packages/protocol/src/manifest.ts:32Media type of the RFC 9457 action error channel (#863).
"application/problem+json"packages/protocol/src/data.ts:117RFC 9457 response for action protocol errors. The media type is application/problem+json, and detail describes the failure.
ProblemDetailsSource notes
RFC 9457 Problem Details document (#863): the action error channel answers `application/problem+json` instead of the bespoke `{ type: 'error', error: { message } }` JSON, so HTTP tooling recognizes failures natively. With `type: 'about:blank'`, `title` is the HTTP reason phrase and `detail` carries the specific explanation. The wire shape is alpha-unfrozen; the 1.0 acceptance freezes it in this problem+json form.
packages/protocol/src/data.ts:105Provide a plain protocol value; the provider Signal remains OE-private.
<T>(host: HTMLElement, context: Context<T>, value: T): UnsubscribeSource notes
Provide a plain protocol value; the provider Signal remains OE-private. The returned handle owns exactly one provider record. A repeated call for the same host and {@linkcode Context.key} disposes the previous record (its request listener and mapping) before publishing the replacement, so repeated provides and reconnect cycles never accumulate listeners; the replaced handle becomes a no-op. Releasing removes only the current record and is idempotent.
packages/element/src/internal/core/signal-context.ts:131Read-only signal protocol used by computed values.
ReadonlySignal<T>Options and source location
packages/protocol/src/signal.ts:26Compiler-recognized node-handle factory (`16b-REF`): declares a REF HANDLE for one intrinsic DOM node of this component.
<T extends globalThis.Element = Element>(callback?: (element: T | null) => void | (() => void)): { (element: globalThis.Element | null): void; readonly current: T | null; }Source notes
Compiler-recognized node-handle factory (`16b-REF`): declares a REF HANDLE for one intrinsic DOM node of this component. The returned value is handed to that node's existing JSX `ref` attribute: ```tsx const field = ref<HTMLInputElement>((element) => { element?.focus(); return () => {/* detach cleanup *\/}; }); // … return <input ref={field} />; ``` The handle is the same object for the whole element lifetime: the compiler erases this call into the retained instance factory, so a reconnect, a claim of server DOM and an update all observe one handle rather than a per-pass copy. It is a REF CHANNEL VALUE, not a reactive source: `current` is written when the node attaches, cleared when it detaches, and it notifies nothing — a tracked slot reading `current` would be a one-shot value, which is why the compiler admits a handle ONLY in a `ref` attribute expression. The optional callback is the attach/detach notification the existing `ref` channel already defines: called with the element on attach, and with `null` on detach AFTER the cleanup it returned has run. Because the handle rides the same `ref` channel, the cleanup ordering, the once-per-detach rule and the scope ownership are the existing ones — this intrinsic adds no second attachment mechanism. Erased by the compiler; calling it at runtime fails closed.
packages/element/src/internal/core/compile-lifecycle.ts:187Release the provider bridge created by one hosted {@linkcode consumeContext} call.
(signalValue: SignalLike<unknown>): voidSource notes
Release the provider bridge created by one hosted {@linkcode consumeContext} call. The bridge is deregistered only AFTER its cleanup returns: a throwing unsubscribe must not leave the signal in a state where the bridge is gone from the bookkeeping but still attached to the provider (unretryable). If cleanup throws, the entry stays registered and the error propagates verbatim, so the caller can retry the release — for example from a `disconnectedCallback` that runs again — once the provider's unsubscribe succeeds. A second call after a successful release is a no-op, and a signal without a bridge (including a signal created without a `host`) is always a no-op.
packages/element/src/internal/core/signal-context.ts:208Recoverable render-phase error carrying the failing component path and tag.
class RenderError extends OpenElementErrorpackages/element/src/internal/core/errors.ts:95Server-render one compiled element through canonical Element composition: returns the serialized DSD `html` string directly.
(input: string | CustomElementConstructor, options?: RenderToStringOptions): stringpackages/element/src/public-runtime.ts:945Set the compiled class, props, diagnostic context, admitted nested elements, and trusted light children for renderToString.
RenderToStringOptionsSource notes
Options for one `renderToString()` call: the compiled component class to serialize, the values projected onto its compiled properties, optional route/source diagnostics metadata, the nested compiled tags the build admitted, and trusted parent-owned light children keyed by slot name.
packages/element/src/public-runtime.ts:170Report an {@linkcode OpenElementError} to the telemetry hook, or console.error when none is installed.
(error: OpenElementError): voidOptions and source location
packages/element/src/internal/core/errors.ts:139A discovered route’s URL, source, type, generated binding name, and optional custom element tag.
RouteEntrySource notes
One route admitted by the scanner: URL `path`, source `filePath`, the route `type`, the generated variable name (`varName`) the entry binds it to, and the optional registration tag. {@link RouteEntry.definePage} and {@link RouteEntry.hasEnhancedForms} carry the two source-derived admission facts the generated entries branch on.
packages/protocol/src/framework.ts:113Canonical request-time/SSG server route context.
ServerRouteContext<Env, Platform, Route>Options and source location
packages/protocol/src/data.ts:25Context passed to a request-time ('dynamic') route loader.
ServerRouteMetadataSource notes
Context passed to a request-time ('dynamic') route loader. This is the server contract: the loader runs on the server with the Web-standard request, matched route params, the host environment and the platform object, and signals validation failure via fail()/redirect().
packages/protocol/src/data.ts:19Install the process-wide error telemetry hook (replaceable for tests, HMR, multi-app pages).
(hook: ErrorTelemetryHook): voidpackages/element/src/internal/core/errors.ts:127Create a writable signal through the selected signal engine.
<T>(initialValue: T): WritableSignal<T>packages/element/src/internal/signal/framework.ts:19Alias for APIs that accept either writable or read-only signals.
Signal<T>packages/protocol/src/signal.ts:31Special file kinds the route scanner recognizes by filename: `renderer` and `middleware`.
SpecialFileTypepackages/protocol/src/framework.ts:79The build’s SSR verdict for a discovered tag, including its module, discovery source, render path, and reason.
SsrAdmissionDecisionSource notes
The build's admission verdict for one discovered tag: where the declaration lives (`modulePath`), how it was discovered (`source`), which render path it is admitted to, and the reason recorded for the manifest.
packages/protocol/src/render.ts:37Tags a deferred frame cannot safely install into an owned Part range: the browser installer rejects any frame whose markup carries one of these.
readonly ["script", "style", "template", "iframe", "object", "embed", "base", "meta", "link"]packages/protocol/src/stream-frame-policy.ts:26Schemes that make a URL attribute unsafe in a streamed frame.
RegExppackages/protocol/src/stream-frame-policy.ts:60URL-carrying attributes the frame check screens for script-bearing scheme obfuscation; only these attribute names are value-screened.
readonly ["href", "src", "action", "formaction", "xlink:href"]packages/protocol/src/stream-frame-policy.ts:42The highest control character code point removed before checking a URL scheme.
32Source notes
Control characters at or below this code point are stripped before the URL-scheme test, so tab/newline/control obfuscation cannot smuggle a scheme past admission.
packages/protocol/src/stream-frame-policy.ts:55Deferred fields (declared streamed properties) one stream route's manifest may carry.
32Source notes
Deferred fields (declared streamed properties) one stream route's manifest may carry. The build scan, the server executor, and the browser seed contract enforce the same bound.
packages/protocol/src/policy.ts:24Part/Block owners one stream route's manifest may address in total across all deferred fields.
64packages/protocol/src/policy.ts:30Serialized stream payload bound, as a string length in UTF-16 code units: one seed attribute or one deferred frame's markup may not exceed it.
numberSource notes
Serialized stream payload bound, as a string length in UTF-16 code units: one seed attribute or one deferred frame's markup may not exceed it. The server checks the JSON text and the rendered range before emitting; the browser checks the attribute before parsing.
packages/protocol/src/policy.ts:45Maximum number of typed properties the browser accepts in one streamed hydration seed.
64Source notes
Typed properties one streamed seed may carry: the browser seed contract rejects the WHOLE seed above this count, so an oversized component would silently fail to hydrate instead of failing loud at the server.
packages/protocol/src/policy.ts:37Milliseconds a streamed response waits for deferred fields before failing those still pending.
30000Source notes
Deferred-field resolution budget (milliseconds) for one streamed response: fields still pending when it expires are failed in place and the stream ends with the shell and whatever resolved.
packages/protocol/src/policy.ts:64Cross-realm StyleSheet constructor: the native CSSStyleSheet or the internal shim.
new () => StyleSheetLikepackages/element/src/internal/core/style-sheet.ts:110Minimal stylesheet contract (replaceSync + cssRules) satisfied by native and shim sheets.
StyleSheetLikeOptions and source location
packages/protocol/src/style-sheet.ts:14Mark an HTML string as trusted for explicit `innerHTML` sinks (the trust does not serialize).
(html: string): TrustedHtmlpackages/element/src/internal/core/security.ts:88Opaque capability marking HTML the application has explicitly vetted as trusted.
TrustedHtmlOptions and source location
packages/element/src/internal/core/security.ts:83Check whether a static attribute makes a streamed frame unsafe to install.
(name: string, value: string): booleanSource notes
Whether a static attribute (name/value as authored into the Part Program) makes a streamed frame unsafely installable: event-handler, seed-spoofing, and srcdoc names fail outright, and URL-carrying names fail when the entity-decoded, control-stripped value carries a script scheme.
packages/protocol/src/stream-frame-policy.ts:113Subscribe to the nearest context provider. Return a signal with the declared default when no provider exists.
<T>(context: { readonly key: symbol; readonly defaultValue: T; }): { readonly value: T; subscribe(fn: (value: T) => void): () => void; }Source notes
Compiler-recognized CONSUMER intrinsic (`16b-CTX`): declares a tracked consumer of `context` for this component and returns the signal its value lives in. ```tsx const theme = useContext(ThemeContext); return <p>{theme.value}</p>; // a tracked slot: refreshes on provider change ``` The returned signal is ONE persistent consumer-local signal: the compiler erases this call into the component's retained setup record, so a reconnect re-reads the nearest provider into the SAME object and a tracked slot keeps exactly one subscription target for the whole element lifetime. Lookup follows the nearest owning component, so an inner provider shadows an outer one and a component with no ancestor provider reads the context's declared default. Reading `.value` in a tracked slot is the supported use — this is the lane's reactive channel, unlike `ref`'s `current`. Reading it inside a handler also works (the signal is live), but only tracked slots refresh. Erased by the compiler; calling it at runtime fails closed.
packages/element/src/internal/core/compile-lifecycle.ts:285Return the custom element that owns the current component instance.
(): HTMLElementSource notes
Compiler-recognized HOST-ACCESS intrinsic (`16b-REF`, `useHost`). ```tsx const host = useHost(); // … host is this instance's owning element (the custom element). ``` It exposes the SAME fact the lifecycle/change/error callbacks already receive as `env.host` — the owning generated element for a root, the nearest enclosing generated element host for a depth-1 retained hostless child — through the expression position instead of a callback parameter. There is therefore no new runtime channel and no second host lookup: the compiler erases the call into a read of the host-element field the retained setup factory already receives. The read is NOT reactive: the element identity never changes for an instance, so a derived node capturing it can never go stale. That is also why it carries no lifecycle ownership — it allocates nothing and needs no cleanup. Erased by the compiler; calling it at runtime fails closed.
packages/element/src/internal/core/compile-lifecycle.ts:218Wrap rendered HTML in a full HTML document.
(html: string, options?: DocumentWrapOptions): stringSource notes
Wrap rendered HTML in a full HTML document. Adds DOCTYPE, head (title, meta, preload), and body. Supports CSP nonce and dev scripts (e.g. Vite client, route module registration).
packages/element/src/internal/core/html-escape.ts:199Choose the form action response: true returns serialized data and enhance returns the full HTML used without JavaScript.
"x-openelement-action"Source notes
Request header selecting the action response channel: `true` marks a programmatic caller and selects the serialized ActionResult union; `enhance` marks the built-in morph enhancement and selects the same full-HTML responses the no-JS path receives.
packages/protocol/src/data.ts:125Assert that a tag name is a valid custom element name.
(tagName: string): voidpackages/element/src/internal/core/tag-utils.ts:50Object prototype keys that must never be injected from untrusted props.
ReadonlySet<string>packages/element/src/internal/core/security.ts:25Error message prefix for all openElement errors.
"[openElement]"packages/protocol/src/errors.ts:50Runtime list of supported hydration strategies; the single source of truth for the `HydrationStrategy` union.
readonly ["load", "idle", "visible", "only", "none"]Source notes
Runtime list of supported hydration strategies; the single source of truth for the `HydrationStrategy` union. Consumed by island/registry validation and re-exported from the element root for app and build adapters.
packages/protocol/src/framework.ts:28Island hydration trigger: 'load' | 'idle' | 'visible' | 'only'.
"load" | "idle" | "visible" | "only" | "none"packages/protocol/src/framework.ts:30Safely assign caller-supplied props onto a target object, skipping keys that could enable prototype pollution and tolerating read-only properties.
(target: Record<string, unknown>, props: Record<string, unknown>, tagName: string, log?: { warn(message: string): void; debug(message: string): void; }): voidSource notes
Safely assign caller-supplied props onto a target object, skipping keys that could enable prototype pollution and tolerating read-only properties. The canonical guarded assigner for the canonical dangerous-key rule (#903, #1214): the
packages/element/src/internal/core/security.ts:131Shared dangerous-key predicate (#903, #1214).
(key: string): booleanSource notes
Shared dangerous-key predicate (#903, #1214). Prototype-internal keys must never be injected from untrusted props on ANY path: host prop collection (collectPublicProps / normalizePublicProps in props-utils.ts), guarded assignment (injectPropsSafe below — the SPA bootstrap page-projection write boundary in
packages/element/src/internal/core/security.ts:53Shared safe-attribute-name predicate (#1033): the SSR face of the one canonical predicate in `../protocol/forbidden-sinks.ts`.
(name: string): booleanSource notes
Shared safe-attribute-name predicate (#1033): the SSR face of the one canonical predicate in `../protocol/forbidden-sinks.ts`. A name must be valid HTML attribute-name grammar (blocks quote/space injection, #602), must not be an event handler (`on*`, case-insensitive), and must not be a forbidden sink (`innerhtml`/`srcdoc`). The compiler, protocol validator, and server serializer enforce the same predicate with their own failure strategies; every path delegates to the single implementation, so the boundary cannot diverge.
packages/element/src/internal/core/security.ts:67Check if a tag name is a valid custom element name per HTML spec.
(tagName: string): booleanpackages/element/src/internal/core/tag-utils.ts:38Request-body bound (bytes) the generated entry applies to action POST routes; larger uploads belong on API routes with explicit limits.
numberpackages/protocol/src/policy.ts:57Framework error carrying a stable code, severity, phase and recoverability contract.
class OpenElementError extends Errorpackages/protocol/src/errors.ts:100Media type of the RFC 9457 action error channel (#863).
"application/problem+json"packages/protocol/src/data.ts:117Tags a deferred frame cannot safely install into an owned Part range: the browser installer rejects any frame whose markup carries one of these.
readonly ["script", "style", "template", "iframe", "object", "embed", "base", "meta", "link"]packages/protocol/src/stream-frame-policy.ts:26Schemes that make a URL attribute unsafe in a streamed frame.
RegExppackages/protocol/src/stream-frame-policy.ts:60URL-carrying attributes the frame check screens for script-bearing scheme obfuscation; only these attribute names are value-screened.
readonly ["href", "src", "action", "formaction", "xlink:href"]packages/protocol/src/stream-frame-policy.ts:42The highest control character code point removed before checking a URL scheme.
32Source notes
Control characters at or below this code point are stripped before the URL-scheme test, so tab/newline/control obfuscation cannot smuggle a scheme past admission.
packages/protocol/src/stream-frame-policy.ts:55Deferred fields (declared streamed properties) one stream route's manifest may carry.
32Source notes
Deferred fields (declared streamed properties) one stream route's manifest may carry. The build scan, the server executor, and the browser seed contract enforce the same bound.
packages/protocol/src/policy.ts:24Part/Block owners one stream route's manifest may address in total across all deferred fields.
64packages/protocol/src/policy.ts:30Serialized stream payload bound, as a string length in UTF-16 code units: one seed attribute or one deferred frame's markup may not exceed it.
numberSource notes
Serialized stream payload bound, as a string length in UTF-16 code units: one seed attribute or one deferred frame's markup may not exceed it. The server checks the JSON text and the rendered range before emitting; the browser checks the attribute before parsing.
packages/protocol/src/policy.ts:45Maximum number of typed properties the browser accepts in one streamed hydration seed.
64Source notes
Typed properties one streamed seed may carry: the browser seed contract rejects the WHOLE seed above this count, so an oversized component would silently fail to hydrate instead of failing loud at the server.
packages/protocol/src/policy.ts:37Milliseconds a streamed response waits for deferred fields before failing those still pending.
30000Source notes
Deferred-field resolution budget (milliseconds) for one streamed response: fields still pending when it expires are failed in place and the stream ends with the shell and whatever resolved.
packages/protocol/src/policy.ts:64Set the emitted stylesheet URLs for this server process.
(urls: readonly string[] | null | undefined, islandEntries?: ReadonlyArray<readonly [string, readonly string[] | null]> | null): voidSource notes
Set the emitted stylesheet URLs for this server process. Called by the router's generated SSR/SSG entry (build time and request-time startup) with the base-joined asset addresses Phase 2 emitted. The optional `islandEntries` half carries the per-tag URLs of generated SHADOW hosts (M09-2e / #1803) through the SAME channel: one setter, one entry import, no second public seam. A `null` URL list is the explicit "declared but carrier unavailable" state the nested renderer fails closed on.
packages/element/src/internal/compiled/server/style-links.ts:34Route action: handles form submissions for a page route.
Action<T, Env, Platform, Route>packages/protocol/src/data.ts:64Choose the form action response: true returns serialized data and enhance returns the full HTML used without JavaScript.
"x-openelement-action"Source notes
Request header selecting the action response channel: `true` marks a programmatic caller and selects the serialized ActionResult union; `enhance` marks the built-in morph enhancement and selects the same full-HTML responses the no-JS path receives.
packages/protocol/src/data.ts:125Context passed to a route action function (extends loader context).
ActionContext<Env, Platform, Route>Options and source location
packages/protocol/src/data.ts:47Wire shape returned to the JavaScript form-enhancement path.
ActionResult<Failure>Source notes
Wire shape returned to the JavaScript form-enhancement path. The no-JS path never sees this: it gets the equivalent semantics as plain HTTP (303 on success, 422 with the re-rendered form on validation failure, redirect/error as status codes). Success carries no data envelope. The application-loop contract makes a successful non-GET action answer 303 (PRG) — the framework never answers 200 with a rendered page, or with a success document, for a successful mutation — so the fetch channel answers `{ type: 'redirect' }` naming the PRG target and the authored return value is discarded by design. Success data travels the PRG target instead (query state the loader re-runs with, which the props projector then maps; see the router guide's "Form actions" section). The union previously declared a `{ type: 'success' }` member that no code path ever emitted — removed so the type matches the wire. Error outcomes (CSRF 403, unknown action 404, unparseable body 400, unexpected 500) are NOT part of this union: since #863 they answer RFC 9457 Problem Details with the PROBLEM_JSON_MEDIA_TYPE content type — see ProblemDetails.
packages/protocol/src/data.ts:92Assert that a tag name is a valid custom element name.
(tagName: string): voidpackages/element/src/internal/core/tag-utils.ts:50Collect all public (non-internal) own properties from a host object.
(host: object): Record<string, unknown>Source notes
Collect all public (non-internal) own properties from a host object. Keys starting with `__openElement` are framework-internal and excluded. Uses Reflect.get for safe access (respects getters); a getter that throws is skipped with a warning so one bad prop cannot take the tree down.
packages/element/src/internal/core/props-utils.ts:41The scanner’s per-tag compatibility tier, reason, discovery source, and rendering and hydration facts.
CompatibilityClassificationSource notes
The per-tag verdict the compatibility scanner records: the tier a discovered tag was classified as, the human-readable `reason`, where the tag was found (`source`), and the SSR/DSD/hydration facts the verdict was derived from.
packages/protocol/src/framework.ts:347The tag’s build compatibility level: server-rendered, client-only, experimental, or rejected.
CompatibilityTierSource notes
How far a discovered tag may participate in the build: 'ssr-capable' renders and hydrates, 'client-only' ships to the browser without server output, 'experimental-dom' is admitted with a downgraded guarantee, and 'rejected' fails the build.
packages/protocol/src/framework.ts:340A component’s delivery layer: static DSD, interactive DSD, a client-only island, or light DOM.
ComponentLayerSource notes
The delivery layer a component belongs to: fully static DSD markup ('dsd-static'), DSD markup with a client island ('dsd-interactive'), a client-only island with no SSR output ('pure-island'), or a light-DOM element ('light-dom'). Recorded per component in the build manifest and consumed by the hydration scheduler.
packages/protocol/src/framework.ts:23Create a derived read-only signal recomputed from its dependencies.
<T>(fn: () => T): ReadonlySignal<T>packages/element/src/internal/signal/framework.ts:23Consumer-local reactive projection of a protocol context value.
<T>(context: Context<T>, host?: HTMLElement): WritableSignal<T>Source notes
Consumer-local reactive projection of a protocol context value. When a `host` is given, the returned signal is bridged to the nearest provider through one Community Context Protocol subscription. That bridge is owned by the CALLER: a long-lived consumer must release it when it tears down (typically `disconnectedCallback`) with {@linkcode releaseConsumedContext}, exactly once. Releasing detaches the provider bridge, so the provider no longer retains or updates the local signal; the local signal itself stays usable with its last value. A call after a successful release is a no-op, and a signal created without a `host` has no bridge to release.
packages/element/src/internal/core/signal-context.ts:183A typed context token: protocol identity (`key`) plus its default value.
Context<T>Options and source location
packages/element/src/internal/core/signal-context.ts:13Create a typed context token shared between provider and consumer elements.
<T>(key: symbol, defaultValue: T): Context<T>Options and source location
packages/element/src/internal/core/signal-context.ts:58Create the per-render document stylesheet collection.
(): DocumentStyleResourcespackages/element/src/internal/core/html-escape.ts:133Create a {@link Logger} that prefixes every message with `[tag]`.
(tag: string): Loggerpackages/element/src/internal/core/logger.ts:18Object prototype keys that must never be injected from untrusted props.
ReadonlySet<string>packages/element/src/internal/core/security.ts:25Resolve `id` (a `#hash` or bare id) against `root` and, when the id is not in that root's own tree, recurse into every nested shadow root.
(id: string, root?: Document | ShadowRoot): HTMLElement | nullSource notes
Resolve `id` (a `#hash` or bare id) against `root` and, when the id is not in that root's own tree, recurse into every nested shadow root. Returns the first match or `null`; a malformed percent-encoded id is not an error.
packages/element/src/internal/core/deep-fragment.ts:20The same document serialization boundary, with only body wrappers left open.
(options?: DocumentWrapOptions): { prefix: string; suffix: string; }Options and source location
packages/element/src/internal/core/html-escape.ts:205The document-level stylesheet resources ONE server render discovered (alpha15 S lane, S-C1.2).
DocumentStyleResourcesSource notes
The document-level stylesheet resources ONE server render discovered (alpha15 S lane, S-C1.2). A light-root component's DOM lives in the document, so its sheet cannot ride the component's own subtree the way a shadow template's link does: the document owns it. This object is the one carrier between the two halves of that render — the compiled serializer, which discovers a component's external sheets while serializing the component, and the document serializer, which writes the head. It is created per render and never shared, so one page's stylesheets can never reach another page's head.
packages/element/src/internal/core/html-escape.ts:125Run a side effect that re-subscribes whenever its signal dependencies change.
(fn: () => void | Unsubscribe): Unsubscribepackages/element/src/internal/signal/framework.ts:27Install the bounded pre-upgrade interaction capture on an owning root (default: the document).
(root?: EventTarget, pendingTags?: readonly string[]): voidSource notes
Install the bounded pre-upgrade interaction capture on an owning root (default: the document). Generated client entries call this with their declared island tags before any compiled element upgrades; after a successful claim the element replays the captured events whose targets live inside its root (compiled claim capture/replay, internal/compiled/runtime.ts). Idempotent per root (repeat calls merge tags, never reinstall listeners) and a no-op where no DOM exists (SSR). Invariant: the capture itself — one fixed listener set per owning root, installed once per page — is page-lifetime by design and is NOT the leak. The M1 leak was retained event-target records; each element releases exactly its own records at its activation decision (success or failure), while records owned by still-pending elements survive for their delayed/lazy upgrade (#1170). Boundedness: the facade capture passes the declared-island filter, so only interactions under a still-pending DECLARED island tag enter the queue — ordinary events and undeclared third-party custom elements are skipped (nested pending declared islands still capture through their own unsettled host). With no tags declared the legacy dash heuristic applies. The shared queue carries a hard capacity cap (fail closed), detached records are swept when a claim root adopts its share (and under queue pressure), and each activation decision deterministically empties that root's own bucket, so post-hydration traffic and removals never grow retention.
packages/element/src/internal/compiled/runtime/pre-upgrade-events.ts:662Error message prefix for all openElement errors.
"[openElement]"packages/protocol/src/errors.ts:50Callback receiving every reported {@linkcode OpenElementError} for telemetry.
ErrorTelemetryHookpackages/protocol/src/errors.ts:132Escape an HTML attribute value.
(value: string): stringSource notes
Escape an HTML attribute value. Delegates to `escapeHtml` so both share the single `ESCAPE_MAP` and the same single-pass replacement (consolidated in #633). Empty-value conventions remain intentionally distinct by design: - `escapeHtml` returns '' for non-string input. - `escapeAttrValue` (below) coerces via `String()` and is the boundary meant for unknown/variable attribute values.
packages/element/src/internal/core/html-escape.ts:55Escape the five HTML-significant characters in text content.
(str: string): stringpackages/element/src/internal/core/html-escape.ts:39Format an unknown thrown value as a human-readable string.
(e: unknown): stringpackages/element/src/internal/core/errors.ts:52FrameworkOptionsSource notes
The adapter-facing framework options: where routes and islands live, the default layout and named-layout declarations, the document `<html>`/head injection channels, and the request-time middleware switches. Every field is optional; the adapter applies its documented default. This is the type an application config file's default export is checked against, so the rendered option table and the actual config surface cannot drift.
packages/protocol/src/framework.ts:180Runtime list of supported hydration strategies; the single source of truth for the `HydrationStrategy` union.
readonly ["load", "idle", "visible", "only", "none"]Source notes
Runtime list of supported hydration strategies; the single source of truth for the `HydrationStrategy` union. Consumed by island/registry validation and re-exported from the element root for app and build adapters.
packages/protocol/src/framework.ts:28Island hydration trigger: 'load' | 'idle' | 'visible' | 'only'.
"load" | "idle" | "visible" | "only" | "none"packages/protocol/src/framework.ts:30Idle-hydration scheduling fallback (milliseconds) when neither `requestIdleCallback` nor `requestAnimationFrame` is available.
50packages/protocol/src/policy.ts:70Safely assign caller-supplied props onto a target object, skipping keys that could enable prototype pollution and tolerating read-only properties.
(target: Record<string, unknown>, props: Record<string, unknown>, tagName: string, log?: { warn(message: string): void; debug(message: string): void; }): voidSource notes
Safely assign caller-supplied props onto a target object, skipping keys that could enable prototype pollution and tolerating read-only properties. The canonical guarded assigner for the canonical dangerous-key rule (#903, #1214): the
packages/element/src/internal/core/security.ts:131Shared dangerous-key predicate (#903, #1214).
(key: string): booleanSource notes
Shared dangerous-key predicate (#903, #1214). Prototype-internal keys must never be injected from untrusted props on ANY path: host prop collection (collectPublicProps / normalizePublicProps in props-utils.ts), guarded assignment (injectPropsSafe below — the SPA bootstrap page-projection write boundary in
packages/element/src/internal/core/security.ts:53Per-island delivery options (hydration strategy, SSR/DSD participation).
IslandOptionsOptions and source location
packages/protocol/src/island.ts:8Shared safe-attribute-name predicate (#1033): the SSR face of the one canonical predicate in `../protocol/forbidden-sinks.ts`.
(name: string): booleanSource notes
Shared safe-attribute-name predicate (#1033): the SSR face of the one canonical predicate in `../protocol/forbidden-sinks.ts`. A name must be valid HTML attribute-name grammar (blocks quote/space injection, #602), must not be an event handler (`on*`, case-insensitive), and must not be a forbidden sink (`innerhtml`/`srcdoc`). The compiler, protocol validator, and server serializer enforce the same predicate with their own failure strategies; every path delegates to the single implementation, so the boundary cannot diverge.
packages/element/src/internal/core/security.ts:67Check if a tag name is a valid custom element name per HTML spec.
(tagName: string): booleanpackages/element/src/internal/core/tag-utils.ts:38Select the built-in layout, declare a custom layout with its module and props, or disable the layout.
LayoutConfigSource notes
Layout declaration: `false` disables the layout entirely, `'default'` uses the built-in layout, and the object form names a tag with the module path that defines it (`import`, resolved like a {@link FrameworkOptions.middleware.use } entry) plus the compiled layout properties the router injects per route.
packages/protocol/src/framework.ts:96Route loader: fetches data for a page route.
Loader<T, Env, Platform, Route>packages/protocol/src/data.ts:56Context passed to a request-time ('dynamic') route loader.
LoaderContext<Env, Platform, Route>Options and source location
packages/protocol/src/data.ts:40Locale-aware resolved path contract.
LocalePathOptions and source location
packages/protocol/src/framework.ts:82logger.ts - Tagged console logger. Lightweight scoped logger. Returns plain functions so it is tree-shakable and has zero class overhead.
LoggerOptions and source location
packages/element/src/internal/core/logger.ts:10Request-body bound (bytes) the generated entry applies to action POST routes; larger uploads belong on API routes with explicit limits.
numberpackages/protocol/src/policy.ts:57Nested element expansion depth bound for `renderToString`: cyclic component composition fails closed instead of recursing without end.
8packages/protocol/src/policy.ts:51Fetch middleware contract (#858): WinterCG shape, dialect-free — no Hono/h3 context object.
MiddlewareSource notes
Fetch middleware contract (#858): WinterCG shape, dialect-free — no Hono/h3 context object. Composed at the handler boundary in onion order (`use[0]` is outermost: it sees the request first and the response last), so it runs with identical semantics in the dev server, the `start` CLI, the e2e fixture server, and the Nitro production entry. A middleware may short-circuit by returning a Response without calling `next()`, or post-process the Response that `next()` returns. Module contract: a Middleware is the DEFAULT EXPORT of a module referenced from `middleware.use` by path (e.g. './app/middleware/auth.ts'). The generated server entry imports the module, so the middleware may close over module scope and import local helpers and third-party packages — it is a real module in the server module graph, never serialized source.
packages/protocol/src/framework.ts:169Run a callback on each element connection. If it returns a cleanup function, run that function on disconnect.
(callback: (env: { readonly host: HTMLElement; readonly signal: AbortSignal; readonly states: CustomStateSet; }) => void | (() => void)): voidSource notes
Compiler-recognized connect intrinsic: runs the callback on every connection of the generated element (initial mount and each reconnect) and releases the optional returned cleanup at that disconnection. Erased by the compiler; calling it at runtime fails closed. The callback may keep the original zero-argument form or declare ONE `env` parameter. `env.host` is the generated element the connection belongs to (for a depth-1 retained hostless child: its nearest ancestor generated element), and `env.signal` aborts at the START of that disconnection, before any registered cleanup runs; a reconnect gets a fresh, un-aborted signal. The parameter's type is the author-facing contract only — the compiler erases it and passes the value from the connection scope the callback runs in.
packages/element/src/internal/core/compile-lifecycle.ts:58Run a callback once when the generated element is disposed, after its connection cleanups.
(callback: (env: { readonly host: HTMLElement; readonly signal: AbortSignal; readonly states: CustomStateSet; }) => void): voidSource notes
Compiler-recognized dispose intrinsic: runs the callback exactly once when the generated element instance is torn down (explicit `dispose()`), after that connection's connect-cleanups. Erased by the compiler; calling it at runtime fails closed. The callback may keep the original zero-argument form or declare ONE `env` parameter whose `signal` is the instance-lifetime teardown signal: it is aborted at the start of teardown, before this and every other disposal callback runs, so `env.signal.aborted` is `true` inside the callback.
packages/element/src/internal/core/compile-lifecycle.ts:80Compiler-recognized error intrinsic (`16b-EB`): the author-facing error boundary of ONE generated element.
(callback: (env: { readonly host: HTMLElement; readonly signal: AbortSignal; readonly states: CustomStateSet; readonly error: unknown; }) => void): voidSource notes
Compiler-recognized error intrinsic (`16b-EB`): the author-facing error boundary of ONE generated element. The callback runs when a value escapes from the element's own work — the connect/claim pass (mount, claim, setup and the `onConnect` replay) and an UPDATE-phase write (a tracked slot refresh or a DOM event handler dispatched inside the compiled body). Erased by the compiler; calling it at runtime fails closed. `env.host` is the generated element the failing work belongs to (the nearest ancestor generated element for a depth-1 retained hostless child), `env.signal` is the per-connection `LifetimeScope` signal for a connect-phase failure and the instance-lifetime teardown signal otherwise, `env.states` is the element's `CustomStateSet`, and `env.error` is the thrown value EXACTLY as it was thrown (never wrapped or replaced). The callback may keep the zero-argument form. A catching handler changes only whether the error escapes: a connect-phase failure still leaves the element in its defined post-failure state (no projection, no listeners, a later reconnect retries from scratch), and an update-phase failure leaves the previously written DOM in place with the subscription still live for the next write. A handler that itself throws REPLACES the original error — that new throw is what surfaces. With no registered handler the pre-existing rethrow/rollback behaviour is unchanged. The callback is CLIENT-owned: it is erased into the compiled module and never runs during `__ssr` (a server render has no element, no connection scope and no handler registry; a producer throw fails the render, exactly as before).
packages/element/src/internal/core/compile-lifecycle.ts:144Run a callback after a declared property changes through an attribute or property write.
(callback: (event: { readonly host: HTMLElement; readonly signal: AbortSignal; readonly states: CustomStateSet; readonly name: string; readonly value: unknown; }) => void): voidSource notes
Compiler-recognized change intrinsic: runs the callback after a DECLARED property of this generated element commits a new value, for an attribute write and for a property write, and never at setup. Erased by the compiler — the callback is registered on the element-lifetime instance owner through the compiler-private host record; calling it at runtime fails closed. `event.host` is the generated element (the nearest ancestor generated element for a depth-1 retained hostless child), `event.signal` is the instance-lifetime teardown signal, and `event.name`/`event.value` are the changed row and its committed value. The callback may keep the zero-argument form.
packages/element/src/internal/core/compile-lifecycle.ts:103One documented attribute of a custom element declaration.
OpenElementAttributeOptions and source location
packages/protocol/src/manifest.ts:15One documented CSS part of a custom element declaration.
OpenElementCssPartOptions and source location
packages/protocol/src/manifest.ts:38One custom element declaration in a package manifest: tag, members and delivery metadata.
OpenElementDeclarationOptions and source location
packages/protocol/src/manifest.ts:116Framework error carrying a stable code, severity, phase and recoverability contract.
class OpenElementError extends Errorpackages/protocol/src/errors.ts:100One documented custom event of a custom element declaration.
OpenElementEventOptions and source location
packages/protocol/src/manifest.ts:25Package manifest of component declarations (not a Custom Elements Manifest).
OpenElementPackageManifestOptions and source location
packages/protocol/src/manifest.ts:129Host-agnostic route and asset contracts shared by app and build drivers.
OpenElementRouteKindpackages/protocol/src/app-model.ts:2One route tree entry, including the URL path, route kind, source, optional tag and params, and child routes.
OpenElementRouteNodeSource notes
One node of the host-agnostic route tree: the matched URL `path` and route kind, the source and module paths the drivers resolve, the optional registered tag and param names, and the nested `children`.
packages/protocol/src/app-model.ts:9One documented slot of a custom element declaration.
OpenElementSlotOptions and source location
packages/protocol/src/manifest.ts:32Media type of the RFC 9457 action error channel (#863).
"application/problem+json"packages/protocol/src/data.ts:117RFC 9457 response for action protocol errors. The media type is application/problem+json, and detail describes the failure.
ProblemDetailsSource notes
RFC 9457 Problem Details document (#863): the action error channel answers `application/problem+json` instead of the bespoke `{ type: 'error', error: { message } }` JSON, so HTTP tooling recognizes failures natively. With `type: 'about:blank'`, `title` is the HTTP reason phrase and `detail` carries the specific explanation. The wire shape is alpha-unfrozen; the 1.0 acceptance freezes it in this problem+json form.
packages/protocol/src/data.ts:105Provide a plain protocol value; the provider Signal remains OE-private.
<T>(host: HTMLElement, context: Context<T>, value: T): UnsubscribeSource notes
Provide a plain protocol value; the provider Signal remains OE-private. The returned handle owns exactly one provider record. A repeated call for the same host and {@linkcode Context.key} disposes the previous record (its request listener and mapping) before publishing the replacement, so repeated provides and reconnect cycles never accumulate listeners; the replaced handle becomes a no-op. Releasing removes only the current record and is idempotent.
packages/element/src/internal/core/signal-context.ts:131Read-only signal protocol used by computed values.
ReadonlySignal<T>Options and source location
packages/protocol/src/signal.ts:26Compiler-recognized node-handle factory (`16b-REF`): declares a REF HANDLE for one intrinsic DOM node of this component.
<T extends globalThis.Element = Element>(callback?: (element: T | null) => void | (() => void)): { (element: globalThis.Element | null): void; readonly current: T | null; }Source notes
Compiler-recognized node-handle factory (`16b-REF`): declares a REF HANDLE for one intrinsic DOM node of this component. The returned value is handed to that node's existing JSX `ref` attribute: ```tsx const field = ref<HTMLInputElement>((element) => { element?.focus(); return () => {/* detach cleanup *\/}; }); // … return <input ref={field} />; ``` The handle is the same object for the whole element lifetime: the compiler erases this call into the retained instance factory, so a reconnect, a claim of server DOM and an update all observe one handle rather than a per-pass copy. It is a REF CHANNEL VALUE, not a reactive source: `current` is written when the node attaches, cleared when it detaches, and it notifies nothing — a tracked slot reading `current` would be a one-shot value, which is why the compiler admits a handle ONLY in a `ref` attribute expression. The optional callback is the attach/detach notification the existing `ref` channel already defines: called with the element on attach, and with `null` on detach AFTER the cleanup it returned has run. Because the handle rides the same `ref` channel, the cleanup ordering, the once-per-detach rule and the scope ownership are the existing ones — this intrinsic adds no second attachment mechanism. Erased by the compiler; calling it at runtime fails closed.
packages/element/src/internal/core/compile-lifecycle.ts:187Release the provider bridge created by one hosted {@linkcode consumeContext} call.
(signalValue: SignalLike<unknown>): voidSource notes
Release the provider bridge created by one hosted {@linkcode consumeContext} call. The bridge is deregistered only AFTER its cleanup returns: a throwing unsubscribe must not leave the signal in a state where the bridge is gone from the bookkeeping but still attached to the provider (unretryable). If cleanup throws, the entry stays registered and the error propagates verbatim, so the caller can retry the release — for example from a `disconnectedCallback` that runs again — once the provider's unsubscribe succeeds. A second call after a successful release is a no-op, and a signal without a bridge (including a signal created without a `host`) is always a no-op.
packages/element/src/internal/core/signal-context.ts:208Recoverable render-phase error carrying the failing component path and tag.
class RenderError extends OpenElementErrorpackages/element/src/internal/core/errors.ts:95Server-render one compiled element through canonical Element composition: returns the serialized DSD `html` string directly.
(input: string | CustomElementConstructor, options?: RenderToStringOptions): stringpackages/element/src/public-runtime.ts:945Set the compiled class, props, diagnostic context, admitted nested elements, and trusted light children for renderToString.
RenderToStringOptionsSource notes
Options for one `renderToString()` call: the compiled component class to serialize, the values projected onto its compiled properties, optional route/source diagnostics metadata, the nested compiled tags the build admitted, and trusted parent-owned light children keyed by slot name.
packages/element/src/public-runtime.ts:170Report an {@linkcode OpenElementError} to the telemetry hook, or console.error when none is installed.
(error: OpenElementError): voidOptions and source location
packages/element/src/internal/core/errors.ts:139A discovered route’s URL, source, type, generated binding name, and optional custom element tag.
RouteEntrySource notes
One route admitted by the scanner: URL `path`, source `filePath`, the route `type`, the generated variable name (`varName`) the entry binds it to, and the optional registration tag. {@link RouteEntry.definePage} and {@link RouteEntry.hasEnhancedForms} carry the two source-derived admission facts the generated entries branch on.
packages/protocol/src/framework.ts:113Canonical request-time/SSG server route context.
ServerRouteContext<Env, Platform, Route>Options and source location
packages/protocol/src/data.ts:25Context passed to a request-time ('dynamic') route loader.
ServerRouteMetadataSource notes
Context passed to a request-time ('dynamic') route loader. This is the server contract: the loader runs on the server with the Web-standard request, matched route params, the host environment and the platform object, and signals validation failure via fail()/redirect().
packages/protocol/src/data.ts:19Install the process-wide error telemetry hook (replaceable for tests, HMR, multi-app pages).
(hook: ErrorTelemetryHook): voidpackages/element/src/internal/core/errors.ts:127Create a writable signal through the selected signal engine.
<T>(initialValue: T): WritableSignal<T>packages/element/src/internal/signal/framework.ts:19Alias for APIs that accept either writable or read-only signals.
Signal<T>packages/protocol/src/signal.ts:31Special file kinds the route scanner recognizes by filename: `renderer` and `middleware`.
SpecialFileTypepackages/protocol/src/framework.ts:79The build’s SSR verdict for a discovered tag, including its module, discovery source, render path, and reason.
SsrAdmissionDecisionSource notes
The build's admission verdict for one discovered tag: where the declaration lives (`modulePath`), how it was discovered (`source`), which render path it is admitted to, and the reason recorded for the manifest.
packages/protocol/src/render.ts:37Tags a deferred frame cannot safely install into an owned Part range: the browser installer rejects any frame whose markup carries one of these.
readonly ["script", "style", "template", "iframe", "object", "embed", "base", "meta", "link"]packages/protocol/src/stream-frame-policy.ts:26Schemes that make a URL attribute unsafe in a streamed frame.
RegExppackages/protocol/src/stream-frame-policy.ts:60URL-carrying attributes the frame check screens for script-bearing scheme obfuscation; only these attribute names are value-screened.
readonly ["href", "src", "action", "formaction", "xlink:href"]packages/protocol/src/stream-frame-policy.ts:42The highest control character code point removed before checking a URL scheme.
32Source notes
Control characters at or below this code point are stripped before the URL-scheme test, so tab/newline/control obfuscation cannot smuggle a scheme past admission.
packages/protocol/src/stream-frame-policy.ts:55Deferred fields (declared streamed properties) one stream route's manifest may carry.
32Source notes
Deferred fields (declared streamed properties) one stream route's manifest may carry. The build scan, the server executor, and the browser seed contract enforce the same bound.
packages/protocol/src/policy.ts:24Part/Block owners one stream route's manifest may address in total across all deferred fields.
64packages/protocol/src/policy.ts:30Serialized stream payload bound, as a string length in UTF-16 code units: one seed attribute or one deferred frame's markup may not exceed it.
numberSource notes
Serialized stream payload bound, as a string length in UTF-16 code units: one seed attribute or one deferred frame's markup may not exceed it. The server checks the JSON text and the rendered range before emitting; the browser checks the attribute before parsing.
packages/protocol/src/policy.ts:45Maximum number of typed properties the browser accepts in one streamed hydration seed.
64Source notes
Typed properties one streamed seed may carry: the browser seed contract rejects the WHOLE seed above this count, so an oversized component would silently fail to hydrate instead of failing loud at the server.
packages/protocol/src/policy.ts:37Milliseconds a streamed response waits for deferred fields before failing those still pending.
30000Source notes
Deferred-field resolution budget (milliseconds) for one streamed response: fields still pending when it expires are failed in place and the stream ends with the shell and whatever resolved.
packages/protocol/src/policy.ts:64Cross-realm StyleSheet constructor: the native CSSStyleSheet or the internal shim.
new () => StyleSheetLikepackages/element/src/internal/core/style-sheet.ts:110Minimal stylesheet contract (replaceSync + cssRules) satisfied by native and shim sheets.
StyleSheetLikeOptions and source location
packages/protocol/src/style-sheet.ts:14Mark an HTML string as trusted for explicit `innerHTML` sinks (the trust does not serialize).
(html: string): TrustedHtmlpackages/element/src/internal/core/security.ts:88Opaque capability marking HTML the application has explicitly vetted as trusted.
TrustedHtmlOptions and source location
packages/element/src/internal/core/security.ts:83Check whether a static attribute makes a streamed frame unsafe to install.
(name: string, value: string): booleanSource notes
Whether a static attribute (name/value as authored into the Part Program) makes a streamed frame unsafely installable: event-handler, seed-spoofing, and srcdoc names fail outright, and URL-carrying names fail when the entity-decoded, control-stripped value carries a script scheme.
packages/protocol/src/stream-frame-policy.ts:113Subscribe to the nearest context provider. Return a signal with the declared default when no provider exists.
<T>(context: { readonly key: symbol; readonly defaultValue: T; }): { readonly value: T; subscribe(fn: (value: T) => void): () => void; }Source notes
Compiler-recognized CONSUMER intrinsic (`16b-CTX`): declares a tracked consumer of `context` for this component and returns the signal its value lives in. ```tsx const theme = useContext(ThemeContext); return <p>{theme.value}</p>; // a tracked slot: refreshes on provider change ``` The returned signal is ONE persistent consumer-local signal: the compiler erases this call into the component's retained setup record, so a reconnect re-reads the nearest provider into the SAME object and a tracked slot keeps exactly one subscription target for the whole element lifetime. Lookup follows the nearest owning component, so an inner provider shadows an outer one and a component with no ancestor provider reads the context's declared default. Reading `.value` in a tracked slot is the supported use — this is the lane's reactive channel, unlike `ref`'s `current`. Reading it inside a handler also works (the signal is live), but only tracked slots refresh. Erased by the compiler; calling it at runtime fails closed.
packages/element/src/internal/core/compile-lifecycle.ts:285Return the custom element that owns the current component instance.
(): HTMLElementSource notes
Compiler-recognized HOST-ACCESS intrinsic (`16b-REF`, `useHost`). ```tsx const host = useHost(); // … host is this instance's owning element (the custom element). ``` It exposes the SAME fact the lifecycle/change/error callbacks already receive as `env.host` — the owning generated element for a root, the nearest enclosing generated element host for a depth-1 retained hostless child — through the expression position instead of a callback parameter. There is therefore no new runtime channel and no second host lookup: the compiler erases the call into a read of the host-element field the retained setup factory already receives. The read is NOT reactive: the element identity never changes for an instance, so a derived node capturing it can never go stale. That is also why it carries no lifecycle ownership — it allocates nothing and needs no cleanup. Erased by the compiler; calling it at runtime fails closed.
packages/element/src/internal/core/compile-lifecycle.ts:218Wrap rendered HTML in a full HTML document.
(html: string, options?: DocumentWrapOptions): stringSource notes
Wrap rendered HTML in a full HTML document. Adds DOCTYPE, head (title, meta, preload), and body. Supports CSP nonce and dev scripts (e.g. Vite client, route module registration).
packages/element/src/internal/core/html-escape.ts:199Compose a fetch middleware chain (#858) around a handler, in onion order: `middleware[0]` is outermost — it sees the request first and the response last.
<Args extends unknown[]>(middleware: Middleware[], handler: (request: Request, ...args: Args) => Promise<Response>): (request: Request, ...args: Args) => Promise<Response>Source notes
Compose a fetch middleware chain (#858) around a handler, in onion order: `middleware[0]` is outermost — it sees the request first and the response last. A middleware may short-circuit by returning a Response without calling `next()`. Extra arguments (runtime context such as env/platform) thread transparently past the middleware chain to the terminal handler — the WinterCG-shaped middleware itself only ever sees `(request, next)`. Generated server entries call this once at module scope so the dev server, the `start` CLI, the e2e fixture server, and the Nitro production entry all share the same composed handler.
packages/element/src/internal/core/runtime.ts:47<Env extends Record<string, unknown> = Record<string, unknown>>(options: RuntimeAdapterOptions<Env>): RuntimeAdapter<Env>Source notes
Normalize a runtime adapter declaration: pass the name, fetch handler and optional prerender iterator through unchanged so a host integration only implements the {@link RuntimeAdapter} contract it needs.
packages/element/src/internal/core/runtime.ts:23Serialize a value to pretty-printed JSON ending with a newline.
(value: unknown): stringpackages/element/src/internal/core/write-json.ts:11Insert markup before a tolerant HTML body close (`</body >`, case-insensitive).
(html: string, content: string): stringpackages/element/src/internal/core/html-route-utils.ts:2(path: string, sep?: "/" | "-"): stringSource notes
Normalize path separators and collapse duplicates. - Backslashes and forward slashes are replaced with the chosen separator. - Repeated separators are collapsed to a single separator.
packages/element/src/internal/core/path-utils.ts:17The host-neutral request handler every runtime adapter and generated server entry exposes: a WinterCG `(request, context?)
OpenElementRequestHandler<Env>Source notes
The host-neutral request handler every runtime adapter and generated server entry exposes: a WinterCG `(request, context?) => Response` with no server engine dialect baked in.
packages/protocol/src/runtime.ts:27(filePath: string): stringSource notes
Convert a file path into a kebab-cased custom element tag name. - Removes a leading `./` or `/`. - Strips known file extensions (`ts`, `tsx`, `js`, `jsx`, `mjs`, `mdx`). - Replaces directory separators with hyphens. - Ensures the result starts with a letter and contains at least one hyphen.
packages/element/src/internal/core/path-utils.ts:32runtime.ts - Runtime adapter protocol.
RuntimeContext<Env>Source notes
runtime.ts - Runtime adapter protocol. Replacement boundary for Nitro, Workers, Node, Deno, or future fetch-compatible runtimes. Preserves openElement semantics while leaving concrete server engines outside this package.
packages/protocol/src/runtime.ts:9Thrown by the SSG build pipeline when the SSR bundle fails to load or the pipeline throws; re-exported via `@openelement/element/build-utils`.
class SsrRenderError extends OpenElementErrorSource notes
Thrown by the SSG build pipeline when the SSR bundle fails to load or the pipeline throws; re-exported via `@openelement/element/build-utils`. Carries the failing component path plus the original error as `cause`.
packages/element/src/internal/core/errors.ts:74Inject island metadata markers into source code.
(source: string, options: IslandTransformOptions): IslandTransformResultSource notes
Inject island metadata markers into source code. Only transforms files inside the islands directory. Tag names are derived from the file path and normalized to valid custom element names (lowercase letters, digits, and hyphens). Unsafe characters are silently normalized to hyphens.
packages/element/src/internal/core/island-transform.ts:20Set the emitted stylesheet URLs for this server process.
(urls: readonly string[] | null | undefined, islandEntries?: ReadonlyArray<readonly [string, readonly string[] | null]> | null): voidSource notes
Set the emitted stylesheet URLs for this server process. Called by the router's generated SSR/SSG entry (build time and request-time startup) with the base-joined asset addresses Phase 2 emitted. The optional `islandEntries` half carries the per-tag URLs of generated SHADOW hosts (M09-2e / #1803) through the SAME channel: one setter, one entry import, no second public seam. A `null` URL list is the explicit "declared but carrier unavailable" state the nested renderer fails closed on.
packages/element/src/internal/compiled/server/style-links.ts:34Route action: handles form submissions for a page route.
Action<T, Env, Platform, Route>packages/protocol/src/data.ts:64Choose the form action response: true returns serialized data and enhance returns the full HTML used without JavaScript.
"x-openelement-action"Source notes
Request header selecting the action response channel: `true` marks a programmatic caller and selects the serialized ActionResult union; `enhance` marks the built-in morph enhancement and selects the same full-HTML responses the no-JS path receives.
packages/protocol/src/data.ts:125Context passed to a route action function (extends loader context).
ActionContext<Env, Platform, Route>Options and source location
packages/protocol/src/data.ts:47Wire shape returned to the JavaScript form-enhancement path.
ActionResult<Failure>Source notes
Wire shape returned to the JavaScript form-enhancement path. The no-JS path never sees this: it gets the equivalent semantics as plain HTTP (303 on success, 422 with the re-rendered form on validation failure, redirect/error as status codes). Success carries no data envelope. The application-loop contract makes a successful non-GET action answer 303 (PRG) — the framework never answers 200 with a rendered page, or with a success document, for a successful mutation — so the fetch channel answers `{ type: 'redirect' }` naming the PRG target and the authored return value is discarded by design. Success data travels the PRG target instead (query state the loader re-runs with, which the props projector then maps; see the router guide's "Form actions" section). The union previously declared a `{ type: 'success' }` member that no code path ever emitted — removed so the type matches the wire. Error outcomes (CSRF 403, unknown action 404, unparseable body 400, unexpected 500) are NOT part of this union: since #863 they answer RFC 9457 Problem Details with the PROBLEM_JSON_MEDIA_TYPE content type — see ProblemDetails.
packages/protocol/src/data.ts:92Assert that a tag name is a valid custom element name.
(tagName: string): voidpackages/element/src/internal/core/tag-utils.ts:50Collect all public (non-internal) own properties from a host object.
(host: object): Record<string, unknown>Source notes
Collect all public (non-internal) own properties from a host object. Keys starting with `__openElement` are framework-internal and excluded. Uses Reflect.get for safe access (respects getters); a getter that throws is skipped with a warning so one bad prop cannot take the tree down.
packages/element/src/internal/core/props-utils.ts:41The scanner’s per-tag compatibility tier, reason, discovery source, and rendering and hydration facts.
CompatibilityClassificationSource notes
The per-tag verdict the compatibility scanner records: the tier a discovered tag was classified as, the human-readable `reason`, where the tag was found (`source`), and the SSR/DSD/hydration facts the verdict was derived from.
packages/protocol/src/framework.ts:347The tag’s build compatibility level: server-rendered, client-only, experimental, or rejected.
CompatibilityTierSource notes
How far a discovered tag may participate in the build: 'ssr-capable' renders and hydrates, 'client-only' ships to the browser without server output, 'experimental-dom' is admitted with a downgraded guarantee, and 'rejected' fails the build.
packages/protocol/src/framework.ts:340A component’s delivery layer: static DSD, interactive DSD, a client-only island, or light DOM.
ComponentLayerSource notes
The delivery layer a component belongs to: fully static DSD markup ('dsd-static'), DSD markup with a client island ('dsd-interactive'), a client-only island with no SSR output ('pure-island'), or a light-DOM element ('light-dom'). Recorded per component in the build manifest and consumed by the hydration scheduler.
packages/protocol/src/framework.ts:23Create a derived read-only signal recomputed from its dependencies.
<T>(fn: () => T): ReadonlySignal<T>packages/element/src/internal/signal/framework.ts:23Consumer-local reactive projection of a protocol context value.
<T>(context: Context<T>, host?: HTMLElement): WritableSignal<T>Source notes
Consumer-local reactive projection of a protocol context value. When a `host` is given, the returned signal is bridged to the nearest provider through one Community Context Protocol subscription. That bridge is owned by the CALLER: a long-lived consumer must release it when it tears down (typically `disconnectedCallback`) with {@linkcode releaseConsumedContext}, exactly once. Releasing detaches the provider bridge, so the provider no longer retains or updates the local signal; the local signal itself stays usable with its last value. A call after a successful release is a no-op, and a signal created without a `host` has no bridge to release.
packages/element/src/internal/core/signal-context.ts:183A typed context token: protocol identity (`key`) plus its default value.
Context<T>Options and source location
packages/element/src/internal/core/signal-context.ts:13Create a typed context token shared between provider and consumer elements.
<T>(key: symbol, defaultValue: T): Context<T>Options and source location
packages/element/src/internal/core/signal-context.ts:58Create the per-render document stylesheet collection.
(): DocumentStyleResourcespackages/element/src/internal/core/html-escape.ts:133Create a {@link Logger} that prefixes every message with `[tag]`.
(tag: string): Loggerpackages/element/src/internal/core/logger.ts:18Object prototype keys that must never be injected from untrusted props.
ReadonlySet<string>packages/element/src/internal/core/security.ts:25Resolve `id` (a `#hash` or bare id) against `root` and, when the id is not in that root's own tree, recurse into every nested shadow root.
(id: string, root?: Document | ShadowRoot): HTMLElement | nullSource notes
Resolve `id` (a `#hash` or bare id) against `root` and, when the id is not in that root's own tree, recurse into every nested shadow root. Returns the first match or `null`; a malformed percent-encoded id is not an error.
packages/element/src/internal/core/deep-fragment.ts:20The same document serialization boundary, with only body wrappers left open.
(options?: DocumentWrapOptions): { prefix: string; suffix: string; }Options and source location
packages/element/src/internal/core/html-escape.ts:205The document-level stylesheet resources ONE server render discovered (alpha15 S lane, S-C1.2).
DocumentStyleResourcesSource notes
The document-level stylesheet resources ONE server render discovered (alpha15 S lane, S-C1.2). A light-root component's DOM lives in the document, so its sheet cannot ride the component's own subtree the way a shadow template's link does: the document owns it. This object is the one carrier between the two halves of that render — the compiled serializer, which discovers a component's external sheets while serializing the component, and the document serializer, which writes the head. It is created per render and never shared, so one page's stylesheets can never reach another page's head.
packages/element/src/internal/core/html-escape.ts:125Run a side effect that re-subscribes whenever its signal dependencies change.
(fn: () => void | Unsubscribe): Unsubscribepackages/element/src/internal/signal/framework.ts:27Install the bounded pre-upgrade interaction capture on an owning root (default: the document).
(root?: EventTarget, pendingTags?: readonly string[]): voidSource notes
Install the bounded pre-upgrade interaction capture on an owning root (default: the document). Generated client entries call this with their declared island tags before any compiled element upgrades; after a successful claim the element replays the captured events whose targets live inside its root (compiled claim capture/replay, internal/compiled/runtime.ts). Idempotent per root (repeat calls merge tags, never reinstall listeners) and a no-op where no DOM exists (SSR). Invariant: the capture itself — one fixed listener set per owning root, installed once per page — is page-lifetime by design and is NOT the leak. The M1 leak was retained event-target records; each element releases exactly its own records at its activation decision (success or failure), while records owned by still-pending elements survive for their delayed/lazy upgrade (#1170). Boundedness: the facade capture passes the declared-island filter, so only interactions under a still-pending DECLARED island tag enter the queue — ordinary events and undeclared third-party custom elements are skipped (nested pending declared islands still capture through their own unsettled host). With no tags declared the legacy dash heuristic applies. The shared queue carries a hard capacity cap (fail closed), detached records are swept when a claim root adopts its share (and under queue pressure), and each activation decision deterministically empties that root's own bucket, so post-hydration traffic and removals never grow retention.
packages/element/src/internal/compiled/runtime/pre-upgrade-events.ts:662Error message prefix for all openElement errors.
"[openElement]"packages/protocol/src/errors.ts:50Callback receiving every reported {@linkcode OpenElementError} for telemetry.
ErrorTelemetryHookpackages/protocol/src/errors.ts:132Escape an HTML attribute value.
(value: string): stringSource notes
Escape an HTML attribute value. Delegates to `escapeHtml` so both share the single `ESCAPE_MAP` and the same single-pass replacement (consolidated in #633). Empty-value conventions remain intentionally distinct by design: - `escapeHtml` returns '' for non-string input. - `escapeAttrValue` (below) coerces via `String()` and is the boundary meant for unknown/variable attribute values.
packages/element/src/internal/core/html-escape.ts:55Escape the five HTML-significant characters in text content.
(str: string): stringpackages/element/src/internal/core/html-escape.ts:39Format an unknown thrown value as a human-readable string.
(e: unknown): stringpackages/element/src/internal/core/errors.ts:52FrameworkOptionsSource notes
The adapter-facing framework options: where routes and islands live, the default layout and named-layout declarations, the document `<html>`/head injection channels, and the request-time middleware switches. Every field is optional; the adapter applies its documented default. This is the type an application config file's default export is checked against, so the rendered option table and the actual config surface cannot drift.
packages/protocol/src/framework.ts:180Runtime list of supported hydration strategies; the single source of truth for the `HydrationStrategy` union.
readonly ["load", "idle", "visible", "only", "none"]Source notes
Runtime list of supported hydration strategies; the single source of truth for the `HydrationStrategy` union. Consumed by island/registry validation and re-exported from the element root for app and build adapters.
packages/protocol/src/framework.ts:28Island hydration trigger: 'load' | 'idle' | 'visible' | 'only'.
"load" | "idle" | "visible" | "only" | "none"packages/protocol/src/framework.ts:30Idle-hydration scheduling fallback (milliseconds) when neither `requestIdleCallback` nor `requestAnimationFrame` is available.
50packages/protocol/src/policy.ts:70Safely assign caller-supplied props onto a target object, skipping keys that could enable prototype pollution and tolerating read-only properties.
(target: Record<string, unknown>, props: Record<string, unknown>, tagName: string, log?: { warn(message: string): void; debug(message: string): void; }): voidSource notes
Safely assign caller-supplied props onto a target object, skipping keys that could enable prototype pollution and tolerating read-only properties. The canonical guarded assigner for the canonical dangerous-key rule (#903, #1214): the
packages/element/src/internal/core/security.ts:131Shared dangerous-key predicate (#903, #1214).
(key: string): booleanSource notes
Shared dangerous-key predicate (#903, #1214). Prototype-internal keys must never be injected from untrusted props on ANY path: host prop collection (collectPublicProps / normalizePublicProps in props-utils.ts), guarded assignment (injectPropsSafe below — the SPA bootstrap page-projection write boundary in
packages/element/src/internal/core/security.ts:53Per-island delivery options (hydration strategy, SSR/DSD participation).
IslandOptionsOptions and source location
packages/protocol/src/island.ts:8Shared safe-attribute-name predicate (#1033): the SSR face of the one canonical predicate in `../protocol/forbidden-sinks.ts`.
(name: string): booleanSource notes
Shared safe-attribute-name predicate (#1033): the SSR face of the one canonical predicate in `../protocol/forbidden-sinks.ts`. A name must be valid HTML attribute-name grammar (blocks quote/space injection, #602), must not be an event handler (`on*`, case-insensitive), and must not be a forbidden sink (`innerhtml`/`srcdoc`). The compiler, protocol validator, and server serializer enforce the same predicate with their own failure strategies; every path delegates to the single implementation, so the boundary cannot diverge.
packages/element/src/internal/core/security.ts:67Check if a tag name is a valid custom element name per HTML spec.
(tagName: string): booleanpackages/element/src/internal/core/tag-utils.ts:38Select the built-in layout, declare a custom layout with its module and props, or disable the layout.
LayoutConfigSource notes
Layout declaration: `false` disables the layout entirely, `'default'` uses the built-in layout, and the object form names a tag with the module path that defines it (`import`, resolved like a {@link FrameworkOptions.middleware.use } entry) plus the compiled layout properties the router injects per route.
packages/protocol/src/framework.ts:96Route loader: fetches data for a page route.
Loader<T, Env, Platform, Route>packages/protocol/src/data.ts:56Context passed to a request-time ('dynamic') route loader.
LoaderContext<Env, Platform, Route>Options and source location
packages/protocol/src/data.ts:40Locale-aware resolved path contract.
LocalePathOptions and source location
packages/protocol/src/framework.ts:82logger.ts - Tagged console logger. Lightweight scoped logger. Returns plain functions so it is tree-shakable and has zero class overhead.
LoggerOptions and source location
packages/element/src/internal/core/logger.ts:10Request-body bound (bytes) the generated entry applies to action POST routes; larger uploads belong on API routes with explicit limits.
numberpackages/protocol/src/policy.ts:57Nested element expansion depth bound for `renderToString`: cyclic component composition fails closed instead of recursing without end.
8packages/protocol/src/policy.ts:51Fetch middleware contract (#858): WinterCG shape, dialect-free — no Hono/h3 context object.
MiddlewareSource notes
Fetch middleware contract (#858): WinterCG shape, dialect-free — no Hono/h3 context object. Composed at the handler boundary in onion order (`use[0]` is outermost: it sees the request first and the response last), so it runs with identical semantics in the dev server, the `start` CLI, the e2e fixture server, and the Nitro production entry. A middleware may short-circuit by returning a Response without calling `next()`, or post-process the Response that `next()` returns. Module contract: a Middleware is the DEFAULT EXPORT of a module referenced from `middleware.use` by path (e.g. './app/middleware/auth.ts'). The generated server entry imports the module, so the middleware may close over module scope and import local helpers and third-party packages — it is a real module in the server module graph, never serialized source.
packages/protocol/src/framework.ts:169Run a callback on each element connection. If it returns a cleanup function, run that function on disconnect.
(callback: (env: { readonly host: HTMLElement; readonly signal: AbortSignal; readonly states: CustomStateSet; }) => void | (() => void)): voidSource notes
Compiler-recognized connect intrinsic: runs the callback on every connection of the generated element (initial mount and each reconnect) and releases the optional returned cleanup at that disconnection. Erased by the compiler; calling it at runtime fails closed. The callback may keep the original zero-argument form or declare ONE `env` parameter. `env.host` is the generated element the connection belongs to (for a depth-1 retained hostless child: its nearest ancestor generated element), and `env.signal` aborts at the START of that disconnection, before any registered cleanup runs; a reconnect gets a fresh, un-aborted signal. The parameter's type is the author-facing contract only — the compiler erases it and passes the value from the connection scope the callback runs in.
packages/element/src/internal/core/compile-lifecycle.ts:58Run a callback once when the generated element is disposed, after its connection cleanups.
(callback: (env: { readonly host: HTMLElement; readonly signal: AbortSignal; readonly states: CustomStateSet; }) => void): voidSource notes
Compiler-recognized dispose intrinsic: runs the callback exactly once when the generated element instance is torn down (explicit `dispose()`), after that connection's connect-cleanups. Erased by the compiler; calling it at runtime fails closed. The callback may keep the original zero-argument form or declare ONE `env` parameter whose `signal` is the instance-lifetime teardown signal: it is aborted at the start of teardown, before this and every other disposal callback runs, so `env.signal.aborted` is `true` inside the callback.
packages/element/src/internal/core/compile-lifecycle.ts:80Compiler-recognized error intrinsic (`16b-EB`): the author-facing error boundary of ONE generated element.
(callback: (env: { readonly host: HTMLElement; readonly signal: AbortSignal; readonly states: CustomStateSet; readonly error: unknown; }) => void): voidSource notes
Compiler-recognized error intrinsic (`16b-EB`): the author-facing error boundary of ONE generated element. The callback runs when a value escapes from the element's own work — the connect/claim pass (mount, claim, setup and the `onConnect` replay) and an UPDATE-phase write (a tracked slot refresh or a DOM event handler dispatched inside the compiled body). Erased by the compiler; calling it at runtime fails closed. `env.host` is the generated element the failing work belongs to (the nearest ancestor generated element for a depth-1 retained hostless child), `env.signal` is the per-connection `LifetimeScope` signal for a connect-phase failure and the instance-lifetime teardown signal otherwise, `env.states` is the element's `CustomStateSet`, and `env.error` is the thrown value EXACTLY as it was thrown (never wrapped or replaced). The callback may keep the zero-argument form. A catching handler changes only whether the error escapes: a connect-phase failure still leaves the element in its defined post-failure state (no projection, no listeners, a later reconnect retries from scratch), and an update-phase failure leaves the previously written DOM in place with the subscription still live for the next write. A handler that itself throws REPLACES the original error — that new throw is what surfaces. With no registered handler the pre-existing rethrow/rollback behaviour is unchanged. The callback is CLIENT-owned: it is erased into the compiled module and never runs during `__ssr` (a server render has no element, no connection scope and no handler registry; a producer throw fails the render, exactly as before).
packages/element/src/internal/core/compile-lifecycle.ts:144Run a callback after a declared property changes through an attribute or property write.
(callback: (event: { readonly host: HTMLElement; readonly signal: AbortSignal; readonly states: CustomStateSet; readonly name: string; readonly value: unknown; }) => void): voidSource notes
Compiler-recognized change intrinsic: runs the callback after a DECLARED property of this generated element commits a new value, for an attribute write and for a property write, and never at setup. Erased by the compiler — the callback is registered on the element-lifetime instance owner through the compiler-private host record; calling it at runtime fails closed. `event.host` is the generated element (the nearest ancestor generated element for a depth-1 retained hostless child), `event.signal` is the instance-lifetime teardown signal, and `event.name`/`event.value` are the changed row and its committed value. The callback may keep the zero-argument form.
packages/element/src/internal/core/compile-lifecycle.ts:103One documented attribute of a custom element declaration.
OpenElementAttributeOptions and source location
packages/protocol/src/manifest.ts:15One documented CSS part of a custom element declaration.
OpenElementCssPartOptions and source location
packages/protocol/src/manifest.ts:38One custom element declaration in a package manifest: tag, members and delivery metadata.
OpenElementDeclarationOptions and source location
packages/protocol/src/manifest.ts:116Framework error carrying a stable code, severity, phase and recoverability contract.
class OpenElementError extends Errorpackages/protocol/src/errors.ts:100One documented custom event of a custom element declaration.
OpenElementEventOptions and source location
packages/protocol/src/manifest.ts:25Package manifest of component declarations (not a Custom Elements Manifest).
OpenElementPackageManifestOptions and source location
packages/protocol/src/manifest.ts:129Host-agnostic route and asset contracts shared by app and build drivers.
OpenElementRouteKindpackages/protocol/src/app-model.ts:2One route tree entry, including the URL path, route kind, source, optional tag and params, and child routes.
OpenElementRouteNodeSource notes
One node of the host-agnostic route tree: the matched URL `path` and route kind, the source and module paths the drivers resolve, the optional registered tag and param names, and the nested `children`.
packages/protocol/src/app-model.ts:9One documented slot of a custom element declaration.
OpenElementSlotOptions and source location
packages/protocol/src/manifest.ts:32Media type of the RFC 9457 action error channel (#863).
"application/problem+json"packages/protocol/src/data.ts:117RFC 9457 response for action protocol errors. The media type is application/problem+json, and detail describes the failure.
ProblemDetailsSource notes
RFC 9457 Problem Details document (#863): the action error channel answers `application/problem+json` instead of the bespoke `{ type: 'error', error: { message } }` JSON, so HTTP tooling recognizes failures natively. With `type: 'about:blank'`, `title` is the HTTP reason phrase and `detail` carries the specific explanation. The wire shape is alpha-unfrozen; the 1.0 acceptance freezes it in this problem+json form.
packages/protocol/src/data.ts:105Provide a plain protocol value; the provider Signal remains OE-private.
<T>(host: HTMLElement, context: Context<T>, value: T): UnsubscribeSource notes
Provide a plain protocol value; the provider Signal remains OE-private. The returned handle owns exactly one provider record. A repeated call for the same host and {@linkcode Context.key} disposes the previous record (its request listener and mapping) before publishing the replacement, so repeated provides and reconnect cycles never accumulate listeners; the replaced handle becomes a no-op. Releasing removes only the current record and is idempotent.
packages/element/src/internal/core/signal-context.ts:131Read-only signal protocol used by computed values.
ReadonlySignal<T>Options and source location
packages/protocol/src/signal.ts:26Compiler-recognized node-handle factory (`16b-REF`): declares a REF HANDLE for one intrinsic DOM node of this component.
<T extends globalThis.Element = Element>(callback?: (element: T | null) => void | (() => void)): { (element: globalThis.Element | null): void; readonly current: T | null; }Source notes
Compiler-recognized node-handle factory (`16b-REF`): declares a REF HANDLE for one intrinsic DOM node of this component. The returned value is handed to that node's existing JSX `ref` attribute: ```tsx const field = ref<HTMLInputElement>((element) => { element?.focus(); return () => {/* detach cleanup *\/}; }); // … return <input ref={field} />; ``` The handle is the same object for the whole element lifetime: the compiler erases this call into the retained instance factory, so a reconnect, a claim of server DOM and an update all observe one handle rather than a per-pass copy. It is a REF CHANNEL VALUE, not a reactive source: `current` is written when the node attaches, cleared when it detaches, and it notifies nothing — a tracked slot reading `current` would be a one-shot value, which is why the compiler admits a handle ONLY in a `ref` attribute expression. The optional callback is the attach/detach notification the existing `ref` channel already defines: called with the element on attach, and with `null` on detach AFTER the cleanup it returned has run. Because the handle rides the same `ref` channel, the cleanup ordering, the once-per-detach rule and the scope ownership are the existing ones — this intrinsic adds no second attachment mechanism. Erased by the compiler; calling it at runtime fails closed.
packages/element/src/internal/core/compile-lifecycle.ts:187Release the provider bridge created by one hosted {@linkcode consumeContext} call.
(signalValue: SignalLike<unknown>): voidSource notes
Release the provider bridge created by one hosted {@linkcode consumeContext} call. The bridge is deregistered only AFTER its cleanup returns: a throwing unsubscribe must not leave the signal in a state where the bridge is gone from the bookkeeping but still attached to the provider (unretryable). If cleanup throws, the entry stays registered and the error propagates verbatim, so the caller can retry the release — for example from a `disconnectedCallback` that runs again — once the provider's unsubscribe succeeds. A second call after a successful release is a no-op, and a signal without a bridge (including a signal created without a `host`) is always a no-op.
packages/element/src/internal/core/signal-context.ts:208Recoverable render-phase error carrying the failing component path and tag.
class RenderError extends OpenElementErrorpackages/element/src/internal/core/errors.ts:95Server-render one compiled element through canonical Element composition: returns the serialized DSD `html` string directly.
(input: string | CustomElementConstructor, options?: RenderToStringOptions): stringpackages/element/src/public-runtime.ts:945Set the compiled class, props, diagnostic context, admitted nested elements, and trusted light children for renderToString.
RenderToStringOptionsSource notes
Options for one `renderToString()` call: the compiled component class to serialize, the values projected onto its compiled properties, optional route/source diagnostics metadata, the nested compiled tags the build admitted, and trusted parent-owned light children keyed by slot name.
packages/element/src/public-runtime.ts:170Report an {@linkcode OpenElementError} to the telemetry hook, or console.error when none is installed.
(error: OpenElementError): voidOptions and source location
packages/element/src/internal/core/errors.ts:139A discovered route’s URL, source, type, generated binding name, and optional custom element tag.
RouteEntrySource notes
One route admitted by the scanner: URL `path`, source `filePath`, the route `type`, the generated variable name (`varName`) the entry binds it to, and the optional registration tag. {@link RouteEntry.definePage} and {@link RouteEntry.hasEnhancedForms} carry the two source-derived admission facts the generated entries branch on.
packages/protocol/src/framework.ts:113Canonical request-time/SSG server route context.
ServerRouteContext<Env, Platform, Route>Options and source location
packages/protocol/src/data.ts:25Context passed to a request-time ('dynamic') route loader.
ServerRouteMetadataSource notes
Context passed to a request-time ('dynamic') route loader. This is the server contract: the loader runs on the server with the Web-standard request, matched route params, the host environment and the platform object, and signals validation failure via fail()/redirect().
packages/protocol/src/data.ts:19Install the process-wide error telemetry hook (replaceable for tests, HMR, multi-app pages).
(hook: ErrorTelemetryHook): voidpackages/element/src/internal/core/errors.ts:127Create a writable signal through the selected signal engine.
<T>(initialValue: T): WritableSignal<T>packages/element/src/internal/signal/framework.ts:19Alias for APIs that accept either writable or read-only signals.
Signal<T>packages/protocol/src/signal.ts:31Special file kinds the route scanner recognizes by filename: `renderer` and `middleware`.
SpecialFileTypepackages/protocol/src/framework.ts:79The build’s SSR verdict for a discovered tag, including its module, discovery source, render path, and reason.
SsrAdmissionDecisionSource notes
The build's admission verdict for one discovered tag: where the declaration lives (`modulePath`), how it was discovered (`source`), which render path it is admitted to, and the reason recorded for the manifest.
packages/protocol/src/render.ts:37Tags a deferred frame cannot safely install into an owned Part range: the browser installer rejects any frame whose markup carries one of these.
readonly ["script", "style", "template", "iframe", "object", "embed", "base", "meta", "link"]packages/protocol/src/stream-frame-policy.ts:26Schemes that make a URL attribute unsafe in a streamed frame.
RegExppackages/protocol/src/stream-frame-policy.ts:60URL-carrying attributes the frame check screens for script-bearing scheme obfuscation; only these attribute names are value-screened.
readonly ["href", "src", "action", "formaction", "xlink:href"]packages/protocol/src/stream-frame-policy.ts:42The highest control character code point removed before checking a URL scheme.
32Source notes
Control characters at or below this code point are stripped before the URL-scheme test, so tab/newline/control obfuscation cannot smuggle a scheme past admission.
packages/protocol/src/stream-frame-policy.ts:55Deferred fields (declared streamed properties) one stream route's manifest may carry.
32Source notes
Deferred fields (declared streamed properties) one stream route's manifest may carry. The build scan, the server executor, and the browser seed contract enforce the same bound.
packages/protocol/src/policy.ts:24Part/Block owners one stream route's manifest may address in total across all deferred fields.
64packages/protocol/src/policy.ts:30Serialized stream payload bound, as a string length in UTF-16 code units: one seed attribute or one deferred frame's markup may not exceed it.
numberSource notes
Serialized stream payload bound, as a string length in UTF-16 code units: one seed attribute or one deferred frame's markup may not exceed it. The server checks the JSON text and the rendered range before emitting; the browser checks the attribute before parsing.
packages/protocol/src/policy.ts:45Maximum number of typed properties the browser accepts in one streamed hydration seed.
64Source notes
Typed properties one streamed seed may carry: the browser seed contract rejects the WHOLE seed above this count, so an oversized component would silently fail to hydrate instead of failing loud at the server.
packages/protocol/src/policy.ts:37Milliseconds a streamed response waits for deferred fields before failing those still pending.
30000Source notes
Deferred-field resolution budget (milliseconds) for one streamed response: fields still pending when it expires are failed in place and the stream ends with the shell and whatever resolved.
packages/protocol/src/policy.ts:64Cross-realm StyleSheet constructor: the native CSSStyleSheet or the internal shim.
new () => StyleSheetLikepackages/element/src/internal/core/style-sheet.ts:110Minimal stylesheet contract (replaceSync + cssRules) satisfied by native and shim sheets.
StyleSheetLikeOptions and source location
packages/protocol/src/style-sheet.ts:14Mark an HTML string as trusted for explicit `innerHTML` sinks (the trust does not serialize).
(html: string): TrustedHtmlpackages/element/src/internal/core/security.ts:88Opaque capability marking HTML the application has explicitly vetted as trusted.
TrustedHtmlOptions and source location
packages/element/src/internal/core/security.ts:83Check whether a static attribute makes a streamed frame unsafe to install.
(name: string, value: string): booleanSource notes
Whether a static attribute (name/value as authored into the Part Program) makes a streamed frame unsafely installable: event-handler, seed-spoofing, and srcdoc names fail outright, and URL-carrying names fail when the entity-decoded, control-stripped value carries a script scheme.
packages/protocol/src/stream-frame-policy.ts:113Subscribe to the nearest context provider. Return a signal with the declared default when no provider exists.
<T>(context: { readonly key: symbol; readonly defaultValue: T; }): { readonly value: T; subscribe(fn: (value: T) => void): () => void; }Source notes
Compiler-recognized CONSUMER intrinsic (`16b-CTX`): declares a tracked consumer of `context` for this component and returns the signal its value lives in. ```tsx const theme = useContext(ThemeContext); return <p>{theme.value}</p>; // a tracked slot: refreshes on provider change ``` The returned signal is ONE persistent consumer-local signal: the compiler erases this call into the component's retained setup record, so a reconnect re-reads the nearest provider into the SAME object and a tracked slot keeps exactly one subscription target for the whole element lifetime. Lookup follows the nearest owning component, so an inner provider shadows an outer one and a component with no ancestor provider reads the context's declared default. Reading `.value` in a tracked slot is the supported use — this is the lane's reactive channel, unlike `ref`'s `current`. Reading it inside a handler also works (the signal is live), but only tracked slots refresh. Erased by the compiler; calling it at runtime fails closed.
packages/element/src/internal/core/compile-lifecycle.ts:285Return the custom element that owns the current component instance.
(): HTMLElementSource notes
Compiler-recognized HOST-ACCESS intrinsic (`16b-REF`, `useHost`). ```tsx const host = useHost(); // … host is this instance's owning element (the custom element). ``` It exposes the SAME fact the lifecycle/change/error callbacks already receive as `env.host` — the owning generated element for a root, the nearest enclosing generated element host for a depth-1 retained hostless child — through the expression position instead of a callback parameter. There is therefore no new runtime channel and no second host lookup: the compiler erases the call into a read of the host-element field the retained setup factory already receives. The read is NOT reactive: the element identity never changes for an instance, so a derived node capturing it can never go stale. That is also why it carries no lifecycle ownership — it allocates nothing and needs no cleanup. Erased by the compiler; calling it at runtime fails closed.
packages/element/src/internal/core/compile-lifecycle.ts:218Wrap rendered HTML in a full HTML document.
(html: string, options?: DocumentWrapOptions): stringSource notes
Wrap rendered HTML in a full HTML document. Adds DOCTYPE, head (title, meta, preload), and body. Supports CSP nonce and dev scripts (e.g. Vite client, route module registration).
packages/element/src/internal/core/html-escape.ts:199Resolve `id` (a `#hash` or bare id) against `root` and, when the id is not in that root's own tree, recurse into every nested shadow root.
(id: string, root?: Document | ShadowRoot): HTMLElement | nullSource notes
Resolve `id` (a `#hash` or bare id) against `root` and, when the id is not in that root's own tree, recurse into every nested shadow root. Returns the first match or `null`; a malformed percent-encoded id is not an error.
packages/element/src/internal/core/deep-fragment.ts:20Install the bounded pre-upgrade interaction capture on an owning root (default: the document).
(root?: EventTarget, pendingTags?: readonly string[]): voidSource notes
Install the bounded pre-upgrade interaction capture on an owning root (default: the document). Generated client entries call this with their declared island tags before any compiled element upgrades; after a successful claim the element replays the captured events whose targets live inside its root (compiled claim capture/replay, internal/compiled/runtime.ts). Idempotent per root (repeat calls merge tags, never reinstall listeners) and a no-op where no DOM exists (SSR). Invariant: the capture itself — one fixed listener set per owning root, installed once per page — is page-lifetime by design and is NOT the leak. The M1 leak was retained event-target records; each element releases exactly its own records at its activation decision (success or failure), while records owned by still-pending elements survive for their delayed/lazy upgrade (#1170). Boundedness: the facade capture passes the declared-island filter, so only interactions under a still-pending DECLARED island tag enter the queue — ordinary events and undeclared third-party custom elements are skipped (nested pending declared islands still capture through their own unsettled host). With no tags declared the legacy dash heuristic applies. The shared queue carries a hard capacity cap (fail closed), detached records are swept when a claim root adopts its share (and under queue pressure), and each activation decision deterministically empties that root's own bucket, so post-hydration traffic and removals never grow retention.
packages/element/src/internal/compiled/runtime/pre-upgrade-events.ts:662Create the per-render document stylesheet collection.
(): DocumentStyleResourcespackages/element/src/internal/core/html-escape.ts:133The document-level stylesheet resources ONE server render discovered (alpha15 S lane, S-C1.2).
DocumentStyleResourcesSource notes
The document-level stylesheet resources ONE server render discovered (alpha15 S lane, S-C1.2). A light-root component's DOM lives in the document, so its sheet cannot ride the component's own subtree the way a shadow template's link does: the document owns it. This object is the one carrier between the two halves of that render — the compiled serializer, which discovers a component's external sheets while serializing the component, and the document serializer, which writes the head. It is created per render and never shared, so one page's stylesheets can never reach another page's head.
packages/element/src/internal/core/html-escape.ts:125Escape an HTML attribute value.
(value: string): stringSource notes
Escape an HTML attribute value. Delegates to `escapeHtml` so both share the single `ESCAPE_MAP` and the same single-pass replacement (consolidated in #633). Empty-value conventions remain intentionally distinct by design: - `escapeHtml` returns '' for non-string input. - `escapeAttrValue` (below) coerces via `String()` and is the boundary meant for unknown/variable attribute values.
packages/element/src/internal/core/html-escape.ts:55Escape a string for use as an attribute value (double-quoted)
(value: unknown): stringpackages/element/src/internal/core/html-escape.ts:60Escape the five HTML-significant characters in text content.
(str: string): stringpackages/element/src/internal/core/html-escape.ts:39(href: string): booleanSource notes
True when an href has the shape a framework-emitted component stylesheet address takes: a site-absolute path or an absolute http(s) URL, without whitespace or markup-significant characters. ONE rule for both sinks that serialize such an address — the DSD template's links and the document head's — so a component's stylesheet reaches a browser the same way whichever root kind the component has.
packages/element/src/internal/core/html-escape.ts:158Branded type: a string that has been HTML-escaped (safe for text content)
SafeHtmlpackages/protocol/src/framework.ts:9Mark an HTML string as trusted for explicit `innerHTML` sinks (the trust does not serialize).
(html: string): TrustedHtmlpackages/element/src/internal/core/security.ts:88Opaque capability marking HTML the application has explicitly vetted as trusted.
TrustedHtmlOptions and source location
packages/element/src/internal/core/security.ts:83Branded type: a string that is intentionally raw/untrusted HTML
UnsafeHtmlpackages/protocol/src/framework.ts:12Wrap rendered HTML in a full HTML document.
(html: string, options?: DocumentWrapOptions): stringSource notes
Wrap rendered HTML in a full HTML document. Adds DOCTYPE, head (title, meta, preload), and body. Supports CSP nonce and dev scripts (e.g. Vite client, route module registration).
packages/element/src/internal/core/html-escape.ts:199Typechecking-only fragment marker; fails closed when executed at runtime.
(_props?: unknown): JSX.Elementpackages/element/src/jsx-dev-runtime.ts:39JSX type interface consumed by TypeScript's automatic JSX transform.
anypackages/element/src/jsx-dev-runtime.ts:44Typechecking-only factory; fails closed when executed at runtime.
(_type: unknown, _props: unknown, _key: unknown, _isStaticChildren: unknown, _source: unknown, _self: unknown): JSX.Elementpackages/element/src/jsx-dev-runtime.ts:27Typechecking-only fragment marker; fails closed when executed at runtime.
(_props?: unknown): JSX.Elementpackages/element/src/jsx-runtime.ts:40Typechecking-only factory; fails closed when executed at runtime.
(_type: unknown, _props: unknown): JSX.Elementpackages/element/src/jsx-runtime.ts:30JSX type interface consumed by TypeScript's automatic JSX transform.
anypackages/element/src/jsx-runtime.ts:45Typechecking-only factory; fails closed when executed at runtime.
(_type: unknown, _props: unknown): JSX.Elementpackages/element/src/jsx-runtime.ts:35Run a callback on each element connection. If it returns a cleanup function, run that function on disconnect.
(callback: (env: { readonly host: HTMLElement; readonly signal: AbortSignal; readonly states: CustomStateSet; }) => void | (() => void)): voidSource notes
Compiler-recognized connect intrinsic: runs the callback on every connection of the generated element (initial mount and each reconnect) and releases the optional returned cleanup at that disconnection. Erased by the compiler; calling it at runtime fails closed. The callback may keep the original zero-argument form or declare ONE `env` parameter. `env.host` is the generated element the connection belongs to (for a depth-1 retained hostless child: its nearest ancestor generated element), and `env.signal` aborts at the START of that disconnection, before any registered cleanup runs; a reconnect gets a fresh, un-aborted signal. The parameter's type is the author-facing contract only — the compiler erases it and passes the value from the connection scope the callback runs in.
packages/element/src/internal/core/compile-lifecycle.ts:58Run a callback once when the generated element is disposed, after its connection cleanups.
(callback: (env: { readonly host: HTMLElement; readonly signal: AbortSignal; readonly states: CustomStateSet; }) => void): voidSource notes
Compiler-recognized dispose intrinsic: runs the callback exactly once when the generated element instance is torn down (explicit `dispose()`), after that connection's connect-cleanups. Erased by the compiler; calling it at runtime fails closed. The callback may keep the original zero-argument form or declare ONE `env` parameter whose `signal` is the instance-lifetime teardown signal: it is aborted at the start of teardown, before this and every other disposal callback runs, so `env.signal.aborted` is `true` inside the callback.
packages/element/src/internal/core/compile-lifecycle.ts:80Run a callback after a declared property changes through an attribute or property write.
(callback: (event: { readonly host: HTMLElement; readonly signal: AbortSignal; readonly states: CustomStateSet; readonly name: string; readonly value: unknown; }) => void): voidSource notes
Compiler-recognized change intrinsic: runs the callback after a DECLARED property of this generated element commits a new value, for an attribute write and for a property write, and never at setup. Erased by the compiler — the callback is registered on the element-lifetime instance owner through the compiler-private host record; calling it at runtime fails closed. `event.host` is the generated element (the nearest ancestor generated element for a depth-1 retained hostless child), `event.signal` is the instance-lifetime teardown signal, and `event.name`/`event.value` are the changed row and its committed value. The callback may keep the zero-argument form.
packages/element/src/internal/core/compile-lifecycle.ts:103<T>(context: { readonly key: symbol; readonly defaultValue: T; }, read: () => T): voidSource notes
Compiler-recognized PROVIDER intrinsic (`16b-CTX`): declares that this component provides `context` with the current value of `read` to its subtree. ```tsx const ThemeContext = createContext(Symbol('theme'), 'light'); function App() { provideContext(ThemeContext, () => props.theme); return <Child />; } ``` The second argument is a VALUE THUNK, deliberately: the compiler erases this call into the component's retained setup record and re-reads the thunk on connect and after every declared-row commit, so a provider follows the lane's one change channel (a property write) rather than introducing a second reactivity model. A `computed` would be the class lane's answer; this lane deliberately has no author `computed`. Published over the generated owner tree, hostless owners included: provider discovery is the Community Context Protocol `context-request` composed event, so the nearest ancestor provider wins and two sibling subtrees cannot see each other. A provider registers on connect, unregisters exactly once on disconnect, and registers again on reconnect. Erased by the compiler; calling it at runtime fails closed.
packages/element/src/internal/core/compile-lifecycle.ts:250Compiler-recognized node-handle factory (`16b-REF`): declares a REF HANDLE for one intrinsic DOM node of this component.
<T extends globalThis.Element = Element>(callback?: (element: T | null) => void | (() => void)): { (element: globalThis.Element | null): void; readonly current: T | null; }Source notes
Compiler-recognized node-handle factory (`16b-REF`): declares a REF HANDLE for one intrinsic DOM node of this component. The returned value is handed to that node's existing JSX `ref` attribute: ```tsx const field = ref<HTMLInputElement>((element) => { element?.focus(); return () => {/* detach cleanup *\/}; }); // … return <input ref={field} />; ``` The handle is the same object for the whole element lifetime: the compiler erases this call into the retained instance factory, so a reconnect, a claim of server DOM and an update all observe one handle rather than a per-pass copy. It is a REF CHANNEL VALUE, not a reactive source: `current` is written when the node attaches, cleared when it detaches, and it notifies nothing — a tracked slot reading `current` would be a one-shot value, which is why the compiler admits a handle ONLY in a `ref` attribute expression. The optional callback is the attach/detach notification the existing `ref` channel already defines: called with the element on attach, and with `null` on detach AFTER the cleanup it returned has run. Because the handle rides the same `ref` channel, the cleanup ordering, the once-per-detach rule and the scope ownership are the existing ones — this intrinsic adds no second attachment mechanism. Erased by the compiler; calling it at runtime fails closed.
packages/element/src/internal/core/compile-lifecycle.ts:187Subscribe to the nearest context provider. Return a signal with the declared default when no provider exists.
<T>(context: { readonly key: symbol; readonly defaultValue: T; }): { readonly value: T; subscribe(fn: (value: T) => void): () => void; }Source notes
Compiler-recognized CONSUMER intrinsic (`16b-CTX`): declares a tracked consumer of `context` for this component and returns the signal its value lives in. ```tsx const theme = useContext(ThemeContext); return <p>{theme.value}</p>; // a tracked slot: refreshes on provider change ``` The returned signal is ONE persistent consumer-local signal: the compiler erases this call into the component's retained setup record, so a reconnect re-reads the nearest provider into the SAME object and a tracked slot keeps exactly one subscription target for the whole element lifetime. Lookup follows the nearest owning component, so an inner provider shadows an outer one and a component with no ancestor provider reads the context's declared default. Reading `.value` in a tracked slot is the supported use — this is the lane's reactive channel, unlike `ref`'s `current`. Reading it inside a handler also works (the signal is live), but only tracked slots refresh. Erased by the compiler; calling it at runtime fails closed.
packages/element/src/internal/core/compile-lifecycle.ts:285Return the custom element that owns the current component instance.
(): HTMLElementSource notes
Compiler-recognized HOST-ACCESS intrinsic (`16b-REF`, `useHost`). ```tsx const host = useHost(); // … host is this instance's owning element (the custom element). ``` It exposes the SAME fact the lifecycle/change/error callbacks already receive as `env.host` — the owning generated element for a root, the nearest enclosing generated element host for a depth-1 retained hostless child — through the expression position instead of a callback parameter. There is therefore no new runtime channel and no second host lookup: the compiler erases the call into a read of the host-element field the retained setup factory already receives. The read is NOT reactive: the element identity never changes for an instance, so a derived node capturing it can never go stale. That is also why it carries no lifecycle ownership — it allocates nothing and needs no cleanup. Erased by the compiler; calling it at runtime fails closed.
packages/element/src/internal/core/compile-lifecycle.ts:218Create a {@link Logger} that prefixes every message with `[tag]`.
(tag: string): Loggerpackages/element/src/internal/core/logger.ts:18Create a fresh, empty warning scope for one render.
(): WarnScopepackages/element/src/internal/core/logger.ts:41logger.ts - Tagged console logger. Lightweight scoped logger. Returns plain functions so it is tree-shakable and has zero class overhead.
LoggerOptions and source location
packages/element/src/internal/core/logger.ts:10Warn at most once per `key` for the given render {@link WarnScope}, falling back to a process-wide set when no scope is passed.
(key: string, logger: Logger, msg: string, scope?: WarnScope): voidpackages/element/src/internal/core/logger.ts:52A render-scoped warning tracker.
WarnScopeSource notes
A render-scoped warning tracker. Pass a fresh `WarnScope` (via `createWarnScope()`) into `warnOnce` at a render entry (e.g. once per SSR document in `wrapInDocument`). Suppression is therefore scoped to a single render: the next page/request gets a new scope and the same key can warn again, so one muted key can never silence a diagnostic across all requests/SSG pages (#643).
packages/element/src/internal/core/logger.ts:36Set the emitted stylesheet URLs for this server process.
(urls: readonly string[] | null | undefined, islandEntries?: ReadonlyArray<readonly [string, readonly string[] | null]> | null): voidSource notes
Set the emitted stylesheet URLs for this server process. Called by the router's generated SSR/SSG entry (build time and request-time startup) with the base-joined asset addresses Phase 2 emitted. The optional `islandEntries` half carries the per-tag URLs of generated SHADOW hosts (M09-2e / #1803) through the SAME channel: one setter, one entry import, no second public seam. A `null` URL list is the explicit "declared but carrier unavailable" state the nested renderer fails closed on.
packages/element/src/internal/compiled/server/style-links.ts:34Route action: handles form submissions for a page route.
Action<T, Env, Platform, Route>packages/protocol/src/data.ts:64Choose the form action response: true returns serialized data and enhance returns the full HTML used without JavaScript.
"x-openelement-action"Source notes
Request header selecting the action response channel: `true` marks a programmatic caller and selects the serialized ActionResult union; `enhance` marks the built-in morph enhancement and selects the same full-HTML responses the no-JS path receives.
packages/protocol/src/data.ts:125Context passed to a route action function (extends loader context).
ActionContext<Env, Platform, Route>Options and source location
packages/protocol/src/data.ts:47Wire shape returned to the JavaScript form-enhancement path.
ActionResult<Failure>Source notes
Wire shape returned to the JavaScript form-enhancement path. The no-JS path never sees this: it gets the equivalent semantics as plain HTTP (303 on success, 422 with the re-rendered form on validation failure, redirect/error as status codes). Success carries no data envelope. The application-loop contract makes a successful non-GET action answer 303 (PRG) — the framework never answers 200 with a rendered page, or with a success document, for a successful mutation — so the fetch channel answers `{ type: 'redirect' }` naming the PRG target and the authored return value is discarded by design. Success data travels the PRG target instead (query state the loader re-runs with, which the props projector then maps; see the router guide's "Form actions" section). The union previously declared a `{ type: 'success' }` member that no code path ever emitted — removed so the type matches the wire. Error outcomes (CSRF 403, unknown action 404, unparseable body 400, unexpected 500) are NOT part of this union: since #863 they answer RFC 9457 Problem Details with the PROBLEM_JSON_MEDIA_TYPE content type — see ProblemDetails.
packages/protocol/src/data.ts:92Assert that a tag name is a valid custom element name.
(tagName: string): voidpackages/element/src/internal/core/tag-utils.ts:50Collect all public (non-internal) own properties from a host object.
(host: object): Record<string, unknown>Source notes
Collect all public (non-internal) own properties from a host object. Keys starting with `__openElement` are framework-internal and excluded. Uses Reflect.get for safe access (respects getters); a getter that throws is skipped with a warning so one bad prop cannot take the tree down.
packages/element/src/internal/core/props-utils.ts:41The scanner’s per-tag compatibility tier, reason, discovery source, and rendering and hydration facts.
CompatibilityClassificationSource notes
The per-tag verdict the compatibility scanner records: the tier a discovered tag was classified as, the human-readable `reason`, where the tag was found (`source`), and the SSR/DSD/hydration facts the verdict was derived from.
packages/protocol/src/framework.ts:347The tag’s build compatibility level: server-rendered, client-only, experimental, or rejected.
CompatibilityTierSource notes
How far a discovered tag may participate in the build: 'ssr-capable' renders and hydrates, 'client-only' ships to the browser without server output, 'experimental-dom' is admitted with a downgraded guarantee, and 'rejected' fails the build.
packages/protocol/src/framework.ts:340A component’s delivery layer: static DSD, interactive DSD, a client-only island, or light DOM.
ComponentLayerSource notes
The delivery layer a component belongs to: fully static DSD markup ('dsd-static'), DSD markup with a client island ('dsd-interactive'), a client-only island with no SSR output ('pure-island'), or a light-DOM element ('light-dom'). Recorded per component in the build manifest and consumed by the hydration scheduler.
packages/protocol/src/framework.ts:23Create a derived read-only signal recomputed from its dependencies.
<T>(fn: () => T): ReadonlySignal<T>packages/element/src/internal/signal/framework.ts:23Consumer-local reactive projection of a protocol context value.
<T>(context: Context<T>, host?: HTMLElement): WritableSignal<T>Source notes
Consumer-local reactive projection of a protocol context value. When a `host` is given, the returned signal is bridged to the nearest provider through one Community Context Protocol subscription. That bridge is owned by the CALLER: a long-lived consumer must release it when it tears down (typically `disconnectedCallback`) with {@linkcode releaseConsumedContext}, exactly once. Releasing detaches the provider bridge, so the provider no longer retains or updates the local signal; the local signal itself stays usable with its last value. A call after a successful release is a no-op, and a signal created without a `host` has no bridge to release.
packages/element/src/internal/core/signal-context.ts:183A typed context token: protocol identity (`key`) plus its default value.
Context<T>Options and source location
packages/element/src/internal/core/signal-context.ts:13Create a typed context token shared between provider and consumer elements.
<T>(key: symbol, defaultValue: T): Context<T>Options and source location
packages/element/src/internal/core/signal-context.ts:58Create the per-render document stylesheet collection.
(): DocumentStyleResourcespackages/element/src/internal/core/html-escape.ts:133Create a {@link Logger} that prefixes every message with `[tag]`.
(tag: string): Loggerpackages/element/src/internal/core/logger.ts:18Object prototype keys that must never be injected from untrusted props.
ReadonlySet<string>packages/element/src/internal/core/security.ts:25Resolve `id` (a `#hash` or bare id) against `root` and, when the id is not in that root's own tree, recurse into every nested shadow root.
(id: string, root?: Document | ShadowRoot): HTMLElement | nullSource notes
Resolve `id` (a `#hash` or bare id) against `root` and, when the id is not in that root's own tree, recurse into every nested shadow root. Returns the first match or `null`; a malformed percent-encoded id is not an error.
packages/element/src/internal/core/deep-fragment.ts:20The same document serialization boundary, with only body wrappers left open.
(options?: DocumentWrapOptions): { prefix: string; suffix: string; }Options and source location
packages/element/src/internal/core/html-escape.ts:205The document-level stylesheet resources ONE server render discovered (alpha15 S lane, S-C1.2).
DocumentStyleResourcesSource notes
The document-level stylesheet resources ONE server render discovered (alpha15 S lane, S-C1.2). A light-root component's DOM lives in the document, so its sheet cannot ride the component's own subtree the way a shadow template's link does: the document owns it. This object is the one carrier between the two halves of that render — the compiled serializer, which discovers a component's external sheets while serializing the component, and the document serializer, which writes the head. It is created per render and never shared, so one page's stylesheets can never reach another page's head.
packages/element/src/internal/core/html-escape.ts:125Run a side effect that re-subscribes whenever its signal dependencies change.
(fn: () => void | Unsubscribe): Unsubscribepackages/element/src/internal/signal/framework.ts:27Install the bounded pre-upgrade interaction capture on an owning root (default: the document).
(root?: EventTarget, pendingTags?: readonly string[]): voidSource notes
Install the bounded pre-upgrade interaction capture on an owning root (default: the document). Generated client entries call this with their declared island tags before any compiled element upgrades; after a successful claim the element replays the captured events whose targets live inside its root (compiled claim capture/replay, internal/compiled/runtime.ts). Idempotent per root (repeat calls merge tags, never reinstall listeners) and a no-op where no DOM exists (SSR). Invariant: the capture itself — one fixed listener set per owning root, installed once per page — is page-lifetime by design and is NOT the leak. The M1 leak was retained event-target records; each element releases exactly its own records at its activation decision (success or failure), while records owned by still-pending elements survive for their delayed/lazy upgrade (#1170). Boundedness: the facade capture passes the declared-island filter, so only interactions under a still-pending DECLARED island tag enter the queue — ordinary events and undeclared third-party custom elements are skipped (nested pending declared islands still capture through their own unsettled host). With no tags declared the legacy dash heuristic applies. The shared queue carries a hard capacity cap (fail closed), detached records are swept when a claim root adopts its share (and under queue pressure), and each activation decision deterministically empties that root's own bucket, so post-hydration traffic and removals never grow retention.
packages/element/src/internal/compiled/runtime/pre-upgrade-events.ts:662Error message prefix for all openElement errors.
"[openElement]"packages/protocol/src/errors.ts:50Callback receiving every reported {@linkcode OpenElementError} for telemetry.
ErrorTelemetryHookpackages/protocol/src/errors.ts:132Escape an HTML attribute value.
(value: string): stringSource notes
Escape an HTML attribute value. Delegates to `escapeHtml` so both share the single `ESCAPE_MAP` and the same single-pass replacement (consolidated in #633). Empty-value conventions remain intentionally distinct by design: - `escapeHtml` returns '' for non-string input. - `escapeAttrValue` (below) coerces via `String()` and is the boundary meant for unknown/variable attribute values.
packages/element/src/internal/core/html-escape.ts:55Escape the five HTML-significant characters in text content.
(str: string): stringpackages/element/src/internal/core/html-escape.ts:39Format an unknown thrown value as a human-readable string.
(e: unknown): stringpackages/element/src/internal/core/errors.ts:52FrameworkOptionsSource notes
The adapter-facing framework options: where routes and islands live, the default layout and named-layout declarations, the document `<html>`/head injection channels, and the request-time middleware switches. Every field is optional; the adapter applies its documented default. This is the type an application config file's default export is checked against, so the rendered option table and the actual config surface cannot drift.
packages/protocol/src/framework.ts:180Runtime list of supported hydration strategies; the single source of truth for the `HydrationStrategy` union.
readonly ["load", "idle", "visible", "only", "none"]Source notes
Runtime list of supported hydration strategies; the single source of truth for the `HydrationStrategy` union. Consumed by island/registry validation and re-exported from the element root for app and build adapters.
packages/protocol/src/framework.ts:28Island hydration trigger: 'load' | 'idle' | 'visible' | 'only'.
"load" | "idle" | "visible" | "only" | "none"packages/protocol/src/framework.ts:30Idle-hydration scheduling fallback (milliseconds) when neither `requestIdleCallback` nor `requestAnimationFrame` is available.
50packages/protocol/src/policy.ts:70Safely assign caller-supplied props onto a target object, skipping keys that could enable prototype pollution and tolerating read-only properties.
(target: Record<string, unknown>, props: Record<string, unknown>, tagName: string, log?: { warn(message: string): void; debug(message: string): void; }): voidSource notes
Safely assign caller-supplied props onto a target object, skipping keys that could enable prototype pollution and tolerating read-only properties. The canonical guarded assigner for the canonical dangerous-key rule (#903, #1214): the
packages/element/src/internal/core/security.ts:131Shared dangerous-key predicate (#903, #1214).
(key: string): booleanSource notes
Shared dangerous-key predicate (#903, #1214). Prototype-internal keys must never be injected from untrusted props on ANY path: host prop collection (collectPublicProps / normalizePublicProps in props-utils.ts), guarded assignment (injectPropsSafe below — the SPA bootstrap page-projection write boundary in
packages/element/src/internal/core/security.ts:53Per-island delivery options (hydration strategy, SSR/DSD participation).
IslandOptionsOptions and source location
packages/protocol/src/island.ts:8Shared safe-attribute-name predicate (#1033): the SSR face of the one canonical predicate in `../protocol/forbidden-sinks.ts`.
(name: string): booleanSource notes
Shared safe-attribute-name predicate (#1033): the SSR face of the one canonical predicate in `../protocol/forbidden-sinks.ts`. A name must be valid HTML attribute-name grammar (blocks quote/space injection, #602), must not be an event handler (`on*`, case-insensitive), and must not be a forbidden sink (`innerhtml`/`srcdoc`). The compiler, protocol validator, and server serializer enforce the same predicate with their own failure strategies; every path delegates to the single implementation, so the boundary cannot diverge.
packages/element/src/internal/core/security.ts:67Check if a tag name is a valid custom element name per HTML spec.
(tagName: string): booleanpackages/element/src/internal/core/tag-utils.ts:38Select the built-in layout, declare a custom layout with its module and props, or disable the layout.
LayoutConfigSource notes
Layout declaration: `false` disables the layout entirely, `'default'` uses the built-in layout, and the object form names a tag with the module path that defines it (`import`, resolved like a {@link FrameworkOptions.middleware.use } entry) plus the compiled layout properties the router injects per route.
packages/protocol/src/framework.ts:96Route loader: fetches data for a page route.
Loader<T, Env, Platform, Route>packages/protocol/src/data.ts:56Context passed to a request-time ('dynamic') route loader.
LoaderContext<Env, Platform, Route>Options and source location
packages/protocol/src/data.ts:40Locale-aware resolved path contract.
LocalePathOptions and source location
packages/protocol/src/framework.ts:82logger.ts - Tagged console logger. Lightweight scoped logger. Returns plain functions so it is tree-shakable and has zero class overhead.
LoggerOptions and source location
packages/element/src/internal/core/logger.ts:10Request-body bound (bytes) the generated entry applies to action POST routes; larger uploads belong on API routes with explicit limits.
numberpackages/protocol/src/policy.ts:57Nested element expansion depth bound for `renderToString`: cyclic component composition fails closed instead of recursing without end.
8packages/protocol/src/policy.ts:51Fetch middleware contract (#858): WinterCG shape, dialect-free — no Hono/h3 context object.
MiddlewareSource notes
Fetch middleware contract (#858): WinterCG shape, dialect-free — no Hono/h3 context object. Composed at the handler boundary in onion order (`use[0]` is outermost: it sees the request first and the response last), so it runs with identical semantics in the dev server, the `start` CLI, the e2e fixture server, and the Nitro production entry. A middleware may short-circuit by returning a Response without calling `next()`, or post-process the Response that `next()` returns. Module contract: a Middleware is the DEFAULT EXPORT of a module referenced from `middleware.use` by path (e.g. './app/middleware/auth.ts'). The generated server entry imports the module, so the middleware may close over module scope and import local helpers and third-party packages — it is a real module in the server module graph, never serialized source.
packages/protocol/src/framework.ts:169Run a callback on each element connection. If it returns a cleanup function, run that function on disconnect.
(callback: (env: { readonly host: HTMLElement; readonly signal: AbortSignal; readonly states: CustomStateSet; }) => void | (() => void)): voidSource notes
Compiler-recognized connect intrinsic: runs the callback on every connection of the generated element (initial mount and each reconnect) and releases the optional returned cleanup at that disconnection. Erased by the compiler; calling it at runtime fails closed. The callback may keep the original zero-argument form or declare ONE `env` parameter. `env.host` is the generated element the connection belongs to (for a depth-1 retained hostless child: its nearest ancestor generated element), and `env.signal` aborts at the START of that disconnection, before any registered cleanup runs; a reconnect gets a fresh, un-aborted signal. The parameter's type is the author-facing contract only — the compiler erases it and passes the value from the connection scope the callback runs in.
packages/element/src/internal/core/compile-lifecycle.ts:58Run a callback once when the generated element is disposed, after its connection cleanups.
(callback: (env: { readonly host: HTMLElement; readonly signal: AbortSignal; readonly states: CustomStateSet; }) => void): voidSource notes
Compiler-recognized dispose intrinsic: runs the callback exactly once when the generated element instance is torn down (explicit `dispose()`), after that connection's connect-cleanups. Erased by the compiler; calling it at runtime fails closed. The callback may keep the original zero-argument form or declare ONE `env` parameter whose `signal` is the instance-lifetime teardown signal: it is aborted at the start of teardown, before this and every other disposal callback runs, so `env.signal.aborted` is `true` inside the callback.
packages/element/src/internal/core/compile-lifecycle.ts:80Compiler-recognized error intrinsic (`16b-EB`): the author-facing error boundary of ONE generated element.
(callback: (env: { readonly host: HTMLElement; readonly signal: AbortSignal; readonly states: CustomStateSet; readonly error: unknown; }) => void): voidSource notes
Compiler-recognized error intrinsic (`16b-EB`): the author-facing error boundary of ONE generated element. The callback runs when a value escapes from the element's own work — the connect/claim pass (mount, claim, setup and the `onConnect` replay) and an UPDATE-phase write (a tracked slot refresh or a DOM event handler dispatched inside the compiled body). Erased by the compiler; calling it at runtime fails closed. `env.host` is the generated element the failing work belongs to (the nearest ancestor generated element for a depth-1 retained hostless child), `env.signal` is the per-connection `LifetimeScope` signal for a connect-phase failure and the instance-lifetime teardown signal otherwise, `env.states` is the element's `CustomStateSet`, and `env.error` is the thrown value EXACTLY as it was thrown (never wrapped or replaced). The callback may keep the zero-argument form. A catching handler changes only whether the error escapes: a connect-phase failure still leaves the element in its defined post-failure state (no projection, no listeners, a later reconnect retries from scratch), and an update-phase failure leaves the previously written DOM in place with the subscription still live for the next write. A handler that itself throws REPLACES the original error — that new throw is what surfaces. With no registered handler the pre-existing rethrow/rollback behaviour is unchanged. The callback is CLIENT-owned: it is erased into the compiled module and never runs during `__ssr` (a server render has no element, no connection scope and no handler registry; a producer throw fails the render, exactly as before).
packages/element/src/internal/core/compile-lifecycle.ts:144Run a callback after a declared property changes through an attribute or property write.
(callback: (event: { readonly host: HTMLElement; readonly signal: AbortSignal; readonly states: CustomStateSet; readonly name: string; readonly value: unknown; }) => void): voidSource notes
Compiler-recognized change intrinsic: runs the callback after a DECLARED property of this generated element commits a new value, for an attribute write and for a property write, and never at setup. Erased by the compiler — the callback is registered on the element-lifetime instance owner through the compiler-private host record; calling it at runtime fails closed. `event.host` is the generated element (the nearest ancestor generated element for a depth-1 retained hostless child), `event.signal` is the instance-lifetime teardown signal, and `event.name`/`event.value` are the changed row and its committed value. The callback may keep the zero-argument form.
packages/element/src/internal/core/compile-lifecycle.ts:103One documented attribute of a custom element declaration.
OpenElementAttributeOptions and source location
packages/protocol/src/manifest.ts:15One documented CSS part of a custom element declaration.
OpenElementCssPartOptions and source location
packages/protocol/src/manifest.ts:38One custom element declaration in a package manifest: tag, members and delivery metadata.
OpenElementDeclarationOptions and source location
packages/protocol/src/manifest.ts:116Framework error carrying a stable code, severity, phase and recoverability contract.
class OpenElementError extends Errorpackages/protocol/src/errors.ts:100One documented custom event of a custom element declaration.
OpenElementEventOptions and source location
packages/protocol/src/manifest.ts:25Package manifest of component declarations (not a Custom Elements Manifest).
OpenElementPackageManifestOptions and source location
packages/protocol/src/manifest.ts:129Host-agnostic route and asset contracts shared by app and build drivers.
OpenElementRouteKindpackages/protocol/src/app-model.ts:2One route tree entry, including the URL path, route kind, source, optional tag and params, and child routes.
OpenElementRouteNodeSource notes
One node of the host-agnostic route tree: the matched URL `path` and route kind, the source and module paths the drivers resolve, the optional registered tag and param names, and the nested `children`.
packages/protocol/src/app-model.ts:9One documented slot of a custom element declaration.
OpenElementSlotOptions and source location
packages/protocol/src/manifest.ts:32Media type of the RFC 9457 action error channel (#863).
"application/problem+json"packages/protocol/src/data.ts:117RFC 9457 response for action protocol errors. The media type is application/problem+json, and detail describes the failure.
ProblemDetailsSource notes
RFC 9457 Problem Details document (#863): the action error channel answers `application/problem+json` instead of the bespoke `{ type: 'error', error: { message } }` JSON, so HTTP tooling recognizes failures natively. With `type: 'about:blank'`, `title` is the HTTP reason phrase and `detail` carries the specific explanation. The wire shape is alpha-unfrozen; the 1.0 acceptance freezes it in this problem+json form.
packages/protocol/src/data.ts:105Provide a plain protocol value; the provider Signal remains OE-private.
<T>(host: HTMLElement, context: Context<T>, value: T): UnsubscribeSource notes
Provide a plain protocol value; the provider Signal remains OE-private. The returned handle owns exactly one provider record. A repeated call for the same host and {@linkcode Context.key} disposes the previous record (its request listener and mapping) before publishing the replacement, so repeated provides and reconnect cycles never accumulate listeners; the replaced handle becomes a no-op. Releasing removes only the current record and is idempotent.
packages/element/src/internal/core/signal-context.ts:131Read-only signal protocol used by computed values.
ReadonlySignal<T>Options and source location
packages/protocol/src/signal.ts:26Compiler-recognized node-handle factory (`16b-REF`): declares a REF HANDLE for one intrinsic DOM node of this component.
<T extends globalThis.Element = Element>(callback?: (element: T | null) => void | (() => void)): { (element: globalThis.Element | null): void; readonly current: T | null; }Source notes
Compiler-recognized node-handle factory (`16b-REF`): declares a REF HANDLE for one intrinsic DOM node of this component. The returned value is handed to that node's existing JSX `ref` attribute: ```tsx const field = ref<HTMLInputElement>((element) => { element?.focus(); return () => {/* detach cleanup *\/}; }); // … return <input ref={field} />; ``` The handle is the same object for the whole element lifetime: the compiler erases this call into the retained instance factory, so a reconnect, a claim of server DOM and an update all observe one handle rather than a per-pass copy. It is a REF CHANNEL VALUE, not a reactive source: `current` is written when the node attaches, cleared when it detaches, and it notifies nothing — a tracked slot reading `current` would be a one-shot value, which is why the compiler admits a handle ONLY in a `ref` attribute expression. The optional callback is the attach/detach notification the existing `ref` channel already defines: called with the element on attach, and with `null` on detach AFTER the cleanup it returned has run. Because the handle rides the same `ref` channel, the cleanup ordering, the once-per-detach rule and the scope ownership are the existing ones — this intrinsic adds no second attachment mechanism. Erased by the compiler; calling it at runtime fails closed.
packages/element/src/internal/core/compile-lifecycle.ts:187Release the provider bridge created by one hosted {@linkcode consumeContext} call.
(signalValue: SignalLike<unknown>): voidSource notes
Release the provider bridge created by one hosted {@linkcode consumeContext} call. The bridge is deregistered only AFTER its cleanup returns: a throwing unsubscribe must not leave the signal in a state where the bridge is gone from the bookkeeping but still attached to the provider (unretryable). If cleanup throws, the entry stays registered and the error propagates verbatim, so the caller can retry the release — for example from a `disconnectedCallback` that runs again — once the provider's unsubscribe succeeds. A second call after a successful release is a no-op, and a signal without a bridge (including a signal created without a `host`) is always a no-op.
packages/element/src/internal/core/signal-context.ts:208Recoverable render-phase error carrying the failing component path and tag.
class RenderError extends OpenElementErrorpackages/element/src/internal/core/errors.ts:95Server-render one compiled element through canonical Element composition: returns the serialized DSD `html` string directly.
(input: string | CustomElementConstructor, options?: RenderToStringOptions): stringpackages/element/src/public-runtime.ts:945Set the compiled class, props, diagnostic context, admitted nested elements, and trusted light children for renderToString.
RenderToStringOptionsSource notes
Options for one `renderToString()` call: the compiled component class to serialize, the values projected onto its compiled properties, optional route/source diagnostics metadata, the nested compiled tags the build admitted, and trusted parent-owned light children keyed by slot name.
packages/element/src/public-runtime.ts:170Report an {@linkcode OpenElementError} to the telemetry hook, or console.error when none is installed.
(error: OpenElementError): voidOptions and source location
packages/element/src/internal/core/errors.ts:139A discovered route’s URL, source, type, generated binding name, and optional custom element tag.
RouteEntrySource notes
One route admitted by the scanner: URL `path`, source `filePath`, the route `type`, the generated variable name (`varName`) the entry binds it to, and the optional registration tag. {@link RouteEntry.definePage} and {@link RouteEntry.hasEnhancedForms} carry the two source-derived admission facts the generated entries branch on.
packages/protocol/src/framework.ts:113Canonical request-time/SSG server route context.
ServerRouteContext<Env, Platform, Route>Options and source location
packages/protocol/src/data.ts:25Context passed to a request-time ('dynamic') route loader.
ServerRouteMetadataSource notes
Context passed to a request-time ('dynamic') route loader. This is the server contract: the loader runs on the server with the Web-standard request, matched route params, the host environment and the platform object, and signals validation failure via fail()/redirect().
packages/protocol/src/data.ts:19Install the process-wide error telemetry hook (replaceable for tests, HMR, multi-app pages).
(hook: ErrorTelemetryHook): voidpackages/element/src/internal/core/errors.ts:127Create a writable signal through the selected signal engine.
<T>(initialValue: T): WritableSignal<T>packages/element/src/internal/signal/framework.ts:19Alias for APIs that accept either writable or read-only signals.
Signal<T>packages/protocol/src/signal.ts:31Special file kinds the route scanner recognizes by filename: `renderer` and `middleware`.
SpecialFileTypepackages/protocol/src/framework.ts:79The build’s SSR verdict for a discovered tag, including its module, discovery source, render path, and reason.
SsrAdmissionDecisionSource notes
The build's admission verdict for one discovered tag: where the declaration lives (`modulePath`), how it was discovered (`source`), which render path it is admitted to, and the reason recorded for the manifest.
packages/protocol/src/render.ts:37Tags a deferred frame cannot safely install into an owned Part range: the browser installer rejects any frame whose markup carries one of these.
readonly ["script", "style", "template", "iframe", "object", "embed", "base", "meta", "link"]packages/protocol/src/stream-frame-policy.ts:26Schemes that make a URL attribute unsafe in a streamed frame.
RegExppackages/protocol/src/stream-frame-policy.ts:60URL-carrying attributes the frame check screens for script-bearing scheme obfuscation; only these attribute names are value-screened.
readonly ["href", "src", "action", "formaction", "xlink:href"]packages/protocol/src/stream-frame-policy.ts:42The highest control character code point removed before checking a URL scheme.
32Source notes
Control characters at or below this code point are stripped before the URL-scheme test, so tab/newline/control obfuscation cannot smuggle a scheme past admission.
packages/protocol/src/stream-frame-policy.ts:55Deferred fields (declared streamed properties) one stream route's manifest may carry.
32Source notes
Deferred fields (declared streamed properties) one stream route's manifest may carry. The build scan, the server executor, and the browser seed contract enforce the same bound.
packages/protocol/src/policy.ts:24Part/Block owners one stream route's manifest may address in total across all deferred fields.
64packages/protocol/src/policy.ts:30Serialized stream payload bound, as a string length in UTF-16 code units: one seed attribute or one deferred frame's markup may not exceed it.
numberSource notes
Serialized stream payload bound, as a string length in UTF-16 code units: one seed attribute or one deferred frame's markup may not exceed it. The server checks the JSON text and the rendered range before emitting; the browser checks the attribute before parsing.
packages/protocol/src/policy.ts:45Maximum number of typed properties the browser accepts in one streamed hydration seed.
64Source notes
Typed properties one streamed seed may carry: the browser seed contract rejects the WHOLE seed above this count, so an oversized component would silently fail to hydrate instead of failing loud at the server.
packages/protocol/src/policy.ts:37Milliseconds a streamed response waits for deferred fields before failing those still pending.
30000Source notes
Deferred-field resolution budget (milliseconds) for one streamed response: fields still pending when it expires are failed in place and the stream ends with the shell and whatever resolved.
packages/protocol/src/policy.ts:64Cross-realm StyleSheet constructor: the native CSSStyleSheet or the internal shim.
new () => StyleSheetLikepackages/element/src/internal/core/style-sheet.ts:110Minimal stylesheet contract (replaceSync + cssRules) satisfied by native and shim sheets.
StyleSheetLikeOptions and source location
packages/protocol/src/style-sheet.ts:14Mark an HTML string as trusted for explicit `innerHTML` sinks (the trust does not serialize).
(html: string): TrustedHtmlpackages/element/src/internal/core/security.ts:88Opaque capability marking HTML the application has explicitly vetted as trusted.
TrustedHtmlOptions and source location
packages/element/src/internal/core/security.ts:83Check whether a static attribute makes a streamed frame unsafe to install.
(name: string, value: string): booleanSource notes
Whether a static attribute (name/value as authored into the Part Program) makes a streamed frame unsafely installable: event-handler, seed-spoofing, and srcdoc names fail outright, and URL-carrying names fail when the entity-decoded, control-stripped value carries a script scheme.
packages/protocol/src/stream-frame-policy.ts:113Subscribe to the nearest context provider. Return a signal with the declared default when no provider exists.
<T>(context: { readonly key: symbol; readonly defaultValue: T; }): { readonly value: T; subscribe(fn: (value: T) => void): () => void; }Source notes
Compiler-recognized CONSUMER intrinsic (`16b-CTX`): declares a tracked consumer of `context` for this component and returns the signal its value lives in. ```tsx const theme = useContext(ThemeContext); return <p>{theme.value}</p>; // a tracked slot: refreshes on provider change ``` The returned signal is ONE persistent consumer-local signal: the compiler erases this call into the component's retained setup record, so a reconnect re-reads the nearest provider into the SAME object and a tracked slot keeps exactly one subscription target for the whole element lifetime. Lookup follows the nearest owning component, so an inner provider shadows an outer one and a component with no ancestor provider reads the context's declared default. Reading `.value` in a tracked slot is the supported use — this is the lane's reactive channel, unlike `ref`'s `current`. Reading it inside a handler also works (the signal is live), but only tracked slots refresh. Erased by the compiler; calling it at runtime fails closed.
packages/element/src/internal/core/compile-lifecycle.ts:285Return the custom element that owns the current component instance.
(): HTMLElementSource notes
Compiler-recognized HOST-ACCESS intrinsic (`16b-REF`, `useHost`). ```tsx const host = useHost(); // … host is this instance's owning element (the custom element). ``` It exposes the SAME fact the lifecycle/change/error callbacks already receive as `env.host` — the owning generated element for a root, the nearest enclosing generated element host for a depth-1 retained hostless child — through the expression position instead of a callback parameter. There is therefore no new runtime channel and no second host lookup: the compiler erases the call into a read of the host-element field the retained setup factory already receives. The read is NOT reactive: the element identity never changes for an instance, so a derived node capturing it can never go stale. That is also why it carries no lifecycle ownership — it allocates nothing and needs no cleanup. Erased by the compiler; calling it at runtime fails closed.
packages/element/src/internal/core/compile-lifecycle.ts:218Wrap rendered HTML in a full HTML document.
(html: string, options?: DocumentWrapOptions): stringSource notes
Wrap rendered HTML in a full HTML document. Adds DOCTYPE, head (title, meta, preload), and body. Supports CSP nonce and dev scripts (e.g. Vite client, route module registration).
packages/element/src/internal/core/html-escape.ts:199(tag: string, attrs?: Record<string, unknown>, children?: readonly unknown[]): stringSource notes
Construct one element's HTML. `attrs` values are the wire truth: `true` emits a bare attribute, `false`/`null`/`undefined` omit it, arrays and records coerce for `class`/`style` exactly like the serializer, and every other value is attribute-escaped through `escapeAttr`. The reserved `innerHTML` key is the trusted-HTML sink: its value must carry the trustedHtml brand and becomes the element's content (children must be empty — the compiler's shared walk already enforces that shape). `children` are FINAL HTML strings (static text is escaped at compile time, dynamic text arrives through `__t`, nested components through `__ssr` or a direct compiled call).
packages/element/src/server.ts:170Inject the renderable nested-host tags for this server process.
(tags: readonly string[] | null | undefined): voidpackages/element/src/server.ts:271Serialize one admitted component's server markup.
(tag: string, props?: Record<string, unknown>, sourceInfo?: SsrSourceInfo, composition?: SsrComposition): stringSource notes
Serialize one admitted component's server markup. A generated element's producer is a string builder, so a nested host inside its markup reaches its own producer only through the render's nested-host expander. A class page used to receive that expander from `renderToString`; a SERVER FUNCTION PAGE's compiled `render` calls this function directly, so the expander travels through the module-level set above instead (F16).
packages/element/src/server.ts:284Escape one dynamic text value (the ONLY channel untrusted text may take into a server function component's output).
(value: unknown): stringSource notes
Escape one dynamic text value (the ONLY channel untrusted text may take into a server function component's output). Coercion matches the serializer's text-Part pipeline exactly: displayValue, then the ONE `escapeText`. A thenable is refused before coercion: a `Promise<...>`-annotated prop read at a text sink is already a located compile error (M14-2), and this guard is the untyped backstop for every read the compiler cannot see (an `any` prop). `{await props.p}` settles the value first and never reaches this branch.
packages/element/src/server.ts:143↑ ↓ Select · Tab inspect · Esc return
@openelement/compiler
46 exportsParse one module source and report the semantic facts the compiler boundary and the Vite graph adapters branch on.
(source: string, fileName: string, options?: ModuleSemanticsOptions): ModuleSemanticFactsSource notes
Parse one module source and report the semantic facts the compiler boundary and the Vite graph adapters branch on. Pure: it never resolves imports from disk and never throws on foreign or invalid syntax — an unparsable module simply yields no recognized facts. The scan's factory vocabulary is host-injected: the default knows only the element package's own registration factories, and page-definition/registration facts for other packages require the caller's {@link ModuleSemanticsOptions.vocabulary} descriptors.
packages/compiler/src/internal/compiler/semantic-core/module-analysis.ts:562One owner's class-candidate facts: the build (or dev server) that created it is the only writer, its stylesheet emitter the only reader.
ClassCandidateRegistryOptions and source location
packages/compiler/src/internal/compiler/tailwind-candidates.ts:55Clear without reading — the hygiene a fresh build invocation starts with.
(): voidpackages/compiler/src/internal/compiler/semantic-core/diagnostics/index.ts:152Drop every registered edge (a build's bookkeeping is its own lifetime).
(): voidpackages/compiler/src/internal/compiler/style-requests.ts:93The admitted class candidates of one compiled artifact module, or undefined when the module does not carry the emitted fact.
(source: string, fileName: string): readonly string[] | undefinedSource notes
The admitted class candidates of one compiled artifact module, or undefined when the module does not carry the emitted fact. Generated elements carry a build-only footer, and compiled classes carry their literal static member.
packages/compiler/src/internal/compiler/compiled-artifact-class-candidates.ts:50The `.css` style edges of one compiled artifact module, in authored order — or undefined when the module is not a shape this recovery adopts.
(source: string, fileName: string): readonly string[] | undefinedSource notes
The `.css` style edges of one compiled artifact module, in authored order — or undefined when the module is not a shape this recovery adopts. Never throws and never guesses: a module without the Part Program marker, without a `.css` specifier, without an arrayed `static styles`, or with a sheet import no class arrays is left entirely to the graph's normal channels, exactly as before this recovery existed. Adoption is all-or-nothing per module, so it can never turn a working module into a fail-closed intercept while half its edges stay unregistered. The read tolerates both artifact forms the pack pipeline produces: the compiler's raw emission (TypeScript syntax, e.g. a `type`-annotated styles member) and the packed module (types stripped by the packer). The AST parse is ScriptKind.TSX for exactly that reason — a diagnostics gate on the file extension would refuse the raw form and silently drop its edges.
packages/compiler/src/internal/compiler/compiled-artifact-style-requests.ts:106Error shape consumed by the Vite plugin and compiler tests.
class CompiledElementError extends CompilerDiagnosticErrorpackages/compiler/src/internal/compiler/semantic-core/compiler-diagnostics.ts:20(options?: CompiledElementPluginOptions): PluginSource notes
The `open:compiled-element` Vite plugin: runs at `enforce: 'pre'` so the compiler sees authored TSX before Vite's own TS/JSX lowering, compiles every module one of the two admission lanes owns, and leaves all other modules untouched. `workspaceRoot` anchors generated source-map ids for linked workspace packages. The generated-element site option is a host capability (M09-1b): hosts that resolve islands before the compiler transform supply the tag fact; hosts that do not (a plain standalone build) omit it and the lane stays inert.
packages/compiler/src/internal/compiler/plugin.ts:199Compile one module through the generated native element lane when — and only when — the host supplied a site fact for it.
(code: string, id: string, options: CompileGeneratedElementOptions): CompiledGeneratedElement | nullSource notes
Compile one module through the generated native element lane when — and only when — the host supplied a site fact for it. Admission order (design §4.2): site fact → class-lane ownership → syntactic default-export/sidecar admission (the root and focus facts and the property table included: the lane reads them from the sidecar, D-root-source / D-delegatesFocus / D-props) → props parameter/type cross-check → leaf generation → bindings requirement. The final emitter step is append-only over the leaf text, so every refusal happens before a half-built module can be returned.
packages/compiler/src/internal/compiler/semantic-ir/generated-element/compile.ts:154Project the compiler's already-structured diagnostics onto the protocol's {@linkcode DiagnosticEnvelope} shape.
(diagnostics: ReadonlyArray<ProjectableCompilerDiagnostic>): DiagnosticEnvelope[]Source notes
Project the compiler's already-structured diagnostics onto the protocol's {@linkcode DiagnosticEnvelope} shape. An empty list projects to an empty list — the caller keeps its own fallback rather than inventing a record.
packages/compiler/src/internal/compiler/semantic-core/diagnostics/index.ts:111(code: string, id: string, options?: ServerComponentCompileOptions): CompileServerComponentResult | nullSource notes
The host-build admission bridge: compile `code` through the server function component lane when — and only when — this module belongs to it. - a module carrying a compiled-element decorator (or an unsupported decorator spelling, which the class lane compiles so it fails closed with OEC9027) belongs to the class lane: null; - a module with no admitted server function component and no near-miss exported JSX function has nothing to admit: null; - a near-miss (statements before the return, a block-bodied arrow, or any other exported function/arrow whose body contains JSX but is not the single-return shape) is NOT null: it goes through {@link compileServerComponentModule}, which fails closed with OEC9032. Returning null would hand the authored module to another lane unchanged; - a plain script id never carries the JSX grammar: null; - the cheap `export` + `<` prefilter (the same conservative superset idea the class lane's prefilter uses) keeps plainly inert modules off the parse. A module that does not parse stays null so the host reports the syntax error. Everything else goes through {@link compileServerComponentModule}, whose diagnostics fail the build closed.
packages/compiler/src/internal/compiler/semantic-core/server-component.ts:701Compile one authored TSX module's server function components into the generative constructor module.
(source: string, fileName: string, options?: ServerComponentCompileOptions): CompileServerComponentResult | nullSource notes
Compile one authored TSX module's server function components into the generative constructor module. Returns null for modules with no exported JSX-returning function (nothing to admit). Fails closed with a {@link CompiledElementError} carrying the ordered OEC diagnostics.
packages/compiler/src/internal/compiler/semantic-core/server-component.ts:423The compiled server function component module.
CompileServerComponentResultOptions and source location
packages/compiler/src/internal/compiler/semantic-core/server-component.ts:93Create one owner's registry (see the lifetime note above).
(): ClassCandidateRegistrypackages/compiler/src/internal/compiler/tailwind-candidates.ts:87Project compiler diagnostics onto the adapter's error shape.
(diagnostics: CompilerDiagnostic[], source: string, id: string): PluginDiagnosticError | nullSource notes
Project compiler diagnostics onto the adapter's error shape. Returns null for an empty diagnostics list: there is nothing to locate or render, and the caller keeps its own fallback rather than inventing a location.
packages/compiler/src/internal/compiler/semantic-core/diagnostics/index.ts:209A source-aware compiler diagnostic: stable OEC code, message and source range.
ElementCompilerDiagnosticOptions and source location
packages/compiler/src/internal/compiler/semantic-core/compiler-diagnostics.ts:17EmittedModuleDiagnosticSource notes
One diagnostic the type checker produced for the emitted module. `file` is the virtual module id the check was given; the remaining fields locate the range inside the EMITTED text.
packages/compiler/src/internal/compiler/semantic-core/type-check.ts:37How the emitted module's imports resolve, and any virtual files to add.
EmittedModuleTypeCheckOptionsOptions and source location
packages/compiler/src/internal/compiler/semantic-core/type-check.ts:46`true` when the emitted module type-checks.
(code: string, fileName: string, options?: EmittedModuleTypeCheckOptions): booleanSource notes
`true` when the emitted module type-checks. The boolean form exists so a caller that only needs a verdict does not destructure an empty array; the diagnostics form is for callers that must report what failed.
packages/compiler/src/internal/compiler/semantic-core/type-check.ts:178The host-supplied fact that admits one module to the generated-element lane.
GeneratedElementSiteSource notes
The host-supplied fact that admits one module to the generated-element lane. It is an internal compiler option value, never author syntax: the router derives it from the island path (M09-1b) and the compiler cannot derive it itself because the island transform runs after this compiler plugin. The fact carries the TAG only. The root used to ride here too; D-root-source (2026-11-13) moved it to the compiler lane's own read of the authored sidecar (`site.ts` `readIslandRoot`), so one stale host scan can no longer pin a root that the source no longer declares.
packages/compiler/src/internal/compiler/semantic-ir/generated-element/contract.ts:93The edge a resolved sheet module id carries, if any.
(moduleId: string): RegisteredStyleRequest | undefinedpackages/compiler/src/internal/compiler/style-requests.ts:65True when the importing module has registered edges (query suffixes ignored).
(importerId: string): booleanpackages/compiler/src/internal/compiler/style-requests.ts:70Check whether a module ID names a .jsx or .tsx file, ignoring the query suffix.
(id: string): booleanSource notes
Whether an authored module id has a JSX-bearing source extension.
packages/compiler/src/internal/compiler/semantic-core/jsx-module-id.ts:2ModuleSemanticFactsSource notes
The bundler-neutral facts one module source yields: its relative imports, the intrinsic bindings it admits ({@link ModuleSemanticFacts.compiledElementDecorator}, {@link ModuleSemanticFacts.exportedTagName}, custom-element tags it defines or references) and the interaction-event names its handlers bind. The Vite graph adapter branches on these without re-parsing the AST.
packages/compiler/src/internal/compiler/semantic-core/module-analysis.ts:14Host-supplied vocabulary extensions for the module scan.
ModuleSemanticsOptionsOptions and source location
packages/compiler/src/internal/compiler/semantic-core/module-analysis.ts:147Describe a binding that the module scanner recognizes and the information it records for calls to that binding.
ModuleVocabularyDescriptorSource notes
One module-scan vocabulary entry the host admits: a binding identity (module specifier + exported name, aliases followed) plus the fact a canonical call of that binding contributes. Plain data — the scan consumes the descriptors without learning the caller's package vocabulary, the same direction as the compiler's {@link StaticSidecarDescriptor} admission (#1473 item 3).
packages/protocol/src/module-descriptors.ts:33Rollup-compatible error shape emitted by the Vite adapter boundary.
PluginDiagnosticErrorOptions and source location
packages/compiler/src/internal/compiler/semantic-core/diagnostics/index.ts:167Resolve named imports used as server component tags and return a synchronous lookup for the compiler.
(source: string, fileName: string, resolve: (specifier: string) => string | ResolvedServerComponentSource | undefined | Promise<string | ResolvedServerComponentSource | undefined>): Promise<ServerComponentCompileOptions…Source notes
Resolve the compiler's static source candidates through an asynchronous host.
packages/compiler/src/internal/compiler/semantic-core/server-component.ts:357The same recovery, read once for both facts an artifact states: its edges and its root scope (alpha15 S lane, S-C1.2).
(source: string, fileName: string): CompiledArtifactStyleRead | undefinedSource notes
The same recovery, read once for both facts an artifact states: its edges and its root scope (alpha15 S lane, S-C1.2). The scope comes from the module's own Part Program literal — the emitter writes it verbatim, so the packed form needs no second source of truth and no assumption about which root kind a shipped package used.
packages/compiler/src/internal/compiler/compiled-artifact-style-requests.ts:120Record one compile failure's envelopes for the build exit (#1612).
(diagnostics: ReadonlyArray<ProjectableCompilerDiagnostic>): voidpackages/compiler/src/internal/compiler/semantic-core/diagnostics/index.ts:138One registered style edge: the authored import's build-graph coordinates.
RegisteredStyleRequestOptions and source location
packages/compiler/src/internal/compiler/style-requests.ts:21Register one module's style edges (the registry's one write path, S-C1.4).
(id: string, specifiers: readonly string[], scopeTag: string | undefined): voidSource notes
Register one module's style edges (the registry's one write path, S-C1.4). The importing component's root scope is part of every edge it registers (alpha15 S lane, S-C1.2): a light-root component's sheets leave the build wrapped in `@scope (<tag>)`, so the tag travels to the intercept through the registry key. A shipped artifact states the same fact in its Part Program literal. The Vite transform is the caller for a module the bundler processes; a build host that admits a module for its ADMISSION FACTS alone (a Page or Layout the server renders and no island imports) calls the same step with the same compiled program — no second writer, no second registry.
packages/compiler/src/internal/compiler/plugin.ts:172Register one generated edge (idempotent per module id — recompiles overwrite).
(request: RegisteredStyleRequest): voidOptions and source location
packages/compiler/src/internal/compiler/style-requests.ts:53Carry the source text and resolved filename of an imported server component. The filename selects the parser syntax.
ResolvedServerComponentSourceSource notes
Authored source with the resolved filename that determines its syntax.
packages/compiler/src/internal/compiler/semantic-core/server-component.ts:64Host-supplied admission extensions for the semantic core.
SemanticCoreOptionsOptions and source location
packages/compiler/src/internal/compiler/semantic-core/module-analysis.ts:137Host-supplied inputs for the server function component compile.
ServerComponentCompileOptionsOptions and source location
packages/compiler/src/internal/compiler/semantic-core/server-component.ts:70(file: string, root: string | undefined, workspaceRoot?: string): stringSource notes
Compile-time source identity for a module: absolute Vite ids are converted to project-relative POSIX paths so Part Program `metadata.sourceFile` and `sourceMap.file` never embed the build machine's path. Module resolution, diagnostics, and HMR keys keep using the caller's own id. Anchors are explicit, never guessed from path substrings (a checkout living under e.g. `/srv/www/` must not fool the cut): the Vite project root first, then the workspace root when the caller knows it (a module outside the project root is typically a linked workspace package). Callers that hand the compiler a path outside every known root (synthetic ids, projects without a Vite root) get the id back unchanged — there is no correct relative form to invent, and the library boundary must not reject paths it cannot anchor. This module stays runtime-neutral: resolving a workspace root from disk is the caller's job.
packages/compiler/src/internal/compiler/plugin.ts:54Identify a colocated static policy declaration for the element compiler.
StaticSidecarDescriptorSource notes
One static-sidecar descriptor the host injects into the element compiler: the admission granted is a colocated static policy statement (#1473 item 3, the static-sidecar admission pattern).
packages/protocol/src/module-descriptors.ts:16Every edge whose sheet file is the given path — the dev HMR reverse lookup.
(file: string): RegisteredStyleRequest[]packages/compiler/src/internal/compiler/style-requests.ts:75The sheet file's absolute path for one authored edge: the importing module's directory joined with the authored specifier.
(importerId: string, specifier: string): stringSource notes
The sheet file's absolute path for one authored edge: the importing module's directory joined with the authored specifier. Relative specifiers only (the compiler refuses bare ones), so the join is total. Parent segments (`../theme.css`) resolve lexically against the directory — the key must be the path the bundler's resolver lands on, never a verbatim `..` id no lookup can match.
packages/compiler/src/internal/compiler/style-requests.ts:148The registry key for one authored edge: the sheet file's resolved path, plus the importing component's light-root scope tag when it has one.
(importerId: string, specifier: string, scopeTag?: string): stringSource notes
The registry key for one authored edge: the sheet file's resolved path, plus the importing component's light-root scope tag when it has one. Query suffixes on the importer id (dev-time cache busting) are stripped, so recompiles re-register under one key; the full relative path keeps same-named sheets in sibling subdirectories distinct edges. The scope tag rides the key because the emitted asset is a different resource per scope: a light root's sheet is served wrapped in `@scope (<tag>)`. Registering an edge passes the tag explicitly (the caller is the compile that just proved it); the intercept resolves a `.css` import from `(importer, specifier)` alone, so it reads the same fact back through the importer index. Both paths land on one key for one edge, and a disagreement can only fail closed at the intercept — never emit an unscoped asset.
packages/compiler/src/internal/compiler/style-requests.ts:125Every edge one importing module declared.
(importerId: string): RegisteredStyleRequest[]Source notes
Every edge one importing module declared. The host build uses it to emit the style resources of modules it admitted for their edges alone (S-C1.4: a Page or Layout the server renders and no island imports).
packages/compiler/src/internal/compiler/style-requests.ts:87Drain the recorded envelopes: the exit reads them exactly once.
(): DiagnosticEnvelope[]packages/compiler/src/internal/compiler/semantic-core/diagnostics/index.ts:145Type-check one emitted compiled module.
(code: string, fileName: string, options?: EmittedModuleTypeCheckOptions): EmittedModuleDiagnostic[]Source notes
Type-check one emitted compiled module. Returns `[]` when the module type-checks; otherwise every diagnostic the checker reported, in emission order, so a build can print all of them instead of only the first. The `fileName` should be the module's real (virtual) id, not a placeholder: module resolution and `paths` matching both key off it, and the diagnostics quote it back.
packages/compiler/src/internal/compiler/semantic-core/type-check.ts:91Validate an unknown value as a Part Program v2.
(raw: unknown): asserts raw is PartProgramSource notes
Validate an unknown value as a Part Program v2. The validator is intentionally strict: unknown instruction kinds, missing ownership records and unsafe paths fail before a runtime can guess at their meaning.
packages/protocol/src/part-program.ts:911(options?: CompiledElementPluginOptions): PluginSource notes
The `open:compiled-element` Vite plugin: runs at `enforce: 'pre'` so the compiler sees authored TSX before Vite's own TS/JSX lowering, compiles every module one of the two admission lanes owns, and leaves all other modules untouched. `workspaceRoot` anchors generated source-map ids for linked workspace packages. The generated-element site option is a host capability (M09-1b): hosts that resolve islands before the compiler transform supply the tag fact; hosts that do not (a plain standalone build) omit it and the lane stays inert.
packages/compiler/src/internal/compiler/plugin.ts:199↑ ↓ Select · Tab inspect · Esc return
@openelement/router
205 exportsRoute action: handles form submissions for a page route.
Action<T, Env, Platform, Route>packages/protocol/src/data.ts:64Choose the form action response: true returns serialized data and enhance returns the full HTML used without JavaScript.
"x-openelement-action"Source notes
Request header selecting the action response channel: `true` marks a programmatic caller and selects the serialized ActionResult union; `enhance` marks the built-in morph enhancement and selects the same full-HTML responses the no-JS path receives.
packages/protocol/src/data.ts:125Context passed to a route action function (extends loader context).
ActionContext<Env, Platform, Route>Options and source location
packages/protocol/src/data.ts:47The discriminated result an action returns: `success` carries the action's data; `failure` carries an HTTP status and payload.
ActionOutcome<Data>Source notes
The discriminated result an action returns: `success` carries the action's data; `failure` carries an HTTP status and payload. See ActionResult for the canonical classifier that produces it.
packages/router/src/authoring.ts:213Wire shape returned to the JavaScript form-enhancement path.
ActionResult<Failure>Source notes
Wire shape returned to the JavaScript form-enhancement path. The no-JS path never sees this: it gets the equivalent semantics as plain HTTP (303 on success, 422 with the re-rendered form on validation failure, redirect/error as status codes). Success carries no data envelope. The application-loop contract makes a successful non-GET action answer 303 (PRG) — the framework never answers 200 with a rendered page, or with a success document, for a successful mutation — so the fetch channel answers `{ type: 'redirect' }` naming the PRG target and the authored return value is discarded by design. Success data travels the PRG target instead (query state the loader re-runs with, which the props projector then maps; see the router guide's "Form actions" section). The union previously declared a `{ type: 'success' }` member that no code path ever emitted — removed so the type matches the wire. Error outcomes (CSRF 403, unknown action 404, unparseable body 400, unexpected 500) are NOT part of this union: since #863 they answer RFC 9457 Problem Details with the PROBLEM_JSON_MEDIA_TYPE content type — see ProblemDetails.
packages/protocol/src/data.ts:92Canonical application-level classification for an action return value.
<Data>(result: Data): ActionOutcome<Data>Source notes
Canonical application-level classification for an action return value. Server and SPA executors project this result differently, but neither may redefine validation failure or admit a raw Response as action data.
packages/router/src/authoring.ts:222Default convention base: the directory the tokens/layout/data conventions resolve under when `dirs` is omitted (or has no shared leading segment).
"app"packages/router/src/config.ts:76Default component directory (`app/components`), the `dirs.components` default.
"app/components"packages/router/src/config.ts:70Convention path for the structural document-head module (`app/head.tsx`).
"app/head.tsx"packages/router/src/config.ts:94Convention-relative suffix of the structural document-head module.
"head.tsx"packages/router/src/config.ts:85Default island directory (`app/islands`), the `dirs.islands` default.
"app/islands"packages/router/src/config.ts:67Convention path for the auto-registered layout.
"app/layout.tsx"packages/router/src/config.ts:91Convention-relative suffix of the auto-registered layout.
"layout.tsx"packages/router/src/config.ts:82The tag name the convention layout is registered under.
"app-layout"packages/router/src/config.ts:97The site-title convention source (the package.json `name` field).
"package.json"packages/router/src/config.ts:100Default route directory (`app/routes`), the `dirs.routes` default.
"app/routes"packages/router/src/config.ts:64Convention-relative suffix of the design-token stylesheet.
"styles/tokens.css"packages/router/src/config.ts:79Convention path for the design-token stylesheet.
"app/styles/tokens.css"packages/router/src/config.ts:88The structural document-head convention path for a resolved `dirs` block.
(base: string): stringpackages/router/src/config.ts:699The layout convention path for a resolved `dirs` block.
(base: string): stringpackages/router/src/config.ts:694The token stylesheet convention path for a resolved `dirs` block.
(base: string): stringpackages/router/src/config.ts:689Build the canonical OpenElement request context from a platform request event.
<Env extends Record<string, unknown> = Record<string, unknown>>(options: CreateRequestContextOptions<Env>): OpenElementRequestContext<Env>Options and source location
packages/router/src/model.ts:45Inputs for building an {@linkcode OpenElementRequestContext} from a platform request event.
CreateRequestContextOptions<Env>Options and source location
packages/router/src/model.ts:17`defineConfig()` — identity helper that pins the config file's shape.
(config: OpenElementUserConfig): OpenElementUserConfigOptions and source location
packages/router/src/config.ts:290Validate and register an island delivery descriptor; returns the normalized config.
(config: IslandConfig): IslandConfigOptions and source location
packages/router/src/authoring.ts:1121Attach a descriptor to a server page function. Pass the function to definePage and default-export the result from the route module. The file name determines the URL. See the function overload.
<Data = unknown, Params extends Record<string, string> = Record<string, string>>(componentClass: CustomElementConstructor, descriptor?: PageDescriptorInput<Data, Params>): PageComponentConstructor<Data, Params>Source notes
Attach a page descriptor to a compiled page element class. Canonical page authoring: the route module default-exports the compiled class (produced by the open:compiled-element transform) wrapped in definePage(). The descriptor holds head/route/renderIntent metadata plus the optional props/error projectors; it must NOT create classes or hold a render function — the compiled class's Part Program is the render. import { definePage } from '@openelement/router'; import { HomePage } from '../components/page-home.tsx'; export const loader = async (ctx) => ({ ... }); // module named exports export default definePage(HomePage, { head: { title: 'Home' }, props: ({ data }) => ({ heading: data?.heading ?? '' }), }); The server function page form (alpha15 server lane) passes the module's exported TSX component function instead — the compiler has already lowered it to a generative HTML constructor, so the same call admits it as a `kind: 'function-page'` descriptor whose render IS that function: export function Home(props: { heading: string }) { return <main><h1>{props.heading}</h1></main>; } export const loader = async () => ({ heading: 'Home' }); export default definePage(Home, { head: { title: 'Home' } }); Descriptor-shape discriminant (one rule, no text sniffing, no ABI field): a first argument that is an ES class (its `prototype` is a non-writable own property; plain functions and arrows are not classes) takes the class branch; any other function takes the function-page branch. Non-functions fail closed with NOT_COMPILED_CLASS. The class-vs-function PAGE classification is a build-time route fact owned by the Router plugin, not this discriminant (M11-1 / M01 C07); definePage only picks the descriptor shape for the value it is handed.
packages/router/src/authoring.ts:498Return a structured action failure with an HTTP status and typed data payload.
<Data>(status: number, data: Data): OpenElementActionFailure<Data>Options and source location
packages/router/src/authoring.ts:192The route-module default export shape a definePage() component call produces.
FunctionPageComponent<Data, Params>packages/router/src/authoring.ts:426Type guard for {@linkcode OpenElementActionFailure}, including its duck-typed cross-realm shape.
(error: unknown): error is OpenElementActionFailurepackages/router/src/authoring.ts:197Per-island delivery configuration (SSR/DSD participation and hydration strategy).
IslandConfigOptions and source location
packages/router/src/authoring.ts:759Adapter-owned browser delivery strategy, including media-query admission.
IslandDeliveryStrategypackages/protocol/src/ssg.ts:31The per-property platform facts an island's typed props cannot express.
IslandPropertyConfigSource notes
The per-property platform facts an island's typed props cannot express. The primitive **names and types** come from the root component's typed props parameter (an inline object type literal, or a local `type`/`interface` in the same module); this entry carries only what a TS type cannot say: reflection, the attribute channel and a declared initial value. The compiler lane cross-checks the two declarations and fails closed on any mismatch, so one side can never be silently inferred from the other. The table is deliberately the `@property` option vocabulary minus `type` and `converter`: the typed member IS the type (a duplicated `type` field would be a second source with no added power), and a custom converter is not expressible on this lane. Array/object/`trustedHtml` members are retained as PROPERTY-ONLY rows (plan §14): they must spell `attribute: false`, require an explicit literal default, and never become an attribute or a JSON wire.
packages/router/src/authoring.ts:727Type guard for {@linkcode OpenElementNotFound}, including its duck-typed cross-realm shape.
(error: unknown): error is OpenElementNotFoundpackages/router/src/authoring.ts:156Type guard for {@linkcode OpenElementRedirect}, including its duck-typed cross-realm shape.
(error: unknown): error is OpenElementRedirectpackages/router/src/authoring.ts:140A JSON value: the complete set of shapes the structured-data channel admits (JSON primitives, arrays and plain objects, all readonly).
JsonValueSource notes
A JSON value: the complete set of shapes the structured-data channel admits (JSON primitives, arrays and plain objects, all readonly). Functions, `undefined`, bigint, symbols, class instances, Date, Map and Set are rejected by the runtime normalizer and by this type, so an author cannot write a document the serializer would refuse.
packages/router/src/authoring.ts:243Route loader: fetches data for a page route.
Loader<T, Env, Platform, Route>packages/protocol/src/data.ts:56Context passed to a request-time ('dynamic') route loader.
LoaderContext<Env, Platform, Route>Options and source location
packages/protocol/src/data.ts:40Throw an {@linkcode OpenElementNotFound} to render the 404 path.
(message?: string): neverpackages/router/src/authoring.ts:135Accepted keys inside `build`.
readonly string[]packages/router/src/config.ts:364Canonical config-file name, resolved in the project root.
"openelement.config.ts"packages/router/src/config.ts:61The exact accepted key set, used by the fail-closed unknown-key check and by the error message (the message must name the accepted surface, never just reject).
readonly string[]Source notes
The exact accepted key set, used by the fail-closed unknown-key check and by the error message (the message must name the accepted surface, never just reject). The nested arrays below are this module's single copy of the sub-key surfaces; the host-tooling loader imports them instead of restating them.
packages/router/src/config.ts:301Accepted keys inside `dirs`.
readonly string[]packages/router/src/config.ts:352Accepted keys inside `head`.
readonly string[]packages/router/src/config.ts:324Keys of one `head.scripts` entry.
readonly string[]packages/router/src/config.ts:335Head keys that carry a plain string value.
readonly string[]packages/router/src/config.ts:343Accepted keys inside `i18n`.
readonly string[]packages/router/src/config.ts:361Accepted keys inside `layout`.
readonly string[]packages/router/src/config.ts:355Accepted keys inside `middleware`.
readonly string[]packages/router/src/config.ts:367Accepted keys inside `styles`.
readonly string[]packages/router/src/config.ts:358class OpenElementActionFailureSource notes
Expected-failure channel for actions (decision 0120): validation failures RETURN `fail(status, data)` — never throw — so the server can answer 422 with the form re-rendered and the submitted values echoed back. Thrown values keep the exception channel (redirect/notFound/error page).
packages/router/src/authoring.ts:173Build-output switches.
OpenElementBuildConfigOptions and source location
packages/router/src/config.ts:156Source roots; see the `dirs` section of the module doc comment.
OpenElementDirsConfigOptions and source location
packages/router/src/config.ts:146OpenElementFunctionPageDescriptor<Data, Params>Source notes
The function-page descriptor the pipeline reads (`module.default.openElementPage` with `kind: 'function-page'`): same metadata/projector shape as {@link OpenElementPageDescriptor} plus the compiled component function — no element class exists, so the generated entry registers nothing and renders through the render function.
packages/router/src/authoring.ts:412The document-head channel.
OpenElementHeadConfigSource notes
The document-head channel. Structured only: every entry serializes through the framework's URL/attribute validators, so a raw HTML string has no way in. Structural head content that is not expressible here (font preloads, icons, feed links, inline CSS) belongs in the `app/head.tsx` convention instead.
packages/router/src/config.ts:120One structured `<script src>` descriptor accepted by `head.scripts`.
OpenElementHeadScriptOptions and source location
packages/router/src/config.ts:103Locale configuration for a locale-prefixed build.
OpenElementI18nConfigOptions and source location
packages/router/src/config.ts:138Not-found signal thrown from a loader to render the route's 404 path.
class OpenElementNotFound extends OpenElementErrorpackages/router/src/authoring.ts:114The page descriptor the pipeline reads (`module.default.openElementPage`).
OpenElementPageDescriptor<Data, Params>Source notes
The page descriptor the pipeline reads (`module.default.openElementPage`). Attached to the compiled page class by definePage(); the class owns the render program, so the descriptor carries metadata and projectors only.
packages/router/src/authoring.ts:375Redirect signal thrown from a loader/action to short-circuit rendering with an HTTP redirect.
class OpenElementRedirect extends OpenElementErrorpackages/router/src/authoring.ts:86Host-agnostic request context shared by App request adapters.
OpenElementRequestContext<Env>Options and source location
packages/router/src/model.ts:3Overrides accepted by an `openelement.config.ts` file (unknown keys fail closed).
OpenElementUserConfigOptions and source location
packages/router/src/config.ts:219A compiled element class carrying the page descriptor static.
PageComponentConstructor<Data, Params>packages/router/src/authoring.ts:388Maps a caught render/loader/action failure onto the error variant of the page's compiled properties.
PageErrorProjector<Data, Params>Source notes
Maps a caught render/loader/action failure onto the error variant of the page's compiled properties. Its presence declares that the page's compiled markup carries an error variant (the generated entry renders the page with these props and status 500 — the POST/GET error-boundary channel of decision 0121 §7); without it the generic status page answers.
packages/router/src/authoring.ts:343Page <head> meaning declared by a route descriptor (decision 0143; canonical/alternates in #1326; structured data via the typed JSON-LD channel).
PageHeadSource notes
Page <head> meaning declared by a route descriptor (decision 0143; canonical/alternates in #1326; structured data via the typed JSON-LD channel). Either a static object or — via PageHeadResolver — resolved per render from the request-scoped context by resolvePageDocument (@openelement/router/document) before the serializer runs.
packages/router/src/authoring.ts:266Resolves a page's head from the request-scoped context (#1326).
PageHeadResolver<Data, Params>Source notes
Resolves a page's head from the request-scoped context (#1326). The resolver receives the same context object the props projector gets and must stay a pure function of it — the Document seam (@openelement/router/ document) never fetches, caches, or schedules loaders on its own.
packages/router/src/authoring.ts:354The request-scoped context handed to a page's props projector.
PagePropsContext<Data, Params>Source notes
The request-scoped context handed to a page's props projector. Everything a compiled page can render must pass through here: the compiled render() only reads `this.<property>`, so the projector is the single deterministic seam that maps loader data, action data, params and request onto the page's compiled properties (decision 0143).
packages/router/src/authoring.ts:302Maps the request-scoped context onto the page's compiled properties.
PagePropsProjector<Data, Params>Source notes
Maps the request-scoped context onto the page's compiled properties. Declared as part of the page descriptor; the generated server entry and the SPA bootstrap call it per render and feed the result to renderToString() props (server) or pre-connect property sets (SPA).
packages/router/src/authoring.ts:331Media type of the RFC 9457 action error channel (#863).
"application/problem+json"packages/protocol/src/data.ts:117RFC 9457 response for action protocol errors. The media type is application/problem+json, and detail describes the failure.
ProblemDetailsSource notes
RFC 9457 Problem Details document (#863): the action error channel answers `application/problem+json` instead of the bespoke `{ type: 'error', error: { message } }` JSON, so HTTP tooling recognizes failures natively. With `type: 'about:blank'`, `title` is the HTTP reason phrase and `detail` carries the specific explanation. The wire shape is alpha-unfrozen; the 1.0 acceptance freezes it in this problem+json form.
packages/protocol/src/data.ts:105Default request-to-props projection used when a page descriptor declares no props projector: route params first, then loader-data record entries.
(context: { params?: Record<string, string>; data?: unknown; }): Record<string, unknown>Source notes
Default request-to-props projection used when a page descriptor declares no props projector: route params first, then loader-data record entries. The compiled serializer consumes only the page's declared compiled properties, so extra entries are ignored. Shared by the generated server entries and the SPA bootstrap (each carries its own copy — generated code cannot import this module's internals). Dangerous keys are filtered through the canonical isDangerousKey predicate (#1214): a hostile loader payload such as JSON.parse('{"__proto__": ...}') can never re-prototype the projection record or the page host it is projected onto. The generated server runtime enforces the same rule by importing this canonical predicate through the kernel-free /authoring leaf (#1470 block e: the old build-time serialization copy of DANGEROUS_KEYS into generated code is retired).
packages/router/src/authoring.ts:684Throw an {@linkcode OpenElementRedirect} for `location` (status must be a real 3xx).
(location: string | URL, status?: number): neverOptions and source location
packages/router/src/authoring.ts:130Fill in missing scan roots, trim trailing slashes, and derive the shared directory for conventions.
(dirs: OpenElementDirsConfig | undefined): { routes: string; islands: string; components: string; base: string; }Source notes
Resolve `dirs` to the three absolute-in-project roots the scanner reads. Omitted entries take the documented defaults.
packages/router/src/config.ts:653ServerPageComponentSource notes
A compiled server page component function (alpha15 server lane): the route module's exported TSX component after the server component lane compiled it — props in, final HTML out. While authoring, the TSX function's inferred type is JSX.Element-returning (the compiler owns the body), so this type admits every function shape; the runtime discriminant in definePage() is the authority on which branch a value takes.
packages/router/src/authoring.ts:403Canonical request-time/SSG server route context.
ServerRouteContext<Env, Platform, Route>Options and source location
packages/protocol/src/data.ts:25Context passed to a request-time ('dynamic') route loader.
ServerRouteMetadataSource notes
Context passed to a request-time ('dynamic') route loader. This is the server contract: the loader runs on the server with the Web-standard request, matched route params, the host environment and the platform object, and signals validation failure via fail()/redirect().
packages/protocol/src/data.ts:19One structured-data document — a JSON-LD node such as a schema.org BlogPosting or WebSite.
StructuredDataEntrySource notes
One structured-data document — a JSON-LD node such as a schema.org BlogPosting or WebSite. Its values are JSON data (string, finite number, boolean, null, array, plain object) and nothing else: the serializer emits the document as data, so an HTML string is not a document here.
packages/router/src/authoring.ts:257Run the production build and exit with the build's verdict.
(argv?: string[]): Promise<void>Source notes
Run the production build and exit with the build's verdict. Shared by the `openelement build` bin subcommand (cli.ts) and this module's own main block, so both faces behave identically.
packages/router/src/cli/build.ts:28(argv: string[]): Promise<void>Source notes
Run the serve CLI with the arguments that follow the command (the bin's `start` subcommand passes them through verbatim, so `--mode=preview` reaches the mode parser unchanged). Shared by the `openelement` bin (cli.ts) and this module's own main block.
packages/router/src/cli/start.ts:496One framework client script a resolved document embeds before `</body>`.
ClientScriptDescriptorSource notes
One framework client script a resolved document embeds before `</body>`. Shape-compatible with the serializer's script descriptors, so the document channel routes it through without conversion; entries without src or code are meaningless and rejected at resolution (never silently dropped).
packages/router/src/loading/module/nonce.ts:31One <link rel="alternate"> record, typically carrying an hreflang.
PageHeadAlternateOptions and source location
packages/router/src/document.ts:41ResolvedDocumentSource notes
A page's resolved document meaning: every <head> field after the head resolver (when the descriptor declares one) has run, plus the normalized `links` projection the serializer consumes. Call-site precedence is resolved-document value first, route/build docConfig fallback second.
packages/router/src/document.ts:59A normalized <link> the serializer emits into <head>.
ResolvedDocumentLinkOptions and source location
packages/router/src/document.ts:47Resolves the descriptor head into the page's ResolvedDocument.
(head: PageHead | PageHeadResolver | undefined, context: PagePropsContext, clientScripts?: readonly ClientScriptDescriptor[]): ResolvedDocumentSource notes
Resolves the descriptor head into the page's ResolvedDocument. A head may be a static object or a resolver receiving the same request-scoped context the props projector gets; resolver output is validated exactly like a static head so malformed page meaning fails loudly at either build time or request time instead of being silently dropped from the serialized document. `clientScripts` carries the framework's client-script descriptors (the build's client asset manifest — the render wiring hands them in, they are never author head data); they are validated like every other field and become part of the resolved document, so every render channel — the SSG render pass included — serializes the final script tags from one place.
packages/router/src/document.ts:196(handler: WinterCgHandler): Promise<object>Source notes
Wraps a WinterCG handler in a Hono app: every method and path delegates to the handler with the host's env binding and — when the host runtime provides one — its execution context. The generated entry's `openElementRuntimeAdapter` and default export plug in unmodified: ```ts import { createHonoAdapter } from '@openelement/router/hono'; import openElement from './dist/server/entry.js'; const app = await createHonoAdapter(openElement); export default app; ```
packages/router/src/hono-adapter.ts:82The WinterCG request handler the generated entries export.
WinterCgHandlerpackages/router/src/hono-adapter.ts:30Mount after host middleware/routes; unmatched URLs continue to the host.
(records: readonly HttpRouteRecord[], options?: RouteTableOptions & { methodNotAllowed?: (request: Request, allow: readonly string[]) => Response | Promise<Response>; }): (request: Request, next: () => Promise<Response>…packages/router/src/http.ts:48HttpHandlerSource notes
Dialect-free WinterCG route handler: return a Response to short-circuit, or `next()` to pass control down the method's handler chain; the last handler's `next` is the host middleware chain's own next.
packages/router/src/http.ts:16Route-scoped request context handed to every {@link HttpHandler}.
HttpRouteContextOptions and source location
packages/router/src/http.ts:5HttpRouteRecordSource notes
A route record for the WinterCG middleware ({@link createRouteMiddleware}): the matching fields of a {@link RouteRecord} plus a per-method handler (or handler chain) map, so one path can answer each HTTP method differently.
packages/router/src/http.ts:27Mounts an OpenElement request handler on a Nitro v3 route.
<Env extends Record<string, unknown> = Record<string, unknown>>(options: OpenElementNitroMountOptions<Env>): (event: NitroRequestEvent<Env>) => Promise<Response>Source notes
Mounts an OpenElement request handler on a Nitro v3 route. Near pass-through: the event's standard `req` goes in, the handler's Response comes out — h3 v2 serves a returned Response as-is.
packages/router/src/nitro-mount.ts:56Minimal Nitro v3 route event shape (#857).
NitroRequestEvent<Env>Source notes
Minimal Nitro v3 route event shape (#857). Nitro v3 is fetch-native: its h3 v2 event carries `req`, a srvx ServerRequest that already IS a standard Request, so the pre-v3 method/path/headers/body translation layer is gone. The mount only wires the OpenElement runtime context around the standard Request → Response seam.
packages/router/src/nitro-mount.ts:12Options for mounting an OpenElement request handler under a Nitro/Node server.
OpenElementNitroMountOptions<Env>Options and source location
packages/router/src/nitro-mount.ts:20Convert the framework's Hono-style route dialect to WHATWG URLPattern syntax.
(path: string): stringpackages/router/src/internal/router/route-pattern.ts:2RouteMatch<T>Source notes
One URL matched against the table: the matched `route` record, the identity reported for it, the decoded path `params`, the parsed `searchParams`, and the raw URLPattern `patternResult` the match was derived from.
packages/router/src/internal/router/route-table.ts:67RouteRecordSource notes
One route as the table stores it: the pathname `path`, an optional stable `id` used in match results, optional non-pathname URL component patterns, and the admitted `methods`.
packages/router/src/internal/router/route-table.ts:54RouteResolution<T>Source notes
The table's verdict for one request: a `match` (with the resolved method), `method-not-allowed` (with the `allow` list the caller answers 405 with), or `not-found` when no path in the table matches at all.
packages/router/src/internal/router/route-table.ts:80class RouteTableSource notes
Immutable route matcher built once from a route list: it freezes every record, rejects duplicate identities and pathname-owning patterns at construction, and answers {@link RouteTable.resolve} with a {@link RouteResolution}. `Pattern` is injectable so callers can pin the URLPattern implementation.
packages/router/src/internal/router/route-table.ts:168Construction options: a URL prefix every route is mounted under, and whether a trailing slash is significant.
RouteTableOptionsOptions and source location
packages/router/src/internal/router/route-table.ts:86The matcher surface a client route list compiles to: matching, resolution and candidate count.
CompiledRouteMatcherOptions and source location
packages/router/src/internal/router/client-router.ts:82Compile a client route list into the canonical {@link RouteTable} matcher, with no router instance attached.
(routes: RouteConfig[]): CompiledRouteMatcherpackages/router/src/internal/router/client-router.ts:110(options: RouterOptions): RouterInstanceSource notes
Create the client-side SPA router for `options.mode` over `options.routes`: it matches through the shared RouteTable, owns its navigation listeners and history/hash state, and reports every committed navigation through `onChange`.
packages/router/src/internal/router/client-router.ts:133Match a route through the canonical RouteTable.
(pathname: string, search: string, routes: RouteConfig[]): RouteMatch<RouteConfig> | nullpackages/router/src/internal/router/client-router.ts:98RouteConfigSource notes
One client route: a {@link RouteRecord} plus the custom element `tagName` SPA mode instantiates for it and an optional `guard` that may veto the navigation by returning `false` or a redirect path.
packages/router/src/internal/router/client-router.ts:29RouterInstanceSource notes
A live client router: the navigation entry points, the current match (`currentPath`/`currentRoute`/`params`/`searchParams`), and `dispose()` to release its listeners.
packages/router/src/internal/router/client-router.ts:69Navigation strategy: the History API ('history'), the URL hash ('hash'), or file-protocol auto-detection ('auto').
RouterModepackages/router/src/internal/router/client-router.ts:22Choose the form action response: true returns serialized data and enhance returns the full HTML used without JavaScript.
"x-openelement-action"Source notes
Request header selecting the action response channel: `true` marks a programmatic caller and selects the serialized ActionResult union; `enhance` marks the built-in morph enhancement and selects the same full-HTML responses the no-JS path receives.
packages/protocol/src/data.ts:125(context: OpenElementRequestScope, routePath: string, error: unknown, production: boolean): ResponseSource notes
The fetch-channel 500 (#863, #558): an unexpected action rejection answers RFC 9457 problem+json with internals scrubbed in production (the detail degrades to the reason phrase; development keeps the message for debugging). The native channel stays on the generated handler's HTML error boundary. `production` is the entry's `import.meta.env.PROD`, injected so this module stays free of build-tool globals.
packages/router/src/vite/internal/server-runtime/action-runtime.ts:379What one protocol run hands back to the generated handler.
ActionExecutionOptions and source location
packages/router/src/vite/internal/server-runtime/action-runtime.ts:63The load context the generated handler built; actions receive it plus `formData`.
ActionLoadContextpackages/router/src/vite/internal/server-runtime/action-runtime.ts:51ActionProtocolStateSource notes
The per-request action channel state: mutated by {@linkcode runActionProtocol} before any protocol exit so the generated handler's catch block can branch on the fetch path.
packages/router/src/vite/internal/server-runtime/action-runtime.ts:58The redirect exit for a POST action: every 3xx an author throws out of an action is coerced to 303 — PRG must be method-safe and non-cacheable.
(context: OpenElementRequestScope, location: string, isFetch: boolean): ResponseSource notes
The redirect exit for a POST action: every 3xx an author throws out of an action is coerced to 303 — PRG must be method-safe and non-cacheable. The native form channel answers a real 303; the fetch channel answers HTTP 200 with the redirect carried as the ActionResult body (`{ type: 'redirect', status: 303, location }`) — the serialized client executor matches on the body, not the HTTP status. GET handlers keep the author's status (the generated catch emits that branch itself).
packages/router/src/vite/internal/server-runtime/action-runtime.ts:359A fn-form API handler: the `(ctx) => Response` form an API route module default-exports.
ApiRouteFunctionpackages/router/src/vite/internal/server-runtime/wintercg.ts:183Instantiates a generated CSP policy template for one request: replaces the first `NONCE_PLACEHOLDER` marker with the request nonce.
(policyTemplate: string, nonce: string): stringSource notes
Instantiates a generated CSP policy template for one request: replaces the first `NONCE_PLACEHOLDER` marker with the request nonce. The template is build-time data (route wiring produced it from the author's `middleware.csp` policy); only this substitution is runtime semantics.
packages/router/src/vite/internal/server-runtime/response-channel.ts:145The scope accessor the generated handlers and built-in middleware share.
(request: Request): OpenElementRequestScope | undefinedOptions and source location
packages/router/src/vite/internal/server-runtime/wintercg.ts:254Options for {@linkcode createCorsMiddleware} — the surface the generated entry emits.
CorsOptionsOptions and source location
packages/router/src/vite/internal/server-runtime/middleware.ts:93(maxSize: number): (request: Request, route: unknown, next: () => Promise<Response>) => Promise<Response>Source notes
The default body-limit handler for action POST routes (#568), bound to the serialized `MAX_ACTION_BODY_BYTES` policy constant (see the module doc): an oversized body answers the fetch channel with problem+json 413 (same fork as the CSRF 403) and the native form channel with plain text. The no-store/Vary negotiation headers ride every 413 like every other action response. Larger uploads belong on API routes with explicit limits. Runs as the first element of the generated POST handler chain (`(request, route, next)` — the {@link HttpHandler } shape of
packages/router/src/vite/internal/server-runtime/action-runtime.ts:290(options?: CorsOptions): WinterCgFetchMiddlewareSource notes
The CORS middleware: non-preflight requests get the allow-origin (and credentials/expose) headers on the channel and an appended `Vary: Origin` when the origin is not `*`; an `OPTIONS` preflight short-circuits with 204 and the full allow set. The origin resolver may return undefined to deny — the generated default reflects only localhost origins and denies everything else.
packages/router/src/vite/internal/server-runtime/middleware.ts:118Creates one per-request CSP nonce: a UUID without its dashes (32 hex characters).
(): stringSource notes
Creates one per-request CSP nonce: a UUID without its dashes (32 hex characters). The CSP middleware embeds this value into the `script-src 'nonce-…'` policy it sets on the response and exposes it to the handlers as the `cspNonce` request-scope variable.
packages/router/src/vite/internal/server-runtime/response-channel.ts:135Assembles the generated app from the entry's route descriptor.
(config: GeneratedAppConfig): GeneratedAppSource notes
Assembles the generated app from the entry's route descriptor. Pure factory: descriptor data in, handler contract out — every emitted call site in the entry binds a property of the returned record.
packages/router/src/vite/internal/server-runtime/app.ts:150Binds the layout runtime to the entry's renderer, trust boundary, and serialized layout/nav/locale data.
(deps: LayoutRuntimeDeps): LayoutRuntimeSource notes
Binds the layout runtime to the entry's renderer, trust boundary, and serialized layout/nav/locale data. The entry destructures `{ resolveLayout: __resolveLayout, renderLayout: __renderLayout }`.
packages/router/src/vite/internal/server-runtime/document-runtime.ts:113Logs `<-- METHOD /path` before the chain and `--> METHOD /path 200 12ms` after it, with the elapsed time humanized the way the previous built-in logged it.
(options?: LoggerOptions): WinterCgFetchMiddlewareSource notes
Logs `<-- METHOD /path` before the chain and `--> METHOD /path 200 12ms` after it, with the elapsed time humanized the way the previous built-in logged it. No color support: the color policy read `process.env`, which shipped runtime code must not (P3).
packages/router/src/vite/internal/server-runtime/middleware.ts:70(): (request: Request, allow: string[]) => ResponseSource notes
The 405 responder handed to `createRouteMiddleware` as `methodNotAllowed`: no-store (request-time responses are never cacheable), the action negotiation `Vary`, and the `Allow` header listing the route's methods (#572). Reads the per-request scope bound by the WinterCG composition layer so the WinterCG-side middleware can answer through the scope's text channel with the channel headers merged in.
packages/router/src/vite/internal/server-runtime/route-dispatch.ts:36The native renderer (default): render a registered compiled element class through Element composition.
(deps: NativePageRendererDeps): PageSsrRendererSource notes
The native renderer (default): render a registered compiled element class through Element composition. Fails closed for invalid tags, depth-bound violations, and unregistered hosts — an unknown OpenElement host cannot be server-rendered (client-only and foreign tags pass through per the admission plan).
packages/router/src/vite/internal/server-runtime/renderer-runtime.ts:107(paths: readonly string[]): Record<string, Record<string, unknown>>Source notes
Creates the per-path page handler table the generated GET/POST wiring populates: one mutable method record per page path, keyed by the route path literal the wiring emits.
packages/router/src/vite/internal/server-runtime/route-dispatch.ts:22Create the default, custom, and error page props projectors with the entry’s protected-key rules.
(deps: PagePropsRuntimeDeps): PagePropsRuntimeSource notes
Binds the page props projection to the generated entry's serialized dangerous-key list. Returns the three projection seams under their generated binding names (`__pageProps`, `__pageErrorProps` — the entry destructures them).
packages/router/src/vite/internal/server-runtime/page-render.ts:209(options?: RequestIdOptions): WinterCgFetchMiddlewareSource notes
Reads the inbound request id (honoring it only when it is present, ≤ `limitLength`, and free of characters outside `[A-Za-z0-9_-=]`), regenerates otherwise, exposes it as the `requestId` scope variable and the response header — the request-id header rides every response the scope builds.
packages/router/src/vite/internal/server-runtime/middleware.ts:40Creates one per-request scope. Exported for the generated wiring's test harnesses; {@linkcode WinterCgApp.fetch} creates and binds one per dispatch.
(request: Request, env?: Record<string, unknown>, platform?: unknown): OpenElementRequestScopeOptions and source location
packages/router/src/vite/internal/server-runtime/wintercg.ts:106The security response headers, applied after the response exists so a handler cannot skip them, plus `X-Powered-By` removal.
(): WinterCgFetchMiddlewareSource notes
The security response headers, applied after the response exists so a handler cannot skip them, plus `X-Powered-By` removal. Same names and values (and the same disabled `Cross-Origin-Embedder-Policy` default) as the built-in set they replace.
packages/router/src/vite/internal/server-runtime/middleware.ts:178Binds the status-page renderer to the entry's `escapeHtml` import.
(escapeHtml: (value: string) => string): StatusHtmlRendererSource notes
Binds the status-page renderer to the entry's `escapeHtml` import. The generated entry imports the canonical escaper (@openelement/element[/html]), so the one implementation serves every status channel (404 fallbacks, render failures, SSG redirect pages).
packages/router/src/vite/internal/server-runtime/document-runtime.ts:48(config: StreamBodyConfig): StreamBodyFnSource notes
Binds the streaming body builder to the entry's injected Element function (and the policy timeout default): the returned builder is the `__streamBody` call site the generated handler invokes once per streamed response.
packages/router/src/vite/internal/server-runtime/stream-runtime.ts:327Creates the per-request response-header channel for a streamed route: the author-facing `Headers` proxy plus its commitment switch.
(route: string): ResponseHeaderChannelSource notes
Creates the per-request response-header channel for a streamed route: the author-facing `Headers` proxy plus its commitment switch. The proxy guards the mutating members (`append`, `set`, `delete`) after {@linkcode ResponseHeaderChannel.commit}: a late write from a held `context.responseHeaders` reference is a no-op with a structured diagnostic naming the route, header, and operation (the no-op rule; it never throws and never reinterprets a late `Location`/`Set-Cookie` as a protocol decision). Every other member — reads, `forEach` included — behaves exactly like the wrapped `Headers`, and `forEach` hands the callback the proxy itself so a callback-held reference is gated the same way. `route` only feeds the diagnostic payload.
packages/router/src/vite/internal/server-runtime/response-channel.ts:60(original: Request): StreamRequestScopeSource notes
The request scope for one streamed route: the loader's `request.signal` aborts when the client disconnects (upstream abort fan-out), the response body's `cancel()` tears the whole scope down, and {@linkcode * StreamRequestScope.abortWork} aborts pending loader work at the timeout without cancelling the still-open response.
packages/router/src/vite/internal/server-runtime/stream-runtime.ts:126Creates the internal WinterCG app one generated entry assembles.
(): WinterCgAppSource notes
Creates the internal WinterCG app one generated entry assembles. The dispatch builds lazily on the first fetch (registration happens at module scope) and rebuilds if anything registers afterwards.
packages/router/src/vite/internal/server-runtime/wintercg.ts:270Object prototype keys that must never be injected from untrusted props.
ReadonlySet<string>packages/element/src/internal/core/security.ts:25Everything the generated entry destructures and re-exports.
GeneratedAppOptions and source location
packages/router/src/vite/internal/server-runtime/app.ts:93The route-descriptor data the generated entry hands the factory.
GeneratedAppConfigOptions and source location
packages/router/src/vite/internal/server-runtime/app.ts:67The page-render seam the entry's Element imports feed (renderer-adapter selected).
GeneratedPageRuntimeSource notes
The page-render seam the entry's Element imports feed (renderer-adapter selected). Present only when the entry has page routes: an API-only entry imports no Element renderer and binds none of it.
packages/router/src/vite/internal/server-runtime/app.ts:55Installs the SSR registry guard and returns its registration seam.
(): SsrRegistryGuardSource notes
Installs the SSR registry guard and returns its registration seam. Behavior contract (moved verbatim from the generated entry): - The TRUE original `define` is captured ONCE on the registry itself (SSR_REGISTRY_ORIGINAL_DEFINE): the registry outlives vite dev SSR module re-evaluations, so a second installation must never capture the already-wrapped `define` as its "original" (#1339). - On the dev SSR stub registry (SSR_REGISTRY_STUB_MARKER) re-definition WINS — the registry outlives module re-evaluation, so route edits only reach SSR output when define() overwrites the stale class (#952). - `NotSupportedError` from a non-stub registry is swallowed (the shim's duplicate-define rejection is its designed live-reload notice); any other error propagates. - A tag the entry registered itself (ownership map) is re-registered through the TRUE original define — a dev re-evaluation registers a FRESH class for the SAME tag and the new class must win. A registration the entry did NOT make is a genuine conflict and keeps the fail-closed no-op.
packages/router/src/vite/internal/server-runtime/security.ts:84True when the dispatch is an SSG prerender pass.
(env: unknown): booleanSource notes
True when the dispatch is an SSG prerender pass. Static build output cannot carry per-request state — the SSG nonce contract (nonce.ts: SSG output carries none, static bytes cannot be per-request) — so the CSP auto-nonce binds nothing on this pass: the handlers' `c.get('cspNonce')` stays undefined and `wrapInDocument` serializes the client script tags nonce-free while the SSG CSP injector writes the policy-only meta.
packages/router/src/vite/internal/server-runtime/response-channel.ts:166The layout runtime bound into the generated entry.
LayoutRuntimeOptions and source location
packages/router/src/vite/internal/server-runtime/document-runtime.ts:58What {@linkcode createLayoutRuntime} binds: the entry's Element imports plus its serialized plan data.
LayoutRuntimeDepsOptions and source location
packages/router/src/vite/internal/server-runtime/document-runtime.ts:91(locales: readonly string[], path: unknown, fallback: string): stringSource notes
Path-derived locale resolution: the first non-empty path segment when it is a declared locale, the fallback otherwise. `locales` is the generated entry's `__locales` project declaration, so request-time resolution and the pages the build emits agree (see expandI18nLocales).
packages/router/src/vite/internal/server-runtime/page-render.ts:74(href: string, locale: string, defaultLocale: string): stringSource notes
Layout href localization: root-relative hrefs gain the active locale prefix unless they already carry it; locale-neutral, external, and protocol-relative hrefs pass through untouched. Nav data is not part of the 1.0 surface, so the generated `__headerNav` is empty today — the contract keeps its guard.
packages/router/src/vite/internal/server-runtime/document-runtime.ts:26Options for {@linkcode createLoggerMiddleware}.
LoggerOptionsOptions and source location
packages/router/src/vite/internal/server-runtime/middleware.ts:59(pattern: string, pathname: string): booleanSource notes
Hono-compatible middleware-scope matching: `'/p/*'` matches `/p` itself and everything beneath it; `'/*'` matches everything; a bare `'/p'` matches only `/p` exactly.
packages/router/src/vite/internal/server-runtime/wintercg.ts:236Merges the loader/action response-header channel into a response.
(response: Response, channel: Headers): ResponseSource notes
Merges the loader/action response-header channel into a response. Channel entries are appended after the framework-set headers, so multi-value `Set-Cookie` accumulates; a protocol header ({@linkcode PROTOCOL_HEADERS}) the response already carries is skipped — the channel cannot override the protocol. An empty channel returns the original `Response` object untouched, so responses that never touch the channel keep their identity (and their streaming body is not rebuilt).
packages/router/src/vite/internal/server-runtime/response-channel.ts:111The subset of the Element serializer the native renderer needs.
NativePageRendererDepsOptions and source location
packages/router/src/vite/internal/server-runtime/renderer-runtime.ts:79The per-request scope: one instance per dispatch, bound to its request by the identity registry.
OpenElementRequestScopeSource notes
The per-request scope: one instance per dispatch, bound to its request by the identity registry. Response headers written before the response exists (`header()`) flow into every response the scope constructs — the merge point the Hono context's prepared headers used to own.
packages/router/src/vite/internal/server-runtime/wintercg.ts:66The request-scoped page context the generated handlers build for one render (#1326).
PageContextpackages/router/src/vite/internal/server-runtime/page-render.ts:86(routeModule: unknown): PageDefinitionSource notes
Canonical page-definition extractor: a route module's default export carries the authoring descriptor on `openElementPage`; anything else projects to the empty descriptor. Kept a hoisted-friendly plain function — the generated entry calls it at module evaluation (route registration, routeInfo) and inside every request handler.
packages/router/src/vite/internal/server-runtime/page-render.ts:44The page descriptor a definePage route module carries on its default export.
PageDefinitionpackages/router/src/vite/internal/server-runtime/page-render.ts:25The page props projection runtime: the default projection from route params/loader data plus the descriptor's `props`/`error` projector seams.
PagePropsRuntimeSource notes
The page props projection runtime: the default projection from route params/loader data plus the descriptor's `props`/`error` projector seams. Every seam filters the canonical dangerous-key set (#1214) so hostile params, loader data, or author projector output can never pollute the props record that flows into the compiled serializer.
packages/router/src/vite/internal/server-runtime/page-render.ts:102The binding the generated-app factory hands {@linkcode createPagePropsRuntime}.
PagePropsRuntimeDepsOptions and source location
packages/router/src/vite/internal/server-runtime/page-render.ts:112PageSsrRendererSource notes
The generated entry's `__ssr` binding: render one registered host tag to HTML. `depth` bounds nested island expansion; `projectedChildren` claims external content (the layout slot). Fails closed per the forks below.
packages/router/src/vite/internal/server-runtime/renderer-runtime.ts:61Source metadata the serializer attributes to a render (the `{ route }` seam).
PageSsrSourceInfoOptions and source location
packages/router/src/vite/internal/server-runtime/renderer-runtime.ts:41Trusted parent-owned light children keyed by slot name (the shell slot claim).
ProjectedChildrenOptions and source location
packages/router/src/vite/internal/server-runtime/renderer-runtime.ts:54The projected props record handed to the compiled page host.
ProjectedPropspackages/router/src/vite/internal/server-runtime/page-render.ts:93Headers the loader/action channel may never override once the response already carries them: the framework protocol always wins on conflict.
ReadonlySet<string>Source notes
Headers the loader/action channel may never override once the response already carries them: the framework protocol always wins on conflict. Compared case-insensitively against the channel entry's name; the channel may still introduce one of these when the response does not set it itself.
packages/router/src/vite/internal/server-runtime/response-channel.ts:36Synchronous server function page render.
(page: unknown, props: ProjectedProps): stringSource notes
Synchronous server function page render. A sync render returns its HTML string on this turn. A thenable is still `String`'d, matching the previous contract; production routes do not use this function for async components.
packages/router/src/vite/internal/server-runtime/page-render.ts:184Full-await server function page render.
(page: unknown, props: ProjectedProps): Promise<string>Source notes
Full-await server function page render. Published from `@openelement/router/server-runtime` because the generated normal, error, 404, and SSG entries import it from that module. A sync render becomes a fulfilled promise of the same string. A thenable is adopted: fulfillment is coerced with `String` after it settles, and rejection rejects this promise with the original reason. Nothing is built into HTML before that settlement, and a rejection is not caught here.
packages/router/src/vite/internal/server-runtime/page-render.ts:197Options for {@linkcode createRequestIdMiddleware}.
RequestIdOptionsOptions and source location
packages/router/src/vite/internal/server-runtime/middleware.ts:24The request view the generated wiring binds as `c.req`.
RequestScopeRequestOptions and source location
packages/router/src/vite/internal/server-runtime/wintercg.ts:46ResponseHeaderChannelSource notes
The per-request response-header channel: the mutable `Headers` instance the loader and the action receive as `context.responseHeaders`, plus the commitment switch the generated stream handler flips when the response is committed.
packages/router/src/vite/internal/server-runtime/types.ts:18(routeModule: unknown): Record<string, unknown>Source notes
Canonical route metadata derived from a route module: only the keys the entry consumers read (route, layout, title, description), each present exactly when the descriptor defines it — spread-conditional, so an absent key stays absent instead of becoming `undefined`.
packages/router/src/vite/internal/server-runtime/page-render.ts:55A route module namespace as the generated entry imports it (`import * as $route`).
RouteModulepackages/router/src/vite/internal/server-runtime/page-render.ts:28Runs the action POST protocol for one request: resolve the action (named `?
(context: OpenElementRequestScope, routeModule: unknown, loadContext: ActionLoadContext, renderStatusPage: (title: string, message: string, status: number) => Response, state: ActionProtocolState): Promise<ActionExecuti…Source notes
Runs the action POST protocol for one request: resolve the action (named `?/name` map or bare `action` export), enforce the same-origin CSRF floor, parse the form body, classify the outcome, and answer per channel: - fetch callers (`ACTION_FETCH_HEADER: true`) always get JSON — the ActionResult union for outcomes, RFC 9457 problem+json for protocol errors (CSRF 403, unknown action 404, unparseable body 400); - native form callers get PRG 303 on success, the status page on protocol errors, and `{ actionResult }` back for a `fail()` so the handler re-renders the form at the author's status (422).
packages/router/src/vite/internal/server-runtime/action-runtime.ts:114The env key the SSG prerender pass sets to `true` on every build-time dispatch (ssg-render.ts passes `{ [SSG_PRERENDER_ENV_KEY]: true }` as the request env).
"OPEN_ELEMENT_SSG_CONTEXT"Source notes
The env key the SSG prerender pass sets to `true` on every build-time dispatch (ssg-render.ts passes `{ [SSG_PRERENDER_ENV_KEY]: true }` as the request env). Since #1560 the prerender driver is our own static generator, so the key is owned here — this module is the single source; the build side imports the constant, and no second copy exists to drift.
packages/router/src/vite/internal/server-runtime/response-channel.ts:156What the generated entry gets from {@linkcode installSsrRegistryGuard}.
SsrRegistryGuardOptions and source location
packages/router/src/vite/internal/server-runtime/security.ts:37The generated entry's `__statusHtml` binding: title/message rendered into a minimal status page.
StatusHtmlRendererpackages/router/src/vite/internal/server-runtime/document-runtime.ts:40stringSource notes
The browser installer bootstrap — the inline head script of every streamed page: the MutationObserver that scans streaming templates, the typed seed admission against the same policy budgets the server enforced, the anchor range ownership check, the frame markup safety screen, and the pagehide retirement/BFCache contract. The module owns the string so the server pump and the browser installer read the same constants from one place; S4 will re-home it from the per-page inline form to a shared asset.
packages/router/src/vite/internal/server-runtime/stream-runtime.ts:520Binding-time configuration of {@linkcode createStreamBody}.
StreamBodyConfigOptions and source location
packages/router/src/vite/internal/server-runtime/stream-runtime.ts:102The bound streaming body builder the generated handler calls.
StreamBodyFnpackages/router/src/vite/internal/server-runtime/stream-runtime.ts:117Per-request inputs of the streaming body builder.
StreamBodyOptionsOptions and source location
packages/router/src/vite/internal/server-runtime/stream-runtime.ts:91The streamed document halves the element `documentStreamParts` produced.
StreamDocumentPartsOptions and source location
packages/router/src/vite/internal/server-runtime/stream-runtime.ts:85The slice of the element stream executor the pump consumes.
StreamExecutorViewOptions and source location
packages/router/src/vite/internal/server-runtime/stream-runtime.ts:76One declared deferred field's settlement record (the pump's queue unit).
StreamFieldRecordOptions and source location
packages/router/src/vite/internal/server-runtime/stream-runtime.ts:54(data: unknown, manifest: StreamRouteManifest): StreamFieldRecord[]Source notes
The deferred-field front gate: validates the loader data against the route's build manifest (one plain object, the `STREAM_MAX_FIELDS` / `STREAM_MAX_OWNERS` budget, every declared field present, no undeclared thenable), attaches both settlement observers per field, and hands back the records the pump queues. Every rejection first sweeps the loader's own thenables for observation (see {@linkcode observeThenables}).
packages/router/src/vite/internal/server-runtime/stream-runtime.ts:199The request scope the generated handler builds around a streamed route.
StreamRequestScopeOptions and source location
packages/router/src/vite/internal/server-runtime/stream-runtime.ts:64Opaque capability marking HTML the application has explicitly vetted as trusted.
TrustedHtmlValueOptions and source location
packages/router/src/vite/internal/server-runtime/renderer-runtime.ts:24The internal WinterCG app: the composition surface the generated entry wires.
WinterCgAppOptions and source location
packages/router/src/vite/internal/server-runtime/wintercg.ts:195The dialect-free fetch middleware the whole composition speaks.
WinterCgFetchMiddlewarepackages/router/src/vite/internal/server-runtime/wintercg.ts:40File size info for a single artifact
ArtifactInfoOptions and source location
packages/router/src/vite/build-manifest.ts:38Build an OpenElement application through the supported adapter boundary.
(config?: InlineConfig): Promise<unknown>Source notes
Build an OpenElement application through the supported adapter boundary. Consumers configure the adapter in `vite.config.ts`; this function owns the invocation so CLI callers do not need to know the adapter's internal build phases or Vite plugin ordering. KR-15: this is a PRODUCTION build. Vite derives `import.meta.env.PROD` from ambient `process.env.NODE_ENV`, not from `mode`, so a build launched from a test runner (`NODE_ENV=test`) or a dev shell silently emitted a development-semantics SSR bundle — `PROD=false`, so the production error channel stopped scrubbing and SSG 500 details fell back to stack traces (known-reds KR-15, Release P0 Gate). Pin production for the duration of the Vite call and restore the ambient value afterwards, so programmatic callers (and their tests) cannot leak a production NODE_ENV into the rest of the process. `mode` is made explicit for the same reason: the generated `import.meta.env.MODE` should say production even when a caller's ambient environment disagrees.
packages/router/src/vite/index.ts:73Build the headExtras string from FrameworkOptions.inject.
(options: FrameworkOptions): HeadExtrasResultSource notes
Build the headExtras string from FrameworkOptions.inject. Serializes headFragments, stylesheets, and scripts into a single HTML string to inject into <head>. Validates all URLs and ensures no raw <script> tags bypass the structured injection APIs.
packages/router/src/vite/head-injection.ts:151Full build manifest summary
BuildManifestOptions and source location
packages/router/src/vite/build-manifest.ts:49Low-level Vite plugin pipeline: SSR dev server, SSG and islands without the content/i18n conveniences of `openElement()`.
(config?: OpenPipelineConfig): Plugin[]Options and source location
packages/router/src/vite/index.ts:39Adapter options extend Element options with build-only delivery declarations. The element package remains unaware of Vite/SSG policy.
FrameworkOptionspackages/router/src/vite/framework.ts:37Result of building head extras from FrameworkOptions.
HeadExtrasResultOptions and source location
packages/router/src/vite/head-injection.ts:139Vite plugin compiling `.mdx` route files into compiled page modules.
(options?: OpenMdxPluginOptions): PluginOptions and source location
packages/router/src/vite/plugin-mdx.ts:72Create the full OpenElement Vite plugin set: route pipeline, SSG and islands.
(options?: OpenElementOptions): Plugin[]Options and source location
packages/router/src/vite/app-vite.ts:39Blog options stored in the adapter build context.
OpenElementBlogOptionsOptions and source location
packages/router/src/vite/framework.ts:59class OpenElementBuildContextSource notes
The build's shared mutable state: the resolved framework options, the phase-1/phase-3 metadata, the sub-plugin data slots, and the production plan and artifact records the release and deployment adapters read. One instance is threaded through every adapter plugin for a build.
packages/router/src/vite/build-context.ts:219Minimal build-context contract available to adapter sub-plugins.
OpenElementBuildContextLikeOptions and source location
packages/router/src/vite/framework.ts:84Locale options carried through the build context to the i18n integration.
OpenElementI18nContextOptionspackages/router/src/vite/framework.ts:77Project locale declaration.
OpenElementI18nOptionsSource notes
Project locale declaration. The build expands every static and dynamic route under each additional locale prefix (`/zh/docs`), passes the resolved locale to page `head`/`props` hooks and localizes layout navigation. Absent means a single-locale site with no locale prefixing — the pre-i18n output, byte for byte.
packages/router/src/vite/framework.ts:26Options for the openElement() unified Vite entry.
OpenElementOptionsSource notes
Options for the openElement() unified Vite entry. The framework-options face here is deliberately narrower than the internal {@linkcode FrameworkOptions} transfer type: - the document-head channel is spelled `head` (never `html`), the same spelling `openelement.config.ts` uses — passing `html` fails closed and names the replacement; - the source roots keep their explicit spellings (`routesDir`, `islandsDir`), while a config file's `dirs` block is the spelling that also moves the file conventions.
packages/router/src/vite/app-vite.ts:31Options for the `.mdx` route plugin ({@linkcode mdxPlugin}).
OpenMdxPluginOptionsOptions and source location
packages/router/src/vite/plugin-mdx.ts:29Low-level Vite plugin pipeline: SSR dev server, SSG and islands without the content/i18n conveniences of `openElement()`.
(config?: OpenPipelineConfig): Plugin[]Options and source location
packages/router/src/vite/index.ts:39Options for the low-level {@linkcode openPipeline} Vite plugin pipeline.
OpenPipelineConfigOptions and source location
packages/router/src/vite/index.ts:30The resolved preset options: the declared style sources, in order.
ResolvedTailwindOptionsOptions and source location
packages/router/src/vite/tailwind.ts:59Speculation Rules configuration for SSG post-processing
SpeculationRulesOptionsOptions and source location
packages/protocol/src/ssg.ts:448User-facing SSG build behavior switches (OpenElementOptions['ssg']).
SsgBehaviorOptionsOptions and source location
packages/protocol/src/ssg.ts:63TailwindOptionsSource notes
Options for the opt-in Tailwind entry (alpha15 S lane; the pre-S "preset" compiled the sources itself — this shape only declares them). `tailwind: true` enables the entry with no declared sources: the document stylesheet is Tailwind's own default compile (`@import 'tailwindcss'`). The shape lives here, on the host-neutral config surface, and the Vite build layer consumes it — the Framework-root declaration graph packed consumers typecheck must never name `vite` (the packed-consumer gate's declaration leak pattern).
packages/router/src/config.ts:176↑ ↓ Select · Tab inspect · Esc return
@openelement/create
5 exportsThe dist-tag a versionless documented install resolves: npm's scope alias defaults to `latest`, which the 1.0 line rides since the alpha.11 ruling.
"latest"Source notes
The dist-tag a versionless documented install resolves: npm's scope alias defaults to `latest`, which the 1.0 line rides since the alpha.11 ruling. The exact version is registry truth; the canonical spelling names no tag.
packages/create/src/install-command.ts:33"@openelement"Source notes
The scope `npm create` resolves to {@linkcode CREATE_PACKAGE_SPECIFIER}: npm's initializer alias maps a bare `@scope` (optionally `@scope@<tag>`) to `@scope/create` at the same tag — untagged, at the scope's default dist-tag — so the canonical spelling never repeats the `/create` suffix (owner-verified against npm's init alias rules).
packages/create/src/install-command.ts:26The npm specifier the generator is published under.
"@openelement/create"packages/create/src/install-command.ts:17Placeholder the usage text and the docs use in place of a project name.
"<project-name>"packages/create/src/install-command.ts:36(projectName?: string, options?: { tag?: string; }): stringSource notes
The documented install command shapes, all verified against the published two-bin artifact (bins `openelement-create` and `create-openelement`, both `src/cli.js`; npm 11 / pnpm 12): - canonical: `npm create
packages/create/src/install-command.ts:59↑ ↓ Select · Tab inspect · Esc return
@openelement/ui
24 exportsThe build-time generated package manifest (declarations for every UI component).
OpenElementPackageManifestpackages/ui/src/manifest.ts:15Button or link control with variant/size surfaces and form participation.
(props: { variant: string; size: string; disabled: boolean; href: string; target: string; type: string; }): anyOptions and source location
packages/ui/src/open-button.tsx:67Code block with a copy button.
(props: { copyLabel: string; }): anyOptions and source location
packages/ui/src/open-code-block.tsx:48Dialog component using native <dialog> element + popover API.
(props: { open: boolean; label: string; closeLabel: string; }): anyOptions and source location
packages/ui/src/open-dialog.tsx:73Popover-API dropdown with CSS Anchor Positioning placement.
(props: { anchorName: string; }): anyOptions and source location
packages/ui/src/open-dropdown.tsx:54Form-associated text input with a label, an error slot and native validity.
(props: { type: string; placeholder: string; label: string; name: string; value: string; disabled: boolean; required: boolean; error: string; }): anyOptions and source location
packages/ui/src/open-input.tsx:76(props: { theme: string; }): anySource notes
Theme toggle button for dark/light mode: reads and flips the document's `data-theme` (with an initialization priority chain) and persists the choice; icon visibility follows the current theme attribute.
packages/ui/src/open-theme-toggle.tsx:56Read the host's `key` slot, initializing it with `init()` on first use.
<T>(host: object, key: string, init: () => T): Tpackages/ui/src/instance-state.ts:15Overwrite the host's `key` slot.
(host: object, key: string, value: unknown): voidpackages/ui/src/instance-state.ts:26Read the host's `key` slot, initializing it with `init()` on first use.
<T>(host: object, key: string, init: () => T): Tpackages/ui/src/instance-state.ts:15Overwrite the host's `key` slot.
(host: object, key: string, value: unknown): voidpackages/ui/src/instance-state.ts:26The build-time generated package manifest (declarations for every UI component).
OpenElementPackageManifestpackages/ui/src/manifest.ts:15Button or link control with variant/size surfaces and form participation.
(props: { variant: string; size: string; disabled: boolean; href: string; target: string; type: string; }): anyOptions and source location
packages/ui/src/open-button.tsx:67{ root: "shadow"; delegatesFocus: true; formAssociated: true; styles: string[]; properties: { variant: { default: string; reflect: true; }; size: { default: string; reflect: true; }; disabled: { default: false; reflect:…Source notes
Platform facts for the generated element: shadow root with delegated focus, form association (the class lane's `formAssociated: true`, so `form.elements` membership and the effective-disabled custom state are unchanged), the authored stylesheet, and the six declared property rows — all reflected, the class lane's exact attribute surface.
packages/ui/src/open-button.tsx:51Code block with a copy button.
(props: { copyLabel: string; }): anyOptions and source location
packages/ui/src/open-code-block.tsx:48Platform facts for the generated element: shadow root, the authored component stylesheet, and the `copyLabel` property (property-only, no attribute form).
{ root: "shadow"; styles: string[]; properties: { copyLabel: { default: string; attribute: false; }; }; }packages/ui/src/open-code-block.tsx:38Dialog component using native <dialog> element + popover API.
(props: { open: boolean; label: string; closeLabel: string; }): anyOptions and source location
packages/ui/src/open-dialog.tsx:73Platform facts for the generated element: shadow root with delegated focus, the authored package stylesheets, and the declared property rows.
{ root: "shadow"; delegatesFocus: true; styles: string[]; properties: { open: { default: false; reflect: true; }; label: { default: string; }; closeLabel: { default: string; attribute: string; }; }; }Source notes
Platform facts for the generated element: shadow root with delegated focus, the authored package stylesheets, and the declared property rows. Only `open` reflects property updates back to the attribute.
packages/ui/src/open-dialog.tsx:61Popover-API dropdown with CSS Anchor Positioning placement.
(props: { anchorName: string; }): anyOptions and source location
packages/ui/src/open-dropdown.tsx:54{ root: "shadow"; styles: string[]; properties: { anchorName: { default: string; attribute: false; }; }; }Source notes
Platform facts for the generated element: shadow root, the authored package stylesheets, and the property-only `anchorName` row (the anchor identity is assigned at activation, never spelled as an attribute).
packages/ui/src/open-dropdown.tsx:43Form-associated text input with a label, an error slot and native validity.
(props: { type: string; placeholder: string; label: string; name: string; value: string; disabled: boolean; required: boolean; error: string; }): anyOptions and source location
packages/ui/src/open-input.tsx:76{ root: "shadow"; delegatesFocus: true; formAssociated: true; styles: string[]; properties: { type: { default: string; }; placeholder: { default: string; }; label: { default: string; }; name: { default: string; }; value…Source notes
Platform facts for the generated element: shadow root with delegated focus, form association (value publication, required and email validity, reset/restore and the fieldset-effective disabled state are the SHELL's mapping), the authored stylesheet, and the eight declared property rows. Only `value` has no attribute wire — it is the live property the form contract and the compiled sinks read.
packages/ui/src/open-input.tsx:58(props: { theme: string; }): anySource notes
Theme toggle button for dark/light mode: reads and flips the document's `data-theme` (with an initialization priority chain) and persists the choice; icon visibility follows the current theme attribute.
packages/ui/src/open-theme-toggle.tsx:56Platform facts for the generated element: shadow root with delegated focus, the authored component stylesheet, and the declared `theme` property.
{ root: "shadow"; delegatesFocus: true; styles: string[]; properties: { theme: { default: string; }; }; }packages/ui/src/open-theme-toggle.tsx:44↑ ↓ Select · Tab inspect · Esc return
The application options type, one row per member.
stringDocument title; defaults to the package.json `name`.
string`<meta name="description">` + `og:description`.
string`<html lang>`; defaults to `en`.
stringSite-root-relative favicon path, emitted as `<link rel="icon">`.
string`og:image` URL. Absolute (crawlable) or site-root-relative.
string[]External stylesheets linked into `<head>`.
OpenElementHeadScript[]External scripts emitted into `<head>`; inline code is not accepted here.
"fail" | "warn"Policy for dynamic-route render failures during SSG. See {@link SsgRenderOptions.dynamicRouteFailure}.
"native"Page renderer selection. The compiled native renderer is the only one supported; omit this key. A retired `'lit'` value is rejected with an explicit migration error at the config boundary (ADR-0152, 2026-11-08).
stringDirectory the route scanner walks, relative to the Vite root. Defaults to `app/routes`.
stringDirectory island modules are discovered in. Defaults to `app/islands`.
string[] | "auto" | "manual"How the build admits component packages whose modules the application imports. - omitted or `'auto'` (the default): the scan derives the admitted set at scan time — every package-owned element module the app's routes, pages, layouts, islands and components really reach (bundler-resolved) is attributed to its owner package (nearest `package.json`), and a package with a valid openElement manifest i…
LayoutConfigLayout declaration; `false` disables the layout, `'default'` uses the built-in one.
LayoutsConfigNamed layout declarations keyed by layout name.
string@dangerous injected as-is, only use with controlled content
(string | { href: string; integrity?: string; crossorigin?: "anonymous" | "use-credentials"; attrs?: Record<string, string | number | boolean>; })[]Stylesheets linked into the document head; each entry is an href or a link record with integrity/crossorigin/attrs.
(string | { src: string; type?: string; async?: boolean; defer?: boolean; integrity?: string; crossorigin?: "anonymous" | "use-credentials"; attrs?: Record<str…Scripts emitted into the document; each entry is a src or a script record with type/async/defer/integrity/crossorigin/attrs.
string[]@dangerous fragments injected as-is. Trust boundary (same level as `trustedHtml`): never concatenate user-controlled content into these fragments; sanitize untrusted data at your own system boundary first. The framework only enforces no-`<script>` and no-executable-`<style>`.
(string | RegExp)[]"load" | "idle" | "visible" | "only" | "none"stringOutput directory for the build artifacts. Defaults to `dist`.
{ islandKB?: number; totalJsKB?: number; pageKB?: number; }Advisory only: exceeded budgets print build-manifest warnings and never fail the build; enforce them in your own build-output test.
booleanEnable the View Transitions API for client navigations. Defaults to true.
boolean | { prerender?: string[]; prefetch?: string[]; exclude?: string[]; eagerness?: "immediate" | "moderate" | "conservative"; }Speculation Rules emission: `true` uses framework defaults, or pass prerender/prefetch URL lists, exclusions and an eagerness.
booleanBuilt-in CORS middleware. Default-ON; pass `false` to disable.
string | string[]Static CORS allowlist data, serialized into the generated entry as JSON. Mutually exclusive with {@link FrameworkOptions.middleware.corsOriginModule }.
stringPath to a module that default-exports `(origin: string) => string | undefined`. The generated entry imports the module — the callback is never serialized — so it may close over module scope and import dependencies. Resolved with the same idiom as `layout.import` (e.g. './app/cors-origin.ts'). Mutually exclusive with `corsOrigin`.
booleanEmit and honor a per-request id header. Default-ON; pass `false` to disable.
booleanLog each request through the built-in logger. Default-ON; pass `false` to disable.
booleanAttach the built-in security response headers. Default-ON; pass `false` to disable.
{ policy?: string; nonce?: boolean; reportOnly?: boolean; }Content-Security-Policy emission: the policy string, nonce generation, and report-only mode.
string[]Fetch middleware chain (#858), composed around the framework handler in onion order (`use[0]` outermost), outside all built-in middleware above. Each entry is a MODULE PATH (same resolution idiom as `layout.import`, e.g. './app/middleware/auth.ts') whose default export is a {@link Middleware}; the generated entry emits `import * as __mw_N from '<path>'` and composes `__mw_N.default` in configured…
CriticalFontAsset[](string | CriticalStyleAsset)[](string | CriticalStyleAsset)[]Alias for styles accepted by config producers.
(string | CriticalInlineScriptAsset)[]booleanAllow intentional external render-blocking styles/scripts.
booleanAlias retained only within this build-side config shape.
booleanMinify inline CSS. Defaults to true.
stringOrigin used to distinguish same-origin and cross-origin absolute URLs.
CriticalAssetsOptionsOpenElementI18nOptionsboolean | TailwindOptionsOpt-in Tailwind entry (alpha9 C2, #1505; externalized alpha15 S lane). `true` or an options object declares the style sources that compile through the official `@tailwindcss/vite` pipeline into the linked document stylesheet; absent keeps the build byte-identical to a Tailwind-less pipeline.
boolean | UnocssOptionsOpt-in UnoCSS entry (alpha15 stage 2B): the sibling of `tailwind`, same shape and same meaning. Declaring it selects UnoCSS as this application's style engine; declaring both keys is a conflict and fails closed — see `UnocssOptions` (`@openelement/router/vite`).
Custom elements from the compiler manifest.
Button or link control with variant/size surfaces and form participation.
@openelement/ui/open-buttonCode block with a copy button.
@openelement/ui/open-code-blockDialog component using native <dialog> element + popover API.
@openelement/ui/open-dialogPopover-API dropdown with CSS Anchor Positioning placement.
@openelement/ui/open-dropdownForm-associated text input with a label, an error slot and native validity.
@openelement/ui/open-inputTheme toggle button for dark/light mode: reads and flips the document's `data-theme` (with an initialization priority chain) and persists the choice; icon visibility follows the current theme attribute.
@openelement/ui/open-theme-toggle