@openelement/protocol 0.41.0-beta.3 → 1.0.0-alpha.12
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/LICENSE +21 -0
- package/README.md +42 -0
- package/package.json +90 -51
- package/src/app-model.d.ts +19 -0
- package/src/app-model.js +1 -0
- package/src/client-assets.d.ts +44 -0
- package/src/client-assets.js +24 -0
- package/src/data.d.ts +81 -11
- package/src/data.js +11 -7
- package/src/errors.d.ts +253 -14
- package/src/errors.js +275 -15
- package/src/forbidden-sinks.d.ts +60 -0
- package/src/forbidden-sinks.js +81 -0
- package/src/framework.d.ts +183 -99
- package/src/framework.js +13 -5
- package/src/index.d.ts +21 -19
- package/src/index.js +21 -20
- package/src/island-admission.d.ts +5 -0
- package/src/island-admission.js +9 -0
- package/src/island.d.ts +32 -19
- package/src/island.js +1 -4
- package/src/manifest.d.ts +15 -27
- package/src/manifest.js +1 -4
- package/src/module-descriptors.d.ts +40 -0
- package/src/module-descriptors.js +1 -0
- package/src/module-vocabulary.d.ts +5 -0
- package/src/module-vocabulary.js +21 -0
- package/src/part-program.d.ts +407 -0
- package/src/part-program.js +758 -0
- package/src/policy.d.ts +64 -0
- package/src/policy.js +65 -0
- package/src/registry-markers.d.ts +39 -0
- package/src/registry-markers.js +40 -0
- package/src/render.d.ts +29 -123
- package/src/render.js +1 -7
- package/src/runtime.d.ts +13 -4
- package/src/runtime.js +1 -8
- package/src/signal.d.ts +31 -7
- package/src/signal.js +5 -6
- package/src/ssg.d.ts +317 -151
- package/src/ssg.js +1 -7
- package/src/stream-frame-policy.d.ts +49 -0
- package/src/stream-frame-policy.js +108 -0
- package/src/style-sheet.d.ts +5 -1
- package/src/style-sheet.js +1 -8
- package/src/void-tags.d.ts +18 -0
- package/src/void-tags.js +34 -0
- package/src/context.d.ts +0 -25
- package/src/context.js +0 -7
- package/src/hydration-markers.d.ts +0 -25
- package/src/hydration-markers.js +0 -26
- package/src/isr.d.ts +0 -30
- package/src/isr.js +0 -4
- package/src/prop.d.ts +0 -46
- package/src/prop.js +0 -6
- package/src/vnode.d.ts +0 -19
- package/src/vnode.js +0 -9
package/src/policy.d.ts
ADDED
|
@@ -0,0 +1,64 @@
|
|
|
1
|
+
//#region src/policy.d.ts
|
|
2
|
+
/**
|
|
3
|
+
* Cross-package build/runtime policy constants — the numeric admission budgets
|
|
4
|
+
* a streamed route, a server render, and the generated entries all enforce.
|
|
5
|
+
*
|
|
6
|
+
* This module is import-free and host-free by design (same base-of-graph
|
|
7
|
+
* contract as stream-frame-policy.ts). Each value below names one policy
|
|
8
|
+
* boundary that more than one executor checks: the router's build manifest
|
|
9
|
+
* scan, the generated server entry, the generated browser bootstrap, and the
|
|
10
|
+
* element-side deferred/SSR paths must reject the same inputs with the same
|
|
11
|
+
* numbers, so the constants are declared once here and carried to every
|
|
12
|
+
* consumer through the public export. A copy of one of these numbers inside a
|
|
13
|
+
* generated string is a drift hazard, not a second source.
|
|
14
|
+
*
|
|
15
|
+
* The values are contracts, not tuning knobs: a released browser bootstrap
|
|
16
|
+
* already enforces them against the server payload, so raising one is a
|
|
17
|
+
* coordinated wire-format change, not a local edit.
|
|
18
|
+
*/
|
|
19
|
+
/**
|
|
20
|
+
* Deferred fields (declared streamed properties) one stream route's manifest
|
|
21
|
+
* may carry. The build scan, the server executor, and the browser seed
|
|
22
|
+
* contract enforce the same bound.
|
|
23
|
+
*/
|
|
24
|
+
export declare const STREAM_MAX_FIELDS = 32;
|
|
25
|
+
/**
|
|
26
|
+
* Part/Region owners one stream route's manifest may address in total across
|
|
27
|
+
* all deferred fields.
|
|
28
|
+
*/
|
|
29
|
+
export declare const STREAM_MAX_OWNERS = 64;
|
|
30
|
+
/**
|
|
31
|
+
* Typed properties one streamed seed may carry: the browser seed contract
|
|
32
|
+
* rejects the WHOLE seed above this count, so an oversized component would
|
|
33
|
+
* silently fail to hydrate instead of failing loud at the server.
|
|
34
|
+
*/
|
|
35
|
+
export declare const STREAM_MAX_SEED_PROPERTIES = 64;
|
|
36
|
+
/**
|
|
37
|
+
* Serialized stream payload bound, as a string length in UTF-16 code units:
|
|
38
|
+
* one seed attribute or one deferred frame's markup may not exceed it. The
|
|
39
|
+
* server checks the JSON text and the rendered range before emitting; the
|
|
40
|
+
* browser checks the attribute before parsing.
|
|
41
|
+
*/
|
|
42
|
+
export declare const STREAM_MAX_PAYLOAD_LENGTH: number;
|
|
43
|
+
/**
|
|
44
|
+
* Nested element expansion depth bound for `renderDsd`: cyclic component
|
|
45
|
+
* composition fails closed instead of recursing without end.
|
|
46
|
+
*/
|
|
47
|
+
export declare const MAX_COMPOSITION_DEPTH = 8;
|
|
48
|
+
/**
|
|
49
|
+
* Request-body bound (bytes) the generated entry applies to action POST
|
|
50
|
+
* routes; larger uploads belong on API routes with explicit limits.
|
|
51
|
+
*/
|
|
52
|
+
export declare const MAX_ACTION_BODY_BYTES: number;
|
|
53
|
+
/**
|
|
54
|
+
* Deferred-field resolution budget (milliseconds) for one streamed response:
|
|
55
|
+
* fields still pending when it expires are failed in place and the stream
|
|
56
|
+
* ends with the shell and whatever resolved.
|
|
57
|
+
*/
|
|
58
|
+
export declare const STREAM_TIMEOUT_MS = 30000;
|
|
59
|
+
/**
|
|
60
|
+
* Idle-hydration scheduling fallback (milliseconds) when neither
|
|
61
|
+
* `requestIdleCallback` nor `requestAnimationFrame` is available.
|
|
62
|
+
*/
|
|
63
|
+
export declare const IDLE_FALLBACK_TIMEOUT_MS = 50;
|
|
64
|
+
//#endregion
|
package/src/policy.js
ADDED
|
@@ -0,0 +1,65 @@
|
|
|
1
|
+
//#region src/policy.ts
|
|
2
|
+
/**
|
|
3
|
+
* Cross-package build/runtime policy constants — the numeric admission budgets
|
|
4
|
+
* a streamed route, a server render, and the generated entries all enforce.
|
|
5
|
+
*
|
|
6
|
+
* This module is import-free and host-free by design (same base-of-graph
|
|
7
|
+
* contract as stream-frame-policy.ts). Each value below names one policy
|
|
8
|
+
* boundary that more than one executor checks: the router's build manifest
|
|
9
|
+
* scan, the generated server entry, the generated browser bootstrap, and the
|
|
10
|
+
* element-side deferred/SSR paths must reject the same inputs with the same
|
|
11
|
+
* numbers, so the constants are declared once here and carried to every
|
|
12
|
+
* consumer through the public export. A copy of one of these numbers inside a
|
|
13
|
+
* generated string is a drift hazard, not a second source.
|
|
14
|
+
*
|
|
15
|
+
* The values are contracts, not tuning knobs: a released browser bootstrap
|
|
16
|
+
* already enforces them against the server payload, so raising one is a
|
|
17
|
+
* coordinated wire-format change, not a local edit.
|
|
18
|
+
*/
|
|
19
|
+
/**
|
|
20
|
+
* Deferred fields (declared streamed properties) one stream route's manifest
|
|
21
|
+
* may carry. The build scan, the server executor, and the browser seed
|
|
22
|
+
* contract enforce the same bound.
|
|
23
|
+
*/
|
|
24
|
+
const STREAM_MAX_FIELDS = 32;
|
|
25
|
+
/**
|
|
26
|
+
* Part/Region owners one stream route's manifest may address in total across
|
|
27
|
+
* all deferred fields.
|
|
28
|
+
*/
|
|
29
|
+
const STREAM_MAX_OWNERS = 64;
|
|
30
|
+
/**
|
|
31
|
+
* Typed properties one streamed seed may carry: the browser seed contract
|
|
32
|
+
* rejects the WHOLE seed above this count, so an oversized component would
|
|
33
|
+
* silently fail to hydrate instead of failing loud at the server.
|
|
34
|
+
*/
|
|
35
|
+
const STREAM_MAX_SEED_PROPERTIES = 64;
|
|
36
|
+
/**
|
|
37
|
+
* Serialized stream payload bound, as a string length in UTF-16 code units:
|
|
38
|
+
* one seed attribute or one deferred frame's markup may not exceed it. The
|
|
39
|
+
* server checks the JSON text and the rendered range before emitting; the
|
|
40
|
+
* browser checks the attribute before parsing.
|
|
41
|
+
*/
|
|
42
|
+
const STREAM_MAX_PAYLOAD_LENGTH = 262144;
|
|
43
|
+
/**
|
|
44
|
+
* Nested element expansion depth bound for `renderDsd`: cyclic component
|
|
45
|
+
* composition fails closed instead of recursing without end.
|
|
46
|
+
*/
|
|
47
|
+
const MAX_COMPOSITION_DEPTH = 8;
|
|
48
|
+
/**
|
|
49
|
+
* Request-body bound (bytes) the generated entry applies to action POST
|
|
50
|
+
* routes; larger uploads belong on API routes with explicit limits.
|
|
51
|
+
*/
|
|
52
|
+
const MAX_ACTION_BODY_BYTES = 10485760;
|
|
53
|
+
/**
|
|
54
|
+
* Deferred-field resolution budget (milliseconds) for one streamed response:
|
|
55
|
+
* fields still pending when it expires are failed in place and the stream
|
|
56
|
+
* ends with the shell and whatever resolved.
|
|
57
|
+
*/
|
|
58
|
+
const STREAM_TIMEOUT_MS = 3e4;
|
|
59
|
+
/**
|
|
60
|
+
* Idle-hydration scheduling fallback (milliseconds) when neither
|
|
61
|
+
* `requestIdleCallback` nor `requestAnimationFrame` is available.
|
|
62
|
+
*/
|
|
63
|
+
const IDLE_FALLBACK_TIMEOUT_MS = 50;
|
|
64
|
+
//#endregion
|
|
65
|
+
export { IDLE_FALLBACK_TIMEOUT_MS, MAX_ACTION_BODY_BYTES, MAX_COMPOSITION_DEPTH, STREAM_MAX_FIELDS, STREAM_MAX_OWNERS, STREAM_MAX_PAYLOAD_LENGTH, STREAM_MAX_SEED_PROPERTIES, STREAM_TIMEOUT_MS };
|
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
//#region src/registry-markers.d.ts
|
|
2
|
+
/**
|
|
3
|
+
* registry-markers.ts — SSR customElements registry marker contract (#965).
|
|
4
|
+
*
|
|
5
|
+
* The Router SSR/dev toolchain replaces `globalThis.customElements` with a
|
|
6
|
+
* stub registry (ssg/ssr-polyfills.ts). That stub lives across vite
|
|
7
|
+
* module-runner re-evaluations, so generated entry code must be allowed to
|
|
8
|
+
* re-define (overwrite the stale class) — otherwise route edits never reach
|
|
9
|
+
* SSR output (#952). These property names are the wire contract between the
|
|
10
|
+
* hand-written writers and the generated entry code.
|
|
11
|
+
*
|
|
12
|
+
* Ordinary TypeScript writers import the constants. Generated entry code is
|
|
13
|
+
* emitted as strings; its generator (ssg/entry-orchestrator.ts) imports this
|
|
14
|
+
* module and injects the values, so no second literal can drift. The values
|
|
15
|
+
* themselves are pinned by registry-marker-drift.test.ts because they cross
|
|
16
|
+
* process/module-evaluation boundaries that cannot share an import edge.
|
|
17
|
+
*/
|
|
18
|
+
/**
|
|
19
|
+
* Marker property set to `true` on the SSR customElements stub. Readers must
|
|
20
|
+
* treat the marked registry as re-definable.
|
|
21
|
+
*/
|
|
22
|
+
export declare const SSR_REGISTRY_STUB_MARKER = "__openElementSsrStub";
|
|
23
|
+
/**
|
|
24
|
+
* Property on the stub holding the generated entry's registration-ownership
|
|
25
|
+
* map (tag -> class it registered): a route module that self-registers its
|
|
26
|
+
* tag wins over the entry's registration, and on dev re-evaluation a fresh
|
|
27
|
+
* self-registered class must still win (#952).
|
|
28
|
+
*/
|
|
29
|
+
export declare const ENTRY_REGISTRATION_OWNERS = "__openEntryDefined";
|
|
30
|
+
/**
|
|
31
|
+
* Property on the SSR registry holding the TRUE original `define` method,
|
|
32
|
+
* captured before the generated entry installs its idempotent wrapper. The
|
|
33
|
+
* registry outlives vite dev SSR module re-evaluations, so without this the
|
|
34
|
+
* second evaluation would capture the already-wrapped `define` as its
|
|
35
|
+
* "original" and every forced re-registration would silently early-return
|
|
36
|
+
* through the previous wrapper (#1339 lit dev feedback).
|
|
37
|
+
*/
|
|
38
|
+
export declare const SSR_REGISTRY_ORIGINAL_DEFINE = "__openElementOrigDefine";
|
|
39
|
+
//#endregion
|
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
//#region src/registry-markers.ts
|
|
2
|
+
/**
|
|
3
|
+
* registry-markers.ts — SSR customElements registry marker contract (#965).
|
|
4
|
+
*
|
|
5
|
+
* The Router SSR/dev toolchain replaces `globalThis.customElements` with a
|
|
6
|
+
* stub registry (ssg/ssr-polyfills.ts). That stub lives across vite
|
|
7
|
+
* module-runner re-evaluations, so generated entry code must be allowed to
|
|
8
|
+
* re-define (overwrite the stale class) — otherwise route edits never reach
|
|
9
|
+
* SSR output (#952). These property names are the wire contract between the
|
|
10
|
+
* hand-written writers and the generated entry code.
|
|
11
|
+
*
|
|
12
|
+
* Ordinary TypeScript writers import the constants. Generated entry code is
|
|
13
|
+
* emitted as strings; its generator (ssg/entry-orchestrator.ts) imports this
|
|
14
|
+
* module and injects the values, so no second literal can drift. The values
|
|
15
|
+
* themselves are pinned by registry-marker-drift.test.ts because they cross
|
|
16
|
+
* process/module-evaluation boundaries that cannot share an import edge.
|
|
17
|
+
*/
|
|
18
|
+
/**
|
|
19
|
+
* Marker property set to `true` on the SSR customElements stub. Readers must
|
|
20
|
+
* treat the marked registry as re-definable.
|
|
21
|
+
*/
|
|
22
|
+
const SSR_REGISTRY_STUB_MARKER = "__openElementSsrStub";
|
|
23
|
+
/**
|
|
24
|
+
* Property on the stub holding the generated entry's registration-ownership
|
|
25
|
+
* map (tag -> class it registered): a route module that self-registers its
|
|
26
|
+
* tag wins over the entry's registration, and on dev re-evaluation a fresh
|
|
27
|
+
* self-registered class must still win (#952).
|
|
28
|
+
*/
|
|
29
|
+
const ENTRY_REGISTRATION_OWNERS = "__openEntryDefined";
|
|
30
|
+
/**
|
|
31
|
+
* Property on the SSR registry holding the TRUE original `define` method,
|
|
32
|
+
* captured before the generated entry installs its idempotent wrapper. The
|
|
33
|
+
* registry outlives vite dev SSR module re-evaluations, so without this the
|
|
34
|
+
* second evaluation would capture the already-wrapped `define` as its
|
|
35
|
+
* "original" and every forced re-registration would silently early-return
|
|
36
|
+
* through the previous wrapper (#1339 lit dev feedback).
|
|
37
|
+
*/
|
|
38
|
+
const SSR_REGISTRY_ORIGINAL_DEFINE = "__openElementOrigDefine";
|
|
39
|
+
//#endregion
|
|
40
|
+
export { ENTRY_REGISTRATION_OWNERS, SSR_REGISTRY_ORIGINAL_DEFINE, SSR_REGISTRY_STUB_MARKER };
|
package/src/render.d.ts
CHANGED
|
@@ -1,52 +1,33 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
* Types for the DSD rendering pipeline: component models, render inputs/outputs,
|
|
5
|
-
* metrics, diagnostics, build reports, ISR records, and DOM simulation.
|
|
6
|
-
*/ import type { VNode } from "./vnode.js";
|
|
7
|
-
import type { ComponentLayer, HydrationStrategy, StrategySource } from "./framework.js";
|
|
8
|
-
import type { CemCompatibilityReport } from "./manifest.js";
|
|
9
|
-
export type RenderPhase = 'instantiate' | 'render' | 'nested' | 'style' | 'serialize';
|
|
10
|
-
export type RenderErrorSeverity = 'error' | 'warning';
|
|
1
|
+
import { ComponentLayer, HydrationStrategy } from "./framework.js";
|
|
2
|
+
//#region src/render.d.ts
|
|
3
|
+
/** One render failure record the SSR pipeline reports. */
|
|
11
4
|
export interface RenderError {
|
|
12
5
|
code: string;
|
|
13
|
-
severity:
|
|
6
|
+
severity: 'error' | 'warning';
|
|
14
7
|
phase: string;
|
|
15
8
|
tagName: string;
|
|
16
9
|
message: string;
|
|
17
10
|
recoverable: boolean;
|
|
18
11
|
}
|
|
19
|
-
|
|
20
|
-
tagName: string;
|
|
21
|
-
componentClass: CustomElementConstructor;
|
|
22
|
-
props: Record<string, unknown>;
|
|
23
|
-
dsdOptions?: DsdOptions;
|
|
24
|
-
nestingDepth: number;
|
|
25
|
-
}
|
|
12
|
+
/** The hydration delivery hint a component or route carries. */
|
|
26
13
|
export interface HydrationHint {
|
|
27
14
|
tagName: string;
|
|
28
15
|
layer: ComponentLayer;
|
|
29
|
-
|
|
16
|
+
hydrate?: HydrationStrategy;
|
|
30
17
|
}
|
|
18
|
+
/**
|
|
19
|
+
* The public result of one `renderDsd()` call: the serialized DSD `html`, the
|
|
20
|
+
* render errors collected while composing it (empty on success), the render
|
|
21
|
+
* metrics for the root component, and the hydration hints the client
|
|
22
|
+
* scheduler reads to upgrade islands.
|
|
23
|
+
*/
|
|
31
24
|
export interface RenderOutput {
|
|
32
25
|
html: string;
|
|
33
26
|
errors: RenderError[];
|
|
34
27
|
metrics: DsdRenderMetrics;
|
|
35
28
|
hydrationHints: HydrationHint[];
|
|
36
29
|
}
|
|
37
|
-
|
|
38
|
-
beforeRender?: (input: RenderInput) => void;
|
|
39
|
-
afterRender?: (output: RenderOutput) => void;
|
|
40
|
-
onError?: (error: RenderError) => void;
|
|
41
|
-
}
|
|
42
|
-
export interface DsdOptions {
|
|
43
|
-
delegatesFocus?: boolean;
|
|
44
|
-
clonable?: boolean;
|
|
45
|
-
serializable?: boolean;
|
|
46
|
-
slotAssignment?: 'named' | 'manual';
|
|
47
|
-
customElementRegistry?: boolean;
|
|
48
|
-
layer?: ComponentLayer;
|
|
49
|
-
}
|
|
30
|
+
/** Per-render declarative-shadow-dom metrics the server records. */
|
|
50
31
|
export interface DsdRenderMetrics {
|
|
51
32
|
tagName: string;
|
|
52
33
|
renderTimeMs: number;
|
|
@@ -55,100 +36,25 @@ export interface DsdRenderMetrics {
|
|
|
55
36
|
hasError: boolean;
|
|
56
37
|
nestingDepth: number;
|
|
57
38
|
}
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
renderMode?: 'shadow' | 'light';
|
|
64
|
-
observedAttributes?: string[];
|
|
65
|
-
}
|
|
66
|
-
export interface DsdComponent {
|
|
67
|
-
render(): VNode | null;
|
|
68
|
-
connectedCallback?(): void;
|
|
69
|
-
layer?: ComponentLayer;
|
|
70
|
-
[key: string]: unknown;
|
|
71
|
-
}
|
|
72
|
-
export interface DsdPageDiagnostics {
|
|
73
|
-
path: string;
|
|
74
|
-
errors: RenderError[];
|
|
75
|
-
hydrationHints: HydrationHint[];
|
|
76
|
-
componentCount: number;
|
|
77
|
-
renderTimeMs: number;
|
|
78
|
-
}
|
|
79
|
-
export interface DsdMetricsSummary {
|
|
80
|
-
totalComponents: number;
|
|
81
|
-
totalRenderTimeMs: number;
|
|
82
|
-
avgRenderTimeMs: number;
|
|
83
|
-
totalTemplateSize: number;
|
|
84
|
-
maxNestingDepth: number;
|
|
85
|
-
errorComponentCount: number;
|
|
86
|
-
}
|
|
87
|
-
export interface DsdHydrationHintSummary {
|
|
88
|
-
totalHints: number;
|
|
89
|
-
interactiveCount: number;
|
|
90
|
-
pureIslandCount: number;
|
|
91
|
-
}
|
|
92
|
-
export interface DsdHydrationStrategySummary {
|
|
93
|
-
load: number;
|
|
94
|
-
idle: number;
|
|
95
|
-
visible: number;
|
|
96
|
-
only: number;
|
|
97
|
-
clientOnlyExcluded: number;
|
|
98
|
-
}
|
|
99
|
-
export interface ManifestDecision {
|
|
100
|
-
tagName: string;
|
|
101
|
-
packageName: string;
|
|
102
|
-
ssr: boolean;
|
|
103
|
-
dsd: boolean;
|
|
104
|
-
hydrate?: string;
|
|
105
|
-
strategySource?: StrategySource;
|
|
106
|
-
renderPath: 'ssr+client' | 'client-only';
|
|
107
|
-
reason?: string;
|
|
108
|
-
source?: 'local' | 'package' | 'nested';
|
|
109
|
-
}
|
|
39
|
+
/**
|
|
40
|
+
* The build's admission verdict for one discovered tag: where the declaration
|
|
41
|
+
* lives (`modulePath`), how it was discovered (`source`), which render path it
|
|
42
|
+
* is admitted to, and the reason recorded for the manifest.
|
|
43
|
+
*/
|
|
110
44
|
export interface SsrAdmissionDecision {
|
|
111
45
|
tagName: string;
|
|
46
|
+
/**
|
|
47
|
+
* Module path of the island declaration. Empty for 'foreign' decisions:
|
|
48
|
+
* a foreign tag is consumed in JSX but declares no module the build owns.
|
|
49
|
+
*/
|
|
112
50
|
modulePath: string;
|
|
113
|
-
|
|
51
|
+
/**
|
|
52
|
+
* 'foreign' (#979): a third-party WC tag discovered by the
|
|
53
|
+
* foreign-tag scanner in page/island JSX — recorded for visibility only;
|
|
54
|
+
* SSR still treats it as an opaque passthrough (renderPath 'client-only').
|
|
55
|
+
*/
|
|
56
|
+
source: 'local' | 'package' | 'nested' | 'foreign';
|
|
114
57
|
renderPath: 'ssr+client' | 'client-only' | 'rejected';
|
|
115
58
|
reason: string;
|
|
116
59
|
}
|
|
117
|
-
|
|
118
|
-
reportVersion: string;
|
|
119
|
-
timestamp: string;
|
|
120
|
-
totalPages: number;
|
|
121
|
-
totalErrors: number;
|
|
122
|
-
renderErrors: DsdPageDiagnostics[];
|
|
123
|
-
metricsSummary: DsdMetricsSummary;
|
|
124
|
-
hydrationHintSummary: DsdHydrationHintSummary;
|
|
125
|
-
hydrationStrategySummary?: DsdHydrationStrategySummary;
|
|
126
|
-
manifestDecisions?: ManifestDecision[];
|
|
127
|
-
admissionDecisions?: SsrAdmissionDecision[];
|
|
128
|
-
cemCompatibility?: CemCompatibilityReport;
|
|
129
|
-
domSimulation?: DomSimulationReport;
|
|
130
|
-
isrRoutes?: IsrRouteRecord[];
|
|
131
|
-
}
|
|
132
|
-
export interface IsrRouteRecord {
|
|
133
|
-
path: string;
|
|
134
|
-
revalidate: number;
|
|
135
|
-
cacheKey: string;
|
|
136
|
-
}
|
|
137
|
-
export interface DomSimulationReport {
|
|
138
|
-
enabled: boolean;
|
|
139
|
-
strategy: string;
|
|
140
|
-
attemptedCount: number;
|
|
141
|
-
succeededCount: number;
|
|
142
|
-
failedCount: number;
|
|
143
|
-
timeoutCount: number;
|
|
144
|
-
attempts: DomSimulationAttempt[];
|
|
145
|
-
}
|
|
146
|
-
export interface DomSimulationAttempt {
|
|
147
|
-
tagName: string;
|
|
148
|
-
success: boolean;
|
|
149
|
-
renderTimeMs: number;
|
|
150
|
-
byteSize?: number;
|
|
151
|
-
error?: string;
|
|
152
|
-
timedOut: boolean;
|
|
153
|
-
fallback: 'client-only' | 'none';
|
|
154
|
-
}
|
|
60
|
+
//#endregion
|
package/src/render.js
CHANGED
|
@@ -1,7 +1 @@
|
|
|
1
|
-
|
|
2
|
-
* @openelement/protocol — Render pipeline types.
|
|
3
|
-
*
|
|
4
|
-
* Types for the DSD rendering pipeline: component models, render inputs/outputs,
|
|
5
|
-
* metrics, diagnostics, build reports, ISR records, and DOM simulation.
|
|
6
|
-
*/
|
|
7
|
-
//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJzb3VyY2VzIjpbImZpbGU6Ly8vVXNlcnMvemhlbmd6aGkvRG9jdW1lbnRzL3Byb2plY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ydCBpbnRlcmZhY2UgRG9tU2ltdWxhdGlvblJlcG9ydCB7XG4gIGVuYWJsZWQ6IGJvb2xlYW47XG4gIHN0cmF0ZWd5OiBzdHJpbmc7XG4gIGF0dGVtcHRlZENvdW50OiBudW1iZXI7XG4gIHN1Y2NlZWRlZENvdW50OiBudW1iZXI7XG4gIGZhaWxlZENvdW50OiBudW1iZXI7XG4gIHRpbWVvdXRDb3VudDogbnVtYmVyO1xuICBhdHRlbXB0czogRG9tU2ltdWxhdGlvbkF0dGVtcHRbXTtcbn1cblxuZXhwb3J0IGludGVyZmFjZSBEb21TaW11bGF0aW9uQXR0ZW1wdCB7XG4gIHRhZ05hbWU6IHN0cmluZztcbiAgc3VjY2VzczogYm9vbGVhbjtcbiAgcmVuZGVyVGltZU1zOiBudW1iZXI7XG4gIGJ5dGVTaXplPzogbnVtYmVyO1xuICBlcnJvcj86IHN0cmluZztcbiAgdGltZWRPdXQ6IGJvb2xlYW47XG4gIGZhbGxiYWNrOiAnY2xpZW50LW9ubHknIHwgJ25vbmUnO1xufVxuIl0sIm5hbWVzIjpbXSwibWFwcGluZ3MiOiJBQUFBOzs7OztDQUtDLEdBRUQifQ==
|
|
1
|
+
export {};
|
package/src/runtime.d.ts
CHANGED
|
@@ -1,29 +1,38 @@
|
|
|
1
|
+
//#region src/runtime.d.ts
|
|
1
2
|
/**
|
|
2
|
-
*
|
|
3
|
+
* runtime.ts - Runtime adapter protocol.
|
|
3
4
|
*
|
|
4
5
|
* Replacement boundary for Nitro, Workers, Node, Deno, or future
|
|
5
6
|
* fetch-compatible runtimes. Preserves openElement semantics while leaving
|
|
6
7
|
* concrete server engines outside this package.
|
|
7
|
-
*/
|
|
8
|
+
*/
|
|
8
9
|
export interface RuntimeContext<Env extends Record<string, unknown> = Record<string, unknown>> {
|
|
9
10
|
env?: Env;
|
|
10
11
|
platform?: unknown;
|
|
11
|
-
|
|
12
|
+
params?: Record<string, string>;
|
|
12
13
|
}
|
|
13
|
-
|
|
14
|
+
interface RuntimePrerenderResult {
|
|
14
15
|
path: string;
|
|
15
16
|
html: string;
|
|
16
17
|
status?: number;
|
|
17
18
|
headers?: HeadersInit;
|
|
18
19
|
}
|
|
20
|
+
/**
|
|
21
|
+
* The host-neutral request handler every runtime adapter and generated server
|
|
22
|
+
* entry exposes: a WinterCG `(request, context?) => Response` with no server
|
|
23
|
+
* engine dialect baked in.
|
|
24
|
+
*/
|
|
19
25
|
export type OpenElementRequestHandler<Env extends Record<string, unknown> = Record<string, unknown>> = (request: Request, context?: RuntimeContext<Env>) => Response | Promise<Response>;
|
|
26
|
+
/** A host runtime adapter: exposes the fetch handler a server engine dispatches to. */
|
|
20
27
|
export interface RuntimeAdapter<Env extends Record<string, unknown> = Record<string, unknown>> {
|
|
21
28
|
name: string;
|
|
22
29
|
fetch: OpenElementRequestHandler<Env>;
|
|
23
30
|
prerender?(): AsyncIterable<RuntimePrerenderResult> | Iterable<RuntimePrerenderResult>;
|
|
24
31
|
}
|
|
32
|
+
/** Options one runtime adapter is constructed with. */
|
|
25
33
|
export interface RuntimeAdapterOptions<Env extends Record<string, unknown> = Record<string, unknown>> {
|
|
26
34
|
name: string;
|
|
27
35
|
fetch: OpenElementRequestHandler<Env>;
|
|
28
36
|
prerender?(): AsyncIterable<RuntimePrerenderResult> | Iterable<RuntimePrerenderResult>;
|
|
29
37
|
}
|
|
38
|
+
//#endregion
|
package/src/runtime.js
CHANGED
|
@@ -1,8 +1 @@
|
|
|
1
|
-
|
|
2
|
-
* @openelement/protocol - Runtime adapter protocol.
|
|
3
|
-
*
|
|
4
|
-
* Replacement boundary for Nitro, Workers, Node, Deno, or future
|
|
5
|
-
* fetch-compatible runtimes. Preserves openElement semantics while leaving
|
|
6
|
-
* concrete server engines outside this package.
|
|
7
|
-
*/
|
|
8
|
-
//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJzb3VyY2VzIjpbImZpbGU6Ly8vVXNlcnMvemhlbmd6aGkvRG9jdW1lbnRzL3By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iBSZXF1ZXN0LCBjb250ZXh0PzogUnVudGltZUNvbnRleHQ8RW52PikgPT4gUmVzcG9uc2UgfCBQcm9taXNlPFJlc3BvbnNlPjtcblxuZXhwb3J0IGludGVyZmFjZSBSdW50aW1lQWRhcHRlcjxFbnYgZXh0ZW5kcyBSZWNvcmQ8c3RyaW5nLCB1bmtub3duPiA9IFJlY29yZDxzdHJpbmcsIHVua25vd24+PiB7XG4gIG5hbWU6IHN0cmluZztcbiAgZmV0Y2g6IE9wZW5FbGVtZW50UmVxdWVzdEhhbmRsZXI8RW52PjtcbiAgcHJlcmVuZGVyPygpOiBBc3luY0l0ZXJhYmxlPFJ1bnRpbWVQcmVyZW5kZXJSZXN1bHQ+IHwgSXRlcmFibGU8UnVudGltZVByZXJlbmRlclJlc3VsdD47XG59XG5cbmV4cG9ydCBpbnRlcmZhY2UgUnVudGltZUFkYXB0ZXJPcHRpb25zPFxuICBFbnYgZXh0ZW5kcyBSZWNvcmQ8c3RyaW5nLCB1bmtub3duPiA9IFJlY29yZDxzdHJpbmcsIHVua25vd24+LFxuPiB7XG4gIG5hbWU6IHN0cmluZztcbiAgZmV0Y2g6IE9wZW5FbGVtZW50UmVxdWVzdEhhbmRsZXI8RW52PjtcbiAgcHJlcmVuZGVyPygpOiBBc3luY0l0ZXJhYmxlPFJ1bnRpbWVQcmVyZW5kZXJSZXN1bHQ+IHwgSXRlcmFibGU8UnVudGltZVByZXJlbmRlclJlc3VsdD47XG59XG4iXSwibmFtZXMiOltdLCJtYXBwaW5ncyI6IkFBQUE7Ozs7OztDQU1DLEdBRUQifQ==
|
|
1
|
+
export {};
|
package/src/signal.d.ts
CHANGED
|
@@ -1,21 +1,45 @@
|
|
|
1
|
+
//#region src/signal.d.ts
|
|
1
2
|
/**
|
|
2
|
-
*
|
|
3
|
+
* signal.ts - Signal contracts.
|
|
3
4
|
*
|
|
4
5
|
* Minimal signal protocol types shared across openElement packages.
|
|
5
|
-
*/
|
|
6
|
-
/**
|
|
6
|
+
*/
|
|
7
|
+
/** Unsubscribe function returned by subscriptions and effects. */
|
|
8
|
+
export type Unsubscribe = () => void;
|
|
9
|
+
/** Runtime/type brand for signals created by the configured reactive engine. */
|
|
10
|
+
export declare const SIGNAL_BRAND: unique symbol;
|
|
11
|
+
/** Minimal signal-like object accepted by renderers and bindings. */
|
|
12
|
+
export interface SignalLike<T = unknown> {
|
|
13
|
+
readonly [SIGNAL_BRAND]: true;
|
|
7
14
|
readonly value: T;
|
|
8
15
|
subscribe(fn: (value: T) => void): Unsubscribe;
|
|
9
16
|
}
|
|
10
|
-
/** Writable signal protocol used by openElement integrations. */
|
|
17
|
+
/** Writable signal protocol used by openElement integrations. */
|
|
18
|
+
export interface WritableSignal<T> extends SignalLike<T> {
|
|
11
19
|
value: T;
|
|
12
20
|
}
|
|
13
|
-
/** Read-only signal protocol used by computed values. */
|
|
21
|
+
/** Read-only signal protocol used by computed values. */
|
|
22
|
+
export interface ReadonlySignal<T> extends SignalLike<T> {
|
|
14
23
|
readonly value: T;
|
|
15
24
|
}
|
|
16
|
-
/** Alias for APIs that accept either writable or read-only signals. */
|
|
17
|
-
|
|
25
|
+
/** Alias for APIs that accept either writable or read-only signals. */
|
|
26
|
+
export type Signal<T> = WritableSignal<T> | ReadonlySignal<T>;
|
|
27
|
+
/**
|
|
28
|
+
* Signal engine protocol used by the framework's built-in adapter.
|
|
29
|
+
*
|
|
30
|
+
* This is a deliberate internal seam, not a public compatibility contract:
|
|
31
|
+
* the framework layer talks to signals only through this narrow interface so
|
|
32
|
+
* its call sites stay implementation-agnostic.
|
|
33
|
+
*
|
|
34
|
+
* The package ships and verifies exactly one engine implementation
|
|
35
|
+
* (`preact-engine`, backed by `@preact/signals-core`). Preact's own API is not
|
|
36
|
+
* Element public API, and arbitrary third-party engines are not promised;
|
|
37
|
+
* any future engine would be added behind this protocol rather than inline
|
|
38
|
+
* (charter decision — see #723).
|
|
39
|
+
*/
|
|
40
|
+
export interface SignalEngine {
|
|
18
41
|
signal<T>(initialValue: T): WritableSignal<T>;
|
|
19
42
|
computed<T>(fn: () => T): ReadonlySignal<T>;
|
|
20
43
|
effect(fn: () => void | Unsubscribe): Unsubscribe;
|
|
21
44
|
}
|
|
45
|
+
//#endregion
|
package/src/signal.js
CHANGED
|
@@ -1,6 +1,5 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJzb3VyY2VzIjpbImZpbGU6Ly8vVXNlcnMvemhlbmd6aGkvRG9jdW1lbnRzL3Byb2plY3RzL29wZW5lbGVtZW50L29wZW5lbGVtZW50L3BhY2thZ2VzL3Byb3RvY29sL3NyYy9zaWduYWwudHMiXSwic291cmNlc0NvbnRlbnQiOlsiLyoqXG4gKiBAb3BlbmVsZW1lbnQvcHJvdG9jb2wgLSBTaWduYWwgY29udHJhY3RzLlxuICpcbiAqIE1pbmltYWwgc2lnbmFsIHByb3RvY29sIHR5cGVzIHNoYXJlZCBhY3Jvc3Mgb3BlbkVsZW1lbnQgcGFja2FnZXMuXG4gKi9cblxuLyoqIFVuc3Vic2NyaWJlIGZ1bmN0aW9uIHJldHVybmVkIGJ5IHN1YnNjcmlwdGlvbnMgYW5kIGVmZmVjdHMuICovXG5leHBvcnQgdHlwZSBVbnN1YnNjcmliZSA9ICgpID0+IHZvaWQ7XG5cbi8qKiBNaW5pbWFsIHNpZ25hbC1saWtlIG9iamVjdCBhY2NlcHRlZCBieSByZW5kZXJlcnMgYW5kIGJpbmRpbmdzLiAqL1xuZXhwb3J0IGludGVyZmFjZSBTaWduYWxMaWtlPFQgPSB1bmtub3duPiB7XG4gIHJlYWRvbmx5IHZhbHVlOiBUO1xuICBzdWJzY3JpYmUoZm46ICh2YWx1ZTogVCkgPT4gdm9pZCk6IFVuc3Vic2NyaWJlO1xufVxuXG4vKiogV3JpdGFibGUgc2lnbmFsIHByb3RvY29sIHVzZWQgYnkgb3BlbkVsZW1lbnQgaW50ZWdyYXRpb25zLiAqL1xuZXhwb3J0IGludGVyZmFjZSBXcml0YWJsZVNpZ25hbDxUPiBleHRlbmRzIFNpZ25hbExpa2U8VD4ge1xuICB2YWx1ZTogVDtcbn1cblxuLyoqIFJlYWQtb25seSBzaWduYWwgcHJvdG9jb2wgdXNlZCBieSBjb21wdXRlZCB2YWx1ZXMuICovXG5leHBvcnQgaW50ZXJmYWNlIFJlYWRvbmx5U2lnbmFsPFQ+IGV4dGVuZHMgU2lnbmFsTGlrZTxUPiB7XG4gIHJlYWRvbmx5IHZhbHVlOiBUO1xufVxuXG4vKiogQWxpYXMgZm9yIEFQSXMgdGhhdCBhY2NlcHQgZWl0aGVyIHdyaXRhYmxlIG9yIHJlYWQtb25seSBzaWduYWxzLiAqL1xuZXhwb3J0IHR5cGUgU2lnbmFsPFQ+ID0gV3JpdGFibGVTaWduYWw8VD4gfCBSZWFkb25seVNpZ25hbDxUPjtcblxuLyoqIFNpZ25hbCBlbmdpbmUgcHJvdG9jb2wgdXNlZCBieSBmcmFtZXdvcmsgYW5kIGFkYXB0ZXIgaW50ZWdyYXRpb25zLiAqL1xuZXhwb3J0IGludGVyZmFjZSBTaWduYWxFbmdpbmUge1xuICBzaWduYWw8VD4oaW5pdGlhbFZhbHVlOiBUKTogV3JpdGFibGVTaWduYWw8VD47XG4gIGNvbXB1dGVkPFQ+KGZuOiAoKSA9PiBUKTogUmVhZG9ubHlTaWduYWw8VD47XG4gIGVmZmVjdChmbjogKCkgPT4gdm9pZCB8IFVuc3Vic2NyaWJlKTogVW5zdWJzY3JpYmU7XG59XG4iXSwibmFtZXMiOltdLCJtYXBwaW5ncyI6IkFBQUE7Ozs7Q0FJQyxHQUVELGdFQUFnRSxHQUNoRSJ9
|
|
1
|
+
//#region src/signal.ts
|
|
2
|
+
/** Runtime/type brand for signals created by the configured reactive engine. */
|
|
3
|
+
const SIGNAL_BRAND = Symbol("openElement.signal");
|
|
4
|
+
//#endregion
|
|
5
|
+
export { SIGNAL_BRAND };
|