@microsoft/fast-element 2.10.1 → 2.10.3

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 (41) hide show
  1. package/ARCHITECTURE_FASTELEMENT.md +1 -1
  2. package/ARCHITECTURE_HTML_TAGGED_TEMPLATE_LITERAL.md +3 -1
  3. package/ARCHITECTURE_INTRO.md +1 -1
  4. package/ARCHITECTURE_OVERVIEW.md +1 -1
  5. package/CHANGELOG.json +153 -1
  6. package/CHANGELOG.md +18 -2
  7. package/DESIGN.md +506 -0
  8. package/biome.json +4 -0
  9. package/dist/context/context.api.json +17 -1
  10. package/dist/di/di.api.json +17 -1
  11. package/dist/dts/hydration/target-builder.d.ts +17 -1
  12. package/dist/dts/templating/html-binding-directive.d.ts +39 -4
  13. package/dist/dts/templating/html-directive.d.ts +7 -1
  14. package/dist/dts/templating/template.d.ts +19 -1
  15. package/dist/dts/templating/view.d.ts +11 -0
  16. package/dist/dts/testing/models.d.ts +20 -0
  17. package/dist/dts/tsdoc-metadata.json +1 -1
  18. package/dist/esm/components/element-controller.js +3 -0
  19. package/dist/esm/components/hydration.js +17 -0
  20. package/dist/esm/hydration/target-builder.js +22 -1
  21. package/dist/esm/templating/compiler.js +29 -11
  22. package/dist/esm/templating/html-binding-directive.js +59 -4
  23. package/dist/esm/templating/html-directive.js +7 -1
  24. package/dist/esm/templating/install-hydratable-view-templates.js +6 -0
  25. package/dist/esm/templating/markup.js +8 -0
  26. package/dist/esm/templating/template.js +19 -1
  27. package/dist/esm/templating/view.js +13 -0
  28. package/dist/esm/testing/models.js +58 -0
  29. package/dist/fast-element.api.json +20 -4
  30. package/dist/fast-element.debug.js +179 -227
  31. package/dist/fast-element.debug.min.js +2 -2
  32. package/dist/fast-element.js +179 -227
  33. package/dist/fast-element.min.js +2 -2
  34. package/dist/fast-element.untrimmed.d.ts +76 -6
  35. package/docs/api-report.api.md +3 -3
  36. package/package.json +7 -19
  37. package/playwright.config.ts +8 -0
  38. package/test/main.ts +95 -1
  39. package/tsconfig.api-extractor.json +6 -0
  40. package/.eslintrc.json +0 -19
  41. package/karma.conf.cjs +0 -148
@@ -42,7 +42,7 @@ flowchart TD
42
42
 
43
43
  The rendering of the template on the `ElementController` is by the `renderTemplate` method which is called during the `ElementController.connect` method which is triggered by `HTMLElement`s `connectedCallback` lifecycle.
44
44
 
45
- The `renderTemplate` identifies the Custom Element, and the shadow root associated with the Custom Element. This then places a rendering of the template (an `ElementView`) onto the internal `view` of the controller. When creating the `ElementView`/`HTMLView` using the `ViewTemplate.render`, the `Compile.compile()` method identifies a `DocumentFragment` either by using an existing `<template>` tag, or creating one to wrap the contents of the shadow root. A new `CompilationContext` is created and the `compileAttributes` function is called, this results in the replacement of the placeholder attributes initally set-up during the pre-render step with their values if a value has been assigned. The factories with the associated nodes identified are then passed to the context. The view then binds all behaviors to the source element. The `CompilationContext.createView` is executed with the `DocumentFragment` as the root, and returns an `HTMLView`. This `HTMLView` includes an `appendTo` method to attach the fragment to the host element, which it then does. It should be noted that the compiled HTML is a `string`, which when set on the `DocumentFragment` as `innerHTML`, this allows the browser to dictate the creation of HTML nodes.
45
+ The `renderTemplate` identifies the Custom Element, and the shadow root associated with the Custom Element. This then places a rendering of the template (an `ElementView`) onto the internal `view` of the controller. When creating the `ElementView`/`HTMLView` using the `ViewTemplate.render`, the `Compiler.compile()` method identifies a `DocumentFragment` either by using an existing `<template>` tag, or creating one to wrap the contents of the shadow root. A new `CompilationContext` is created and the `compileAttributes` function is called, this results in the replacement of the placeholder attributes initally set-up during the pre-render step with their values if a value has been assigned. The factories with the associated nodes identified are then passed to the context. The view then binds all behaviors to the source element. The `CompilationContext.createView` is executed with the `DocumentFragment` as the root, and returns an `HTMLView`. This `HTMLView` includes an `appendTo` method to attach the fragment to the host element, which it then does. It should be noted that the compiled HTML is a `string`, which when set on the `DocumentFragment` as `innerHTML`, this allows the browser to dictate the creation of HTML nodes.
46
46
 
