@microsoft/fast-element 3.0.0-rc.1 → 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 (286) hide show
  1. package/CHANGELOG.md +51 -1
  2. package/README.md +50 -14
  3. package/dist/context/context.api.json +13 -13
  4. package/dist/declarative/declarative.api.json +654 -15
  5. package/dist/di/di.api.json +15 -15
  6. package/dist/dts/__test__/helpers.d.ts +6 -0
  7. package/dist/dts/__test__/setup-node.d.ts +0 -0
  8. package/dist/dts/binding/binding.d.ts +15 -5
  9. package/dist/dts/binding/one-time.d.ts +1 -1
  10. package/dist/dts/binding/one-way.d.ts +1 -1
  11. package/dist/dts/binding/signal.d.ts +1 -1
  12. package/dist/dts/binding/two-way.d.ts +1 -1
  13. package/dist/dts/components/attributes.d.ts +1 -1
  14. package/dist/dts/components/enable-hydration.d.ts +22 -2
  15. package/dist/dts/components/fast-definitions.d.ts +7 -4
  16. package/dist/dts/components/fast-element.d.ts +42 -12
  17. package/dist/dts/components/hydration-tracker.d.ts +47 -4
  18. package/dist/dts/components/hydration.d.ts +5 -0
  19. package/dist/dts/context.d.ts +7 -7
  20. package/dist/dts/declarative/debug.d.ts +2 -3
  21. package/dist/dts/declarative/index.d.ts +3 -2
  22. package/dist/dts/declarative/interfaces.d.ts +1 -2
  23. package/dist/dts/declarative/template.d.ts +2 -1
  24. package/dist/dts/declarative/utilities.d.ts +50 -4
  25. package/dist/dts/di/di.d.ts +6 -6
  26. package/dist/dts/dom-policy.d.ts +22 -4
  27. package/dist/dts/dom.d.ts +4 -16
  28. package/dist/dts/hydration/diagnostics.d.ts +93 -0
  29. package/dist/dts/hydration/hydration-debugger.d.ts +35 -0
  30. package/dist/dts/hydration/messages.d.ts +62 -0
  31. package/dist/dts/hydration/target-builder.d.ts +26 -1
  32. package/dist/dts/hydration.d.ts +7 -3
  33. package/dist/dts/index.d.ts +7 -3
  34. package/dist/dts/interfaces.d.ts +1 -0
  35. package/dist/dts/observation/observable.d.ts +3 -3
  36. package/dist/dts/platform.d.ts +20 -4
  37. package/dist/dts/registry.d.ts +1 -0
  38. package/dist/dts/templating/children.d.ts +1 -1
  39. package/dist/dts/templating/compiler.d.ts +1 -1
  40. package/dist/dts/templating/html-binding-directive.d.ts +6 -2
  41. package/dist/dts/templating/html-directive.d.ts +2 -1
  42. package/dist/dts/templating/hydration-view.d.ts +24 -3
  43. package/dist/dts/templating/ref.d.ts +1 -1
  44. package/dist/dts/templating/render.d.ts +2 -2
  45. package/dist/dts/templating/repeat.d.ts +1 -1
  46. package/dist/dts/templating/slotted.d.ts +1 -1
  47. package/dist/dts/templating/template.d.ts +5 -5
  48. package/dist/dts/templating/when.d.ts +1 -1
  49. package/dist/dts/testing/fakes.d.ts +4 -4
  50. package/dist/esm/__test__/helpers.js +22 -0
  51. package/dist/esm/__test__/setup-node.js +18 -0
  52. package/dist/esm/binding/two-way.js +1 -2
  53. package/dist/esm/components/attributes.js +12 -8
  54. package/dist/esm/components/element-controller.js +11 -6
  55. package/dist/esm/components/enable-hydration.js +27 -3
  56. package/dist/esm/components/fast-definitions.js +19 -18
  57. package/dist/esm/components/hydration-tracker.js +34 -5
  58. package/dist/esm/components/hydration.js +85 -6
  59. package/dist/esm/debug.js +1 -0
  60. package/dist/esm/declarative/attribute-map.js +2 -1
  61. package/dist/esm/declarative/debug.js +0 -1
  62. package/dist/esm/declarative/index.js +1 -0
  63. package/dist/esm/declarative/interfaces.js +0 -1
  64. package/dist/esm/declarative/observer-map-utilities.js +58 -55
  65. package/dist/esm/declarative/template-bridge.js +4 -14
  66. package/dist/esm/declarative/template.js +4 -3
  67. package/dist/esm/declarative/utilities.js +236 -1
  68. package/dist/esm/di/di.js +2 -1
  69. package/dist/esm/dom-policy.js +33 -4
  70. package/dist/esm/hydration/diagnostics.js +50 -0
  71. package/dist/esm/hydration/hydration-debugger.js +112 -0
  72. package/dist/esm/hydration/messages.js +84 -0
  73. package/dist/esm/hydration/target-builder.js +65 -19
  74. package/dist/esm/hydration.js +3 -1
  75. package/dist/esm/index.js +6 -2
  76. package/dist/esm/interfaces.js +1 -0
  77. package/dist/esm/metadata.js +2 -8
  78. package/dist/esm/observation/notifier.js +2 -4
  79. package/dist/esm/registry.js +1 -0
  80. package/dist/esm/templating/html-binding-directive.js +1 -1
  81. package/dist/esm/templating/hydration-view.js +20 -27
  82. package/dist/esm/templating/render.js +39 -18
  83. package/dist/esm/templating/repeat.js +51 -17
  84. package/dist/esm/templating/view.js +1 -1
  85. package/dist/esm/testing/fixture.js +2 -2
  86. package/dist/esm/testing/timeout.js +2 -2
  87. package/dist/fast-element.api.json +1329 -99
  88. package/dist/fast-element.d.ts +147 -66
  89. package/dist/fast-element.debug.js +392 -99
  90. package/dist/fast-element.debug.min.js +2 -2
  91. package/dist/fast-element.js +392 -99
  92. package/dist/fast-element.min.js +2 -2
  93. package/dist/fast-element.untrimmed.d.ts +133 -70
  94. package/dist/hydration/hydration.api.json +1280 -57
  95. package/dist/styles/styles.api.json +1 -1
  96. package/package.json +21 -9
  97. package/ARCHITECTURE_FASTELEMENT.md +0 -63
  98. package/ARCHITECTURE_HTML_TAGGED_TEMPLATE_LITERAL.md +0 -36
  99. package/ARCHITECTURE_INTRO.md +0 -10
  100. package/ARCHITECTURE_OVERVIEW.md +0 -52
  101. package/ARCHITECTURE_UPDATES.md +0 -11
  102. package/CHANGELOG.json +0 -2275
  103. package/DECLARATIVE_DESIGN.md +0 -806
  104. package/DECLARATIVE_HTML.md +0 -470
  105. package/DECLARATIVE_MIGRATION.md +0 -215
  106. package/DECLARATIVE_RENDERING.md +0 -530
  107. package/DECLARATIVE_RENDERING_LIFECYCLE.md +0 -288
  108. package/DECLARATIVE_SCHEMA_OBSERVER_MAP.md +0 -489
  109. package/DESIGN.md +0 -615
  110. package/MIGRATION.md +0 -387
  111. package/SIZES.md +0 -25
  112. package/api-extractor.arrays.json +0 -15
  113. package/api-extractor.context.json +0 -15
  114. package/api-extractor.declarative.json +0 -15
  115. package/api-extractor.di.json +0 -15
  116. package/api-extractor.hydration.json +0 -15
  117. package/api-extractor.styles.json +0 -15
  118. package/biome.json +0 -4
  119. package/docs/ACKNOWLEDGEMENTS.md +0 -12
  120. package/docs/api-report.api.md +0 -1299
  121. package/docs/arrays/api-report.api.md +0 -114
  122. package/docs/context/api-report.api.md +0 -69
  123. package/docs/declarative/api-report.api.md +0 -397
  124. package/docs/di/api-report.api.md +0 -315
  125. package/docs/fast-element-2-changes.md +0 -15
  126. package/docs/hydration/api-report.api.md +0 -285
  127. package/docs/styles/api-report.api.md +0 -135
  128. package/playwright.config.ts +0 -26
  129. package/playwright.declarative.config.ts +0 -26
  130. package/playwright.declarative.webui.config.ts +0 -20
  131. package/scripts/declarative/build-fixtures-with-webui.js +0 -135
  132. package/scripts/declarative/build-fixtures.js +0 -49
  133. package/scripts/declarative/build-fixtures.utilities.js +0 -101
  134. package/scripts/measure-sizes.js +0 -219
  135. package/scripts/run-api-extractor.js +0 -70
  136. package/test/declarative/fixtures/README.md +0 -72
  137. package/test/declarative/fixtures/WRITING_FIXTURES.md +0 -330
  138. package/test/declarative/fixtures/bindings/README.md +0 -12
  139. package/test/declarative/fixtures/bindings/attribute/entry.html +0 -13
  140. package/test/declarative/fixtures/bindings/attribute/fast-build.config.json +0 -6
  141. package/test/declarative/fixtures/bindings/attribute/index.html +0 -25
  142. package/test/declarative/fixtures/bindings/attribute/main.ts +0 -41
  143. package/test/declarative/fixtures/bindings/attribute/state.json +0 -8
  144. package/test/declarative/fixtures/bindings/attribute/templates.html +0 -11
  145. package/test/declarative/fixtures/bindings/content/entry.html +0 -12
  146. package/test/declarative/fixtures/bindings/content/fast-build.config.json +0 -6
  147. package/test/declarative/fixtures/bindings/content/index.html +0 -19
  148. package/test/declarative/fixtures/bindings/content/main.ts +0 -27
  149. package/test/declarative/fixtures/bindings/content/state.json +0 -4
  150. package/test/declarative/fixtures/bindings/content/templates.html +0 -6
  151. package/test/declarative/fixtures/bindings/dot-syntax/entry.html +0 -11
  152. package/test/declarative/fixtures/bindings/dot-syntax/fast-build.config.json +0 -6
  153. package/test/declarative/fixtures/bindings/dot-syntax/index.html +0 -47
  154. package/test/declarative/fixtures/bindings/dot-syntax/main.ts +0 -59
  155. package/test/declarative/fixtures/bindings/dot-syntax/state.json +0 -16
  156. package/test/declarative/fixtures/bindings/dot-syntax/templates.html +0 -17
  157. package/test/declarative/fixtures/bindings/event/entry.html +0 -11
  158. package/test/declarative/fixtures/bindings/event/fast-build.config.json +0 -6
  159. package/test/declarative/fixtures/bindings/event/index.html +0 -43
  160. package/test/declarative/fixtures/bindings/event/main.ts +0 -43
  161. package/test/declarative/fixtures/bindings/event/state.json +0 -3
  162. package/test/declarative/fixtures/bindings/event/templates.html +0 -18
  163. package/test/declarative/fixtures/bindings/host/entry.html +0 -40
  164. package/test/declarative/fixtures/bindings/host/fast-build.config.json +0 -6
  165. package/test/declarative/fixtures/bindings/host/index.html +0 -96
  166. package/test/declarative/fixtures/bindings/host/main.ts +0 -222
  167. package/test/declarative/fixtures/bindings/host/state.json +0 -9
  168. package/test/declarative/fixtures/bindings/host/templates.html +0 -55
  169. package/test/declarative/fixtures/directives/README.md +0 -12
  170. package/test/declarative/fixtures/directives/children/entry.html +0 -11
  171. package/test/declarative/fixtures/directives/children/fast-build.config.json +0 -6
  172. package/test/declarative/fixtures/directives/children/index.html +0 -15
  173. package/test/declarative/fixtures/directives/children/main.ts +0 -22
  174. package/test/declarative/fixtures/directives/children/state.json +0 -3
  175. package/test/declarative/fixtures/directives/children/templates.html +0 -3
  176. package/test/declarative/fixtures/directives/ref/entry.html +0 -11
  177. package/test/declarative/fixtures/directives/ref/fast-build.config.json +0 -6
  178. package/test/declarative/fixtures/directives/ref/index.html +0 -15
  179. package/test/declarative/fixtures/directives/ref/main.ts +0 -17
  180. package/test/declarative/fixtures/directives/ref/state.json +0 -1
  181. package/test/declarative/fixtures/directives/ref/templates.html +0 -3
  182. package/test/declarative/fixtures/directives/repeat/entry.html +0 -21
  183. package/test/declarative/fixtures/directives/repeat/fast-build.config.json +0 -6
  184. package/test/declarative/fixtures/directives/repeat/index.html +0 -133
  185. package/test/declarative/fixtures/directives/repeat/main.ts +0 -110
  186. package/test/declarative/fixtures/directives/repeat/sprites.svg +0 -8
  187. package/test/declarative/fixtures/directives/repeat/state.json +0 -10
  188. package/test/declarative/fixtures/directives/repeat/templates.html +0 -75
  189. package/test/declarative/fixtures/directives/slotted/entry.html +0 -17
  190. package/test/declarative/fixtures/directives/slotted/fast-build.config.json +0 -6
  191. package/test/declarative/fixtures/directives/slotted/index.html +0 -27
  192. package/test/declarative/fixtures/directives/slotted/main.ts +0 -29
  193. package/test/declarative/fixtures/directives/slotted/state.json +0 -1
  194. package/test/declarative/fixtures/directives/slotted/templates.html +0 -7
  195. package/test/declarative/fixtures/directives/when/entry.html +0 -51
  196. package/test/declarative/fixtures/directives/when/fast-build.config.json +0 -6
  197. package/test/declarative/fixtures/directives/when/index.html +0 -136
  198. package/test/declarative/fixtures/directives/when/main.ts +0 -172
  199. package/test/declarative/fixtures/directives/when/state.json +0 -12
  200. package/test/declarative/fixtures/directives/when/templates.html +0 -75
  201. package/test/declarative/fixtures/ecosystem/README.md +0 -11
  202. package/test/declarative/fixtures/ecosystem/declarative-no-hydration/entry.html +0 -12
  203. package/test/declarative/fixtures/ecosystem/declarative-no-hydration/fast-build.config.json +0 -6
  204. package/test/declarative/fixtures/ecosystem/declarative-no-hydration/index.html +0 -20
  205. package/test/declarative/fixtures/ecosystem/declarative-no-hydration/main.ts +0 -68
  206. package/test/declarative/fixtures/ecosystem/declarative-no-hydration/state.json +0 -4
  207. package/test/declarative/fixtures/ecosystem/declarative-no-hydration/templates.html +0 -7
  208. package/test/declarative/fixtures/ecosystem/errors/entry.html +0 -12
  209. package/test/declarative/fixtures/ecosystem/errors/fast-build.config.json +0 -6
  210. package/test/declarative/fixtures/ecosystem/errors/index.html +0 -20
  211. package/test/declarative/fixtures/ecosystem/errors/main.ts +0 -17
  212. package/test/declarative/fixtures/ecosystem/errors/state.json +0 -1
  213. package/test/declarative/fixtures/ecosystem/errors/templates.html +0 -7
  214. package/test/declarative/fixtures/ecosystem/lifecycle-callbacks/entry.html +0 -17
  215. package/test/declarative/fixtures/ecosystem/lifecycle-callbacks/fast-build.config.json +0 -6
  216. package/test/declarative/fixtures/ecosystem/lifecycle-callbacks/index.html +0 -56
  217. package/test/declarative/fixtures/ecosystem/lifecycle-callbacks/main.ts +0 -134
  218. package/test/declarative/fixtures/ecosystem/lifecycle-callbacks/state.json +0 -12
  219. package/test/declarative/fixtures/ecosystem/lifecycle-callbacks/templates.html +0 -34
  220. package/test/declarative/fixtures/ecosystem/performance-metrics/entry.html +0 -25
  221. package/test/declarative/fixtures/ecosystem/performance-metrics/fast-build.config.json +0 -6
  222. package/test/declarative/fixtures/ecosystem/performance-metrics/fast-card.css +0 -10
  223. package/test/declarative/fixtures/ecosystem/performance-metrics/index.html +0 -181
  224. package/test/declarative/fixtures/ecosystem/performance-metrics/main.ts +0 -58
  225. package/test/declarative/fixtures/ecosystem/performance-metrics/state.json +0 -6
  226. package/test/declarative/fixtures/ecosystem/performance-metrics/templates.html +0 -15
  227. package/test/declarative/fixtures/extensions/README.md +0 -15
  228. package/test/declarative/fixtures/extensions/attribute-map/entry.html +0 -14
  229. package/test/declarative/fixtures/extensions/attribute-map/fast-build.config.json +0 -6
  230. package/test/declarative/fixtures/extensions/attribute-map/index.html +0 -31
  231. package/test/declarative/fixtures/extensions/attribute-map/main.ts +0 -40
  232. package/test/declarative/fixtures/extensions/attribute-map/state.json +0 -4
  233. package/test/declarative/fixtures/extensions/attribute-map/templates.html +0 -14
  234. package/test/declarative/fixtures/extensions/attribute-map-naming-strategy/entry.html +0 -12
  235. package/test/declarative/fixtures/extensions/attribute-map-naming-strategy/fast-build.config.json +0 -7
  236. package/test/declarative/fixtures/extensions/attribute-map-naming-strategy/index.html +0 -25
  237. package/test/declarative/fixtures/extensions/attribute-map-naming-strategy/main.ts +0 -31
  238. package/test/declarative/fixtures/extensions/attribute-map-naming-strategy/state.json +0 -5
  239. package/test/declarative/fixtures/extensions/attribute-map-naming-strategy/templates.html +0 -11
  240. package/test/declarative/fixtures/extensions/attribute-map-naming-strategy-camel-case/entry.html +0 -13
  241. package/test/declarative/fixtures/extensions/attribute-map-naming-strategy-camel-case/fast-build.config.json +0 -7
  242. package/test/declarative/fixtures/extensions/attribute-map-naming-strategy-camel-case/index.html +0 -23
  243. package/test/declarative/fixtures/extensions/attribute-map-naming-strategy-camel-case/main.ts +0 -37
  244. package/test/declarative/fixtures/extensions/attribute-map-naming-strategy-camel-case/state.json +0 -1
  245. package/test/declarative/fixtures/extensions/attribute-map-naming-strategy-camel-case/templates.html +0 -9
  246. package/test/declarative/fixtures/extensions/observer-map/entry.html +0 -15
  247. package/test/declarative/fixtures/extensions/observer-map/fast-build.config.json +0 -6
  248. package/test/declarative/fixtures/extensions/observer-map/index.html +0 -442
  249. package/test/declarative/fixtures/extensions/observer-map/main.ts +0 -482
  250. package/test/declarative/fixtures/extensions/observer-map/state.json +0 -158
  251. package/test/declarative/fixtures/extensions/observer-map/templates.html +0 -172
  252. package/test/declarative/fixtures/extensions/observer-map-config-object/entry.html +0 -16
  253. package/test/declarative/fixtures/extensions/observer-map-config-object/fast-build.config.json +0 -6
  254. package/test/declarative/fixtures/extensions/observer-map-config-object/index.html +0 -27
  255. package/test/declarative/fixtures/extensions/observer-map-config-object/main.ts +0 -53
  256. package/test/declarative/fixtures/extensions/observer-map-config-object/state.json +0 -9
  257. package/test/declarative/fixtures/extensions/observer-map-config-object/templates.html +0 -12
  258. package/test/declarative/fixtures/extensions/observer-map-deep-merge/README.md +0 -98
  259. package/test/declarative/fixtures/extensions/observer-map-deep-merge/entry.html +0 -156
  260. package/test/declarative/fixtures/extensions/observer-map-deep-merge/fast-build.config.json +0 -6
  261. package/test/declarative/fixtures/extensions/observer-map-deep-merge/index.html +0 -376
  262. package/test/declarative/fixtures/extensions/observer-map-deep-merge/main.ts +0 -366
  263. package/test/declarative/fixtures/extensions/observer-map-deep-merge/state.json +0 -69
  264. package/test/declarative/fixtures/extensions/observer-map-deep-merge/templates.html +0 -91
  265. package/test/declarative/fixtures/extensions/observer-map-properties/entry.html +0 -14
  266. package/test/declarative/fixtures/extensions/observer-map-properties/fast-build.config.json +0 -6
  267. package/test/declarative/fixtures/extensions/observer-map-properties/index.html +0 -110
  268. package/test/declarative/fixtures/extensions/observer-map-properties/main.ts +0 -175
  269. package/test/declarative/fixtures/extensions/observer-map-properties/state.json +0 -29
  270. package/test/declarative/fixtures/extensions/observer-map-properties/templates.html +0 -55
  271. package/test/declarative/fixtures/scenarios/README.md +0 -7
  272. package/test/declarative/fixtures/scenarios/nested-elements/entry.html +0 -16
  273. package/test/declarative/fixtures/scenarios/nested-elements/fast-build.config.json +0 -6
  274. package/test/declarative/fixtures/scenarios/nested-elements/index.html +0 -126
  275. package/test/declarative/fixtures/scenarios/nested-elements/main.ts +0 -214
  276. package/test/declarative/fixtures/scenarios/nested-elements/state.json +0 -10
  277. package/test/declarative/fixtures/scenarios/nested-elements/templates.html +0 -54
  278. package/test/declarative/index.html +0 -12
  279. package/test/declarative/vite.config.ts +0 -55
  280. package/test/declarative-main.ts +0 -6
  281. package/test/extension-subpaths-main.ts +0 -9
  282. package/test/index.html +0 -11
  283. package/test/main.ts +0 -109
  284. package/test/pure-declarative-main.ts +0 -1
  285. package/test/vite.config.ts +0 -19
  286. package/tsconfig.api-extractor.json +0 -6
