@microsoft/fast-element 2.10.3 → 3.0.0-rc.1

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 (351) hide show
  1. package/ARCHITECTURE_HTML_TAGGED_TEMPLATE_LITERAL.md +1 -1
  2. package/ARCHITECTURE_OVERVIEW.md +2 -2
  3. package/CHANGELOG.json +31 -1
  4. package/CHANGELOG.md +10 -2
  5. package/DECLARATIVE_DESIGN.md +806 -0
  6. package/DECLARATIVE_HTML.md +470 -0
  7. package/DECLARATIVE_MIGRATION.md +215 -0
  8. package/DECLARATIVE_RENDERING.md +530 -0
  9. package/DECLARATIVE_RENDERING_LIFECYCLE.md +288 -0
  10. package/DECLARATIVE_SCHEMA_OBSERVER_MAP.md +489 -0
  11. package/DESIGN.md +143 -34
  12. package/MIGRATION.md +387 -0
  13. package/README.md +208 -1
  14. package/SIZES.md +25 -0
  15. package/api-extractor.arrays.json +15 -0
  16. package/api-extractor.context.json +1 -0
  17. package/api-extractor.declarative.json +15 -0
  18. package/api-extractor.di.json +1 -0
  19. package/api-extractor.hydration.json +15 -0
  20. package/api-extractor.styles.json +15 -0
  21. package/dist/arrays/arrays.api.json +2621 -0
  22. package/dist/context/context.api.json +1 -1
  23. package/dist/declarative/declarative.api.json +7844 -0
  24. package/dist/di/di.api.json +2 -2
  25. package/dist/dts/array-observer.d.ts +2 -0
  26. package/dist/dts/arrays.d.ts +2 -0
  27. package/dist/dts/attr.d.ts +1 -0
  28. package/dist/dts/binding/signal.d.ts +6 -6
  29. package/dist/dts/binding/two-way.d.ts +1 -0
  30. package/dist/dts/binding.d.ts +7 -0
  31. package/dist/dts/components/attributes.d.ts +2 -5
  32. package/dist/dts/components/definition-schema-transforms.d.ts +9 -0
  33. package/dist/dts/components/element-controller.d.ts +80 -114
  34. package/dist/dts/components/element-hydration.d.ts +1 -1
  35. package/dist/dts/components/enable-hydration.d.ts +34 -0
  36. package/dist/dts/components/fast-definitions.d.ts +91 -42
  37. package/dist/dts/components/fast-element.d.ts +5 -8
  38. package/dist/dts/components/hydration-tracker.d.ts +40 -0
  39. package/dist/dts/components/hydration.d.ts +18 -53
  40. package/dist/dts/components/schema.d.ts +205 -0
  41. package/dist/dts/context.d.ts +6 -6
  42. package/dist/dts/css.d.ts +3 -0
  43. package/dist/dts/debug.d.ts +5 -1
  44. package/dist/dts/declarative/attribute-map.d.ts +58 -0
  45. package/dist/dts/declarative/debug.d.ts +5 -0
  46. package/dist/dts/declarative/index.d.ts +13 -0
  47. package/dist/dts/declarative/interfaces.d.ts +9 -0
  48. package/dist/dts/declarative/observer-map-utilities.d.ts +58 -0
  49. package/dist/dts/declarative/observer-map.d.ts +89 -0
  50. package/dist/dts/declarative/runtime.d.ts +5 -0
  51. package/dist/dts/declarative/syntax.d.ts +21 -0
  52. package/dist/dts/declarative/template-bridge.d.ts +33 -0
  53. package/dist/dts/declarative/template-parser.d.ts +98 -0
  54. package/dist/dts/declarative/template.d.ts +9 -0
  55. package/dist/dts/declarative/utilities.d.ts +312 -0
  56. package/dist/dts/di/di.d.ts +1 -1
  57. package/dist/dts/directives/children.d.ts +2 -0
  58. package/dist/dts/directives/node-observation.d.ts +2 -0
  59. package/dist/dts/directives/ref.d.ts +2 -0
  60. package/dist/dts/directives/repeat.d.ts +4 -0
  61. package/dist/dts/directives/slotted.d.ts +2 -0
  62. package/dist/dts/directives/when.d.ts +3 -0
  63. package/dist/dts/dom-policy.d.ts +1 -1
  64. package/dist/dts/html.d.ts +5 -0
  65. package/dist/dts/hydration/runtime.d.ts +7 -0
  66. package/dist/dts/hydration/target-builder.d.ts +15 -12
  67. package/dist/dts/hydration.d.ts +14 -0
  68. package/dist/dts/index.d.ts +38 -42
  69. package/dist/dts/index.debug.d.ts +0 -1
  70. package/dist/dts/index.rollup.debug.d.ts +0 -1
  71. package/dist/dts/interfaces.d.ts +1 -49
  72. package/dist/dts/observable.d.ts +3 -6
  73. package/dist/dts/observation/arrays.d.ts +1 -1
  74. package/dist/dts/observation/update-queue.d.ts +1 -1
  75. package/dist/dts/platform.d.ts +25 -4
  76. package/dist/dts/render.d.ts +7 -0
  77. package/dist/dts/schema.d.ts +1 -0
  78. package/dist/dts/state/exports.d.ts +1 -1
  79. package/dist/dts/state/state.d.ts +2 -2
  80. package/dist/dts/styles/css-directive.d.ts +5 -12
  81. package/dist/dts/styles/css.d.ts +5 -7
  82. package/dist/dts/styles/element-styles.d.ts +0 -10
  83. package/dist/dts/styles.d.ts +6 -0
  84. package/dist/dts/templating/children.d.ts +1 -1
  85. package/dist/dts/templating/html-binding-directive.d.ts +10 -0
  86. package/dist/dts/templating/html-directive.d.ts +17 -0
  87. package/dist/dts/templating/hydration-view.d.ts +109 -0
  88. package/dist/dts/templating/ref.d.ts +1 -1
  89. package/dist/dts/templating/render.d.ts +8 -2
  90. package/dist/dts/templating/repeat.d.ts +2 -2
  91. package/dist/dts/templating/slotted.d.ts +1 -1
  92. package/dist/dts/templating/template.d.ts +17 -9
  93. package/dist/dts/templating/view.d.ts +25 -102
  94. package/dist/dts/templating/when.d.ts +1 -1
  95. package/dist/dts/templating.d.ts +10 -0
  96. package/dist/dts/testing/exports.d.ts +2 -2
  97. package/dist/dts/tsdoc-metadata.json +1 -1
  98. package/dist/dts/updates.d.ts +1 -0
  99. package/dist/dts/volatile.d.ts +2 -0
  100. package/dist/esm/array-observer.js +1 -0
  101. package/dist/esm/arrays.js +1 -0
  102. package/dist/esm/attr.js +1 -0
  103. package/dist/esm/binding/normalize.js +1 -1
  104. package/dist/esm/binding/signal.js +4 -4
  105. package/dist/esm/binding/two-way.js +2 -1
  106. package/dist/esm/binding.js +4 -0
  107. package/dist/esm/components/attributes.js +8 -5
  108. package/dist/esm/components/definition-schema-transforms.js +23 -0
  109. package/dist/esm/components/element-controller.js +200 -269
  110. package/dist/esm/components/element-hydration.js +1 -1
  111. package/dist/esm/components/enable-hydration.js +100 -0
  112. package/dist/esm/components/fast-definitions.js +211 -49
  113. package/dist/esm/components/fast-element.js +18 -27
  114. package/dist/esm/components/hydration-tracker.js +93 -0
  115. package/dist/esm/components/hydration.js +62 -144
  116. package/dist/esm/components/schema.js +253 -0
  117. package/dist/esm/context.js +6 -6
  118. package/dist/esm/css.js +3 -0
  119. package/dist/esm/debug.js +26 -26
  120. package/dist/esm/declarative/attribute-map.js +121 -0
  121. package/dist/esm/declarative/debug.js +5 -0
  122. package/dist/esm/declarative/index.js +3 -0
  123. package/dist/esm/declarative/interfaces.js +10 -0
  124. package/dist/esm/declarative/observer-map-utilities.js +562 -0
  125. package/dist/esm/declarative/observer-map.js +216 -0
  126. package/dist/esm/declarative/runtime.js +14 -0
  127. package/dist/esm/declarative/syntax.js +36 -0
  128. package/dist/esm/declarative/template-bridge.js +170 -0
  129. package/dist/esm/declarative/template-parser.js +306 -0
  130. package/dist/esm/declarative/template.js +142 -0
  131. package/dist/esm/declarative/utilities.js +834 -0
  132. package/dist/esm/di/di.js +6 -8
  133. package/dist/esm/directives/children.js +1 -0
  134. package/dist/esm/directives/node-observation.js +1 -0
  135. package/dist/esm/directives/ref.js +1 -0
  136. package/dist/esm/directives/repeat.js +1 -0
  137. package/dist/esm/directives/slotted.js +1 -0
  138. package/dist/esm/directives/when.js +1 -0
  139. package/dist/esm/dom-policy.js +2 -2
  140. package/dist/esm/dom.js +1 -1
  141. package/dist/esm/html.js +2 -0
  142. package/dist/esm/hydration/runtime.js +33 -0
  143. package/dist/esm/hydration/target-builder.js +97 -90
  144. package/dist/esm/hydration.js +4 -0
  145. package/dist/esm/index.debug.js +2 -1
  146. package/dist/esm/index.js +34 -29
  147. package/dist/esm/index.rollup.debug.js +3 -2
  148. package/dist/esm/index.rollup.js +1 -1
  149. package/dist/esm/interfaces.js +1 -45
  150. package/dist/esm/observable.js +1 -4
  151. package/dist/esm/observation/arrays.js +1 -1
  152. package/dist/esm/observation/observable.js +5 -5
  153. package/dist/esm/observation/update-queue.js +47 -58
  154. package/dist/esm/platform.js +31 -30
  155. package/dist/esm/render.js +1 -0
  156. package/dist/esm/schema.js +1 -0
  157. package/dist/esm/state/exports.js +1 -1
  158. package/dist/esm/styles/css-directive.js +1 -2
  159. package/dist/esm/styles/css.js +15 -56
  160. package/dist/esm/styles/element-styles.js +69 -15
  161. package/dist/esm/styles.js +2 -0
  162. package/dist/esm/templating/html-binding-directive.js +24 -10
  163. package/dist/esm/templating/hydration-view.js +235 -0
  164. package/dist/esm/templating/render.js +13 -2
  165. package/dist/esm/templating/repeat.js +36 -34
  166. package/dist/esm/templating/template.js +7 -7
  167. package/dist/esm/templating/view.js +24 -233
  168. package/dist/esm/templating.js +7 -0
  169. package/dist/esm/testing/exports.js +2 -2
  170. package/dist/esm/updates.js +1 -0
  171. package/dist/esm/volatile.js +1 -0
  172. package/dist/fast-element.api.json +9017 -6996
  173. package/dist/fast-element.d.ts +3557 -796
  174. package/dist/fast-element.debug.js +5093 -4419
  175. package/dist/fast-element.debug.min.js +2 -2
  176. package/dist/fast-element.js +5398 -4655
  177. package/dist/fast-element.min.js +2 -2
  178. package/dist/fast-element.untrimmed.d.ts +881 -481
  179. package/dist/hydration/hydration.api.json +5237 -0
  180. package/dist/styles/styles.api.json +2672 -0
  181. package/docs/api-report.api.md +344 -167
  182. package/docs/arrays/api-report.api.md +114 -0
  183. package/docs/declarative/api-report.api.md +397 -0
  184. package/docs/hydration/api-report.api.md +285 -0
  185. package/docs/styles/api-report.api.md +135 -0
  186. package/package.json +149 -40
  187. package/playwright.declarative.config.ts +26 -0
  188. package/playwright.declarative.webui.config.ts +20 -0
  189. package/scripts/declarative/build-fixtures-with-webui.js +135 -0
  190. package/scripts/declarative/build-fixtures.js +49 -0
  191. package/scripts/declarative/build-fixtures.utilities.js +101 -0
  192. package/scripts/measure-sizes.js +219 -0
  193. package/scripts/run-api-extractor.js +39 -20
  194. package/test/declarative/fixtures/README.md +72 -0
  195. package/test/declarative/fixtures/WRITING_FIXTURES.md +330 -0
  196. package/test/declarative/fixtures/bindings/README.md +12 -0
  197. package/test/declarative/fixtures/bindings/attribute/entry.html +13 -0
  198. package/test/declarative/fixtures/bindings/attribute/fast-build.config.json +6 -0
  199. package/test/declarative/fixtures/bindings/attribute/index.html +25 -0
  200. package/test/declarative/fixtures/bindings/attribute/main.ts +41 -0
  201. package/test/declarative/fixtures/bindings/attribute/state.json +8 -0
  202. package/test/declarative/fixtures/bindings/attribute/templates.html +11 -0
  203. package/test/declarative/fixtures/bindings/content/entry.html +12 -0
  204. package/test/declarative/fixtures/bindings/content/fast-build.config.json +6 -0
  205. package/test/declarative/fixtures/bindings/content/index.html +19 -0
  206. package/test/declarative/fixtures/bindings/content/main.ts +27 -0
  207. package/test/declarative/fixtures/bindings/content/state.json +4 -0
  208. package/test/declarative/fixtures/bindings/content/templates.html +6 -0
  209. package/test/declarative/fixtures/bindings/dot-syntax/entry.html +11 -0
  210. package/test/declarative/fixtures/bindings/dot-syntax/fast-build.config.json +6 -0
  211. package/test/declarative/fixtures/bindings/dot-syntax/index.html +47 -0
  212. package/test/declarative/fixtures/bindings/dot-syntax/main.ts +59 -0
  213. package/test/declarative/fixtures/bindings/dot-syntax/state.json +16 -0
  214. package/test/declarative/fixtures/bindings/dot-syntax/templates.html +17 -0
  215. package/test/declarative/fixtures/bindings/event/entry.html +11 -0
  216. package/test/declarative/fixtures/bindings/event/fast-build.config.json +6 -0
  217. package/test/declarative/fixtures/bindings/event/index.html +43 -0
  218. package/test/declarative/fixtures/bindings/event/main.ts +43 -0
  219. package/test/declarative/fixtures/bindings/event/state.json +3 -0
  220. package/test/declarative/fixtures/bindings/event/templates.html +18 -0
  221. package/test/declarative/fixtures/bindings/host/entry.html +40 -0
  222. package/test/declarative/fixtures/bindings/host/fast-build.config.json +6 -0
  223. package/test/declarative/fixtures/bindings/host/index.html +96 -0
  224. package/test/declarative/fixtures/bindings/host/main.ts +222 -0
  225. package/test/declarative/fixtures/bindings/host/state.json +9 -0
  226. package/test/declarative/fixtures/bindings/host/templates.html +55 -0
  227. package/test/declarative/fixtures/directives/README.md +12 -0
  228. package/test/declarative/fixtures/directives/children/entry.html +11 -0
  229. package/test/declarative/fixtures/directives/children/fast-build.config.json +6 -0
  230. package/test/declarative/fixtures/directives/children/index.html +15 -0
  231. package/test/declarative/fixtures/directives/children/main.ts +22 -0
  232. package/test/declarative/fixtures/directives/children/state.json +3 -0
  233. package/test/declarative/fixtures/directives/children/templates.html +3 -0
  234. package/test/declarative/fixtures/directives/ref/entry.html +11 -0
  235. package/test/declarative/fixtures/directives/ref/fast-build.config.json +6 -0
  236. package/test/declarative/fixtures/directives/ref/index.html +15 -0
  237. package/test/declarative/fixtures/directives/ref/main.ts +17 -0
  238. package/test/declarative/fixtures/directives/ref/state.json +1 -0
  239. package/test/declarative/fixtures/directives/ref/templates.html +3 -0
  240. package/test/declarative/fixtures/directives/repeat/entry.html +21 -0
  241. package/test/declarative/fixtures/directives/repeat/fast-build.config.json +6 -0
  242. package/test/declarative/fixtures/directives/repeat/index.html +133 -0
  243. package/test/declarative/fixtures/directives/repeat/main.ts +110 -0
  244. package/test/declarative/fixtures/directives/repeat/sprites.svg +8 -0
  245. package/test/declarative/fixtures/directives/repeat/state.json +10 -0
  246. package/test/declarative/fixtures/directives/repeat/templates.html +75 -0
  247. package/test/declarative/fixtures/directives/slotted/entry.html +17 -0
  248. package/test/declarative/fixtures/directives/slotted/fast-build.config.json +6 -0
  249. package/test/declarative/fixtures/directives/slotted/index.html +27 -0
  250. package/test/declarative/fixtures/directives/slotted/main.ts +29 -0
  251. package/test/declarative/fixtures/directives/slotted/state.json +1 -0
  252. package/test/declarative/fixtures/directives/slotted/templates.html +7 -0
  253. package/test/declarative/fixtures/directives/when/entry.html +51 -0
  254. package/test/declarative/fixtures/directives/when/fast-build.config.json +6 -0
  255. package/test/declarative/fixtures/directives/when/index.html +136 -0
  256. package/test/declarative/fixtures/directives/when/main.ts +172 -0
  257. package/test/declarative/fixtures/directives/when/state.json +12 -0
  258. package/test/declarative/fixtures/directives/when/templates.html +75 -0
  259. package/test/declarative/fixtures/ecosystem/README.md +11 -0
  260. package/test/declarative/fixtures/ecosystem/declarative-no-hydration/entry.html +12 -0
  261. package/test/declarative/fixtures/ecosystem/declarative-no-hydration/fast-build.config.json +6 -0
  262. package/test/declarative/fixtures/ecosystem/declarative-no-hydration/index.html +20 -0
  263. package/test/declarative/fixtures/ecosystem/declarative-no-hydration/main.ts +68 -0
  264. package/test/declarative/fixtures/ecosystem/declarative-no-hydration/state.json +4 -0
  265. package/test/declarative/fixtures/ecosystem/declarative-no-hydration/templates.html +7 -0
  266. package/test/declarative/fixtures/ecosystem/errors/entry.html +12 -0
  267. package/test/declarative/fixtures/ecosystem/errors/fast-build.config.json +6 -0
  268. package/test/declarative/fixtures/ecosystem/errors/index.html +20 -0
  269. package/test/declarative/fixtures/ecosystem/errors/main.ts +17 -0
  270. package/test/declarative/fixtures/ecosystem/errors/state.json +1 -0
  271. package/test/declarative/fixtures/ecosystem/errors/templates.html +7 -0
  272. package/test/declarative/fixtures/ecosystem/lifecycle-callbacks/entry.html +17 -0
  273. package/test/declarative/fixtures/ecosystem/lifecycle-callbacks/fast-build.config.json +6 -0
  274. package/test/declarative/fixtures/ecosystem/lifecycle-callbacks/index.html +56 -0
  275. package/test/declarative/fixtures/ecosystem/lifecycle-callbacks/main.ts +134 -0
  276. package/test/declarative/fixtures/ecosystem/lifecycle-callbacks/state.json +12 -0
  277. package/test/declarative/fixtures/ecosystem/lifecycle-callbacks/templates.html +34 -0
  278. package/test/declarative/fixtures/ecosystem/performance-metrics/entry.html +25 -0
  279. package/test/declarative/fixtures/ecosystem/performance-metrics/fast-build.config.json +6 -0
  280. package/test/declarative/fixtures/ecosystem/performance-metrics/fast-card.css +10 -0
  281. package/test/declarative/fixtures/ecosystem/performance-metrics/index.html +181 -0
  282. package/test/declarative/fixtures/ecosystem/performance-metrics/main.ts +58 -0
  283. package/test/declarative/fixtures/ecosystem/performance-metrics/state.json +6 -0
  284. package/test/declarative/fixtures/ecosystem/performance-metrics/templates.html +15 -0
  285. package/test/declarative/fixtures/extensions/README.md +15 -0
  286. package/test/declarative/fixtures/extensions/attribute-map/entry.html +14 -0
  287. package/test/declarative/fixtures/extensions/attribute-map/fast-build.config.json +6 -0
  288. package/test/declarative/fixtures/extensions/attribute-map/index.html +31 -0
  289. package/test/declarative/fixtures/extensions/attribute-map/main.ts +40 -0
  290. package/test/declarative/fixtures/extensions/attribute-map/state.json +4 -0
  291. package/test/declarative/fixtures/extensions/attribute-map/templates.html +14 -0
  292. package/test/declarative/fixtures/extensions/attribute-map-naming-strategy/entry.html +12 -0
  293. package/test/declarative/fixtures/extensions/attribute-map-naming-strategy/fast-build.config.json +7 -0
  294. package/test/declarative/fixtures/extensions/attribute-map-naming-strategy/index.html +25 -0
  295. package/test/declarative/fixtures/extensions/attribute-map-naming-strategy/main.ts +31 -0
  296. package/test/declarative/fixtures/extensions/attribute-map-naming-strategy/state.json +5 -0
  297. package/test/declarative/fixtures/extensions/attribute-map-naming-strategy/templates.html +11 -0
  298. package/test/declarative/fixtures/extensions/attribute-map-naming-strategy-camel-case/entry.html +13 -0
  299. package/test/declarative/fixtures/extensions/attribute-map-naming-strategy-camel-case/fast-build.config.json +7 -0
  300. package/test/declarative/fixtures/extensions/attribute-map-naming-strategy-camel-case/index.html +23 -0
  301. package/test/declarative/fixtures/extensions/attribute-map-naming-strategy-camel-case/main.ts +37 -0
  302. package/test/declarative/fixtures/extensions/attribute-map-naming-strategy-camel-case/state.json +1 -0
  303. package/test/declarative/fixtures/extensions/attribute-map-naming-strategy-camel-case/templates.html +9 -0
  304. package/test/declarative/fixtures/extensions/observer-map/entry.html +15 -0
  305. package/test/declarative/fixtures/extensions/observer-map/fast-build.config.json +6 -0
  306. package/test/declarative/fixtures/extensions/observer-map/index.html +442 -0
  307. package/test/declarative/fixtures/extensions/observer-map/main.ts +482 -0
  308. package/test/declarative/fixtures/extensions/observer-map/state.json +158 -0
  309. package/test/declarative/fixtures/extensions/observer-map/templates.html +172 -0
  310. package/test/declarative/fixtures/extensions/observer-map-config-object/entry.html +16 -0
  311. package/test/declarative/fixtures/extensions/observer-map-config-object/fast-build.config.json +6 -0
  312. package/test/declarative/fixtures/extensions/observer-map-config-object/index.html +27 -0
  313. package/test/declarative/fixtures/extensions/observer-map-config-object/main.ts +53 -0
  314. package/test/declarative/fixtures/extensions/observer-map-config-object/state.json +9 -0
  315. package/test/declarative/fixtures/extensions/observer-map-config-object/templates.html +12 -0
  316. package/test/declarative/fixtures/extensions/observer-map-deep-merge/README.md +98 -0
  317. package/test/declarative/fixtures/extensions/observer-map-deep-merge/entry.html +156 -0
  318. package/test/declarative/fixtures/extensions/observer-map-deep-merge/fast-build.config.json +6 -0
  319. package/test/declarative/fixtures/extensions/observer-map-deep-merge/index.html +376 -0
  320. package/test/declarative/fixtures/extensions/observer-map-deep-merge/main.ts +366 -0
  321. package/test/declarative/fixtures/extensions/observer-map-deep-merge/state.json +69 -0
  322. package/test/declarative/fixtures/extensions/observer-map-deep-merge/templates.html +91 -0
  323. package/test/declarative/fixtures/extensions/observer-map-properties/entry.html +14 -0
  324. package/test/declarative/fixtures/extensions/observer-map-properties/fast-build.config.json +6 -0
  325. package/test/declarative/fixtures/extensions/observer-map-properties/index.html +110 -0
  326. package/test/declarative/fixtures/extensions/observer-map-properties/main.ts +175 -0
  327. package/test/declarative/fixtures/extensions/observer-map-properties/state.json +29 -0
  328. package/test/declarative/fixtures/extensions/observer-map-properties/templates.html +55 -0
  329. package/test/declarative/fixtures/scenarios/README.md +7 -0
  330. package/test/declarative/fixtures/scenarios/nested-elements/entry.html +16 -0
  331. package/test/declarative/fixtures/scenarios/nested-elements/fast-build.config.json +6 -0
  332. package/test/declarative/fixtures/scenarios/nested-elements/index.html +126 -0
  333. package/test/declarative/fixtures/scenarios/nested-elements/main.ts +214 -0
  334. package/test/declarative/fixtures/scenarios/nested-elements/state.json +10 -0
  335. package/test/declarative/fixtures/scenarios/nested-elements/templates.html +54 -0
  336. package/test/declarative/index.html +12 -0
  337. package/test/declarative/vite.config.ts +55 -0
  338. package/test/declarative-main.ts +6 -0
  339. package/test/extension-subpaths-main.ts +9 -0
  340. package/test/main.ts +38 -33
  341. package/test/pure-declarative-main.ts +1 -0
  342. package/dist/dts/components/install-hydration.d.ts +0 -1
  343. package/dist/dts/pending-task.d.ts +0 -32
  344. package/dist/dts/polyfills.d.ts +0 -0
  345. package/dist/dts/styles/css-binding-directive.d.ts +0 -60
  346. package/dist/dts/templating/install-hydratable-view-templates.d.ts +0 -1
  347. package/dist/esm/components/install-hydration.js +0 -3
  348. package/dist/esm/pending-task.js +0 -28
  349. package/dist/esm/polyfills.js +0 -60
  350. package/dist/esm/styles/css-binding-directive.js +0 -76
  351. package/dist/esm/templating/install-hydratable-view-templates.js +0 -23
