@microsoft/fast-element 2.10.4 → 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 (349) hide show
  1. package/ARCHITECTURE_HTML_TAGGED_TEMPLATE_LITERAL.md +1 -1
  2. package/ARCHITECTURE_OVERVIEW.md +2 -2
  3. package/CHANGELOG.json +1 -1
  4. package/CHANGELOG.md +2 -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 +138 -33
  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/declarative/declarative.api.json +7844 -0
  23. package/dist/di/di.api.json +1 -1
  24. package/dist/dts/array-observer.d.ts +2 -0
  25. package/dist/dts/arrays.d.ts +2 -0
  26. package/dist/dts/attr.d.ts +1 -0
  27. package/dist/dts/binding/signal.d.ts +6 -6
  28. package/dist/dts/binding/two-way.d.ts +1 -0
  29. package/dist/dts/binding.d.ts +7 -0
  30. package/dist/dts/components/attributes.d.ts +2 -5
  31. package/dist/dts/components/definition-schema-transforms.d.ts +9 -0
  32. package/dist/dts/components/element-controller.d.ts +80 -114
  33. package/dist/dts/components/element-hydration.d.ts +1 -1
  34. package/dist/dts/components/enable-hydration.d.ts +34 -0
  35. package/dist/dts/components/fast-definitions.d.ts +91 -42
  36. package/dist/dts/components/fast-element.d.ts +5 -8
  37. package/dist/dts/components/hydration-tracker.d.ts +40 -0
  38. package/dist/dts/components/hydration.d.ts +18 -53
  39. package/dist/dts/components/schema.d.ts +205 -0
  40. package/dist/dts/context.d.ts +6 -6
  41. package/dist/dts/css.d.ts +3 -0
  42. package/dist/dts/debug.d.ts +5 -1
  43. package/dist/dts/declarative/attribute-map.d.ts +58 -0
  44. package/dist/dts/declarative/debug.d.ts +5 -0
  45. package/dist/dts/declarative/index.d.ts +13 -0
  46. package/dist/dts/declarative/interfaces.d.ts +9 -0
  47. package/dist/dts/declarative/observer-map-utilities.d.ts +58 -0
  48. package/dist/dts/declarative/observer-map.d.ts +89 -0
  49. package/dist/dts/declarative/runtime.d.ts +5 -0
  50. package/dist/dts/declarative/syntax.d.ts +21 -0
  51. package/dist/dts/declarative/template-bridge.d.ts +33 -0
  52. package/dist/dts/declarative/template-parser.d.ts +98 -0
  53. package/dist/dts/declarative/template.d.ts +9 -0
  54. package/dist/dts/declarative/utilities.d.ts +312 -0
  55. package/dist/dts/di/di.d.ts +1 -1
  56. package/dist/dts/directives/children.d.ts +2 -0
  57. package/dist/dts/directives/node-observation.d.ts +2 -0
  58. package/dist/dts/directives/ref.d.ts +2 -0
  59. package/dist/dts/directives/repeat.d.ts +4 -0
  60. package/dist/dts/directives/slotted.d.ts +2 -0
  61. package/dist/dts/directives/when.d.ts +3 -0
  62. package/dist/dts/dom-policy.d.ts +1 -1
  63. package/dist/dts/html.d.ts +5 -0
  64. package/dist/dts/hydration/runtime.d.ts +7 -0
  65. package/dist/dts/hydration/target-builder.d.ts +15 -12
  66. package/dist/dts/hydration.d.ts +14 -0
  67. package/dist/dts/index.d.ts +38 -42
  68. package/dist/dts/index.debug.d.ts +0 -1
  69. package/dist/dts/index.rollup.debug.d.ts +0 -1
  70. package/dist/dts/interfaces.d.ts +1 -49
  71. package/dist/dts/observable.d.ts +3 -6
  72. package/dist/dts/observation/arrays.d.ts +1 -1
  73. package/dist/dts/observation/update-queue.d.ts +1 -1
  74. package/dist/dts/platform.d.ts +25 -4
  75. package/dist/dts/render.d.ts +7 -0
  76. package/dist/dts/schema.d.ts +1 -0
  77. package/dist/dts/state/exports.d.ts +1 -1
  78. package/dist/dts/state/state.d.ts +2 -2
  79. package/dist/dts/styles/css-directive.d.ts +5 -12
  80. package/dist/dts/styles/css.d.ts +5 -7
  81. package/dist/dts/styles/element-styles.d.ts +0 -10
  82. package/dist/dts/styles.d.ts +6 -0
  83. package/dist/dts/templating/children.d.ts +1 -1
  84. package/dist/dts/templating/html-binding-directive.d.ts +4 -0
  85. package/dist/dts/templating/html-directive.d.ts +17 -0
  86. package/dist/dts/templating/hydration-view.d.ts +109 -0
  87. package/dist/dts/templating/ref.d.ts +1 -1
  88. package/dist/dts/templating/render.d.ts +1 -1
  89. package/dist/dts/templating/repeat.d.ts +2 -2
  90. package/dist/dts/templating/slotted.d.ts +1 -1
  91. package/dist/dts/templating/template.d.ts +17 -9
  92. package/dist/dts/templating/view.d.ts +25 -102
  93. package/dist/dts/templating/when.d.ts +1 -1
  94. package/dist/dts/templating.d.ts +10 -0
  95. package/dist/dts/testing/exports.d.ts +2 -2
  96. package/dist/dts/updates.d.ts +1 -0
  97. package/dist/dts/volatile.d.ts +2 -0
  98. package/dist/esm/array-observer.js +1 -0
  99. package/dist/esm/arrays.js +1 -0
  100. package/dist/esm/attr.js +1 -0
  101. package/dist/esm/binding/normalize.js +1 -1
  102. package/dist/esm/binding/signal.js +4 -4
  103. package/dist/esm/binding/two-way.js +2 -1
  104. package/dist/esm/binding.js +4 -0
  105. package/dist/esm/components/attributes.js +8 -5
  106. package/dist/esm/components/definition-schema-transforms.js +23 -0
  107. package/dist/esm/components/element-controller.js +200 -269
  108. package/dist/esm/components/element-hydration.js +1 -1
  109. package/dist/esm/components/enable-hydration.js +100 -0
  110. package/dist/esm/components/fast-definitions.js +211 -49
  111. package/dist/esm/components/fast-element.js +18 -27
  112. package/dist/esm/components/hydration-tracker.js +93 -0
  113. package/dist/esm/components/hydration.js +62 -144
  114. package/dist/esm/components/schema.js +253 -0
  115. package/dist/esm/context.js +6 -6
  116. package/dist/esm/css.js +3 -0
  117. package/dist/esm/debug.js +26 -26
  118. package/dist/esm/declarative/attribute-map.js +121 -0
  119. package/dist/esm/declarative/debug.js +5 -0
  120. package/dist/esm/declarative/index.js +3 -0
  121. package/dist/esm/declarative/interfaces.js +10 -0
  122. package/dist/esm/declarative/observer-map-utilities.js +562 -0
  123. package/dist/esm/declarative/observer-map.js +216 -0
  124. package/dist/esm/declarative/runtime.js +14 -0
  125. package/dist/esm/declarative/syntax.js +36 -0
  126. package/dist/esm/declarative/template-bridge.js +170 -0
  127. package/dist/esm/declarative/template-parser.js +306 -0
  128. package/dist/esm/declarative/template.js +142 -0
  129. package/dist/esm/declarative/utilities.js +834 -0
  130. package/dist/esm/di/di.js +6 -8
  131. package/dist/esm/directives/children.js +1 -0
  132. package/dist/esm/directives/node-observation.js +1 -0
  133. package/dist/esm/directives/ref.js +1 -0
  134. package/dist/esm/directives/repeat.js +1 -0
  135. package/dist/esm/directives/slotted.js +1 -0
  136. package/dist/esm/directives/when.js +1 -0
  137. package/dist/esm/dom-policy.js +2 -2
  138. package/dist/esm/dom.js +1 -1
  139. package/dist/esm/html.js +2 -0
  140. package/dist/esm/hydration/runtime.js +33 -0
  141. package/dist/esm/hydration/target-builder.js +97 -90
  142. package/dist/esm/hydration.js +4 -0
  143. package/dist/esm/index.debug.js +2 -1
  144. package/dist/esm/index.js +34 -29
  145. package/dist/esm/index.rollup.debug.js +3 -2
  146. package/dist/esm/index.rollup.js +1 -1
  147. package/dist/esm/interfaces.js +1 -45
  148. package/dist/esm/observable.js +1 -4
  149. package/dist/esm/observation/arrays.js +1 -1
  150. package/dist/esm/observation/observable.js +5 -5
  151. package/dist/esm/observation/update-queue.js +47 -58
  152. package/dist/esm/platform.js +31 -30
  153. package/dist/esm/render.js +1 -0
  154. package/dist/esm/schema.js +1 -0
  155. package/dist/esm/state/exports.js +1 -1
  156. package/dist/esm/styles/css-directive.js +1 -2
  157. package/dist/esm/styles/css.js +15 -56
  158. package/dist/esm/styles/element-styles.js +69 -15
  159. package/dist/esm/styles.js +2 -0
  160. package/dist/esm/templating/html-binding-directive.js +10 -8
  161. package/dist/esm/templating/hydration-view.js +235 -0
  162. package/dist/esm/templating/render.js +1 -1
  163. package/dist/esm/templating/repeat.js +36 -34
  164. package/dist/esm/templating/template.js +7 -7
  165. package/dist/esm/templating/view.js +24 -233
  166. package/dist/esm/templating.js +7 -0
  167. package/dist/esm/testing/exports.js +2 -2
  168. package/dist/esm/updates.js +1 -0
  169. package/dist/esm/volatile.js +1 -0
  170. package/dist/fast-element.api.json +9016 -6995
  171. package/dist/fast-element.d.ts +3557 -796
  172. package/dist/fast-element.debug.js +5088 -4437
  173. package/dist/fast-element.debug.min.js +2 -2
  174. package/dist/fast-element.js +5369 -4649
  175. package/dist/fast-element.min.js +2 -2
  176. package/dist/fast-element.untrimmed.d.ts +863 -475
  177. package/dist/hydration/hydration.api.json +5237 -0
  178. package/dist/styles/styles.api.json +2672 -0
  179. package/docs/api-report.api.md +343 -166
  180. package/docs/arrays/api-report.api.md +114 -0
  181. package/docs/declarative/api-report.api.md +397 -0
  182. package/docs/hydration/api-report.api.md +285 -0
  183. package/docs/styles/api-report.api.md +135 -0
  184. package/package.json +149 -41
  185. package/playwright.declarative.config.ts +26 -0
  186. package/playwright.declarative.webui.config.ts +20 -0
  187. package/scripts/declarative/build-fixtures-with-webui.js +135 -0
  188. package/scripts/declarative/build-fixtures.js +49 -0
  189. package/scripts/declarative/build-fixtures.utilities.js +101 -0
  190. package/scripts/measure-sizes.js +219 -0
  191. package/scripts/run-api-extractor.js +39 -20
  192. package/test/declarative/fixtures/README.md +72 -0
  193. package/test/declarative/fixtures/WRITING_FIXTURES.md +330 -0
  194. package/test/declarative/fixtures/bindings/README.md +12 -0
  195. package/test/declarative/fixtures/bindings/attribute/entry.html +13 -0
  196. package/test/declarative/fixtures/bindings/attribute/fast-build.config.json +6 -0
  197. package/test/declarative/fixtures/bindings/attribute/index.html +25 -0
  198. package/test/declarative/fixtures/bindings/attribute/main.ts +41 -0
  199. package/test/declarative/fixtures/bindings/attribute/state.json +8 -0
  200. package/test/declarative/fixtures/bindings/attribute/templates.html +11 -0
  201. package/test/declarative/fixtures/bindings/content/entry.html +12 -0
  202. package/test/declarative/fixtures/bindings/content/fast-build.config.json +6 -0
  203. package/test/declarative/fixtures/bindings/content/index.html +19 -0
  204. package/test/declarative/fixtures/bindings/content/main.ts +27 -0
  205. package/test/declarative/fixtures/bindings/content/state.json +4 -0
  206. package/test/declarative/fixtures/bindings/content/templates.html +6 -0
  207. package/test/declarative/fixtures/bindings/dot-syntax/entry.html +11 -0
  208. package/test/declarative/fixtures/bindings/dot-syntax/fast-build.config.json +6 -0
  209. package/test/declarative/fixtures/bindings/dot-syntax/index.html +47 -0
  210. package/test/declarative/fixtures/bindings/dot-syntax/main.ts +59 -0
  211. package/test/declarative/fixtures/bindings/dot-syntax/state.json +16 -0
  212. package/test/declarative/fixtures/bindings/dot-syntax/templates.html +17 -0
  213. package/test/declarative/fixtures/bindings/event/entry.html +11 -0
  214. package/test/declarative/fixtures/bindings/event/fast-build.config.json +6 -0
  215. package/test/declarative/fixtures/bindings/event/index.html +43 -0
  216. package/test/declarative/fixtures/bindings/event/main.ts +43 -0
  217. package/test/declarative/fixtures/bindings/event/state.json +3 -0
  218. package/test/declarative/fixtures/bindings/event/templates.html +18 -0
  219. package/test/declarative/fixtures/bindings/host/entry.html +40 -0
  220. package/test/declarative/fixtures/bindings/host/fast-build.config.json +6 -0
  221. package/test/declarative/fixtures/bindings/host/index.html +96 -0
  222. package/test/declarative/fixtures/bindings/host/main.ts +222 -0
  223. package/test/declarative/fixtures/bindings/host/state.json +9 -0
  224. package/test/declarative/fixtures/bindings/host/templates.html +55 -0
  225. package/test/declarative/fixtures/directives/README.md +12 -0
  226. package/test/declarative/fixtures/directives/children/entry.html +11 -0
  227. package/test/declarative/fixtures/directives/children/fast-build.config.json +6 -0
  228. package/test/declarative/fixtures/directives/children/index.html +15 -0
  229. package/test/declarative/fixtures/directives/children/main.ts +22 -0
  230. package/test/declarative/fixtures/directives/children/state.json +3 -0
  231. package/test/declarative/fixtures/directives/children/templates.html +3 -0
  232. package/test/declarative/fixtures/directives/ref/entry.html +11 -0
  233. package/test/declarative/fixtures/directives/ref/fast-build.config.json +6 -0
  234. package/test/declarative/fixtures/directives/ref/index.html +15 -0
  235. package/test/declarative/fixtures/directives/ref/main.ts +17 -0
  236. package/test/declarative/fixtures/directives/ref/state.json +1 -0
  237. package/test/declarative/fixtures/directives/ref/templates.html +3 -0
  238. package/test/declarative/fixtures/directives/repeat/entry.html +21 -0
  239. package/test/declarative/fixtures/directives/repeat/fast-build.config.json +6 -0
  240. package/test/declarative/fixtures/directives/repeat/index.html +133 -0
  241. package/test/declarative/fixtures/directives/repeat/main.ts +110 -0
  242. package/test/declarative/fixtures/directives/repeat/sprites.svg +8 -0
  243. package/test/declarative/fixtures/directives/repeat/state.json +10 -0
  244. package/test/declarative/fixtures/directives/repeat/templates.html +75 -0
  245. package/test/declarative/fixtures/directives/slotted/entry.html +17 -0
  246. package/test/declarative/fixtures/directives/slotted/fast-build.config.json +6 -0
  247. package/test/declarative/fixtures/directives/slotted/index.html +27 -0
  248. package/test/declarative/fixtures/directives/slotted/main.ts +29 -0
  249. package/test/declarative/fixtures/directives/slotted/state.json +1 -0
  250. package/test/declarative/fixtures/directives/slotted/templates.html +7 -0
  251. package/test/declarative/fixtures/directives/when/entry.html +51 -0
  252. package/test/declarative/fixtures/directives/when/fast-build.config.json +6 -0
  253. package/test/declarative/fixtures/directives/when/index.html +136 -0
  254. package/test/declarative/fixtures/directives/when/main.ts +172 -0
  255. package/test/declarative/fixtures/directives/when/state.json +12 -0
  256. package/test/declarative/fixtures/directives/when/templates.html +75 -0
  257. package/test/declarative/fixtures/ecosystem/README.md +11 -0
  258. package/test/declarative/fixtures/ecosystem/declarative-no-hydration/entry.html +12 -0
  259. package/test/declarative/fixtures/ecosystem/declarative-no-hydration/fast-build.config.json +6 -0
  260. package/test/declarative/fixtures/ecosystem/declarative-no-hydration/index.html +20 -0
  261. package/test/declarative/fixtures/ecosystem/declarative-no-hydration/main.ts +68 -0
  262. package/test/declarative/fixtures/ecosystem/declarative-no-hydration/state.json +4 -0
  263. package/test/declarative/fixtures/ecosystem/declarative-no-hydration/templates.html +7 -0
  264. package/test/declarative/fixtures/ecosystem/errors/entry.html +12 -0
  265. package/test/declarative/fixtures/ecosystem/errors/fast-build.config.json +6 -0
  266. package/test/declarative/fixtures/ecosystem/errors/index.html +20 -0
  267. package/test/declarative/fixtures/ecosystem/errors/main.ts +17 -0
  268. package/test/declarative/fixtures/ecosystem/errors/state.json +1 -0
  269. package/test/declarative/fixtures/ecosystem/errors/templates.html +7 -0
  270. package/test/declarative/fixtures/ecosystem/lifecycle-callbacks/entry.html +17 -0
  271. package/test/declarative/fixtures/ecosystem/lifecycle-callbacks/fast-build.config.json +6 -0
  272. package/test/declarative/fixtures/ecosystem/lifecycle-callbacks/index.html +56 -0
  273. package/test/declarative/fixtures/ecosystem/lifecycle-callbacks/main.ts +134 -0
  274. package/test/declarative/fixtures/ecosystem/lifecycle-callbacks/state.json +12 -0
  275. package/test/declarative/fixtures/ecosystem/lifecycle-callbacks/templates.html +34 -0
  276. package/test/declarative/fixtures/ecosystem/performance-metrics/entry.html +25 -0
  277. package/test/declarative/fixtures/ecosystem/performance-metrics/fast-build.config.json +6 -0
  278. package/test/declarative/fixtures/ecosystem/performance-metrics/fast-card.css +10 -0
  279. package/test/declarative/fixtures/ecosystem/performance-metrics/index.html +181 -0
  280. package/test/declarative/fixtures/ecosystem/performance-metrics/main.ts +58 -0
  281. package/test/declarative/fixtures/ecosystem/performance-metrics/state.json +6 -0
  282. package/test/declarative/fixtures/ecosystem/performance-metrics/templates.html +15 -0
  283. package/test/declarative/fixtures/extensions/README.md +15 -0
  284. package/test/declarative/fixtures/extensions/attribute-map/entry.html +14 -0
  285. package/test/declarative/fixtures/extensions/attribute-map/fast-build.config.json +6 -0
  286. package/test/declarative/fixtures/extensions/attribute-map/index.html +31 -0
  287. package/test/declarative/fixtures/extensions/attribute-map/main.ts +40 -0
  288. package/test/declarative/fixtures/extensions/attribute-map/state.json +4 -0
  289. package/test/declarative/fixtures/extensions/attribute-map/templates.html +14 -0
  290. package/test/declarative/fixtures/extensions/attribute-map-naming-strategy/entry.html +12 -0
  291. package/test/declarative/fixtures/extensions/attribute-map-naming-strategy/fast-build.config.json +7 -0
  292. package/test/declarative/fixtures/extensions/attribute-map-naming-strategy/index.html +25 -0
  293. package/test/declarative/fixtures/extensions/attribute-map-naming-strategy/main.ts +31 -0
  294. package/test/declarative/fixtures/extensions/attribute-map-naming-strategy/state.json +5 -0
  295. package/test/declarative/fixtures/extensions/attribute-map-naming-strategy/templates.html +11 -0
  296. package/test/declarative/fixtures/extensions/attribute-map-naming-strategy-camel-case/entry.html +13 -0
  297. package/test/declarative/fixtures/extensions/attribute-map-naming-strategy-camel-case/fast-build.config.json +7 -0
  298. package/test/declarative/fixtures/extensions/attribute-map-naming-strategy-camel-case/index.html +23 -0
  299. package/test/declarative/fixtures/extensions/attribute-map-naming-strategy-camel-case/main.ts +37 -0
  300. package/test/declarative/fixtures/extensions/attribute-map-naming-strategy-camel-case/state.json +1 -0
  301. package/test/declarative/fixtures/extensions/attribute-map-naming-strategy-camel-case/templates.html +9 -0
  302. package/test/declarative/fixtures/extensions/observer-map/entry.html +15 -0
  303. package/test/declarative/fixtures/extensions/observer-map/fast-build.config.json +6 -0
  304. package/test/declarative/fixtures/extensions/observer-map/index.html +442 -0
  305. package/test/declarative/fixtures/extensions/observer-map/main.ts +482 -0
  306. package/test/declarative/fixtures/extensions/observer-map/state.json +158 -0
  307. package/test/declarative/fixtures/extensions/observer-map/templates.html +172 -0
  308. package/test/declarative/fixtures/extensions/observer-map-config-object/entry.html +16 -0
  309. package/test/declarative/fixtures/extensions/observer-map-config-object/fast-build.config.json +6 -0
  310. package/test/declarative/fixtures/extensions/observer-map-config-object/index.html +27 -0
  311. package/test/declarative/fixtures/extensions/observer-map-config-object/main.ts +53 -0
  312. package/test/declarative/fixtures/extensions/observer-map-config-object/state.json +9 -0
  313. package/test/declarative/fixtures/extensions/observer-map-config-object/templates.html +12 -0
  314. package/test/declarative/fixtures/extensions/observer-map-deep-merge/README.md +98 -0
  315. package/test/declarative/fixtures/extensions/observer-map-deep-merge/entry.html +156 -0
  316. package/test/declarative/fixtures/extensions/observer-map-deep-merge/fast-build.config.json +6 -0
  317. package/test/declarative/fixtures/extensions/observer-map-deep-merge/index.html +376 -0
  318. package/test/declarative/fixtures/extensions/observer-map-deep-merge/main.ts +366 -0
  319. package/test/declarative/fixtures/extensions/observer-map-deep-merge/state.json +69 -0
  320. package/test/declarative/fixtures/extensions/observer-map-deep-merge/templates.html +91 -0
  321. package/test/declarative/fixtures/extensions/observer-map-properties/entry.html +14 -0
  322. package/test/declarative/fixtures/extensions/observer-map-properties/fast-build.config.json +6 -0
  323. package/test/declarative/fixtures/extensions/observer-map-properties/index.html +110 -0
  324. package/test/declarative/fixtures/extensions/observer-map-properties/main.ts +175 -0
  325. package/test/declarative/fixtures/extensions/observer-map-properties/state.json +29 -0
  326. package/test/declarative/fixtures/extensions/observer-map-properties/templates.html +55 -0
  327. package/test/declarative/fixtures/scenarios/README.md +7 -0
  328. package/test/declarative/fixtures/scenarios/nested-elements/entry.html +16 -0
  329. package/test/declarative/fixtures/scenarios/nested-elements/fast-build.config.json +6 -0
  330. package/test/declarative/fixtures/scenarios/nested-elements/index.html +126 -0
  331. package/test/declarative/fixtures/scenarios/nested-elements/main.ts +214 -0
  332. package/test/declarative/fixtures/scenarios/nested-elements/state.json +10 -0
  333. package/test/declarative/fixtures/scenarios/nested-elements/templates.html +54 -0
  334. package/test/declarative/index.html +12 -0
  335. package/test/declarative/vite.config.ts +55 -0
  336. package/test/declarative-main.ts +6 -0
  337. package/test/extension-subpaths-main.ts +9 -0
  338. package/test/main.ts +38 -33
  339. package/test/pure-declarative-main.ts +1 -0
  340. package/dist/dts/components/install-hydration.d.ts +0 -1
  341. package/dist/dts/pending-task.d.ts +0 -32
  342. package/dist/dts/polyfills.d.ts +0 -0
  343. package/dist/dts/styles/css-binding-directive.d.ts +0 -60
  344. package/dist/dts/templating/install-hydratable-view-templates.d.ts +0 -1
  345. package/dist/esm/components/install-hydration.js +0 -3
  346. package/dist/esm/pending-task.js +0 -28
  347. package/dist/esm/polyfills.js +0 -60
  348. package/dist/esm/styles/css-binding-directive.js +0 -76
  349. package/dist/esm/templating/install-hydratable-view-templates.js +0 -23
