Skip to content

Commit 87524ca

Browse files
janechuCopilot
andcommitted
fix: keep fast-element exports explicit
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
1 parent aae0486 commit 87524ca

22 files changed

Lines changed: 633 additions & 247 deletions

File tree

.github/skills/typescript/SKILL.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ import { type Constructable, isFunction } from "../interfaces.js";
1818
Sub-entry-points expose focused APIs through the `exports` map:
1919

2020
```ts
21-
import { twoWay } from "@microsoft/fast-element/binding.js";
21+
import { twoWay } from "@microsoft/fast-element/binding/two-way.js";
2222
import { reactive } from "@microsoft/fast-element/state.js";
2323
import { composedParent } from "@microsoft/fast-element/utilities.js";
2424
```
@@ -95,7 +95,7 @@ export const template = html<MyElement>`
9595
Two-way bindings require a sub-entry-point import:
9696

9797
```ts
98-
import { twoWay } from "@microsoft/fast-element/binding.js";
98+
import { twoWay } from "@microsoft/fast-element/binding/two-way.js";
9999
```
100100

101101
### Partial HTML

examples/todo-app/src/todo-app.template.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
import { html, repeat } from "@microsoft/fast-element";
2-
import { twoWay } from "@microsoft/fast-element/binding.js";
2+
import { twoWay } from "@microsoft/fast-element/binding/two-way.js";
33
import type { TodoApp } from "./todo-app.js";
44
import type { Todo } from "./todo-list.js";
55
import "./todo-form.js";

examples/todo-app/src/todo-form.template.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
import { html } from "@microsoft/fast-element";
2-
import { twoWay } from "@microsoft/fast-element/binding.js";
2+
import { twoWay } from "@microsoft/fast-element/binding/two-way.js";
33
import type { TodoForm } from "./todo-form.js";
44

55
export const template = html<TodoForm>`

packages/fast-element/ARCHITECTURE_INTRO.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22

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

88
## Glossary

packages/fast-element/DESIGN.md

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -174,11 +174,9 @@ This gives FAST automatic, fine-grained dependency tracking without explicit dec
174174

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

177-
The focused public binding entrypoint
178-
`@microsoft/fast-element/binding.js` is implemented by
179-
`src/binding/exports.ts`. It groups the optional `signal` and `twoWay`
180-
helpers with the core binding primitives so callers no longer need nested
181-
subpath imports.
177+
Optional binding helpers remain on dedicated public subpaths:
178+
`@microsoft/fast-element/binding/two-way.js` and
179+
`@microsoft/fast-element/binding/signal.js`.
182180

183181
---
184182

@@ -356,9 +354,9 @@ the imperative `html` API:
356354
The `src/declarative.ts` entrypoint owns the declarative-only side effects:
357355
registering debug messages and installing hydratable view templates. This keeps
358356
the root `@microsoft/fast-element` barrel free of declarative side effects and
359-
utility-subpath collisions, while `src/hydration/exports.ts` backs the grouped
360-
`@microsoft/fast-element/hydration.js` entrypoint for low-level hydration
361-
utilities and manual install hooks. See
357+
utility-subpath collisions, while low-level hydration APIs stay on the dedicated
358+
`src/components/hydration.ts`, `src/components/install-hydration.ts`, and
359+
`src/templating/install-hydratable-view-templates.ts` modules. See
362360
[`DECLARATIVE_DESIGN.md`](./DECLARATIVE_DESIGN.md) for the detailed
363361
architecture.
364362

