@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
@@ -1530,7 +1530,7 @@
1530
1530
  },
1531
1531
  {
1532
1532
  "kind": "Content",
1533
- "text": "<T>;\n singleton<T_1 extends "
1533
+ "text": "<T>;\n singleton<T extends "
1534
1534
  },
1535
1535
  {
1536
1536
  "kind": "Reference",
@@ -1539,7 +1539,7 @@
1539
1539
  },
1540
1540
  {
1541
1541
  "kind": "Content",
1542
- "text": ">(target: T_1 & "
1542
+ "text": ">(target: T & "
1543
1543
  },
1544
1544
  {
1545
1545
  "kind": "Reference",
@@ -1557,7 +1557,7 @@
1557
1557
  },
1558
1558
  {
1559
1559
  "kind": "Content",
1560
- "text": "<T_1>>, options?: "
1560
+ "text": "<T>>, options?: "
1561
1561
  },
1562
1562
  {
1563
1563
  "kind": "Reference",
@@ -1566,7 +1566,7 @@
1566
1566
  },
1567
1567
  {
1568
1568
  "kind": "Content",
1569
- "text": "): T_1 & "
1569
+ "text": "): T & "
1570
1570
  },
1571
1571
  {
1572
1572
  "kind": "Reference",
@@ -1575,7 +1575,7 @@
1575
1575
  },
1576
1576
  {
1577
1577
  "kind": "Content",
1578
- "text": "<T_1>;\n}>"
1578
+ "text": "<T>;\n}>"
1579
1579
  }
1580
1580
  ],
1581
1581
  "fileUrlPath": "dist/dts/di/di.d.ts",