@@ -0,0 +1,54 @@
1
+ <f-template name="test-element-repeat-event">
2
+ <template>
3
+ <ul>
4
+ <f-repeat value="{{item in repeatEventItems}}">
5
+ <li>
6
+ <button type="button" @click="{$c.parent.handleItemClick($e)}">{{item.name}}</button>
7
+ </li>
8
+ </f-repeat>
9
+ </ul>
10
+ </template>
11
+ </f-template>
12
+ <f-template name="test-when-in-repeat">
13
+ <template>
14
+ <ul>
15
+ <f-repeat value="{{item in whenRepeatItems}}">
16
+ <li>
17
+ <f-when value="{{showNames}}">
18
+ <button class="name" type="button" @click="{$c.parent.handleItemClick($e)}">{{item.name}}</button>
19
+ </f-when>
20
+ </li>
21
+ </f-repeat>
22
+ </ul>
23
+ </template>
24
+ </f-template>
25
+ <f-template name="grand-child-element">
26
+ <template>
27
+ <span class="category">{{category}}</span>
28
+ </template>
29
+ </f-template>
30
+ <f-template name="child-element">
31
+ <template>
32
+ <div class="item">
33
+ <span class="index">{{idx}}</span>
34
+ <span class="text">{{text}}</span>
35
+ <grand-child-element category="{{category}}"></grand-child-element>
36
+ </div>
37
+ </template>
38
+ </f-template>
39
+ <f-template name="parent-element">
40
+ <template>
41
+ <div class="list-container">
42
+ <h2>{{title}}</h2>
43
+ <div class="items">
44
+ <f-repeat value="{{item in items}}" positioning="true">
45
+ <child-element
46
+ text="{{item.text}}"
47
+ idx="{{$index}}"
48
+ category="{{category}}"
49
+ ></child-element>
50
+ </f-repeat>
51
+ </div>
52
+ </div>
53
+ </template>
54
+ </f-template>
@@ -0,0 +1,12 @@
1
+ <!DOCTYPE html>
2
+ <html lang="en">
3
+ <head>
4
+ <meta charset="UTF-8">
5
+ <meta name="viewport" content="width=device-width, initial-scale=1.0">
6
+ <title>FAST HTML Test Suite</title>
7
+ </head>
8
+ <body>
9
+ <h1>FAST HTML Test Suite</h1>
10
+ <ul><!--TOC--></ul>
11
+ </body>
12
+ </html>
@@ -0,0 +1,55 @@
1
+ import { readdirSync } from "node:fs";
2
+ import { dirname, join } from "node:path";
3
+ import { fileURLToPath } from "node:url";
4
+ import { defineConfig } from "vite";
5
+
6
+ const __dirname = dirname(fileURLToPath(import.meta.url));
7
+ const fixturesDir = join(__dirname, "fixtures");
8
+
9
+ function discoverFixtureInputs(): Record<string, string> {
10
+ const inputs: Record<string, string> = {
11
+ index: join(__dirname, "index.html"),
12
+ };
13
+
14
+ for (const category of readdirSync(fixturesDir, { withFileTypes: true })) {
15
+ if (!category.isDirectory()) {
16
+ continue;
17
+ }
18
+
19
+ const categoryDir = join(fixturesDir, category.name);
20
+
21
+ for (const fixture of readdirSync(categoryDir, { withFileTypes: true })) {
22
+ if (!fixture.isDirectory()) {
23
+ continue;
24
+ }
25
+
26
+ const key = `${category.name}/${fixture.name}`;
27
+ inputs[key] = join(categoryDir, fixture.name, "index.html");
28
+ }
29
+ }
30
+
31
+ return inputs;
32
+ }
33
+
34
+ export default defineConfig({
35
+ plugins: [
36
+ {
37
+ name: "html-toc",
38
+ transformIndexHtml(html) {
39
+ const inputs = discoverFixtureInputs();
40
+ const toc = Object.keys(inputs)
41
+ .filter(key => key !== "index")
42
+ .sort()
43
+ .map(key => `<li><a href="/fixtures/${key}/">${key}</a></li>`)
44
+ .join("");
45
+
46
+ return html.replace("<!--TOC-->", toc);
47
+ },
48
+ },
49
+ ],
50
+ build: {
51
+ rollupOptions: {
52
+ input: discoverFixtureInputs(),
53
+ },
54
+ },
55
+ });
@@ -0,0 +1,6 @@
1
+ export {
2
+ declarativeTemplate,
3
+ Schema,
4
+ TemplateParser,
5
+ } from "../src/declarative/index.js";
6
+ export { FASTElement, FASTElementDefinition, uniqueElementName } from "./main.js";
@@ -0,0 +1,9 @@
1
+ export {
2
+ AttributeMap,
3
+ attributeMap,
4
+ } from "@microsoft/fast-element/attribute-map.js";
5
+ export {
6
+ ObserverMap,
7
+ observerMap,
8
+ } from "@microsoft/fast-element/observer-map.js";
9
+ export { Schema } from "../src/components/schema.js";
package/test/main.ts CHANGED
@@ -1,30 +1,37 @@
1
- import "../src/debug.js";
1
+ import { enableDebug } from "../src/debug.js";
2
+
3
+ enableDebug();
2
4
 
