@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.
Files changed (57) hide show
  1. package/LICENSE +21 -0
  2. package/README.md +42 -0
  3. package/package.json +90 -51
  4. package/src/app-model.d.ts +19 -0
  5. package/src/app-model.js +1 -0
  6. package/src/client-assets.d.ts +44 -0
  7. package/src/client-assets.js +24 -0
  8. package/src/data.d.ts +81 -11
  9. package/src/data.js +11 -7
  10. package/src/errors.d.ts +253 -14
  11. package/src/errors.js +275 -15
  12. package/src/forbidden-sinks.d.ts +60 -0
  13. package/src/forbidden-sinks.js +81 -0
  14. package/src/framework.d.ts +183 -99
  15. package/src/framework.js +13 -5
  16. package/src/index.d.ts +21 -19
  17. package/src/index.js +21 -20
  18. package/src/island-admission.d.ts +5 -0
  19. package/src/island-admission.js +9 -0
  20. package/src/island.d.ts +32 -19
  21. package/src/island.js +1 -4
  22. package/src/manifest.d.ts +15 -27
  23. package/src/manifest.js +1 -4
  24. package/src/module-descriptors.d.ts +40 -0
  25. package/src/module-descriptors.js +1 -0
  26. package/src/module-vocabulary.d.ts +5 -0
  27. package/src/module-vocabulary.js +21 -0
  28. package/src/part-program.d.ts +407 -0
  29. package/src/part-program.js +758 -0
  30. package/src/policy.d.ts +64 -0
  31. package/src/policy.js +65 -0
  32. package/src/registry-markers.d.ts +39 -0
  33. package/src/registry-markers.js +40 -0
  34. package/src/render.d.ts +29 -123
  35. package/src/render.js +1 -7
  36. package/src/runtime.d.ts +13 -4
  37. package/src/runtime.js +1 -8
  38. package/src/signal.d.ts +31 -7
  39. package/src/signal.js +5 -6
  40. package/src/ssg.d.ts +317 -151
  41. package/src/ssg.js +1 -7
  42. package/src/stream-frame-policy.d.ts +49 -0
  43. package/src/stream-frame-policy.js +108 -0
  44. package/src/style-sheet.d.ts +5 -1
  45. package/src/style-sheet.js +1 -8
  46. package/src/void-tags.d.ts +18 -0
  47. package/src/void-tags.js +34 -0
  48. package/src/context.d.ts +0 -25
  49. package/src/context.js +0 -7
  50. package/src/hydration-markers.d.ts +0 -25
  51. package/src/hydration-markers.js +0 -26
  52. package/src/isr.d.ts +0 -30
  53. package/src/isr.js +0 -4
  54. package/src/prop.d.ts +0 -46
  55. package/src/prop.js +0 -6
  56. package/src/vnode.d.ts +0 -19
  57. package/src/vnode.js +0 -9
package/src/island.d.ts CHANGED
@@ -1,38 +1,51 @@
1
- /**
2
- * @openelement/protocol - Island contracts.
3
- */ import type { HydrationStrategy } from "./framework.js";
4
- export interface IslandMeta {
5
- tagName: string;
6
- layer: string;
7
- isIsland: boolean;
8
- ssr?: boolean;
9
- dsd: boolean;
10
- }
1
+ import { HydrationStrategy } from "./framework.js";
2
+ //#region src/island.d.ts
3
+ /** Per-island delivery options (hydration strategy, SSR/DSD participation). */
11
4
  export interface IslandOptions {
12
5
  /** Hydration strategy:
13
6
  * - 'load': load immediately when module is imported
14
7
  * - 'idle': defer to requestIdleCallback (default)
15
8
  * - 'visible': use IntersectionObserver to defer until element is visible
16
9
  * - 'only': client-only render, no DSD/SSR output
17
- */ strategy?: HydrationStrategy;
18
- /** Optional tag name override. If provided, used instead of the first argument. */ tagName?: string;
10
+ *
11
+ * Named `hydrate` to match `defineIslandConfig()` in the Router package —
12
+ * one option name across both packages.
13
+ */
14
+ hydrate?: HydrationStrategy;
19
15
  /**
20
16
  * Whether to use DSD for SSR rendering of this island.
17
+ *
18
+ * Honored by the build-side island scan (via `defineIslandConfig`), not by
19
+ * `defineIsland()` itself: passing it in `IslandOptions` has no runtime
20
+ * effect.
21
21
  * @default true
22
- */ dsd?: boolean;
22
+ */
23
+ dsd?: boolean;
23
24
  /**
24
25
  * Whether this island may be admitted into server rendering.
25
- */ ssr?: boolean;
26
+ *
27
+ * Like `dsd`, decided by the build-side island scan; inert when passed to
28
+ * `defineIsland()`.
29
+ */
30
+ ssr?: boolean;
26
31
  }