@@ -35,4 +35,4 @@ export declare class SlottedDirective extends NodeObservationDirective<SlottedDi
35
35
  * @param propertyOrOptions - The options used to configure slotted node observation.
36
36
  * @public
37
37
  */
38
- export declare function slotted<TSource = any>(propertyOrOptions: (keyof TSource & string) | SlottedDirectiveOptions<keyof TSource & string>): CaptureType;
38
+ export declare function slotted<TSource = any, TParent = any>(propertyOrOptions: (keyof TSource & string) | SlottedDirectiveOptions<keyof TSource & string>): CaptureType<TSource, TParent>;
@@ -1,5 +1,5 @@
1
1
  import { Binding } from "../binding/binding.js";
2
- import type { DOMPolicy } from "../dom.js";
2
+ import type { DOMPolicy } from "../dom-policy.js";
3
3
  import type { Expression } from "../observation/observable.js";
4
4
  import { type AddViewBehaviorFactory, type CompiledViewBehaviorFactory, HTMLDirective, type ViewBehaviorFactory } from "./html-directive.js";
5
5
  import type { ElementView, HTMLView, SyntheticView } from "./view.js";
@@ -34,7 +34,7 @@ export interface HydratableElementViewTemplate<TSource = any, TParent = any> ext
34
34
  * into templates.
