@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
package/dist/dts/di/di.d.ts
CHANGED
|
@@ -537,7 +537,7 @@ export declare const DI: Readonly<{
|
|
|
537
537
|
*
|
|
538
538
|
* @public
|
|
539
539
|
*/
|
|
540
|
-
singleton<
|
|
540
|
+
singleton<T extends Constructable>(target: T & Partial<RegisterSelf<T>>, options?: SingletonOptions): T & RegisterSelf<T>;
|
|
541
541
|
}>;
|
|
542
542
|
/**
|
|
543
543
|
* The key that resolves the dependency injection Container itself.
|
|
@@ -827,7 +827,7 @@ export declare const Registration: Readonly<{
|
|
|
827
827
|
* @param key - The key to register the singleton under.
|
|
828
828
|
* @param value - The class to instantiate as a singleton when first requested.
|
|
829
829
|
*/
|
|
830
|
-
singleton<
|
|
830
|
+
singleton<T extends Constructable>(key: Key, value: T): Registration<InstanceType<T>>;
|
|
831
831
|
/**
|
|
832
832
|
* Creates an instance from a class.
|
|
833
833
|
* Every time you request this {@link Key} you will get a new instance.
|
|
@@ -840,7 +840,7 @@ export declare const Registration: Readonly<{
|
|
|
840
840
|
* @param key - The key to register the instance type under.
|
|
841
841
|
* @param value - The class to instantiate each time the key is requested.
|
|
842
842
|
*/
|
|
843
|
-
transient<
|
|
843
|
+
transient<T extends Constructable>(key: Key, value: T): Registration<InstanceType<T>>;
|
|
844
844
|
/**
|
|
845
845
|
* Delegates to a callback function to provide the dependency.
|
|
846
846
|
* Every time you request this {@link Key} the callback will be invoked to provide
|
|
@@ -855,7 +855,7 @@ export declare const Registration: Readonly<{
|
|
|
855
855
|
* @param key - The key to register the callback for.
|
|
856
856
|
* @param callback - The function that is expected to return the dependency.
|
|
857
857
|
*/
|
|
858
|
-
callback<
|
|
858
|
+
callback<T>(key: Key, callback: ResolveCallback<T>): Registration<Resolved<T>>;
|
|
859
859
|
/**
|
|
860
860
|
* Delegates to a callback function to provide the dependency and then caches the
|
|
861
861
|
* dependency for future requests.
|
|
@@ -872,7 +872,7 @@ export declare const Registration: Readonly<{
|
|
|
872
872
|
* If you pass the same Registration to another container, the same cached value will be used.
|
|
873
873
|
* Should all references to the resolver returned be removed, the cache will expire.
|
|
874
874
|
*/
|
|
875
|
-
cachedCallback<
|
|
875
|
+
cachedCallback<T>(key: Key, callback: ResolveCallback<T>): Registration<Resolved<T>>;
|
|
876
876
|
/**
|
|
877
877
|
* Creates an alternate {@link Key} to retrieve an instance by.
|
|
878
878
|
*
|
|
@@ -887,7 +887,7 @@ export declare const Registration: Readonly<{
|
|
|
887
887
|
* @param originalKey - The original key that has been registered.
|
|
888
888
|
* @param aliasKey - The alias to the original key.
|
|
889
889
|
*/
|
|
890
|
-
aliasTo<
|
|
890
|
+
aliasTo<T>(originalKey: T, aliasKey: Key): Registration<Resolved<T>>;
|
|
891
891
|
}>;
|
|
892
892
|
/** @internal */
|
|
893
893
|
export declare function validateKey(key: any): void;
|
package/dist/dts/dom-policy.d.ts
CHANGED
|
@@ -1,5 +1,24 @@
|
|
|
1
|
-
import { DOMAspect, type DOMSink
|
|
1
|
+
import { DOMAspect, type DOMSink } from "./dom.js";
|
|
2
2
|
import { type TrustedTypesPolicy } from "./interfaces.js";
|
|
3
|
+
/**
|
|
4
|
+
* A policy that controls whether values can be written to DOM sinks.
|
|
5
|
+
* @public
|
|
6
|
+
*/
|
|
7
|
+
export interface DOMPolicy {
|
|
8
|
+
/**
|
|
9
|
+
* Creates safe HTML from the provided value.
|
|
10
|
+
* @param value - The source to convert to safe HTML.
|
|
11
|
+
*/
|
|
12
|
+
createHTML(value: string): string;
|
|
13
|
+
/**
|
|
14
|
+
* Protects a DOM sink that intends to write to the DOM.
|
|
15
|
+
* @param tagName - The tag name for the element to write to.
|
|
16
|
+
* @param aspect - The aspect of the DOM to write to.
|
|
17
|
+
* @param aspectName - The name of the aspect to write to.
|
|
18
|
+
* @param sink - The sink that is used to write to the DOM.
|
|
19
|
+
*/
|
|
20
|
+
protect(tagName: string | null, aspect: DOMAspect, aspectName: string, sink: DOMSink): DOMSink;
|
|
21
|
+
}
|
|
3
22
|
/**
|
|
4
23
|
* A specific DOM sink guard for a node aspect.
|
|
5
24
|
* @public
|
|
@@ -72,12 +91,11 @@ export type DOMPolicyOptions = {
|
|
|
72
91
|
* A helper for creating DOM policies.
|
|
73
92
|
* @public
|
|
74
93
|
*/
|
|
75
|
-
declare const DOMPolicy: Readonly<{
|
|
94
|
+
export declare const DOMPolicy: Readonly<{
|
|
76
95
|
/**
|
|
77
96
|
* Creates a new DOM Policy object.
|
|
78
97
|
* @param options - The options to use in creating the policy.
|
|
79
98
|
* @returns The newly created DOMPolicy.
|
|
80
99
|
*/
|
|
81
|
-
create(options?: DOMPolicyOptions): Readonly<
|
|
100
|
+
create(options?: DOMPolicyOptions): Readonly<DOMPolicy>;
|
|
82
101
|
}>;
|
|
83
|
-
export { DOMPolicy };
|
package/dist/dts/dom.d.ts
CHANGED
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import type { DOMPolicy as DOMPolicyDefinition } from "./dom-policy.js";
|
|
1
2
|
/**
|
|
2
3
|
* The type of HTML aspect to target.
|
|
3
4
|
* @public
|
|
@@ -46,20 +47,7 @@ export type DOMSink = (target: Node, aspectName: string, value: any, ...args: an
|
|
|
46
47
|
* A security policy that FAST can use to interact with the DOM.
|
|
47
48
|
* @public
|
|
48
49
|
*/
|
|
49
|
-
export interface DOMPolicy {
|
|
50
|
-
/**
|
|
51
|
-
* Creates safe HTML from the provided value.
|
|
52
|
-
* @param value - The source to convert to safe HTML.
|
|
53
|
-
*/
|
|
54
|
-
createHTML(value: string): string;
|
|
55
|
-
/**
|
|
56
|
-
* Protects a DOM sink that intends to write to the DOM.
|
|
57
|
-
* @param tagName - The tag name for the element to write to.
|
|
58
|
-
* @param aspect - The aspect of the DOM to write to.
|
|
59
|
-
* @param aspectName - The name of the aspect to write to.
|
|
60
|
-
* @param sink - The sink that is used to write to the DOM.
|
|
61
|
-
*/
|
|
62
|
-
protect(tagName: string | null, aspect: DOMAspect, aspectName: string, sink: DOMSink): DOMSink;
|
|
50
|
+
export interface DOMPolicy extends DOMPolicyDefinition {
|
|
63
51
|
}
|
|
64
52
|
/**
|
|
65
53
|
* Common DOM APIs.
|
|
@@ -69,7 +57,7 @@ export declare const DOM: Readonly<{
|
|
|
69
57
|
/**
|
|
70
58
|
* Gets the dom policy used by the templating system.
|
|
71
59
|
*/
|
|
72
|
-
readonly policy:
|
|
60
|
+
readonly policy: DOMPolicyDefinition;
|
|
73
61
|
/**
|
|
74
62
|
* Sets the dom policy used by the templating system.
|
|
75
63
|
* @param policy - The policy to set.
|
|
@@ -77,7 +65,7 @@ export declare const DOM: Readonly<{
|
|
|
77
65
|
* This API can only be called once, for security reasons. It should be
|
|
78
66
|
* called by the application developer at the start of their program.
|
|
79
67
|
*/
|
|
80
|
-
setPolicy(value:
|
|
68
|
+
setPolicy(value: DOMPolicyDefinition): void;
|
|
81
69
|
/**
|
|
82
70
|
* Sets an attribute value on an element.
|
|
83
71
|
* @param element - The element to set the attribute value on.
|
|
@@ -0,0 +1,93 @@
|
|
|
1
|
+
import type { ViewBehaviorFactory } from "../templating/html-directive.js";
|
|
2
|
+
/**
|
|
3
|
+
* Structured description of the binding hydration was expecting to apply when
|
|
4
|
+
* a mismatch is detected.
|
|
5
|
+
* @public
|
|
6
|
+
*/
|
|
7
|
+
export interface HydrationMismatchExpectation {
|
|
8
|
+
/**
|
|
9
|
+
* The tag name of the element the binding was expecting (e.g. `"SPAN"`),
|
|
10
|
+
* or `null` when the binding does not target a specific element (host or
|
|
11
|
+
* template-level bindings).
|
|
12
|
+
*/
|
|
13
|
+
tagName: string | null;
|
|
14
|
+
/**
|
|
15
|
+
* Human-readable description of the binding aspect, for example
|
|
16
|
+
* `"content"`, `"property className"`, or `"attribute aria-label"`.
|
|
17
|
+
*/
|
|
18
|
+
aspect: string;
|
|
19
|
+
}
|
|
20
|
+
/**
|
|
21
|
+
* Structured description of the DOM hydration actually encountered at the
|
|
22
|
+
* mismatch point.
|
|
23
|
+
* @public
|
|
24
|
+
*/
|
|
25
|
+
export interface HydrationMismatchActual {
|
|
26
|
+
/**
|
|
27
|
+
* Serialized HTML snippet of the server-rendered DOM where the mismatch
|
|
28
|
+
* was detected. Truncated with an ellipsis when long.
|
|
29
|
+
*/
|
|
30
|
+
html: string;
|
|
31
|
+
}
|
|
32
|
+
/**
|
|
33
|
+
* Result of a hydration-mismatch diagnostic format call.
|
|
34
|
+
* @public
|
|
35
|
+
*/
|
|
36
|
+
export interface HydrationDiagnosticResult {
|
|
37
|
+
/**
|
|
38
|
+
* The error message to attach to the thrown hydration error.
|
|
39
|
+
*/
|
|
40
|
+
message: string;
|
|
41
|
+
/**
|
|
42
|
+
* Structured description of the binding the hydration walk was
|
|
43
|
+
* attempting to apply. The default diagnostic leaves this `undefined`;
|
|
44
|
+
* install `hydrationDebugger()` to populate it.
|
|
45
|
+
*/
|
|
46
|
+
expected?: HydrationMismatchExpectation | string;
|
|
47
|
+
/**
|
|
48
|
+
* Structured description of the server-rendered DOM that was
|
|
49
|
+
* encountered at the mismatch point. The default diagnostic leaves
|
|
50
|
+
* this `undefined`; install `hydrationDebugger()` to populate it.
|
|
51
|
+
*/
|
|
52
|
+
received?: HydrationMismatchActual;
|
|
53
|
+
}
|
|
54
|
+
/**
|
|
55
|
+
* Pluggable formatter for hydration mismatch errors. The default
|
|
56
|
+
* implementation is a minimal one-line message; install
|
|
57
|
+
* {@link hydrationDebugger} to swap in the rich "Expected … / Received …"
|
|
58
|
+
* formatter with an HTML snippet of the SSR DOM.
|
|
59
|
+
* @public
|
|
60
|
+
*/
|
|
61
|
+
export interface HydrationDiagnostic {
|
|
62
|
+
/**
|
|
63
|
+
* Format a binding-resolution mismatch (a factory whose `targetNodeId`
|
|
64
|
+
* has no entry in the resolved targets after the SSR DOM walk).
|
|
65
|
+
*/
|
|
66
|
+
formatBindingMismatch(factory: ViewBehaviorFactory, firstChild: Node, lastChild: Node, hostName: string | undefined): HydrationDiagnosticResult;
|
|
67
|
+
/**
|
|
68
|
+
* Format a structural error encountered during the SSR DOM walk
|
|
69
|
+
* (e.g. attribute binding count overflow, missing close marker).
|
|
70
|
+
*/
|
|
71
|
+
formatStructuralError(node: Node, hostName: string | undefined, expectedDescription: string): HydrationDiagnosticResult;
|
|
72
|
+
}
|
|
73
|
+
/**
|
|
74
|
+
* Installs a {@link HydrationDiagnostic} as the active formatter for
|
|
75
|
+
* hydration mismatch errors. Called by `enableHydration()` when an opt-in
|
|
76
|
+
* debugger configuration is supplied; not exposed as `@public` because
|
|
77
|
+
* library consumers should always go through `enableHydration` to install
|
|
78
|
+
* a debugger.
|
|
79
|
+
* @internal
|
|
80
|
+
*/
|
|
81
|
+
export declare function installHydrationDiagnostic(diagnostic: HydrationDiagnostic): void;
|
|
82
|
+
/**
|
|
83
|
+
* Returns the currently active {@link HydrationDiagnostic} — either the
|
|
84
|
+
* minimal default or one installed by an opt-in debugger.
|
|
85
|
+
* @internal
|
|
86
|
+
*/
|
|
87
|
+
export declare function getHydrationDiagnostic(): HydrationDiagnostic;
|
|
88
|
+
/**
|
|
89
|
+
* Reads the host element's tag name from any node inside a hydration view.
|
|
90
|
+
* Returns `undefined` when the node is not inside a shadow root.
|
|
91
|
+
* @internal
|
|
92
|
+
*/
|
|
93
|
+
export declare function getHostName(node: Node | null | undefined): string | undefined;
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
import type { HydrationDiagnostic } from "./diagnostics.js";
|
|
2
|
+
/**
|
|
3
|
+
* Opt-in hydration debugger configuration. Pass to `enableHydration` to
|
|
4
|
+
* install the rich "Expected / Received" hydration mismatch formatter:
|
|
5
|
+
*
|
|
6
|
+
* ```ts
|
|
7
|
+
* import { enableHydration, hydrationDebugger } from "@microsoft/fast-element/hydration.js";
|
|
8
|
+
*
|
|
9
|
+
* enableHydration({ debugger: hydrationDebugger() });
|
|
10
|
+
* ```
|
|
11
|
+
*
|
|
12
|
+
* @public
|
|
13
|
+
*/
|
|
14
|
+
export interface HydrationDebugger {
|
|
15
|
+
/**
|
|
16
|
+
* The {@link HydrationDiagnostic} the debugger installs when consumed
|
|
17
|
+
* by `enableHydration`.
|
|
18
|
+
*/
|
|
19
|
+
readonly diagnostic: HydrationDiagnostic;
|
|
20
|
+
}
|
|
21
|
+
/**
|
|
22
|
+
* Returns a {@link HydrationDebugger} that, when supplied to
|
|
23
|
+
* `enableHydration({ debugger })`, installs the rich hydration mismatch
|
|
24
|
+
* formatter: a single-line "Expected … / Received …" message plus an HTML
|
|
25
|
+
* snippet of the SSR DOM and structured `expected`/`received` fields on
|
|
26
|
+
* the thrown error (both `HydrationBindingError` and
|
|
27
|
+
* `HydrationTargetElementError`).
|
|
28
|
+
*
|
|
29
|
+
* Without the debugger, hydration errors emit only a minimal one-line
|
|
30
|
+
* message pointing at this function — keeping the runtime hydration cost
|
|
31
|
+
* small for production bundles that do not need rich diagnostics.
|
|
32
|
+
*
|
|
33
|
+
* @public
|
|
34
|
+
*/
|
|
35
|
+
export declare function hydrationDebugger(): HydrationDebugger;
|
|
@@ -0,0 +1,62 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Centralized hydration mismatch message strings used by both the default
|
|
3
|
+
* minimal `HydrationDiagnostic` and the opt-in `hydrationDebugger` rich
|
|
4
|
+
* formatter, and by the structural-error throw sites in
|
|
5
|
+
* `target-builder.ts`.
|
|
6
|
+
*
|
|
7
|
+
* Static text is exported as a plain `const`; interpolated text is exported
|
|
8
|
+
* as a small builder function. Plain `export const` declarations tree-shake
|
|
9
|
+
* better than frozen-object property bags, so unused strings drop out of
|
|
10
|
+
* bundles cleanly.
|
|
11
|
+
*/
|
|
12
|
+
/**
|
|
13
|
+
* Fallback host tag name used when a hydration mismatch is detected on a
|
|
14
|
+
* node that is not inside a shadow root.
|
|
15
|
+
*/
|
|
16
|
+
export declare const unknownHostName = "unknown";
|
|
17
|
+
export declare const aspectLabelAttribute = "attribute";
|
|
18
|
+
export declare const aspectLabelBooleanAttribute = "boolean attribute";
|
|
19
|
+
export declare const aspectLabelProperty = "property";
|
|
20
|
+
export declare const aspectLabelContent = "content";
|
|
21
|
+
export declare const aspectLabelTokenList = "token list";
|
|
22
|
+
export declare const aspectLabelEvent = "event";
|
|
23
|
+
/** Fallback used when the aspectType is missing or unknown. */
|
|
24
|
+
export declare const aspectLabelUnknown = "binding";
|
|
25
|
+
/**
|
|
26
|
+
* Combines an aspect label with the original source aspect identifier from
|
|
27
|
+
* markup (e.g. `"property className"`). Returns the bare label when no
|
|
28
|
+
* source aspect was captured.
|
|
29
|
+
*/
|
|
30
|
+
export declare function formatAspect(label: string, sourceAspect: string | undefined): string;
|
|
31
|
+
/**
|
|
32
|
+
* Formats the "Expected" half of the rich hydration mismatch message, e.g.
|
|
33
|
+
* `"<span> with content binding"` or `"content binding"` when no tag is
|
|
34
|
+
* associated with the binding factory.
|
|
35
|
+
*/
|
|
36
|
+
export declare function formatExpectedTarget(tagName: string | null, aspect: string): string;
|
|
37
|
+
/**
|
|
38
|
+
* Default minimal hydration mismatch message used when the
|
|
39
|
+
* `hydrationDebugger` opt-in is not installed. The optional `detail` string
|
|
40
|
+
* carries the structural expectation surfaced by `target-builder.ts`.
|
|
41
|
+
*/
|
|
42
|
+
export declare function formatDefaultMismatchMessage(hostName: string, detail: string | undefined): string;
|
|
43
|
+
/**
|
|
44
|
+
* Rich `Expected … / Received …` hydration mismatch message format produced
|
|
45
|
+
* by the `hydrationDebugger` formatter.
|
|
46
|
+
*/
|
|
47
|
+
export declare function formatRichMismatchMessage(hostName: string, expectedText: string, receivedHtml: string): string;
|
|
48
|
+
export declare const expectedContentAfterStartMarker = "content following `<!--fe:b-->` content binding marker";
|
|
49
|
+
export declare const expectedContentEndMarker = "matching `<!--fe:/b-->` content binding close marker";
|
|
50
|
+
export declare const expectedElementBoundaryEndMarker = "matching `<!--fe:/e-->` element boundary close marker";
|
|
51
|
+
/**
|
|
52
|
+
* Builds the "no more attribute bindings" structural expectation message
|
|
53
|
+
* thrown when an element's `data-fe` count claims more attribute bindings
|
|
54
|
+
* than the compiled template defines.
|
|
55
|
+
*/
|
|
56
|
+
export declare function formatNoMoreAttributeBindings(factoryCount: number): string;
|
|
57
|
+
/**
|
|
58
|
+
* Builds the "no more content bindings" structural expectation message
|
|
59
|
+
* thrown when the SSR DOM contains more content binding markers than the
|
|
60
|
+
* compiled template defines.
|
|
61
|
+
*/
|
|
62
|
+
export declare function formatNoMoreContentBindings(factoryCount: number): string;
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import type { CompiledViewBehaviorFactory, ViewBehaviorFactory, ViewBehaviorTargets } from "../templating/html-directive.js";
|
|
2
|
+
import { type HydrationMismatchActual, type HydrationMismatchExpectation } from "./diagnostics.js";
|
|
2
3
|
export declare class HydrationTargetElementError extends Error {
|
|
3
4
|
/**
|
|
4
5
|
* The Compiled View Behavior Factories that belong to the view.
|
|
@@ -8,6 +9,18 @@ export declare class HydrationTargetElementError extends Error {
|
|
|
8
9
|
* The node to target factory.
|
|
9
10
|
*/
|
|
10
11
|
readonly node: Node;
|
|
12
|
+
/**
|
|
13
|
+
* Structured description of the binding the hydration walk was
|
|
14
|
+
* attempting to apply when the mismatch was detected. Free-form
|
|
15
|
+
* string for structural errors that do not correspond to a single
|
|
16
|
+
* binding factory.
|
|
17
|
+
*/
|
|
18
|
+
readonly expected?: (HydrationMismatchExpectation | string) | undefined;
|
|
19
|
+
/**
|
|
20
|
+
* Structured description of the server-rendered DOM that was
|
|
21
|
+
* encountered at the mismatch point.
|
|
22
|
+
*/
|
|
23
|
+
readonly received?: HydrationMismatchActual | undefined;
|
|
11
24
|
/**
|
|
12
25
|
* String representation of the HTML in the template that
|
|
13
26
|
* threw the target element error.
|
|
@@ -25,7 +38,19 @@ export declare class HydrationTargetElementError extends Error {
|
|
|
25
38
|
/**
|
|
26
39
|
* The node to target factory.
|
|
27
40
|
*/
|
|
28
|
-
node: Node
|
|
41
|
+
node: Node,
|
|
42
|
+
/**
|
|
43
|
+
* Structured description of the binding the hydration walk was
|
|
44
|
+
* attempting to apply when the mismatch was detected. Free-form
|
|
45
|
+
* string for structural errors that do not correspond to a single
|
|
46
|
+
* binding factory.
|
|
47
|
+
*/
|
|
48
|
+
expected?: (HydrationMismatchExpectation | string) | undefined,
|
|
49
|
+
/**
|
|
50
|
+
* Structured description of the server-rendered DOM that was
|
|
51
|
+
* encountered at the mismatch point.
|
|
52
|
+
*/
|
|
53
|
+
received?: HydrationMismatchActual | undefined);
|
|
29
54
|
}
|
|
30
55
|
/**
|
|
31
56
|
* Represents the DOM boundaries controlled by a view
|
package/dist/dts/hydration.d.ts
CHANGED
|
@@ -1,10 +1,14 @@
|
|
|
1
1
|
export type { HydrationOptions } from "./components/enable-hydration.js";
|
|
2
|
-
export { deferHydrationAttribute, enableHydration, } from "./components/enable-hydration.js";
|
|
2
|
+
export { deferHydrationAttribute, enableHydration, StopHydration, } from "./components/enable-hydration.js";
|
|
3
3
|
export { isHydratable } from "./components/hydration.js";
|
|
4
4
|
export { HydrationTracker } from "./components/hydration-tracker.js";
|
|
5
|
-
export type { DOMAspect,
|
|
5
|
+
export type { DOMAspect, DOMSink, } from "./dom.js";
|
|
6
|
+
export { type DOMAspectGuards, type DOMElementGuards, type DOMGuards, DOMPolicy, type DOMPolicyOptions, type DOMSinkGuards, } from "./dom-policy.js";
|
|
7
|
+
export type { HydrationDiagnostic, HydrationDiagnosticResult, HydrationMismatchActual, HydrationMismatchExpectation, } from "./hydration/diagnostics.js";
|
|
8
|
+
export type { HydrationDebugger } from "./hydration/hydration-debugger.js";
|
|
9
|
+
export { hydrationDebugger } from "./hydration/hydration-debugger.js";
|
|
6
10
|
export type { ViewBehaviorBoundaries, ViewBoundaries, } from "./hydration/target-builder.js";
|
|
7
|
-
export type { Disposable } from "./interfaces.js";
|
|
11
|
+
export type { Disposable, TrustedTypesPolicy } from "./interfaces.js";
|
|
8
12
|
export type { ExecutionContext, ExpressionController, SourceLifetime, } from "./observation/observable.js";
|
|
9
13
|
export type { ContentTemplate, ContentView, HydratableContentTemplate, } from "./templating/html-binding-directive.js";
|
|
10
14
|
export type { ViewBehavior, ViewBehaviorFactory, ViewBehaviorTargets, ViewController, } from "./templating/html-directive.js";
|
package/dist/dts/index.d.ts
CHANGED
|
@@ -1,3 +1,7 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Core APIs for building standards-based Web Components with FAST Element.
|
|
3
|
+
* @packageDocumentation
|
|
4
|
+
*/
|
|
1
5
|
export { AttributeConfiguration, AttributeDefinition, type AttributeMode, attr, booleanConverter, type DecoratorAttributeConfiguration, nullableBooleanConverter, nullableNumberConverter, type ValueConverter, } from "./attr.js";
|
|
2
6
|
export { Binding, type BindingDirective } from "./binding/binding.js";
|
|
3
7
|
export { normalizeBinding } from "./binding/normalize.js";
|
|
@@ -7,9 +11,9 @@ export { Signal, signal } from "./binding/signal.js";
|
|
|
7
11
|
export { type TwoWayBindingOptions, TwoWaySettings, twoWay, } from "./binding/two-way.js";
|
|
8
12
|
export type { ElementControllerStrategy } from "./components/element-controller.js";
|
|
9
13
|
export { ElementController, Stages, } from "./components/element-controller.js";
|
|
10
|
-
export type { FASTElementExtension, FASTElementTemplateResolver, PartialFASTElementDefinition, ShadowRootOptions, TypeRegistry, } from "./components/fast-definitions.js";
|
|
14
|
+
export type { FASTElementExtension, FASTElementTemplateResolver, PartialFASTElementDefinition, ShadowRootOptions, TypeDefinition, TypeRegistry, } from "./components/fast-definitions.js";
|
|
11
15
|
export { FASTElementDefinition, fastElementRegistry, type TemplateLifecycleCallbacks, } from "./components/fast-definitions.js";
|
|
12
|
-
export { customElement, FASTElement } from "./components/fast-element.js";
|
|
16
|
+
export { customElement, FASTElement, type FASTElementConstructor, } from "./components/fast-element.js";
|
|
13
17
|
export { enableDebug } from "./debug.js";
|
|
14
18
|
export { type ChildListDirectiveOptions, ChildrenDirective, type ChildrenDirectiveOptions, children, type SubtreeDirectiveOptions, } from "./directives/children.js";
|
|
15
19
|
export { type ElementsFilter, elements, type NodeBehaviorOptions, NodeObservationDirective, } from "./directives/node-observation.js";
|
|
@@ -17,7 +21,7 @@ export { RefDirective, ref } from "./directives/ref.js";
|
|
|
17
21
|
export { RepeatBehavior, RepeatDirective, type RepeatOptions, repeat, } from "./directives/repeat.js";
|
|
18
22
|
export { SlottedDirective, type SlottedDirectiveOptions, slotted, } from "./directives/slotted.js";
|
|
19
23
|
export { when } from "./directives/when.js";
|
|
20
|
-
export
|
|
24
|
+
export { DOM, DOMAspect, type DOMSink } from "./dom.js";
|
|
21
25
|
export { type DOMAspectGuards, type DOMElementGuards, type DOMGuards, DOMPolicy, type DOMPolicyOptions, type DOMSinkGuards, } from "./dom-policy.js";
|
|
22
26
|
export type { Callable, Class, Constructable, Disposable, TrustedTypesPolicy, } from "./interfaces.js";
|
|
23
27
|
export { ArrayObserver, type LengthObserver, lengthOf, Sort, type SortObserver, Splice, SpliceStrategy, SpliceStrategySupport, sortedCount, } from "./observation/arrays.js";
|
package/dist/dts/interfaces.d.ts
CHANGED
|
@@ -72,6 +72,7 @@ export declare const enum Message {
|
|
|
72
72
|
cannotSetTemplatePolicyAfterCompilation = 1208,
|
|
73
73
|
blockedByDOMPolicy = 1209,
|
|
74
74
|
invalidHydrationAttributeMarker = 1210,
|
|
75
|
+
duplicateRenderInstruction = 1211,
|
|
75
76
|
missingElementDefinition = 1401,
|
|
76
77
|
noRegistrationForContext = 1501,
|
|
77
78
|
noFactoryForResolver = 1502,
|
|
@@ -180,13 +180,13 @@ export declare const Observable: Readonly<{
|
|
|
180
180
|
* @param initialSubscriber - An initial subscriber to changes in the binding value.
|
|
181
181
|
* @param isVolatileBinding - Indicates whether the binding's dependency list must be re-evaluated on every value evaluation.
|
|
182
182
|
*/
|
|
183
|
-
binding<TSource = any, TReturn = any>(expression: Expression<TSource, TReturn
|
|
183
|
+
binding<TSource = any, TReturn = any>(expression: Expression<TSource, TReturn>, initialSubscriber?: Subscriber, isVolatileBinding?: boolean): ExpressionNotifier<TSource, TReturn>;
|
|
184
184
|
/**
|
|
185
185
|
* Determines whether a binding expression is volatile and needs to have its dependency list re-evaluated
|
|
186
186
|
* on every evaluation of the value.
|
|
187
187
|
* @param expression - The binding to inspect.
|
|
188
188
|
*/
|
|
189
|
-
isVolatileBinding<
|
|
189
|
+
isVolatileBinding<TSource = any, TReturn = any>(expression: Expression<TSource, TReturn>): boolean;
|
|
190
190
|
}>;
|
|
191
191
|
/**
|
|
192
192
|
* Decorator: Defines an observable property on the target.
|
|
@@ -270,7 +270,7 @@ export declare const ExecutionContext: Readonly<{
|
|
|
270
270
|
/**
|
|
271
271
|
* A default execution context.
|
|
272
272
|
*/
|
|
273
|
-
default: ExecutionContext
|
|
273
|
+
default: ExecutionContext;
|
|
274
274
|
/**
|
|
275
275
|
* Gets the current event.
|
|
276
276
|
* @returns An event object.
|
package/dist/dts/platform.d.ts
CHANGED
|
@@ -35,19 +35,35 @@ export declare function getDebugMessageLookup(): Record<number, string>;
|
|
|
35
35
|
*/
|
|
36
36
|
export declare const emptyArray: readonly never[];
|
|
37
37
|
/**
|
|
38
|
-
*
|
|
39
|
-
* @
|
|
38
|
+
* A type that can be registered with a `TypeRegistry`.
|
|
39
|
+
* @public
|
|
40
40
|
*/
|
|
41
41
|
export interface TypeDefinition {
|
|
42
|
+
/**
|
|
43
|
+
* The registered type constructor.
|
|
44
|
+
*/
|
|
42
45
|
type: Function;
|
|
43
46
|
}
|
|
44
47
|
/**
|
|
45
|
-
*
|
|
46
|
-
* @
|
|
48
|
+
* A registry that stores definitions by type.
|
|
49
|
+
* @public
|
|
47
50
|
*/
|
|
48
51
|
export interface TypeRegistry<TDefinition extends TypeDefinition> {
|
|
52
|
+
/**
|
|
53
|
+
* Registers a type definition.
|
|
54
|
+
* @param definition - The type definition to register.
|
|
55
|
+
* @returns `true` when the definition was registered, otherwise `false`.
|
|
56
|
+
*/
|
|
49
57
|
register(definition: TDefinition): boolean;
|
|
58
|
+
/**
|
|
59
|
+
* Gets a definition by type.
|
|
60
|
+
* @param key - The type to retrieve the definition for.
|
|
61
|
+
*/
|
|
50
62
|
getByType(key: Function): TDefinition | undefined;
|
|
63
|
+
/**
|
|
64
|
+
* Gets a definition by instance.
|
|
65
|
+
* @param object - The instance to retrieve the definition for.
|
|
66
|
+
*/
|
|
51
67
|
getForInstance(object: any): TDefinition | undefined;
|
|
52
68
|
}
|
|
53
69
|
/**
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { FASTElementDefinition, fastElementRegistry, type TypeDefinition, type TypeRegistry, } from "./components/fast-definitions.js";
|
|
@@ -59,4 +59,4 @@ export declare class ChildrenDirective extends NodeObservationDirective<Children
|
|
|
59
59
|
* @param propertyOrOptions - The options used to configure child node observation.
|
|
60
60
|
* @public
|
|
61
61
|
*/
|
|
62
|
-
export declare function children<TSource = any>(propertyOrOptions: (keyof TSource & string) | ChildrenDirectiveOptions<keyof TSource & string>): CaptureType
|
|
62
|
+
export declare function children<TSource = any, TParent = any>(propertyOrOptions: (keyof TSource & string) | ChildrenDirectiveOptions<keyof TSource & string>): CaptureType<TSource, TParent>;
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import type { Binding, BindingDirective } from "../binding/binding.js";
|
|
2
|
-
import { DOMAspect
|
|
2
|
+
import { DOMAspect } from "../dom.js";
|
|
3
|
+
import type { DOMPolicy } from "../dom-policy.js";
|
|
3
4
|
import { ExecutionContext, type Expression, type ExpressionObserver } from "../observation/observable.js";
|
|
4
5
|
import { type AddViewBehaviorFactory, type Aspected, HTMLDirective, type ViewBehavior, type ViewBehaviorFactory, type ViewController } from "./html-directive.js";
|
|
5
6
|
/**
|
|
@@ -65,7 +66,6 @@ export interface HydratableContentTemplate extends ContentTemplate {
|
|
|
65
66
|
* @public
|
|
66
67
|
*/
|
|
67
68
|
export declare class HTMLBindingDirective implements HTMLDirective, ViewBehaviorFactory, ViewBehavior, Aspected, BindingDirective {
|
|
68
|
-
dataBinding: Binding;
|
|
69
69
|
private data;
|
|
70
70
|
private updateTarget;
|
|
71
71
|
/**
|
|
@@ -96,6 +96,10 @@ export declare class HTMLBindingDirective implements HTMLDirective, ViewBehavior
|
|
|
96
96
|
* The type of aspect to target.
|
|
97
97
|
*/
|
|
98
98
|
aspectType: DOMAspect;
|
|
99
|
+
/**
|
|
100
|
+
* The binding configuration to apply.
|
|
101
|
+
*/
|
|
102
|
+
dataBinding: Binding;
|
|
99
103
|
/**
|
|
100
104
|
* Creates an instance of HTMLBindingDirective.
|
|
101
105
|
* @param dataBinding - The binding configuration to apply.
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import type { Binding } from "../binding/binding.js";
|
|
2
|
-
import { DOMAspect
|
|
2
|
+
import { DOMAspect } from "../dom.js";
|
|
3
|
+
import type { DOMPolicy } from "../dom-policy.js";
|
|
3
4
|
import type { Constructable } from "../interfaces.js";
|
|
4
5
|
import type { ExpressionController } from "../observation/observable.js";
|
|
5
6
|
/**
|
|
@@ -1,11 +1,12 @@
|
|
|
1
1
|
import { Hydratable } from "../components/hydration.js";
|
|
2
|
+
import { type HydrationMismatchActual, type HydrationMismatchExpectation } from "../hydration/diagnostics.js";
|
|
2
3
|
import { type ViewBehaviorBoundaries } from "../hydration/target-builder.js";
|
|
3
4
|
import { type ExecutionContext, SourceLifetime } from "../observation/observable.js";
|
|
4
5
|
import type { ViewTemplate } from "../templating/template.js";
|
|
5
6
|
import type { ViewBehaviorFactory, ViewBehaviorTargets, ViewController } from "./html-directive.js";
|
|
6
7
|
import { DefaultExecutionContext, type ElementView, type SyntheticView } from "./view.js";
|
|
7
8
|
/** @public */
|
|
8
|
-
export interface HydratableView<TSource = any, TParent = any> extends ElementView, SyntheticView, DefaultExecutionContext<TParent> {
|
|
9
|
+
export interface HydratableView<TSource = any, TParent = any> extends ElementView<TSource, TParent>, SyntheticView<TSource, TParent>, DefaultExecutionContext<TParent> {
|
|
9
10
|
[Hydratable]: symbol;
|
|
10
11
|
readonly bindingViewBoundaries: Record<string, ViewNodes>;
|
|
11
12
|
readonly hydrationStage: keyof typeof HydrationStage;
|
|
@@ -42,6 +43,16 @@ export declare class HydrationBindingError extends Error {
|
|
|
42
43
|
* threw the binding error.
|
|
43
44
|
*/
|
|
44
45
|
readonly templateString: string;
|
|
46
|
+
/**
|
|
47
|
+
* Structured description of the binding the hydration walk was
|
|
48
|
+
* attempting to apply when the mismatch was detected.
|
|
49
|
+
*/
|
|
50
|
+
readonly expected?: HydrationMismatchExpectation | undefined;
|
|
51
|
+
/**
|
|
52
|
+
* Structured description of the server-rendered DOM that was
|
|
53
|
+
* encountered at the mismatch point.
|
|
54
|
+
*/
|
|
55
|
+
readonly received?: HydrationMismatchActual | undefined;
|
|
45
56
|
constructor(
|
|
46
57
|
/**
|
|
47
58
|
* The error message
|
|
@@ -60,7 +71,17 @@ export declare class HydrationBindingError extends Error {
|
|
|
60
71
|
* String representation of the HTML in the template that
|
|
61
72
|
* threw the binding error.
|
|
62
73
|
*/
|
|
63
|
-
templateString: string
|
|
74
|
+
templateString: string,
|
|
75
|
+
/**
|
|
76
|
+
* Structured description of the binding the hydration walk was
|
|
77
|
+
* attempting to apply when the mismatch was detected.
|
|
78
|
+
*/
|
|
79
|
+
expected?: HydrationMismatchExpectation | undefined,
|
|
80
|
+
/**
|
|
81
|
+
* Structured description of the server-rendered DOM that was
|
|
82
|
+
* encountered at the mismatch point.
|
|
83
|
+
*/
|
|
84
|
+
received?: HydrationMismatchActual | undefined);
|
|
64
85
|
}
|
|
65
86
|
export declare class HydrationView<TSource = any, TParent = any> extends DefaultExecutionContext<TParent> implements HydratableView {
|
|
66
87
|
readonly firstChild: Node;
|
|
@@ -71,7 +92,7 @@ export declare class HydrationView<TSource = any, TParent = any> extends Default
|
|
|
71
92
|
context: ExecutionContext<any>;
|
|
72
93
|
source: TSource | null;
|
|
73
94
|
isBound: boolean;
|
|
74
|
-
get hydrationStage(): "
|
|
95
|
+
get hydrationStage(): "hydrated" | "hydrating" | "unhydrated";
|
|
75
96
|
get targets(): ViewBehaviorTargets;
|
|
76
97
|
get bindingViewBoundaries(): ViewBehaviorBoundaries;
|
|
77
98
|
readonly sourceLifetime: SourceLifetime;
|
|
@@ -20,4 +20,4 @@ export declare class RefDirective extends StatelessAttachedAttributeDirective<st
|
|
|
20
20
|
* @param propertyName - The name of the property to assign the reference to.
|
|
21
21
|
* @public
|
|
22
22
|
*/
|
|
23
|
-
export declare const ref: <TSource = any>(propertyName: keyof TSource & string) => CaptureType
|
|
23
|
+
export declare const ref: <TSource = any, TParent = any>(propertyName: keyof TSource & string) => CaptureType<TSource, TParent>;
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { Binding, type BindingDirective } from "../binding/binding.js";
|
|
2
2
|
import type { FASTElement } from "../components/fast-element.js";
|
|
3
|
-
import type { DOMPolicy } from "../dom.js";
|
|
3
|
+
import type { DOMPolicy } from "../dom-policy.js";
|
|
4
4
|
import { type Constructable } from "../interfaces.js";
|
|
5
5
|
import type { Subscriber } from "../observation/notifier.js";
|
|
6
6
|
import type { ExecutionContext, Expression, ExpressionObserver } from "../observation/observable.js";
|
|
@@ -314,5 +314,5 @@ export declare class NodeTemplate implements ContentTemplate, ContentView {
|
|
|
314
314
|
* RenderInstruction to determine the view.
|
|
315
315
|
* @public
|
|
316
316
|
*/
|
|
317
|
-
export declare function render<TSource = any, TItem = any, TParent = any>(value?: Expression<TSource, TItem> | Binding<TSource, TItem> | {}, template?: ContentTemplate | string | Expression<TSource, ContentTemplate | string | Node, TParent> | Binding<TSource, ContentTemplate | string | Node, TParent>): CaptureType
|
|
317
|
+
export declare function render<TSource = any, TItem = any, TParent = any>(value?: Expression<TSource, TItem> | Binding<TSource, TItem> | {}, template?: ContentTemplate | string | Expression<TSource, ContentTemplate | string | Node, TParent> | Binding<TSource, ContentTemplate | string | Node, TParent>): CaptureType<TSource, TParent>;
|
|
318
318
|
export {};
|
|
@@ -127,4 +127,4 @@ export declare class RepeatDirective<TSource = any> implements HTMLDirective, Vi
|
|
|
127
127
|
* @param options - Options used to turn on special repeat features.
|
|
128
128
|
* @public
|
|
129
129
|
*/
|
|
130
|
-
export declare function repeat<TSource = any, TArray extends ReadonlyArray<any> = ReadonlyArray<any>, TParent = any>(items: Expression<TSource, TArray, TParent> | Binding<TSource, TArray, TParent> | ReadonlyArray<any>, template: Expression<TSource, ViewTemplate<any, TSource>> | Binding<TSource, ViewTemplate<any, TSource>> | ViewTemplate<any, TSource>, options?: RepeatOptions): CaptureType
|
|
130
|
+
export declare function repeat<TSource = any, TArray extends ReadonlyArray<any> = ReadonlyArray<any>, TParent = any>(items: Expression<TSource, TArray, TParent> | Binding<TSource, TArray, TParent> | ReadonlyArray<any>, template: Expression<TSource, ViewTemplate<any, TSource>> | Binding<TSource, ViewTemplate<any, TSource>> | ViewTemplate<any, TSource>, options?: RepeatOptions): CaptureType<TSource, TParent>;
|