32
+ /** Options for the build-time island source transform. */
27
33
  export interface IslandTransformOptions {
28
- /** Directory containing island files (e.g. "app/islands") */ islandsDir: string;
29
- /** Absolute or relative file path of the source being processed */ filePath: string;
34
+ /** Directory containing island files (e.g. "app/islands") */
35
+ islandsDir: string;
36
+ /** Absolute or relative file path of the source being processed */
37
+ filePath: string;
30
38
  }
39
+ /** The island transform output: rewritten source plus extracted facts. */
31
40
  export interface IslandTransformResult {
32
- /** Transformed source code with markers */ code: string;
33
- /** Detected island entries */ islands: Array<{
41
+ /** Transformed source code with markers */
42
+ code: string;
43
+ /** Detected island entries */
44
+ islands: Array<{
34
45
  tagName: string;
35
46
  filePath: string;
36
47
  }>;
37
- /** Optional source map */ map?: string;
48
+ /** Optional source map */
49
+ map?: string;
38
50
  }
51
+ //#endregion
package/src/island.js CHANGED
@@ -1,4 +1 @@
1
- /**
2
- * @openelement/protocol - Island contracts.
3
- */
4
- //# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJzb3VyY2VzIjpbImZpbGU6Ly8vVXNlcnMvemhlbmd6aGkvRG9jdW1lbnRzL3Byb2plY3RzL29wZW5lbGVtZW50L29wZW5lbGVtZW50L3BhY2thZ2VzL3Byb3RvY29sL3NyYy9pc2xhbmQudHMiXSwic291cmNlc0NvbnRlbnQiOlsiLyoqXG4gKiBAb3BlbmVsZW1lbnQvcHJvdG9jb2wgLSBJc2xhbmQgY29udHJhY3RzLlxuICovXG5cbmltcG9ydCB0eXBlIHsgSHlkcmF0aW9uU3RyYXRlZ3kgfSBmcm9tICcuL2ZyYW1ld29yay5qcyc7XG5cbmV4cG9ydCBpbnRlcmZhY2UgSXNsYW5kTWV0YSB7XG4gIHRhZ05hbWU6IHN0cmluZztcbiAgbGF5ZXI6IHN0cmluZztcbiAgaXNJc2xhbmQ6IGJvb2xlYW47XG4gIHNzcj86IGJvb2xlYW47XG4gIGRzZDogYm9vbGVhbjtcbn1cblxuZXhwb3J0IGludGVyZmFjZSBJc2xhbmRPcHRpb25zIHtcbiAgLyoqIEh5Z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2xhbmRzXCIpICovXG4gIGlzbGFuZHNEaXI6IHN0cmluZztcbiAgLyoqIEFic29sdXRlIG9yIHJlbGF0aXZlIGZpbGUgcGF0aCBvZiB0aGUgc291cmNlIGJlaW5nIHByb2Nlc3NlZCAqL1xuICBmaWxlUGF0aDogc3RyaW5nO1xufVxuXG5leHBvcnQgaW50ZXJmYWNlIElzbGFuZFRyYW5zZm9ybVJlc3VsdCB7XG4gIC8qKiBUcmFuc2Zvcm1lZCBzb3VyY2UgY29kZSB3aXRoIG1hcmtlcnMgKi9cbiAgY29kZTogc3RyaW5nO1xuICAvKiogRGV0ZWN0ZWQgaXNsYW5kIGVudHJpZXMgKi9cbiAgaXNsYW5kczogQXJyYXk8eyB0YWdOYW1lOiBzdHJpbmc7IGZpbGVQYXRoOiBzdHJpbmcgfT47XG4gIC8qKiBPcHRpb25hbCBzb3VyY2UgbWFwICovXG4gIG1hcD86IHN0cmluZztcbn1cbiJdLCJuYW1lcyI6W10sIm1hcHBpbmdzIjoiQUFBQTs7Q0FFQyxHQUVEIn0=
1
+ export {};
package/src/manifest.d.ts CHANGED
@@ -1,6 +1,6 @@
1
- /**
2
- * @openelement/protocol - CEM manifest and compatibility contract types.
3
- */ import type { ComponentLayer, HydrationStrategy } from "./framework.js";
1
+ import { CompatibilityClassification, CompatibilityTier, ComponentLayer, HydrationStrategy } from "./framework.js";
2
+ //#region src/manifest.d.ts
3
+ /** One documented attribute of a custom element declaration. */
4
4
  export interface OpenElementAttribute {
5
5
  name: string;
6
6
  type?: string;
@@ -9,41 +9,34 @@ export interface OpenElementAttribute {
9
9
  reflects?: boolean;
10
10
  fieldName?: string;
11
11
  }
12
+ /** One documented custom event of a custom element declaration. */
12
13
  export interface OpenElementEvent {
13
14
  name: string;
14
15
  type?: string;
15
16
  description?: string;
16
17
  }
18
+ /** One documented slot of a custom element declaration. */
17
19
  export interface OpenElementSlot {
18
20
  name: string;
19
21
  description?: string;
20
22
  }
23
+ /** One documented CSS part of a custom element declaration. */
21
24
  export interface OpenElementCssPart {
22
25
  name: string;
23
26
  description?: string;
24
27
  }
25
- export type WebComponentAuthoringKind = 'basic-element' | 'third-party-wc';
26
- export type WebComponentRenderCapability = 'ssr-dsd' | 'client-only' | 'unsupported';
27
- export interface WebComponentContract {
28
- /** Default OpenElement Basic Element path, or explicit third-party WC interop. */ authoring: WebComponentAuthoringKind;
29
- /** What the framework may do with this component during build/render. */ render: WebComponentRenderCapability;
30
- /** Whether metadata came from OpenElement source, package manifest, or CEM. */ metadataSource?: 'openElement' | 'manifest' | 'cem';
31
- /** Human-facing diagnostic for conservative or unsupported paths. */ reason?: string;
32
- }
28
+ /** The openElement-specific extension block of a package manifest declaration. */
33
29
  export interface OpenElementExtensions {
34
30
  ssr?: boolean;
35
31
  dsd?: boolean;
36
32
  layer?: ComponentLayer;
37
33
  hydrate?: HydrationStrategy;
34
+ /** Stability marker from the owning package's manifest policy. */
35
+ status?: 'stable' | 'experimental';
38
36
  module?: string;
39
37
  export?: string;
40
- contract?: WebComponentContract;
41
- }
42
- export interface OpenElementExport {
43
- name: string;
44
- path?: string;
45
- description?: string;
46
38
  }
39
+ /** One custom element declaration in a package manifest: tag, members and delivery metadata. */
47
40
  export interface OpenElementDeclaration {
48
41
  tagName: string;
49
42
  className?: string;
@@ -52,16 +45,11 @@ export interface OpenElementDeclaration {
52
45
  events?: OpenElementEvent[];
53
46
  slots?: OpenElementSlot[];
54
47
  cssParts?: OpenElementCssPart[];
55
- contract?: WebComponentContract;
56
48
  openElement?: OpenElementExtensions;
57
49
  description?: string;
58
50
  }
59
- export interface OpenElementModule {
60
- path: string;
61
- exports?: OpenElementExport[];
62
- declarations?: string[];
63
- }
64
- /** CEM-compatible package manifest */ export interface OpenElementPackageManifest {
51
+ /** Package manifest of component declarations (not a Custom Elements Manifest). */
52
+ export interface OpenElementPackageManifest {
65
53
  schemaVersion: string;
66
54
  packageName: string;
67
55
  version: string;
@@ -71,10 +59,8 @@ export interface OpenElementModule {
71
59
  homepage?: string;
72
60
  repository?: string;
73
61
  declarations: OpenElementDeclaration[];
74
- modules?: OpenElementModule[];
75
62
  }
76
- import type { CompatibilityClassification, CompatibilityTier } from "./framework.js";
77
- export type { CompatibilityClassification, CompatibilityTier };
63
+ /** The compatibility classification report for one custom element manifest. */
78
64
  export interface CemCompatibilityReport {
79
65
  totalClassified: number;
80
66
  ssrCapableCount: number;
@@ -84,3 +70,5 @@ export interface CemCompatibilityReport {
84
70
  classifications: CompatibilityClassification[];
85
71
  summary: string;
86
72
  }
73
+ //#endregion
74
+ export type { CompatibilityClassification, CompatibilityTier };
package/src/manifest.js CHANGED
@@ -1,4 +1 @@
1
- /**
2
- * @openelement/protocol - CEM manifest and compatibility contract types.
3
- */
4
- //# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJzb3VyY2VzIjpbImZpbGU6Ly8vVXNlcnMvemhlbmd6aGkvRG9jdW1lbnRzL3Byb2plY3RzL29wZW5lbGVtZW50L29wZW5lbGVtZW50L3BhY2thZ2VzL3Byb3RvY29sL3NyYy9tYW5pZmVzdC50cyJdLCJzb3VyY2VzQ29udGVudCI6WyIvKipcbiAqIEBvcGVuZWxlbWVudC9wcm90b2NvbCAtIENFTSBtYW5pZmVzdCBhbmQgY29tcGF0aWJpbGl0eSBjb250cmFjdCB0eXBlcy5cbiAqL1xuXG5pbXBvcnQgdHlwZSB7IENvbXBvbmVudExheWVyLCBIeWRyYXRpb25TdHJhdGVneSB9IGZyb20gJy4vZnJhbWV3b3JrLmpzJztcblxuLy8gLS0tIE1hbmlmZXN0IGRlc2NyaXB0b3JzIChDRU0tY29tcGF0aWJsZSkgLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tXG5cbmV4cG9ydCBpbnRlcmZhY2UgT3BlbkVsZW1lbnRBdHRyaWJ1dGUge1xuICBuYW1lOiBzdHJpbmc7XG4gIHR5cGU/OiBzdHJpbmc7XG4gIGRlZmF1bHQ/OiBzdHJpbmc7XG4gIGRlc2NyaXB0aW9u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bGl0eVJlcG9ydCB7XG4gIHRvdGFsQ2xhc3NpZmllZDogbnVtYmVyO1xuICBzc3JDYXBhYmxlQ291bnQ6IG51bWJlcjtcbiAgY2xpZW50T25seUNvdW50OiBudW1iZXI7XG4gIHJlamVjdGVkQ291bnQ6IG51bWJlcjtcbiAgZXhwZXJpbWVudGFsRG9tQ291bnQ6IG51bWJlcjtcbiAgY2xhc3NpZmljYXRpb25zOiBDb21wYXRpYmlsaXR5Q2xhc3NpZmljYXRpb25bXTtcbiAgc3VtbWFyeTogc3RyaW5nO1xufVxuIl0sIm5hbWVzIjpbXSwibWFwcGluZ3MiOiJBQUFBOztDQUVDLEdBRUQifQ==
1
+ export {};
@@ -0,0 +1,40 @@
1
+ //#region src/module-descriptors.d.ts
2
+ /**
3
+ * Protocol-owned module-descriptor contracts (#1557 package split): the
4
+ * binding-identity descriptors both the compiler's semantic core and the
5
+ * router build consume without depending on each other. Plain data — the
6
+ * scan consumes the descriptors without learning the caller's package
7
+ * vocabulary. The compiler facade re-exports these exact identities
8
+ * (`semantic-core/module-analysis.ts`); the router's admission constants
9
+ * (`ISLAND_ADMISSION`, `ROUTER_MODULE_VOCABULARY`) type against them.
10
+ */
11
+ /**
12
+ * One static-sidecar descriptor the host injects into the element
13
+ * compiler: the admission granted is a colocated static policy statement
14
+ * (#1473 item 3, the static-sidecar admission pattern).
15
+ */
16
+ export interface StaticSidecarDescriptor {
17
+ /** Canonical module specifier the sidecar export must be imported from. */
18
+ readonly moduleSpecifier: string;
19
+ /** Exported name of the sidecar factory binding. */
20
+ readonly exportName: string;
21
+ /** The admission granted: a colocated static policy statement. */
22
+ readonly kind: 'static-sidecar';
23
+ }
24
+ /**
25
+ * One module-scan vocabulary entry the host admits: a binding identity
26
+ * (module specifier + exported name, aliases followed) plus the fact a
27
+ * canonical call of that binding contributes. Plain data — the scan consumes
28
+ * the descriptors without learning the caller's package vocabulary, the
29
+ * same direction as the compiler's
30
+ * {@link StaticSidecarDescriptor} admission (#1473 item 3).
31
+ */
32
+ export interface ModuleVocabularyDescriptor {
33
+ /** Canonical module specifier the factory must be imported from. */
34
+ readonly moduleSpecifier: string;
35
+ /** Exported name of the factory binding. */
36
+ readonly exportName: string;
37
+ /** What a canonical call of the binding contributes to the scan. */
38
+ readonly kind: 'page-definition' | 'element-registration';
39
+ }
40
+ //#endregion
@@ -0,0 +1 @@
1
+ export {};
@@ -0,0 +1,5 @@
1
+ import { ModuleVocabularyDescriptor } from "./module-descriptors.js";
2
+ //#region src/module-vocabulary.d.ts
3
+ /** The module vocabulary router injects into `analyzeModuleSemantics`. */
4
+ export declare const ROUTER_MODULE_VOCABULARY: readonly ModuleVocabularyDescriptor[];
5
+ //#endregion
@@ -0,0 +1,21 @@
1
+ //#region src/module-vocabulary.ts
2
+ /** The module vocabulary router injects into `analyzeModuleSemantics`. */
3
+ const ROUTER_MODULE_VOCABULARY = [
4
+ {
5
+ moduleSpecifier: "@openelement/router",
6
+ exportName: "definePage",
7
+ kind: "page-definition"
8
+ },
9
+ {
10
+ moduleSpecifier: "@openelement/router/lit",
11
+ exportName: "defineLitPage",
12
+ kind: "page-definition"
13
+ },
14
+ {
15
+ moduleSpecifier: "@openelement/router",
16
+ exportName: "defineElement",
17
+ kind: "element-registration"
18
+ }
19
+ ];
20
+ //#endregion
21
+ export { ROUTER_MODULE_VOCABULARY };
@@ -0,0 +1,407 @@
1
+ import { VOID_TAGS } from "./void-tags.js";
2
+ //#region src/part-program.d.ts
3
+ /** The Part Program IR version this package defines (currently v1). */
4
+ export declare const PART_PROGRAM_VERSION: 1;
5
+ /**
6
+ * Version of the compiled-module ABI: the statics a generated module carries
7
+ * (`__partProgram`, `__compiledProperties`, `__elementMetadata`,
8
+ * `__observedAttributes`, `__computedFields`) and the runtime facade binds.
9
+ * Bump when the generated-module contract changes shape; generated artifacts
10
+ * stamp both this and PART_PROGRAM_VERSION so consumers can tell format drift
11
+ * from release drift.
12
+ */
13
+ export declare const COMPILED_MODULE_ABI_VERSION: 1;
14
+ /** How the compiled component attaches its root: light DOM or a shadow root. */
15
+ export type RootMode = 'light' | 'shadow-open' | 'shadow-closed';
16
+ /** The root of one program tree: element, part anchor, or text. */
17
+ export interface ProgramRoot {
18
+ id: 'root';
19
+ kind: RootMode;
20
+ nodes: string[];
21
+ }
22
+ /** The JSON-serializable value shape a compiled property default admits. */
23
+ export type SerializableValue = null | boolean | number | string | SerializableValue[] | {
24
+ [key: string]: SerializableValue;
25
+ };
26
+ /** Where a part sits relative to its anchor. */
27
+ export interface ProgramPosition {
28
+ offset: number;
29
+ line: number;
30
+ column: number;
31
+ }
32
+ /** A half-open [start, end) range into the authored source text. */
33
+ export interface ProgramSourceRange {
34
+ file: string;
35
+ start: ProgramPosition;
36
+ end: ProgramPosition;
37
+ }
38
+ /** The kind of source record a program source map entry carries. */
39
+ export type ProgramSourceKind = 'root' | 'element' | 'part' | 'region' | 'property' | 'handler';
40
+ /** One source-map record: the authored origin of one emitted node or part. */
41
+ export interface ProgramSourceRecord {
42
+ id: string;
43
+ kind: ProgramSourceKind;
44
+ source: ProgramSourceRange;
45
+ }
46
+ /** The program source map: authored spans projected onto emitted records. */
47
+ export interface ProgramSourceMap {
48
+ version: 1;
49
+ file: string;
50
+ records: ProgramSourceRecord[];
51
+ }
52
+ /** Exact compiler-owned location for one dynamic sink or range anchor. */
53
+ export interface ProgramLocation {
54
+ id: string;
55
+ kind: 'anchor' | 'sink';
56
+ path: number[];
57
+ node?: string;
58
+ }
59
+ /** A location record also makes the identity auditable without inspecting parts. */
60
+ export type ProgramLocationRecord = {
61
+ id: string;
62
+ kind: 'element';
63
+ tag: string;
64
+ path: number[];
65
+ } | {
66
+ id: string;
67
+ kind: 'anchor';
68
+ part: number;
69
+ path: number[];
70
+ } | {
71
+ id: string;
72
+ kind: 'sink';
73
+ part: number;
74
+ node: string;
75
+ path: number[];
76
+ };
77
+ /** A static element node of the program tree. */
78
+ export interface ProgramElementNode {
79
+ k: 'el';
80
+ id: string;
81
+ tag: string;
82
+ attrs: Array<[string, string]>;
83
+ /**
84
+ * Per-item attribute slots ([name, itemField]) — valid only inside an
85
+ * `each` item template. At mount/claim time the value resolves from the
86
+ * current item: `true` emits a bare attribute, `false`/`null`/`undefined`
87
+ * omit it, anything else serializes with String().
88
+ */
89
+ iattrs?: Array<[string, string]>;
90
+ children: ProgramTreeNode[];
91
+ }
92
+ /** A static text node of the program tree. */
93
+ export interface ProgramTextNode {
94
+ k: 'text';
95
+ value: string;
96
+ }
97
+ /** The anchor node marking where a part binds in the tree. */
98
+ export interface ProgramPartAnchorNode {
99
+ k: 'part';
100
+ id: string;
101
+ index: number;
102
+ }
103
+ /**
104
+ * Item-value text slot; valid only inside an `each` item template. `field`
105
+ * names the item field rendered by this slot — multi-field item templates
106
+ * carry one slot per field, and the compiler always emits it.
107
+ */
108
+ export interface ProgramItemValueNode {
109
+ k: 'ival';
110
+ field: string;
111
+ }
112
+ /** The discriminated union of static tree nodes. */
113
+ export type ProgramTreeNode = ProgramElementNode | ProgramTextNode | ProgramPartAnchorNode | ProgramItemValueNode;
114
+ /** A text interpolation part bound to one signal. */
115
+ export interface ProgramTextPart {
116
+ k: 'text';
117
+ index: number;
118
+ signal: string;
119
+ location: ProgramLocation;
120
+ }
121
+ /** DOM property sink bound to a Signal; `path` is retained for seed consumers. */
122
+ export interface ProgramPropPart {
123
+ k: 'prop';
124
+ index: number;
125
+ signal: string;
126
+ name: string;
127
+ path: number[];
128
+ location: ProgramLocation;
129
+ }
130
+ /** String attribute sink bound to a Signal. */
131
+ export interface ProgramAttrPart {
132
+ k: 'attr';
133
+ index: number;
134
+ signal: string;
135
+ name: string;
136
+ path: number[];
137
+ location: ProgramLocation;
138
+ }
139
+ /** Boolean attribute sink bound to a Signal. */
140
+ export interface ProgramBoolPart {
141
+ k: 'bool';
142
+ index: number;
143
+ signal: string;
144
+ name: string;
145
+ path: number[];
146
+ location: ProgramLocation;
147
+ }
148
+ /** Specialized fixed sinks make ownership explicit for class and style text. */
149
+ export interface ProgramClassPart {
150
+ k: 'class';
151
+ index: number;
152
+ signal: string;
153
+ path: number[];
154
+ location: ProgramLocation;
155
+ }
156
+ /** A style binding part. */
157
+ export interface ProgramStylePart {
158
+ k: 'style';
159
+ index: number;
160
+ signal: string;
161
+ path: number[];
162
+ location: ProgramLocation;
163
+ }
164
+ /**
165
+ * Trusted-HTML content sink (alpha.9). The signal value must carry
166
+ * the runtime TrustedHtml capability; its HTML replaces the target
167
+ * element's content. The target's subtree is opaque to the claim path. The
168
+ * compiler emits this only for an explicit `innerHTML={this.<field>}` sink on
169
+ * an otherwise childless element — there is no implicit or discovery path to
170
+ * raw HTML.
171
+ */
172
+ export interface ProgramHtmlPart {
173
+ k: 'html';
174
+ index: number;
175
+ signal: string;
176
+ path: number[];
177
+ location: ProgramLocation;
178
+ }
179
+ /** A named ref slot is serializable; the generated class supplies the ref value. */
180
+ export interface ProgramRefPart {
181
+ k: 'ref';
182
+ index: number;
183
+ ref: string;
184
+ path: number[];
185
+ location: ProgramLocation;
186
+ }
187
+ /** The action one event part dispatches. */
188
+ export type ProgramEventAction = {
189
+ kind: 'method';
190
+ name: string;
191
+ } | {
192
+ kind: 'call';
193
+ name: string;
194
+ } | {
195
+ kind: 'increment' | 'decrement';
196
+ signal: string;
197
+ } | {
198
+ kind: 'assign';
199
+ signal: string;
200
+ value: SerializableValue;
201
+ } | {
202
+ kind: 'add' | 'subtract';
203
+ signal: string;
204
+ value: number;
205
+ };
206
+ /** An event binding part: listener wiring between DOM event and action. */
207
+ export interface ProgramEventPart {
208
+ k: 'event';
209
+ index: number;
210
+ event: string;
211
+ handler: string;
212
+ action: ProgramEventAction;
213
+ path: number[];
214
+ location: ProgramLocation;
215
+ }
216
+ /** The comparison operators a program condition supports. */
217
+ export type ConditionOperator = 'greater-than' | 'greater-or-equal' | 'less-than' | 'less-or-equal' | 'equals' | 'not-equals' | 'truthy';
218
+ /** One condition clause of a when part. */
219
+ export interface ProgramCondition {
220
+ signal: string;
221
+ op: ConditionOperator;
222
+ value: number | string | boolean;
223
+ }
224
+ /**
225
+ * Operator/literal compatibility for when-Region tests (issue #1372). Both
226
+ * wire validators (this module and the server serializer's shared validator)
227
+ * close the space through this one predicate:
228
+ * - ordering operators require a finite numeric literal;
229
+ * - `equals`/`not-equals` admit a finite number, string, or boolean;
230
+ * - `truthy` admits exactly `true` or `false` (the recorded expectation).
231
+ */
232
+ export declare function conditionLiteralAllowed(op: unknown, value: unknown): boolean;
233
+ /** A conditional part: swaps template branches on a condition. */
234
+ export interface ProgramWhenPart {
235
+ k: 'when';
236
+ index: number;
237
+ signal: string;
238
+ test: ProgramCondition;
239
+ on: ProgramTreeNode[];
240
+ off: ProgramTreeNode[];
241
+ location: ProgramLocation;
242
+ }
243
+ /**
244
+ * An event binding scoped to each item of an `each` region. The runtime
245
+ * attaches this listener to every item root node created by the region,
246
+ * making per-item handlers (onClick={this.select(row.id)}) expressible
247
+ * without fixed-path event parts.
248
+ */
249
+ export interface ItemEventBinding {
250
+ /** DOM event name ('click', 'input', …). */
251
+ event: string;
252
+ /** Handler method name on the compiled class. */
253
+ handler: string;
254
+ /** The action to dispatch, same union as fixed event parts. */
255
+ action: ProgramEventAction;
256
+ /**
257
+ * Optional child selector within the item template (e.g. '.probe-button').
258
+ * When omitted, the listener attaches to the item root.
259
+ */
260
+ selector?: string;
261
+ }
262
+ /** A list part: repeats its template node per item of a bound signal. */
263
+ export interface ProgramEachPart {
264
+ k: 'each';
265
+ index: number;
266
+ signal: string;
267
+ key: string;
268
+ /**
269
+ * Restatement of the item field for single-field templates; omitted when
270
+ * the item template binds multiple fields (each `ival`/`iattrs` slot then
271
+ * carries its own field).
272
+ */
273
+ field?: string;
274
+ item: ProgramTreeNode[];
275
+ /** Per-item event bindings (#1556 IR v2): listeners attached to each item. */
276
+ itemEvents?: ItemEventBinding[];
277
+ location: ProgramLocation;
278
+ }
279
+ /** The discriminated union of dynamic parts a program instantiates. */
280
+ export type ProgramPart = ProgramTextPart | ProgramPropPart | ProgramAttrPart | ProgramBoolPart | ProgramClassPart | ProgramStylePart | ProgramHtmlPart | ProgramRefPart | ProgramEventPart | ProgramWhenPart | ProgramEachPart;
281
+ /** One region the program tracks: the boundaries of a dynamic subtree. */
282
+ export interface ProgramRegionRecord {
283
+ id: string;
284
+ index: number;
285
+ kind: 'when' | 'each';
286
+ anchor: string;
287
+ end: string;
288
+ source: string;
289
+ }
290
+ /** One module dependency the compiled module graph records. */
291
+ export interface ProgramDependencyRecord {
292
+ signal: string;
293
+ owner: {
294
+ kind: 'part' | 'region';
295
+ index: number;
296
+ };
297
+ location: string;
298
+ }
299
+ /** The serialized value-type tag of a compiled property default. */
300
+ export type PropertyValueType = 'string' | 'number' | 'boolean' | 'array' | 'object';
301
+ /** One compiled @property declaration: name, type, and reflection facts. */
302
+ export interface CompiledPropertyMetadata {
303
+ name: string;
304
+ attribute: string | null;
305
+ type: PropertyValueType;
306
+ converter: PropertyValueType;
307
+ reflect: boolean;
308
+ default: SerializableValue;
309
+ /**
310
+ * True for computed fields (`= computed(() => ...)` in the source): their
311
+ * signal is derived from other property signals by the generated
312
+ * `__computedFields` factory, never seeded from attributes/props. Always
313
+ * paired with `attribute: null` and `reflect: false`.
314
+ */
315
+ computed?: boolean;
316
+ /** Source signal names a computed field reads (declaration order). */
317
+ deps?: string[];
318
+ }
319
+ /** One property entry of the compiled custom-elements-manifest metadata. */
320
+ export interface CemPropertyMetadata {
321
+ name: string;
322
+ fieldName: string;
323
+ type: PropertyValueType;
324
+ attribute: string | null;
325
+ reflect: boolean;
326
+ }
327
+ /** The compiled custom-elements-manifest metadata block of one component. */
328
+ export interface CompiledCemMetadata {
329
+ tagName: string;
330
+ className: string;
331
+ declaration: {
332
+ name: string;
333
+ module: string;
334
+ };
335
+ attributes: Array<{
336
+ name: string;
337
+ fieldName: string;
338
+ type: PropertyValueType;
339
+ reflect: boolean;
340
+ }>;
341
+ members: CemPropertyMetadata[];
342
+ }
343
+ /** The compiled element metadata the program carries for tooling consumers. */
344
+ export interface CompiledElementMetadata {
345
+ tag: string;
346
+ className: string;
347
+ sourceFile: string;
348
+ properties: CompiledPropertyMetadata[];
349
+ observedAttributes: string[];
350
+ cem: CompiledCemMetadata;
351
+ }
352
+ /** The one deterministic program consumed by all execution modes. */
353
+ export interface PartProgramV1 {
354
+ version: typeof PART_PROGRAM_VERSION;
355
+ tag: string;
356
+ root: ProgramRoot;
357
+ template: ProgramTreeNode[];
358
+ parts: ProgramPart[];
359
+ regions: ProgramRegionRecord[];
360
+ dependencies: ProgramDependencyRecord[];
361
+ locations: ProgramLocationRecord[];
362
+ /**
363
+ * Compile-time provenance. The canonical in-memory artifact always carries
364
+ * it; the serialized module payload omits it (no runtime consumer reads it),
365
+ * so the validator accepts programs with or without it but still verifies
366
+ * it strictly when present.
367
+ */
368
+ sourceMap: ProgramSourceMap;
369
+ metadata: CompiledElementMetadata;
370
+ }
371
+ /** The serializable Part Program v1: one compiled component as data. */
372
+ export type PartProgram = PartProgramV1;
373
+ /** Anchor marker payloads shared by seed runtime consumers. */
374
+ export declare function partAnchorMarker(index: number): string;
375
+ /** The comment marker closing a part anchor in serialized program markup. */
376
+ export declare function partAnchorEndMarker(index: number): string;
377
+ /**
378
+ * The one `<style>` element the server serializer emits as the first DSD
379
+ * template child when the class carries static styles (renderDsd
380
+ * parity — pages never upgrade, so their styles must ship in the payload).
381
+ * The claim path skips exactly this marked node; a marked node on a
382
+ * style-less class is claim drift and fails closed.
383
+ */
384
+ export declare const STATIC_STYLES_MARKER = "data-oe-static-styles";
385
+ /**
386
+ * Internal SSR provenance marker on light-mode host tags (#1148).
387
+ * Present only when the host's light subtree was server-rendered under the
388
+ * in-place activation contract: the client binds the existing DOM instead of
389
+ * clearing it, and a parent's activation walk prunes the nested host's
390
+ * subtree. Client rendering never writes it and it is never removed. The
391
+ * writer (internal/compiled/server) and readers (internal/compiled/runtime)
392
+ * import this constant; nothing writes the literal.
393
+ */
394
+ export declare const DATA_OE_LIGHT = "data-oe-light";
395
+ /**
396
+ * The wire-validator face of the one canonical attribute-name predicate
397
+ * (delegates to `./forbidden-sinks.ts`); exported for parity tests.
398
+ */
399
+ export declare function isAttributeName(value: unknown): value is string;
400
+ /**
401
+ * Validate an unknown value as a Part Program v1. The validator is intentionally
402
+ * strict: unknown instruction kinds, missing ownership records and unsafe paths
403
+ * fail before a runtime can guess at their meaning.
404
+ */
405
+ export declare function validatePartProgram(raw: unknown): asserts raw is PartProgram;
406
+ //#endregion
407
+ export { VOID_TAGS };