35
35
  * @public
36
36
  */
37
- export interface CaptureType {
37
+ export interface CaptureType<TSource = any, TParent = any> {
38
38
  }
39
39
  /**
40
40
  * A template capable of rendering views not specifically connected to custom elements.
@@ -48,7 +48,7 @@ export interface SyntheticViewTemplate<TSource = any, TParent = any> {
48
48
  /**
49
49
  * Returns a directive that can inline the template.
50
50
  */
51
- inline(): CaptureType;
51
+ inline(): CaptureType<TSource, TParent>;
52
52
  }
53
53
  /**
54
54
  * A template capable of hydrating a synthetic view from existing DOM nodes.
@@ -73,7 +73,7 @@ export interface HTMLTemplateCompilationResult<TSource = any, TParent = any> {
73
73
  * Represents the types of values that can be interpolated into a template.
74
74
  * @public
75
75
  */
76
- export type TemplateValue<TSource, TParent = any> = Expression<TSource, any, TParent> | Binding<TSource, any, TParent> | HTMLDirective | CaptureType;
76
+ export type TemplateValue<TSource, TParent = any> = Expression<TSource, any, TParent> | Binding<TSource, any, TParent> | HTMLDirective | CaptureType<TSource, TParent>;
77
77
  /**
78
78
  * Inlines a template into another template.
79
79
  * @public
@@ -126,7 +126,7 @@ export declare class ViewTemplate<TSource = any, TParent = any> implements Eleme
126
126
  /**
127
127
  * Returns a directive that can inline the template.
128
128
  */
