@microsoft/fast-element 3.0.0-rc.1 → 3.0.0-rc.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +51 -1
- package/README.md +50 -14
- package/dist/context/context.api.json +13 -13
- package/dist/declarative/declarative.api.json +654 -15
- package/dist/di/di.api.json +15 -15
- package/dist/dts/__test__/helpers.d.ts +6 -0
- package/dist/dts/__test__/setup-node.d.ts +0 -0
- package/dist/dts/binding/binding.d.ts +15 -5
- package/dist/dts/binding/one-time.d.ts +1 -1
- package/dist/dts/binding/one-way.d.ts +1 -1
- package/dist/dts/binding/signal.d.ts +1 -1
- package/dist/dts/binding/two-way.d.ts +1 -1
- package/dist/dts/components/attributes.d.ts +1 -1
- package/dist/dts/components/enable-hydration.d.ts +22 -2
- package/dist/dts/components/fast-definitions.d.ts +7 -4
- package/dist/dts/components/fast-element.d.ts +42 -12
- package/dist/dts/components/hydration-tracker.d.ts +47 -4
- package/dist/dts/components/hydration.d.ts +5 -0
- package/dist/dts/context.d.ts +7 -7
- package/dist/dts/declarative/debug.d.ts +2 -3
- package/dist/dts/declarative/index.d.ts +3 -2
- package/dist/dts/declarative/interfaces.d.ts +1 -2
- package/dist/dts/declarative/template.d.ts +2 -1
- package/dist/dts/declarative/utilities.d.ts +50 -4
- package/dist/dts/di/di.d.ts +6 -6
- package/dist/dts/dom-policy.d.ts +22 -4
- package/dist/dts/dom.d.ts +4 -16
- package/dist/dts/hydration/diagnostics.d.ts +93 -0
- package/dist/dts/hydration/hydration-debugger.d.ts +35 -0
- package/dist/dts/hydration/messages.d.ts +62 -0
- package/dist/dts/hydration/target-builder.d.ts +26 -1
- package/dist/dts/hydration.d.ts +7 -3
- package/dist/dts/index.d.ts +7 -3
- package/dist/dts/interfaces.d.ts +1 -0
- package/dist/dts/observation/observable.d.ts +3 -3
- package/dist/dts/platform.d.ts +20 -4
- package/dist/dts/registry.d.ts +1 -0
- package/dist/dts/templating/children.d.ts +1 -1
- package/dist/dts/templating/compiler.d.ts +1 -1
- package/dist/dts/templating/html-binding-directive.d.ts +6 -2
- package/dist/dts/templating/html-directive.d.ts +2 -1
- package/dist/dts/templating/hydration-view.d.ts +24 -3
- package/dist/dts/templating/ref.d.ts +1 -1
- package/dist/dts/templating/render.d.ts +2 -2
- package/dist/dts/templating/repeat.d.ts +1 -1
- package/dist/dts/templating/slotted.d.ts +1 -1
- package/dist/dts/templating/template.d.ts +5 -5
- package/dist/dts/templating/when.d.ts +1 -1
- package/dist/dts/testing/fakes.d.ts +4 -4
- package/dist/esm/__test__/helpers.js +22 -0
- package/dist/esm/__test__/setup-node.js +18 -0
- package/dist/esm/binding/two-way.js +1 -2
- package/dist/esm/components/attributes.js +12 -8
- package/dist/esm/components/element-controller.js +11 -6
- package/dist/esm/components/enable-hydration.js +27 -3
- package/dist/esm/components/fast-definitions.js +19 -18
- package/dist/esm/components/hydration-tracker.js +34 -5
- package/dist/esm/components/hydration.js +85 -6
- package/dist/esm/debug.js +1 -0
- package/dist/esm/declarative/attribute-map.js +2 -1
- package/dist/esm/declarative/debug.js +0 -1
- package/dist/esm/declarative/index.js +1 -0
- package/dist/esm/declarative/interfaces.js +0 -1
- package/dist/esm/declarative/observer-map-utilities.js +58 -55
- package/dist/esm/declarative/template-bridge.js +4 -14
- package/dist/esm/declarative/template.js +4 -3
- package/dist/esm/declarative/utilities.js +236 -1
- package/dist/esm/di/di.js +2 -1
- package/dist/esm/dom-policy.js +33 -4
- package/dist/esm/hydration/diagnostics.js +50 -0
- package/dist/esm/hydration/hydration-debugger.js +112 -0
- package/dist/esm/hydration/messages.js +84 -0
- package/dist/esm/hydration/target-builder.js +65 -19
- package/dist/esm/hydration.js +3 -1
- package/dist/esm/index.js +6 -2
- package/dist/esm/interfaces.js +1 -0
- package/dist/esm/metadata.js +2 -8
- package/dist/esm/observation/notifier.js +2 -4
- package/dist/esm/registry.js +1 -0
- package/dist/esm/templating/html-binding-directive.js +1 -1
- package/dist/esm/templating/hydration-view.js +20 -27
- package/dist/esm/templating/render.js +39 -18
- package/dist/esm/templating/repeat.js +51 -17
- package/dist/esm/templating/view.js +1 -1
- package/dist/esm/testing/fixture.js +2 -2
- package/dist/esm/testing/timeout.js +2 -2
- package/dist/fast-element.api.json +1329 -99
- package/dist/fast-element.d.ts +147 -66
- package/dist/fast-element.debug.js +392 -99
- package/dist/fast-element.debug.min.js +2 -2
- package/dist/fast-element.js +392 -99
- package/dist/fast-element.min.js +2 -2
- package/dist/fast-element.untrimmed.d.ts +133 -70
- package/dist/hydration/hydration.api.json +1280 -57
- package/dist/styles/styles.api.json +1 -1
- package/package.json +21 -9
- package/ARCHITECTURE_FASTELEMENT.md +0 -63
- package/ARCHITECTURE_HTML_TAGGED_TEMPLATE_LITERAL.md +0 -36
- package/ARCHITECTURE_INTRO.md +0 -10
- package/ARCHITECTURE_OVERVIEW.md +0 -52
- package/ARCHITECTURE_UPDATES.md +0 -11
- package/CHANGELOG.json +0 -2275
- package/DECLARATIVE_DESIGN.md +0 -806
- package/DECLARATIVE_HTML.md +0 -470
- package/DECLARATIVE_MIGRATION.md +0 -215
- package/DECLARATIVE_RENDERING.md +0 -530
- package/DECLARATIVE_RENDERING_LIFECYCLE.md +0 -288
- package/DECLARATIVE_SCHEMA_OBSERVER_MAP.md +0 -489
- package/DESIGN.md +0 -615
- package/MIGRATION.md +0 -387
- package/SIZES.md +0 -25
- package/api-extractor.arrays.json +0 -15
- package/api-extractor.context.json +0 -15
- package/api-extractor.declarative.json +0 -15
- package/api-extractor.di.json +0 -15
- package/api-extractor.hydration.json +0 -15
- package/api-extractor.styles.json +0 -15
- package/biome.json +0 -4
- package/docs/ACKNOWLEDGEMENTS.md +0 -12
- package/docs/api-report.api.md +0 -1299
- package/docs/arrays/api-report.api.md +0 -114
- package/docs/context/api-report.api.md +0 -69
- package/docs/declarative/api-report.api.md +0 -397
- package/docs/di/api-report.api.md +0 -315
- package/docs/fast-element-2-changes.md +0 -15
- package/docs/hydration/api-report.api.md +0 -285
- package/docs/styles/api-report.api.md +0 -135
- package/playwright.config.ts +0 -26
- package/playwright.declarative.config.ts +0 -26
- package/playwright.declarative.webui.config.ts +0 -20
- package/scripts/declarative/build-fixtures-with-webui.js +0 -135
- package/scripts/declarative/build-fixtures.js +0 -49
- package/scripts/declarative/build-fixtures.utilities.js +0 -101
- package/scripts/measure-sizes.js +0 -219
- package/scripts/run-api-extractor.js +0 -70
- package/test/declarative/fixtures/README.md +0 -72
- package/test/declarative/fixtures/WRITING_FIXTURES.md +0 -330
- package/test/declarative/fixtures/bindings/README.md +0 -12
- package/test/declarative/fixtures/bindings/attribute/entry.html +0 -13
- package/test/declarative/fixtures/bindings/attribute/fast-build.config.json +0 -6
- package/test/declarative/fixtures/bindings/attribute/index.html +0 -25
- package/test/declarative/fixtures/bindings/attribute/main.ts +0 -41
- package/test/declarative/fixtures/bindings/attribute/state.json +0 -8
- package/test/declarative/fixtures/bindings/attribute/templates.html +0 -11
- package/test/declarative/fixtures/bindings/content/entry.html +0 -12
- package/test/declarative/fixtures/bindings/content/fast-build.config.json +0 -6
- package/test/declarative/fixtures/bindings/content/index.html +0 -19
- package/test/declarative/fixtures/bindings/content/main.ts +0 -27
- package/test/declarative/fixtures/bindings/content/state.json +0 -4
- package/test/declarative/fixtures/bindings/content/templates.html +0 -6
- package/test/declarative/fixtures/bindings/dot-syntax/entry.html +0 -11
- package/test/declarative/fixtures/bindings/dot-syntax/fast-build.config.json +0 -6
- package/test/declarative/fixtures/bindings/dot-syntax/index.html +0 -47
- package/test/declarative/fixtures/bindings/dot-syntax/main.ts +0 -59
- package/test/declarative/fixtures/bindings/dot-syntax/state.json +0 -16
- package/test/declarative/fixtures/bindings/dot-syntax/templates.html +0 -17
- package/test/declarative/fixtures/bindings/event/entry.html +0 -11
- package/test/declarative/fixtures/bindings/event/fast-build.config.json +0 -6
- package/test/declarative/fixtures/bindings/event/index.html +0 -43
- package/test/declarative/fixtures/bindings/event/main.ts +0 -43
- package/test/declarative/fixtures/bindings/event/state.json +0 -3
- package/test/declarative/fixtures/bindings/event/templates.html +0 -18
- package/test/declarative/fixtures/bindings/host/entry.html +0 -40
- package/test/declarative/fixtures/bindings/host/fast-build.config.json +0 -6
- package/test/declarative/fixtures/bindings/host/index.html +0 -96
- package/test/declarative/fixtures/bindings/host/main.ts +0 -222
- package/test/declarative/fixtures/bindings/host/state.json +0 -9
- package/test/declarative/fixtures/bindings/host/templates.html +0 -55
- package/test/declarative/fixtures/directives/README.md +0 -12
- package/test/declarative/fixtures/directives/children/entry.html +0 -11
- package/test/declarative/fixtures/directives/children/fast-build.config.json +0 -6
- package/test/declarative/fixtures/directives/children/index.html +0 -15
- package/test/declarative/fixtures/directives/children/main.ts +0 -22
- package/test/declarative/fixtures/directives/children/state.json +0 -3
- package/test/declarative/fixtures/directives/children/templates.html +0 -3
- package/test/declarative/fixtures/directives/ref/entry.html +0 -11
- package/test/declarative/fixtures/directives/ref/fast-build.config.json +0 -6
- package/test/declarative/fixtures/directives/ref/index.html +0 -15
- package/test/declarative/fixtures/directives/ref/main.ts +0 -17
- package/test/declarative/fixtures/directives/ref/state.json +0 -1
- package/test/declarative/fixtures/directives/ref/templates.html +0 -3
- package/test/declarative/fixtures/directives/repeat/entry.html +0 -21
- package/test/declarative/fixtures/directives/repeat/fast-build.config.json +0 -6
- package/test/declarative/fixtures/directives/repeat/index.html +0 -133
- package/test/declarative/fixtures/directives/repeat/main.ts +0 -110
- package/test/declarative/fixtures/directives/repeat/sprites.svg +0 -8
- package/test/declarative/fixtures/directives/repeat/state.json +0 -10
- package/test/declarative/fixtures/directives/repeat/templates.html +0 -75
- package/test/declarative/fixtures/directives/slotted/entry.html +0 -17
- package/test/declarative/fixtures/directives/slotted/fast-build.config.json +0 -6
- package/test/declarative/fixtures/directives/slotted/index.html +0 -27
- package/test/declarative/fixtures/directives/slotted/main.ts +0 -29
- package/test/declarative/fixtures/directives/slotted/state.json +0 -1
- package/test/declarative/fixtures/directives/slotted/templates.html +0 -7
- package/test/declarative/fixtures/directives/when/entry.html +0 -51
- package/test/declarative/fixtures/directives/when/fast-build.config.json +0 -6
- package/test/declarative/fixtures/directives/when/index.html +0 -136
- package/test/declarative/fixtures/directives/when/main.ts +0 -172
- package/test/declarative/fixtures/directives/when/state.json +0 -12
- package/test/declarative/fixtures/directives/when/templates.html +0 -75
- package/test/declarative/fixtures/ecosystem/README.md +0 -11
- package/test/declarative/fixtures/ecosystem/declarative-no-hydration/entry.html +0 -12
- package/test/declarative/fixtures/ecosystem/declarative-no-hydration/fast-build.config.json +0 -6
- package/test/declarative/fixtures/ecosystem/declarative-no-hydration/index.html +0 -20
- package/test/declarative/fixtures/ecosystem/declarative-no-hydration/main.ts +0 -68
- package/test/declarative/fixtures/ecosystem/declarative-no-hydration/state.json +0 -4
- package/test/declarative/fixtures/ecosystem/declarative-no-hydration/templates.html +0 -7
- package/test/declarative/fixtures/ecosystem/errors/entry.html +0 -12
- package/test/declarative/fixtures/ecosystem/errors/fast-build.config.json +0 -6
- package/test/declarative/fixtures/ecosystem/errors/index.html +0 -20
- package/test/declarative/fixtures/ecosystem/errors/main.ts +0 -17
- package/test/declarative/fixtures/ecosystem/errors/state.json +0 -1
- package/test/declarative/fixtures/ecosystem/errors/templates.html +0 -7
- package/test/declarative/fixtures/ecosystem/lifecycle-callbacks/entry.html +0 -17
- package/test/declarative/fixtures/ecosystem/lifecycle-callbacks/fast-build.config.json +0 -6
- package/test/declarative/fixtures/ecosystem/lifecycle-callbacks/index.html +0 -56
- package/test/declarative/fixtures/ecosystem/lifecycle-callbacks/main.ts +0 -134
- package/test/declarative/fixtures/ecosystem/lifecycle-callbacks/state.json +0 -12
- package/test/declarative/fixtures/ecosystem/lifecycle-callbacks/templates.html +0 -34
- package/test/declarative/fixtures/ecosystem/performance-metrics/entry.html +0 -25
- package/test/declarative/fixtures/ecosystem/performance-metrics/fast-build.config.json +0 -6
- package/test/declarative/fixtures/ecosystem/performance-metrics/fast-card.css +0 -10
- package/test/declarative/fixtures/ecosystem/performance-metrics/index.html +0 -181
- package/test/declarative/fixtures/ecosystem/performance-metrics/main.ts +0 -58
- package/test/declarative/fixtures/ecosystem/performance-metrics/state.json +0 -6
- package/test/declarative/fixtures/ecosystem/performance-metrics/templates.html +0 -15
- package/test/declarative/fixtures/extensions/README.md +0 -15
- package/test/declarative/fixtures/extensions/attribute-map/entry.html +0 -14
- package/test/declarative/fixtures/extensions/attribute-map/fast-build.config.json +0 -6
- package/test/declarative/fixtures/extensions/attribute-map/index.html +0 -31
- package/test/declarative/fixtures/extensions/attribute-map/main.ts +0 -40
- package/test/declarative/fixtures/extensions/attribute-map/state.json +0 -4
- package/test/declarative/fixtures/extensions/attribute-map/templates.html +0 -14
- package/test/declarative/fixtures/extensions/attribute-map-naming-strategy/entry.html +0 -12
- package/test/declarative/fixtures/extensions/attribute-map-naming-strategy/fast-build.config.json +0 -7
- package/test/declarative/fixtures/extensions/attribute-map-naming-strategy/index.html +0 -25
- package/test/declarative/fixtures/extensions/attribute-map-naming-strategy/main.ts +0 -31
- package/test/declarative/fixtures/extensions/attribute-map-naming-strategy/state.json +0 -5
- package/test/declarative/fixtures/extensions/attribute-map-naming-strategy/templates.html +0 -11
- package/test/declarative/fixtures/extensions/attribute-map-naming-strategy-camel-case/entry.html +0 -13
- package/test/declarative/fixtures/extensions/attribute-map-naming-strategy-camel-case/fast-build.config.json +0 -7
- package/test/declarative/fixtures/extensions/attribute-map-naming-strategy-camel-case/index.html +0 -23
- package/test/declarative/fixtures/extensions/attribute-map-naming-strategy-camel-case/main.ts +0 -37
- package/test/declarative/fixtures/extensions/attribute-map-naming-strategy-camel-case/state.json +0 -1
- package/test/declarative/fixtures/extensions/attribute-map-naming-strategy-camel-case/templates.html +0 -9
- package/test/declarative/fixtures/extensions/observer-map/entry.html +0 -15
- package/test/declarative/fixtures/extensions/observer-map/fast-build.config.json +0 -6
- package/test/declarative/fixtures/extensions/observer-map/index.html +0 -442
- package/test/declarative/fixtures/extensions/observer-map/main.ts +0 -482
- package/test/declarative/fixtures/extensions/observer-map/state.json +0 -158
- package/test/declarative/fixtures/extensions/observer-map/templates.html +0 -172
- package/test/declarative/fixtures/extensions/observer-map-config-object/entry.html +0 -16
- package/test/declarative/fixtures/extensions/observer-map-config-object/fast-build.config.json +0 -6
- package/test/declarative/fixtures/extensions/observer-map-config-object/index.html +0 -27
- package/test/declarative/fixtures/extensions/observer-map-config-object/main.ts +0 -53
- package/test/declarative/fixtures/extensions/observer-map-config-object/state.json +0 -9
- package/test/declarative/fixtures/extensions/observer-map-config-object/templates.html +0 -12
- package/test/declarative/fixtures/extensions/observer-map-deep-merge/README.md +0 -98
- package/test/declarative/fixtures/extensions/observer-map-deep-merge/entry.html +0 -156
- package/test/declarative/fixtures/extensions/observer-map-deep-merge/fast-build.config.json +0 -6
- package/test/declarative/fixtures/extensions/observer-map-deep-merge/index.html +0 -376
- package/test/declarative/fixtures/extensions/observer-map-deep-merge/main.ts +0 -366
- package/test/declarative/fixtures/extensions/observer-map-deep-merge/state.json +0 -69
- package/test/declarative/fixtures/extensions/observer-map-deep-merge/templates.html +0 -91
- package/test/declarative/fixtures/extensions/observer-map-properties/entry.html +0 -14
- package/test/declarative/fixtures/extensions/observer-map-properties/fast-build.config.json +0 -6
- package/test/declarative/fixtures/extensions/observer-map-properties/index.html +0 -110
- package/test/declarative/fixtures/extensions/observer-map-properties/main.ts +0 -175
- package/test/declarative/fixtures/extensions/observer-map-properties/state.json +0 -29
- package/test/declarative/fixtures/extensions/observer-map-properties/templates.html +0 -55
- package/test/declarative/fixtures/scenarios/README.md +0 -7
- package/test/declarative/fixtures/scenarios/nested-elements/entry.html +0 -16
- package/test/declarative/fixtures/scenarios/nested-elements/fast-build.config.json +0 -6
- package/test/declarative/fixtures/scenarios/nested-elements/index.html +0 -126
- package/test/declarative/fixtures/scenarios/nested-elements/main.ts +0 -214
- package/test/declarative/fixtures/scenarios/nested-elements/state.json +0 -10
- package/test/declarative/fixtures/scenarios/nested-elements/templates.html +0 -54
- package/test/declarative/index.html +0 -12
- package/test/declarative/vite.config.ts +0 -55
- package/test/declarative-main.ts +0 -6
- package/test/extension-subpaths-main.ts +0 -9
- package/test/index.html +0 -11
- package/test/main.ts +0 -109
- package/test/pure-declarative-main.ts +0 -1
- package/test/vite.config.ts +0 -19
- package/tsconfig.api-extractor.json +0 -6
|
@@ -1,135 +0,0 @@
|
|
|
1
|
-
## API Report File for "@microsoft/fast-element"
|
|
2
|
-
|
|
3
|
-
> Do not edit this file. It is a report generated by [API Extractor](https://api-extractor.com/).
|
|
4
|
-
|
|
5
|
-
```ts
|
|
6
|
-
|
|
7
|
-
// @public
|
|
8
|
-
export type ComposableStyles = string | ElementStyles | CSSStyleSheet;
|
|
9
|
-
|
|
10
|
-
// @public
|
|
11
|
-
export type Constructable<T = {}> = {
|
|
12
|
-
new (...args: any[]): T;
|
|
13
|
-
};
|
|
14
|
-
|
|
15
|
-
// @public
|
|
16
|
-
export type ConstructibleStyleStrategy = {
|
|
17
|
-
new (styles: (string | CSSStyleSheet)[]): StyleStrategy;
|
|
18
|
-
};
|
|
19
|
-
|
|
20
|
-
// @public
|
|
21
|
-
export interface CSSDirective {
|
|
22
|
-
createCSS(): ComposableStyles;
|
|
23
|
-
}
|
|
24
|
-
|
|
25
|
-
// @public
|
|
26
|
-
export const CSSDirective: Readonly<{
|
|
27
|
-
getForInstance: (object: any) => CSSDirectiveDefinition<Constructable<CSSDirective>> | undefined;
|
|
28
|
-
getByType: (key: Function) => CSSDirectiveDefinition<Constructable<CSSDirective>> | undefined;
|
|
29
|
-
define<TType extends Constructable<CSSDirective>>(type: any): TType;
|
|
30
|
-
}>;
|
|
31
|
-
|
|
32
|
-
// @public
|
|
33
|
-
export function cssDirective(): (type: Constructable<CSSDirective>) => void;
|
|
34
|
-
|
|
35
|
-
// @public
|
|
36
|
-
export interface CSSDirectiveDefinition<TType extends Constructable<CSSDirective> = Constructable<CSSDirective>> {
|
|
37
|
-
readonly type: TType;
|
|
38
|
-
}
|
|
39
|
-
|
|
40
|
-
// @public
|
|
41
|
-
export class ElementStyles {
|
|
42
|
-
constructor(styles: ReadonlyArray<ComposableStyles>);
|
|
43
|
-
// @internal (undocumented)
|
|
44
|
-
addStylesTo(target: StyleTarget): void;
|
|
45
|
-
// @internal (undocumented)
|
|
46
|
-
isAttachedTo(target: StyleTarget): boolean;
|
|
47
|
-
static normalize(styles: ComposableStyles | ComposableStyles[] | undefined): ElementStyles | undefined;
|
|
48
|
-
// @internal (undocumented)
|
|
49
|
-
removeStylesFrom(target: StyleTarget): void;
|
|
50
|
-
static setDefaultStrategy(Strategy: ConstructibleStyleStrategy): void;
|
|
51
|
-
get strategy(): StyleStrategy;
|
|
52
|
-
// (undocumented)
|
|
53
|
-
readonly styles: ReadonlyArray<ComposableStyles>;
|
|
54
|
-
static readonly supportsAdoptedStyleSheets: boolean;
|
|
55
|
-
withStrategy(Strategy: ConstructibleStyleStrategy): this;
|
|
56
|
-
}
|
|
57
|
-
|
|
58
|
-
// @public
|
|
59
|
-
export interface ExecutionContext<TParent = any> {
|
|
60
|
-
readonly event: Event;
|
|
61
|
-
eventDetail<TDetail>(): TDetail;
|
|
62
|
-
eventTarget<TTarget extends EventTarget>(): TTarget;
|
|
63
|
-
index: number;
|
|
64
|
-
readonly isEven: boolean;
|
|
65
|
-
readonly isFirst: boolean;
|
|
66
|
-
readonly isInMiddle: boolean;
|
|
67
|
-
readonly isLast: boolean;
|
|
68
|
-
readonly isOdd: boolean;
|
|
69
|
-
length: number;
|
|
70
|
-
parent: TParent;
|
|
71
|
-
parentContext: ExecutionContext<TParent>;
|
|
72
|
-
}
|
|
73
|
-
|
|
74
|
-
// @public
|
|
75
|
-
export const ExecutionContext: Readonly<{
|
|
76
|
-
default: ExecutionContext<any>;
|
|
77
|
-
getEvent(): Event | null;
|
|
78
|
-
setEvent(event: Event | null): void;
|
|
79
|
-
}>;
|
|
80
|
-
|
|
81
|
-
// @public
|
|
82
|
-
export interface ExpressionController<TSource = any, TParent = any> {
|
|
83
|
-
readonly context: ExecutionContext<TParent>;
|
|
84
|
-
readonly isBound: boolean;
|
|
85
|
-
onUnbind(behavior: {
|
|
86
|
-
unbind(controller: ExpressionController<TSource, TParent>): any;
|
|
87
|
-
}): void;
|
|
88
|
-
readonly source: TSource;
|
|
89
|
-
readonly sourceLifetime?: SourceLifetime;
|
|
90
|
-
}
|
|
91
|
-
|
|
92
|
-
// @public
|
|
93
|
-
export interface HostBehavior<TSource = any> {
|
|
94
|
-
addedCallback?(controller: HostController<TSource>): void;
|
|
95
|
-
connectedCallback?(controller: HostController<TSource>): void;
|
|
96
|
-
disconnectedCallback?(controller: HostController<TSource>): void;
|
|
97
|
-
removedCallback?(controller: HostController<TSource>): void;
|
|
98
|
-
}
|
|
99
|
-
|
|
100
|
-
// @public
|
|
101
|
-
export interface HostController<TSource = any> extends ExpressionController<TSource> {
|
|
102
|
-
addBehavior(behavior: HostBehavior<TSource>): void;
|
|
103
|
-
addStyles(styles: ElementStyles | HTMLStyleElement | null | undefined): void;
|
|
104
|
-
readonly isConnected: boolean;
|
|
105
|
-
mainStyles: ElementStyles | null;
|
|
106
|
-
removeBehavior(behavior: HostBehavior<TSource>, force?: boolean): void;
|
|
107
|
-
removeStyles(styles: ElementStyles | HTMLStyleElement | null | undefined): void;
|
|
108
|
-
}
|
|
109
|
-
|
|
110
|
-
// @public
|
|
111
|
-
export const SourceLifetime: Readonly<{
|
|
112
|
-
readonly unknown: undefined;
|
|
113
|
-
readonly coupled: 1;
|
|
114
|
-
}>;
|
|
115
|
-
|
|
116
|
-
// @public
|
|
117
|
-
export type SourceLifetime = (typeof SourceLifetime)[keyof typeof SourceLifetime];
|
|
118
|
-
|
|
119
|
-
// @public
|
|
120
|
-
export interface StyleStrategy {
|
|
121
|
-
addStylesTo(target: StyleTarget): void;
|
|
122
|
-
removeStylesFrom(target: StyleTarget): void;
|
|
123
|
-
}
|
|
124
|
-
|
|
125
|
-
// @public
|
|
126
|
-
export interface StyleTarget extends Pick<Node, "getRootNode"> {
|
|
127
|
-
adoptedStyleSheets?: CSSStyleSheet[];
|
|
128
|
-
append(styles: HTMLStyleElement): void;
|
|
129
|
-
querySelectorAll<E extends Element = Element>(selectors: string): NodeListOf<E>;
|
|
130
|
-
removeChild(styles: HTMLStyleElement): void;
|
|
131
|
-
}
|
|
132
|
-
|
|
133
|
-
// (No @packageDocumentation comment for this package)
|
|
134
|
-
|
|
135
|
-
```
|
package/playwright.config.ts
DELETED
|
@@ -1,26 +0,0 @@
|
|
|
1
|
-
import { defineConfig, devices } from "@playwright/test";
|
|
2
|
-
|
|
3
|
-
export default defineConfig({
|
|
4
|
-
testDir: ".",
|
|
5
|
-
testMatch: "**/*.pw.spec.ts",
|
|
6
|
-
retries: 3,
|
|
7
|
-
projects: [
|
|
8
|
-
{
|
|
9
|
-
name: "chromium",
|
|
10
|
-
use: { ...devices["Desktop Chrome"] },
|
|
11
|
-
},
|
|
12
|
-
{
|
|
13
|
-
name: "firefox",
|
|
14
|
-
use: { ...devices["Desktop Firefox"] },
|
|
15
|
-
},
|
|
16
|
-
{
|
|
17
|
-
name: "webkit",
|
|
18
|
-
use: { ...devices["Desktop Safari"] },
|
|
19
|
-
},
|
|
20
|
-
],
|
|
21
|
-
webServer: {
|
|
22
|
-
command: "npm run test-server",
|
|
23
|
-
port: 5173,
|
|
24
|
-
reuseExistingServer: true,
|
|
25
|
-
},
|
|
26
|
-
});
|
|
@@ -1,26 +0,0 @@
|
|
|
1
|
-
import { defineConfig, devices } from "@playwright/test";
|
|
2
|
-
|
|
3
|
-
export default defineConfig({
|
|
4
|
-
testDir: "./test/declarative/fixtures",
|
|
5
|
-
testMatch: "**/*.spec.ts",
|
|
6
|
-
retries: 3,
|
|
7
|
-
projects: [
|
|
8
|
-
{
|
|
9
|
-
name: "chromium",
|
|
10
|
-
use: { ...devices["Desktop Chrome"] },
|
|
11
|
-
},
|
|
12
|
-
{
|
|
13
|
-
name: "firefox",
|
|
14
|
-
use: { ...devices["Desktop Firefox"] },
|
|
15
|
-
},
|
|
16
|
-
{
|
|
17
|
-
name: "webkit",
|
|
18
|
-
use: { ...devices["Desktop Safari"] },
|
|
19
|
-
},
|
|
20
|
-
],
|
|
21
|
-
webServer: {
|
|
22
|
-
command: "npm run test-server:declarative",
|
|
23
|
-
port: 5174,
|
|
24
|
-
reuseExistingServer: true,
|
|
25
|
-
},
|
|
26
|
-
});
|
|
@@ -1,20 +0,0 @@
|
|
|
1
|
-
import { defineConfig, devices } from "@playwright/test";
|
|
2
|
-
|
|
3
|
-
process.env.FAST_WEBUI_INTEGRATION = "true";
|
|
4
|
-
|
|
5
|
-
export default defineConfig({
|
|
6
|
-
testDir: "./test/declarative/fixtures",
|
|
7
|
-
testMatch: "**/*.spec.ts",
|
|
8
|
-
retries: 3,
|
|
9
|
-
projects: [
|
|
10
|
-
{
|
|
11
|
-
name: "chromium",
|
|
12
|
-
use: { ...devices["Desktop Chrome"] },
|
|
13
|
-
},
|
|
14
|
-
],
|
|
15
|
-
webServer: {
|
|
16
|
-
command: "npm run test-server:declarative:webui",
|
|
17
|
-
port: 5174,
|
|
18
|
-
reuseExistingServer: true,
|
|
19
|
-
},
|
|
20
|
-
});
|
|
@@ -1,135 +0,0 @@
|
|
|
1
|
-
#!/usr/bin/env node
|
|
2
|
-
|
|
3
|
-
/**
|
|
4
|
-
* Build FAST HTML fixtures with @microsoft/webui.
|
|
5
|
-
*
|
|
6
|
-
* For each fixture directory this script:
|
|
7
|
-
* 1. Extracts <f-template> components from templates.html into individual
|
|
8
|
-
* component files (webui uses filename-based component discovery).
|
|
9
|
-
* 2. Builds the fixture with `webui build --plugin=fast`.
|
|
10
|
-
* 3. Renders the compiled protocol with the fixture's state.json.
|
|
11
|
-
* 4. Writes the rendered index.html into temp/integrations/webui/fixtures/
|
|
12
|
-
* alongside a copy of main.ts and any extra assets so that Playwright
|
|
13
|
-
* tests can run against the webui-rendered output via Vite.
|
|
14
|
-
*/
|
|
15
|
-
|
|
16
|
-
import {
|
|
17
|
-
copyFileSync,
|
|
18
|
-
existsSync,
|
|
19
|
-
mkdirSync,
|
|
20
|
-
readdirSync,
|
|
21
|
-
readFileSync,
|
|
22
|
-
rmSync,
|
|
23
|
-
writeFileSync,
|
|
24
|
-
} from "node:fs";
|
|
25
|
-
import { dirname, join, resolve } from "node:path";
|
|
26
|
-
import { fileURLToPath } from "node:url";
|
|
27
|
-
import { build, render } from "@microsoft/webui";
|
|
28
|
-
import {
|
|
29
|
-
convertToWebuiSyntax,
|
|
30
|
-
discoverFixtures,
|
|
31
|
-
extractFTemplates,
|
|
32
|
-
} from "./build-fixtures.utilities.js";
|
|
33
|
-
|
|
34
|
-
const __dirname = dirname(fileURLToPath(import.meta.url));
|
|
35
|
-
const fixturesDir = resolve(__dirname, "../../test/declarative/fixtures");
|
|
36
|
-
const fixtures = discoverFixtures(fixturesDir);
|
|
37
|
-
const outBase = resolve(__dirname, "../../temp/integrations/webui/fixtures");
|
|
38
|
-
|
|
39
|
-
// Files produced by the build or only needed for the build step.
|
|
40
|
-
const buildOnlyFiles = new Set([
|
|
41
|
-
"entry.html",
|
|
42
|
-
"fast-build.config.json",
|
|
43
|
-
"templates.html",
|
|
44
|
-
"state.json",
|
|
45
|
-
"index.html",
|
|
46
|
-
]);
|
|
47
|
-
|
|
48
|
-
/**
|
|
49
|
-
* Build a single fixture with webui and write the rendered output plus
|
|
50
|
-
* supporting files into the output directory.
|
|
51
|
-
*/
|
|
52
|
-
function buildFixture(fixtureName) {
|
|
53
|
-
const fixtureDir = join(fixturesDir, fixtureName);
|
|
54
|
-
const buildDir = join(outBase, ".build", fixtureName);
|
|
55
|
-
const buildOutDir = join(buildDir, "out");
|
|
56
|
-
const fixtureOutDir = join(outBase, fixtureName);
|
|
57
|
-
|
|
58
|
-
mkdirSync(buildDir, { recursive: true });
|
|
59
|
-
mkdirSync(buildOutDir, { recursive: true });
|
|
60
|
-
mkdirSync(fixtureOutDir, { recursive: true });
|
|
61
|
-
|
|
62
|
-
// Extract individual component HTML files for webui discovery,
|
|
63
|
-
// converting FAST directives to webui syntax.
|
|
64
|
-
const templatesHtml = readFileSync(join(fixtureDir, "templates.html"), "utf8");
|
|
65
|
-
const templates = extractFTemplates(templatesHtml);
|
|
66
|
-
|
|
67
|
-
for (const { name, content } of templates) {
|
|
68
|
-
writeFileSync(join(buildDir, `${name}.html`), convertToWebuiSyntax(content));
|
|
69
|
-
}
|
|
70
|
-
|
|
71
|
-
// Prepare entry.html without script tags for webui build
|
|
72
|
-
const entryHtml = readFileSync(join(fixtureDir, "entry.html"), "utf8");
|
|
73
|
-
const cleanedEntry = entryHtml
|
|
74
|
-
.split("\n")
|
|
75
|
-
.filter(line => !line.includes("<script"))
|
|
76
|
-
.join("\n");
|
|
77
|
-
writeFileSync(join(buildDir, "entry.html"), cleanedEntry);
|
|
78
|
-
|
|
79
|
-
// Build protocol
|
|
80
|
-
const buildResult = build({
|
|
81
|
-
appDir: buildDir,
|
|
82
|
-
entry: "entry.html",
|
|
83
|
-
plugin: "fast",
|
|
84
|
-
outDir: buildOutDir,
|
|
85
|
-
});
|
|
86
|
-
|
|
87
|
-
if (!buildResult.protocol || buildResult.protocol.length === 0) {
|
|
88
|
-
throw new Error(`Build produced empty protocol for "${fixtureName}"`);
|
|
89
|
-
}
|
|
90
|
-
|
|
91
|
-
// Render with state
|
|
92
|
-
const state = JSON.parse(readFileSync(join(fixtureDir, "state.json"), "utf8"));
|
|
93
|
-
let html = render(buildResult.protocol, state, {
|
|
94
|
-
plugin: "fast",
|
|
95
|
-
entry: "entry.html",
|
|
96
|
-
});
|
|
97
|
-
|
|
98
|
-
// Inject <script type="module" src="./main.ts"> before </body>
|
|
99
|
-
html = html.replace(
|
|
100
|
-
"</body>",
|
|
101
|
-
'<script type="module" src="./main.ts"></script>\n</body>',
|
|
102
|
-
);
|
|
103
|
-
|
|
104
|
-
writeFileSync(join(fixtureOutDir, "index.html"), html);
|
|
105
|
-
|
|
106
|
-
// Copy main.ts and any extra assets (CSS, SVG, etc.) from the
|
|
107
|
-
// original fixture directory so Vite can serve them.
|
|
108
|
-
for (const entry of readdirSync(fixtureDir)) {
|
|
109
|
-
if (buildOnlyFiles.has(entry) || entry.endsWith(".spec.ts")) {
|
|
110
|
-
continue;
|
|
111
|
-
}
|
|
112
|
-
copyFileSync(join(fixtureDir, entry), join(fixtureOutDir, entry));
|
|
113
|
-
}
|
|
114
|
-
|
|
115
|
-
process.stdout.write(`Fixture "${fixtureName}" built successfully.\n`);
|
|
116
|
-
}
|
|
117
|
-
|
|
118
|
-
function main() {
|
|
119
|
-
// Clean previous build output
|
|
120
|
-
if (existsSync(outBase)) {
|
|
121
|
-
rmSync(outBase, { recursive: true });
|
|
122
|
-
}
|
|
123
|
-
|
|
124
|
-
for (const fixtureName of fixtures) {
|
|
125
|
-
buildFixture(fixtureName);
|
|
126
|
-
}
|
|
127
|
-
|
|
128
|
-
// Clean up intermediate build directory
|
|
129
|
-
const buildTmp = join(outBase, ".build");
|
|
130
|
-
if (existsSync(buildTmp)) {
|
|
131
|
-
rmSync(buildTmp, { recursive: true });
|
|
132
|
-
}
|
|
133
|
-
}
|
|
134
|
-
|
|
135
|
-
main();
|
|
@@ -1,49 +0,0 @@
|
|
|
1
|
-
#!/usr/bin/env node
|
|
2
|
-
import { execFileSync } from "node:child_process";
|
|
3
|
-
import { readFileSync, writeFileSync } from "node:fs";
|
|
4
|
-
import { createRequire } from "node:module";
|
|
5
|
-
import { dirname, join, resolve } from "node:path";
|
|
6
|
-
import { fileURLToPath } from "node:url";
|
|
7
|
-
import { discoverFixtures } from "./build-fixtures.utilities.js";
|
|
8
|
-
|
|
9
|
-
// Pass-through CLI arguments (forwarded to every fast-build invocation).
|
|
10
|
-
const passthroughArgs = process.argv.slice(2);
|
|
11
|
-
|
|
12
|
-
const __dirname = dirname(fileURLToPath(import.meta.url));
|
|
13
|
-
const fixturesDir = resolve(__dirname, "../../test/declarative/fixtures");
|
|
14
|
-
const fixtures = discoverFixtures(fixturesDir);
|
|
15
|
-
|
|
16
|
-
const require = createRequire(import.meta.url);
|
|
17
|
-
const fastBin = require.resolve("@microsoft/fast-build/bin/fast.js");
|
|
18
|
-
|
|
19
|
-
for (const fixtureName of fixtures) {
|
|
20
|
-
const fixtureDir = resolve(__dirname, "../../test/declarative/fixtures", fixtureName);
|
|
21
|
-
const configFile = join(fixtureDir, "fast-build.config.json");
|
|
22
|
-
const templatesFile = join(fixtureDir, "templates.html");
|
|
23
|
-
const outputFile = join(fixtureDir, "index.html");
|
|
24
|
-
|
|
25
|
-
// Step 1: render shadow DOM via fast-build CLI using config file
|
|
26
|
-
execFileSync(
|
|
27
|
-
process.execPath,
|
|
28
|
-
[fastBin, "build", `--config=${configFile}`, ...passthroughArgs],
|
|
29
|
-
{ stdio: "inherit" },
|
|
30
|
-
);
|
|
31
|
-
|
|
32
|
-
// Step 2: inject <f-template> declarations from templates.html before <script>
|
|
33
|
-
const fTemplates = readFileSync(templatesFile, "utf8").trim();
|
|
34
|
-
const rawHtml = readFileSync(outputFile, "utf8");
|
|
35
|
-
|
|
36
|
-
if (!rawHtml.includes('<script type="module"')) {
|
|
37
|
-
throw new Error(
|
|
38
|
-
`Fixture "${fixtureName}": could not find '<script type="module"' in "${outputFile}". Template injection failed.`,
|
|
39
|
-
);
|
|
40
|
-
}
|
|
41
|
-
|
|
42
|
-
const html = rawHtml.replace(
|
|
43
|
-
/(\s*)<script type="module"/,
|
|
44
|
-
`\n${fTemplates}\n$1<script type="module"`,
|
|
45
|
-
);
|
|
46
|
-
|
|
47
|
-
writeFileSync(outputFile, html);
|
|
48
|
-
process.stdout.write(`Fixture "${fixtureName}" built successfully.\n`);
|
|
49
|
-
}
|
|
@@ -1,101 +0,0 @@
|
|
|
1
|
-
import { existsSync, readdirSync } from "node:fs";
|
|
2
|
-
import { join } from "node:path";
|
|
3
|
-
|
|
4
|
-
/**
|
|
5
|
-
* Auto-discover fixture directories that contain the required build files
|
|
6
|
-
* (entry.html, templates.html, state.json, and fast-build.config.json).
|
|
7
|
-
*
|
|
8
|
-
* Fixtures are organized in category subdirectories (e.g., bindings/attribute,
|
|
9
|
-
* directives/repeat). The function scans two levels deep: category directories
|
|
10
|
-
* at the top level, and fixture directories within each category.
|
|
11
|
-
*
|
|
12
|
-
* Each fixture directory must contain a `fast-build.config.json` that
|
|
13
|
-
* configures the `@microsoft/fast-build` CLI. At minimum the config
|
|
14
|
-
* should specify `entry`, `state`, `output`, and `templates`. Fixture-
|
|
15
|
-
* specific options such as `attribute-name-strategy` can also be included.
|
|
16
|
-
*
|
|
17
|
-
* @param {string} fixturesDir - Absolute path to the fixtures directory.
|
|
18
|
-
* @returns {string[]} Sorted array of fixture paths relative to fixturesDir
|
|
19
|
-
* (e.g., "bindings/attribute", "directives/repeat").
|
|
20
|
-
*/
|
|
21
|
-
export function discoverFixtures(fixturesDir) {
|
|
22
|
-
const fixtures = [];
|
|
23
|
-
|
|
24
|
-
for (const category of readdirSync(fixturesDir, { withFileTypes: true })) {
|
|
25
|
-
if (!category.isDirectory()) continue;
|
|
26
|
-
|
|
27
|
-
const categoryDir = join(fixturesDir, category.name);
|
|
28
|
-
|
|
29
|
-
for (const fixture of readdirSync(categoryDir, { withFileTypes: true })) {
|
|
30
|
-
if (!fixture.isDirectory()) continue;
|
|
31
|
-
|
|
32
|
-
const dir = join(categoryDir, fixture.name);
|
|
33
|
-
if (
|
|
34
|
-
existsSync(join(dir, "entry.html")) &&
|
|
35
|
-
existsSync(join(dir, "templates.html")) &&
|
|
36
|
-
existsSync(join(dir, "state.json")) &&
|
|
37
|
-
existsSync(join(dir, "fast-build.config.json"))
|
|
38
|
-
) {
|
|
39
|
-
fixtures.push(`${category.name}/${fixture.name}`);
|
|
40
|
-
}
|
|
41
|
-
}
|
|
42
|
-
}
|
|
43
|
-
|
|
44
|
-
return fixtures.sort((a, b) => a.localeCompare(b));
|
|
45
|
-
}
|
|
46
|
-
|
|
47
|
-
/**
|
|
48
|
-
* Extract `<f-template name="X">` elements from an HTML string.
|
|
49
|
-
* Returns an array of `{ name, content }` objects where `content`
|
|
50
|
-
* is the inner HTML of the `<template>` child. When the `<template>`
|
|
51
|
-
* element carries host-binding attributes (e.g. `@click`, `?disabled`),
|
|
52
|
-
* those are preserved by wrapping the content in a `<template>` tag.
|
|
53
|
-
* @param {string} html - Raw HTML containing `<f-template>` elements.
|
|
54
|
-
* @returns {{ name: string, content: string }[]}
|
|
55
|
-
*/
|
|
56
|
-
export function extractFTemplates(html) {
|
|
57
|
-
const results = [];
|
|
58
|
-
const regex =
|
|
59
|
-
/<f-template\s+name="([^"]+)">\s*<template([^>]*)>([\s\S]*?)<\/template>\s*<\/f-template>/g;
|
|
60
|
-
let match;
|
|
61
|
-
while ((match = regex.exec(html)) !== null) {
|
|
62
|
-
const name = match[1];
|
|
63
|
-
const attrs = match[2].trim();
|
|
64
|
-
const inner = match[3].trim();
|
|
65
|
-
|
|
66
|
-
if (attrs.length > 0) {
|
|
67
|
-
results.push({
|
|
68
|
-
name,
|
|
69
|
-
content: `<template ${attrs}>${inner}</template>`,
|
|
70
|
-
});
|
|
71
|
-
} else {
|
|
72
|
-
results.push({ name, content: inner });
|
|
73
|
-
}
|
|
74
|
-
}
|
|
75
|
-
return results;
|
|
76
|
-
}
|
|
77
|
-
|
|
78
|
-
/**
|
|
79
|
-
* Convert FAST template directives to webui syntax.
|
|
80
|
-
*
|
|
81
|
-
* - `<f-when value="{{expr}}">` → `<if condition="expr">`
|
|
82
|
-
* - `</f-when>` → `</if>`
|
|
83
|
-
* - `<f-repeat value="{{item in list}}" ...>` → `<for each="item in list" ...>`
|
|
84
|
-
* - `</f-repeat>` → `</for>`
|
|
85
|
-
*
|
|
86
|
-
* @param {string} html - Template HTML using FAST directive syntax.
|
|
87
|
-
* @returns {string} Template HTML using webui directive syntax.
|
|
88
|
-
*/
|
|
89
|
-
export function convertToWebuiSyntax(html) {
|
|
90
|
-
return html
|
|
91
|
-
.replace(
|
|
92
|
-
/<f-when\s+value="{{([\s\S]*?)}}"\s*>/g,
|
|
93
|
-
(_, expr) => `<if condition="${expr.trim()}">`,
|
|
94
|
-
)
|
|
95
|
-
.replace(/<\/f-when>/g, "</if>")
|
|
96
|
-
.replace(
|
|
97
|
-
/<f-repeat\s+value="{{([\s\S]*?)}}"([^>]*)>/g,
|
|
98
|
-
(_, expr, rest) => `<for each="${expr.trim()}"${rest}>`,
|
|
99
|
-
)
|
|
100
|
-
.replace(/<\/f-repeat>/g, "</for>");
|
|
101
|
-
}
|