3
- export { customElement, FASTElement } from "../src/components/fast-element.js";
4
5
  export {
5
- attr,
6
6
  AttributeConfiguration,
7
7
  AttributeDefinition,
8
+ attr,
8
9
  } from "../src/components/attributes.js";
9
10
  export {
10
- ElementController,
11
- HydratableElementController,
12
11
  AdoptedStyleSheetsStrategy,
12
+ ElementController,
13
13
  StyleElementStrategy,
14
- needsHydrationAttribute,
15
- deferHydrationAttribute,
16
14
  } from "../src/components/element-controller.js";
15
+ export type { FASTElementExtension } from "../src/components/fast-definitions.js";
17
16
  export { FASTElementDefinition } from "../src/components/fast-definitions.js";
18
- export { HydrationMarkup } from "../src/components/hydration.js";
17
+ export { customElement, FASTElement } from "../src/components/fast-element.js";
18
+ export {
19
+ HydrationMarkup,
20
+ isHydratable,
21
+ } from "../src/components/hydration.js";
22
+ export {
23
+ deferHydrationAttribute,
24
+ enableHydration,
25
+ } from "../src/components/enable-hydration.js";
19
26
  export { Context } from "../src/context.js";
20
27
  export {
28
+ all,
21
29
  Container,
22
30
  ContainerConfiguration,
23
31
  ContainerImpl,
24
32
  DefaultResolver,
25
33
  DI,
26
34
  FactoryImpl,
27
- all,
28
35
  inject,
29
36
  lazy,
30
37
  optional,
@@ -42,13 +49,13 @@ export { css } from "../src/styles/css.js";
42
49
  export { ElementStyles } from "../src/styles/element-styles.js";
43
50
  export { ref } from "../src/templating/ref.js";
44
51
  export { html } from "../src/templating/template.js";
52
+ export { Fake } from "../src/testing/fakes.js";
45
53
  export { uniqueElementName } from "../src/testing/fixture.js";
46
54
  export { ChildModel, DerivedModel, Model } from "../src/testing/models.js";
47
- export { Fake } from "../src/testing/fakes.js";
48
55
  export { composedContains, composedParent } from "../src/utilities.js";
49
56
  export const conditionalTimeout = function (
50
57
  condition: boolean,
51
- iteration = 0
58
+ iteration = 0,
52
59
  ): Promise<boolean> {
53
60
  return new Promise(function (resolve) {
54
61
  setTimeout(() => {
@@ -60,41 +67,39 @@ export const conditionalTimeout = function (
60
67
  }, 5);
61
68
  });
62
69
  };
63
- export { ArrayObserver, lengthOf, Splice } from "../src/observation/arrays.js";
64
- export { ownedState, reactive, state, watch } from "../src/state/exports.js";
65
- export { fixture } from "../src/testing/fixture.js";
66
- export { CSSBindingDirective } from "../src/styles/css-binding-directive.js";
67
- export { cssDirective, CSSDirective } from "../src/styles/css-directive.js";
68
- export { ExecutionContext } from "../src/observation/observable.js";
70
+ export { createTrackableDOMPolicy, toHTML } from "../src/__test__/helpers.js";
69
71
  export { Binding } from "../src/binding/binding.js";
70
72
  export { oneTime } from "../src/binding/one-time.js";
71
- export { oneWay, listener } from "../src/binding/one-way.js";
73
+ export { listener, oneWay } from "../src/binding/one-way.js";
72
74
  export { Signal, signal } from "../src/binding/signal.js";
73
75
  export { twoWay } from "../src/binding/two-way.js";
76
+ export { isString } from "../src/interfaces.js";
77
+ export { Metadata } from "../src/metadata.js";
78
+ export { ArrayObserver, lengthOf, Splice } from "../src/observation/arrays.js";
79
+ export { ExecutionContext } from "../src/observation/observable.js";
80
+ export { emptyArray, FAST } from "../src/platform.js";
81
+ export { ownedState, reactive, state, watch } from "../src/state/exports.js";
82
+ export { CSSDirective, cssDirective } from "../src/styles/css-directive.js";
83
+ export { ChildrenDirective, children } from "../src/templating/children.js";
84
+ export { Compiler } from "../src/templating/compiler.js";
74
85
  export { HTMLBindingDirective } from "../src/templating/html-binding-directive.js";
75
- export { ViewTemplate } from "../src/templating/template.js";
76
- export { HTMLView } from "../src/templating/view.js";
77
86
  export { HTMLDirective, htmlDirective } from "../src/templating/html-directive.js";
78
- export { nextId } from "../src/templating/markup.js";
79
- export { createTrackableDOMPolicy, toHTML } from "../src/__test__/helpers.js";
80
- export { children, ChildrenDirective } from "../src/templating/children.js";
87
+ export { Markup, nextId, Parser } from "../src/templating/markup.js";
81
88
  export { elements } from "../src/templating/node-observation.js";
82
- export { Compiler } from "../src/templating/compiler.js";
83
- export { Markup, Parser } from "../src/templating/markup.js";
84
- export { when } from "../src/templating/when.js";
85
89
  export {
86
- render,
90
+ NodeTemplate,
87
91
  RenderBehavior,
88
92
  RenderDirective,
89
93
  RenderInstruction,
90
- NodeTemplate,
94
+ render,
91
95
  renderWith,
92
96
  } from "../src/templating/render.js";
93
- export { repeat, RepeatBehavior, RepeatDirective } from "../src/templating/repeat.js";
94
- export { slotted, SlottedDirective } from "../src/templating/slotted.js";
95
- export { isString } from "../src/interfaces.js";
96
- export { FAST, emptyArray } from "../src/platform.js";
97
- export { Metadata } from "../src/metadata.js";
97
+ export { RepeatBehavior, RepeatDirective, repeat } from "../src/templating/repeat.js";
98
+ export { SlottedDirective, slotted } from "../src/templating/slotted.js";
99
+ export { ViewTemplate } from "../src/templating/template.js";
100
+ export { HTMLView } from "../src/templating/view.js";
101
+ export { when } from "../src/templating/when.js";
102
+ export { fixture } from "../src/testing/fixture.js";
98
103
  export function removeWhitespace(str: string): string {
99
104
  return str
100
105
  .trim()
@@ -0,0 +1 @@
1
+ export { Schema, TemplateParser } from "../src/declarative/index.js";
@@ -1 +0,0 @@
1
- import "../templating/install-hydratable-view-templates.js";
@@ -1,32 +0,0 @@
1
- /**
2
- * An implementation of the https://github.com/webcomponents-cg/community-protocols/blob/main/proposals/pending-task.md proposal.
3
- * @public
4
- */
5
- export interface PendingTask extends Event {
6
- /**
7
- * A promise that resolves when the pending task is complete.
8
- */
9
- readonly complete: Promise<void>;
10
- }
11
- /**
12
- * A concrete implementation of {@link PendingTask}
13
- * @public
14
- */
15
- export declare class PendingTaskEvent extends Event implements PendingTask {
16
- readonly complete: Promise<void>;
17
- /**
18
- * The type of the pending task event.
19
- */
20
- static readonly type = "pending-task";
21
- /**
22
- * Creates an instance of PendingTaskEvent.
23
- * @param complete - A promise that resolves when the pending task is complete.
24
- */
25
- constructor(complete: Promise<void>);
26
- /**
27
- * Determines whether a value is a PendingTaskEvent.
28
- * @param value - The value to check.
29
- * @returns True if the value is a PendingTaskEvent; false otherwise.
30
- */
31
- static isPendingTask<T extends Event>(value: T | PendingTask): value is PendingTask;
32
- }
File without changes
@@ -1,60 +0,0 @@
1
- import type { Binding, BindingDirective } from "../binding/binding.js";
2
- import type { Subscriber } from "../observation/notifier.js";
3
- import type { ExpressionObserver } from "../observation/observable.js";
4
- import { type AddBehavior, CSSDirective } from "./css-directive.js";
5
- import type { ComposableStyles } from "./element-styles.js";
6
- import type { HostBehavior, HostController } from "./host.js";
7
- type CSSBindingEntry = {
8
- observer: ExpressionObserver;
9
- controller: HostController;
10
- };
11
- /**
12
- * Enables bindings in CSS.
13
- *
14
- * @public
15
- */
16
- export declare class CSSBindingDirective implements HostBehavior, Subscriber, CSSDirective, BindingDirective {
17
- readonly dataBinding: Binding;
18
- readonly targetAspect: string;
19
- /**
20
- * Creates an instance of CSSBindingDirective.
21
- * @param dataBinding - The binding to use in CSS.
22
- * @param targetAspect - The CSS property to target.
23
- */
24
- constructor(dataBinding: Binding, targetAspect: string);
25
- /**
26
- * Creates a CSS fragment to interpolate into the CSS document.
27
- * @returns - the string to interpolate into CSS
28
- */
29
- createCSS(add: AddBehavior): ComposableStyles;
30
- /**
31
- * Executed when this behavior is attached to a controller.
32
- * @param controller - Controls the behavior lifecycle.
33
- */
34
- addedCallback(controller: HostController<HTMLElement & {
35
- $cssBindings: Map<CSSBindingDirective, CSSBindingEntry>;
36
- }>): void;
37
- /**
38
- * Executed when this behavior's host is connected.
39
- * @param controller - Controls the behavior lifecycle.
40
- */
41
- connectedCallback(controller: HostController<HTMLElement & {
42
- $cssBindings: Map<CSSBindingDirective, CSSBindingEntry>;
43
- }>): void;
44
- /**
45
- * Executed when this behavior is detached from a controller.
46
- * @param controller - Controls the behavior lifecycle.
47
- */
48
- removedCallback(controller: HostController<HTMLElement & {
49
- $cssBindings: Map<CSSBindingDirective, CSSBindingEntry>;
50
- }>): void;
51
- /**
52
- * Called when a subject this instance has subscribed to changes.
53
- * @param subject - The subject of the change.
54
- * @param args - The event args detailing the change that occurred.
55
- *
56
- * @internal
57
- */
58
- handleChange(_: any, observer: ExpressionObserver): void;
59
- }
60
- export {};
@@ -1,3 +0,0 @@
1
- import "../templating/install-hydratable-view-templates.js";
2
- import { HydratableElementController } from "./element-controller.js";
3
- HydratableElementController.install();
@@ -1,28 +0,0 @@
1
- /**
2
- * A concrete implementation of {@link PendingTask}
3
- * @public
4
- */
5
- export class PendingTaskEvent extends Event {
6
- /**
7
- * Creates an instance of PendingTaskEvent.
8
- * @param complete - A promise that resolves when the pending task is complete.
9
- */
10
- constructor(complete) {
11
- super(PendingTaskEvent.type, { bubbles: true, composed: true });
12
- this.complete = complete;
13
- }
14
- /**
15
- * Determines whether a value is a PendingTaskEvent.
16
- * @param value - The value to check.
17
- * @returns True if the value is a PendingTaskEvent; false otherwise.
18
- */
19
- static isPendingTask(value) {
20
- var _a;
21
- return (value.type === PendingTaskEvent.type &&
22
- typeof ((_a = value.complete) === null || _a === void 0 ? void 0 : _a.then) === "function");
23
- }
24
- }
25
- /**
26
- * The type of the pending task event.
27
- */
28
- PendingTaskEvent.type = "pending-task";
@@ -1,60 +0,0 @@
1
- /* eslint-disable @typescript-eslint/ban-ts-comment */
2
- (function ensureGlobalThis() {
3
- if (typeof globalThis !== "undefined") {
4
- // We're running in a modern environment.
5
- return;
6
- }
7
- // @ts-ignore
8
- if (typeof global !== "undefined") {
9
- // We're running in NodeJS
10
- // @ts-ignore
11
- global.globalThis = global;
12
- }
13
- else if (typeof self !== "undefined") {
14
- self.globalThis = self;
15
- }
16
- else if (typeof window !== "undefined") {
17
- // We're running in the browser's main thread.
18
- window.globalThis = window;
19
- }
20
- else {
21
- // Hopefully we never get here...
22
- // Not all environments allow eval and Function. Use only as a last resort:
23
- // eslint-disable-next-line no-new-func
24
- const result = new Function("return this")();
25
- result.globalThis = result;
26
- }
27
- })();
28
- (function requestIdleCallbackPolyfill() {
29
- if ("requestIdleCallback" in globalThis) {
30
- return;
31
- }
32
- /**
33
- * A polyfill for requestIdleCallback that falls back to setTimeout.
34
- *
35
- * @param callback - The function to call when the browser is idle.
36
- * @param options - Options object that may contain a timeout property.
37
- * @returns An ID that can be used to cancel the callback.
38
- * @public
39
- */
40
- globalThis.requestIdleCallback = function requestIdleCallback(callback, options) {
41
- const start = Date.now();
42
- return setTimeout(() => {
43
- callback({
44
- didTimeout: (options === null || options === void 0 ? void 0 : options.timeout)
45
- ? Date.now() - start >= options.timeout
46
- : false,
47
- timeRemaining: () => 0,
48
- });
49
- }, 1);
50
- };
51
- /**
52
- * A polyfill for cancelIdleCallback that falls back to clearTimeout.
53
- *
54
- * @param id - The ID of the callback to cancel.
55
- * @public
56
- */
57
- globalThis.cancelIdleCallback = function cancelIdleCallback(id) {
58
- clearTimeout(id);
59
- };
60
- })();
@@ -1,76 +0,0 @@
1
- import { CSSDirective } from "./css-directive.js";
2
- function handleChange(directive, controller, observer) {
3
- controller.source.style.setProperty(directive.targetAspect, observer.bind(controller));
4
- }
5
- /**
6
- * Enables bindings in CSS.
7
- *
8
- * @public
9
- */
10
- export class CSSBindingDirective {
11
- /**
12
- * Creates an instance of CSSBindingDirective.
13
- * @param dataBinding - The binding to use in CSS.
14
- * @param targetAspect - The CSS property to target.
15
- */
16
- constructor(dataBinding, targetAspect) {
17
- this.dataBinding = dataBinding;
18
- this.targetAspect = targetAspect;
19
- }
20
- /**
21
- * Creates a CSS fragment to interpolate into the CSS document.
22
- * @returns - the string to interpolate into CSS
23
- */
24
- createCSS(add) {
25
- add(this);
26
- return `var(${this.targetAspect})`;
27
- }
28
- /**
29
- * Executed when this behavior is attached to a controller.
30
- * @param controller - Controls the behavior lifecycle.
31
- */
32
- addedCallback(controller) {
33
- var _a;
34
- const element = controller.source;
35
- if (!element.$cssBindings) {
36
- element.$cssBindings = new Map();
37
- const setAttribute = element.setAttribute;
38
- element.setAttribute = (attr, value) => {
39
- setAttribute.call(element, attr, value);
40
- if (attr === "style") {
41
- element.$cssBindings.forEach((v, k) => handleChange(k, v.controller, v.observer));
42
- }
43
- };
44
- }
45
- const observer = (_a = controller[this.targetAspect]) !== null && _a !== void 0 ? _a : (controller[this.targetAspect] = this.dataBinding.createObserver(this, this));
46
- observer.controller = controller;
47
- controller.source.$cssBindings.set(this, { controller, observer });
48
- }
49
- /**
50
- * Executed when this behavior's host is connected.
51
- * @param controller - Controls the behavior lifecycle.
52
- */
53
- connectedCallback(controller) {
54
- handleChange(this, controller, controller[this.targetAspect]);
55
- }
56
- /**
57
- * Executed when this behavior is detached from a controller.
58
- * @param controller - Controls the behavior lifecycle.
59
- */
60
- removedCallback(controller) {
61
- if (controller.source.$cssBindings) {
62
- controller.source.$cssBindings.delete(this);
63
- }
64
- }
65
- /**
66
- * Called when a subject this instance has subscribed to changes.
67
- * @param subject - The subject of the change.
68
- * @param args - The event args detailing the change that occurred.
69
- *
70
- * @internal
71
- */
72
- handleChange(_, observer) {
73
- handleChange(this, observer.controller, observer);
74
- }
75
- }
76
- CSSDirective.define(CSSBindingDirective);
@@ -1,23 +0,0 @@
1
- import { Hydratable } from "../components/hydration.js";
2
- import { ViewTemplate } from "./template.js";
3
- import { HydrationView } from "./view.js";
4
- // Configure ViewTemplate to be hydratable by attaching a symbol identifier
5
- // and a hydrate method. Augmenting the hydration features is done by
6
- // property assignment instead of class extension to better allow the
7
- // hydration feature to be tree-shaken.
8
- //
9
- // When hydrate() is called, it creates a HydrationView that wraps the
10
- // pre-rendered DOM range (firstChild → lastChild) instead of cloning a
11
- // compiled DocumentFragment. The HydrationView will then use
12
- // buildViewBindingTargets() to scan for hydration markers and attach
13
- // reactive bindings to the existing DOM nodes.
14
- Object.defineProperties(ViewTemplate.prototype, {
15
- [Hydratable]: { value: Hydratable, enumerable: false, configurable: false },
16
- hydrate: {
17
- value: function (firstChild, lastChild, hostBindingTarget) {
18
- return new HydrationView(firstChild, lastChild, this, hostBindingTarget);
19
- },
20
- enumerable: true,
21
- configurable: false,
22
- },
23
- });