129
- inline(): CaptureType;
129
+ inline(): CaptureType<TSource, TParent>;
130
130
  /**
131
131
  * Sets the DOMPolicy for this template.
132
132
  * @param policy - The policy to associated with this template.
@@ -9,4 +9,4 @@ import type { CaptureType, SyntheticViewTemplate } from "./template.js";
9
9
  * gets the template to render when the conditional is false.
10
10
  * @public
11
11
  */
12
- export declare function when<TSource = any, TReturn = any, TParent = any>(condition: Expression<TSource, TReturn, TParent> | boolean, templateOrTemplateBinding: SyntheticViewTemplate<TSource, TParent> | Expression<TSource, SyntheticViewTemplate<TSource, TParent>, TParent>, elseTemplateOrTemplateBinding?: SyntheticViewTemplate<TSource, TParent> | Expression<TSource, SyntheticViewTemplate<TSource, TParent>, TParent>): CaptureType;
12
+ export declare function when<TSource = any, TReturn = any, TParent = any>(condition: Expression<TSource, TReturn, TParent> | boolean, templateOrTemplateBinding: SyntheticViewTemplate<TSource, TParent> | Expression<TSource, SyntheticViewTemplate<TSource, TParent>, TParent>, elseTemplateOrTemplateBinding?: SyntheticViewTemplate<TSource, TParent> | Expression<TSource, SyntheticViewTemplate<TSource, TParent>, TParent>): CaptureType<TSource, TParent>;
@@ -1,15 +1,15 @@
1
1
  import { ExecutionContext } from "../observation/observable.js";
2
2
  import type { ViewBehavior, ViewBehaviorTargets } from "../templating/html-directive.js";
