@microsoft/fast-element 2.10.4 → 3.0.0-rc.2

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 (211) hide show
  1. package/CHANGELOG.md +52 -2
  2. package/README.md +244 -1
  3. package/dist/arrays/arrays.api.json +2621 -0
  4. package/dist/context/context.api.json +13 -13
  5. package/dist/declarative/declarative.api.json +8483 -0
  6. package/dist/di/di.api.json +16 -16
  7. package/dist/dts/__test__/helpers.d.ts +6 -0
  8. package/dist/dts/array-observer.d.ts +2 -0
  9. package/dist/dts/arrays.d.ts +2 -0
  10. package/dist/dts/attr.d.ts +1 -0
  11. package/dist/dts/binding/binding.d.ts +15 -5
  12. package/dist/dts/binding/one-time.d.ts +1 -1
  13. package/dist/dts/binding/one-way.d.ts +1 -1
  14. package/dist/dts/binding/signal.d.ts +6 -6
  15. package/dist/dts/binding/two-way.d.ts +2 -1
  16. package/dist/dts/binding.d.ts +7 -0
  17. package/dist/dts/components/attributes.d.ts +1 -4
  18. package/dist/dts/components/definition-schema-transforms.d.ts +9 -0
  19. package/dist/dts/components/element-controller.d.ts +80 -114
  20. package/dist/dts/components/element-hydration.d.ts +1 -1
  21. package/dist/dts/components/enable-hydration.d.ts +54 -0
  22. package/dist/dts/components/fast-definitions.d.ts +98 -46
  23. package/dist/dts/components/fast-element.d.ts +43 -16
  24. package/dist/dts/components/hydration-tracker.d.ts +83 -0
  25. package/dist/dts/components/hydration.d.ts +23 -53
  26. package/dist/dts/components/schema.d.ts +205 -0
  27. package/dist/dts/context.d.ts +13 -13
  28. package/dist/dts/css.d.ts +3 -0
  29. package/dist/dts/debug.d.ts +5 -1
  30. package/dist/dts/declarative/attribute-map.d.ts +58 -0
  31. package/dist/dts/declarative/debug.d.ts +4 -0
  32. package/dist/dts/declarative/index.d.ts +14 -0
  33. package/dist/dts/declarative/interfaces.d.ts +8 -0
  34. package/dist/dts/declarative/observer-map-utilities.d.ts +58 -0
  35. package/dist/dts/declarative/observer-map.d.ts +89 -0
  36. package/dist/dts/declarative/runtime.d.ts +5 -0
  37. package/dist/dts/declarative/syntax.d.ts +21 -0
  38. package/dist/dts/declarative/template-bridge.d.ts +33 -0
  39. package/dist/dts/declarative/template-parser.d.ts +98 -0
  40. package/dist/dts/declarative/template.d.ts +10 -0
  41. package/dist/dts/declarative/utilities.d.ts +358 -0
  42. package/dist/dts/di/di.d.ts +7 -7
  43. package/dist/dts/directives/children.d.ts +2 -0
  44. package/dist/dts/directives/node-observation.d.ts +2 -0
  45. package/dist/dts/directives/ref.d.ts +2 -0
  46. package/dist/dts/directives/repeat.d.ts +4 -0
  47. package/dist/dts/directives/slotted.d.ts +2 -0
  48. package/dist/dts/directives/when.d.ts +3 -0
  49. package/dist/dts/dom-policy.d.ts +23 -5
  50. package/dist/dts/dom.d.ts +4 -16
  51. package/dist/dts/html.d.ts +5 -0
  52. package/dist/dts/hydration/diagnostics.d.ts +93 -0
  53. package/dist/dts/hydration/hydration-debugger.d.ts +35 -0
  54. package/dist/dts/hydration/messages.d.ts +62 -0
  55. package/dist/dts/hydration/runtime.d.ts +7 -0
  56. package/dist/dts/hydration/target-builder.d.ts +40 -12
  57. package/dist/dts/hydration.d.ts +18 -0
  58. package/dist/dts/index.d.ts +42 -42
  59. package/dist/dts/index.debug.d.ts +0 -1
  60. package/dist/dts/index.rollup.debug.d.ts +0 -1
  61. package/dist/dts/interfaces.d.ts +2 -49
  62. package/dist/dts/observable.d.ts +3 -6
  63. package/dist/dts/observation/arrays.d.ts +1 -1
  64. package/dist/dts/observation/observable.d.ts +3 -3
  65. package/dist/dts/observation/update-queue.d.ts +1 -1
  66. package/dist/dts/platform.d.ts +45 -8
  67. package/dist/dts/registry.d.ts +1 -0
  68. package/dist/dts/render.d.ts +7 -0
  69. package/dist/dts/schema.d.ts +1 -0
  70. package/dist/dts/state/exports.d.ts +1 -1
  71. package/dist/dts/state/state.d.ts +2 -2
  72. package/dist/dts/styles/css-directive.d.ts +5 -12
  73. package/dist/dts/styles/css.d.ts +5 -7
  74. package/dist/dts/styles/element-styles.d.ts +0 -10
  75. package/dist/dts/styles.d.ts +6 -0
  76. package/dist/dts/templating/compiler.d.ts +1 -1
  77. package/dist/dts/templating/html-binding-directive.d.ts +10 -2
  78. package/dist/dts/templating/html-directive.d.ts +19 -1
  79. package/dist/dts/templating/hydration-view.d.ts +130 -0
  80. package/dist/dts/templating/render.d.ts +1 -1
  81. package/dist/dts/templating/repeat.d.ts +1 -1
  82. package/dist/dts/templating/template.d.ts +15 -7
  83. package/dist/dts/templating/view.d.ts +25 -102
  84. package/dist/dts/templating.d.ts +10 -0
  85. package/dist/dts/testing/exports.d.ts +2 -2
  86. package/dist/dts/testing/fakes.d.ts +4 -4
  87. package/dist/dts/updates.d.ts +1 -0
  88. package/dist/dts/volatile.d.ts +2 -0
  89. package/dist/esm/__test__/helpers.js +22 -0
  90. package/dist/esm/__test__/setup-node.js +18 -0
  91. package/dist/esm/array-observer.js +1 -0
  92. package/dist/esm/arrays.js +1 -0
  93. package/dist/esm/attr.js +1 -0
  94. package/dist/esm/binding/normalize.js +1 -1
  95. package/dist/esm/binding/signal.js +4 -4
  96. package/dist/esm/binding/two-way.js +3 -3
  97. package/dist/esm/binding.js +4 -0
  98. package/dist/esm/components/attributes.js +18 -11
  99. package/dist/esm/components/definition-schema-transforms.js +23 -0
  100. package/dist/esm/components/element-controller.js +206 -270
  101. package/dist/esm/components/element-hydration.js +1 -1
  102. package/dist/esm/components/enable-hydration.js +124 -0
  103. package/dist/esm/components/fast-definitions.js +219 -56
  104. package/dist/esm/components/fast-element.js +18 -27
  105. package/dist/esm/components/hydration-tracker.js +122 -0
  106. package/dist/esm/components/hydration.js +137 -140
  107. package/dist/esm/components/schema.js +253 -0
  108. package/dist/esm/context.js +6 -6
  109. package/dist/esm/css.js +3 -0
  110. package/dist/esm/debug.js +27 -26
  111. package/dist/esm/declarative/attribute-map.js +122 -0
  112. package/dist/esm/declarative/debug.js +4 -0
  113. package/dist/esm/declarative/index.js +4 -0
  114. package/dist/esm/declarative/interfaces.js +9 -0
  115. package/dist/esm/declarative/observer-map-utilities.js +565 -0
  116. package/dist/esm/declarative/observer-map.js +216 -0
  117. package/dist/esm/declarative/runtime.js +14 -0
  118. package/dist/esm/declarative/syntax.js +36 -0
  119. package/dist/esm/declarative/template-bridge.js +160 -0
  120. package/dist/esm/declarative/template-parser.js +306 -0
  121. package/dist/esm/declarative/template.js +143 -0
  122. package/dist/esm/declarative/utilities.js +1069 -0
  123. package/dist/esm/di/di.js +8 -9
  124. package/dist/esm/directives/children.js +1 -0
  125. package/dist/esm/directives/node-observation.js +1 -0
  126. package/dist/esm/directives/ref.js +1 -0
  127. package/dist/esm/directives/repeat.js +1 -0
  128. package/dist/esm/directives/slotted.js +1 -0
  129. package/dist/esm/directives/when.js +1 -0
  130. package/dist/esm/dom-policy.js +35 -6
  131. package/dist/esm/dom.js +1 -1
  132. package/dist/esm/html.js +2 -0
  133. package/dist/esm/hydration/diagnostics.js +50 -0
  134. package/dist/esm/hydration/hydration-debugger.js +112 -0
  135. package/dist/esm/hydration/messages.js +84 -0
  136. package/dist/esm/hydration/runtime.js +33 -0
  137. package/dist/esm/hydration/target-builder.js +144 -91
  138. package/dist/esm/hydration.js +6 -0
  139. package/dist/esm/index.debug.js +2 -1
  140. package/dist/esm/index.js +38 -29
  141. package/dist/esm/index.rollup.debug.js +3 -2
  142. package/dist/esm/index.rollup.js +1 -1
  143. package/dist/esm/interfaces.js +2 -45
  144. package/dist/esm/metadata.js +2 -8
  145. package/dist/esm/observable.js +1 -4
  146. package/dist/esm/observation/arrays.js +1 -1
  147. package/dist/esm/observation/notifier.js +2 -4
  148. package/dist/esm/observation/observable.js +5 -5
  149. package/dist/esm/observation/update-queue.js +47 -58
  150. package/dist/esm/platform.js +31 -30
  151. package/dist/esm/registry.js +1 -0
  152. package/dist/esm/render.js +1 -0
  153. package/dist/esm/schema.js +1 -0
  154. package/dist/esm/state/exports.js +1 -1
  155. package/dist/esm/styles/css-directive.js +1 -2
  156. package/dist/esm/styles/css.js +15 -56
  157. package/dist/esm/styles/element-styles.js +69 -15
  158. package/dist/esm/styles.js +2 -0
  159. package/dist/esm/templating/html-binding-directive.js +11 -9
  160. package/dist/esm/templating/hydration-view.js +228 -0
  161. package/dist/esm/templating/render.js +39 -18
  162. package/dist/esm/templating/repeat.js +69 -33
  163. package/dist/esm/templating/template.js +7 -7
  164. package/dist/esm/templating/view.js +25 -234
  165. package/dist/esm/templating.js +7 -0
  166. package/dist/esm/testing/exports.js +2 -2
  167. package/dist/esm/testing/fixture.js +2 -2
  168. package/dist/esm/testing/timeout.js +2 -2
  169. package/dist/esm/updates.js +1 -0
  170. package/dist/esm/volatile.js +1 -0
  171. package/dist/fast-element.api.json +14389 -11138
  172. package/dist/fast-element.d.ts +3651 -809
  173. package/dist/fast-element.debug.js +5666 -4722
  174. package/dist/fast-element.debug.min.js +2 -2
  175. package/dist/fast-element.js +5394 -4381
  176. package/dist/fast-element.min.js +2 -2
  177. package/dist/fast-element.untrimmed.d.ts +923 -472
  178. package/dist/hydration/hydration.api.json +6460 -0
  179. package/dist/styles/styles.api.json +2672 -0
  180. package/package.json +165 -45
  181. package/ARCHITECTURE_FASTELEMENT.md +0 -63
  182. package/ARCHITECTURE_HTML_TAGGED_TEMPLATE_LITERAL.md +0 -36
  183. package/ARCHITECTURE_INTRO.md +0 -10
  184. package/ARCHITECTURE_OVERVIEW.md +0 -52
  185. package/ARCHITECTURE_UPDATES.md +0 -11
  186. package/CHANGELOG.json +0 -2275
  187. package/DESIGN.md +0 -510
  188. package/api-extractor.context.json +0 -14
  189. package/api-extractor.di.json +0 -14
  190. package/biome.json +0 -4
  191. package/dist/dts/components/install-hydration.d.ts +0 -1
  192. package/dist/dts/pending-task.d.ts +0 -32
  193. package/dist/dts/styles/css-binding-directive.d.ts +0 -60
  194. package/dist/dts/templating/install-hydratable-view-templates.d.ts +0 -1
  195. package/dist/esm/components/install-hydration.js +0 -3
  196. package/dist/esm/pending-task.js +0 -28
  197. package/dist/esm/polyfills.js +0 -60
  198. package/dist/esm/styles/css-binding-directive.js +0 -76
  199. package/dist/esm/templating/install-hydratable-view-templates.js +0 -23
  200. package/docs/ACKNOWLEDGEMENTS.md +0 -12
  201. package/docs/api-report.api.md +0 -1122
  202. package/docs/context/api-report.api.md +0 -69
  203. package/docs/di/api-report.api.md +0 -315
  204. package/docs/fast-element-2-changes.md +0 -15
  205. package/playwright.config.ts +0 -26
  206. package/scripts/run-api-extractor.js +0 -51
  207. package/test/index.html +0 -11
  208. package/test/main.ts +0 -104
  209. package/test/vite.config.ts +0 -19
  210. package/tsconfig.api-extractor.json +0 -6
  211. /package/dist/dts/{polyfills.d.ts → __test__/setup-node.d.ts} +0 -0
