Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion examples/todo-app/src/todo-app.template.ts
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ export const template = html<TodoApp>`
&times;
</button>
</li>
`
`,
)}
</ul>
`;
7 changes: 5 additions & 2 deletions packages/fast-element/ARCHITECTURE_INTRO.md
Original file line number Diff line number Diff line change
@@ -1,10 +1,13 @@
# Introduction

This document (and the linked documents) explains how the exports and side effects of `@microsoft/fast-element` are used to create custom elements.
This document (and the linked documents) explains how the exports and side
effects of `@microsoft/fast-element` are used to create custom elements,
including the dedicated binding, hydration, and `declarative.js`
sub-entrypoints.

## Glossary

- [Overview](./ARCHITECTURE_OVERVIEW.md): How the `@microsoft/fast-element` should be used by a developer and what code is executed during the first render.
- [`FASTElement`](./ARCHITECTURE_FASTELEMENT.md): How the `FASTElement` is architected.
- [`html` tagged template literal](./ARCHITECTURE_HTML_TAGGED_TEMPLATE_LITERAL.md): How the `html` tagged template literal takes and converts the contents into a `ViewTemplate`.
- [`Updates` queue](./ARCHITECTURE_UPDATES.md): How updates to attributes and observables are processed.
- [`Updates` queue](./ARCHITECTURE_UPDATES.md): How updates to attributes and observables are processed.
16 changes: 14 additions & 2 deletions packages/fast-element/DESIGN.md
Original file line number Diff line number Diff line change
Expand Up @@ -174,6 +174,10 @@ This gives FAST automatic, fine-grained dependency tracking without explicit dec

`normalizeBinding(value)` converts raw arrow functions or static values into a `Binding` object.

Optional binding helpers remain on dedicated public subpaths:
`@microsoft/fast-element/binding/two-way.js` and
`@microsoft/fast-element/binding/signal.js`.

---

### html Tagged Template Literal
Expand Down Expand Up @@ -350,8 +354,11 @@ the imperative `html` API:
The `src/declarative.ts` entrypoint owns the declarative-only side effects:
registering debug messages and installing hydratable view templates. This keeps
the root `@microsoft/fast-element` barrel free of declarative side effects and
utility-subpath collisions. See [`DECLARATIVE_DESIGN.md`](./DECLARATIVE_DESIGN.md)
for the detailed architecture.
utility-subpath collisions, while low-level hydration APIs stay on the dedicated
`src/components/hydration.ts`, `src/components/install-hydration.ts`, and
`src/templating/install-hydratable-view-templates.ts` modules. See
[`DECLARATIVE_DESIGN.md`](./DECLARATIVE_DESIGN.md) for the detailed
architecture.

---

Expand Down Expand Up @@ -528,6 +535,8 @@ src/
│ └── update-queue.ts # Updates (UpdateQueue)
├── binding/
│ ├── binding.ts # Binding abstract base class, BindingDirective
│ ├── signal.ts # signal() and Signal
│ ├── two-way.ts # twoWay()
│ ├── one-way.ts # oneWay, listener
│ ├── one-time.ts # oneTime
│ └── normalize.ts # normalizeBinding helper
Expand All @@ -554,6 +563,8 @@ src/
│ ├── fast-element.ts # FASTElement, @customElement
│ ├── element-controller.ts # ElementController, Stages
│ ├── fast-definitions.ts # FASTElementDefinition, TemplateOptions
│ ├── hydration.ts # HydrationMarkup and hydration helpers
│ ├── install-hydration.ts # Legacy hydration install side-effect module
│ └── attributes.ts # AttributeDefinition, @attr, converters
├── di/
│ └── di.ts # DI container, decorators, resolvers, Registration
Expand All @@ -567,6 +578,7 @@ src/
│ ├── utilities.ts # Declarative parsing and proxy utilities
│ └── syntax.ts # Declarative syntax constants
├── state/
│ ├── exports.ts # Focused state entrypoint (state.js)
│ ├── state.ts # state() helper (beta)
│ └── watch.ts # watch() helper (beta)
└── hydration/
Expand Down
23 changes: 23 additions & 0 deletions packages/fast-element/MIGRATION.md
Original file line number Diff line number Diff line change
Expand Up @@ -53,6 +53,29 @@ removed `@microsoft/fast-html` package.
APIs; the declarative entrypoint owns the debug-message and hydratable-view
side effects.

## Export path cleanup (v3)