@@ -2223,7 +2223,7 @@
2223
2223
  {
2224
2224
  "kind": "PropertySignature",
2225
2225
  "canonicalReference": "@microsoft/fast-element!InterfaceConfiguration#respectConnection:member",
2226
- "docComment": "/**\n * When true, the dependency will be re-resolved when FASTElement connection changes. If the resolved value changes due to connection change, a {@link @microsoft/fast-element#Observable | notification} will be emitted for the property, with the previous and next values provided to any subscriber.\n */\n",
2226
+ "docComment": "/**\n * When true, the dependency will be re-resolved when FASTElement connection changes. If the resolved value changes due to connection change, an observable notification will be emitted for the property, with the previous and next values provided to any subscriber.\n */\n",
2227
2227
  "excerptTokens": [
2228
2228
  {
2229
2229
  "kind": "Content",
@@ -2702,7 +2702,7 @@
2702
2702
  },
2703
2703
  {
2704
2704
  "kind": "Content",
2705
- "text": "<T>;\n singleton<T_1 extends "
2705
+ "text": "<T>;\n singleton<T extends "
2706
2706
  },
2707
2707
  {
2708
2708
  "kind": "Reference",
@@ -2720,7 +2720,7 @@
2720
2720
  },
2721
2721
  {
2722
2722
  "kind": "Content",
2723
- "text": ", value: T_1): "
2723
+ "text": ", value: T): "
2724
2724
  },
2725
2725
  {
2726
2726
  "kind": "Reference",
@@ -2738,7 +2738,7 @@
2738
2738
  },
2739
2739
  {
2740
2740
  "kind": "Content",
2741
- "text": "<T_1>>;\n transient<T_2 extends "
2741
+ "text": "<T>>;\n transient<T extends "
2742
2742
  },
2743
2743
  {
2744
2744
  "kind": "Reference",
@@ -2756,7 +2756,7 @@
2756
2756
  },
2757
2757
  {
2758
2758
  "kind": "Content",
2759
- "text": ", value: T_2): "
2759
+ "text": ", value: T): "
2760
2760
  },
2761
2761
  {
2762
2762
  "kind": "Reference",
@@ -2774,7 +2774,7 @@
2774
2774
  },
2775
2775
  {
2776
2776
  "kind": "Content",
2777
- "text": "<T_2>>;\n callback<T_3>(key: "
2777
+ "text": "<T>>;\n callback<T>(key: "
2778
2778
  },
2779
2779
  {
2780
2780
  "kind": "Reference",
@@ -2792,7 +2792,7 @@
2792
2792
  },
2793
2793
  {
2794
2794
  "kind": "Content",
2795
- "text": "<T_3>): "
2795
+ "text": "<T>): "
2796
2796
  },
2797
2797
  {
2798
2798
  "kind": "Reference",
@@ -2810,7 +2810,7 @@
2810
2810
  },
2811
2811
  {
2812
2812
  "kind": "Content",
2813
- "text": "<T_3>>;\n cachedCallback<T_4>(key: "
2813
+ "text": "<T>>;\n cachedCallback<T>(key: "
2814
2814
  },
2815
2815
  {
2816
2816
  "kind": "Reference",
@@ -2828,7 +2828,7 @@
2828
2828
  },
2829
2829
  {
2830
2830
  "kind": "Content",
2831
- "text": "<T_4>): "
2831
+ "text": "<T>): "
2832
2832
  },
2833
2833
  {
2834
2834
  "kind": "Reference",
@@ -2846,7 +2846,7 @@
2846
2846
  },
2847
2847
  {
2848
2848
  "kind": "Content",
2849
- "text": "<T_4>>;\n aliasTo<T_5>(originalKey: T_5, aliasKey: "
2849
+ "text": "<T>>;\n aliasTo<T>(originalKey: T, aliasKey: "
2850
2850
  },
2851
2851
  {
2852
2852
  "kind": "Reference",
@@ -2873,7 +2873,7 @@
2873
2873
  },
2874
2874
  {
2875
2875
  "kind": "Content",
2876
- "text": "<T_5>>;\n}>"
2876
+ "text": "<T>>;\n}>"
2877
2877
  }
2878
2878
  ],
2879
2879
  "fileUrlPath": "dist/dts/di/di.d.ts",
@@ -0,0 +1,6 @@
1
+ export declare function toHTML(node: Node, preserveCommentMarkup?: boolean): string;
2
+ export declare function createTrackableDOMPolicy(): {
3
+ used: boolean;
4
+ createHTML: (html: string) => string;
5
+ protect(tagName: any, aspect: any, aspectName: any, sink: any): (node: any, aspectName: any, value: any, ...args: any[]) => void;
6
+ };
@@ -0,0 +1,2 @@
1
+ export { ArrayObserver, type LengthObserver, Sort, type SortObserver, Splice, SpliceStrategy, SpliceStrategySupport, } from "./observation/arrays.js";
2
+ export type { Notifier, Subscriber, SubscriberSet } from "./observation/notifier.js";
@@ -0,0 +1,2 @@
1
+ export { type ArrayObserver, type LengthObserver, lengthOf, Sort, type SortObserver, Splice, SpliceStrategy, SpliceStrategySupport, sortedCount, } from "./observation/arrays.js";
2
+ export type { Notifier, Subscriber, SubscriberSet } from "./observation/notifier.js";
@@ -0,0 +1 @@
1
+ export { AttributeConfiguration, AttributeDefinition, type AttributeMode, attr, booleanConverter, type DecoratorAttributeConfiguration, nullableBooleanConverter, nullableNumberConverter, type ValueConverter, } from "./components/attributes.js";
@@ -1,4 +1,5 @@
1
- import type { DOMAspect, DOMPolicy } from "../dom.js";
1
+ import type { DOMAspect } from "../dom.js";
2
+ import type { DOMPolicy } from "../dom-policy.js";
2
3
  import type { Subscriber } from "../observation/notifier.js";
3
4
  import type { Expression, ExpressionObserver } from "../observation/observable.js";
4
5
  /**
@@ -26,20 +27,29 @@ export interface BindingDirective {
26
27
  * @public
27
28
  */
28
29
  export declare abstract class Binding<TSource = any, TReturn = any, TParent = any> {
29
- evaluate: Expression<TSource, TReturn, TParent>;
30
- policy?: DOMPolicy | undefined;
31
- isVolatile: boolean;
32
30
  /**
33
31
  * Options associated with the binding.
34
32
  */
35
33
  options?: any;
34
+ /**
35
+ * Evaluates the binding.
36
+ */
37
+ evaluate: Expression<TSource, TReturn, TParent>;
38
+ /**
39
+ * The security policy to associate with this binding.
40
+ */
41
+ policy?: DOMPolicy;
42
+ /**
43
+ * Indicates whether the binding is volatile.
44
+ */
45
+ isVolatile: boolean;
36
46
  /**
37
47
  * Creates a binding.
38
48
  * @param evaluate - Evaluates the binding.
39
49
  * @param policy - The security policy to associate with this binding.
40
50
  * @param isVolatile - Indicates whether the binding is volatile.
41
51
  */
42
- constructor(evaluate: Expression<TSource, TReturn, TParent>, policy?: DOMPolicy | undefined, isVolatile?: boolean);
52
+ constructor(evaluate: Expression<TSource, TReturn, TParent>, policy?: DOMPolicy, isVolatile?: boolean);
43
53
  /**
44
54
  * Creates an observer capable of notifying a subscriber when the output of a binding changes.
45
55
  * @param subscriber - The subscriber to changes in the binding.
@@ -1,4 +1,4 @@
1
- import type { DOMPolicy } from "../dom.js";
1
+ import type { DOMPolicy } from "../dom-policy.js";
2
2
  import type { Expression } from "../observation/observable.js";
3
3
  import { Binding } from "./binding.js";
4
4
  /**
@@ -1,4 +1,4 @@
1
- import type { DOMPolicy } from "../dom.js";
1
+ import type { DOMPolicy } from "../dom-policy.js";
2
2
  import { type Expression } from "../observation/observable.js";
3
3
  import { Binding } from "./binding.js";
4
4
  /**
@@ -1,6 +1,6 @@
1
- import type { Expression } from "../observation/observable.js";
1
+ import type { DOMPolicy } from "../dom-policy.js";
2
2
  import type { Subscriber } from "../observation/notifier.js";
3
- import type { DOMPolicy } from "../dom.js";
3
+ import type { Expression } from "../observation/observable.js";
4
4
  import { Binding } from "./binding.js";
5
5
  /**
6
6
  * The gateway to signal APIs.
@@ -9,14 +9,14 @@ import { Binding } from "./binding.js";
9
9
  export declare const Signal: Readonly<{
10
10
  /**
11
11
  * Subscribes to a signal.
12
- * @param signal The signal to subscribe to.
13
- * @param subscriber The subscriber.
12
+ * @param signal - The signal to subscribe to.
13
+ * @param subscriber - The subscriber.
14
14
  */
15
15
  subscribe(signal: string, subscriber: Subscriber): void;
16
16
  /**
17
17
  * Unsubscribes from the signal.
18
- * @param signal The signal to unsubscribe from.
19
- * @param subscriber The subscriber.
18
+ * @param signal - The signal to unsubscribe from.
19
+ * @param subscriber - The subscriber.
20
20
  */
21
21
  unsubscribe(signal: string, subscriber: Subscriber): void;
22
22
  /**
@@ -1,4 +1,4 @@
1
- import type { DOMPolicy } from "../dom.js";
1
+ import type { DOMPolicy } from "../dom-policy.js";
2
2
  import { type Expression } from "../observation/observable.js";
3
3
  import { Binding, type BindingDirective } from "./binding.js";
4
4
  /**
@@ -23,6 +23,7 @@ export interface TwoWaySettings {
23
23
  }
24
24
  /**
25
25
  * Enables configuring two-way binding settings.
26
+ * @public
26
27
  */
27
28
  export declare const TwoWaySettings: Readonly<{
28
29
  /**
@@ -0,0 +1,7 @@
1
+ export { Binding, type BindingDirective } from "./binding/binding.js";
2
+ export { normalizeBinding } from "./binding/normalize.js";
3
+ export { oneTime } from "./binding/one-time.js";
4
+ export { listener, oneWay } from "./binding/one-way.js";
5
+ export type { DOMAspect, DOMPolicy } from "./dom.js";
6
+ export type { Subscriber } from "./observation/notifier.js";
7
+ export type { Expression, ExpressionObserver } from "./observation/observable.js";
@@ -16,8 +16,6 @@ export interface ValueConverter {
16
16
  */
17
17
  fromView(value: any): any;
18
18
  }
19
- declare const booleanMode = "boolean";
20
- declare const reflectMode = "reflect";
21
19
  /**
22
20
  * The mode that specifies the runtime behavior of the attribute.
23
21
  * @remarks
@@ -29,7 +27,7 @@ declare const reflectMode = "reflect";
29
27
  * changes in the DOM, but does not reflect property changes back.
30
28
  * @public
31
29
  */
32
- export type AttributeMode = typeof reflectMode | typeof booleanMode | "fromView";
30
+ export type AttributeMode = "reflect" | "boolean" | "fromView";
33
31
  /**
34
32
  * Metadata used to configure a custom attribute's behavior.
35
33
  * @public
@@ -153,4 +151,3 @@ export declare function attr(config?: DecoratorAttributeConfiguration): (target:
153
151
  * @public
154
152
  */
155
153
  export declare function attr(target: {}, prop: string): void;
156
- export {};
@@ -0,0 +1,9 @@
1
+ import type { FASTElementDefinition } from "../components/fast-definitions.js";
2
+ import type { Schema } from "./schema.js";
3
+ export interface DeclarativeSchemaTransformContext {
4
+ definition: FASTElementDefinition;
5
+ schema: Schema;
6
+ }
7
+ export type DeclarativeSchemaTransform = (context: DeclarativeSchemaTransformContext) => void;
8
+ export declare function setDefinitionSchemaTransform(definition: FASTElementDefinition, key: string, transform: DeclarativeSchemaTransform, priority: number): void;
9
+ export declare function getDefinitionSchemaTransforms(definition?: FASTElementDefinition): readonly DeclarativeSchemaTransform[];
@@ -1,4 +1,4 @@
1
- import { PropertyChangeNotifier } from "../observation/notifier.js";
1
+ import type { Notifier, Subscriber } from "../observation/notifier.js";
2
2
  import { ExecutionContext, type ExpressionController, SourceLifetime } from "../observation/observable.js";
3
3
  import { ElementStyles } from "../styles/element-styles.js";
4
4
  import type { HostBehavior, HostController } from "../styles/host.js";
@@ -6,10 +6,6 @@ import type { StyleStrategy, StyleTarget } from "../styles/style-strategy.js";
6
6
  import type { ElementViewTemplate } from "../templating/template.js";
7
7
  import type { ElementView } from "../templating/view.js";
8
8
  import { FASTElementDefinition, type ShadowRootOptions } from "./fast-definitions.js";
9
- /**
10
- * @deprecated Use the export from ./hydration.js instead.
11
- */
12
- export { deferHydrationAttribute } from "./hydration.js";
13
9
  /**
14
10
  * A type that instantiates an ElementController
15
11
  * @public
@@ -35,7 +31,11 @@ export declare const enum Stages {
35
31
  * Controls the lifecycle and rendering of a `FASTElement`.
36
32
  * @public
37
33
  */
38
- export declare class ElementController<TElement extends HTMLElement = HTMLElement> extends PropertyChangeNotifier implements HostController<TElement> {
34
+ export declare class ElementController<TElement extends HTMLElement = HTMLElement> implements Notifier, HostController<TElement> {
35
+ /**
36
+ * Internal notifier used to delegate subscriber management.
37
+ */
38
+ private _notifier;
39
39
  /**
40
40
  * A map of observable properties that were set on the element before upgrade.
41
41
  */
@@ -48,6 +48,26 @@ export declare class ElementController<TElement extends HTMLElement = HTMLElemen
48
48
  * Indicates whether the element has an existing shadow root (e.g. from declarative shadow DOM).
49
49
  */
50
50
  protected hasExistingShadowRoot: boolean;
51
+ /**
52
+ * Resolves the isPrerendered promise.
53
+ */
54
+ private _resolvePrerendered;
55
+ /**
56
+ * Resolves the isHydrated promise.
57
+ */
58
+ private _resolveHydrated;
59
+ /**
60
+ * Resolves `true` when the element had an existing shadow root
61
+ * (from SSR or declarative shadow DOM) at connect time, `false`
62
+ * otherwise.
63
+ */
64
+ readonly isPrerendered: Promise<boolean>;
65
+ /**
66
+ * Resolves `true` after prerendered content has been successfully
67
+ * hydrated, or `false` when the component is client-side rendered
68
+ * or hydration is not enabled.
69
+ */
70
+ readonly isHydrated: Promise<boolean>;
51
71
  /**
52
72
  * The template used to render the component.
53
73
  */
@@ -147,6 +167,27 @@ export declare class ElementController<TElement extends HTMLElement = HTMLElemen
147
167
  * @internal
148
168
  */
149
169
  constructor(element: TElement, definition: FASTElementDefinition);
170
+ /**
171
+ * The subject that subscribers will receive notifications for.
172
+ */
173
+ get subject(): TElement;
174
+ /**
175
+ * Notifies all subscribers of a property change.
176
+ * @param args - The property name that changed.
177
+ */
178
+ notify(args: any): void;
179
+ /**
180
+ * Subscribes to notification of changes in the element's state.
181
+ * @param subscriber - The object that is subscribing for change notification.
182
+ * @param propertyToWatch - The name of the property to watch for changes.
183
+ */
184
+ subscribe(subscriber: Subscriber, propertyToWatch?: any): void;
185
+ /**
186
+ * Unsubscribes from notification of changes in the element's state.
187
+ * @param subscriber - The object that is unsubscribing from change notification.
188
+ * @param propertyToUnwatch - The name of the property to unsubscribe from.
189
+ */
190
+ unsubscribe(subscriber: Subscriber, propertyToUnwatch?: any): void;
150
191
  /**
151
192
  * Registers an unbind handler with the controller.
152
193
  * @param behavior - An object to call when the controller unbinds.
@@ -183,6 +224,22 @@ export declare class ElementController<TElement extends HTMLElement = HTMLElemen
183
224
  * Binds any observables that were set before upgrade.
184
225
  */
185
226
  protected bindObservables(): void;
227
+ /**
228
+ * Captures own-properties that shadow observable accessors on the prototype so
229
+ * they can be rebound through the accessor before rendering.
230
+ */
231
+ protected captureBoundObservables(): void;
232
+ /**
233
+ * Synchronizes late-defined attribute-map attributes from the live DOM to the
234
+ * associated property values before the initial render occurs.
235
+ */
236
+ protected syncLateAttributes(): void;
237
+ /**
238
+ * Observes late-defined attribute-map attributes that the platform does not
239
+ * surface through attributeChangedCallback because they were added after
240
+ * customElements.define() completed.
241
+ */
242
+ protected observeLateAttributes(): void;
186
243
  /**
187
244
  * Connects any existing behaviors on the associated element.
188
245
  */
@@ -219,6 +276,11 @@ export declare class ElementController<TElement extends HTMLElement = HTMLElemen
219
276
  * If `null` is provided, any existing view will be removed.
220
277
  */
221
278
  protected renderTemplate(template: ElementViewTemplate | null | undefined): void;
279
+ /**
280
+ * Standard client-side render: clears any stale content, clones the
281
+ * compiled fragment, binds, and appends to the host.
282
+ */
283
+ private renderClientSide;
222
284
  /**
223
285
  * Locates or creates a controller for the specified element.
224
286
  * @param element - The element to return the controller for.
@@ -235,6 +297,18 @@ export declare class ElementController<TElement extends HTMLElement = HTMLElemen
235
297
  * @param strategy - The strategy to use.
236
298
  */
237
299
  static setStrategy(strategy: ElementControllerStrategy): void;
300
+ /**
301
+ * A hook that, when set, handles prerendered content hydration.
302
+ * Called by renderTemplate when an existing shadow root is detected.
303
+ * Returns true if hydration was performed, false to fall back to client-side.
304
+ * @internal
305
+ */
306
+ private static hydrationHook;
307
+ /**
308
+ * Installs the hydration hook. Called by enableHydration().
309
+ * @internal
310
+ */
311
+ static installHydrationHook(hook: (controller: ElementController, template: ElementViewTemplate, element: HTMLElement, host: Node) => boolean): void;
238
312
  }
239
313
  /**
240
314
  * https://wicg.github.io/construct-stylesheets/
@@ -260,111 +334,3 @@ export declare class StyleElementStrategy implements StyleStrategy {
260
334
  addStylesTo(target: StyleTarget): void;
261
335
  removeStylesFrom(target: StyleTarget): void;
262
336
  }
263
- /**
264
- * The attribute used to indicate that an element needs hydration.
265
- * @public
266
- */
267
- export declare const needsHydrationAttribute = "needs-hydration";
268
- /**
269
- * Lifecycle callbacks for element hydration events
270
- * @public
271
- */
272
- export interface HydrationControllerCallbacks<TElement extends HTMLElement = HTMLElement> {
273
- /**
274
- * Called once when the first element enters the hydration pipeline.
275
- * This is the earliest point at which we know a component has been
276
- * async-defined with `defer-and-hydrate`, a template is pending via
277
- * `<f-template>`, and the element has `needs-hydration`.
278
- */
279
- hydrationStarted?(): void;
280
- /**
281
- * Called before an individual element's hydration begins
282
- */
283
- elementWillHydrate?(source: TElement): void;
284
- /**
285
- * Called after an individual element's hydration has finished
286
- */
287
- elementDidHydrate?(source: TElement): void;
288
- /**
289
- * Called after all elements have completed hydration
290
- */
291
- hydrationComplete?(): void;
292
- }
293
- /**
294
- * An ElementController capable of hydrating FAST elements from
295
- * Declarative Shadow DOM.
296
- *
297
- * @beta
298
- */
299
- export declare class HydratableElementController<TElement extends HTMLElement = HTMLElement> extends ElementController<TElement> {
300
- /**
301
- * Controls whether the controller will hydrate during the connect() method.
302
- * Initialized during the first connect() call to true when the `needs-hydration`
303
- * attribute is present on the element.
304
- */
305
- protected needsHydration?: boolean;
306
- private static hydrationObserver;
307
- /**
308
- * {@inheritdoc ElementController.shadowOptions}
309
- */
310
- get shadowOptions(): ShadowRootOptions | undefined;
311
- set shadowOptions(value: ShadowRootOptions | undefined);
312
- /**
313
- * Lifecycle callbacks for hydration events
314
- */
315
- static lifecycleCallbacks: HydrationControllerCallbacks;
316
- /**
317
- * Whether the hydrationStarted callback has already been invoked.
318
- */
319
- private static hydrationStarted;
320
- /**
321
- * An idle callback ID used to track hydration completion
322
- */
323
- private static idleCallbackId;
324
- /**
325
- * Adds the current element instance to the hydrating instances map
326
- */
327
- private addHydratingInstance;
328
- /**
329
- * Configure lifecycle callbacks for hydration events
330
- */
331
- static config(callbacks: HydrationControllerCallbacks): typeof HydratableElementController;
332
- private static hydrationObserverHandler;
333
- /**
334
- * Checks to see if hydration is complete and if so, invokes the hydrationComplete callback.
335
- * Then resets the ElementController strategy to the default so that future elements
336
- * don't use the HydratableElementController.
337
- *
338
- * @param deadline - the idle deadline object
339
- */
340
- private static checkHydrationComplete;
341
- /**
342
- * Runs connected lifecycle behavior on the associated element.
343
- */
344
- connect(): void;
345
- /**
346
- * A map of element instances by the name of the custom element they are
347
- * associated with. The key is the custom element name, and the value is the
348
- * instances of hydratable elements which currently need to be hydrated.
349
- *
350
- * When all of the instances in the set have been hydrated, the set is
351
- * cleared and removed from the map. If the map is empty, the
352
- * hydrationComplete callback is invoked.
353
- */
354
- private static hydratingInstances?;
355
- /**
356
- * Removes the current element instance from the hydrating instances map
357
- */
358
- private removeHydratingInstance;
359
- /**
360
- * Unregisters the hydration observer when the element is disconnected.
361
- */
362
- disconnect(): void;
363
- /**
364
- * Sets the ElementController strategy to HydratableElementController.
365
- * @remarks
366
- * This method is typically called during application startup to enable
367
- * hydration support for FAST elements.
368
- */
369
- static install(): void;
370
- }
@@ -1,2 +1,2 @@
1
- export { HydratableElementController } from "./element-controller.js";
1
+ export { ElementController } from "./element-controller.js";
2
2
  export * from "./hydration.js";
@@ -0,0 +1,54 @@
1
+ import { type HydrationOptions } from "./hydration-tracker.js";
2
+ export { StopHydration } from "./hydration-tracker.js";
3
+ export type { HydrationOptions };
4
+ /**
5
+ * Enables hydration support for prerendered FAST elements.
6
+ *
7
+ * @remarks
8
+ * Call this before any FAST elements connect to the DOM. Hydration
9
+ * logic is not active unless this function is called, keeping
10
+ * `FASTElement` lightweight for client-side-only applications.
11
+ *
12
+ * Safe to call multiple times — the hydration hook is installed once
13
+ * and subsequent calls merge their options into the shared tracker.
14
+ * By default, the hook stops hydrating new prerendered elements after
15
+ * the global `hydrationComplete` callback. Set
16
+ * `stopHydration` to `StopHydration.never` for streaming scenarios
17
+ * that append hydratable Declarative Shadow DOM after the initial batch.
18
+ *
19
+ * Pass `debugger: hydrationDebugger()` to swap the default minimal
20
+ * hydration mismatch error message for a rich "Expected / Received"
21
+ * report including the SSR HTML snippet and structured
22
+ * `expected`/`received` fields on `HydrationBindingError` /
23
+ * `HydrationTargetElementError`. The debugger module is tree-shaken
24
+ * out of production hydration bundles unless explicitly imported.
25
+ *
26
+ * @example
27
+ * ```ts
28
+ * import { enableHydration, StopHydration } from "@microsoft/fast-element/hydration.js";
29
+ *
30
+ * enableHydration({
31
+ * stopHydration: StopHydration.never,
32
+ * hydrationComplete() {
33
+ * console.log("hydration complete");
34
+ * },
35
+ * });
36
+ * ```
37
+ *
38
+ * @example Rich hydration mismatch diagnostics
39
+ * ```ts
40
+ * import { enableHydration, hydrationDebugger } from "@microsoft/fast-element/hydration.js";
41
+ *
42
+ * enableHydration({ debugger: hydrationDebugger() });
43
+ * ```
44
+ *
45
+ * @param options - Optional global hydration callbacks and behavior.
46
+ * @public
47
+ */
48
+ export declare function enableHydration(options?: HydrationOptions): void;
49
+ /**
50
+ * The attribute used to defer hydration of an element.
51
+ * Retained for intersection observer viewport hydration rendering.
52
+ * @beta
53
+ */
54
+ export declare const deferHydrationAttribute = "defer-hydration";