47
47
  ### 🔄 **Lifecycle**: Component is disconnected
48
48
 
@@ -6,10 +6,12 @@ The `html` export from `@microsoft/fast-element` is used to create the template
6
6
 
7
7
  Before the template can be used it goes through a step to convert it into a `ViewTemplate` which it does via the `ViewTemplate.create()` method. This is then used during the `compose` step, before `FASTElement` is instantiated.
8
8
 
9
- During the `Compiler.compile()` method(triggered by `ViewTemplate.create()` method), the following happens for each string:
9
+ During the static `ViewTemplate.create()` method (called by the `html` tag), the following happens for each string:
10
10
  - Factories with unique IDs are created for each tag template literal argument (or `TemplateValue`) which matches with the corresponding string
11
11
  - A binding is created from the `TemplateValue`
12
12
 
13
+ The `Compiler.compile()` method is called lazily the first time the template is rendered (via `ViewTemplate.compile()`, which is triggered by `ViewTemplate.create()` instance method or `ViewTemplate.render()`).
14
+
13
15
  A resulting string using a `createHTML()` function is produced using the `HTMLDirective`s executed for each factory. The behavior is augmented by the previous string from the `html` tag template which determines the aspect if one exists, these aspects are the `@`, `:`, or other binding aspect attached to attributes.
14
16
 
15
17
  The `createHTML()` function utilizes a `Markup` attribute which is assigned to a factory's unique ID. The strings are concatenated and passed to a new `ViewTemplate` with all the factories (empty until one is assigned) that act as a dictionary with the unique IDs as the key to look up each factory once it has been created. The string this creates is injected into a `<template>` as `innerHTML`, which allows the browser to create the nodes and placeholder factory IDs, with the only `DOM` node that is explicitly created being the wrapping `<template>` element.
@@ -6,5 +6,5 @@ This document (and the linked documents) explains how the exports and side effec
6
6
 
7
7
  - [Overview](./ARCHITECTURE_OVERVIEW.md): How the `@microsoft/fast-element` should be used by a developer and what code is executed during the first render.
8
8
  - [`FASTElement`](./ARCHITECTURE_FASTELEMENT.md): How the `FASTElement` is architected.
9
- - [`html` tagged template literal](./ARCHITECTURE_HTML_TAGGED_TEMPLATE_LITERAL.md): How the `html` tagged template literal takes and converts the contents into a `VIEWTemplate`.
9
+ - [`html` tagged template literal](./ARCHITECTURE_HTML_TAGGED_TEMPLATE_LITERAL.md): How the `html` tagged template literal takes and converts the contents into a `ViewTemplate`.
10
10
  - [`Updates` queue](./ARCHITECTURE_UPDATES.md): How updates to attributes and observables are processed.
@@ -39,7 +39,7 @@ flowchart TD
39
39
  A --> B
40
40
  C@{ shape: rect, label: "A Custom Element executes the <code>compose</code> step"}
41
41
  B --> C
42
- D@{ shape: procs, label: "<ul style="text-align: left"><li>Any defined observable decorators are added to the FAST global</li><li>An attribute decorator locates the associated Custom Elements constructor which it uses to push itself to the Custom Elements attribute collection</li></ul>"}
42
+ D@{ shape: procs, label: "<ul style='text-align: left'><li>Any defined observable decorators are added to the FAST global</li><li>An attribute decorator locates the associated Custom Elements constructor which it uses to push itself to the Custom Elements attribute collection</li></ul>"}
43
43
  C --> D
