Skip to content

Commit 2cff100

Browse files
janechuCopilot
andcommitted
Flatten fast-element export subpaths
Keep the public fast-element export paths flat while resolving package export types, test, and default targets to the original source and output locations. Also address review feedback by preserving explicit declarative schemas and avoiding shell-string API doc generation. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
1 parent 855033c commit 2cff100

403 files changed

Lines changed: 6960 additions & 2393 deletions

File tree

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

.github/skills/typescript/SKILL.md

Lines changed: 4 additions & 4 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/two-way.js";
21+
import { twoWay } from "@microsoft/fast-element/two-way.js";
2222
import { reactive } from "@microsoft/fast-element/state.js";
2323
import { composedParent } from "@microsoft/fast-element/utilities.js";
2424
```
@@ -67,8 +67,8 @@ Templates use the `html` tagged template literal typed to the element class:
6767

6868
```ts
6969
import { html } from "@microsoft/fast-element/html.js";
70-
import { repeat } from "@microsoft/fast-element/directives/repeat.js";
71-
import { when } from "@microsoft/fast-element/directives/when.js";
70+
import { repeat } from "@microsoft/fast-element/repeat.js";
71+
import { when } from "@microsoft/fast-element/when.js";
7272
import type { MyElement } from "./my-element.js";
7373

7474
export const template = html<MyElement>`
@@ -97,7 +97,7 @@ export const template = html<MyElement>`
9797
Two-way bindings require a sub-entry-point import:
9898

9999
```ts
100-
import { twoWay } from "@microsoft/fast-element/binding/two-way.js";
100+
import { twoWay } from "@microsoft/fast-element/two-way.js";
101101
```
102102

103103
### Partial HTML

change/@microsoft-fast-element-22265526-9ae0-4996-878d-ec0bd68133c2.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"type": "major",
3-
"comment": "Move optional helpers such as Updates, Observable, attr, binding, DOM, Schema, html, templating, render, hydration, directives, volatile, and ArrayObserver to dedicated fast-element subpath exports while keeping controller and definition internals on the root entrypoint.",
3+
"comment": "Move optional helpers to dedicated flat fast-element subpath exports such as @microsoft/fast-element/children.js, @microsoft/fast-element/repeat.js, @microsoft/fast-element/two-way.js, @microsoft/fast-element/signal.js, @microsoft/fast-element/attribute-map.js, and @microsoft/fast-element/observer-map.js while keeping controller and definition internals on the root entrypoint.",
44
"packageName": "@microsoft/fast-element",
55
"email": "7559015+janechu@users.noreply.github.com",
66
"dependentChangeType": "none"

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

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
1-
import { twoWay } from "@microsoft/fast-element/binding/two-way.js";
2-
import { repeat } from "@microsoft/fast-element/directives/repeat.js";
31
import { html } from "@microsoft/fast-element/html.js";
2+
import { repeat } from "@microsoft/fast-element/repeat.js";
3+
import { twoWay } from "@microsoft/fast-element/two-way.js";
44
import type { TodoApp } from "./todo-app.js";
55
import type { Todo } from "./todo-list.js";
66
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 @@
1-
import { twoWay } from "@microsoft/fast-element/binding/two-way.js";
21
import { html } from "@microsoft/fast-element/html.js";
2+
import { twoWay } from "@microsoft/fast-element/two-way.js";
33
import type { TodoForm } from "./todo-form.js";
44

