diff --git a/biome.jsonc b/biome.jsonc index 759dea75009..8bd2f504da6 100644 --- a/biome.jsonc +++ b/biome.jsonc @@ -15,6 +15,16 @@ "!package-lock.json" ] }, + "overrides": [ + { + "includes": ["**/test/declarative/fixtures/**/*.html"], + "html": { + "formatter": { + "enabled": false + } + } + } + ], "html": { "formatter": { "enabled": true diff --git a/change/@microsoft-fast-element-c74392ec-7a62-4196-a74d-78d3cb1ce61c.json b/change/@microsoft-fast-element-c74392ec-7a62-4196-a74d-78d3cb1ce61c.json new file mode 100644 index 00000000000..48c43856e63 --- /dev/null +++ b/change/@microsoft-fast-element-c74392ec-7a62-4196-a74d-78d3cb1ce61c.json @@ -0,0 +1,7 @@ +{ + "type": "none", + "comment": "Allow duplicate f-template names to keep the first template assignment", + "packageName": "@microsoft/fast-element", + "email": "7559015+janechu@users.noreply.github.com", + "dependentChangeType": "none" +} diff --git a/packages/fast-element/DESIGN.md b/packages/fast-element/DESIGN.md index 752c5f110e5..72fd31aaf19 100644 --- a/packages/fast-element/DESIGN.md +++ b/packages/fast-element/DESIGN.md @@ -350,7 +350,9 @@ the imperative `html` API: - The internal `` publisher parses HTML and returns concrete `ViewTemplate` instances through the registry-aware declarative template - bridge. + bridge. If duplicate connected publishers share a name, the first connected + publisher supplies the definition template and later duplicates do not + reassign it. - `TemplateParser` lowers declarative syntax to the same `strings` / `values` shape used by `ViewTemplate.create()`. - `attributeMap()` and `observerMap()` are `FASTElementExtension` factories diff --git a/packages/fast-element/README.md b/packages/fast-element/README.md index 6d4a720f3ee..1147337af26 100644 --- a/packages/fast-element/README.md +++ b/packages/fast-element/README.md @@ -136,8 +136,10 @@ MyElement.define({ `declarativeTemplate()` automatically defines FAST's internal native `` publisher in the relevant registry, resolves the matching ``, and keeps the definition template concrete -before `define()` resolves. Consumers should not import or define the -`` implementation directly. +before `define()` resolves. If multiple matching `` elements are +connected, the first connected element supplies the template and later duplicates +do not reassign it. Consumers should not import or define the `` +implementation directly. Declarative schema behavior is enabled with define extensions: diff --git a/packages/fast-element/SIZES.md b/packages/fast-element/SIZES.md index e6ac7937aa9..67ec54c7e12 100644 --- a/packages/fast-element/SIZES.md +++ b/packages/fast-element/SIZES.md @@ -19,7 +19,7 @@ Bundle sizes for `@microsoft/fast-element` exports. | repeat (@microsoft/fast-element/repeat.js) | 29.57 KB | 9.41 KB | 8.48 KB | | css (@microsoft/fast-element/css.js) | 2.43 KB | 1.00 KB | 911 B | | enableHydration (@microsoft/fast-element/hydration.js) | 43.27 KB | 13.19 KB | 11.88 KB | -| declarativeTemplate (@microsoft/fast-element/declarative.js) | 58.77 KB | 18.45 KB | 16.46 KB | +| declarativeTemplate (@microsoft/fast-element/declarative.js) | 58.39 KB | 18.35 KB | 16.38 KB | | ArrayObserver (@microsoft/fast-element/array-observer.js) | 12.51 KB | 4.45 KB | 4.01 KB | | observerMap (@microsoft/fast-element/observer-map.js) | 20.41 KB | 7.24 KB | 6.52 KB | | attributeMap (@microsoft/fast-element/attribute-map.js) | 15.78 KB | 5.58 KB | 5.04 KB | diff --git a/packages/fast-element/docs/declarative-design.md b/packages/fast-element/docs/declarative-design.md index 021e6d30591..8b75a63fb4f 100644 --- a/packages/fast-element/docs/declarative-design.md +++ b/packages/fast-element/docs/declarative-design.md @@ -79,6 +79,11 @@ When connected to the DOM it: 4. Runs definition-scoped schema transforms, such as `attributeMap()` and `observerMap()`, before returning the concrete `ViewTemplate`. +When multiple connected `` publishers share the same `name`, the +bridge resolves pending definitions from the first connected publisher and keeps +the resolved template stable. Later duplicate publishers do not reassign the +definition template. + ### `TemplateParser` — declarative HTML parser A standalone class that converts declarative HTML template markup into the diff --git a/packages/fast-element/src/declarative/debug.ts b/packages/fast-element/src/declarative/debug.ts index 75602b9469b..87140bcaae2 100644 --- a/packages/fast-element/src/declarative/debug.ts +++ b/packages/fast-element/src/declarative/debug.ts @@ -3,6 +3,4 @@ export const debugMessages = { "The first child of the must be a