44
44
  F@{ shape: rect, label: "An HTML tagged template literal is executed for the FAST Custom Element and applied to the definition" }
45
45
  D --> F
package/CHANGELOG.json CHANGED
@@ -2,7 +2,159 @@
2
2
  "name": "@microsoft/fast-element",
3
3
  "entries": [
4
4
  {
5
- "date": "Mon, 02 Mar 2026 22:31:53 GMT",
5
+ "date": "Wed, 08 Apr 2026 00:19:52 GMT",
6
+ "version": "2.10.3",
7
+ "tag": "@microsoft/fast-element_v2.10.3",
8
+ "comments": {
9
+ "patch": [
10
+ {
11
+ "author": "863023+radium-v@users.noreply.github.com",
12
+ "package": "@microsoft/fast-element",
13
+ "commit": "e222ea1a8f0dfce91622f3b8504539c5fed1ddbd",
14
+ "comment": "fix: replace direct property access with Reflect.get for lazy getter resolution"
15
+ }
16
+ ],
17
+ "none": [
18
+ {
19
+ "author": "7559015+janechu@users.noreply.github.com",
20
+ "package": "@microsoft/fast-element",
21
+ "commit": "72e9f0d675f7a08de40eff911fefb783d1c43b3a",
22
+ "comment": "chore: add DESIGN.md and fix architecture doc errors"
23
+ }
24
+ ]
25
+ }
26
+ },
27
+ {
28
+ "date": "Tue, 07 Apr 2026 00:50:48 GMT",
29
+ "version": "2.10.2",
30
+ "tag": "@microsoft/fast-element_v2.10.2",
31
+ "comments": {
32
+ "none": [
33
+ {
34
+ "author": "863023+radium-v@users.noreply.github.com",
35
+ "package": "@microsoft/fast-element",
36
+ "commit": "05ccb88f41eb44ec6cbe263335cc030de99f80a4",
37
+ "comment": "chore: add biome script to run biome on changed files in packages"
38
+ }
39
+ ]
40
+ }
41
+ },
42
+ {
43
+ "date": "Sat, 04 Apr 2026 00:22:26 GMT",
44
+ "version": "2.10.2",
45
+ "tag": "@microsoft/fast-element_v2.10.2",
46
+ "comments": {
47
+ "none": [
48
+ {
49
+ "author": "7559015+janechu@users.noreply.github.com",
50
+ "package": "@microsoft/fast-element",
51
+ "commit": "4371b6c6124feaec26dd51116cb6d777a6507a99",
52
+ "comment": "Add documentation on FAST templating"
53
+ }
54
+ ]
55
+ }
56
+ },
57
+ {
58
+ "date": "Thu, 26 Mar 2026 00:04:08 GMT",
59
+ "version": "2.10.2",
60
+ "tag": "@microsoft/fast-element_v2.10.2",
61
+ "comments": {
62
+ "none": [
63
+ {
64
+ "author": "863023+radium-v@users.noreply.github.com",
65
+ "package": "@microsoft/fast-element",
66
+ "commit": "6b0fd6c4a4b0c635d4e5c18d251b28abbf32bab5",
67
+ "comment": "chore: migrate to biome for linting and formatting"
68
+ },
69
+ {
70
+ "author": "863023+radium-v@users.noreply.github.com",
71
+ "package": "@microsoft/fast-element",
72
+ "commit": "11227f6085b9aa2a3048c70427867a1f8d2f6873",
73
+ "comment": "chore: replace old clean script with new implementation"
74
+ },
75
+ {
76
+ "author": "7559015+janechu@users.noreply.github.com",
77
+ "package": "@microsoft/fast-element",
78
+ "commit": "ea46496f56cd94cb0dae65b7026998c88604aaac",
79
+ "comment": "chore: fix publish blocker due to biome"
80
+ }
81
+ ]
82
+ }
83
+ },
84
+ {
85
+ "date": "Fri, 20 Mar 2026 00:07:36 GMT",
86
+ "version": "2.10.2",
87
+ "tag": "@microsoft/fast-element_v2.10.2",
88
+ "comments": {
89
+ "none": [
90
+ {
91
+ "author": "7559015+janechu@users.noreply.github.com",
92
+ "package": "@microsoft/fast-element",
93
+ "commit": "6df43be90d257a49389c188935400792b7108cc6",
94
+ "comment": "Split tests to assist in base PR build gate times"
95
+ },
96
+ {
97
+ "author": "863023+radium-v@users.noreply.github.com",
98
+ "package": "@microsoft/fast-element",
99
+ "commit": "1dd81b899a21eb28ed7dd15bdf1c558196775c3e",
100
+ "comment": "chore: update dependencies and configurations"
101
+ },
102
+ {
103
+ "author": "7559015+janechu@users.noreply.github.com",
104
+ "package": "@microsoft/fast-element",
105
+ "commit": "8f79bdbf1d7c3af827ca807347fc1134bbf45731",
106
+ "comment": "Remove karma/mocha/chai and related unused dependencies"
107
+ }
108
+ ]
109
+ }
110
+ },
111
+ {
112
+ "date": "Fri, 13 Mar 2026 18:13:56 GMT",
113
+ "version": "2.10.2",
114
+ "tag": "@microsoft/fast-element_v2.10.2",
115
+ "comments": {
116
+ "patch": [
117
+ {
118
+ "author": "863023+radium-v@users.noreply.github.com",
119
+ "package": "@microsoft/fast-element",
120
+ "commit": "3ade63edb5abe7b5454e96390aac5ad13fdb4cc7",
121
+ "comment": "fix: add hydrating instance when needsHydration is true in HydratableElementController"
122
+ }
123
+ ]
124
+ }
125
+ },
126
+ {
127
+ "date": "Tue, 10 Mar 2026 00:17:17 GMT",
128
+ "version": "2.10.1",
129
+ "tag": "@microsoft/fast-element_v2.10.1",
130
+ "comments": {
131
+ "none": [
132
+ {
133
+ "author": "7559015+janechu@users.noreply.github.com",
134
+ "package": "@microsoft/fast-element",
135
+ "commit": "f91c57b5df062d6a1bb46a692070b89e31df384d",
136
+ "comment": "Remove webpack-env from tsconfig"
137
+ }
138
+ ]
139
+ }
140
+ },
141
+ {
142
+ "date": "Sun, 08 Mar 2026 00:09:02 GMT",
143
+ "version": "2.10.1",
144
+ "tag": "@microsoft/fast-element_v2.10.1",
145
+ "comments": {
146
+ "none": [
147
+ {
148
+ "author": "7559015+janechu@users.noreply.github.com",
149
+ "package": "@microsoft/fast-element",
150
+ "commit": "37734050ee0b61e9ea58a567882359ed5ab78eb6",
151
+ "comment": "Update Karma tests to Playwright"
152
+ }
153
+ ]
154
+ }
155
+ },
156
+ {
157
+ "date": "Mon, 02 Mar 2026 22:31:57 GMT",
6
158
  "version": "2.10.1",
7
159
  "tag": "@microsoft/fast-element_v2.10.1",
8
160
  "comments": {
package/CHANGELOG.md CHANGED
@@ -1,12 +1,28 @@
1
1
  # Change Log - @microsoft/fast-element
2
2
 
3
- <!-- This log was last generated on Mon, 02 Mar 2026 22:31:53 GMT and should not be manually modified. -->
3
+ <!-- This log was last generated on Wed, 08 Apr 2026 00:19:52 GMT and should not be manually modified. -->
4
4
 
5
5
  <!-- Start content -->
6
6
 
7
+ ## 2.10.3
8
+
9
+ Wed, 08 Apr 2026 00:19:52 GMT
10
+
11
+ ### Patches
12
+
13
+ - fix: replace direct property access with Reflect.get for lazy getter resolution (863023+radium-v@users.noreply.github.com)
14
+
15
+ ## 2.10.2
16
+
17
+ Fri, 13 Mar 2026 18:13:56 GMT
18
+
19
+ ### Patches
20
+
21
+ - fix: add hydrating instance when needsHydration is true in HydratableElementController (863023+radium-v@users.noreply.github.com)
22
+
7
23
  ## 2.10.1
8
24
 
9
- Mon, 02 Mar 2026 22:31:53 GMT
25
+ Mon, 02 Mar 2026 22:31:57 GMT
10
26
 
11
27
  ### Patches
12
28