55
export const template = html<TodoForm>`

packages/fast-element/DECLARATIVE_DESIGN.md

Lines changed: 14 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -3,8 +3,8 @@
33
This document is intended for contributors who want to understand the internal
44
architecture of the declarative runtime in
55
`@microsoft/fast-element/declarative.js` and the schema-driven map extensions in
6-
`@microsoft/fast-element/extensions/attribute-map.js` and
7-
`@microsoft/fast-element/extensions/observer-map.js`. It covers the feature's
6+
`@microsoft/fast-element/attribute-map.js` and
7+
`@microsoft/fast-element/observer-map.js`. It covers the feature's
88
purpose, core concepts, data flow, and its integration with the rest of
99
`@microsoft/fast-element`.
1010

@@ -58,7 +58,7 @@ registry-aware declarative template bridge.
5858
|---|---|
5959
| **Server-agnostic rendering** | Templates are plain HTML strings with no dependency on Node.js or any specific SSR framework. |
6060
| **Progressive enhancement** | Components can be server-rendered and then hydrated client-side without a full re-render. |
61-
| **FAST parity** | The declarative syntax maps 1-to-1 to FAST Element directive helpers (`repeat`, `when`, `slotted`, `children`, `ref`) from their `@microsoft/fast-element/directives/*` subpaths. |
61+
| **FAST parity** | The declarative syntax maps 1-to-1 to FAST Element directive helpers (`repeat`, `when`, `slotted`, `children`, `ref`) from their flat `@microsoft/fast-element/*` subpaths. |
6262
| **Minimal authoring overhead** | Component authors write HTML, not tagged template strings, while retaining full reactive capabilities. |
6363

6464
---
@@ -119,7 +119,7 @@ An optional layer that uses the `Schema` to automatically:
119119
- Propagate deep property mutations back through FAST's observable system so bindings re-render.
120120

121121
Enabled via the `observerMap()` definition extension. Import the extension from
122-
`@microsoft/fast-element/extensions/observer-map.js`; the declarative entrypoint
122+
`@microsoft/fast-element/observer-map.js`; the declarative entrypoint
123123
does not re-export it. Calling `observerMap()` without arguments observes all
124124
root properties discovered in the template or supplied schema.
125125

@@ -167,7 +167,7 @@ For non-declarative elements, pass a schema directly to `observerMap()`:
167167
```typescript
168168
import { FASTElement } from "@microsoft/fast-element";
169169
import { Schema } from "@microsoft/fast-element/schema.js";
170-
import { observerMap } from "@microsoft/fast-element/extensions/observer-map.js";
170+
import { observerMap } from "@microsoft/fast-element/observer-map.js";
171171

172172
class MyElement extends FASTElement {}
173173

@@ -203,7 +203,7 @@ An optional layer that uses the `Schema` to automatically register `@attr`-style
203203
- `FASTElementDefinition.attributeLookup` is keyed by the HTML attribute name, and `propertyLookup` is keyed by the JS property name so `attributeChangedCallback` correctly delegates to the new `AttributeDefinition`.
204204

205205
Enabled via the `attributeMap()` definition extension. Import the extension from
206-
`@microsoft/fast-element/extensions/attribute-map.js`; the declarative entrypoint
206+
`@microsoft/fast-element/attribute-map.js`; the declarative entrypoint
207207
does not re-export it. Calling `attributeMap()` without arguments uses the
208208
default `"camelCase"` strategy. To preserve binding keys exactly as written,
209209
pass `attributeMap({ "attribute-name-strategy": "none" })`. Outside declarative
@@ -297,13 +297,13 @@ import {
297297
import {
298298
attributeMap,
299299
type AttributeMapConfig,
300-
} from "@microsoft/fast-element/extensions/attribute-map.js";
300+
} from "@microsoft/fast-element/attribute-map.js";
301301
import {
302302
observerMap,
303303
type ObserverMapConfig,
304304
type ObserverMapPathEntry,
305305
type ObserverMapPathNode,
306-
} from "@microsoft/fast-element/extensions/observer-map.js";
306+
} from "@microsoft/fast-element/observer-map.js";
307307
```
308308

309309
The declarative entrypoint does not re-export the map helpers or their
@@ -324,8 +324,8 @@ Primary map extension exports:
324324

325325
| Export | Public subpath | Purpose |
326326
|---|---|---|
327-
| `attributeMap()` | `@microsoft/fast-element/extensions/attribute-map.js` | Define extension that registers `@attr`-style properties for leaf bindings discovered during parsing or supplied by `definition.schema`. |
328-
| `observerMap()` | `@microsoft/fast-element/extensions/observer-map.js` | Define extension that defines observable root properties and proxy-based deep change tracking from `config.schema`, `definition.schema`, or a declarative template schema. |
327+
| `attributeMap()` | `@microsoft/fast-element/attribute-map.js` | Define extension that registers `@attr`-style properties for leaf bindings discovered during parsing or supplied by `definition.schema`. |
328+
| `observerMap()` | `@microsoft/fast-element/observer-map.js` | Define extension that defines observable root properties and proxy-based deep change tracking from `config.schema`, `definition.schema`, or a declarative template schema. |
329329

330330
The implementation element class (`<f-template>`), `TemplateElement.config()`,
331331
`TemplateElement.options()`, `ElementOptions*`, and
@@ -349,10 +349,10 @@ The extension subpaths export their own configuration types:
349349

350350
| Type | Public subpath | Purpose |
351351
|---|---|---|
352-
| `ObserverMapConfig` | `@microsoft/fast-element/extensions/observer-map.js` | Configuration object for `observerMap()`; accepts optional `schema` and `properties` keys. |
353-
| `ObserverMapPathEntry` | `@microsoft/fast-element/extensions/observer-map.js` | `boolean \| ObserverMapPathNode` — a node in the observation path tree. |
354-
| `ObserverMapPathNode` | `@microsoft/fast-element/extensions/observer-map.js` | Object node with optional `$observe` and child property overrides. |
355-
| `AttributeMapConfig` | `@microsoft/fast-element/extensions/attribute-map.js` | Configuration object for `attributeMap()`; accepts `attribute-name-strategy`. |
352+
| `ObserverMapConfig` | `@microsoft/fast-element/observer-map.js` | Configuration object for `observerMap()`; accepts optional `schema` and `properties` keys. |
353+
| `ObserverMapPathEntry` | `@microsoft/fast-element/observer-map.js` | `boolean \| ObserverMapPathNode` — a node in the observation path tree. |
354+
| `ObserverMapPathNode` | `@microsoft/fast-element/observer-map.js` | Object node with optional `$observe` and child property overrides. |
355+
| `AttributeMapConfig` | `@microsoft/fast-element/attribute-map.js` | Configuration object for `attributeMap()`; accepts `attribute-name-strategy`. |
356356

357357
---
358358

packages/fast-element/DECLARATIVE_HTML.md

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -36,8 +36,8 @@ installed only when `enableHydration()` is called from
3636

3737
`observerMap()` and `attributeMap()` remain available from the declarative
3838
entrypoint for existing declarative imports. New code should prefer the
39-
extension subpaths, `@microsoft/fast-element/extensions/observer-map.js` and
40-
`@microsoft/fast-element/extensions/attribute-map.js`, especially when using
39+
extension subpaths, `@microsoft/fast-element/observer-map.js` and
40+
`@microsoft/fast-element/attribute-map.js`, especially when using
4141
the maps without declarative templates.
4242

4343
Example:
@@ -142,7 +142,7 @@ For non-declarative/manual schemas, import from the extension subpath and pass
142142
`observerMap({ schema })`.
143143

144144
```typescript
145-
import { observerMap } from "@microsoft/fast-element/extensions/observer-map.js";
145+
import { observerMap } from "@microsoft/fast-element/observer-map.js";
146146
```
147147

148148
For finer control, pass a configuration object with a `properties` key that maps root property names to a recursive path tree:
@@ -199,7 +199,7 @@ Manual schema example:
199199
```typescript
200200
import { FASTElement } from "@microsoft/fast-element";
201201
import { Schema } from "@microsoft/fast-element/schema.js";
202-
import { observerMap } from "@microsoft/fast-element/extensions/observer-map.js";
202+
import { observerMap } from "@microsoft/fast-element/observer-map.js";
203203

204204
class MyElement extends FASTElement {}
205205

@@ -229,7 +229,7 @@ on the FAST element definition and import `attributeMap()` from its extension
229229
subpath.
230230

231231
```typescript
232-
import { attributeMap } from "@microsoft/fast-element/extensions/attribute-map.js";
232+
import { attributeMap } from "@microsoft/fast-element/attribute-map.js";
233233
```
234234

235235
By default, the binding key is treated as a camelCase property name and the HTML

packages/fast-element/DECLARATIVE_MIGRATION.md

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -119,8 +119,8 @@ Public declarative imports now come from
119119
`@microsoft/fast-element/declarative.js` rather than
120120
`@microsoft/fast-html`. Existing declarative imports for `attributeMap()` and
121121
`observerMap()` remain valid. New code that only needs the map extensions should
122-
prefer `@microsoft/fast-element/extensions/attribute-map.js` and
123-
`@microsoft/fast-element/extensions/observer-map.js`.
122+
prefer `@microsoft/fast-element/attribute-map.js` and
123+
`@microsoft/fast-element/observer-map.js`.
124124

125125
### Schema changes
126126

@@ -184,8 +184,8 @@ factored away from declarative templating. Prefer importing them from their
184184
dedicated subpaths for tree-shaken or non-declarative use:
185185

186186
```ts
187-
import { attributeMap } from "@microsoft/fast-element/extensions/attribute-map.js";
188-
import { observerMap } from "@microsoft/fast-element/extensions/observer-map.js";
187+
import { attributeMap } from "@microsoft/fast-element/attribute-map.js";
188+
import { observerMap } from "@microsoft/fast-element/observer-map.js";
189189
```
190190

191191
`FASTElementDefinition.schema` is optional. `declarativeTemplate()` assigns it
@@ -196,7 +196,7 @@ directly in configuration:
196196
```ts
197197
import { FASTElement } from "@microsoft/fast-element";
198198
import { Schema } from "@microsoft/fast-element/schema.js";
199-
import { observerMap } from "@microsoft/fast-element/extensions/observer-map.js";
199+
import { observerMap } from "@microsoft/fast-element/observer-map.js";
200200

201201
class MyElement extends FASTElement {}
202202

packages/fast-element/DECLARATIVE_SCHEMA_OBSERVER_MAP.md

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,7 @@ The Schema and Observer Map architecture enables automatic observation of comple
3030
- **Schema Class**: Generates JSON schemas that describe the structure and binding paths of data objects based on template analysis or manually registered paths
3131
- **Observer Map Class**: Uses the schema information to automatically define observable properties and create proxies for nested object observation
3232
- **f-template Integration**: Template processing automatically populates schemas and configures observer maps during template compilation
33-
- **Extension Subpaths**: `@microsoft/fast-element/extensions/observer-map.js` and `@microsoft/fast-element/extensions/attribute-map.js` expose the map helpers independently from declarative templating
33+
- **Extension Subpaths**: `@microsoft/fast-element/observer-map.js` and `@microsoft/fast-element/attribute-map.js` expose the map helpers independently from declarative templating
3434

3535
### Supported Data Types
3636

@@ -167,7 +167,7 @@ entrypoint continues to re-export `observerMap()` for existing declarative code:
167167

168168
```typescript
169169
import { declarativeTemplate } from "@microsoft/fast-element/declarative.js";
170-
import { observerMap } from "@microsoft/fast-element/extensions/observer-map.js";
170+
import { observerMap } from "@microsoft/fast-element/observer-map.js";
171171

172172
MyElement.define(
173173
{
@@ -188,7 +188,7 @@ configuration:
188188
```typescript
189189
import { FASTElement } from "@microsoft/fast-element";
190190
import { Schema } from "@microsoft/fast-element/schema.js";
191-
import { observerMap } from "@microsoft/fast-element/extensions/observer-map.js";
191+
import { observerMap } from "@microsoft/fast-element/observer-map.js";
192192

193193
class MyElement extends FASTElement {}
194194

packages/fast-element/DESIGN.md

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -43,7 +43,7 @@ For deep dives into specific areas, see the linked detailed documents.
4343
| Reactive data binding | `Observable`, `ExpressionNotifier`, `oneWay`/`oneTime`/`listener` bindings |
4444
| Declarative templating | `html` tagged template literal → `ViewTemplate` → compiled `HTMLView` |
4545
| Declarative HTML runtime | `@microsoft/fast-element/declarative.js``declarativeTemplate()`, `TemplateParser`, `Schema` |
46-
| Schema-driven extensions | `@microsoft/fast-element/extensions/attribute-map.js` and `@microsoft/fast-element/extensions/observer-map.js` → tree-shakeable map helpers usable with declarative or manually supplied schemas |
46+
| Schema-driven extensions | `@microsoft/fast-element/attribute-map.js` and `@microsoft/fast-element/observer-map.js` → tree-shakeable map helpers usable with declarative or manually supplied schemas |
4747
| Async DOM updates | `Updates` queue (batched, `requestAnimationFrame`-aligned) |
4848
| Scoped styles | `css` tagged template literal → `ElementStyles``adoptedStylesheets` / `<style>` |
4949
| Dependency injection | `DI` container, `@inject`, `@singleton`, `@transient`, resolvers |
@@ -333,8 +333,8 @@ FAST Element also owns the declarative HTML runtime that previously lived in a
333333
separate package. The dedicated `@microsoft/fast-element/declarative.js`
334334
entrypoint exports the declarative runtime API: `declarativeTemplate()`,
335335
`TemplateParser`, `Schema`, `schemaRegistry`, and related parser/schema types.
336-
Import map helpers from `@microsoft/fast-element/extensions/attribute-map.js`
337-
and `@microsoft/fast-element/extensions/observer-map.js`. These subpaths keep
336+
Import map helpers from `@microsoft/fast-element/attribute-map.js`
337+
and `@microsoft/fast-element/observer-map.js`. These subpaths keep
338338
the schema-driven map extensions factored away from declarative templating so
339339
they can also be used with manually supplied schemas. The `<f-template>` element
340340
is an internal native `HTMLElement` publisher that `declarativeTemplate()`

packages/fast-element/MIGRATION.md

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -46,7 +46,7 @@ removed `@microsoft/fast-html` package.
4646
| Before | After |
4747
|---|---|
4848
| `@microsoft/fast-html` | `@microsoft/fast-element/declarative.js` |
49-
| `@microsoft/fast-html/utilities.js` | `@microsoft/fast-element/declarative/utilities.js` |
49+
| `@microsoft/fast-html/utilities.js` | `@microsoft/fast-element/declarative-utilities.js` |
5050

5151
Core FAST Element helpers now use dedicated subpaths:
5252

@@ -65,19 +65,19 @@ Core FAST Element helpers now use dedicated subpaths:
6565
| `enableHydration`, `HydrationTracker`, hydration types | `@microsoft/fast-element/hydration.js` |
6666
| `ArrayObserver` | `@microsoft/fast-element/array-observer.js` |
6767
| `volatile` | `@microsoft/fast-element/volatile.js` |
68-
| `children` | `@microsoft/fast-element/directives/children.js` |
69-
| `elements`, `NodeObservationDirective` | `@microsoft/fast-element/directives/node-observation.js` |
70-
| `ref` | `@microsoft/fast-element/directives/ref.js` |
71-
| `slotted` | `@microsoft/fast-element/directives/slotted.js` |
72-
| `when` | `@microsoft/fast-element/directives/when.js` |
73-
| `repeat` | `@microsoft/fast-element/directives/repeat.js` |
68+
| `children` | `@microsoft/fast-element/children.js` |
69+
| `elements`, `NodeObservationDirective` | `@microsoft/fast-element/node-observation.js` |
70+
| `ref` | `@microsoft/fast-element/ref.js` |
71+
| `slotted` | `@microsoft/fast-element/slotted.js` |
72+
| `when` | `@microsoft/fast-element/when.js` |
73+
| `repeat` | `@microsoft/fast-element/repeat.js` |
7474

7575
### Migration steps
7676

7777
1. Update declarative runtime imports to
7878
`@microsoft/fast-element/declarative.js`.
7979
2. Update declarative utility imports such as `deepMerge` to
80-
`@microsoft/fast-element/declarative/utilities.js`.
80+
`@microsoft/fast-element/declarative-utilities.js`.
8181
3. Keep importing root FAST Element APIs such as `FASTElement`, `FAST`,
8282
`ElementController`, and definition/controller types from
8383
`@microsoft/fast-element`, and import moved helpers from their dedicated
@@ -153,8 +153,8 @@ Core FAST Element helpers now use dedicated subpaths:
153153

154154
```typescript
155155
import { declarativeTemplate } from "@microsoft/fast-element/declarative.js";
156-
import { attributeMap } from "@microsoft/fast-element/extensions/attribute-map.js";
157-
import { observerMap } from "@microsoft/fast-element/extensions/observer-map.js";
156+
import { attributeMap } from "@microsoft/fast-element/attribute-map.js";
157+
import { observerMap } from "@microsoft/fast-element/observer-map.js";
158158

159159
MyElement.define(
160160
{

0 commit comments

Comments
 (0)