3
3
  export declare const Fake: Readonly<{
4
- executionContext<TParent = any>(parent?: TParent | undefined, parentContext?: ExecutionContext<TParent> | undefined): ExecutionContext<TParent>;
5
- viewController<TSource = any, TParent_1 = any>(targets?: ViewBehaviorTargets, ...behaviors: ViewBehavior<TSource, TParent_1>[]): {
4
+ executionContext<TParent = any>(parent?: TParent, parentContext?: ExecutionContext<TParent>): ExecutionContext<TParent>;
5
+ viewController<TSource = any, TParent = any>(targets?: ViewBehaviorTargets, ...behaviors: ViewBehavior<TSource, TParent>[]): {
6
6
  isBound: boolean;
7
- context: ExecutionContext<TParent_1>;
7
+ context: ExecutionContext<TParent>;
8
8
  onUnbind(object: any): void;
9
9
  source: TSource;
10
10
  targets: ViewBehaviorTargets;
11
11
  toJSON: () => undefined;
12
- bind(source: TSource, context?: ExecutionContext<TParent_1>): void;
12
+ bind(source: TSource, context?: ExecutionContext<TParent>): void;
13
13
  unbind(): void;
14
14
  };
15
15
  }>;
@@ -0,0 +1,22 @@
1
+ export function toHTML(node, preserveCommentMarkup = false) {
2
+ return Array.from(node.childNodes)
3
+ .map((x) => {
4
+ if (preserveCommentMarkup && x.nodeType === 8) {
5
+ return `<!--${x.textContent}-->`;
6
+ }
7
+ return x.outerHTML || x.textContent;
8
+ })
9
+ .join("");
10
+ }
11
+ export function createTrackableDOMPolicy() {
12
+ return {
13
+ used: false,
14
+ createHTML: (html) => html,
15
+ protect(tagName, aspect, aspectName, sink) {
16
+ return (node, aspectName, value, ...args) => {
17
+ this.used = true;
18
+ sink(node, aspectName, value, ...args);
19
+ };
20
+ },
21
+ };
22
+ }
@@ -0,0 +1,18 @@
1
+ "use strict";
2
+ /* eslint-disable */
3
+ if (window.document && !window.document.createRange) {
4
+ window.document.createRange = () => ({
5
+ setStart: () => { },
6
+ setEnd: () => { },
7
+ // @ts-ignore
8
+ commonAncestorContainer: {
9
+ nodeName: "BODY",
10
+ ownerDocument: document,
11
+ },
12
+ });
13
+ }
14
+ if (!window.requestAnimationFrame) {
15
+ window.requestAnimationFrame = function (callback) {
16
+ return setTimeout(callback, 4);
17
+ };
18
+ }
@@ -34,8 +34,7 @@ class TwoWayObserver {
34
34
  bind(controller) {
35
35
  var _a;
36
36
  if (!this.changeEvent) {
37
- this.changeEvent =
38
- (_a = this.dataBinding.options.changeEvent) !== null && _a !== void 0 ? _a : twoWaySettings.determineChangeEvent(this.directive, this.target);
37
+ this.changeEvent = (_a = this.dataBinding.options.changeEvent) !== null && _a !== void 0 ? _a : twoWaySettings.determineChangeEvent(this.directive, this.target);
39
38
  }
40
39
  if (this.isNotBound) {
41
40
  this.target.addEventListener(this.changeEvent, this);
@@ -23,14 +23,10 @@ export const AttributeConfiguration = Object.freeze({
23
23
  */
24
24
  export const booleanConverter = {
25
25
  toView(value) {
26
- return value ? "true" : "false";
26
+ return value ? "" : null;
27
27
  },
28
28
  fromView(value) {
29
- return !(value === null ||
30
- value === void 0 ||
31
- value === "false" ||
32
- value === false ||
33
- value === 0);
29
+ return !!value;
34
30
  },
35
31
  };
36
32
  /**
@@ -70,7 +66,7 @@ export const nullableNumberConverter = {
70
66
  fromView: toNumber,
71
67
  };
72
68
  /**
73
- * An implementation of `Accessor` that supports reactivity,
69
+ * An implementation of {@link Accessor} that supports reactivity,
74
70
  * change callbacks, attribute reflection, and type conversion for
75
71
  * custom elements.
76
72
  * @public
@@ -133,7 +129,15 @@ export class AttributeDefinition {
133
129
  return;
134
130
  }
135
131
  this.guards.add(element);
136
- this.setValue(element, value);
132
+ if (this.mode === booleanMode) {
133
+ // Native HTML boolean attribute semantics: presence of the attribute
134
+ // (any string value, including "") means `true`; `null` (the value
135
+ // passed by the platform on `removeAttribute`) means `false`.
136
+ this.setValue(element, value !== null);
137
+ }
138
+ else {
139
+ this.setValue(element, value);
140
+ }
137
141
  this.guards.delete(element);
138
142
  }
139
143
  tryReflectToAttribute(element) {
@@ -49,14 +49,16 @@ export class ElementController {
49
49
  * The context the expression is evaluated against.
50
50
  */
51
51
  get context() {
52
- var _a, _b;
52
+ var _a;
53
+ var _b;
53
54
  return (_b = (_a = this.view) === null || _a === void 0 ? void 0 : _a.context) !== null && _b !== void 0 ? _b : ExecutionContext.default;
54
55
  }
55
56
  /**
56
57
  * Indicates whether the controller is bound.
57
58
  */
58
59
  get isBound() {
59
- var _a, _b;
60
+ var _a;
61
+ var _b;
60
62
  return (_b = (_a = this.view) === null || _a === void 0 ? void 0 : _a.isBound) !== null && _b !== void 0 ? _b : false;
61
63
  }
62
64
  /**
@@ -82,8 +84,7 @@ export class ElementController {
82
84
  }
83
85
  else if (definition.template) {
84
86
  // 3. Default to the static definition.
85
- this._template =
86
- (_a = definition.template) !== null && _a !== void 0 ? _a : null;
87
+ this._template = (_a = definition.template) !== null && _a !== void 0 ? _a : null;
87
88
  }
88
89
  }
89
90
  return this._template;
@@ -478,7 +479,8 @@ export class ElementController {
478
479
  * customElements.define() completed.
479
480
  */
480
481
  observeLateAttributes() {
481
- if (getLateAttributeLookup(this.definition) === null) {
482
+ const lateAttributes = getLateAttributeLookup(this.definition);
483
+ if (lateAttributes === null) {
482
484
  return;
483
485
  }
484
486
  const element = this.source;
@@ -499,7 +501,10 @@ export class ElementController {
499
501
  controller.onAttributeChangedCallback(attributeName, null, element.getAttribute(attributeName));
500
502
  }
501
503
  });
502
- element[lateAttributeObserver].observe(element, { attributes: true });
504
+ element[lateAttributeObserver].observe(element, {
505
+ attributes: true,
506
+ attributeFilter: Object.keys(lateAttributes),
507
+ });
503
508
  }
504
509
  /**
505
510
  * Connects any existing behaviors on the associated element.
@@ -1,8 +1,10 @@
1
+ import { installHydrationDiagnostic } from "../hydration/diagnostics.js";
1
2
  import { ensureHydrationRuntime } from "../hydration/runtime.js";
2
3
  import { SourceLifetime } from "../observation/observable.js";
3
4
  import { ElementController } from "./element-controller.js";
4
5
  import { isHydratable } from "./hydration.js";
5
6
  import { HydrationTracker } from "./hydration-tracker.js";
7
+ export { StopHydration } from "./hydration-tracker.js";
6
8
  /**
7
9
  * No-op handler used during prerendered bind to discard the
8
10
  * upgrade-time burst of attributeChangedCallbacks.
@@ -20,30 +22,52 @@ let hookInstalled = false;
20
22
  *
21
23
  * Safe to call multiple times — the hydration hook is installed once
22
24
  * and subsequent calls merge their options into the shared tracker.
25
+ * By default, the hook stops hydrating new prerendered elements after
26
+ * the global `hydrationComplete` callback. Set
27
+ * `stopHydration` to `StopHydration.never` for streaming scenarios
28
+ * that append hydratable Declarative Shadow DOM after the initial batch.
29
+ *
30
+ * Pass `debugger: hydrationDebugger()` to swap the default minimal
31
+ * hydration mismatch error message for a rich "Expected / Received"
32
+ * report including the SSR HTML snippet and structured
33
+ * `expected`/`received` fields on `HydrationBindingError` /
34
+ * `HydrationTargetElementError`. The debugger module is tree-shaken
35
+ * out of production hydration bundles unless explicitly imported.
23
36
  *
24
37
  * @example
25
38
  * ```ts
26
- * import { enableHydration } from "@microsoft/fast-element/hydration.js";
39
+ * import { enableHydration, StopHydration } from "@microsoft/fast-element/hydration.js";
27
40
  *
28
41
  * enableHydration({
42
+ * stopHydration: StopHydration.never,
29
43
  * hydrationComplete() {
30
44
  * console.log("hydration complete");
31
45
  * },
32
46
  * });
33
47
  * ```
34
48
  *
35
- * @param options - Optional callbacks for global hydration events.
49
+ * @example Rich hydration mismatch diagnostics
50
+ * ```ts
51
+ * import { enableHydration, hydrationDebugger } from "@microsoft/fast-element/hydration.js";
52
+ *
53
+ * enableHydration({ debugger: hydrationDebugger() });
54
+ * ```
55
+ *
56
+ * @param options - Optional global hydration callbacks and behavior.
36
57
  * @public
37
58
  */
38
59
  export function enableHydration(options) {
39
60
  ensureHydrationRuntime();
61
+ if (options === null || options === void 0 ? void 0 : options.debugger) {
62
+ installHydrationDiagnostic(options.debugger.diagnostic);
63
+ }
40
64
  if (!hookInstalled) {
41
65
  tracker = new HydrationTracker(options !== null && options !== void 0 ? options : {});
42
66
  hookInstalled = true;
43
67
  const activeTracker = tracker;
44
68
  ElementController.installHydrationHook((controller, template, element, host) => {
45
69
  var _a, _b;
46
- if (!isHydratable(template)) {
70
+ if (!activeTracker.shouldHydrate || !isHydratable(template)) {
47
71
  return false;
48
72
  }
49
73
  const callbacks = controller.definition.lifecycleCallbacks;
@@ -7,18 +7,20 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge
7
7
  step((generator = generator.apply(thisArg, _arguments || [])).next());
8
8
  });
9
9
  };
10
- var _a;
11
10
  import { isFunction, isString } from "../interfaces.js";
12
11
  import { Observable } from "../observation/observable.js";
13
- import { createTypeRegistry } from "../platform.js";
12
+ import { createTypeRegistry, } from "../platform.js";
14
13
  import { ElementStyles } from "../styles/element-styles.js";
15
14
  import { AttributeDefinition } from "./attributes.js";
16
15
  const defaultShadowOptions = { mode: "open" };
17
16
  const defaultElementOptions = {};
18
17
  const fastElementBaseTypes = new Set();
19
18
  /**
20
- * The FAST custom element registry
21
- * @internal
19
+ * The FAST custom element registry.
20
+ * @remarks
21
+ * This registry stores FAST element definitions by constructor so consumers can
22
+ * look up the `FASTElementDefinition` associated with an element type or instance.
23
+ * @public
22
24
  */
23
25
  export const fastElementRegistry = createTypeRegistry();
24
26
  const templateResolvers = new WeakMap();
@@ -45,11 +47,11 @@ function getRegisteredTypes(registry = customElements) {
45
47
  return registeredTypes;
46
48
  }
47
49
  function finalizeResolvedTemplate(definition, template) {
48
- var _b, _c;
50
+ var _a, _b;
49
51
  pendingTemplateResolutions.delete(definition);
50
52
  if (definition.template === void 0 && template !== void 0) {
51
53
  definition.template = template;
52
- (_c = (_b = definition.lifecycleCallbacks) === null || _b === void 0 ? void 0 : _b.templateDidUpdate) === null || _c === void 0 ? void 0 : _c.call(_b, definition.name);
54
+ (_b = (_a = definition.lifecycleCallbacks) === null || _a === void 0 ? void 0 : _a.templateDidUpdate) === null || _b === void 0 ? void 0 : _b.call(_a, definition.name);
53
55
  }
54
56
  if (definition.template !== void 0) {
55
57
  templateResolutionErrors.delete(definition);
@@ -101,8 +103,8 @@ export function trackLateAttributeDefinition(definition, attribute) {
101
103
  * @internal
102
104
  */
103
105
  export function getLateAttributeLookup(definition) {
104
- var _b;
105
- return ((_b = lateAttributeLookups.get(definition)) !== null && _b !== void 0 ? _b : null);
106
+ var _a;
107
+ return ((_a = lateAttributeLookups.get(definition)) !== null && _a !== void 0 ? _a : null);
106
108
  }
107
109
  /**
108
110
  * Resolves the concrete template for a FAST element definition when the
@@ -183,14 +185,14 @@ export class FASTElementDefinition {
183
185
  }
184
186
  constructor(type, nameOrConfig = type
185
187
  .definition) {
186
- var _b;
188
+ var _a;
187
189
  this.platformDefined = false;
188
190
  if (isString(nameOrConfig)) {
189
191
  nameOrConfig = { name: nameOrConfig };
190
192
  }
191
193
  this.type = type;
192
194
  this.name = nameOrConfig.name;
193
- this.registry = (_b = nameOrConfig.registry) !== null && _b !== void 0 ? _b : customElements;
195
+ this.registry = (_a = nameOrConfig.registry) !== null && _a !== void 0 ? _a : customElements;
194
196
  if (isFASTElementTemplateResolver(nameOrConfig.template)) {
195
197
  templateResolvers.set(this, nameOrConfig.template);
196
198
  }
@@ -244,7 +246,7 @@ export class FASTElementDefinition {
244
246
  * This operation is idempotent per registry.
245
247
  */
246
248
  define(registry = this.registry, extensions) {
247
- var _b, _c;
249
+ var _a, _b;
248
250
  const type = this.type;
249
251
  if (!registry.get(this.name)) {
250
252
  applyFASTElementExtensions(this, registry, extensions);
@@ -252,11 +254,11 @@ export class FASTElementDefinition {
252
254
  void Promise.resolve()
253
255
  .then(() => resolveFASTElementTemplate(this))
254
256
  .then(template => {
255
- var _b, _c;
257
+ var _a, _b;
256
258
  if (template !== void 0 && !registry.get(this.name)) {
257
259
  this.platformDefined = true;
258
260
  registry.define(this.name, type, this.elementOptions);
259
- (_c = (_b = this.lifecycleCallbacks) === null || _b === void 0 ? void 0 : _b.elementDidDefine) === null || _c === void 0 ? void 0 : _c.call(_b, this.name);
261
+ (_b = (_a = this.lifecycleCallbacks) === null || _a === void 0 ? void 0 : _a.elementDidDefine) === null || _b === void 0 ? void 0 : _b.call(_a, this.name);
260
262
  }
261
263
  })
262
264
  .catch(error => {
@@ -267,7 +269,7 @@ export class FASTElementDefinition {
267
269
  }
268
270
  this.platformDefined = true;
269
271
  registry.define(this.name, type, this.elementOptions);
270
- (_c = (_b = this.lifecycleCallbacks) === null || _b === void 0 ? void 0 : _b.elementDidDefine) === null || _c === void 0 ? void 0 : _c.call(_b, this.name);
272
+ (_b = (_a = this.lifecycleCallbacks) === null || _a === void 0 ? void 0 : _a.elementDidDefine) === null || _b === void 0 ? void 0 : _b.call(_a, this.name);
271
273
  }
272
274
  return this;
273
275
  }
@@ -279,9 +281,9 @@ export class FASTElementDefinition {
279
281
  */
280
282
  static compose(type, nameOrDef) {
281
283
  const definition = fastElementBaseTypes.has(type) || fastElementRegistry.getByType(type)
282
- ? new _a(class extends type {
284
+ ? new FASTElementDefinition(class extends type {
283
285
  }, nameOrDef)
284
- : new _a(type, nameOrDef);
286
+ : new FASTElementDefinition(type, nameOrDef);
285
287
  return Promise.resolve(definition);
286
288
  }
287
289
  /**
@@ -293,7 +295,6 @@ export class FASTElementDefinition {
293
295
  fastElementBaseTypes.add(type);
294
296
  }
295
297
  }
296
- _a = FASTElementDefinition;
297
298
  /**
298
299
  * The definition has been registered to the FAST element registry.
299
300
  */
@@ -313,7 +314,7 @@ FASTElementDefinition.getForInstance = fastElementRegistry.getForInstance;
313
314
  * @param name - The name of the defined custom element.
314
315
  * @alpha
315
316
  */
316
- FASTElementDefinition.register = (name, registry = customElements) => __awaiter(void 0, void 0, void 0, function* () {
317
+ FASTElementDefinition.register = (name_1, ...args_1) => __awaiter(void 0, [name_1, ...args_1], void 0, function* (name, registry = customElements) {
317
318
  const registeredTypes = getRegisteredTypes(registry);
318
319
  if (!Object.prototype.hasOwnProperty.call(registeredTypes, name)) {
319
320
  Observable.defineProperty(registeredTypes, name);
@@ -1,3 +1,17 @@
1
+ /**
2
+ * Describes when FAST should stop hydrating newly connected prerendered elements.
3
+ * @public
4
+ */
5
+ export const StopHydration = Object.freeze({
6
+ /**
7
+ * Stop hydrating new prerendered elements after the active hydration batch completes.
8
+ */
9
+ hydrationComplete: "hydration-complete",
10
+ /**
11
+ * Keep the hydration hook active for later prerendered elements.
12
+ */
13
+ never: "never",
14
+ });
1
15
  /**
2
16
  * Tracks prerendered elements through the hydration lifecycle and
3
17
  * fires global callbacks at start and completion. Per-element callbacks
@@ -8,10 +22,20 @@
8
22
  */
9
23
  export class HydrationTracker {
10
24
  constructor(options) {
11
- this.options = options;
25
+ var _a;
12
26
  this.elements = new Set();
13
27
  this.started = false;
28
+ this.completed = false;
14
29
  this.checkTimer = null;
30
+ this.callbacks = options;
31
+ this.stopHydration = (_a = options.stopHydration) !== null && _a !== void 0 ? _a : StopHydration.hydrationComplete;
32
+ }
33
+ /**
34
+ * Indicates whether the hydration hook should attempt to hydrate
35
+ * prerendered elements.
36
+ */
37
+ get shouldHydrate() {
38
+ return !this.completed || this.stopHydration === StopHydration.never;
15
39
  }
16
40
  /**
17
41
  * Registers an element as pending hydration.
@@ -19,10 +43,11 @@ export class HydrationTracker {
19
43
  */
20
44
  add(element) {
21
45
  var _a, _b;
46
+ this.completed = false;
22
47
  if (!this.started) {
23
48
  this.started = true;
24
49
  try {
25
- (_b = (_a = this.options).hydrationStarted) === null || _b === void 0 ? void 0 : _b.call(_a);
50
+ (_b = (_a = this.callbacks).hydrationStarted) === null || _b === void 0 ? void 0 : _b.call(_a);
26
51
  }
27
52
  catch (_c) {
28
53
  // A lifecycle callback must never prevent hydration.
@@ -47,13 +72,14 @@ export class HydrationTracker {
47
72
  this.checkTimer = null;
48
73
  if (this.elements.size === 0) {
49
74
  try {
50
- (_b = (_a = this.options).hydrationComplete) === null || _b === void 0 ? void 0 : _b.call(_a);
75
+ (_b = (_a = this.callbacks).hydrationComplete) === null || _b === void 0 ? void 0 : _b.call(_a);
51
76
  }
52
77
  catch (_c) {
53
78
  // A lifecycle callback must never prevent post-hydration cleanup.
54
79
  }
55
80
  finally {
56
81
  this.started = false;
82
+ this.completed = true;
57
83
  }
58
84
  }
59
85
  }, 0);
@@ -64,11 +90,14 @@ export class HydrationTracker {
64
90
  * callbacks so both the original and new callbacks fire.
65
91
  */
66
92
  mergeOptions(incoming) {
67
- const prev = this.options;
68
- this.options = {
93
+ const prev = this.callbacks;
94
+ this.callbacks = {
69
95
  hydrationStarted: chainCallback(prev.hydrationStarted, incoming.hydrationStarted),
70
96
  hydrationComplete: chainCallback(prev.hydrationComplete, incoming.hydrationComplete),
71
97
  };
98
+ if (incoming.stopHydration !== void 0) {
99
+ this.stopHydration = incoming.stopHydration;
100
+ }
72
101
  }
73
102
  }
74
103
  function chainCallback(first, second) {
@@ -20,7 +20,17 @@ import { FAST } from "../platform.js";
20
20
  * Attribute bindings use a single `data-fe` attribute whose value is
21
21
  * the count of attribute binding factories targeting the element:
22
22
  * <div data-fe="3"> (3 attribute bindings)
23
+ *
24
+ * WebUI versions that predate the data-free marker format still emit indexed
25
+ * markers. The parser below accepts those legacy markers so existing WebUI SSR
26
+ * output can hydrate against the newer FAST runtime.
23
27
  */
28
+ const legacyBindingStartMarker = /fe-b\$\$start\$\$(\d+)\$\$(.+)\$\$fe-b/;
29
+ const legacyBindingEndMarker = /fe-b\$\$end\$\$(\d+)\$\$(.+)\$\$fe-b/;
30
+ const legacyRepeatViewStartMarker = /fe-repeat\$\$start\$\$(\d+)\$\$fe-repeat/;
31
+ const legacyRepeatViewEndMarker = /fe-repeat\$\$end\$\$(\d+)\$\$fe-repeat/;
32
+ const legacyElementBoundaryStartMarker = /^(?:.{0,1000})fe-eb\$\$start\$\$(.+?)\$\$fe-eb/;
33
+ const legacyElementBoundaryEndMarker = /fe-eb\$\$end\$\$(.{0,1000})\$\$fe-eb(?:.{0,1000})$/;
24
34
  function isComment(node) {
25
35
  return node && node.nodeType === Node.COMMENT_NODE;
26
36
  }
@@ -31,6 +41,8 @@ function isComment(node) {
31
41
  export const HydrationMarkup = Object.freeze({
32
42
  // Single attribute marker format (count only)
33
43
  attributeMarkerName: "data-fe",
44
+ legacyAttributeMarkerName: "data-fe-b",
45
+ legacyCompactAttributeMarkerName: "data-fe-c",
34
46
  // Content binding markers (no arguments)
35
47
  contentBindingStartMarker() {
36
48
  return "fe:b";
@@ -54,22 +66,24 @@ export const HydrationMarkup = Object.freeze({
54
66
  },
55
67
  // Detection — simple string equality
56
68
  isContentBindingStartMarker(data) {
57
- return data === "fe:b";
69
+ return data === "fe:b" || legacyBindingStartMarker.test(data);
58
70
  },
59
71
  isContentBindingEndMarker(data) {
60
- return data === "fe:/b";
72
+ return data === "fe:/b" || legacyBindingEndMarker.test(data);
61
73
  },
62
74
  isRepeatViewStartMarker(data) {
63
- return data === "fe:r";
75
+ return data === "fe:r" || legacyRepeatViewStartMarker.test(data);
64
76
  },
65
77
  isRepeatViewEndMarker(data) {
66
- return data === "fe:/r";
78
+ return data === "fe:/r" || legacyRepeatViewEndMarker.test(data);
67
79
  },
68
80
  isElementBoundaryStartMarker(node) {
69
- return isComment(node) && node.data === "fe:e";
81
+ return (isComment(node) &&
82
+ (node.data === "fe:e" || legacyElementBoundaryStartMarker.test(node.data)));
70
83
  },
71
84
  isElementBoundaryEndMarker(node) {
72
- return isComment(node) && node.data === "fe:/e";
85
+ return (isComment(node) &&
86
+ (node.data === "fe:/e" || legacyElementBoundaryEndMarker.test(node.data)));
73
87
  },
74
88
  /**
75
89
  * Returns the count of attribute bindings on the element, or null
@@ -97,7 +111,72 @@ export const HydrationMarkup = Object.freeze({
97
111
  }
98
112
  return count;
99
113
  },
114
+ parseLegacyAttributeBindingIndices(node) {
115
+ const indices = [];
116
+ const attr = node.getAttribute(this.legacyAttributeMarkerName);
117
+ if (attr !== null) {
118
+ for (const value of attr.trim().split(/\s+/)) {
119
+ if (value === "") {
120
+ continue;
121
+ }
122
+ const index = Number(value);
123
+ if (!Number.isInteger(index) || index < 0) {
124
+ throw FAST.error(Message.invalidHydrationAttributeMarker, {
125
+ value: attr,
126
+ });
127
+ }
128
+ indices.push(index);
129
+ }
130
+ }
131
+ const enumeratedPrefix = `${this.legacyAttributeMarkerName}-`;
132
+ const compactPrefix = `${this.legacyCompactAttributeMarkerName}-`;
133
+ for (const name of node.getAttributeNames()) {
134
+ if (name.startsWith(enumeratedPrefix)) {
135
+ const index = Number(name.slice(enumeratedPrefix.length));
136
+ if (!Number.isInteger(index) || index < 0) {
137
+ throw FAST.error(Message.invalidHydrationAttributeMarker, {
138
+ value: name,
139
+ });
140
+ }
141
+ indices.push(index);
142
+ }
143
+ else if (name.startsWith(compactPrefix)) {
144
+ const [start, count] = name
145
+ .slice(compactPrefix.length)
146
+ .split("-")
147
+ .map(value => Number(value));
148
+ if (!Number.isInteger(start) ||
149
+ !Number.isInteger(count) ||
150
+ start < 0 ||
151
+ count < 1) {
152
+ throw FAST.error(Message.invalidHydrationAttributeMarker, {
153
+ value: name,
154
+ });
155
+ }
156
+ for (let i = 0; i < count; i++) {
157
+ indices.push(start + i);
158
+ }
159
+ }
160
+ }
161
+ return indices.length === 0 ? null : indices;
162
+ },
163
+ removeLegacyAttributeBindingMarkers(node) {
164
+ node.removeAttribute(this.legacyAttributeMarkerName);
165
+ for (const name of node.getAttributeNames()) {
166
+ if (name.startsWith(`${this.legacyAttributeMarkerName}-`) ||
167
+ name.startsWith(`${this.legacyCompactAttributeMarkerName}-`)) {
168
+ node.removeAttribute(name);
169
+ }
170
+ }
171
+ },
172
+ parseLegacyContentBindingStartIndex(data) {
173
+ return parseLegacyIntMarker(legacyBindingStartMarker, data);
174
+ },
100
175
  });
176
+ function parseLegacyIntMarker(pattern, data) {
177
+ const match = pattern.exec(data);
178
+ return match === null ? null : Number(match[1]);
179
+ }
101
180
  /**
102
181
  * @internal
103
182
  */
package/dist/esm/debug.js CHANGED
@@ -11,6 +11,7 @@ const baseDebugMessages = {
11
11
  [1208 /* cannotSetTemplatePolicyAfterCompilation */]: "The DOM Policy cannot be set after a template is compiled.",
12
12
  [1209 /* blockedByDOMPolicy */]: "'${aspectName}' on '${tagName}' is blocked by the current DOMPolicy.",
13
13
  [1210 /* invalidHydrationAttributeMarker */]: "Invalid data-fe attribute value '${value}'. Expected a positive integer.",
14
+ [1211 /* duplicateRenderInstruction */]: "Replacing existing RenderInstruction for '${type}' with name '${name}'.",
14
15
  [1401 /* missingElementDefinition */]: "Missing FASTElement definition.",
15
16
  [1501 /* noRegistrationForContext */]: "No registration for Context/Interface '${name}'.",
16
17
  [1502 /* noFactoryForResolver */]: "Dependency injection resolver for '${key}' returned a null factory.",
@@ -65,7 +65,8 @@ export class AttributeMap {
65
65
  this.config = config;
66
66
  }
67
67
  defineProperties() {
68
- var _a, _b;
68
+ var _a;
69
+ var _b;
69
70
  const propertyNames = this.schema.getRootProperties();
70
71
  const existingAccessorNames = new Set(Observable.getAccessors(this.classPrototype).map(a => a.name));
71
72
  const strategy = (_b = (_a = this.config) === null || _a === void 0 ? void 0 : _a["attribute-name-strategy"]) !== null && _b !== void 0 ? _b : "camelCase";
@@ -1,5 +1,4 @@
1
1
  export const debugMessages = {
2
2
  [2000 /* noTemplateProvided */]: "The first child of the <f-template> must be a <template>, this is missing from ${name}.",
3
3
  [2001 /* moreThanOneTemplateProvided */]: "There can only be one <template> inside the <f-template>; remove any extra <template> elements and keep exactly one for ${name}.",
4
- [2002 /* moreThanOneMatchingTemplateProvided */]: 'There can only be one connected <f-template name="${name}"> in a registry while resolving a declarative template; remove duplicate matches for ${name}.',
5
4
  };