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

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (286) hide show
  1. package/CHANGELOG.md +51 -1
  2. package/README.md +50 -14
  3. package/dist/context/context.api.json +13 -13
  4. package/dist/declarative/declarative.api.json +654 -15
  5. package/dist/di/di.api.json +15 -15
  6. package/dist/dts/__test__/helpers.d.ts +6 -0
  7. package/dist/dts/__test__/setup-node.d.ts +0 -0
  8. package/dist/dts/binding/binding.d.ts +15 -5
  9. package/dist/dts/binding/one-time.d.ts +1 -1
  10. package/dist/dts/binding/one-way.d.ts +1 -1
  11. package/dist/dts/binding/signal.d.ts +1 -1
  12. package/dist/dts/binding/two-way.d.ts +1 -1
  13. package/dist/dts/components/attributes.d.ts +1 -1
  14. package/dist/dts/components/enable-hydration.d.ts +22 -2
  15. package/dist/dts/components/fast-definitions.d.ts +7 -4
  16. package/dist/dts/components/fast-element.d.ts +42 -12
  17. package/dist/dts/components/hydration-tracker.d.ts +47 -4
  18. package/dist/dts/components/hydration.d.ts +5 -0
  19. package/dist/dts/context.d.ts +7 -7
  20. package/dist/dts/declarative/debug.d.ts +2 -3
  21. package/dist/dts/declarative/index.d.ts +3 -2
  22. package/dist/dts/declarative/interfaces.d.ts +1 -2
  23. package/dist/dts/declarative/template.d.ts +2 -1
  24. package/dist/dts/declarative/utilities.d.ts +50 -4
  25. package/dist/dts/di/di.d.ts +6 -6
  26. package/dist/dts/dom-policy.d.ts +22 -4
  27. package/dist/dts/dom.d.ts +4 -16
  28. package/dist/dts/hydration/diagnostics.d.ts +93 -0
  29. package/dist/dts/hydration/hydration-debugger.d.ts +35 -0
  30. package/dist/dts/hydration/messages.d.ts +62 -0
  31. package/dist/dts/hydration/target-builder.d.ts +26 -1
  32. package/dist/dts/hydration.d.ts +7 -3
  33. package/dist/dts/index.d.ts +7 -3
  34. package/dist/dts/interfaces.d.ts +1 -0
  35. package/dist/dts/observation/observable.d.ts +3 -3
  36. package/dist/dts/platform.d.ts +20 -4
  37. package/dist/dts/registry.d.ts +1 -0
  38. package/dist/dts/templating/children.d.ts +1 -1
  39. package/dist/dts/templating/compiler.d.ts +1 -1
  40. package/dist/dts/templating/html-binding-directive.d.ts +6 -2
  41. package/dist/dts/templating/html-directive.d.ts +2 -1
  42. package/dist/dts/templating/hydration-view.d.ts +24 -3
  43. package/dist/dts/templating/ref.d.ts +1 -1
  44. package/dist/dts/templating/render.d.ts +2 -2
  45. package/dist/dts/templating/repeat.d.ts +1 -1
  46. package/dist/dts/templating/slotted.d.ts +1 -1
  47. package/dist/dts/templating/template.d.ts +5 -5
  48. package/dist/dts/templating/when.d.ts +1 -1
  49. package/dist/dts/testing/fakes.d.ts +4 -4
  50. package/dist/esm/__test__/helpers.js +22 -0
  51. package/dist/esm/__test__/setup-node.js +18 -0
  52. package/dist/esm/binding/two-way.js +1 -2
  53. package/dist/esm/components/attributes.js +12 -8
  54. package/dist/esm/components/element-controller.js +11 -6
  55. package/dist/esm/components/enable-hydration.js +27 -3
  56. package/dist/esm/components/fast-definitions.js +19 -18
  57. package/dist/esm/components/hydration-tracker.js +34 -5
  58. package/dist/esm/components/hydration.js +85 -6
  59. package/dist/esm/debug.js +1 -0
  60. package/dist/esm/declarative/attribute-map.js +2 -1
  61. package/dist/esm/declarative/debug.js +0 -1
  62. package/dist/esm/declarative/index.js +1 -0
  63. package/dist/esm/declarative/interfaces.js +0 -1
  64. package/dist/esm/declarative/observer-map-utilities.js +58 -55
  65. package/dist/esm/declarative/template-bridge.js +4 -14
  66. package/dist/esm/declarative/template.js +4 -3
  67. package/dist/esm/declarative/utilities.js +236 -1
  68. package/dist/esm/di/di.js +2 -1
  69. package/dist/esm/dom-policy.js +33 -4
  70. package/dist/esm/hydration/diagnostics.js +50 -0
  71. package/dist/esm/hydration/hydration-debugger.js +112 -0
  72. package/dist/esm/hydration/messages.js +84 -0
  73. package/dist/esm/hydration/target-builder.js +65 -19
  74. package/dist/esm/hydration.js +3 -1
  75. package/dist/esm/index.js +6 -2
  76. package/dist/esm/interfaces.js +1 -0
  77. package/dist/esm/metadata.js +2 -8
  78. package/dist/esm/observation/notifier.js +2 -4
  79. package/dist/esm/registry.js +1 -0
  80. package/dist/esm/templating/html-binding-directive.js +1 -1
  81. package/dist/esm/templating/hydration-view.js +20 -27
  82. package/dist/esm/templating/render.js +39 -18
  83. package/dist/esm/templating/repeat.js +51 -17
  84. package/dist/esm/templating/view.js +1 -1
  85. package/dist/esm/testing/fixture.js +2 -2
  86. package/dist/esm/testing/timeout.js +2 -2
  87. package/dist/fast-element.api.json +1329 -99
  88. package/dist/fast-element.d.ts +147 -66
  89. package/dist/fast-element.debug.js +392 -99
  90. package/dist/fast-element.debug.min.js +2 -2
  91. package/dist/fast-element.js +392 -99
  92. package/dist/fast-element.min.js +2 -2
  93. package/dist/fast-element.untrimmed.d.ts +133 -70
  94. package/dist/hydration/hydration.api.json +1280 -57
  95. package/dist/styles/styles.api.json +1 -1
  96. package/package.json +21 -9
  97. package/ARCHITECTURE_FASTELEMENT.md +0 -63
  98. package/ARCHITECTURE_HTML_TAGGED_TEMPLATE_LITERAL.md +0 -36
  99. package/ARCHITECTURE_INTRO.md +0 -10
  100. package/ARCHITECTURE_OVERVIEW.md +0 -52
  101. package/ARCHITECTURE_UPDATES.md +0 -11
  102. package/CHANGELOG.json +0 -2275
  103. package/DECLARATIVE_DESIGN.md +0 -806
  104. package/DECLARATIVE_HTML.md +0 -470
  105. package/DECLARATIVE_MIGRATION.md +0 -215
  106. package/DECLARATIVE_RENDERING.md +0 -530
  107. package/DECLARATIVE_RENDERING_LIFECYCLE.md +0 -288
  108. package/DECLARATIVE_SCHEMA_OBSERVER_MAP.md +0 -489
  109. package/DESIGN.md +0 -615
  110. package/MIGRATION.md +0 -387
  111. package/SIZES.md +0 -25
  112. package/api-extractor.arrays.json +0 -15
  113. package/api-extractor.context.json +0 -15
  114. package/api-extractor.declarative.json +0 -15
  115. package/api-extractor.di.json +0 -15
  116. package/api-extractor.hydration.json +0 -15
  117. package/api-extractor.styles.json +0 -15
  118. package/biome.json +0 -4
  119. package/docs/ACKNOWLEDGEMENTS.md +0 -12
  120. package/docs/api-report.api.md +0 -1299
  121. package/docs/arrays/api-report.api.md +0 -114
  122. package/docs/context/api-report.api.md +0 -69
  123. package/docs/declarative/api-report.api.md +0 -397
  124. package/docs/di/api-report.api.md +0 -315
  125. package/docs/fast-element-2-changes.md +0 -15
  126. package/docs/hydration/api-report.api.md +0 -285
  127. package/docs/styles/api-report.api.md +0 -135
  128. package/playwright.config.ts +0 -26
  129. package/playwright.declarative.config.ts +0 -26
  130. package/playwright.declarative.webui.config.ts +0 -20
  131. package/scripts/declarative/build-fixtures-with-webui.js +0 -135
  132. package/scripts/declarative/build-fixtures.js +0 -49
  133. package/scripts/declarative/build-fixtures.utilities.js +0 -101
  134. package/scripts/measure-sizes.js +0 -219
  135. package/scripts/run-api-extractor.js +0 -70
  136. package/test/declarative/fixtures/README.md +0 -72
  137. package/test/declarative/fixtures/WRITING_FIXTURES.md +0 -330
  138. package/test/declarative/fixtures/bindings/README.md +0 -12
  139. package/test/declarative/fixtures/bindings/attribute/entry.html +0 -13
  140. package/test/declarative/fixtures/bindings/attribute/fast-build.config.json +0 -6
  141. package/test/declarative/fixtures/bindings/attribute/index.html +0 -25
  142. package/test/declarative/fixtures/bindings/attribute/main.ts +0 -41
  143. package/test/declarative/fixtures/bindings/attribute/state.json +0 -8
  144. package/test/declarative/fixtures/bindings/attribute/templates.html +0 -11
  145. package/test/declarative/fixtures/bindings/content/entry.html +0 -12
  146. package/test/declarative/fixtures/bindings/content/fast-build.config.json +0 -6
  147. package/test/declarative/fixtures/bindings/content/index.html +0 -19
  148. package/test/declarative/fixtures/bindings/content/main.ts +0 -27
  149. package/test/declarative/fixtures/bindings/content/state.json +0 -4
  150. package/test/declarative/fixtures/bindings/content/templates.html +0 -6
  151. package/test/declarative/fixtures/bindings/dot-syntax/entry.html +0 -11
  152. package/test/declarative/fixtures/bindings/dot-syntax/fast-build.config.json +0 -6
  153. package/test/declarative/fixtures/bindings/dot-syntax/index.html +0 -47
  154. package/test/declarative/fixtures/bindings/dot-syntax/main.ts +0 -59
  155. package/test/declarative/fixtures/bindings/dot-syntax/state.json +0 -16
  156. package/test/declarative/fixtures/bindings/dot-syntax/templates.html +0 -17
  157. package/test/declarative/fixtures/bindings/event/entry.html +0 -11
  158. package/test/declarative/fixtures/bindings/event/fast-build.config.json +0 -6
  159. package/test/declarative/fixtures/bindings/event/index.html +0 -43
  160. package/test/declarative/fixtures/bindings/event/main.ts +0 -43
  161. package/test/declarative/fixtures/bindings/event/state.json +0 -3
  162. package/test/declarative/fixtures/bindings/event/templates.html +0 -18
  163. package/test/declarative/fixtures/bindings/host/entry.html +0 -40
  164. package/test/declarative/fixtures/bindings/host/fast-build.config.json +0 -6
  165. package/test/declarative/fixtures/bindings/host/index.html +0 -96
  166. package/test/declarative/fixtures/bindings/host/main.ts +0 -222
  167. package/test/declarative/fixtures/bindings/host/state.json +0 -9
  168. package/test/declarative/fixtures/bindings/host/templates.html +0 -55
  169. package/test/declarative/fixtures/directives/README.md +0 -12
  170. package/test/declarative/fixtures/directives/children/entry.html +0 -11
  171. package/test/declarative/fixtures/directives/children/fast-build.config.json +0 -6
  172. package/test/declarative/fixtures/directives/children/index.html +0 -15
  173. package/test/declarative/fixtures/directives/children/main.ts +0 -22
  174. package/test/declarative/fixtures/directives/children/state.json +0 -3
  175. package/test/declarative/fixtures/directives/children/templates.html +0 -3
  176. package/test/declarative/fixtures/directives/ref/entry.html +0 -11
  177. package/test/declarative/fixtures/directives/ref/fast-build.config.json +0 -6
  178. package/test/declarative/fixtures/directives/ref/index.html +0 -15
  179. package/test/declarative/fixtures/directives/ref/main.ts +0 -17
  180. package/test/declarative/fixtures/directives/ref/state.json +0 -1
  181. package/test/declarative/fixtures/directives/ref/templates.html +0 -3
  182. package/test/declarative/fixtures/directives/repeat/entry.html +0 -21
  183. package/test/declarative/fixtures/directives/repeat/fast-build.config.json +0 -6
  184. package/test/declarative/fixtures/directives/repeat/index.html +0 -133
  185. package/test/declarative/fixtures/directives/repeat/main.ts +0 -110
  186. package/test/declarative/fixtures/directives/repeat/sprites.svg +0 -8
  187. package/test/declarative/fixtures/directives/repeat/state.json +0 -10
  188. package/test/declarative/fixtures/directives/repeat/templates.html +0 -75
  189. package/test/declarative/fixtures/directives/slotted/entry.html +0 -17
  190. package/test/declarative/fixtures/directives/slotted/fast-build.config.json +0 -6
  191. package/test/declarative/fixtures/directives/slotted/index.html +0 -27
  192. package/test/declarative/fixtures/directives/slotted/main.ts +0 -29
  193. package/test/declarative/fixtures/directives/slotted/state.json +0 -1
  194. package/test/declarative/fixtures/directives/slotted/templates.html +0 -7
  195. package/test/declarative/fixtures/directives/when/entry.html +0 -51
  196. package/test/declarative/fixtures/directives/when/fast-build.config.json +0 -6
  197. package/test/declarative/fixtures/directives/when/index.html +0 -136
  198. package/test/declarative/fixtures/directives/when/main.ts +0 -172
  199. package/test/declarative/fixtures/directives/when/state.json +0 -12
  200. package/test/declarative/fixtures/directives/when/templates.html +0 -75
  201. package/test/declarative/fixtures/ecosystem/README.md +0 -11
  202. package/test/declarative/fixtures/ecosystem/declarative-no-hydration/entry.html +0 -12
  203. package/test/declarative/fixtures/ecosystem/declarative-no-hydration/fast-build.config.json +0 -6
  204. package/test/declarative/fixtures/ecosystem/declarative-no-hydration/index.html +0 -20
  205. package/test/declarative/fixtures/ecosystem/declarative-no-hydration/main.ts +0 -68
  206. package/test/declarative/fixtures/ecosystem/declarative-no-hydration/state.json +0 -4
  207. package/test/declarative/fixtures/ecosystem/declarative-no-hydration/templates.html +0 -7
  208. package/test/declarative/fixtures/ecosystem/errors/entry.html +0 -12
  209. package/test/declarative/fixtures/ecosystem/errors/fast-build.config.json +0 -6
  210. package/test/declarative/fixtures/ecosystem/errors/index.html +0 -20
  211. package/test/declarative/fixtures/ecosystem/errors/main.ts +0 -17
  212. package/test/declarative/fixtures/ecosystem/errors/state.json +0 -1
  213. package/test/declarative/fixtures/ecosystem/errors/templates.html +0 -7
  214. package/test/declarative/fixtures/ecosystem/lifecycle-callbacks/entry.html +0 -17
  215. package/test/declarative/fixtures/ecosystem/lifecycle-callbacks/fast-build.config.json +0 -6
  216. package/test/declarative/fixtures/ecosystem/lifecycle-callbacks/index.html +0 -56
  217. package/test/declarative/fixtures/ecosystem/lifecycle-callbacks/main.ts +0 -134
  218. package/test/declarative/fixtures/ecosystem/lifecycle-callbacks/state.json +0 -12
  219. package/test/declarative/fixtures/ecosystem/lifecycle-callbacks/templates.html +0 -34
  220. package/test/declarative/fixtures/ecosystem/performance-metrics/entry.html +0 -25
  221. package/test/declarative/fixtures/ecosystem/performance-metrics/fast-build.config.json +0 -6
  222. package/test/declarative/fixtures/ecosystem/performance-metrics/fast-card.css +0 -10
  223. package/test/declarative/fixtures/ecosystem/performance-metrics/index.html +0 -181
  224. package/test/declarative/fixtures/ecosystem/performance-metrics/main.ts +0 -58
  225. package/test/declarative/fixtures/ecosystem/performance-metrics/state.json +0 -6
  226. package/test/declarative/fixtures/ecosystem/performance-metrics/templates.html +0 -15
  227. package/test/declarative/fixtures/extensions/README.md +0 -15
  228. package/test/declarative/fixtures/extensions/attribute-map/entry.html +0 -14
  229. package/test/declarative/fixtures/extensions/attribute-map/fast-build.config.json +0 -6
  230. package/test/declarative/fixtures/extensions/attribute-map/index.html +0 -31
  231. package/test/declarative/fixtures/extensions/attribute-map/main.ts +0 -40
  232. package/test/declarative/fixtures/extensions/attribute-map/state.json +0 -4
  233. package/test/declarative/fixtures/extensions/attribute-map/templates.html +0 -14
  234. package/test/declarative/fixtures/extensions/attribute-map-naming-strategy/entry.html +0 -12
  235. package/test/declarative/fixtures/extensions/attribute-map-naming-strategy/fast-build.config.json +0 -7
  236. package/test/declarative/fixtures/extensions/attribute-map-naming-strategy/index.html +0 -25
  237. package/test/declarative/fixtures/extensions/attribute-map-naming-strategy/main.ts +0 -31
  238. package/test/declarative/fixtures/extensions/attribute-map-naming-strategy/state.json +0 -5
  239. package/test/declarative/fixtures/extensions/attribute-map-naming-strategy/templates.html +0 -11
  240. package/test/declarative/fixtures/extensions/attribute-map-naming-strategy-camel-case/entry.html +0 -13
  241. package/test/declarative/fixtures/extensions/attribute-map-naming-strategy-camel-case/fast-build.config.json +0 -7
  242. package/test/declarative/fixtures/extensions/attribute-map-naming-strategy-camel-case/index.html +0 -23
  243. package/test/declarative/fixtures/extensions/attribute-map-naming-strategy-camel-case/main.ts +0 -37
  244. package/test/declarative/fixtures/extensions/attribute-map-naming-strategy-camel-case/state.json +0 -1
  245. package/test/declarative/fixtures/extensions/attribute-map-naming-strategy-camel-case/templates.html +0 -9
  246. package/test/declarative/fixtures/extensions/observer-map/entry.html +0 -15
  247. package/test/declarative/fixtures/extensions/observer-map/fast-build.config.json +0 -6
  248. package/test/declarative/fixtures/extensions/observer-map/index.html +0 -442
  249. package/test/declarative/fixtures/extensions/observer-map/main.ts +0 -482
  250. package/test/declarative/fixtures/extensions/observer-map/state.json +0 -158
  251. package/test/declarative/fixtures/extensions/observer-map/templates.html +0 -172
  252. package/test/declarative/fixtures/extensions/observer-map-config-object/entry.html +0 -16
  253. package/test/declarative/fixtures/extensions/observer-map-config-object/fast-build.config.json +0 -6
  254. package/test/declarative/fixtures/extensions/observer-map-config-object/index.html +0 -27
  255. package/test/declarative/fixtures/extensions/observer-map-config-object/main.ts +0 -53
  256. package/test/declarative/fixtures/extensions/observer-map-config-object/state.json +0 -9
  257. package/test/declarative/fixtures/extensions/observer-map-config-object/templates.html +0 -12
  258. package/test/declarative/fixtures/extensions/observer-map-deep-merge/README.md +0 -98
  259. package/test/declarative/fixtures/extensions/observer-map-deep-merge/entry.html +0 -156
  260. package/test/declarative/fixtures/extensions/observer-map-deep-merge/fast-build.config.json +0 -6
  261. package/test/declarative/fixtures/extensions/observer-map-deep-merge/index.html +0 -376
  262. package/test/declarative/fixtures/extensions/observer-map-deep-merge/main.ts +0 -366
  263. package/test/declarative/fixtures/extensions/observer-map-deep-merge/state.json +0 -69
  264. package/test/declarative/fixtures/extensions/observer-map-deep-merge/templates.html +0 -91
  265. package/test/declarative/fixtures/extensions/observer-map-properties/entry.html +0 -14
  266. package/test/declarative/fixtures/extensions/observer-map-properties/fast-build.config.json +0 -6
  267. package/test/declarative/fixtures/extensions/observer-map-properties/index.html +0 -110
  268. package/test/declarative/fixtures/extensions/observer-map-properties/main.ts +0 -175
  269. package/test/declarative/fixtures/extensions/observer-map-properties/state.json +0 -29
  270. package/test/declarative/fixtures/extensions/observer-map-properties/templates.html +0 -55
  271. package/test/declarative/fixtures/scenarios/README.md +0 -7
  272. package/test/declarative/fixtures/scenarios/nested-elements/entry.html +0 -16
  273. package/test/declarative/fixtures/scenarios/nested-elements/fast-build.config.json +0 -6
  274. package/test/declarative/fixtures/scenarios/nested-elements/index.html +0 -126
  275. package/test/declarative/fixtures/scenarios/nested-elements/main.ts +0 -214
  276. package/test/declarative/fixtures/scenarios/nested-elements/state.json +0 -10
  277. package/test/declarative/fixtures/scenarios/nested-elements/templates.html +0 -54
  278. package/test/declarative/index.html +0 -12
  279. package/test/declarative/vite.config.ts +0 -55
  280. package/test/declarative-main.ts +0 -6
  281. package/test/extension-subpaths-main.ts +0 -9
  282. package/test/index.html +0 -11
  283. package/test/main.ts +0 -109
  284. package/test/pure-declarative-main.ts +0 -1
  285. package/test/vite.config.ts +0 -19
  286. package/tsconfig.api-extractor.json +0 -6