@@ -1,48 +1,44 @@
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
+ export { AttributeConfiguration, AttributeDefinition, type AttributeMode, attr, booleanConverter, type DecoratorAttributeConfiguration, nullableBooleanConverter, nullableNumberConverter, type ValueConverter, } from "./attr.js";
8
2
  export { Binding, type BindingDirective } from "./binding/binding.js";
9
3
  export { normalizeBinding } from "./binding/normalize.js";
10
4
  export { oneTime } from "./binding/one-time.js";
11
5
  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";
18
- 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";
27
- 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";
6
+ export { Signal, signal } from "./binding/signal.js";
7
+ export { type TwoWayBindingOptions, TwoWaySettings, twoWay, } from "./binding/two-way.js";
44
8
  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";
9
+ export { ElementController, Stages, } from "./components/element-controller.js";
10
+ export type { FASTElementExtension, FASTElementTemplateResolver, PartialFASTElementDefinition, ShadowRootOptions, TypeRegistry, } from "./components/fast-definitions.js";
11
+ export { FASTElementDefinition, fastElementRegistry, type TemplateLifecycleCallbacks, } from "./components/fast-definitions.js";
47
12
  export { customElement, FASTElement } from "./components/fast-element.js";
48
- export { deferHydrationAttribute, isHydratable } from "./components/hydration.js";
13
+ export { enableDebug } from "./debug.js";
14
+ export { type ChildListDirectiveOptions, ChildrenDirective, type ChildrenDirectiveOptions, children, type SubtreeDirectiveOptions, } from "./directives/children.js";
15
+ export { type ElementsFilter, elements, type NodeBehaviorOptions, NodeObservationDirective, } from "./directives/node-observation.js";
16
+ export { RefDirective, ref } from "./directives/ref.js";
17
+ export { RepeatBehavior, RepeatDirective, type RepeatOptions, repeat, } from "./directives/repeat.js";
18
+ export { SlottedDirective, type SlottedDirectiveOptions, slotted, } from "./directives/slotted.js";
19
+ export { when } from "./directives/when.js";
20
+ export * from "./dom.js";
21
+ export { type DOMAspectGuards, type DOMElementGuards, type DOMGuards, DOMPolicy, type DOMPolicyOptions, type DOMSinkGuards, } from "./dom-policy.js";
22
+ export type { Callable, Class, Constructable, Disposable, TrustedTypesPolicy, } from "./interfaces.js";
23
+ export { ArrayObserver, type LengthObserver, lengthOf, Sort, type SortObserver, Splice, SpliceStrategy, SpliceStrategySupport, sortedCount, } from "./observation/arrays.js";
24
+ export { type Notifier, PropertyChangeNotifier, type Subscriber, SubscriberSet, } from "./observation/notifier.js";
25
+ export type { Accessor, Expression, ExpressionController, ExpressionNotifier, ExpressionObserver, ObservationRecord, } from "./observation/observable.js";
26
+ export { ExecutionContext, Observable, observable, SourceLifetime, volatile, } from "./observation/observable.js";
27
+ export { type UpdateQueue, Updates } from "./observation/update-queue.js";
28
+ export { emptyArray, FAST } from "./platform.js";
29
+ 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";
30
+ export * from "./state/exports.js";
31
+ export { type CSSTemplateTag, type CSSValue, css } from "./styles/css.js";
32
+ export { CSSDirective, type CSSDirectiveDefinition, cssDirective, } from "./styles/css-directive.js";
33
+ export type { ComposableStyles, ConstructibleStyleStrategy, } from "./styles/element-styles.js";
34
+ export { ElementStyles } from "./styles/element-styles.js";
35
+ export type { HostBehavior, HostController } from "./styles/host.js";
36
+ export type { StyleStrategy, StyleTarget } from "./styles/style-strategy.js";
37
+ export { type CompilationStrategy, Compiler } from "./templating/compiler.js";
38
+ export { type ContentTemplate, type ContentView, HTMLBindingDirective, } from "./templating/html-binding-directive.js";
39
+ 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";
40
+ export { Markup, Parser } from "./templating/markup.js";
41
+ export { RenderBehavior, RenderDirective, render } from "./templating/render.js";
42
+ export { type CaptureType, type ElementViewTemplate, type HTMLTemplateCompilationResult, type HTMLTemplateTag, html, InlineTemplateDirective, type SyntheticViewTemplate, type TemplateValue, ViewTemplate, } from "./templating/template.js";
43
+ export { DefaultExecutionContext, type ElementView, HTMLView, type SyntheticView, type View, } from "./templating/view.js";
44
+ 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,7 @@ export declare const enum Message {
120
71
  onlySetTemplatePolicyOnce = 1207,
121
72
  cannotSetTemplatePolicyAfterCompilation = 1208,
122
73
  blockedByDOMPolicy = 1209,
74
+ invalidHydrationAttributeMarker = 1210,
123
75
  missingElementDefinition = 1401,
124
76
  noRegistrationForContext = 1501,
125
77
  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;
@@ -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
@@ -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";
@@ -39,7 +39,7 @@ export type State<T> = ReadonlyState<T> & {
39
39
  current: T;
40
40
  /**
41
41
  * Sets the current state value.
42
- * @param value The new state value.
42
+ * @param value - The new state value.
43
43
  */
44
44
  set(value: T): void;
45
45
  /**
@@ -121,7 +121,7 @@ export type ComputedBuilder = {
121
121
  on: {
122
122
  /**
123
123
  * Provides a setup callback for the computation.
124
- * @param callback The callback to run to setup the computation.
124
+ * @param callback - The callback to run to setup the computation.
125
125
  */
126
126
  setup(callback: ComputedSetupCallback): void;
127
127
  };
@@ -1,22 +1,16 @@
1
1
  import type { Constructable } from "../interfaces.js";
2
- import type { HostBehavior } from "./host.js";
3
2
  import type { ComposableStyles } from "./element-styles.js";
4
3
  /**
5
- * Used to add behaviors when constructing styles.
6
- * @public
7
- */
8
- export type AddBehavior = (behavior: HostBehavior<HTMLElement>) => void;
9
- /**
10
- * Directive for use in {@link css}.
4
+ * Directive for use in CSS templates.
11
5
  *
12
6
  * @public
13
7
  */
14
8
  export interface CSSDirective {
15
9
  /**
16
- * Creates a CSS fragment to interpolate into the CSS document.
17
- * @returns - the string to interpolate into CSS
10
+ * Creates static styles to interpolate into the CSS document.
11
+ * @returns - the styles to interpolate into CSS
18
12
  */
19
- createCSS(add: AddBehavior): ComposableStyles;
13
+ createCSS(): ComposableStyles;
20
14
  }
21
15
  /**
22
16
  * Defines metadata for a CSSDirective.
@@ -29,8 +23,7 @@ export interface CSSDirectiveDefinition<TType extends Constructable<CSSDirective
29
23
  readonly type: TType;
30
24
  }
31
25
  /**
32
- * Instructs the css engine to provide dynamic styles or
33
- * associate behaviors with styles.
26
+ * Instructs the css engine to provide styles during CSS template composition.
34
27
  * @public
35
28
  */
36
29
  export declare const CSSDirective: Readonly<{
@@ -1,36 +1,34 @@
1
- import { Binding } from "../binding/binding.js";
2
- import type { Expression } from "../observation/observable.js";
3
1
  import { CSSDirective } from "./css-directive.js";
4
2
  import { type ComposableStyles, ElementStyles } from "./element-styles.js";
5
3
  /**
6
4
  * Represents the types of values that can be interpolated into a template.
7
5
  * @public
8
6
  */
9
- export type CSSValue<TSource, TParent = any> = Expression<TSource, any, TParent> | Binding<TSource, any, TParent> | ComposableStyles | CSSDirective;
7
+ export type CSSValue = ComposableStyles | CSSDirective;
10
8
  /**
11
9
  * Transforms a template literal string into styles.
12
10
  * @param strings - The string fragments that are interpolated with the values.
13
11
  * @param values - The values that are interpolated with the string fragments.
14
12
  * @remarks
15
- * The css helper supports interpolation of strings and ElementStyle instances.
13
+ * The css helper supports interpolation of static composable styles and CSS directives.
16
14
  * Use the .partial method to create partial CSS fragments.
17
15
  * @public
18
16
  */
19
- export type CSSTemplateTag = (<TSource = any, TParent = any>(strings: TemplateStringsArray, ...values: CSSValue<TSource, TParent>[]) => ElementStyles) & {
17
+ export type CSSTemplateTag = ((strings: TemplateStringsArray, ...values: CSSValue[]) => ElementStyles) & {
20
18
  /**
21
19
  * Transforms a template literal string into partial CSS.
22
20
  * @param strings - The string fragments that are interpolated with the values.
23
21
  * @param values - The values that are interpolated with the string fragments.
24
22
  * @public
25
23
  */
26
- partial<TSource = any, TParent = any>(strings: TemplateStringsArray, ...values: CSSValue<TSource, TParent>[]): CSSDirective;
24
+ partial(strings: TemplateStringsArray, ...values: CSSValue[]): CSSDirective;
27
25
  };
28
26
  /**
29
27
  * Transforms a template literal string into styles.
30
28
  * @param strings - The string fragments that are interpolated with the values.
31
29
  * @param values - The values that are interpolated with the string fragments.
32
30
  * @remarks
33
- * The css helper supports interpolation of strings and ElementStyle instances.
31
+ * The css helper supports interpolation of static composable styles and CSS directives.
34
32
  * @public
35
33
  */
36
34
  export declare const css: CSSTemplateTag;
@@ -1,5 +1,4 @@
1
1
  import type { StyleStrategy, StyleTarget } from "./style-strategy.js";
2
- import type { HostBehavior } from "./host.js";
3
2
  /**
4
3
  * Represents styles that can be composed into the ShadowDOM of a custom element.
5
4
  * @public
@@ -24,10 +23,6 @@ export declare class ElementStyles {
24
23
  readonly styles: ReadonlyArray<ComposableStyles>;
25
24
  private targets;
26
25
  private _strategy;
27
- /**
28
- * The behaviors associated with this set of styles.
29
- */
30
- readonly behaviors: ReadonlyArray<HostBehavior<HTMLElement>> | null;
31
26
  /**
32
27
  * Gets the StyleStrategy associated with these element styles.
33
28
  */
@@ -43,11 +38,6 @@ export declare class ElementStyles {
43
38
  removeStylesFrom(target: StyleTarget): void;
44
39
  /** @internal */
45
40
  isAttachedTo(target: StyleTarget): boolean;
46
- /**
47
- * Associates behaviors with this set of styles.
48
- * @param behaviors - The behaviors to associate.
49
- */
50
- withBehaviors(...behaviors: HostBehavior<HTMLElement>[]): this;
51
41
  /**
52
42
  * Sets the strategy that handles adding/removing these styles for an element.
53
43
  * @param strategy - The strategy to use.
@@ -0,0 +1,6 @@
1
+ export type { Constructable } from "./interfaces.js";
2
+ export type { ExecutionContext, ExpressionController, SourceLifetime, } from "./observation/observable.js";
3
+ export { CSSDirective, type CSSDirectiveDefinition, cssDirective, } from "./styles/css-directive.js";
4
+ export { type ComposableStyles, type ConstructibleStyleStrategy, ElementStyles, } from "./styles/element-styles.js";
5
+ export type { HostBehavior, HostController } from "./styles/host.js";
6
+ export type { StyleStrategy, StyleTarget } from "./styles/style-strategy.js";
@@ -59,4 +59,4 @@ export declare class ChildrenDirective extends NodeObservationDirective<Children
59
59
  * @param propertyOrOptions - The options used to configure child node observation.
60
60
  * @public
61
61
  */
62
- export declare function children<TSource = any, TParent = any>(propertyOrOptions: (keyof TSource & string) | ChildrenDirectiveOptions<keyof TSource & string>): CaptureType<TSource, TParent>;
62
+ export declare function children<TSource = any>(propertyOrOptions: (keyof TSource & string) | ChildrenDirectiveOptions<keyof TSource & string>): CaptureType;
@@ -39,6 +39,10 @@ export interface ContentTemplate {
39
39
  */
40
40
  create(): ContentView;
41
41
  }
42
+ /**
43
+ * A template capable of hydrating content from existing DOM nodes.
44
+ * @beta
45
+ */
42
46
  export interface HydratableContentTemplate extends ContentTemplate {
43
47
  /**
44
48
  * Hydrates a content view from first/last nodes.
@@ -135,6 +139,12 @@ export declare class HTMLBindingDirective implements HTMLDirective, ViewBehavior
135
139
  * Re-evaluates the binding expression via observer.bind() and pushes
136
140
  * the new value to the DOM through the updateTarget sink function.
137
141
  * This is the reactive update path that keeps the DOM in sync with data.
142
+ *
143
+ * Guards against stale notifications: when a view is unbound (e.g., after
144
+ * a parent `when` directive tears down a child element), coupled-lifetime
145
+ * observers may still hold active subscriptions. If a property change fires
146
+ * on the source element while the view is inactive, this guard prevents
147
+ * the binding expression from evaluating with a null source.
138
148
  * @internal
139
149
  */
140
150
  handleChange(binding: Expression, observer: ExpressionObserver): void;
@@ -18,6 +18,23 @@ export interface ViewController<TSource = any, TParent = any> extends Expression
18
18
  * The parts of the view that are targeted by view behaviors.
19
19
  */
20
20
  readonly targets: ViewBehaviorTargets;
21
+ /**
22
+ * When true, directives skip attribute/booleanAttribute DOM
23
+ * updates during bind(). This is an internal flag set only
24
+ * during the prerendered bind window.
25
+ * @internal
26
+ */
27
+ readonly _skipAttrUpdates?: boolean;
28
+ /**
29
+ * Resolves `true` when the view's host element had prerendered
30
+ * content (existing shadow root).
31
+ */
32
+ readonly isPrerendered?: Promise<boolean>;
33
+ /**
34
+ * Resolves `true` after prerendered content has been hydrated,
35
+ * `false` when client-side rendered or hydration not enabled.
36
+ */
37
+ readonly isHydrated?: Promise<boolean>;
21
38
  }
22
39
  /**
23
40
  * Represents an object that can contribute behavior to a view.
@@ -0,0 +1,109 @@
1
+ import { Hydratable } from "../components/hydration.js";
2
+ import { type ViewBehaviorBoundaries } from "../hydration/target-builder.js";
3
+ import { type ExecutionContext, SourceLifetime } from "../observation/observable.js";
4
+ import type { ViewTemplate } from "../templating/template.js";
5
+ import type { ViewBehaviorFactory, ViewBehaviorTargets, ViewController } from "./html-directive.js";
6
+ import { DefaultExecutionContext, type ElementView, type SyntheticView } from "./view.js";
7
+ /** @public */
8
+ export interface HydratableView<TSource = any, TParent = any> extends ElementView, SyntheticView, DefaultExecutionContext<TParent> {
9
+ [Hydratable]: symbol;
10
+ readonly bindingViewBoundaries: Record<string, ViewNodes>;
11
+ readonly hydrationStage: keyof typeof HydrationStage;
12
+ }
13
+ /**
14
+ * A view controller that can hydrate existing DOM nodes.
15
+ * @beta
16
+ */
17
+ export type HydratableViewController<TSource = any, TParent = any> = HydratableView<TSource, TParent> & ViewController<TSource, TParent>;
18
+ /** @public */
19
+ export interface ViewNodes {
20
+ first: Node;
21
+ last: Node;
22
+ }
23
+ /** @public */
24
+ export declare const HydrationStage: {
25
+ readonly unhydrated: "unhydrated";
26
+ readonly hydrating: "hydrating";
27
+ readonly hydrated: "hydrated";
28
+ };
29
+ /** @public */
30
+ export declare class HydrationBindingError extends Error {
31
+ /**
32
+ * The factory that was unable to be bound
33
+ */
34
+ readonly factory: ViewBehaviorFactory;
35
+ /**
36
+ * A DocumentFragment containing a clone of the
37
+ * view's Nodes.
38
+ */
39
+ readonly fragment: DocumentFragment;
40
+ /**
41
+ * String representation of the HTML in the template that
42
+ * threw the binding error.
43
+ */
44
+ readonly templateString: string;
45
+ constructor(
46
+ /**
47
+ * The error message
48
+ */
49
+ message: string | undefined,
50
+ /**
51
+ * The factory that was unable to be bound
52
+ */
53
+ factory: ViewBehaviorFactory,
54
+ /**
55
+ * A DocumentFragment containing a clone of the
56
+ * view's Nodes.
57
+ */
58
+ fragment: DocumentFragment,
59
+ /**
60
+ * String representation of the HTML in the template that
61
+ * threw the binding error.
62
+ */
63
+ templateString: string);
64
+ }
65
+ export declare class HydrationView<TSource = any, TParent = any> extends DefaultExecutionContext<TParent> implements HydratableView {
66
+ readonly firstChild: Node;
67
+ readonly lastChild: Node;
68
+ private sourceTemplate;
69
+ private hostBindingTarget?;
70
+ [Hydratable]: symbol;
71
+ context: ExecutionContext<any>;
72
+ source: TSource | null;
73
+ isBound: boolean;
74
+ get hydrationStage(): "unhydrated" | "hydrating" | "hydrated";
75
+ get targets(): ViewBehaviorTargets;
76
+ get bindingViewBoundaries(): ViewBehaviorBoundaries;
77
+ readonly sourceLifetime: SourceLifetime;
78
+ private unbindables;
79
+ private fragment;
80
+ private behaviors;
81
+ private factories;
82
+ private _hydrationStage;
83
+ private _bindingViewBoundaries;
84
+ private _targets;
85
+ constructor(firstChild: Node, lastChild: Node, sourceTemplate: ViewTemplate, hostBindingTarget?: Element | undefined);
86
+ /**
87
+ * no-op. Hydrated views are don't need to be moved from a documentFragment
88
+ * to the target node.
89
+ */
90
+ insertBefore(node: Node): void;
91
+ /**
92
+ * Appends the view to a node. In cases where this is called before the
93
+ * view has been removed, the method will no-op.
94
+ * @param node - the node to append the view to.
95
+ */
96
+ appendTo(node: Node): void;
97
+ remove(): void;
98
+ bind(source: TSource, context?: ExecutionContext<any>): void;
99
+ unbind(): void;
100
+ /**
101
+ * Removes the view and unbinds its behaviors, disposing of DOM nodes afterward.
102
+ * Once a view has been disposed, it cannot be inserted or bound again.
103
+ */
104
+ dispose(): void;
105
+ onUnbind(behavior: {
106
+ unbind(controller: ViewController<TSource, TParent>): void;
107
+ }): void;
108
+ private evaluateUnbindables;
109
+ }
@@ -20,4 +20,4 @@ export declare class RefDirective extends StatelessAttachedAttributeDirective<st
20
20
  * @param propertyName - The name of the property to assign the reference to.
21
21
  * @public
22
22
  */
23
- export declare const ref: <TSource = any, TParent = any>(propertyName: keyof TSource & string) => CaptureType<TSource, TParent>;
23
+ export declare const ref: <TSource = any>(propertyName: keyof TSource & string) => CaptureType;
@@ -35,7 +35,13 @@ export declare class RenderBehavior<TSource = any> implements ViewBehavior, Subs
35
35
  * @param controller - The view controller that manages the lifecycle of this behavior.
36
36
  */
37
37
  unbind(controller: ViewController): void;
38
- /** @internal */
38
+ /**
39
+ * Handles changes from data or template binding observers.
40
+ * Guards against stale notifications that may arrive after the
41
+ * controller's view has been unbound (e.g., when a parent `when`
42
+ * directive tears down and later recreates a child element).
43
+ * @internal
44
+ */
39
45
  handleChange(source: any, observer: ExpressionObserver): void;
40
46
  private bindView;
41
47
  private refreshView;
@@ -308,5 +314,5 @@ export declare class NodeTemplate implements ContentTemplate, ContentView {
308
314
  * RenderInstruction to determine the view.
309
315
  * @public
310
316
  */
311
- export declare function render<TSource = any, TItem = any, TParent = any>(value?: Expression<TSource, TItem> | Binding<TSource, TItem> | {}, template?: ContentTemplate | string | Expression<TSource, ContentTemplate | string | Node, TParent> | Binding<TSource, ContentTemplate | string | Node, TParent>): CaptureType<TSource, TParent>;
317
+ export declare function render<TSource = any, TItem = any, TParent = any>(value?: Expression<TSource, TItem> | Binding<TSource, TItem> | {}, template?: ContentTemplate | string | Expression<TSource, ContentTemplate | string | Node, TParent> | Binding<TSource, ContentTemplate | string | Node, TParent>): CaptureType;
312
318
  export {};
@@ -1,5 +1,5 @@
1
1
  import type { Binding, BindingDirective } from "../binding/binding.js";
2
- import { Sort, Splice } from "../observation/arrays.js";
2
+ import { type Sort, type Splice } from "../observation/arrays.js";
3
3
  import type { Subscriber } from "../observation/notifier.js";
4
4
  import { type Expression, type ExpressionObserver } from "../observation/observable.js";
5
5
  import { type AddViewBehaviorFactory, HTMLDirective, type ViewBehavior, type ViewBehaviorFactory, type ViewController } from "./html-directive.js";
@@ -127,4 +127,4 @@ export declare class RepeatDirective<TSource = any> implements HTMLDirective, Vi
127
127
  * @param options - Options used to turn on special repeat features.
128
128
  * @public
129
129
  */
130
- export declare function repeat<TSource = any, TArray extends ReadonlyArray<any> = ReadonlyArray<any>, TParent = any>(items: Expression<TSource, TArray, TParent> | Binding<TSource, TArray, TParent> | ReadonlyArray<any>, template: Expression<TSource, ViewTemplate<any, TSource>> | Binding<TSource, ViewTemplate<any, TSource>> | ViewTemplate<any, TSource>, options?: RepeatOptions): CaptureType<TSource, TParent>;
130
+ export declare function repeat<TSource = any, TArray extends ReadonlyArray<any> = ReadonlyArray<any>, TParent = any>(items: Expression<TSource, TArray, TParent> | Binding<TSource, TArray, TParent> | ReadonlyArray<any>, template: Expression<TSource, ViewTemplate<any, TSource>> | Binding<TSource, ViewTemplate<any, TSource>> | ViewTemplate<any, TSource>, options?: RepeatOptions): CaptureType;
@@ -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, TParent = any>(propertyOrOptions: (keyof TSource & string) | SlottedDirectiveOptions<keyof TSource & string>): CaptureType<TSource, TParent>;
38
+ export declare function slotted<TSource = any>(propertyOrOptions: (keyof TSource & string) | SlottedDirectiveOptions<keyof TSource & string>): CaptureType;