@@ -0,0 +1,93 @@
1
+ import type { ViewBehaviorFactory } from "../templating/html-directive.js";
2
+ /**
3
+ * Structured description of the binding hydration was expecting to apply when
4
+ * a mismatch is detected.
5
+ * @public
6
+ */
7
+ export interface HydrationMismatchExpectation {
8
+ /**
9
+ * The tag name of the element the binding was expecting (e.g. `"SPAN"`),
10
+ * or `null` when the binding does not target a specific element (host or
11
+ * template-level bindings).
12
+ */
13
+ tagName: string | null;
14
+ /**
15
+ * Human-readable description of the binding aspect, for example
16
+ * `"content"`, `"property className"`, or `"attribute aria-label"`.
17
+ */
18
+ aspect: string;
19
+ }
20
+ /**
21
+ * Structured description of the DOM hydration actually encountered at the
22
+ * mismatch point.
23
+ * @public
24
+ */
25
+ export interface HydrationMismatchActual {
26
+ /**
27
+ * Serialized HTML snippet of the server-rendered DOM where the mismatch
28
+ * was detected. Truncated with an ellipsis when long.
29
+ */
30
+ html: string;
31
+ }
32
+ /**
33
+ * Result of a hydration-mismatch diagnostic format call.
34
+ * @public
35
+ */
36
+ export interface HydrationDiagnosticResult {
37
+ /**
38
+ * The error message to attach to the thrown hydration error.
39
+ */
40
+ message: string;
41
+ /**
42
+ * Structured description of the binding the hydration walk was
43
+ * attempting to apply. The default diagnostic leaves this `undefined`;
44
+ * install `hydrationDebugger()` to populate it.
45
+ */
46
+ expected?: HydrationMismatchExpectation | string;
47
+ /**
48
+ * Structured description of the server-rendered DOM that was
49
+ * encountered at the mismatch point. The default diagnostic leaves
50
+ * this `undefined`; install `hydrationDebugger()` to populate it.
51
+ */
52
+ received?: HydrationMismatchActual;
53
+ }
54
+ /**
55
+ * Pluggable formatter for hydration mismatch errors. The default
56
+ * implementation is a minimal one-line message; install
57
+ * {@link hydrationDebugger} to swap in the rich "Expected … / Received …"
58
+ * formatter with an HTML snippet of the SSR DOM.
59
+ * @public
60
+ */
61
+ export interface HydrationDiagnostic {
62
+ /**
63
+ * Format a binding-resolution mismatch (a factory whose `targetNodeId`
64
+ * has no entry in the resolved targets after the SSR DOM walk).
65
+ */
66
+ formatBindingMismatch(factory: ViewBehaviorFactory, firstChild: Node, lastChild: Node, hostName: string | undefined): HydrationDiagnosticResult;
67
+ /**
68
+ * Format a structural error encountered during the SSR DOM walk
69
+ * (e.g. attribute binding count overflow, missing close marker).
70
+ */
71
+ formatStructuralError(node: Node, hostName: string | undefined, expectedDescription: string): HydrationDiagnosticResult;
72
+ }
73
+ /**
74
+ * Installs a {@link HydrationDiagnostic} as the active formatter for
75
+ * hydration mismatch errors. Called by `enableHydration()` when an opt-in
76
+ * debugger configuration is supplied; not exposed as `@public` because
77
+ * library consumers should always go through `enableHydration` to install
78
+ * a debugger.
79
+ * @internal
80
+ */
81
+ export declare function installHydrationDiagnostic(diagnostic: HydrationDiagnostic): void;
82
+ /**
83
+ * Returns the currently active {@link HydrationDiagnostic} — either the
84
+ * minimal default or one installed by an opt-in debugger.
85
+ * @internal
86
+ */
87
+ export declare function getHydrationDiagnostic(): HydrationDiagnostic;
88
+ /**
89
+ * Reads the host element's tag name from any node inside a hydration view.
90
+ * Returns `undefined` when the node is not inside a shadow root.
91
+ * @internal
92
+ */
93
+ export declare function getHostName(node: Node | null | undefined): string | undefined;
@@ -0,0 +1,35 @@
1
+ import type { HydrationDiagnostic } from "./diagnostics.js";
2
+ /**
3
+ * Opt-in hydration debugger configuration. Pass to `enableHydration` to
4
+ * install the rich "Expected / Received" hydration mismatch formatter:
5
+ *
6
+ * ```ts
7
+ * import { enableHydration, hydrationDebugger } from "@microsoft/fast-element/hydration.js";
8
+ *
9
+ * enableHydration({ debugger: hydrationDebugger() });
10
+ * ```
11
+ *
12
+ * @public
13
+ */
14
+ export interface HydrationDebugger {
15
+ /**
16
+ * The {@link HydrationDiagnostic} the debugger installs when consumed
17
+ * by `enableHydration`.
18
+ */
19
+ readonly diagnostic: HydrationDiagnostic;
20
+ }
21
+ /**
22
+ * Returns a {@link HydrationDebugger} that, when supplied to
23
+ * `enableHydration({ debugger })`, installs the rich hydration mismatch
24
+ * formatter: a single-line "Expected … / Received …" message plus an HTML
25
+ * snippet of the SSR DOM and structured `expected`/`received` fields on
26
+ * the thrown error (both `HydrationBindingError` and
27
+ * `HydrationTargetElementError`).
28
+ *
29
+ * Without the debugger, hydration errors emit only a minimal one-line
30
+ * message pointing at this function — keeping the runtime hydration cost
31
+ * small for production bundles that do not need rich diagnostics.
32
+ *
33
+ * @public
34
+ */
35
+ export declare function hydrationDebugger(): HydrationDebugger;
@@ -0,0 +1,62 @@
1
+ /**
2
+ * Centralized hydration mismatch message strings used by both the default
3
+ * minimal `HydrationDiagnostic` and the opt-in `hydrationDebugger` rich
4
+ * formatter, and by the structural-error throw sites in
5
+ * `target-builder.ts`.
6
+ *
7
+ * Static text is exported as a plain `const`; interpolated text is exported
8
+ * as a small builder function. Plain `export const` declarations tree-shake
9
+ * better than frozen-object property bags, so unused strings drop out of
10
+ * bundles cleanly.
11
+ */
12
+ /**
13
+ * Fallback host tag name used when a hydration mismatch is detected on a
14
+ * node that is not inside a shadow root.
15
+ */
16
+ export declare const unknownHostName = "unknown";
17
+ export declare const aspectLabelAttribute = "attribute";
18
+ export declare const aspectLabelBooleanAttribute = "boolean attribute";
19
+ export declare const aspectLabelProperty = "property";
20
+ export declare const aspectLabelContent = "content";
21
+ export declare const aspectLabelTokenList = "token list";
22
+ export declare const aspectLabelEvent = "event";
23
+ /** Fallback used when the aspectType is missing or unknown. */
24
+ export declare const aspectLabelUnknown = "binding";
25
+ /**
26
+ * Combines an aspect label with the original source aspect identifier from
27
+ * markup (e.g. `"property className"`). Returns the bare label when no
28
+ * source aspect was captured.
29
+ */
30
+ export declare function formatAspect(label: string, sourceAspect: string | undefined): string;
31
+ /**
32
+ * Formats the "Expected" half of the rich hydration mismatch message, e.g.
33
+ * `"<span> with content binding"` or `"content binding"` when no tag is
34
+ * associated with the binding factory.
35
+ */
36
+ export declare function formatExpectedTarget(tagName: string | null, aspect: string): string;
37
+ /**
38
+ * Default minimal hydration mismatch message used when the
39
+ * `hydrationDebugger` opt-in is not installed. The optional `detail` string
40
+ * carries the structural expectation surfaced by `target-builder.ts`.
41
+ */
42
+ export declare function formatDefaultMismatchMessage(hostName: string, detail: string | undefined): string;
43
+ /**
44
+ * Rich `Expected … / Received …` hydration mismatch message format produced
45
+ * by the `hydrationDebugger` formatter.
46
+ */
47
+ export declare function formatRichMismatchMessage(hostName: string, expectedText: string, receivedHtml: string): string;
48
+ export declare const expectedContentAfterStartMarker = "content following `<!--fe:b-->` content binding marker";
49
+ export declare const expectedContentEndMarker = "matching `<!--fe:/b-->` content binding close marker";
50
+ export declare const expectedElementBoundaryEndMarker = "matching `<!--fe:/e-->` element boundary close marker";
51
+ /**
52
+ * Builds the "no more attribute bindings" structural expectation message
53
+ * thrown when an element's `data-fe` count claims more attribute bindings
54
+ * than the compiled template defines.
55
+ */
56
+ export declare function formatNoMoreAttributeBindings(factoryCount: number): string;
57
+ /**
58
+ * Builds the "no more content bindings" structural expectation message
59
+ * thrown when the SSR DOM contains more content binding markers than the
60
+ * compiled template defines.
61
+ */
62
+ export declare function formatNoMoreContentBindings(factoryCount: number): string;
@@ -0,0 +1,7 @@
1
+ /**
2
+ * Installs the hydration runtime on `ViewTemplate.prototype`,
3
+ * making all templates hydratable. Call this before any hydration
4
+ * occurs. Safe to call multiple times — subsequent calls are no-ops.
5
+ * @internal
6
+ */
7
+ export declare function ensureHydrationRuntime(): void;
@@ -1,4 +1,5 @@
1
1
  import type { CompiledViewBehaviorFactory, ViewBehaviorFactory, ViewBehaviorTargets } from "../templating/html-directive.js";