@@ -1,219 +0,0 @@
1
- import { readFileSync, writeFileSync } from "node:fs";
2
- import path from "node:path";
3
- import { fileURLToPath } from "node:url";
4
- import { brotliCompressSync, gzipSync } from "node:zlib";
5
- import { build } from "esbuild";
6
-
7
- const __filename = fileURLToPath(import.meta.url);
8
- const __dirname = path.dirname(__filename);
9
- const packageRoot = path.resolve(__dirname, "..");
10
- const rootImportPath = "@microsoft/fast-element";
11
- const fastElementImportPath = "@microsoft/fast-element/fast-element.js";
12
- const updatesImportPath = "@microsoft/fast-element/updates.js";
13
- const observableImportPath = "@microsoft/fast-element/observable.js";
14
- const attrImportPath = "@microsoft/fast-element/attr.js";
15
- const childrenImportPath = "@microsoft/fast-element/children.js";
16
- const refImportPath = "@microsoft/fast-element/ref.js";
17
- const slottedImportPath = "@microsoft/fast-element/slotted.js";
18
- const volatileImportPath = "@microsoft/fast-element/volatile.js";
19
- const whenImportPath = "@microsoft/fast-element/when.js";
20
- const htmlImportPath = "@microsoft/fast-element/html.js";
21
- const repeatImportPath = "@microsoft/fast-element/repeat.js";
22
- const cssImportPath = "@microsoft/fast-element/css.js";
23
- const declarativeImportPath = "@microsoft/fast-element/declarative.js";
24
- const hydrationImportPath = "@microsoft/fast-element/hydration.js";
25
- const arrayObserverImportPath = "@microsoft/fast-element/array-observer.js";
26
- const observerMapImportPath = "@microsoft/fast-element/observer-map.js";
27
- const attributeMapImportPath = "@microsoft/fast-element/attribute-map.js";
28
-
29
- const namedExports = [{ name: "FASTElement", importPath: fastElementImportPath }];
30
-
31
- const measuredExports = [
32
- {
33
- name: "Updates",
34
- export: "Updates",
35
- importPath: updatesImportPath,
36
- },
37
- {
38
- name: "Observable",
39
- export: "Observable",
40
- importPath: observableImportPath,
41
- },
42
- {
43
- name: "observable",
44
- export: "observable",
45
- importPath: observableImportPath,
46
- },
47
- {
48
- name: "attr",
49
- export: "attr",
50
- importPath: attrImportPath,
51
- },
52
- {
53
- name: "children",
54
- export: "children",
55
- importPath: childrenImportPath,
56
- },
57
- {
58
- name: "ref",
59
- export: "ref",
60
- importPath: refImportPath,
61
- },
62
- {
63
- name: "slotted",
64
- export: "slotted",
65
- importPath: slottedImportPath,
66
- },
67
- {
68
- name: "volatile",
69
- export: "volatile",
70
- importPath: volatileImportPath,
71
- },
72
- {
73
- name: "when",
74
- export: "when",
75
- importPath: whenImportPath,
76
- },
77
- {
78
- name: "html",
79
- export: "html",
80
- importPath: htmlImportPath,
81
- },
82
- {
83
- name: "repeat",
84
- export: "repeat",
85
- importPath: repeatImportPath,
86
- },
87
- {
88
- name: "css",
89
- export: "css",
90
- importPath: cssImportPath,
91
- },
92
- {
93
- name: "enableHydration",
94
- export: "enableHydration",
95
- importPath: hydrationImportPath,
96
- },
97
- {
98
- name: "declarativeTemplate",
99
- export: "declarativeTemplate",
100
- importPath: declarativeImportPath,
101
- },
102
- {
103
- name: "ArrayObserver",
104
- export: "ArrayObserver",
105
- importPath: arrayObserverImportPath,
106
- },
107
- {
108
- name: "observerMap",
109
- export: "observerMap",
110
- importPath: observerMapImportPath,
111
- },
112
- {
113
- name: "attributeMap",
114
- export: "attributeMap",
115
- importPath: attributeMapImportPath,
116
- },
117
- ];
118
-
119
- function formatExportLabel(name, importPath) {
120
- return `${name} (${importPath})`;
121
- }
122
-
123
- function formatBytes(bytes) {
124
- if (bytes < 1024) return `${bytes} B`;
125
- return `${(bytes / 1024).toFixed(2)} KB`;
126
- }
127
-
128
- function measureBuffer(buffer) {
129
- const gzip = gzipSync(buffer);
130
- const brotli = brotliCompressSync(buffer);
131
- return {
132
- minified: buffer.length,
133
- gzip: gzip.length,
134
- brotli: brotli.length,
135
- };
136
- }
137
-
138
- async function measureExport(exportName, importPath = rootImportPath) {
139
- const contents = `import { ${exportName} } from "${importPath}";
140
- export { ${exportName} };
141
- `;
142
-
143
- const result = await build({
144
- stdin: {
145
- contents,
146
- resolveDir: packageRoot,
147
- loader: "ts",
148
- },
149
- bundle: true,
150
- minify: true,
151
- format: "esm",
152
- write: false,
153
- treeShaking: true,
154
- });
155
-
156
- const code = Buffer.from(result.outputFiles[0].contents);
157
- return measureBuffer(code);
158
- }
159
-
160
- async function measureCore() {
161
- const coreBundle = path.resolve(packageRoot, "dist/fast-element.min.js");
162
- const buffer = readFileSync(coreBundle);
163
- return measureBuffer(buffer);
164
- }
165
-
166
- async function main() {
167
- const results = [];
168
-
169
- // Measure CDN rollup bundle
170
- const core = await measureCore();
171
- results.push({ name: "CDN Rollup Bundle", ...core });
172
-
173
- // Measure each named export in parallel
174
- const exportResults = await Promise.all(
175
- namedExports.map(async ({ name, importPath }) => {
176
- const sizes = await measureExport(name, importPath);
177
- return { name: formatExportLabel(name, importPath), ...sizes };
178
- }),
179
- );
180
- results.push(...exportResults);
181
-
182
- // Measure each root export in parallel
183
- const measuredResults = await Promise.all(
184
- measuredExports.map(
185
- async ({ name, export: exportName, importPath = rootImportPath }) => {
186
- const sizes = await measureExport(exportName, importPath);
187
- return { name: formatExportLabel(name, importPath), ...sizes };
188
- },
189
- ),
190
- );
191
- results.push(...measuredResults);
192
-
193
- // Generate markdown table
194
- const lines = [
195
- "# Export Sizes",
196
- "",
197
- "Bundle sizes for `@microsoft/fast-element` exports.",
198
- "",
199
- "| Export | Minified | Gzip | Brotli |",
200
- "|--------|----------|------|--------|",
201
- ];
202
-
203
- for (const { name, minified, gzip, brotli } of results) {
204
- lines.push(
205
- `| ${name} | ${formatBytes(minified)} | ${formatBytes(gzip)} | ${formatBytes(brotli)} |`,
206
- );
207
- }
208
-
209
- lines.push("");
210
-
211
- const outputPath = path.resolve(packageRoot, "SIZES.md");
212
- writeFileSync(outputPath, lines.join("\n"));
213
- console.log(`Bundle sizes written to ${outputPath}`);
214
- }
215
-
216
- main().catch(err => {
217
- console.error(err);
218
- process.exit(1);
219
- });
@@ -1,70 +0,0 @@
1
- import fs from "node:fs";
2
- import path from "node:path";
3
- import { fileURLToPath } from "node:url";
4
- import { Extractor, ExtractorConfig } from "@microsoft/api-extractor";
5
-
6
- const __filename = fileURLToPath(import.meta.url);
7
- const __dirname = path.dirname(__filename);
8
-
9
- export const exportPaths = [
10
- {
11
- path: "./context.js",
12
- docsFolder: "context",
13
- configPath: path.resolve(__dirname, "../api-extractor.context.json"),
14
- },
15
- {
16
- path: "./declarative.js",
17
- docsFolder: "declarative",
18
- configPath: path.resolve(__dirname, "../api-extractor.declarative.json"),
19
- },
20
- {
21
- path: "./di.js",
22
- docsFolder: "di",
23
- configPath: path.resolve(__dirname, "../api-extractor.di.json"),
24
- },
25
- {
26
- path: "./hydration.js",
27
- docsFolder: "hydration",
28
- configPath: path.resolve(__dirname, "../api-extractor.hydration.json"),
29
- },
30
- {
31
- path: "./styles.js",
32
- docsFolder: "styles",
33
- configPath: path.resolve(__dirname, "../api-extractor.styles.json"),
34
- },
35
- {
36
- path: "./arrays.js",
37
- docsFolder: "arrays",
38
- configPath: path.resolve(__dirname, "../api-extractor.arrays.json"),
39
- },
40
- ];
41
-
42
- (function () {
43
- exportPaths.forEach(exportPath => {
44
- const docsFolder = path.resolve(__dirname, `../docs/${exportPath.docsFolder}`);
45
- // Create folders in the docs directory
46
- if (!fs.existsSync(docsFolder)) {
47
- fs.mkdirSync(docsFolder);
48
- }
49
-
50
- // Load and parse the api-extractor.json file
51
- const extractorConfig = ExtractorConfig.loadFileAndPrepare(exportPath.configPath);
52
-
53
- // Invoke API Extractor
54
- const extractorResult = Extractor.invoke(extractorConfig, {
55
- // Equivalent to the "--local" command-line parameter
56
- localBuild: process.argv[2] !== "ci",
57
- });
58
-
59
- if (extractorResult.succeeded) {
60
- console.log(
61
- `API Extractor completed successfully for ${exportPath.configPath}`,
62
- );
63
- } else {
64
- console.error(
65
- `API Extractor completed with ${extractorResult.errorCount} errors` +
66
- ` and ${extractorResult.warningCount} warnings for ${exportPath.configPath}`,
67
- );
68
- }
69
- });
70
- })();
@@ -1,72 +0,0 @@
1
- # Fixtures
2
-
3
- Fixtures are organized into category subdirectories:
4
-
5
- | Category | Description |
6
- |---|---|
7
- | [`bindings/`](./bindings/README.md) | Various binding types (attribute, content, event, dot-syntax, host). |
8
- | [`scenarios/`](./scenarios/README.md) | Complex scenarios with edge cases involving multiple features. |
9
- | [`directives/`](./directives/README.md) | Attribute and element directives (`f-repeat`, `f-when`, `f-ref`, etc.). |
10
- | [`extensions/`](./extensions/README.md) | Additional functionality that augments the core behavior (attribute maps, observer maps). |
11
- | [`ecosystem/`](./ecosystem/README.md) | Other ecosystem APIs (errors, lifecycle, performance). |
12
-
13
- Each fixture contains the following contents:
14
-
15
- ```
16
- <category>/<fixture-name>/
17
- ├── <fixture-name>.spec.ts - Playwright tests
18
- ├── entry.html - Entry template with root custom elements (input to build-fixtures.js)
19
- ├── fast-build.config.json - Build configuration for @microsoft/fast-build
20
- ├── index.html - Pre-rendered HTML page served by Vite (generated by build-fixtures.js)
21
- ├── main.ts - Component definition and setup
22
- ├── state.json - Initial state passed to the server-side renderer
23
- └── templates.html - Declarative f-template definitions
24
- ```
25
-
26
- Fixtures are auto-discovered by the Vite config in `../vite.config.ts`. To add a new fixture, create a new directory within the appropriate category with the files above — no other changes are needed.
27
-
28
- ## Hydration readiness
29
-
30
- Fixtures that exercise prerendered Declarative Shadow DOM should enable
31
- hydration explicitly and set a global flag in the `hydrationComplete()` callback
32
- so Playwright tests can wait for the element to be fully interactive before
33
- asserting. The standard pattern is:
34
-
35
- 1. **In `main.ts`**, call `enableHydration()` before elements connect:
36
-
37
- ```ts
38
- import { enableHydration } from "@microsoft/fast-element/hydration.js";
39
-
40
- enableHydration({
41
- hydrationComplete() {
42
- (window as any).hydrationCompleted = true;
43
- },
44
- });
45
- ```
46
-
47
- Per-element callbacks belong on `declarativeTemplate(callbacks)`. Map
48
- behavior belongs in define extensions such as `attributeMap()` and
49
- `observerMap()`.
50
-
51
- 2. **In the spec file**, create the wait **before** navigation so the listener is registered before the page starts loading:
52
-
53
- ```ts
54
- const hydrationCompleted = page.waitForFunction(
55
- () => (window as any).hydrationCompleted === true,
56
- );
57
- await page.goto("/fixtures/<fixture-name>/");
58
- await hydrationCompleted;
59
- ```
60
-
61
- Place this around every `page.goto()` call — including inside `test.beforeEach` hooks — to prevent assertions from running before hydration finishes.
62
-
63
- ## Entry HTML attribute guidelines
64
-
65
- The `entry.html` file defines the root custom elements that the server-side renderer processes. When writing attribute bindings on root elements, follow these conventions:
66
-
67
- - **Same-name complex bindings are unnecessary.** Attributes like `list="{{list}}"` where `list` is an array or object are redundant — non-primitive values are automatically stripped from the rendered opening tag, and state propagation already provides the value to the element's template. Omit these attributes.
68
- - **Rename bindings should be avoided.** Prefer naming state properties to match the attribute name the element expects. When a rename such as `foo="{{bar}}"` is removed, ensure `state.json` includes a property named `foo` with the contents of `bar` so the value is available via state propagation.
69
- - **Property bindings (`:attr`) for renames are acceptable** when multiple instances of the same element in a fixture need different values for the same property (e.g., `:items="{{emptyItems}}"` and `:items="{{singleItem}}"` on separate elements).
70
- - **Primitive same-name bindings are fine.** Attributes like `type="{{type}}"` where the value is a string, number, or boolean are rendered onto the opening tag and may be needed for `@attr`-based element initialization.
71
-
72
- For a complete guide on creating fixtures — including how to write each file, component patterns, and spec examples — see [WRITING_FIXTURES.md](./WRITING_FIXTURES.md).
@@ -1,330 +0,0 @@
1
- # Writing Fixtures
2
-
3
- This guide explains how to create and maintain Playwright test fixtures for the
4
- declarative runtime in `@microsoft/fast-element`. Each fixture is a
5
- self-contained test case that exercises a specific feature through a live Vite
6
- dev server.
7
-
8
- ## Fixture structure
9
-
10
- Every fixture lives in a category subdirectory under
11
- `test/declarative/fixtures/`:
12
-
13
- ```
14
- test/declarative/fixtures/<category>/<feature>/
15
- ├── <feature>.spec.ts # Playwright test
16
- ├── entry.html # Entry template — input to the build step
17
- ├── fast-build.config.json # Build configuration for @microsoft/fast-build
18
- ├── index.html # Pre-rendered page — GENERATED, do not edit
19
- ├── main.ts # Component definitions and setup
20
- ├── state.json # Initial state for server-side rendering
21
- └── templates.html # Declarative <f-template> definitions
22
- ```
23
-
24
- Fixtures are organized into five categories:
25
-
26
- | Category | Description | Details |
27
- |---|---|---|
28
- | `bindings/` | Various binding types (attribute, content, event, etc.) | [README](./bindings/README.md) |
29
- | `scenarios/` | Complex scenarios with edge cases involving multiple features | [README](./scenarios/README.md) |
30
- | `directives/` | Attribute and element directives (`f-repeat`, `f-when`, `f-ref`, etc.) | [README](./directives/README.md) |
31
- | `extensions/` | Additional functionality beyond direct configuration (attribute maps, observer maps) | [README](./extensions/README.md) |
32
- | `ecosystem/` | Other ecosystem APIs (errors, lifecycle, performance) | [README](./ecosystem/README.md) |
33
-
34
- > **Important:** `index.html` is generated by `npm run build:fixtures`. Never edit it by hand — your changes will be overwritten on the next build. If something looks wrong in `index.html`, fix the source files (`entry.html`, `state.json`, `templates.html`) and rebuild.
35
-
36
- ---
37
-
38
- ## Creating a new fixture
39
-
40
- 1. Create a new directory under `test/declarative/fixtures/<category>/` with a
41
- descriptive kebab-case name (e.g., `bindings/my-feature/`).
42
- 2. Add the required files described below.
43
- 3. Run `npm run build:fixtures -w @microsoft/fast-element` to generate
44
- `index.html`.
45
- 4. Write your Playwright tests in `<feature>.spec.ts`.
46
- 5. Run `npm run test:chromium:declarative -w @microsoft/fast-element` to verify
47
- everything works.
48
-
49
- Fixtures are auto-discovered by scanning category directories for subdirectories that contain `entry.html`, `templates.html`, `state.json`, and `fast-build.config.json`. Both the build script and the Vite config pick up new fixtures automatically — no registration step is needed.
50
-
51
- ---
52
-
53
- ## fast-build.config.json
54
-
55
- Each fixture must include a `fast-build.config.json` file that tells the `@microsoft/fast-build` CLI where to find the fixture's source files and how to build them. The build script passes `--config=<path>` to the CLI for each fixture.
56
-
57
- ### Standard config
58
-
59
- Most fixtures use the same standard configuration:
60
-
61
- ```json
62
- {
63
- "entry": "entry.html",
64
- "state": "state.json",
65
- "output": "index.html",
66
- "templates": "templates.html"
67
- }
68
- ```
69
-
70
- ### Fixture-specific options
71
-
72
- If a fixture needs custom build options (e.g., an attribute name strategy), add them to the config:
73
-
74
- ```json
75
- {
76
- "entry": "entry.html",
77
- "state": "state.json",
78
- "output": "index.html",
79
- "templates": "templates.html",
80
- "attribute-name-strategy": "camelCase"
81
- }
82
- ```
83
-
84
- Allowed keys: `entry`, `state`, `output`, `templates`, `attribute-name-strategy`. All values must be strings. File paths are resolved relative to the config file's directory.
85
-
86
- > **Note:** Fixture configs must use the standard file names (`entry.html`, `state.json`, `index.html`, `templates.html`) because the build scripts and WebUI integration rely on these conventions for template injection and cross-renderer testing.
87
-
88
- ---
89
-
90
- ## entry.html
91
-
92
- The entry file is a minimal HTML document that places your custom elements on the page. It serves as the input to the server-side renderer.
93
-
94
- ```html
95
- <!DOCTYPE html>
96
- <html lang="en-US">
97
- <head>
98
- <meta charset="utf-8">
99
- <title></title>
100
- </head>
101
- <body>
102
- <my-element greeting="{{greeting}}"></my-element>
103
- <script type="module" src="./main.ts"></script>
104
- </body>
105
- </html>
106
- ```
107
-
108
- ### Attribute binding guidelines
109
-
110
- When writing attribute bindings on root elements in `entry.html`:
111
-
112
- | Pattern | Guidance |
113
- |---|---|
114
- | `type="{{type}}"` (primitive same-name) | ✅ Fine — rendered onto the opening tag for `@attr` initialization. |
115
- | `list="{{list}}"` (complex same-name) | ❌ Unnecessary — non-primitive values are stripped from the rendered tag; state propagation provides them automatically. |
116
- | `foo="{{bar}}"` (rename) | ❌ Avoid — rename `bar` to `foo` in `state.json` instead. |
117
- | `:items="{{emptyItems}}"` (property binding) | ✅ Acceptable when multiple instances of the same element need different values for the same property. |
118
-
119
- ---
120
-
121
- ## state.json
122
-
123
- A JSON object containing the initial state that the server-side renderer uses to evaluate bindings. Property names should match what the templates and entry HTML reference.
124
-
125
- ```json
126
- {
127
- "greeting": "Hello",
128
- "isEnabled": true,
129
- "items": ["A", "B", "C"]
130
- }
131
- ```
132
-
133
- Keep `state.json` minimal — only include values that affect the pre-rendered output. Complex objects (arrays, nested data) are supported.
134
-
135
- ---
136
-
137
- ## templates.html
138
-
139
- This file defines the declarative `<f-template>` elements that describe each custom element's shadow DOM. Each `<f-template>` has a `name` attribute matching the custom element tag name and contains a `<template>` child with the component's markup.
140
-
141
- ```html
142
- <f-template name="my-element">
143
- <template>
144
- <span>{{greeting}}</span>
145
- </template>
146
- </f-template>
147
- ```
148
-
149
- ### Template syntax
150
-
151
- For a full reference of binding syntax, event bindings, directives (`f-when`,
152
- `f-repeat`), and execution context access, see the [Syntax section of the
153
- declarative docs](../../../DECLARATIVE_HTML.md#syntax).
154
-
155
- Multiple `<f-template>` elements can be defined in a single `templates.html` — one per custom element used in the fixture.
156
-
157
- ---
158
-
159
- ## main.ts
160
-
161
- The component definition file registers custom elements and configures the template system. Every fixture must:
162
-
163
- 1. Define element classes extending `FASTElement`.
164
- 2. Call `define()` on the element class with `template: declarativeTemplate()`.
165
- 3. Use `declarativeTemplate(callbacks)` for per-element lifecycle callbacks,
166
- `enableHydration()` for hydration callbacks, and define extensions such as
167
- `attributeMap()` / `observerMap()` for schema behavior.
168
- `declarativeTemplate()` registers FAST's internal `<f-template>` publisher
169
- automatically.
170
-
171
- ### Import paths
172
-
173
- > **Important:** All imports in `main.ts` must use package names (for example
174
- > `@microsoft/fast-element`), **not** relative paths.
175
- > Relative imports will break the WebUI integration tests because fixtures are
176
- > copied to a different directory structure during the integration build. The
177
- > same applies to any other paths referenced in `main.ts`.
178
-
179
- ### Basic pattern
180
-
181
- ```typescript
182
- import {
183
- FASTElement,
184
- attr,
185
- observable,
186
- } from "@microsoft/fast-element";
187
- import { declarativeTemplate } from "@microsoft/fast-element/declarative.js";
188
-
189
- class MyElement extends FASTElement {
190
- @attr
191
- greeting: string = "Hello";
192
- }
193
- MyElement.define({
194
- name: "my-element",
195
- template: declarativeTemplate(),
196
- });
197
- ```
198
-
199
- ### When to use `@attr` vs `@observable`
200
-
201
- - Use `@attr` for values reflected as HTML attributes (strings, booleans) — these can be set in `entry.html`.
202
- - Use `@observable` for internal state or complex values (arrays, objects) — these are provided via `state.json`.
203
-
204
- ### Exporting types
205
-
206
- If your spec file needs to reference element types (e.g., for `page.evaluate` calls), export the classes:
207
-
208
- ```typescript
209
- export class TestElement extends FASTElement {
210
- @observable
211
- list: Array<string> = [];
212
- }
213
- ```
214
-
215
- Then import in the spec:
216
-
217
- ```typescript
218
- import type { TestElement } from "./main.js";
219
-
220
- await customElement.evaluate((node: TestElement) => {
221
- node.list = ["A", "B", "C"];
222
- });
223
- ```
224
-
225
- ### Using ObserverMap
226
-
227
- For fixtures that test deeply nested property reactivity, prefer the
228
- definition-scoped `observerMap()` extension:
229
-
230
- ```typescript
231
- import { declarativeTemplate } from "@microsoft/fast-element/declarative.js";
232
- import { observerMap } from "@microsoft/fast-element/observer-map.js";
233
-
234
- MyElement.define(
235
- {
236
- name: "my-element",
237
- template: declarativeTemplate(),
238
- },
239
- [observerMap()],
240
- );
241
- ```
242
-
243
- This enables the `ObserverMap` proxy system to track nested property changes without requiring `@observable` decorators on every property.
244
-
245
- ---
246
-
247
- ## Writing the spec file
248
-
249
- Spec files use Playwright's test runner. Each fixture's tests navigate to the fixture page and interact with the rendered components.
250
-
251
- ### Basic structure
252
-
253
- ```typescript
254
- import { expect, test } from "@playwright/test";
255
-
256
- test.describe("my-feature", async () => {
257
- test("initial render is correct", async ({ page }) => {
258
- await page.goto("/fixtures/bindings/my-feature/");
259
-
260
- const element = page.locator("my-element");
261
- await expect(element).toHaveText("Hello");
262
- });
263
-
264
- test("responds to attribute changes", async ({ page }) => {
265
- await page.goto("/fixtures/bindings/my-feature/");
266
-
267
- const element = page.locator("my-element");
268
-
269
- await page.evaluate(() => {
270
- document
271
- .querySelector("my-element")!
272
- .setAttribute("greeting", "World");
273
- });
274
-
275
- await expect(element).toHaveText("World");
276
- });
277
- });
278
- ```
279
-
280
- ### Common patterns
281
-
282
- - **Navigate to the fixture:** `await page.goto("/fixtures/<category>/<feature>/");`
283
- - **Locate elements:** `page.locator("my-element")` or `page.locator("#specific-id")`
284
- - **Modify attributes:** `await page.evaluate(() => { element.setAttribute(...) })`
285
- - **Modify properties:** `await element.evaluate((node: MyElement) => { node.prop = value })`
286
- - **Assert text:** `await expect(element).toHaveText("expected")`
287
- - **Assert attributes:** `await expect(element).toHaveAttribute("attr", "value")`
288
- - **Assert child count:** `await expect(element.locator("li")).toHaveCount(3)`
289
-
290
- ---
291
-
292
- ## Rebuilding fixtures
293
-
294
- After editing `entry.html`, `templates.html`, `state.json`, or `fast-build.config.json`, you **must** regenerate `index.html`:
295
-
296
- ```bash
297
- npm run build:fixtures -w @microsoft/fast-element
298
- ```
299
-
300
- This invokes `@microsoft/fast-build` for each auto-discovered fixture with `--config` pointing to the fixture's `fast-build.config.json`. The CLI reads the config file to locate the entry template, state, template definitions, and output path, then renders the output. The build script then injects the `<f-template>` declarations from `templates.html` before the `<script>` tag in the generated output. Fixtures are discovered automatically by scanning category subdirectories for directories that contain `entry.html`, `templates.html`, `state.json`, and `fast-build.config.json`.
301
-
302
- > **Tip:** If you're iterating on a fixture, use
303
- > `npm run dev:declarative -w @microsoft/fast-element` to start the Vite dev
304
- > server with file watching. But remember to run `build:fixtures` before
305
- > committing — the Vite dev server uses the generated `index.html`.
306
-
307
- ### WebUI integration
308
-
309
- The same fixtures are also validated against `@microsoft/webui` to ensure cross-renderer compatibility. To build and test fixtures with webui:
310
-
311
- ```bash
312
- # Build fixtures with webui and run Playwright tests
313
- npm run test:webui-integration -w @microsoft/fast-element
314
-
315
- # Or run the steps separately
316
- npm run build:fixtures:webui -w @microsoft/fast-element
317
- npm exec -w @microsoft/fast-element -- playwright test --config=playwright.declarative.webui.config.ts
318
- ```
319
-
320
- The webui build step (`scripts/build-fixtures-with-webui.js`) extracts `<f-template>` elements, builds each fixture with `webui build --plugin=fast`, renders the output with `state.json`, and writes the result to `temp/integrations/webui/fixtures/`. The existing Playwright specs then run against this output.
321
-
322
- ---
323
-
324
- ## Checklist for new fixtures
325
-
326
- - [ ] Created fixture directory within the appropriate category with all required files (including `fast-build.config.json`)
327
- - [ ] Ran `npm run build:fixtures -w @microsoft/fast-element` to generate `index.html`
328
- - [ ] Wrote Playwright tests in `<feature>.spec.ts`
329
- - [ ] Tests pass locally with `npm run test:chromium:declarative -w @microsoft/fast-element`
330
- - [ ] Committed all files **including** the generated `index.html`