@@ -537,7 +535,8 @@ src/
537535
│ └── update-queue.ts # Updates (UpdateQueue)
538536
├── binding/
539537
│ ├── binding.ts # Binding abstract base class, BindingDirective
540-
│ ├── exports.ts # Focused binding entrypoint (binding.js)
538+
│ ├── signal.ts # signal() and Signal
539+
│ ├── two-way.ts # twoWay()
541540
│ ├── one-way.ts # oneWay, listener
542541
│ ├── one-time.ts # oneTime
543542
│ └── normalize.ts # normalizeBinding helper
@@ -564,6 +563,8 @@ src/
564563
│ ├── fast-element.ts # FASTElement, @customElement
565564
│ ├── element-controller.ts # ElementController, Stages
566565
│ ├── fast-definitions.ts # FASTElementDefinition, TemplateOptions
566+
│ ├── hydration.ts # HydrationMarkup and hydration helpers
567+
│ ├── install-hydration.ts # Legacy hydration install side-effect module
567568
│ └── attributes.ts # AttributeDefinition, @attr, converters
568569
├── di/
569570
│ └── di.ts # DI container, decorators, resolvers, Registration
@@ -581,7 +582,6 @@ src/
581582
│ ├── state.ts # state() helper (beta)
582583
│ └── watch.ts # watch() helper (beta)
583584
└── hydration/
584-
├── exports.ts # Focused hydration entrypoint (hydration.js)
585585
└── target-builder.ts # Hydration target resolution
586586
```
587587

packages/fast-element/MIGRATION.md

Lines changed: 14 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -53,32 +53,28 @@ removed `@microsoft/fast-html` package.
5353
APIs; the declarative entrypoint owns the debug-message and hydratable-view
5454
side effects.
5555

56-
## Focused export paths (v3)
56+
## Export path cleanup (v3)
5757

58-
FAST Element now groups optional bindings and hydration helpers behind dedicated
59-
sub-entrypoints instead of exposing multiple nested legacy paths.
58+
Optional binding and hydration helpers remain on their dedicated public
59+
sub-entrypoints:
60+
61+
- `@microsoft/fast-element/binding/two-way.js`
62+
- `@microsoft/fast-element/binding/signal.js`
63+
- `@microsoft/fast-element/element-hydration.js`
64+
- `@microsoft/fast-element/install-element-hydration.js`
65+
- `@microsoft/fast-element/install-hydratable-view-templates.js`
6066

6167
### Removed exports
6268

6369
| Import | Replacement |
6470
|---|---|
65-
| `@microsoft/fast-element/binding/two-way.js` | `@microsoft/fast-element/binding.js` |
66-
| `@microsoft/fast-element/binding/signal.js` | `@microsoft/fast-element/binding.js` |
67-
| `@microsoft/fast-element/element-hydration.js` | `@microsoft/fast-element/hydration.js` |
68-
| `@microsoft/fast-element/install-element-hydration.js` | `@microsoft/fast-element/hydration.js` |
69-
| `@microsoft/fast-element/install-hydratable-view-templates.js` | `@microsoft/fast-element/hydration.js` |
7071
| `@microsoft/fast-element/metadata.js` | No public replacement |
7172
| `@microsoft/fast-element/pending-task.js` | No public replacement |
7273

7374
### Migration steps
7475

75-
1. Update two-way and signal imports to `@microsoft/fast-element/binding.js`.
76-
2. Update hydration utility imports to `@microsoft/fast-element/hydration.js`.
77-
3. Replace manual side-effect imports with
78-
`installElementHydration()` or `installHydratableViewTemplates()` from
79-
`@microsoft/fast-element/hydration.js` only when you need those hooks
80-
outside `@microsoft/fast-element/declarative.js`.
81-
4. Remove any direct imports from `metadata.js` or `pending-task.js`.
76+
1. Keep optional binding and hydration imports on their dedicated subpaths.
77+
2. Remove any direct imports from `metadata.js` or `pending-task.js`.
8278

8379
## Prerendered Content Optimization (v2 → v3)
8480

@@ -97,10 +93,9 @@ sub-entrypoints instead of exposing multiple nested legacy paths.
9793
|---|---|
9894
| `@microsoft/fast-element/install-hydration.js` | No replacement needed — prerendered path is built into `ElementController` |
9995

100-
Hydratable `ViewTemplate` support is still applied automatically by
101-
`@microsoft/fast-element/declarative.js`. For manual installation, import
102-
`installHydratableViewTemplates()` from
103-
`@microsoft/fast-element/hydration.js`.
96+
The `install-hydratable-view-templates.js` side-effect import is still
97+
available and is applied automatically by
98+
`@microsoft/fast-element/declarative.js` for hydration marker support.
10499

105100
### Changed behavior
106101

packages/fast-element/README.md

Lines changed: 4 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -65,24 +65,17 @@ importing `@microsoft/fast-element`.
6565

6666
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.
6767

68-
## Focused Entry Points
68+
## Dedicated Entry Points
6969

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

7373
```ts
74-
import { twoWay } from "@microsoft/fast-element/binding.js";
75-
import {
76-
HydrationMarkup,
77-
installHydratableViewTemplates,
78-
} from "@microsoft/fast-element/hydration.js";
74+
import { twoWay } from "@microsoft/fast-element/binding/two-way.js";
75+
import { HydrationMarkup } from "@microsoft/fast-element/element-hydration.js";
76+
import "@microsoft/fast-element/install-hydratable-view-templates.js";
7977
```
8078

81-
`binding.js` groups the optional binding helpers (`twoWay`, `signal`,
82-
`Signal`, and related types) behind a single public path. `hydration.js`
83-
groups the low-level hydration utilities and the manual install hooks used
84-
outside `declarative.js`.
85-
8679
`@microsoft/fast-element/declarative.js` still installs hydratable
8780
`ViewTemplate` support automatically. The legacy `metadata.js` and
8881
`pending-task.js` subpaths are no longer part of the public export map.

packages/fast-element/SIZES.md

Lines changed: 13 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -4,17 +4,17 @@ Bundle sizes for `@microsoft/fast-element` exports.
44

55
| Export | Minified | Gzip | Brotli |
66
|--------|----------|------|--------|
7-
| CDN Rollup Bundle | 63.16 KB | 18.83 KB | 16.88 KB |
8-
| FASTElement | 23.03 KB | 7.22 KB | 6.50 KB |
9-
| Updates | 3.18 KB | 1.32 KB | 1.10 KB |
10-
| Observable | 7.69 KB | 2.83 KB | 2.52 KB |
11-
| observable | 7.73 KB | 2.85 KB | 2.53 KB |
12-
| attr | 933 B | 481 B | 417 B |
13-
| children | 5.72 KB | 2.17 KB | 1.92 KB |
14-
| css | 1.99 KB | 919 B | 819 B |
15-
| ref | 4.69 KB | 1.85 KB | 1.62 KB |
16-
| slotted | 5.51 KB | 2.11 KB | 1.85 KB |
17-
| volatile | 7.78 KB | 2.87 KB | 2.54 KB |
7+
| CDN Rollup Bundle | 63.06 KB | 18.80 KB | 16.88 KB |
8+
| FASTElement | 23.30 KB | 7.32 KB | 6.60 KB |
9+
| Updates | 3.45 KB | 1.43 KB | 1.21 KB |
10+
| Observable | 7.96 KB | 2.94 KB | 2.62 KB |
11+
| observable | 8.00 KB | 2.95 KB | 2.62 KB |
12+
| attr | 3.39 KB | 1.37 KB | 1.13 KB |
13+
| children | 5.99 KB | 2.29 KB | 2.01 KB |
14+
| css | 4.47 KB | 1.78 KB | 1.54 KB |
15+
| ref | 4.96 KB | 1.96 KB | 1.71 KB |
16+
| slotted | 5.78 KB | 2.22 KB | 1.95 KB |
17+
| volatile | 8.05 KB | 2.97 KB | 2.63 KB |
1818
| when | 2.40 KB | 978 B | 786 B |
19-
| html | 26.97 KB | 8.80 KB | 7.89 KB |
20-
| repeat | 30.52 KB | 9.71 KB | 8.72 KB |
19+
| html | 27.14 KB | 8.88 KB | 7.96 KB |
20+
| repeat | 30.79 KB | 9.81 KB | 8.82 KB |

packages/fast-element/package.json

Lines changed: 24 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -40,9 +40,13 @@
4040
"test": "./src/declarative/utilities.ts",
4141
"default": "./dist/esm/declarative/utilities.js"
4242
},
43-
"./binding.js": {
44-
"types": "./dist/dts/binding/exports.d.ts",
45-
"default": "./dist/esm/binding/exports.js"
43+
"./binding/two-way.js": {
44+
"types": "./dist/dts/binding/two-way.d.ts",
45+
"default": "./dist/esm/binding/two-way.js"
46+
},
47+
"./binding/signal.js": {
48+
"types": "./dist/dts/binding/signal.d.ts",
49+
"default": "./dist/esm/binding/signal.js"
4650
},
4751
"./render.js": {
4852
"types": "./dist/dts/templating/render.d.ts",
@@ -68,9 +72,17 @@
6872
"types": "./dist/dts/di/di.d.ts",
6973
"default": "./dist/esm/di/di.js"
7074
},
71-
"./hydration.js": {
72-
"types": "./dist/dts/hydration/exports.d.ts",
73-
"default": "./dist/esm/hydration/exports.js"
75+
"./element-hydration.js": {
76+
"types": "./dist/dts/components/hydration.d.ts",
77+
"default": "./dist/esm/components/hydration.js"
78+
},
79+
"./install-element-hydration.js": {
80+
"types": "./dist/dts/components/install-hydration.d.ts",
81+
"default": "./dist/esm/components/install-hydration.js"
82+
},
83+
"./install-hydratable-view-templates.js": {
84+
"types": "./dist/dts/templating/install-hydratable-view-templates.d.ts",
85+
"default": "./dist/esm/templating/install-hydratable-view-templates.js"
7486
},
7587
"./dom-policy.js": {
7688
"types": "./dist/dts/dom-policy.d.ts",
@@ -84,7 +96,12 @@
8496
},
8597
"unpkg": "dist/fast-element.min.js",
8698
"sideEffects": [
87-
"./dist/esm/debug.js"
99+
"./dist/esm/debug.js",
100+
"./dist/esm/declarative.js",
101+
"./dist/esm/polyfills.js",
102+
"./dist/esm/components/install-hydration.js",
103+
"./dist/esm/templating/install-hydratable-view-templates.js",
104+
"./dist/esm/interfaces.js"
88105
],
89106
"scripts": {
90107
"clean": "clean dist temp test-results",

packages/fast-element/src/binding/exports.ts

Lines changed: 0 additions & 12 deletions
This file was deleted.

0 commit comments

Comments
 (0)