Skip to content

refactor: add template resolver pipeline#7490

Merged
janechu merged 9 commits intomicrosoft:releases/fast-element-v3from
janechu:copilot/pr1-core-template-resolver
Apr 24, 2026
Merged

refactor: add template resolver pipeline#7490
janechu merged 9 commits intomicrosoft:releases/fast-element-v3from
janechu:copilot/pr1-core-template-resolver

Conversation

@janechu
Copy link
Copy Markdown
Collaborator

@janechu janechu commented Apr 24, 2026

Pull Request

📖 Description

This draft lays the groundwork for definition-aware template resolution in @microsoft/fast-element.

  • treat PartialFASTElementDefinition.template as either a concrete template or a function-based resolver
  • apply FAST element extensions before template resolution and platform registration
  • keep FASTElementDefinition.template concrete by resolving async templates before registration completes
  • add focused Playwright coverage for async template resolution, concurrent define calls, and deferred registration behavior

👩‍💻 Reviewer Notes

This is the stack base for the declarative-template work. The main areas to review are the resolver API shape in fast-definitions.ts and the updated FASTElement.define() sequencing.

📑 Test Plan

  • npm run build:tsc -w @microsoft/fast-element
  • npm run doc -w @microsoft/fast-element
  • npx @biomejs/biome check --colors=off packages/fast-element/src/components/fast-definitions.pw.spec.ts packages/fast-element/src/components/fast-definitions.ts packages/fast-element/src/components/fast-element.pw.spec.ts packages/fast-element/src/components/fast-element.ts packages/fast-element/src/index.ts
  • npm run checkchange
  • npx playwright test src/components/fast-definitions.pw.spec.ts src/components/fast-element.pw.spec.ts --project=chromium

✅ Checklist

General

  • I have included a change request file using $ npm run change
  • I have added tests for my changes.
  • I have tested my changes.
  • I have updated the project documentation to reflect my changes.
  • I have read the CONTRIBUTING documentation and followed the standards for this project.

⏭ Next Steps

Follow-up draft PRs will build the declarative <f-template> publication path, add declarativeTemplate(), and then remove the remaining sideEffects metadata.

janechu and others added 3 commits April 23, 2026 23:56
Move FASTElement definition orchestration to a function-based template resolver pipeline so extensions run before template resolution and concrete templates are assigned before registration.

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Drop the templateOptions defer-and-hydrate API from fast-element so the core resolver pipeline no longer preserves the old deferred-template registration path.

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
@janechu janechu marked this pull request as ready for review April 24, 2026 17:21
janechu and others added 2 commits April 24, 2026 10:34
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
janechu and others added 3 commits April 24, 2026 12:26
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
@janechu janechu merged commit 3af0ed5 into microsoft:releases/fast-element-v3 Apr 24, 2026
7 checks passed
janechu added a commit that referenced this pull request Apr 24, 2026
# Pull Request

## 📖 Description

Adds a new **Declarative HTML** documentation section to the 3.x docs site with four pages covering the full declarative template authoring workflow:

- **Overview** — Purpose of declarative templates, when to use them, a hello world example, and comparison with imperative `html` tagged templates.
- **Writing f-templates** — Template syntax including content/attribute/boolean/event bindings, directives (`f-when`, `f-repeat`, `f-ref`, `f-slotted`, `f-children`), dot-notation paths, execution context access (`$e`, `$c`), and expression limitations.
- **Defining Elements** — `TemplateElement` registration, `templateOptions: "defer-and-hydrate"`, lifecycle callbacks (`config()`), element configuration (`options()`), `observerMap` and `attributeMap` usage.
- **Server-Side Rendering** — The renderer-agnostic SSR contract, hydration flow, Declarative Shadow DOM output, state propagation, and `@microsoft/fast-build` CLI usage.

Also adds cross-references from `packages/fast-element/README.md` and `DECLARATIVE_HTML.md` to the new docs.

Based on the declarative template features from PRs #7490, #7491, #7492, and #7493.

## 📑 Test Plan

- Website builds successfully with `npm run build -w sites/website`
- All four pages render correctly in the 11ty output
- `npm run checkchange` passes (no change files needed for docs-only changes to the website)

## ✅ Checklist

### General

- [x] I have included a change request file using `$ npm run change`
- [ ] I have added tests for my changes.
- [x] I have tested my changes.
- [x] I have updated the project documentation to reflect my changes.
- [x] I have read the [CONTRIBUTING](https://github.com/microsoft/fast/blob/main/CONTRIBUTING.md) documentation and followed the [standards](https://github.com/microsoft/fast/blob/main/CODE_OF_CONDUCT.md#our-standards) for this project.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants