@microsoft/fast-element 2.10.4 → 3.0.0-rc.1
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/ARCHITECTURE_HTML_TAGGED_TEMPLATE_LITERAL.md +1 -1
- package/ARCHITECTURE_OVERVIEW.md +2 -2
- package/CHANGELOG.json +1 -1
- package/CHANGELOG.md +2 -2
- package/DECLARATIVE_DESIGN.md +806 -0
- package/DECLARATIVE_HTML.md +470 -0
- package/DECLARATIVE_MIGRATION.md +215 -0
- package/DECLARATIVE_RENDERING.md +530 -0
- package/DECLARATIVE_RENDERING_LIFECYCLE.md +288 -0
- package/DECLARATIVE_SCHEMA_OBSERVER_MAP.md +489 -0
- package/DESIGN.md +138 -33
- package/MIGRATION.md +387 -0
- package/README.md +208 -1
- package/SIZES.md +25 -0
- package/api-extractor.arrays.json +15 -0
- package/api-extractor.context.json +1 -0
- package/api-extractor.declarative.json +15 -0
- package/api-extractor.di.json +1 -0
- package/api-extractor.hydration.json +15 -0
- package/api-extractor.styles.json +15 -0
- package/dist/arrays/arrays.api.json +2621 -0
- package/dist/declarative/declarative.api.json +7844 -0
- package/dist/di/di.api.json +1 -1
- package/dist/dts/array-observer.d.ts +2 -0
- package/dist/dts/arrays.d.ts +2 -0
- package/dist/dts/attr.d.ts +1 -0
- package/dist/dts/binding/signal.d.ts +6 -6
- package/dist/dts/binding/two-way.d.ts +1 -0
- package/dist/dts/binding.d.ts +7 -0
- package/dist/dts/components/attributes.d.ts +2 -5
- package/dist/dts/components/definition-schema-transforms.d.ts +9 -0
- package/dist/dts/components/element-controller.d.ts +80 -114
- package/dist/dts/components/element-hydration.d.ts +1 -1
- package/dist/dts/components/enable-hydration.d.ts +34 -0
- package/dist/dts/components/fast-definitions.d.ts +91 -42
- package/dist/dts/components/fast-element.d.ts +5 -8
- package/dist/dts/components/hydration-tracker.d.ts +40 -0
- package/dist/dts/components/hydration.d.ts +18 -53
- package/dist/dts/components/schema.d.ts +205 -0
- package/dist/dts/context.d.ts +6 -6
- package/dist/dts/css.d.ts +3 -0
- package/dist/dts/debug.d.ts +5 -1
- package/dist/dts/declarative/attribute-map.d.ts +58 -0
- package/dist/dts/declarative/debug.d.ts +5 -0
- package/dist/dts/declarative/index.d.ts +13 -0
- package/dist/dts/declarative/interfaces.d.ts +9 -0
- package/dist/dts/declarative/observer-map-utilities.d.ts +58 -0
- package/dist/dts/declarative/observer-map.d.ts +89 -0
- package/dist/dts/declarative/runtime.d.ts +5 -0
- package/dist/dts/declarative/syntax.d.ts +21 -0
- package/dist/dts/declarative/template-bridge.d.ts +33 -0
- package/dist/dts/declarative/template-parser.d.ts +98 -0
- package/dist/dts/declarative/template.d.ts +9 -0
- package/dist/dts/declarative/utilities.d.ts +312 -0
- package/dist/dts/di/di.d.ts +1 -1
- package/dist/dts/directives/children.d.ts +2 -0
- package/dist/dts/directives/node-observation.d.ts +2 -0
- package/dist/dts/directives/ref.d.ts +2 -0
- package/dist/dts/directives/repeat.d.ts +4 -0
- package/dist/dts/directives/slotted.d.ts +2 -0
- package/dist/dts/directives/when.d.ts +3 -0
- package/dist/dts/dom-policy.d.ts +1 -1
- package/dist/dts/html.d.ts +5 -0
- package/dist/dts/hydration/runtime.d.ts +7 -0
- package/dist/dts/hydration/target-builder.d.ts +15 -12
- package/dist/dts/hydration.d.ts +14 -0
- package/dist/dts/index.d.ts +38 -42
- package/dist/dts/index.debug.d.ts +0 -1
- package/dist/dts/index.rollup.debug.d.ts +0 -1
- package/dist/dts/interfaces.d.ts +1 -49
- package/dist/dts/observable.d.ts +3 -6
- package/dist/dts/observation/arrays.d.ts +1 -1
- package/dist/dts/observation/update-queue.d.ts +1 -1
- package/dist/dts/platform.d.ts +25 -4
- package/dist/dts/render.d.ts +7 -0
- package/dist/dts/schema.d.ts +1 -0
- package/dist/dts/state/exports.d.ts +1 -1
- package/dist/dts/state/state.d.ts +2 -2
- package/dist/dts/styles/css-directive.d.ts +5 -12
- package/dist/dts/styles/css.d.ts +5 -7
- package/dist/dts/styles/element-styles.d.ts +0 -10
- package/dist/dts/styles.d.ts +6 -0
- package/dist/dts/templating/children.d.ts +1 -1
- package/dist/dts/templating/html-binding-directive.d.ts +4 -0
- package/dist/dts/templating/html-directive.d.ts +17 -0
- package/dist/dts/templating/hydration-view.d.ts +109 -0
- package/dist/dts/templating/ref.d.ts +1 -1
- package/dist/dts/templating/render.d.ts +1 -1
- package/dist/dts/templating/repeat.d.ts +2 -2
- package/dist/dts/templating/slotted.d.ts +1 -1
- package/dist/dts/templating/template.d.ts +17 -9
- package/dist/dts/templating/view.d.ts +25 -102
- package/dist/dts/templating/when.d.ts +1 -1
- package/dist/dts/templating.d.ts +10 -0
- package/dist/dts/testing/exports.d.ts +2 -2
- package/dist/dts/updates.d.ts +1 -0
- package/dist/dts/volatile.d.ts +2 -0
- package/dist/esm/array-observer.js +1 -0
- package/dist/esm/arrays.js +1 -0
- package/dist/esm/attr.js +1 -0
- package/dist/esm/binding/normalize.js +1 -1
- package/dist/esm/binding/signal.js +4 -4
- package/dist/esm/binding/two-way.js +2 -1
- package/dist/esm/binding.js +4 -0
- package/dist/esm/components/attributes.js +8 -5
- package/dist/esm/components/definition-schema-transforms.js +23 -0
- package/dist/esm/components/element-controller.js +200 -269
- package/dist/esm/components/element-hydration.js +1 -1
- package/dist/esm/components/enable-hydration.js +100 -0
- package/dist/esm/components/fast-definitions.js +211 -49
- package/dist/esm/components/fast-element.js +18 -27
- package/dist/esm/components/hydration-tracker.js +93 -0
- package/dist/esm/components/hydration.js +62 -144
- package/dist/esm/components/schema.js +253 -0
- package/dist/esm/context.js +6 -6
- package/dist/esm/css.js +3 -0
- package/dist/esm/debug.js +26 -26
- package/dist/esm/declarative/attribute-map.js +121 -0
- package/dist/esm/declarative/debug.js +5 -0
- package/dist/esm/declarative/index.js +3 -0
- package/dist/esm/declarative/interfaces.js +10 -0
- package/dist/esm/declarative/observer-map-utilities.js +562 -0
- package/dist/esm/declarative/observer-map.js +216 -0
- package/dist/esm/declarative/runtime.js +14 -0
- package/dist/esm/declarative/syntax.js +36 -0
- package/dist/esm/declarative/template-bridge.js +170 -0
- package/dist/esm/declarative/template-parser.js +306 -0
- package/dist/esm/declarative/template.js +142 -0
- package/dist/esm/declarative/utilities.js +834 -0
- package/dist/esm/di/di.js +6 -8
- package/dist/esm/directives/children.js +1 -0
- package/dist/esm/directives/node-observation.js +1 -0
- package/dist/esm/directives/ref.js +1 -0
- package/dist/esm/directives/repeat.js +1 -0
- package/dist/esm/directives/slotted.js +1 -0
- package/dist/esm/directives/when.js +1 -0
- package/dist/esm/dom-policy.js +2 -2
- package/dist/esm/dom.js +1 -1
- package/dist/esm/html.js +2 -0
- package/dist/esm/hydration/runtime.js +33 -0
- package/dist/esm/hydration/target-builder.js +97 -90
- package/dist/esm/hydration.js +4 -0
- package/dist/esm/index.debug.js +2 -1
- package/dist/esm/index.js +34 -29
- package/dist/esm/index.rollup.debug.js +3 -2
- package/dist/esm/index.rollup.js +1 -1
- package/dist/esm/interfaces.js +1 -45
- package/dist/esm/observable.js +1 -4
- package/dist/esm/observation/arrays.js +1 -1
- package/dist/esm/observation/observable.js +5 -5
- package/dist/esm/observation/update-queue.js +47 -58
- package/dist/esm/platform.js +31 -30
- package/dist/esm/render.js +1 -0
- package/dist/esm/schema.js +1 -0
- package/dist/esm/state/exports.js +1 -1
- package/dist/esm/styles/css-directive.js +1 -2
- package/dist/esm/styles/css.js +15 -56
- package/dist/esm/styles/element-styles.js +69 -15
- package/dist/esm/styles.js +2 -0
- package/dist/esm/templating/html-binding-directive.js +10 -8
- package/dist/esm/templating/hydration-view.js +235 -0
- package/dist/esm/templating/render.js +1 -1
- package/dist/esm/templating/repeat.js +36 -34
- package/dist/esm/templating/template.js +7 -7
- package/dist/esm/templating/view.js +24 -233
- package/dist/esm/templating.js +7 -0
- package/dist/esm/testing/exports.js +2 -2
- package/dist/esm/updates.js +1 -0
- package/dist/esm/volatile.js +1 -0
- package/dist/fast-element.api.json +9016 -6995
- package/dist/fast-element.d.ts +3557 -796
- package/dist/fast-element.debug.js +5088 -4437
- package/dist/fast-element.debug.min.js +2 -2
- package/dist/fast-element.js +5369 -4649
- package/dist/fast-element.min.js +2 -2
- package/dist/fast-element.untrimmed.d.ts +863 -475
- package/dist/hydration/hydration.api.json +5237 -0
- package/dist/styles/styles.api.json +2672 -0
- package/docs/api-report.api.md +343 -166
- package/docs/arrays/api-report.api.md +114 -0
- package/docs/declarative/api-report.api.md +397 -0
- package/docs/hydration/api-report.api.md +285 -0
- package/docs/styles/api-report.api.md +135 -0
- package/package.json +149 -41
- package/playwright.declarative.config.ts +26 -0
- package/playwright.declarative.webui.config.ts +20 -0
- package/scripts/declarative/build-fixtures-with-webui.js +135 -0
- package/scripts/declarative/build-fixtures.js +49 -0
- package/scripts/declarative/build-fixtures.utilities.js +101 -0
- package/scripts/measure-sizes.js +219 -0
- package/scripts/run-api-extractor.js +39 -20
- package/test/declarative/fixtures/README.md +72 -0
- package/test/declarative/fixtures/WRITING_FIXTURES.md +330 -0
- package/test/declarative/fixtures/bindings/README.md +12 -0
- package/test/declarative/fixtures/bindings/attribute/entry.html +13 -0
- package/test/declarative/fixtures/bindings/attribute/fast-build.config.json +6 -0
- package/test/declarative/fixtures/bindings/attribute/index.html +25 -0
- package/test/declarative/fixtures/bindings/attribute/main.ts +41 -0
- package/test/declarative/fixtures/bindings/attribute/state.json +8 -0
- package/test/declarative/fixtures/bindings/attribute/templates.html +11 -0
- package/test/declarative/fixtures/bindings/content/entry.html +12 -0
- package/test/declarative/fixtures/bindings/content/fast-build.config.json +6 -0
- package/test/declarative/fixtures/bindings/content/index.html +19 -0
- package/test/declarative/fixtures/bindings/content/main.ts +27 -0
- package/test/declarative/fixtures/bindings/content/state.json +4 -0
- package/test/declarative/fixtures/bindings/content/templates.html +6 -0
- package/test/declarative/fixtures/bindings/dot-syntax/entry.html +11 -0
- package/test/declarative/fixtures/bindings/dot-syntax/fast-build.config.json +6 -0
- package/test/declarative/fixtures/bindings/dot-syntax/index.html +47 -0
- package/test/declarative/fixtures/bindings/dot-syntax/main.ts +59 -0
- package/test/declarative/fixtures/bindings/dot-syntax/state.json +16 -0
- package/test/declarative/fixtures/bindings/dot-syntax/templates.html +17 -0
- package/test/declarative/fixtures/bindings/event/entry.html +11 -0
- package/test/declarative/fixtures/bindings/event/fast-build.config.json +6 -0
- package/test/declarative/fixtures/bindings/event/index.html +43 -0
- package/test/declarative/fixtures/bindings/event/main.ts +43 -0
- package/test/declarative/fixtures/bindings/event/state.json +3 -0
- package/test/declarative/fixtures/bindings/event/templates.html +18 -0
- package/test/declarative/fixtures/bindings/host/entry.html +40 -0
- package/test/declarative/fixtures/bindings/host/fast-build.config.json +6 -0
- package/test/declarative/fixtures/bindings/host/index.html +96 -0
- package/test/declarative/fixtures/bindings/host/main.ts +222 -0
- package/test/declarative/fixtures/bindings/host/state.json +9 -0
- package/test/declarative/fixtures/bindings/host/templates.html +55 -0
- package/test/declarative/fixtures/directives/README.md +12 -0
- package/test/declarative/fixtures/directives/children/entry.html +11 -0
- package/test/declarative/fixtures/directives/children/fast-build.config.json +6 -0
- package/test/declarative/fixtures/directives/children/index.html +15 -0
- package/test/declarative/fixtures/directives/children/main.ts +22 -0
- package/test/declarative/fixtures/directives/children/state.json +3 -0
- package/test/declarative/fixtures/directives/children/templates.html +3 -0
- package/test/declarative/fixtures/directives/ref/entry.html +11 -0
- package/test/declarative/fixtures/directives/ref/fast-build.config.json +6 -0
- package/test/declarative/fixtures/directives/ref/index.html +15 -0
- package/test/declarative/fixtures/directives/ref/main.ts +17 -0
- package/test/declarative/fixtures/directives/ref/state.json +1 -0
- package/test/declarative/fixtures/directives/ref/templates.html +3 -0
- package/test/declarative/fixtures/directives/repeat/entry.html +21 -0
- package/test/declarative/fixtures/directives/repeat/fast-build.config.json +6 -0
- package/test/declarative/fixtures/directives/repeat/index.html +133 -0
- package/test/declarative/fixtures/directives/repeat/main.ts +110 -0
- package/test/declarative/fixtures/directives/repeat/sprites.svg +8 -0
- package/test/declarative/fixtures/directives/repeat/state.json +10 -0
- package/test/declarative/fixtures/directives/repeat/templates.html +75 -0
- package/test/declarative/fixtures/directives/slotted/entry.html +17 -0
- package/test/declarative/fixtures/directives/slotted/fast-build.config.json +6 -0
- package/test/declarative/fixtures/directives/slotted/index.html +27 -0
- package/test/declarative/fixtures/directives/slotted/main.ts +29 -0
- package/test/declarative/fixtures/directives/slotted/state.json +1 -0
- package/test/declarative/fixtures/directives/slotted/templates.html +7 -0
- package/test/declarative/fixtures/directives/when/entry.html +51 -0
- package/test/declarative/fixtures/directives/when/fast-build.config.json +6 -0
- package/test/declarative/fixtures/directives/when/index.html +136 -0
- package/test/declarative/fixtures/directives/when/main.ts +172 -0
- package/test/declarative/fixtures/directives/when/state.json +12 -0
- package/test/declarative/fixtures/directives/when/templates.html +75 -0
- package/test/declarative/fixtures/ecosystem/README.md +11 -0
- package/test/declarative/fixtures/ecosystem/declarative-no-hydration/entry.html +12 -0
- package/test/declarative/fixtures/ecosystem/declarative-no-hydration/fast-build.config.json +6 -0
- package/test/declarative/fixtures/ecosystem/declarative-no-hydration/index.html +20 -0
- package/test/declarative/fixtures/ecosystem/declarative-no-hydration/main.ts +68 -0
- package/test/declarative/fixtures/ecosystem/declarative-no-hydration/state.json +4 -0
- package/test/declarative/fixtures/ecosystem/declarative-no-hydration/templates.html +7 -0
- package/test/declarative/fixtures/ecosystem/errors/entry.html +12 -0
- package/test/declarative/fixtures/ecosystem/errors/fast-build.config.json +6 -0
- package/test/declarative/fixtures/ecosystem/errors/index.html +20 -0
- package/test/declarative/fixtures/ecosystem/errors/main.ts +17 -0
- package/test/declarative/fixtures/ecosystem/errors/state.json +1 -0
- package/test/declarative/fixtures/ecosystem/errors/templates.html +7 -0
- package/test/declarative/fixtures/ecosystem/lifecycle-callbacks/entry.html +17 -0
- package/test/declarative/fixtures/ecosystem/lifecycle-callbacks/fast-build.config.json +6 -0
- package/test/declarative/fixtures/ecosystem/lifecycle-callbacks/index.html +56 -0
- package/test/declarative/fixtures/ecosystem/lifecycle-callbacks/main.ts +134 -0
- package/test/declarative/fixtures/ecosystem/lifecycle-callbacks/state.json +12 -0
- package/test/declarative/fixtures/ecosystem/lifecycle-callbacks/templates.html +34 -0
- package/test/declarative/fixtures/ecosystem/performance-metrics/entry.html +25 -0
- package/test/declarative/fixtures/ecosystem/performance-metrics/fast-build.config.json +6 -0
- package/test/declarative/fixtures/ecosystem/performance-metrics/fast-card.css +10 -0
- package/test/declarative/fixtures/ecosystem/performance-metrics/index.html +181 -0
- package/test/declarative/fixtures/ecosystem/performance-metrics/main.ts +58 -0
- package/test/declarative/fixtures/ecosystem/performance-metrics/state.json +6 -0
- package/test/declarative/fixtures/ecosystem/performance-metrics/templates.html +15 -0
- package/test/declarative/fixtures/extensions/README.md +15 -0
- package/test/declarative/fixtures/extensions/attribute-map/entry.html +14 -0
- package/test/declarative/fixtures/extensions/attribute-map/fast-build.config.json +6 -0
- package/test/declarative/fixtures/extensions/attribute-map/index.html +31 -0
- package/test/declarative/fixtures/extensions/attribute-map/main.ts +40 -0
- package/test/declarative/fixtures/extensions/attribute-map/state.json +4 -0
- package/test/declarative/fixtures/extensions/attribute-map/templates.html +14 -0
- package/test/declarative/fixtures/extensions/attribute-map-naming-strategy/entry.html +12 -0
- package/test/declarative/fixtures/extensions/attribute-map-naming-strategy/fast-build.config.json +7 -0
- package/test/declarative/fixtures/extensions/attribute-map-naming-strategy/index.html +25 -0
- package/test/declarative/fixtures/extensions/attribute-map-naming-strategy/main.ts +31 -0
- package/test/declarative/fixtures/extensions/attribute-map-naming-strategy/state.json +5 -0
- package/test/declarative/fixtures/extensions/attribute-map-naming-strategy/templates.html +11 -0
- package/test/declarative/fixtures/extensions/attribute-map-naming-strategy-camel-case/entry.html +13 -0
- package/test/declarative/fixtures/extensions/attribute-map-naming-strategy-camel-case/fast-build.config.json +7 -0
- package/test/declarative/fixtures/extensions/attribute-map-naming-strategy-camel-case/index.html +23 -0
- package/test/declarative/fixtures/extensions/attribute-map-naming-strategy-camel-case/main.ts +37 -0
- package/test/declarative/fixtures/extensions/attribute-map-naming-strategy-camel-case/state.json +1 -0
- package/test/declarative/fixtures/extensions/attribute-map-naming-strategy-camel-case/templates.html +9 -0
- package/test/declarative/fixtures/extensions/observer-map/entry.html +15 -0
- package/test/declarative/fixtures/extensions/observer-map/fast-build.config.json +6 -0
- package/test/declarative/fixtures/extensions/observer-map/index.html +442 -0
- package/test/declarative/fixtures/extensions/observer-map/main.ts +482 -0
- package/test/declarative/fixtures/extensions/observer-map/state.json +158 -0
- package/test/declarative/fixtures/extensions/observer-map/templates.html +172 -0
- package/test/declarative/fixtures/extensions/observer-map-config-object/entry.html +16 -0
- package/test/declarative/fixtures/extensions/observer-map-config-object/fast-build.config.json +6 -0
- package/test/declarative/fixtures/extensions/observer-map-config-object/index.html +27 -0
- package/test/declarative/fixtures/extensions/observer-map-config-object/main.ts +53 -0
- package/test/declarative/fixtures/extensions/observer-map-config-object/state.json +9 -0
- package/test/declarative/fixtures/extensions/observer-map-config-object/templates.html +12 -0
- package/test/declarative/fixtures/extensions/observer-map-deep-merge/README.md +98 -0
- package/test/declarative/fixtures/extensions/observer-map-deep-merge/entry.html +156 -0
- package/test/declarative/fixtures/extensions/observer-map-deep-merge/fast-build.config.json +6 -0
- package/test/declarative/fixtures/extensions/observer-map-deep-merge/index.html +376 -0
- package/test/declarative/fixtures/extensions/observer-map-deep-merge/main.ts +366 -0
- package/test/declarative/fixtures/extensions/observer-map-deep-merge/state.json +69 -0
- package/test/declarative/fixtures/extensions/observer-map-deep-merge/templates.html +91 -0
- package/test/declarative/fixtures/extensions/observer-map-properties/entry.html +14 -0
- package/test/declarative/fixtures/extensions/observer-map-properties/fast-build.config.json +6 -0
- package/test/declarative/fixtures/extensions/observer-map-properties/index.html +110 -0
- package/test/declarative/fixtures/extensions/observer-map-properties/main.ts +175 -0
- package/test/declarative/fixtures/extensions/observer-map-properties/state.json +29 -0
- package/test/declarative/fixtures/extensions/observer-map-properties/templates.html +55 -0
- package/test/declarative/fixtures/scenarios/README.md +7 -0
- package/test/declarative/fixtures/scenarios/nested-elements/entry.html +16 -0
- package/test/declarative/fixtures/scenarios/nested-elements/fast-build.config.json +6 -0
- package/test/declarative/fixtures/scenarios/nested-elements/index.html +126 -0
- package/test/declarative/fixtures/scenarios/nested-elements/main.ts +214 -0
- package/test/declarative/fixtures/scenarios/nested-elements/state.json +10 -0
- package/test/declarative/fixtures/scenarios/nested-elements/templates.html +54 -0
- package/test/declarative/index.html +12 -0
- package/test/declarative/vite.config.ts +55 -0
- package/test/declarative-main.ts +6 -0
- package/test/extension-subpaths-main.ts +9 -0
- package/test/main.ts +38 -33
- package/test/pure-declarative-main.ts +1 -0
- package/dist/dts/components/install-hydration.d.ts +0 -1
- package/dist/dts/pending-task.d.ts +0 -32
- package/dist/dts/polyfills.d.ts +0 -0
- package/dist/dts/styles/css-binding-directive.d.ts +0 -60
- package/dist/dts/templating/install-hydratable-view-templates.d.ts +0 -1
- package/dist/esm/components/install-hydration.js +0 -3
- package/dist/esm/pending-task.js +0 -28
- package/dist/esm/polyfills.js +0 -60
- package/dist/esm/styles/css-binding-directive.js +0 -76
- package/dist/esm/templating/install-hydratable-view-templates.js +0 -23
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Options for configuring global hydration lifecycle events.
|
|
3
|
+
* @public
|
|
4
|
+
*/
|
|
5
|
+
export interface HydrationOptions {
|
|
6
|
+
/** Called once when the first prerendered element begins hydrating. */
|
|
7
|
+
hydrationStarted?(): void;
|
|
8
|
+
/** Called after all prerendered elements have completed hydration. */
|
|
9
|
+
hydrationComplete?(): void;
|
|
10
|
+
}
|
|
11
|
+
/**
|
|
12
|
+
* Tracks prerendered elements through the hydration lifecycle and
|
|
13
|
+
* fires global callbacks at start and completion. Per-element callbacks
|
|
14
|
+
* (`elementWillHydrate`, `elementDidHydrate`) are handled through
|
|
15
|
+
* definition-level `TemplateLifecycleCallbacks`.
|
|
16
|
+
*
|
|
17
|
+
* @public
|
|
18
|
+
*/
|
|
19
|
+
export declare class HydrationTracker {
|
|
20
|
+
private options;
|
|
21
|
+
private elements;
|
|
22
|
+
private started;
|
|
23
|
+
private checkTimer;
|
|
24
|
+
constructor(options: HydrationOptions);
|
|
25
|
+
/**
|
|
26
|
+
* Registers an element as pending hydration.
|
|
27
|
+
* Fires `hydrationStarted` on the first call.
|
|
28
|
+
*/
|
|
29
|
+
add(element: HTMLElement): void;
|
|
30
|
+
/**
|
|
31
|
+
* Removes an element from the pending set and schedules
|
|
32
|
+
* a debounced completion check.
|
|
33
|
+
*/
|
|
34
|
+
remove(element: HTMLElement): void;
|
|
35
|
+
/**
|
|
36
|
+
* Merges additional options into the tracker, chaining
|
|
37
|
+
* callbacks so both the original and new callbacks fire.
|
|
38
|
+
*/
|
|
39
|
+
mergeOptions(incoming: HydrationOptions): void;
|
|
40
|
+
}
|
|
@@ -1,63 +1,33 @@
|
|
|
1
1
|
import type { ContentTemplate, HydratableContentTemplate } from "../templating/html-binding-directive.js";
|
|
2
2
|
import type { ViewController } from "../templating/html-directive.js";
|
|
3
|
+
import type { HydratableViewController } from "../templating/hydration-view.js";
|
|
3
4
|
import type { ElementViewTemplate, HydratableElementViewTemplate, HydratableSyntheticViewTemplate, SyntheticViewTemplate } from "../templating/template.js";
|
|
4
|
-
import type { HydrationView } from "../templating/view.js";
|
|
5
5
|
/**
|
|
6
6
|
* Markup utilities to aid in template hydration.
|
|
7
7
|
* @internal
|
|
8
8
|
*/
|
|
9
9
|
export declare const HydrationMarkup: Readonly<{
|
|
10
|
-
attributeMarkerName: "data-fe
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
isContentBindingStartMarker(
|
|
18
|
-
isContentBindingEndMarker(
|
|
19
|
-
isRepeatViewStartMarker(
|
|
20
|
-
isRepeatViewEndMarker(
|
|
10
|
+
attributeMarkerName: "data-fe";
|
|
11
|
+
contentBindingStartMarker(): string;
|
|
12
|
+
contentBindingEndMarker(): string;
|
|
13
|
+
repeatStartMarker(): string;
|
|
14
|
+
repeatEndMarker(): string;
|
|
15
|
+
elementBoundaryStartMarker(): string;
|
|
16
|
+
elementBoundaryEndMarker(): string;
|
|
17
|
+
isContentBindingStartMarker(data: string): boolean;
|
|
18
|
+
isContentBindingEndMarker(data: string): boolean;
|
|
19
|
+
isRepeatViewStartMarker(data: string): boolean;
|
|
20
|
+
isRepeatViewEndMarker(data: string): boolean;
|
|
21
21
|
isElementBoundaryStartMarker(node: Node): boolean;
|
|
22
22
|
isElementBoundaryEndMarker(node: Node): boolean;
|
|
23
23
|
/**
|
|
24
|
-
* Returns the
|
|
25
|
-
*
|
|
24
|
+
* Returns the count of attribute bindings on the element, or null
|
|
25
|
+
* if no attribute binding marker is present.
|
|
26
26
|
*
|
|
27
|
-
*
|
|
27
|
+
* Parses the `data-fe="N"` attribute format where N is the count
|
|
28
|
+
* of attribute binding factories targeting this element.
|
|
28
29
|
*/
|
|
29
|
-
|
|
30
|
-
/**
|
|
31
|
-
* Returns the indexes of the ViewBehaviorFactories affecting
|
|
32
|
-
* attributes for the element, or null if no factories were found.
|
|
33
|
-
*
|
|
34
|
-
* This method parses the enumerated format: `data-fe-b-0`, `data-fe-b-1`, `data-fe-b-2`.
|
|
35
|
-
* This is an alternative format that uses separate attributes for each binding index.
|
|
36
|
-
*/
|
|
37
|
-
parseEnumeratedAttributeBinding(node: Element): null | number[];
|
|
38
|
-
/**
|
|
39
|
-
* Returns the indexes of the ViewBehaviorFactories affecting
|
|
40
|
-
* attributes for the element, or null if no factories were found.
|
|
41
|
-
*
|
|
42
|
-
* This method parses the compact format: `data-fe-c-{index}-{count}`.
|
|
43
|
-
*/
|
|
44
|
-
parseCompactAttributeBinding(node: Element): null | number[];
|
|
45
|
-
/**
|
|
46
|
-
* Parses the ViewBehaviorFactory index from string data. Returns
|
|
47
|
-
* the binding index or null if the index cannot be retrieved.
|
|
48
|
-
*/
|
|
49
|
-
parseContentBindingStartMarker(content: string): null | [index: number, id: string];
|
|
50
|
-
parseContentBindingEndMarker(content: string): null | [index: number, id: string];
|
|
51
|
-
/**
|
|
52
|
-
* Parses the index of a repeat directive from a content string.
|
|
53
|
-
*/
|
|
54
|
-
parseRepeatStartMarker(content: string): null | number;
|
|
55
|
-
parseRepeatEndMarker(content: string): null | number;
|
|
56
|
-
/**
|
|
57
|
-
* Parses element Id from element boundary markers
|
|
58
|
-
*/
|
|
59
|
-
parseElementBoundaryStartMarker(content: string): null | string;
|
|
60
|
-
parseElementBoundaryEndMarker(content: string): null | string;
|
|
30
|
+
parseAttributeBindingCount(node: Element): number | null;
|
|
61
31
|
}>;
|
|
62
32
|
/**
|
|
63
33
|
* @internal
|
|
@@ -68,15 +38,10 @@ export declare const Hydratable: unique symbol;
|
|
|
68
38
|
*
|
|
69
39
|
* @beta
|
|
70
40
|
*/
|
|
71
|
-
export declare function isHydratable(view: ViewController): view is
|
|
41
|
+
export declare function isHydratable(view: ViewController): view is HydratableViewController;
|
|
72
42
|
/** @beta */
|
|
73
43
|
export declare function isHydratable<TSource = any, TParent = any>(template: SyntheticViewTemplate<TSource, TParent>): template is HydratableSyntheticViewTemplate<TSource, TParent>;
|
|
74
44
|
/** @beta */
|
|
75
45
|
export declare function isHydratable<TSource = any, TParent = any>(template: ElementViewTemplate<TSource, TParent>): template is HydratableElementViewTemplate<TSource, TParent>;
|
|
76
46
|
/** @beta */
|
|
77
47
|
export declare function isHydratable(template: ContentTemplate): template is HydratableContentTemplate;
|
|
78
|
-
/**
|
|
79
|
-
* The attribute used to defer hydration of an element.
|
|
80
|
-
* @beta
|
|
81
|
-
*/
|
|
82
|
-
export declare const deferHydrationAttribute = "defer-hydration";
|
|
@@ -0,0 +1,205 @@
|
|
|
1
|
+
type FastContextMetaData = "$fast_context";
|
|
2
|
+
type FastContextsMetaData = "$fast_parent_contexts";
|
|
3
|
+
/**
|
|
4
|
+
* Describes a child custom element binding referenced by a schema path.
|
|
5
|
+
* @public
|
|
6
|
+
*/
|
|
7
|
+
export interface ChildrenMap {
|
|
8
|
+
customElementName: string;
|
|
9
|
+
attributeName: string;
|
|
10
|
+
}
|
|
11
|
+
/**
|
|
12
|
+
* A reusable JSON schema definition.
|
|
13
|
+
* @public
|
|
14
|
+
*/
|
|
15
|
+
export interface JSONSchemaDefinition extends JSONSchemaCommon {
|
|
16
|
+
$fast_context: string;
|
|
17
|
+
$fast_parent_contexts: Array<string>;
|
|
18
|
+
}
|
|
19
|
+
/**
|
|
20
|
+
* Common properties shared by schema nodes.
|
|
21
|
+
* @public
|
|
22
|
+
*/
|
|
23
|
+
export interface JSONSchemaCommon {
|
|
24
|
+
type?: string;
|
|
25
|
+
properties?: any;
|
|
26
|
+
items?: any;
|
|
27
|
+
anyOf?: Array<any>;
|
|
28
|
+
$ref?: string;
|
|
29
|
+
/**
|
|
30
|
+
* Stamped by `applyConfigToSchema` when an `ObserverMapConfig` excludes
|
|
31
|
+
* this path. When `false`, the proxy system skips observation for this
|
|
32
|
+
* node and (if all descendants are also `false`) its subtree.
|
|
33
|
+
*/
|
|
34
|
+
$observe?: boolean;
|
|
35
|
+
}
|
|
36
|
+
/**
|
|
37
|
+
* A JSON schema describing a root property.
|
|
38
|
+
* @public
|
|
39
|
+
*/
|
|
40
|
+
export interface JSONSchema extends JSONSchemaCommon {
|
|
41
|
+
$schema: string;
|
|
42
|
+
$id: string;
|
|
43
|
+
$defs?: Record<string, JSONSchemaDefinition>;
|
|
44
|
+
}
|
|
45
|
+
/**
|
|
46
|
+
* Common metadata for paths cached while parsing a template.
|
|
47
|
+
* @public
|
|
48
|
+
*/
|
|
49
|
+
export interface CachedPathCommon {
|
|
50
|
+
parentContext: string | null;
|
|
51
|
+
currentContext: string | null;
|
|
52
|
+
path: string;
|
|
53
|
+
}
|
|
54
|
+
/**
|
|
55
|
+
* A path discovered from an access expression.
|
|
56
|
+
* @public
|
|
57
|
+
*/
|
|
58
|
+
export interface AccessCachedPath extends CachedPathCommon {
|
|
59
|
+
type: "access";
|
|
60
|
+
}
|
|
61
|
+
/**
|
|
62
|
+
* A path discovered from a default binding.
|
|
63
|
+
* @public
|
|
64
|
+
*/
|
|
65
|
+
export interface DefaultCachedPath extends CachedPathCommon {
|
|
66
|
+
type: "default";
|
|
67
|
+
}
|
|
68
|
+
/**
|
|
69
|
+
* A path discovered from an event binding.
|
|
70
|
+
* @public
|
|
71
|
+
*/
|
|
72
|
+
export interface EventCachedPath extends CachedPathCommon {
|
|
73
|
+
type: "event";
|
|
74
|
+
}
|
|
75
|
+
/**
|
|
76
|
+
* A path discovered from a repeat directive.
|
|
77
|
+
* @public
|
|
78
|
+
*/
|
|
79
|
+
export interface RepeatCachedPath extends CachedPathCommon {
|
|
80
|
+
type: "repeat";
|
|
81
|
+
}
|
|
82
|
+
/**
|
|
83
|
+
* A path discovered while parsing a template.
|
|
84
|
+
* @public
|
|
85
|
+
*/
|
|
86
|
+
export type CachedPath = DefaultCachedPath | RepeatCachedPath | AccessCachedPath | EventCachedPath;
|
|
87
|
+
/**
|
|
88
|
+
* A map from element names and root properties to JSON schemas.
|
|
89
|
+
* @public
|
|
90
|
+
*/
|
|
91
|
+
export type CachedPathMap = Map<string, Map<string, JSONSchema>>;
|
|
92
|
+
/**
|
|
93
|
+
* Configuration for registering a path with a schema.
|
|
94
|
+
* @public
|
|
95
|
+
*/
|
|
96
|
+
export interface RegisterPathConfig {
|
|
97
|
+
rootPropertyName: string;
|
|
98
|
+
pathConfig: CachedPath;
|
|
99
|
+
childrenMap: ChildrenMap | null;
|
|
100
|
+
}
|
|
101
|
+
export declare const fastContextMetaData: FastContextMetaData;
|
|
102
|
+
export declare const fastContextsMetaData: FastContextsMetaData;
|
|
103
|
+
export declare const defsPropertyName = "$defs";
|
|
104
|
+
export declare const refPropertyName = "$ref";
|
|
105
|
+
/**
|
|
106
|
+
* Module-level registry that maps custom element names to their schema maps.
|
|
107
|
+
* Used for cross-element `$ref` resolution (e.g. nested element schemas).
|
|
108
|
+
* Each Schema instance registers itself here on construction.
|
|
109
|
+
* @public
|
|
110
|
+
*/
|
|
111
|
+
export declare const schemaRegistry: CachedPathMap;
|
|
112
|
+
/**
|
|
113
|
+
* A constructed JSON schema from a template
|
|
114
|
+
* @public
|
|
115
|
+
*/
|
|
116
|
+
export declare class Schema {
|
|
117
|
+
/**
|
|
118
|
+
* The name of the custom element
|
|
119
|
+
*/
|
|
120
|
+
private customElementName;
|
|
121
|
+
/**
|
|
122
|
+
* Instance-level JSON schema map describing each root property
|
|
123
|
+
*/
|
|
124
|
+
private schemaMap;
|
|
125
|
+
constructor(name: string);
|
|
126
|
+
/**
|
|
127
|
+
* Add a path to a schema
|
|
128
|
+
* @param config - The path registration configuration.
|
|
129
|
+
*/
|
|
130
|
+
addPath(config: RegisterPathConfig): void;
|
|
131
|
+
/**
|
|
132
|
+
* Gets the JSON schema for a property name
|
|
133
|
+
* @param rootPropertyName - the root property the JSON schema is mapped to
|
|
134
|
+
* @returns The JSON schema for the root property
|
|
135
|
+
*/
|
|
136
|
+
getSchema(rootPropertyName: string): JSONSchema | null;
|
|
137
|
+
/**
|
|
138
|
+
* Gets root properties
|
|
139
|
+
* @returns IterableIterator<string>
|
|
140
|
+
*/
|
|
141
|
+
getRootProperties(): IterableIterator<string>;
|
|
142
|
+
/**
|
|
143
|
+
* Get a path split into property names
|
|
144
|
+
* @param path - The dot syntax path, e.g. `a.b.c`.
|
|
145
|
+
* @returns An array of items in the path
|
|
146
|
+
*/
|
|
147
|
+
private getSplitPath;
|
|
148
|
+
/**
|
|
149
|
+
* Gets the path to the $def
|
|
150
|
+
* @param context - The context name. For example, `item in items` creates the `item` context.
|
|
151
|
+
* @returns A string to use as a $ref
|
|
152
|
+
*/
|
|
153
|
+
private getDefsPath;
|
|
154
|
+
/**
|
|
155
|
+
* Get the schema $id
|
|
156
|
+
* @param customElementName - The custom element name
|
|
157
|
+
* @param propertyName - The property name
|
|
158
|
+
* @returns The ID that can be used in the JSON schema as $id
|
|
159
|
+
*/
|
|
160
|
+
private getSchemaId;
|
|
161
|
+
/**
|
|
162
|
+
* Add a new JSON schema to the JSON schema map
|
|
163
|
+
* @param propertyName - The name of the property to assign this JSON schema to.
|
|
164
|
+
*/
|
|
165
|
+
private addNewSchema;
|
|
166
|
+
/**
|
|
167
|
+
* Add properties to a context
|
|
168
|
+
* @param schema - The schema to add the properties to.
|
|
169
|
+
* @param splitPath - The path split into property/context names.
|
|
170
|
+
* @param context - The path context.
|
|
171
|
+
*/
|
|
172
|
+
private addPropertiesToAContext;
|
|
173
|
+
/**
|
|
174
|
+
* Add properties to an object
|
|
175
|
+
* @param schema - The schema to add the properties to.
|
|
176
|
+
* @param splitPath - The path split into property/context names.
|
|
177
|
+
* @param context - The path context.
|
|
178
|
+
* @param type - The data type (see JSON schema for details).
|
|
179
|
+
*/
|
|
180
|
+
private addPropertiesToAnObject;
|
|
181
|
+
/**
|
|
182
|
+
* Add an array to an object property
|
|
183
|
+
* @param schema - The schema to add the properties to.
|
|
184
|
+
* @param context - The name of the context.
|
|
185
|
+
*/
|
|
186
|
+
private addArrayToAnObject;
|
|
187
|
+
/**
|
|
188
|
+
* Add a context to the $defs property
|
|
189
|
+
* @param schema - The schema to use.
|
|
190
|
+
* @param propertyName - The name of the property the context belongs to.
|
|
191
|
+
* @param currentContext - The current context.
|
|
192
|
+
* @param parentContext - The parent context.
|
|
193
|
+
* @returns
|
|
194
|
+
*/
|
|
195
|
+
private addContext;
|
|
196
|
+
/**
|
|
197
|
+
* Get parent contexts
|
|
198
|
+
* @param schema - The schema to use.
|
|
199
|
+
* @param parentContext - The parent context.
|
|
200
|
+
* @param contexts - A list of parent contexts.
|
|
201
|
+
* @returns
|
|
202
|
+
*/
|
|
203
|
+
private getParentContexts;
|
|
204
|
+
}
|
|
205
|
+
export {};
|
package/dist/dts/context.d.ts
CHANGED
|
@@ -99,9 +99,9 @@ export declare const Context: Readonly<{
|
|
|
99
99
|
dispatch<T_4 extends UnknownContext>(target: EventTarget, context: T_4, callback: ContextCallback<ContextType<T_4>>, multiple?: boolean): void;
|
|
100
100
|
/**
|
|
101
101
|
* Enables an event target to provide a context value.
|
|
102
|
-
* @param target The target to provide the context value for.
|
|
103
|
-
* @param context The context to provide the value for.
|
|
104
|
-
* @param value The value to provide for the context.
|
|
102
|
+
* @param target - The target to provide the context value for.
|
|
103
|
+
* @param context - The context to provide the value for.
|
|
104
|
+
* @param value - The value to provide for the context.
|
|
105
105
|
*/
|
|
106
106
|
provide<T_5 extends UnknownContext>(target: EventTarget, context: T_5, value: ContextType<T_5>): void;
|
|
107
107
|
/**
|
|
@@ -117,9 +117,9 @@ export declare const Context: Readonly<{
|
|
|
117
117
|
/**
|
|
118
118
|
* Defines a getter-only property on the target that will return the context
|
|
119
119
|
* value for the target.
|
|
120
|
-
* @param target The target to define the property on.
|
|
121
|
-
* @param propertyName The name of the property to define.
|
|
122
|
-
* @param context The context that will be used to retrieve the property value.
|
|
120
|
+
* @param target - The target to define the property on.
|
|
121
|
+
* @param propertyName - The name of the property to define.
|
|
122
|
+
* @param context - The context that will be used to retrieve the property value.
|
|
123
123
|
* @remarks
|
|
124
124
|
* Uses the default request strategy to locate the context and will return the
|
|
125
125
|
* initialValue if the context isn't handled.
|
package/dist/dts/debug.d.ts
CHANGED
|
@@ -0,0 +1,58 @@
|
|
|
1
|
+
import { type FASTElementExtension } from "../components/fast-definitions.js";
|
|
2
|
+
import type { Schema } from "../components/schema.js";
|
|
3
|
+
export { type AccessCachedPath, type CachedPath, type CachedPathCommon, type CachedPathMap, type ChildrenMap, type DefaultCachedPath, type EventCachedPath, type JSONSchema, type JSONSchemaCommon, type JSONSchemaDefinition, type RegisterPathConfig, type RepeatCachedPath, Schema, schemaRegistry, } from "../components/schema.js";
|
|
4
|
+
/**
|
|
5
|
+
* Configuration object for the attributeMap extension.
|
|
6
|
+
* Omitting all fields uses the default attribute-mapping behavior.
|
|
7
|
+
* @public
|
|
8
|
+
*/
|
|
9
|
+
export interface AttributeMapConfig {
|
|
10
|
+
/**
|
|
11
|
+
* Strategy for mapping template binding keys to HTML attribute names.
|
|
12
|
+
*
|
|
13
|
+
* - `"camelCase"` (default): the binding key is treated as a camelCase property
|
|
14
|
+
* name and the attribute name is derived by converting it to
|
|
15
|
+
* kebab-case (e.g. `{{fooBar}}` → property `fooBar`, attribute
|
|
16
|
+
* `foo-bar`). This matches the build-time `attribute-name-strategy`
|
|
17
|
+
* option in `@microsoft/fast-build`.
|
|
18
|
+
* - `"none"`: the binding key is used as-is for both the
|
|
19
|
+
* property name and the attribute name (e.g. `{{foo-bar}}` →
|
|
20
|
+
* property `foo-bar`, attribute `foo-bar`).
|
|
21
|
+
*/
|
|
22
|
+
"attribute-name-strategy"?: "none" | "camelCase";
|
|
23
|
+
}
|
|
24
|
+
/**
|
|
25
|
+
* Creates a FAST element extension that enables schema-driven attribute mapping
|
|
26
|
+
* for the resolved definition. When called without arguments, uses the default
|
|
27
|
+
* attribute-mapping behavior. The extension uses `definition.schema` immediately
|
|
28
|
+
* for manual schemas, or the schema generated/augmented by `declarativeTemplate()`.
|
|
29
|
+
* @public
|
|
30
|
+
*/
|
|
31
|
+
export declare function attributeMap(config?: AttributeMapConfig): FASTElementExtension;
|
|
32
|
+
/**
|
|
33
|
+
* AttributeMap provides functionality for detecting simple (leaf) properties in
|
|
34
|
+
* a generated JSON schema and defining them as attr properties on a class prototype.
|
|
35
|
+
*
|
|
36
|
+
* A property is a candidate for attr when its schema entry has no nested `properties`,
|
|
37
|
+
* no `type`, and no `anyOf` — for example, a plain `foo` binding.
|
|
38
|
+
*
|
|
39
|
+
* When `attribute-name-strategy` is `"camelCase"` (the default), the binding key is treated as a
|
|
40
|
+
* camelCase property name and the HTML attribute name is derived by converting it to
|
|
41
|
+
* kebab-case (e.g. property `fooBar` → attribute `foo-bar`). This matches the
|
|
42
|
+
* build-time `attribute-name-strategy` option in `@microsoft/fast-build`.
|
|
43
|
+
*
|
|
44
|
+
* When `attribute-name-strategy` is `"none"`, the binding key is used
|
|
45
|
+
* as both the attribute name and property name — no normalization is applied.
|
|
46
|
+
*
|
|
47
|
+
* Properties already decorated with `attr` or `observable` on the class are left
|
|
48
|
+
* untouched.
|
|
49
|
+
* @public
|
|
50
|
+
*/
|
|
51
|
+
export declare class AttributeMap {
|
|
52
|
+
private schema;
|
|
53
|
+
private classPrototype;
|
|
54
|
+
private definition;
|
|
55
|
+
private config;
|
|
56
|
+
constructor(classPrototype: any, schema: Schema, definition?: any, config?: AttributeMapConfig);
|
|
57
|
+
defineProperties(): void;
|
|
58
|
+
}
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
export type { AttributeConfiguration, AttributeDefinition, AttributeMode, ValueConverter, } from "../components/attributes.js";
|
|
2
|
+
export type { FASTElementDefinition, FASTElementExtension, FASTElementTemplateResolver, PartialFASTElementDefinition, ShadowRootOptions, TemplateLifecycleCallbacks, } from "../components/fast-definitions.js";
|
|
3
|
+
export { type AccessCachedPath, type CachedPath, type CachedPathCommon, type CachedPathMap, type ChildrenMap, type DefaultCachedPath, type EventCachedPath, type JSONSchema, type JSONSchemaCommon, type JSONSchemaDefinition, type RegisterPathConfig, type RepeatCachedPath, Schema, schemaRegistry, } from "../components/schema.js";
|
|
4
|
+
export type { DOMPolicy } from "../dom.js";
|
|
5
|
+
export type { Constructable } from "../interfaces.js";
|
|
6
|
+
export type { Accessor } from "../observation/observable.js";
|
|
7
|
+
export type { ComposableStyles, ConstructibleStyleStrategy, ElementStyles, } from "../styles/element-styles.js";
|
|
8
|
+
export type { StyleStrategy, StyleTarget } from "../styles/style-strategy.js";
|
|
9
|
+
export type { ViewBehavior, ViewBehaviorFactory, } from "../templating/html-directive.js";
|
|
10
|
+
export type { CaptureType, ElementViewTemplate, HTMLTemplateCompilationResult, SyntheticViewTemplate, TemplateValue, ViewTemplate, } from "../templating/template.js";
|
|
11
|
+
export type { ElementView, HTMLView } from "../templating/view.js";
|
|
12
|
+
export { declarativeTemplate } from "./template.js";
|
|
13
|
+
export { type ResolvedStringsAndValues, TemplateParser } from "./template-parser.js";
|
|
@@ -0,0 +1,58 @@
|
|
|
1
|
+
import { type JSONSchema, type JSONSchemaDefinition } from "../components/schema.js";
|
|
2
|
+
/**
|
|
3
|
+
* Find a definition
|
|
4
|
+
* This may exist as a $ref at the root or as a $ref in any anyOf or not at all
|
|
5
|
+
* if the Observer Map has not been enabled on a child component
|
|
6
|
+
* @param schema - The JSON schema to find the ref in
|
|
7
|
+
* @returns The definition or null
|
|
8
|
+
* @public
|
|
9
|
+
*/
|
|
10
|
+
export declare function findDef(schema: JSONSchema | JSONSchemaDefinition): string | null;
|
|
11
|
+
/**
|
|
12
|
+
* Assign observables to data
|
|
13
|
+
* @param schema - The schema
|
|
14
|
+
* @param rootSchema - The root schema mapping to the root property
|
|
15
|
+
* @param data - The data
|
|
16
|
+
* @param target - The target custom element
|
|
17
|
+
* @param rootProperty - The root property
|
|
18
|
+
* @returns
|
|
19
|
+
* @public
|
|
20
|
+
*/
|
|
21
|
+
export declare function assignObservables(schema: JSONSchema | JSONSchemaDefinition, rootSchema: JSONSchema, data: any, target: any, rootProperty: string): typeof Proxy;
|
|
22
|
+
/**
|
|
23
|
+
* Assign a proxy to an object
|
|
24
|
+
* @param schema - The current schema
|
|
25
|
+
* @param rootSchema - The root schema for the root property
|
|
26
|
+
* @param target - The target custom element
|
|
27
|
+
* @param rootProperty - The root property
|
|
28
|
+
* @param object - The object to assign the proxy to
|
|
29
|
+
* @returns Proxy object
|
|
30
|
+
* @public
|
|
31
|
+
*/
|
|
32
|
+
export declare function assignProxy(schema: JSONSchema | JSONSchemaDefinition, rootSchema: JSONSchema, target: any, rootProperty: string, object: any): typeof Proxy;
|
|
33
|
+
/**
|
|
34
|
+
* Deeply compares two objects for equality.
|
|
35
|
+
*
|
|
36
|
+
* @param obj1 - First object to compare
|
|
37
|
+
* @param obj2 - Second object to compare
|
|
38
|
+
* @returns True if the objects are deeply equal, false otherwise
|
|
39
|
+
* @public
|
|
40
|
+
*/
|
|
41
|
+
export declare function deepEqual(obj1: any, obj2: any): boolean;
|
|
42
|
+
/**
|
|
43
|
+
* Checks if a value is a plain object (not an array, null, or other type).
|
|
44
|
+
*
|
|
45
|
+
* @param value - The value to check
|
|
46
|
+
* @returns True if the value is a plain object, false otherwise
|
|
47
|
+
* @public
|
|
48
|
+
*/
|
|
49
|
+
export declare function isPlainObject(value: any): value is Record<string, any>;
|
|
50
|
+
/**
|
|
51
|
+
* Deeply merges the source object into the target object.
|
|
52
|
+
*
|
|
53
|
+
* @param target - The target object to merge into
|
|
54
|
+
* @param source - The source object to merge from
|
|
55
|
+
* @returns boolean indicating whether changes were made
|
|
56
|
+
* @public
|
|
57
|
+
*/
|
|
58
|
+
export declare function deepMerge(target: any, source: any): boolean;
|
|
@@ -0,0 +1,89 @@
|
|
|
1
|
+
import { type FASTElementExtension } from "../components/fast-definitions.js";
|
|
2
|
+
import type { Schema } from "../components/schema.js";
|
|
3
|
+
export { type AccessCachedPath, type CachedPath, type CachedPathCommon, type CachedPathMap, type ChildrenMap, type DefaultCachedPath, type EventCachedPath, type JSONSchema, type JSONSchemaCommon, type JSONSchemaDefinition, type RegisterPathConfig, type RepeatCachedPath, Schema, schemaRegistry, } from "../components/schema.js";
|
|
4
|
+
/**
|
|
5
|
+
* A node in the observer-map path tree.
|
|
6
|
+
*
|
|
7
|
+
* - `true` → observe this path and all descendants (unless overridden by children).
|
|
8
|
+
* - `false` → do NOT observe this path or its descendants (unless overridden by children).
|
|
9
|
+
* - `ObserverMapPathNode` → configure child paths individually;
|
|
10
|
+
* the node itself is observed if `$observe` is true (default when parent is observed).
|
|
11
|
+
* @public
|
|
12
|
+
*/
|
|
13
|
+
export type ObserverMapPathEntry = boolean | ObserverMapPathNode;
|
|
14
|
+
/**
|
|
15
|
+
* A node object in the observer-map path tree.
|
|
16
|
+
*
|
|
17
|
+
* `$observe` controls whether this node itself is observed.
|
|
18
|
+
* When omitted the value is inherited from the nearest ancestor
|
|
19
|
+
* that explicitly sets `$observe`. At the root level the default is `true`.
|
|
20
|
+
*
|
|
21
|
+
* Child property overrides are keyed by property name.
|
|
22
|
+
* @public
|
|
23
|
+
*/
|
|
24
|
+
export interface ObserverMapPathNode {
|
|
25
|
+
$observe?: boolean;
|
|
26
|
+
[propertyName: string]: ObserverMapPathEntry | undefined;
|
|
27
|
+
}
|
|
28
|
+
/**
|
|
29
|
+
* Configuration object for the observerMap extension.
|
|
30
|
+
* `schema` enables non-declarative/manual schema use.
|
|
31
|
+
* When `properties` is omitted, every root property is observed. When
|
|
32
|
+
* `properties` is present, only listed root properties participate in
|
|
33
|
+
* observer-map observation.
|
|
34
|
+
* @public
|
|
35
|
+
*/
|
|
36
|
+
export interface ObserverMapConfig {
|
|
37
|
+
/**
|
|
38
|
+
* The schema to use for observer-map configuration.
|
|
39
|
+
* Pass this for non-declarative/manual schema use. When omitted, the
|
|
40
|
+
* extension uses the schema on the FAST element definition.
|
|
41
|
+
*/
|
|
42
|
+
schema?: Schema;
|
|
43
|
+
/**
|
|
44
|
+
* Per-root-property observation control.
|
|
45
|
+
* Keys are root property names discovered in the template schema.
|
|
46
|
+
* Only root properties listed here participate in observer-map observation.
|
|
47
|
+
* Omitting this field observes every discovered root property.
|
|
48
|
+
*/
|
|
49
|
+
properties?: {
|
|
50
|
+
[rootProperty: string]: ObserverMapPathEntry;
|
|
51
|
+
};
|
|
52
|
+
}
|
|
53
|
+
/**
|
|
54
|
+
* Creates a FAST element extension that enables schema-driven observer mapping
|
|
55
|
+
* for the resolved definition. When called without arguments, observes every
|
|
56
|
+
* discovered root property. The extension uses `config.schema`,
|
|
57
|
+
* `definition.schema`, or the schema generated by `declarativeTemplate()`.
|
|
58
|
+
* @public
|
|
59
|
+
*/
|
|
60
|
+
export declare function observerMap(config?: ObserverMapConfig): FASTElementExtension;
|
|
61
|
+
/**
|
|
62
|
+
* ObserverMap provides functionality for caching binding paths, extracting root properties,
|
|
63
|
+
* and defining observable properties on class prototypes
|
|
64
|
+
* @public
|
|
65
|
+
*/
|
|
66
|
+
export declare class ObserverMap {
|
|
67
|
+
private schema;
|
|
68
|
+
private classPrototype;
|
|
69
|
+
private config;
|
|
70
|
+
constructor(classPrototype: any, schema: Schema, config?: ObserverMapConfig);
|
|
71
|
+
defineProperties(): void;
|
|
72
|
+
/**
|
|
73
|
+
* Creates a proxy for an object that intercepts property mutations and triggers Observable notifications
|
|
74
|
+
* @param target - The target instance that owns the root property
|
|
75
|
+
* @param rootProperty - The name of the root property for notification purposes
|
|
76
|
+
* @param object - The object to wrap with a proxy
|
|
77
|
+
* @param schema - The schema for the element
|
|
78
|
+
* @returns A proxy that triggers notifications on property mutations
|
|
79
|
+
*/
|
|
80
|
+
private getAndAssignObservables;
|
|
81
|
+
/**
|
|
82
|
+
* Creates a property change handler function for observable properties
|
|
83
|
+
* This handler is called when an observable property transitions from undefined to a defined value
|
|
84
|
+
* @param propertyName - The name of the property for which to create the change handler
|
|
85
|
+
* @param existingChangedMethod - Optional existing changed method to call after the instance resolver logic
|
|
86
|
+
* @returns A function that handles property changes and sets up proxies for object values
|
|
87
|
+
*/
|
|
88
|
+
private defineChanged;
|
|
89
|
+
}
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
export declare const attributeDirectivePrefix: string;
|
|
2
|
+
export declare const clientSideCloseExpression: string;
|
|
3
|
+
export declare const clientSideOpenExpression: string;
|
|
4
|
+
export declare const closeExpression: string;
|
|
5
|
+
/**
|
|
6
|
+
* Event argument accessor for declarative event bindings.
|
|
7
|
+
* @public
|
|
8
|
+
*/
|
|
9
|
+
export declare const eventArgAccessor: string;
|
|
10
|
+
/**
|
|
11
|
+
* Execution context accessor for declarative event bindings.
|
|
12
|
+
* @public
|
|
13
|
+
*/
|
|
14
|
+
export declare const executionContextAccessor: string;
|
|
15
|
+
export declare const openExpression: string;
|
|
16
|
+
export declare const repeatDirectiveClose: string;
|
|
17
|
+
export declare const repeatDirectiveOpen: string;
|
|
18
|
+
export declare const unescapedCloseExpression: string;
|
|
19
|
+
export declare const unescapedOpenExpression: string;
|
|
20
|
+
export declare const whenDirectiveClose: string;
|
|
21
|
+
export declare const whenDirectiveOpen: string;
|