FAST Documentation
website·Indexed 35 days ago
https://www.fast.designAPI reference for the FAST framework, including @microsoft/fast-element. Covers dependency injection (DI) with ResolverBuilder and Factory, context management, DOM policies, and hydration controllers across versions 2.x and 3.x.
What's inside FAST
- FAST is a collection of technologies built on Web Components and modern W3C Web Standards. It is designed to help developers build website and application designs efficiently. Because it adheres to open web standards and does not create a proprietary component model, FAST components function like native HTML elements and can be used without a framework or in combination with any existing framework or library.
Overview of Web Components standards
Web Components is an umbrella term for W3C web standards that allow the creation of custom HTML elements. These standards enable developers to define new HTML tags, utilize a standard component lifecycle, encapsulate HTML rendering and CSS, parameterize CSS, and skin components. These features are supported across all major modern browsers.Overview of the FAST tech stack
FAST is a collection of technologies built on W3C Web Component standards. It is designed to be framework-agnostic, meaning components built with FAST function like native HTML elements and can be used with any framework or library. The stack is divided into three layers based on the level of customization needed: high-level ready-made components, foundational building blocks for design systems, and a low-level library for custom component creation.Overview of the FAST framework
FAST is a collection of technologies built on Web Components and modern Web Standards. It is designed to help developers tackle common website and application design challenges. Because it is built directly on W3C Web Component standards and does not create its own proprietary component model, FAST components function like native HTML elements. They can be used without a framework or in combination with any existing framework or library.Overview of Declarative HTML templates in FAST Element
FAST Element provides a declarative authoring model using<f-template>elements. Unlike the imperative model (which uses JavaScript tagged template literals), declarative templates are plain HTML parsed at runtime. This allows templates to be rendered by any server-side technology (e.g., Rust, Go, .NET) without requiring the FAST Element client runtime on the server, enabling stack-agnostic server-side rendering (SSR). Hydration and client rendering occur in the browser Window.Use the Splice class to represent array transformations
The
Spliceclass in@microsoft/fast-elementrepresents how a previous array of items was transformed into a new array. It functions as a list of tuples consisting of(index, removed, addedCount).index: The position in the array where the change occurred.removed: The sequence of items that were removed at that index.addedCount: The number of items added starting from that index.
This is used to track changes between array states, allowing for efficient updates rather than full array resets.
import { Splice } from '@microsoft/fast-element'; // Example: At index 2, 1 item was removed and 2 items were added const splice = new Splice(2, [removedItem], 2);Use TemplateParser to convert declarative HTML to ViewTemplate data
The
TemplateParserclass from@microsoft/fast-element/declarative.jsis used to convert declarative HTML template markup into thestringsandvaluesarrays consumed byViewTemplate.create().Key architectural characteristics:
- Stateless: The class is stateless across invocations; mutable state is managed on the call stack or within the
TemplateResolutionContext. - Synchronous: The parsing pipeline is fully synchronous and does not allocate promises during template resolution.
import { TemplateParser } from '@microsoft/fast-element/declarative'; // Example usage context: // const parser = new TemplateParser(); // const { strings, values } = parser.parse(innerHTML, schema);- Stateless: The class is stateless across invocations; mutable state is managed on the call stack or within the
Use UpdateQueue to synchronize DOM writes
TheUpdateQueueinterface from@microsoft/fast-elementacts as a work queue designed to synchronize writes to the DOM. It allows developers to schedule updates and control when they are processed to avoid excessive reflows and repaints.import { UpdateQueue } from '@microsoft/fast-element'; // Example usage of the interface const queue: UpdateQueue = { /* ... implementation ... */ };Understand the purpose and scope of fast-element
Unlike "mega SPA frameworks,"fast-elementis specifically designed to enable the creation of web components. Because of this focused scope,fast-elementand components built with it can be used in tandem with other front-end frameworks rather than replacing them.FAST project planning and release cadence
The FAST team uses a hybrid planning model to manage the project backlog:
- Quarterly Planning: Focuses on large-scale themes, strategic work, and OKRs (e.g., SSR support).
- Weekly Planning: An agile process where the team selects the most impactful bugs, features, and documentation tasks from the backlog for the current iteration.
- Release Schedule: Minor and patch changes merged to the
mainbranch are published Sunday through Thursday evenings (Pacific Time).
Frameworks with native FAST support
The following frameworks and tools natively support FAST web components and require no additional configuration: ASP.NET, Ember, Svelte, Vite, Vue, and Webpack.Use ResolverBuilder to register dependencies in FAST
TheResolverBuilder<K>class is a utility used to construct and register resolvers for a dependency injection container in the@microsoft/fast-element/di.jspackage. It allows developers to define how dependencies are instantiated and managed throughout their lifetime.import { ResolverBuilder } from '@microsoft/fast-element/di.js'; // Usage depends on the container implementation