Optional binding and hydration helpers remain on their dedicated public
sub-entrypoints:

- `@microsoft/fast-element/binding/two-way.js`
- `@microsoft/fast-element/binding/signal.js`
- `@microsoft/fast-element/element-hydration.js`
- `@microsoft/fast-element/install-element-hydration.js`
- `@microsoft/fast-element/install-hydratable-view-templates.js`

### Removed exports

| Import | Replacement |
|---|---|
| `@microsoft/fast-element/metadata.js` | No public replacement |
| `@microsoft/fast-element/pending-task.js` | No public replacement |

### Migration steps

1. Keep optional binding and hydration imports on their dedicated subpaths.
2. Remove any direct imports from `metadata.js` or `pending-task.js`.

## Prerendered Content Optimization (v2 → v3)

### Removed exports
Expand Down
15 changes: 15 additions & 0 deletions packages/fast-element/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -65,6 +65,21 @@ importing `@microsoft/fast-element`.

Bundle sizes for each tree-shakeable export are tracked in [`SIZES.md`](./SIZES.md) and regenerated on every build. See the [Export Sizes](https://www.fast.design/docs/3.x/resources/export-sizes/) documentation page for the latest numbers.

## Dedicated Entry Points

Use the dedicated sub-entrypoints when you only need optional binding or
hydration APIs:

```ts
import { twoWay } from "@microsoft/fast-element/binding/two-way.js";
import { HydrationMarkup } from "@microsoft/fast-element/element-hydration.js";
import "@microsoft/fast-element/install-hydratable-view-templates.js";
```

`@microsoft/fast-element/declarative.js` still installs hydratable
`ViewTemplate` support automatically. The legacy `metadata.js` and
`pending-task.js` subpaths are no longer part of the public export map.

## Dynamic Style Application

When runtime state or external signals need to add or remove styles, create the
Expand Down
8 changes: 0 additions & 8 deletions packages/fast-element/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -64,10 +64,6 @@
"types": "./dist/dts/context.d.ts",
"default": "./dist/esm/context.js"
},
"./metadata.js": {
"types": "./dist/dts/metadata.d.ts",
"default": "./dist/esm/metadata.js"
},
"./testing.js": {
"types": "./dist/dts/testing/exports.d.ts",
"default": "./dist/esm/testing/exports.js"
Expand All @@ -88,10 +84,6 @@
"types": "./dist/dts/templating/install-hydratable-view-templates.d.ts",
"default": "./dist/esm/templating/install-hydratable-view-templates.js"
},
"./pending-task.js": {
"types": "./dist/dts/pending-task.d.ts",
"default": "./dist/esm/pending-task.js"
},
"./dom-policy.js": {
"types": "./dist/dts/dom-policy.d.ts",
"default": "./dist/esm/dom-policy.js"
Expand Down
2 changes: 0 additions & 2 deletions packages/fast-element/src/components/element-hydration.ts

This file was deleted.

23 changes: 22 additions & 1 deletion packages/fast-element/src/declarative.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,4 +4,25 @@ import "./templating/install-hydratable-view-templates.js";

FAST.addMessages(debugMessages);

export * from "./declarative/index.js";
export type {
AttributeMapConfig,
CachedPathMap,
ElementOptions,
ElementOptionsDictionary,
HydrationLifecycleCallbacks,
JSONSchema,
ObserverMapConfig,
ObserverMapPathEntry,
ObserverMapPathNode,
ResolvedStringsAndValues,
} from "./declarative/index.js";
export {
AttributeMap,
AttributeMapOption,
ObserverMap,
ObserverMapOption,
Schema,
schemaRegistry,
TemplateElement,
TemplateParser,
} from "./declarative/index.js";
171 changes: 170 additions & 1 deletion packages/fast-element/src/index.debug.ts
Original file line number Diff line number Diff line change
@@ -1,2 +1,171 @@
import "./debug.js";
export * from "./index.js";

// Binding
export { Binding, type BindingDirective } from "./binding/binding.js";
export { normalizeBinding } from "./binding/normalize.js";
export { oneTime } from "./binding/one-time.js";
export { listener, oneWay } from "./binding/one-way.js";
export type {
AttributeMode,
DecoratorAttributeConfiguration,
ValueConverter,
} from "./components/attributes.js";
// Components
export {
AttributeConfiguration,
AttributeDefinition,
attr,
booleanConverter,
nullableBooleanConverter,
nullableNumberConverter,
} from "./components/attributes.js";
export type { ElementControllerStrategy } from "./components/element-controller.js";
export {
ElementController,
Stages,
} from "./components/element-controller.js";
export type {
FASTElementExtension,
PartialFASTElementDefinition,
ShadowRootOptions,
TypeRegistry,
} from "./components/fast-definitions.js";
export {
FASTElementDefinition,
fastElementRegistry,
type TemplateLifecycleCallbacks,
TemplateOptions,
} from "./components/fast-definitions.js";
export { customElement, FASTElement } from "./components/fast-element.js";
export { deferHydrationAttribute, isHydratable } from "./components/hydration.js";
export {
type ElementHydrationCallbacks,
HydrationTracker,
} from "./components/hydration-tracker.js";
// DOM
export { DOM, DOMAspect, type DOMPolicy, type DOMSink } from "./dom.js";
export type {
Callable,
Class,
Constructable,
Disposable,
FASTGlobal,
TrustedTypesPolicy,
} from "./interfaces.js";
// Observation
export {
ArrayObserver,
type LengthObserver,
lengthOf,
Sort,
type SortObserver,
Splice,
SpliceStrategy,
SpliceStrategySupport,
sortedCount,
} from "./observation/arrays.js";
export {
type Notifier,
PropertyChangeNotifier,
type Subscriber,
SubscriberSet,
} from "./observation/notifier.js";
export {
type Accessor,
ExecutionContext,
type Expression,
type ExpressionController,
type ExpressionNotifier,
type ExpressionObserver,
Observable,
type ObservationRecord,
observable,
SourceLifetime,
volatile,
} from "./observation/observable.js";
export { type UpdateQueue, Updates } from "./observation/update-queue.js";
export { emptyArray, FAST } from "./platform.js";
export { type CSSTemplateTag, type CSSValue, css } from "./styles/css.js";
// Styles
export {
CSSDirective,
type CSSDirectiveDefinition,
cssDirective,
} from "./styles/css-directive.js";
export {
type ComposableStyles,
type ConstructibleStyleStrategy,
ElementStyles,
} from "./styles/element-styles.js";
export type { HostBehavior, HostController } from "./styles/host.js";
export type { StyleStrategy, StyleTarget } from "./styles/style-strategy.js";
export type {
ChildListDirectiveOptions,
ChildrenDirectiveOptions,
SubtreeDirectiveOptions,
} from "./templating/children.js";
// Templating
export { ChildrenDirective, children } from "./templating/children.js";
export type { CompilationStrategy } from "./templating/compiler.js";
export { Compiler } from "./templating/compiler.js";
export type {
ContentTemplate,
ContentView,
} from "./templating/html-binding-directive.js";
export { HTMLBindingDirective } from "./templating/html-binding-directive.js";
export type {
AddViewBehaviorFactory,
Aspected,
CompiledViewBehaviorFactory,
HTMLDirectiveDefinition,
PartialHTMLDirectiveDefinition,
ViewBehavior,
ViewBehaviorFactory,
ViewBehaviorTargets,
ViewController,
} from "./templating/html-directive.js";
export {
HTMLDirective,
htmlDirective,
StatelessAttachedAttributeDirective,
} from "./templating/html-directive.js";
export { Markup, Parser } from "./templating/markup.js";
export type {
ElementsFilter,
NodeBehaviorOptions,
} from "./templating/node-observation.js";
export {
elements,
NodeObservationDirective,
} from "./templating/node-observation.js";
export { RefDirective, ref } from "./templating/ref.js";
export { RenderBehavior, RenderDirective, render } from "./templating/render.js";
export type { RepeatOptions } from "./templating/repeat.js";
export {
RepeatBehavior,
RepeatDirective,
repeat,
} from "./templating/repeat.js";
export type { SlottedDirectiveOptions } from "./templating/slotted.js";
export { SlottedDirective, slotted } from "./templating/slotted.js";
export type {
CaptureType,
ElementViewTemplate,
HTMLTemplateCompilationResult,
HTMLTemplateTag,
SyntheticViewTemplate,
TemplateValue,
} from "./templating/template.js";
export {
html,
InlineTemplateDirective,
ViewTemplate,
} from "./templating/template.js";
export type {
ElementView,
HydratableView,
SyntheticView,
View,
} from "./templating/view.js";
export { HTMLView, HydrationBindingError } from "./templating/view.js";
export { when } from "./templating/when.js";
Loading
Loading