Rewrite v3 Getting Started docs#7569
Conversation
There was a problem hiding this comment.
Pull request overview
This PR rewrites and expands the FAST Element v3 documentation site’s getting-started content, adds a new DOM Policy guide, and introduces prev/next pagination derived from the Eleventy navigation tree. It also tweaks the website dev workflow by enabling Eleventy incremental builds in watch mode.
Changes:
- Reworked v3 getting-started docs (Quick Start, FASTElement, HTML Templates) and added navigation ordering.
- Added a new v3 advanced “DOM Policies” guide and linked it from template/security guidance.
- Implemented prev/next pagination UI (Nunjucks include + CSS) and added a
prevNextEleventy filter; enabled--incrementalin the site start script.
Reviewed changes
Copilot reviewed 9 out of 9 changed files in this pull request and generated 9 comments.
Show a summary per file
| File | Description |
|---|---|
| sites/website/src/docs/3.x/getting-started/quick-start.md | Rewritten Quick Start guide; introduces tsconfig guidance and an end-to-end component example. |
| sites/website/src/docs/3.x/getting-started/html-templates.md | Expanded template authoring/binding reference, including DOMPolicy mention and host bindings. |
| sites/website/src/docs/3.x/getting-started/fast-element.md | Reworked FASTElement overview; adds lifecycle/define/compose guidance and controller notes. |
| sites/website/src/docs/3.x/advanced/dom-policy.md | New DOMPolicy advanced guide describing Trusted Types integration and withPolicy(). |
| sites/website/src/css/main.css | Adds pagination navigation styling and hides pagination in print. |
| sites/website/src/_includes/pagination-nav.njk | New prev/next pagination include driven by eleventy-navigation ordering. |
| sites/website/src/_includes/3x-container.njk | Renders pagination include for v3 pages. |
| sites/website/package.json | Adds --incremental to Eleventy serve/watch startup script. |
| sites/website/eleventy.config.js | Adds a prevNext filter to compute siblings from the navigation tree. |
| "module": "ESNext", | ||
| "moduleResolution": "Bundler", | ||
| "target": "ES2022", | ||
| "useDefineForClassFields": false // should be false when targeting ES2022 or newer (see FAST#5261) |
There was a problem hiding this comment.
The linked issue includes further details about the tc39 class fields feature, which is already in Stage 4. This may be a more general issue when using the side-effectful function calls as well and needs some investigation before we can definitively say it's only needed when using decorators.
There was a problem hiding this comment.
I can convert the reference to the FAST issue to a document footnote rather than a parenthetical.
| class HelloWorld extends FASTElement { | ||
| @attr | ||
| name: string; | ||
| } |
| ### Event Bindings | ||
|
|
||
| Event bindings are used to attach event listeners to elements within the template. They are denoted by prefixing an attribute binding with an at symbol (`@`). The value returned by the binding function is expected to be a function, which is registered as an event listener for the specified event type. |
| :::tip | ||
| FAST's `Observable` API can be used independently of custom elements, so you can create observable objects and properties in any JavaScript class, not just those that extend `FASTElement`. Read the [Reactivity](/docs/advanced/reactivity.md) section for more details on using observables in FAST. | ||
| ::: |
| const trustedType = trustedTypes.createPolicy("my-app", { | ||
| createHTML(value) { | ||
| // Run the value through a sanitizer such as DOMPurify | ||
| // before returning it. | ||
| return sanitize(value); | ||
| }, | ||
| }); |
|
|
||
| This guide assumes you're building a browser bundle with TypeScript, via a build tool such as esbuild, Rollup, Vite, or Webpack. | ||
|
|
||
| Install `@microsoft/fast-element` as a dev dependency: |
|
|
||
| ```bash | ||
| npm install --save @microsoft/fast-element | ||
| npm install --save-dev @microsoft/fast-element |
Pull Request
📖 Description
Rewrites and expands the FAST Element v3 documentation site. The getting-started guides were dense and in places out of date; this branch reworks them and adds the missing DOM Policy reference.
--incrementalflag to the website's watch mode so local rebuilds are faster.📑 Test Plan
Everything here touches
sites/website/**(content, Eleventy config, styles). Runnpm run startinsites/website, then check the updated pages render and the prev/next navigation links to the right neighbors. All existing tests pass.✅ Checklist
General