2
+ import { type HydrationMismatchActual, type HydrationMismatchExpectation } from "./diagnostics.js";
2
3
  export declare class HydrationTargetElementError extends Error {
3
4
  /**
4
5
  * The Compiled View Behavior Factories that belong to the view.
@@ -7,7 +8,19 @@ export declare class HydrationTargetElementError extends Error {
7
8
  /**
8
9
  * The node to target factory.
9
10
  */
10
- readonly node: Element;
11
+ readonly node: Node;
12
+ /**
13
+ * Structured description of the binding the hydration walk was
14
+ * attempting to apply when the mismatch was detected. Free-form
15
+ * string for structural errors that do not correspond to a single
16
+ * binding factory.
17
+ */
18
+ readonly expected?: (HydrationMismatchExpectation | string) | undefined;
19
+ /**
20
+ * Structured description of the server-rendered DOM that was
21
+ * encountered at the mismatch point.
22
+ */
23
+ readonly received?: HydrationMismatchActual | undefined;
11
24
  /**
12
25
  * String representation of the HTML in the template that
13
26
  * threw the target element error.
@@ -25,10 +38,23 @@ export declare class HydrationTargetElementError extends Error {
25
38
  /**
26
39
  * The node to target factory.
27
40
  */
28
- node: Element);
41
+ node: Node,
42
+ /**
43
+ * Structured description of the binding the hydration walk was
44
+ * attempting to apply when the mismatch was detected. Free-form
45
+ * string for structural errors that do not correspond to a single
46
+ * binding factory.
47
+ */
48
+ expected?: (HydrationMismatchExpectation | string) | undefined,
49
+ /**
50
+ * Structured description of the server-rendered DOM that was
51
+ * encountered at the mismatch point.
52
+ */
53
+ received?: HydrationMismatchActual | undefined);
29
54
  }
30
55
  /**
31
56
  * Represents the DOM boundaries controlled by a view
57
+ * @public
32
58
  */
33
59
  export interface ViewBoundaries {
34
60
  first: Node;
@@ -37,6 +63,7 @@ export interface ViewBoundaries {
37
63
  /**
38
64
  * Stores relationships between a {@link ViewBehaviorFactory} and
39
65
  * the {@link ViewBoundaries} the factory created.
66
+ * @public
40
67
  */
41
68
  export interface ViewBehaviorBoundaries {
42
69
  [factoryId: string]: ViewBoundaries;
@@ -52,20 +79,21 @@ export declare function createRangeForNodes(first: Node, last: Node): Range;
52
79
  /**
53
80
  * Maps compiled ViewBehaviorFactory IDs to their corresponding DOM nodes in the
54
81
  * server-rendered shadow root. Uses a TreeWalker to scan the existing DOM between
55
- * firstNode and lastNode, parsing hydration markers to build the targets map.
82
+ * firstNode and lastNode, processing data-free sequential hydration markers.
83
+ *
84
+ * A sequential factory pointer advances through the factories array in DFS order.
85
+ * Since the template compiler and hydration walker both traverse the DOM in
86
+ * identical depth-first order, no embedded indices are needed in markers.
56
87
  *
57
- * For element nodes: parses `data-fe-b` (or variant) attributes to identify which
58
- * factories target each element, then removes the marker attribute.
88
+ * For element nodes: parses `data-fe="N"` to determine the count of attribute
89
+ * binding factories, then consumes N factories sequentially.
59
90
  *
60
- * For comment nodes: parses content binding markers (`fe-b$$start/end$$`) to find
61
- * the DOM range controlled by each content binding. Single text nodes become the
62
- * direct target; multi-node ranges are stored in boundaries for structural directives.
63
- * Element boundary markers (`fe-eb$$start/end$$`) cause the walker to skip over
64
- * nested custom elements that handle their own hydration.
91
+ * For comment nodes: `fe:b` markers consume the next factory for content bindings,
92
+ * using balanced depth counting for nested marker pairing. `fe:e` markers cause
93
+ * the walker to skip nested custom element subtrees.
65
94
  *
66
95
  * Host bindings (targetNodeId='h') appear at the start of the factories array but
67
- * have no SSR markers — getHydrationIndexOffset() computes how many to skip so that
68
- * marker indices align with the correct non-host factories.
96
+ * have no SSR markers — getHydrationIndexOffset() computes the initial pointer value.
69
97
  *
70
98
  * @param firstNode - The first node of the view.
71
99
  * @param lastNode - The last node of the view.
@@ -0,0 +1,18 @@
1
+ export type { HydrationOptions } from "./components/enable-hydration.js";
2
+ export { deferHydrationAttribute, enableHydration, StopHydration, } from "./components/enable-hydration.js";
3
+ export { isHydratable } from "./components/hydration.js";
4
+ export { HydrationTracker } from "./components/hydration-tracker.js";
5
+ export type { DOMAspect, DOMSink, } from "./dom.js";
6
+ export { type DOMAspectGuards, type DOMElementGuards, type DOMGuards, DOMPolicy, type DOMPolicyOptions, type DOMSinkGuards, } from "./dom-policy.js";
7
+ export type { HydrationDiagnostic, HydrationDiagnosticResult, HydrationMismatchActual, HydrationMismatchExpectation, } from "./hydration/diagnostics.js";
8
+ export type { HydrationDebugger } from "./hydration/hydration-debugger.js";
9
+ export { hydrationDebugger } from "./hydration/hydration-debugger.js";
10
+ export type { ViewBehaviorBoundaries, ViewBoundaries, } from "./hydration/target-builder.js";
11
+ export type { Disposable, TrustedTypesPolicy } from "./interfaces.js";
12
+ export type { ExecutionContext, ExpressionController, SourceLifetime, } from "./observation/observable.js";
13
+ export type { ContentTemplate, ContentView, HydratableContentTemplate, } from "./templating/html-binding-directive.js";
14
+ export type { ViewBehavior, ViewBehaviorFactory, ViewBehaviorTargets, ViewController, } from "./templating/html-directive.js";
15
+ export type { HydratableView, HydratableViewController, ViewNodes, } from "./templating/hydration-view.js";
16
+ export { HydrationBindingError, HydrationStage, } from "./templating/hydration-view.js";
17
+ export type { CaptureType, ElementViewTemplate, HydratableElementViewTemplate, HydratableSyntheticViewTemplate, SyntheticViewTemplate, } from "./templating/template.js";
18
+ export type { DefaultExecutionContext, ElementView, SyntheticView, View, } from "./templating/view.js";
@@ -1,48 +1,48 @@
1
- export type { Callable, Class, Constructable, Disposable, FASTGlobal, TrustedTypesPolicy, } from "./interfaces.js";
2
- export { emptyArray, FAST } from "./platform.js";
3
- export { DOM, DOMAspect, type DOMPolicy, type DOMSink } from "./dom.js";
4
- export { ArrayObserver, lengthOf, Sort, sortedCount, Splice, SpliceStrategy, SpliceStrategySupport, type LengthObserver, type SortObserver, } from "./observation/arrays.js";
5
- export { PropertyChangeNotifier, SubscriberSet, type Notifier, type Subscriber, } from "./observation/notifier.js";
6
- export { ExecutionContext, Observable, observable, SourceLifetime, volatile, type Accessor, type Expression, type ExpressionController, type ExpressionNotifier, type ExpressionObserver, type ObservationRecord, } from "./observation/observable.js";
7
- export { Updates, type UpdateQueue } from "./observation/update-queue.js";
1
+ /**
2
+ * Core APIs for building standards-based Web Components with FAST Element.
3
+ * @packageDocumentation
4
+ */
5
+ export { AttributeConfiguration, AttributeDefinition, type AttributeMode, attr, booleanConverter, type DecoratorAttributeConfiguration, nullableBooleanConverter, nullableNumberConverter, type ValueConverter, } from "./attr.js";
8
6
  export { Binding, type BindingDirective } from "./binding/binding.js";
9
7
  export { normalizeBinding } from "./binding/normalize.js";
10
8
  export { oneTime } from "./binding/one-time.js";
11
9
  export { listener, oneWay } from "./binding/one-way.js";
12
- export { CSSBindingDirective } from "./styles/css-binding-directive.js";
13
- export { cssDirective, CSSDirective, type AddBehavior, type CSSDirectiveDefinition, } from "./styles/css-directive.js";
14
- export { css, type CSSTemplateTag, type CSSValue } from "./styles/css.js";
15
- export { ElementStyles, type ComposableStyles, type ConstructibleStyleStrategy, } from "./styles/element-styles.js";
16
- export { type HostBehavior } from "./styles/host.js";
17
- export type { HostController } from "./styles/host.js";
10
+ export { Signal, signal } from "./binding/signal.js";
11
+ export { type TwoWayBindingOptions, TwoWaySettings, twoWay, } from "./binding/two-way.js";
12
+ export type { ElementControllerStrategy } from "./components/element-controller.js";
13
+ export { ElementController, Stages, } from "./components/element-controller.js";
14
+ export type { FASTElementExtension, FASTElementTemplateResolver, PartialFASTElementDefinition, ShadowRootOptions, TypeDefinition, TypeRegistry, } from "./components/fast-definitions.js";
15
+ export { FASTElementDefinition, fastElementRegistry, type TemplateLifecycleCallbacks, } from "./components/fast-definitions.js";
16
+ export { customElement, FASTElement, type FASTElementConstructor, } from "./components/fast-element.js";
17
+ export { enableDebug } from "./debug.js";
18
+ export { type ChildListDirectiveOptions, ChildrenDirective, type ChildrenDirectiveOptions, children, type SubtreeDirectiveOptions, } from "./directives/children.js";
19
+ export { type ElementsFilter, elements, type NodeBehaviorOptions, NodeObservationDirective, } from "./directives/node-observation.js";
20
+ export { RefDirective, ref } from "./directives/ref.js";
21
+ export { RepeatBehavior, RepeatDirective, type RepeatOptions, repeat, } from "./directives/repeat.js";
22
+ export { SlottedDirective, type SlottedDirectiveOptions, slotted, } from "./directives/slotted.js";
23
+ export { when } from "./directives/when.js";
24
+ export { DOM, DOMAspect, type DOMSink } from "./dom.js";
25
+ export { type DOMAspectGuards, type DOMElementGuards, type DOMGuards, DOMPolicy, type DOMPolicyOptions, type DOMSinkGuards, } from "./dom-policy.js";
26
+ export type { Callable, Class, Constructable, Disposable, TrustedTypesPolicy, } from "./interfaces.js";
27
+ export { ArrayObserver, type LengthObserver, lengthOf, Sort, type SortObserver, Splice, SpliceStrategy, SpliceStrategySupport, sortedCount, } from "./observation/arrays.js";
28
+ export { type Notifier, PropertyChangeNotifier, type Subscriber, SubscriberSet, } from "./observation/notifier.js";
29
+ export type { Accessor, Expression, ExpressionController, ExpressionNotifier, ExpressionObserver, ObservationRecord, } from "./observation/observable.js";
30
+ export { ExecutionContext, Observable, observable, SourceLifetime, volatile, } from "./observation/observable.js";
31
+ export { type UpdateQueue, Updates } from "./observation/update-queue.js";
32
+ export { emptyArray, FAST } from "./platform.js";
33
+ export { type AccessCachedPath, type CachedPath, type CachedPathCommon, type CachedPathMap, type ChildrenMap, type DefaultCachedPath, type EventCachedPath, type JSONSchema, type JSONSchemaCommon, type JSONSchemaDefinition, type RegisterPathConfig, type RepeatCachedPath, Schema, schemaRegistry, } from "./schema.js";
34
+ export * from "./state/exports.js";
35
+ export { type CSSTemplateTag, type CSSValue, css } from "./styles/css.js";
36
+ export { CSSDirective, type CSSDirectiveDefinition, cssDirective, } from "./styles/css-directive.js";
37
+ export type { ComposableStyles, ConstructibleStyleStrategy, } from "./styles/element-styles.js";
38
+ export { ElementStyles } from "./styles/element-styles.js";
39
+ export type { HostBehavior, HostController } from "./styles/host.js";
18
40
  export type { StyleStrategy, StyleTarget } from "./styles/style-strategy.js";
19
- export { children, ChildrenDirective } from "./templating/children.js";
20
- export type { ChildListDirectiveOptions, ChildrenDirectiveOptions, SubtreeDirectiveOptions, } from "./templating/children.js";
21
- export { Compiler } from "./templating/compiler.js";
22
- export type { CompilationStrategy } from "./templating/compiler.js";
23
- export { HTMLBindingDirective } from "./templating/html-binding-directive.js";
24
- export type { ContentTemplate, ContentView, } from "./templating/html-binding-directive.js";
25
- export { htmlDirective, HTMLDirective, StatelessAttachedAttributeDirective, } from "./templating/html-directive.js";
26
- export type { AddViewBehaviorFactory, Aspected, CompiledViewBehaviorFactory, HTMLDirectiveDefinition, PartialHTMLDirectiveDefinition, ViewBehavior, ViewBehaviorFactory, ViewBehaviorTargets, ViewController, } from "./templating/html-directive.js";
41
+ export { type CompilationStrategy, Compiler } from "./templating/compiler.js";
42
+ export { type ContentTemplate, type ContentView, HTMLBindingDirective, } from "./templating/html-binding-directive.js";
43
+ export { type AddViewBehaviorFactory, type Aspected, type CompiledViewBehaviorFactory, HTMLDirective, type HTMLDirectiveDefinition, htmlDirective, type PartialHTMLDirectiveDefinition, StatelessAttachedAttributeDirective, type ViewBehavior, type ViewBehaviorFactory, type ViewBehaviorTargets, type ViewController, } from "./templating/html-directive.js";
27
44
  export { Markup, Parser } from "./templating/markup.js";
28
- export { elements, NodeObservationDirective } from "./templating/node-observation.js";
29
- export type { ElementsFilter, NodeBehaviorOptions, } from "./templating/node-observation.js";
30
- export { ref, RefDirective } from "./templating/ref.js";
31
- export { render, RenderBehavior, RenderDirective } from "./templating/render.js";
32
- export { repeat, RepeatBehavior, RepeatDirective } from "./templating/repeat.js";
33
- export type { RepeatOptions } from "./templating/repeat.js";
34
- export { slotted, SlottedDirective } from "./templating/slotted.js";
35
- export type { SlottedDirectiveOptions } from "./templating/slotted.js";
36
- export { html, InlineTemplateDirective, ViewTemplate } from "./templating/template.js";
37
- export type { CaptureType, ElementViewTemplate, HTMLTemplateCompilationResult, HTMLTemplateTag, SyntheticViewTemplate, TemplateValue, } from "./templating/template.js";
38
- export { HTMLView, HydrationBindingError } from "./templating/view.js";
39
- export type { ElementView, HydratableView, SyntheticView, View, } from "./templating/view.js";
40
- export { when } from "./templating/when.js";
41
- export { attr, AttributeConfiguration, AttributeDefinition, booleanConverter, nullableBooleanConverter, nullableNumberConverter, } from "./components/attributes.js";
42
- export type { AttributeMode, DecoratorAttributeConfiguration, ValueConverter, } from "./components/attributes.js";
43
- export { ElementController, HydratableElementController, needsHydrationAttribute, Stages, type HydrationControllerCallbacks, } from "./components/element-controller.js";
44
- export type { ElementControllerStrategy } from "./components/element-controller.js";
45
- export { FASTElementDefinition, fastElementRegistry, TemplateOptions, type TemplateLifecycleCallbacks, } from "./components/fast-definitions.js";
46
- export type { PartialFASTElementDefinition, ShadowRootOptions, TypeRegistry, } from "./components/fast-definitions.js";
47
- export { customElement, FASTElement } from "./components/fast-element.js";
48
- export { deferHydrationAttribute, isHydratable } from "./components/hydration.js";
45
+ export { RenderBehavior, RenderDirective, render } from "./templating/render.js";
46
+ export { type CaptureType, type ElementViewTemplate, type HTMLTemplateCompilationResult, type HTMLTemplateTag, html, InlineTemplateDirective, type SyntheticViewTemplate, type TemplateValue, ViewTemplate, } from "./templating/template.js";
47
+ export { DefaultExecutionContext, type ElementView, HTMLView, type SyntheticView, type View, } from "./templating/view.js";
48
+ export * from "./utilities.js";
@@ -1,2 +1 @@
1
- import "./debug.js";
2
1
  export * from "./index.js";
@@ -1,2 +1 @@
1
- import "./debug.js";
2
1
  export * from "./index.js";
@@ -56,55 +56,6 @@ export type Mutable<T> = {
56
56
  * @public
57
57
  */
58
58
  export type ParameterDecorator = (target: Object, propertyKey: string | undefined, parameterIndex: number) => void;
59
- /**
60
- * The FAST global.
61
- * @public
62
- */
63
- export interface FASTGlobal {
64
- /**
65
- * The list of loaded versions.
66
- */
67
- readonly versions: string[];
68
- /**
69
- * Gets a kernel value.
70
- * @param id - The id to get the value for.
71
- * @param initialize - Creates the initial value for the id if not already existing.
72
- */
73
- getById<T>(id: string | number): T | null;
74
- getById<T>(id: string | number, initialize: () => T): T;
75
- /**
76
- * Sends a warning to the developer.
77
- * @param code - The warning code to send.
78
- * @param values - Values relevant for the warning message.
79
- */
80
- warn(code: number, values?: Record<string, any>): void;
81
- /**
82
- * Creates an error.
83
- * @param code - The error code to send.
84
- * @param values - Values relevant for the error message.
85
- */
86
- error(code: number, values?: Record<string, any>): Error;
87
- /**
88
- * Adds debug messages for errors and warnings.
89
- * @param messages - The message dictionary to add.
90
- * @remarks
91
- * Message can include placeholders like $\{name\} which can be
92
- * replaced by values passed at runtime.
93
- */
94
- addMessages(messages: Record<number, string>): void;
95
- }
96
- /**
97
- * Core services that can be shared across FAST instances.
98
- * @internal
99
- */
100
- type KernelServiceId = {
101
- readonly updateQueue: string | number;
102
- readonly observable: string | number;
103
- readonly contextEvent: string | number;
104
- readonly elementRegistry: string | number;
105
- };
106
- declare let KernelServiceId: KernelServiceId;
107
- export { KernelServiceId };
108
59
  /**
109
60
  * Warning and error messages.
110
61
  * @internal
@@ -120,6 +71,8 @@ export declare const enum Message {
120
71
  onlySetTemplatePolicyOnce = 1207,
121
72
  cannotSetTemplatePolicyAfterCompilation = 1208,
122
73
  blockedByDOMPolicy = 1209,
74
+ invalidHydrationAttributeMarker = 1210,
75
+ duplicateRenderInstruction = 1211,
123
76
  missingElementDefinition = 1401,
124
77
  noRegistrationForContext = 1501,
125
78
  noFactoryForResolver = 1502,
@@ -1,7 +1,4 @@
1
- /**
2
- * Observable exports for easy access to the Observable API
3
- */
4
- export { ExecutionContext, Observable, observable, SourceLifetime, volatile, } from "./observation/observable.js";
5
- export type { Accessor, Expression, ExpressionController, ExpressionNotifier, ExpressionObserver, ObservationRecord, } from "./observation/observable.js";
6
- export { PropertyChangeNotifier, SubscriberSet } from "./observation/notifier.js";
7
1
  export type { Notifier, Subscriber } from "./observation/notifier.js";
2
+ export { PropertyChangeNotifier, SubscriberSet } from "./observation/notifier.js";
3
+ export type { Accessor, Expression, ExpressionController, ExpressionNotifier, ExpressionObserver, ObservationRecord, } from "./observation/observable.js";
4
+ export { ExecutionContext, Observable, observable, SourceLifetime, } from "./observation/observable.js";
@@ -226,7 +226,7 @@ export declare const ArrayObserver: Readonly<{
226
226
  * Enables the array observation mechanism.
227
227
  * @remarks
228
228
  * Array observation is enabled automatically when using the
229
- * {@link RepeatDirective}, so calling this API manually is
229
+ * `RepeatDirective`, so calling this API manually is
230
230
  * not typically necessary.
231
231
  */
232
232
  readonly enable: () => void;
@@ -180,13 +180,13 @@ export declare const Observable: Readonly<{
180
180
  * @param initialSubscriber - An initial subscriber to changes in the binding value.
181
181
  * @param isVolatileBinding - Indicates whether the binding's dependency list must be re-evaluated on every value evaluation.
182
182
  */
183
- binding<TSource = any, TReturn = any>(expression: Expression<TSource, TReturn, any>, initialSubscriber?: Subscriber, isVolatileBinding?: boolean): ExpressionNotifier<TSource, TReturn, any>;
183
+ binding<TSource = any, TReturn = any>(expression: Expression<TSource, TReturn>, initialSubscriber?: Subscriber, isVolatileBinding?: boolean): ExpressionNotifier<TSource, TReturn>;
184
184
  /**
185
185
  * Determines whether a binding expression is volatile and needs to have its dependency list re-evaluated
186
186
  * on every evaluation of the value.
187
187
  * @param expression - The binding to inspect.
188
188
  */
189
- isVolatileBinding<TSource_1 = any, TReturn_1 = any>(expression: Expression<TSource_1, TReturn_1, any>): boolean;
189
+ isVolatileBinding<TSource = any, TReturn = any>(expression: Expression<TSource, TReturn>): boolean;
190
190
  }>;
191
191
  /**
192
192
  * Decorator: Defines an observable property on the target.
@@ -270,7 +270,7 @@ export declare const ExecutionContext: Readonly<{
270
270
  /**
271
271
  * A default execution context.
272
272
  */
273
- default: ExecutionContext<any>;
273
+ default: ExecutionContext;
274
274
  /**
275
275
  * Gets the current event.
276
276
  * @returns An event object.
@@ -1,4 +1,4 @@
1
- import { type Callable } from "../interfaces.js";
1
+ import type { Callable } from "../interfaces.js";
2
2
  /**
3
3
  * A work queue used to synchronize writes to the DOM.
4
4
  * @public
@@ -1,10 +1,31 @@
1
- import { type FASTGlobal } from "./interfaces.js";
2
- import "./polyfills.js";
3
1
  /**
4
- * The FAST global.
2
+ * The FAST messaging API for warnings and errors.
5
3
  * @public
6
4
  */
7
- export declare const FAST: FASTGlobal;
5
+ export declare const FAST: {
6
+ /**
7
+ * Sends a warning to the developer.
8
+ * @param code - The warning code to send.
9
+ * @param values - Values relevant for the warning message.
10
+ */
11
+ warn(_code: number, _values?: Record<string, any>): void;
12
+ /**
13
+ * Creates an error from a code.
14
+ * @param code - The error code.
15
+ * @param values - Values relevant for the error message.
16
+ */
17
+ error(code: number, _values?: Record<string, any>): Error;
18
+ /**
19
+ * Adds debug messages for errors and warnings.
20
+ * @param messages - The message dictionary to add.
21
+ */
22
+ addMessages(messages: Record<number, string>): void;
23
+ };
24
+ /**
25
+ * Gets the shared debug message lookup.
26
+ * @internal
27
+ */
28
+ export declare function getDebugMessageLookup(): Record<number, string>;
8
29
  /**
9
30
  * A readonly, empty array.
10
31
  * @remarks
@@ -14,19 +35,35 @@ export declare const FAST: FASTGlobal;
14
35
  */
15
36
  export declare const emptyArray: readonly never[];
16
37
  /**
17
- * Do not change. Part of shared kernel contract.
18
- * @internal
38
+ * A type that can be registered with a `TypeRegistry`.
39
+ * @public
19
40
  */
20
41
  export interface TypeDefinition {
42
+ /**
43
+ * The registered type constructor.
44
+ */
21
45
  type: Function;
22
46
  }
23
47
  /**
24
- * Do not change. Part of shared kernel contract.
25
- * @internal
48
+ * A registry that stores definitions by type.
49
+ * @public
26
50
  */
27
51
  export interface TypeRegistry<TDefinition extends TypeDefinition> {
52
+ /**
53
+ * Registers a type definition.
54
+ * @param definition - The type definition to register.
55
+ * @returns `true` when the definition was registered, otherwise `false`.
56
+ */
28
57
  register(definition: TDefinition): boolean;
58
+ /**
59
+ * Gets a definition by type.
60
+ * @param key - The type to retrieve the definition for.
61
+ */
29
62
  getByType(key: Function): TDefinition | undefined;
63
+ /**
64
+ * Gets a definition by instance.
65
+ * @param object - The instance to retrieve the definition for.
66
+ */
30
67
  getForInstance(object: any): TDefinition | undefined;
31
68
  }
32
69
  /**
@@ -0,0 +1 @@
1
+ export { FASTElementDefinition, fastElementRegistry, type TypeDefinition, type TypeRegistry, } from "./components/fast-definitions.js";
@@ -0,0 +1,7 @@
1
+ export type { Binding, BindingDirective } from "./binding/binding.js";
2
+ export type { Subscriber } from "./observation/notifier.js";
3
+ export type { Expression, ExpressionObserver } from "./observation/observable.js";
4
+ export type { ContentTemplate } from "./templating/html-binding-directive.js";
5
+ export type { AddViewBehaviorFactory, HTMLDirective, ViewBehavior, ViewBehaviorFactory, ViewController, } from "./templating/html-directive.js";
6
+ export { RenderBehavior, RenderDirective, render } from "./templating/render.js";
7
+ export type { CaptureType } from "./templating/template.js";
@@ -0,0 +1 @@
1
+ export { type AccessCachedPath, type CachedPath, type CachedPathCommon, type CachedPathMap, type ChildrenMap, type DefaultCachedPath, type EventCachedPath, type JSONSchema, type JSONSchemaCommon, type JSONSchemaDefinition, type RegisterPathConfig, type RepeatCachedPath, Schema, schemaRegistry, } from "./components/schema.js";
@@ -1,3 +1,3 @@
1
1
  export { reactive } from "./reactive.js";
2
- export { watch } from "./watch.js";
3
2
  export * from "./state.js";
3
+ export { watch } from "./watch.js";