@microsoft/fast-element 2.10.3 → 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 +31 -1
- package/CHANGELOG.md +10 -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 +143 -34
- 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/context/context.api.json +1 -1
- package/dist/declarative/declarative.api.json +7844 -0
- package/dist/di/di.api.json +2 -2
- 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 +10 -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 +8 -2
- 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/tsdoc-metadata.json +1 -1
- 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 +24 -10
- package/dist/esm/templating/hydration-view.js +235 -0
- package/dist/esm/templating/render.js +13 -2
- 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 +9017 -6996
- package/dist/fast-element.d.ts +3557 -796
- package/dist/fast-element.debug.js +5093 -4419
- package/dist/fast-element.debug.min.js +2 -2
- package/dist/fast-element.js +5398 -4655
- package/dist/fast-element.min.js +2 -2
- package/dist/fast-element.untrimmed.d.ts +881 -481
- package/dist/hydration/hydration.api.json +5237 -0
- package/dist/styles/styles.api.json +2672 -0
- package/docs/api-report.api.md +344 -167
- 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 -40
- 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
package/dist/fast-element.d.ts
CHANGED
|
@@ -1,1119 +1,3880 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* A
|
|
3
|
-
* registered with the specified key.
|
|
4
|
-
* @param key - The key to resolve all dependencies for.
|
|
5
|
-
* @param searchAncestors - [optional] Indicates whether to search ancestor containers.
|
|
2
|
+
* A path discovered from an access expression.
|
|
6
3
|
* @public
|
|
7
4
|
*/
|
|
8
|
-
export declare
|
|
5
|
+
export declare interface AccessCachedPath extends CachedPathCommon {
|
|
6
|
+
type: "access";
|
|
7
|
+
}
|
|
9
8
|
|
|
10
9
|
/**
|
|
11
|
-
*
|
|
10
|
+
* Represents a getter/setter property accessor on an object.
|
|
12
11
|
* @public
|
|
13
12
|
*/
|
|
14
|
-
export declare
|
|
13
|
+
export declare interface Accessor {
|
|
14
|
+
/**
|
|
15
|
+
* The name of the property.
|
|
16
|
+
*/
|
|
17
|
+
name: string;
|
|
18
|
+
/**
|
|
19
|
+
* Gets the value of the property on the source object.
|
|
20
|
+
* @param source - The source object to access.
|
|
21
|
+
*/
|
|
22
|
+
getValue(source: any): any;
|
|
23
|
+
/**
|
|
24
|
+
* Sets the value of the property on the source object.
|
|
25
|
+
* @param source - The source object to access.
|
|
26
|
+
* @param value - The value to set the property to.
|
|
27
|
+
*/
|
|
28
|
+
setValue(source: any, value: any): void;
|
|
29
|
+
}
|
|
15
30
|
|
|
16
31
|
/**
|
|
17
|
-
*
|
|
18
|
-
*
|
|
32
|
+
* Used to add behavior factories when constructing templates.
|
|
19
33
|
* @public
|
|
20
34
|
*/
|
|
21
|
-
declare type
|
|
22
|
-
new (...args: any[]): T;
|
|
23
|
-
};
|
|
35
|
+
export declare type AddViewBehaviorFactory = (factory: ViewBehaviorFactory) => string;
|
|
24
36
|
|
|
25
37
|
/**
|
|
26
|
-
*
|
|
38
|
+
* An observer for arrays.
|
|
27
39
|
* @public
|
|
28
40
|
*/
|
|
29
|
-
export declare interface
|
|
41
|
+
export declare interface ArrayObserver extends SubscriberSet {
|
|
30
42
|
/**
|
|
31
|
-
*
|
|
32
|
-
* @param params - The registration objects.
|
|
43
|
+
* The strategy to use for tracking changes.
|
|
33
44
|
*/
|
|
34
|
-
|
|
45
|
+
strategy: SpliceStrategy | null;
|
|
35
46
|
/**
|
|
36
|
-
*
|
|
37
|
-
* @param key - The key to register the resolver under.
|
|
38
|
-
* @param resolver - The resolver to register.
|
|
47
|
+
* The length observer for the array.
|
|
39
48
|
*/
|
|
40
|
-
|
|
49
|
+
readonly lengthObserver: LengthObserver;
|
|
41
50
|
/**
|
|
42
|
-
*
|
|
43
|
-
* @param key - The key to resolved to register the transformer with.
|
|
44
|
-
* @param transformer - The transformer to register.
|
|
51
|
+
* The sort observer for the array.
|
|
45
52
|
*/
|
|
46
|
-
|
|
53
|
+
readonly sortObserver: SortObserver;
|
|
47
54
|
/**
|
|
48
|
-
*
|
|
49
|
-
* @param
|
|
50
|
-
* @param autoRegister - Indicates whether or not to try to auto-register a dependency for
|
|
51
|
-
* the key if one is not explicitly registered.
|
|
55
|
+
* Adds a splice to the list of changes.
|
|
56
|
+
* @param splice - The splice to add.
|
|
52
57
|
*/
|
|
53
|
-
|
|
58
|
+
addSplice(splice: Splice): void;
|
|
54
59
|
/**
|
|
55
|
-
*
|
|
56
|
-
* @param
|
|
57
|
-
* @param factory - The factory to register.
|
|
60
|
+
* Adds a sort to the list of changes.
|
|
61
|
+
* @param sort - The sort to add.
|
|
58
62
|
*/
|
|
59
|
-
|
|
63
|
+
addSort(sort: Sort): void;
|
|
60
64
|
/**
|
|
61
|
-
*
|
|
62
|
-
* @param
|
|
65
|
+
* Indicates that a reset change has occurred.
|
|
66
|
+
* @param oldCollection - The collection as it was before the reset.
|
|
63
67
|
*/
|
|
64
|
-
|
|
68
|
+
reset(oldCollection: any[] | undefined): void;
|
|
65
69
|
/**
|
|
66
|
-
*
|
|
67
|
-
* @param config - The configuration for the new container.
|
|
70
|
+
* Flushes the changes to subscribers.
|
|
68
71
|
*/
|
|
69
|
-
|
|
72
|
+
flush(): void;
|
|
70
73
|
}
|
|
71
74
|
|
|
72
75
|
/**
|
|
73
|
-
*
|
|
76
|
+
* An observer for arrays.
|
|
74
77
|
* @public
|
|
75
78
|
*/
|
|
76
|
-
export declare const
|
|
79
|
+
export declare const ArrayObserver: Readonly<{
|
|
80
|
+
readonly sorted: 0;
|
|
81
|
+
/**
|
|
82
|
+
* Enables the array observation mechanism.
|
|
83
|
+
* @remarks
|
|
84
|
+
* Array observation is enabled automatically when using the
|
|
85
|
+
* `RepeatDirective`, so calling this API manually is
|
|
86
|
+
* not typically necessary.
|
|
87
|
+
*/
|
|
88
|
+
readonly enable: () => void;
|
|
89
|
+
}>;
|
|
77
90
|
|
|
78
91
|
/**
|
|
79
|
-
*
|
|
92
|
+
* Represents something that applies to a specific aspect of the DOM.
|
|
80
93
|
* @public
|
|
81
94
|
*/
|
|
82
|
-
export declare interface
|
|
95
|
+
export declare interface Aspected {
|
|
83
96
|
/**
|
|
84
|
-
* The
|
|
97
|
+
* The original source aspect exactly as represented in markup.
|
|
85
98
|
*/
|
|
86
|
-
|
|
99
|
+
sourceAspect: string;
|
|
87
100
|
/**
|
|
88
|
-
*
|
|
89
|
-
* resolver is found for the key, this function is called to provide
|
|
90
|
-
* a registration.
|
|
101
|
+
* The evaluated target aspect, determined after processing the source.
|
|
91
102
|
*/
|
|
92
|
-
|
|
103
|
+
targetAspect: string;
|
|
93
104
|
/**
|
|
94
|
-
*
|
|
95
|
-
* by its owner. The default is "false" which results in the parent container being used.
|
|
105
|
+
* The type of aspect to target.
|
|
96
106
|
*/
|
|
97
|
-
|
|
107
|
+
aspectType: DOMAspect;
|
|
98
108
|
/**
|
|
99
|
-
*
|
|
100
|
-
* @param key - The key to register the dependency with.
|
|
101
|
-
* @param handler - The container that is handling the auto-registration request.
|
|
109
|
+
* A binding if one is associated with the aspect.
|
|
102
110
|
*/
|
|
103
|
-
|
|
111
|
+
dataBinding?: Binding;
|
|
104
112
|
}
|
|
105
113
|
|
|
106
114
|
/**
|
|
107
|
-
*
|
|
115
|
+
* Decorator: Specifies an HTML attribute.
|
|
116
|
+
* @param config - The configuration for the attribute.
|
|
108
117
|
* @public
|
|
109
118
|
*/
|
|
110
|
-
export declare
|
|
111
|
-
/**
|
|
112
|
-
* The default configuration used when creating a DOM-disconnected container.
|
|
113
|
-
* @remarks
|
|
114
|
-
* The default creates a root container, with no parent container. It does not handle
|
|
115
|
-
* owner requests and it uses singleton resolution behavior for auto-registration.
|
|
116
|
-
*/
|
|
117
|
-
default: Readonly<ContainerConfiguration>;
|
|
118
|
-
}>;
|
|
119
|
+
export declare function attr(config?: DecoratorAttributeConfiguration): (target: {}, property: string) => void;
|
|
119
120
|
|
|
120
121
|
/**
|
|
121
|
-
*
|
|
122
|
+
* Decorator: Specifies an HTML attribute.
|
|
123
|
+
* @param target - The class to define the attribute on.
|
|
124
|
+
* @param prop - The property name to be associated with the attribute.
|
|
125
|
+
* @public
|
|
122
126
|
*/
|
|
123
|
-
export declare
|
|
124
|
-
protected owner: any;
|
|
125
|
-
protected config: ContainerConfiguration;
|
|
126
|
-
private _parent;
|
|
127
|
-
private registerDepth;
|
|
128
|
-
private resolvers;
|
|
129
|
-
private isHandlingContextRequests;
|
|
130
|
-
get parent(): ContainerImpl | null;
|
|
131
|
-
get depth(): number;
|
|
132
|
-
get responsibleForOwnerRequests(): boolean;
|
|
133
|
-
constructor(owner: any, config: ContainerConfiguration);
|
|
134
|
-
handleContextRequests(enable: boolean): void;
|
|
135
|
-
register(...params: any[]): Container;
|
|
136
|
-
registerResolver<K extends Key, T = K>(key: K, resolver: Resolver<T>): Resolver<T>;
|
|
137
|
-
registerTransformer<K extends Key, T = K>(key: K, transformer: Transformer_2<T>): boolean;
|
|
138
|
-
getResolver<K extends Key, T = K>(key: K | Key, autoRegister?: boolean): Resolver<T> | null;
|
|
139
|
-
has<K extends Key>(key: K, searchAncestors?: boolean): boolean;
|
|
140
|
-
getAsync<K extends Key>(key: K): Promise<Resolved<K>>;
|
|
141
|
-
get<K extends Key>(key: K): Resolved<K>;
|
|
142
|
-
getAll<K extends Key>(key: K, searchAncestors?: boolean): readonly Resolved<K>[];
|
|
143
|
-
getFactory<K extends Constructable>(Type: K): Factory<K>;
|
|
144
|
-
registerFactory<K extends Constructable>(key: K, factory: Factory<K>): void;
|
|
145
|
-
createChild(config?: Partial<Omit<ContainerConfiguration, "parentLocator">>): Container;
|
|
146
|
-
private jitRegister;
|
|
147
|
-
}
|
|
127
|
+
export declare function attr(target: {}, prop: string): void;
|
|
148
128
|
|
|
149
129
|
/**
|
|
150
|
-
*
|
|
130
|
+
* Metadata used to configure a custom attribute's behavior.
|
|
151
131
|
* @public
|
|
152
132
|
*/
|
|
153
|
-
declare type
|
|
154
|
-
|
|
155
|
-
|
|
133
|
+
export declare type AttributeConfiguration = {
|
|
134
|
+
property: string;
|
|
135
|
+
attribute?: string;
|
|
136
|
+
mode?: AttributeMode;
|
|
137
|
+
converter?: ValueConverter;
|
|
156
138
|
};
|
|
157
139
|
|
|
158
140
|
/**
|
|
159
|
-
*
|
|
160
|
-
* {@link https://github.com/webcomponents-cg/community-protocols/blob/main/proposals/context.md | W3C Community Context protocol.}
|
|
141
|
+
* Metadata used to configure a custom attribute's behavior.
|
|
161
142
|
* @public
|
|
162
143
|
*/
|
|
163
|
-
declare const
|
|
164
|
-
/**
|
|
165
|
-
* The event type used for W3C Context Protocol requests.
|
|
166
|
-
*/
|
|
167
|
-
eventType: "context-request";
|
|
144
|
+
export declare const AttributeConfiguration: Readonly<{
|
|
168
145
|
/**
|
|
169
|
-
*
|
|
170
|
-
* Otherwise, returns a new FASTContext with this name.
|
|
171
|
-
* @param name - The name of the FASTContext to get or create.
|
|
172
|
-
* @returns A FASTContext object.
|
|
146
|
+
* Locates all attribute configurations associated with a type.
|
|
173
147
|
*/
|
|
174
|
-
|
|
148
|
+
locate: (target: {}) => AttributeConfiguration[];
|
|
149
|
+
}>;
|
|
150
|
+
|
|
151
|
+
/**
|
|
152
|
+
* An implementation of `Accessor` that supports reactivity,
|
|
153
|
+
* change callbacks, attribute reflection, and type conversion for
|
|
154
|
+
* custom elements.
|
|
155
|
+
* @public
|
|
156
|
+
*/
|
|
157
|
+
export declare class AttributeDefinition implements Accessor {
|
|
158
|
+
private readonly fieldName;
|
|
159
|
+
private readonly callbackName;
|
|
160
|
+
private readonly hasCallback;
|
|
161
|
+
private readonly guards;
|
|
175
162
|
/**
|
|
176
|
-
*
|
|
177
|
-
* context through the DOM.
|
|
178
|
-
* @param name - The name to use for the connext. Useful in debugging.
|
|
179
|
-
* @param initialValue - An optional initial value to use if a context handler isn't found.
|
|
163
|
+
* The class constructor that owns this attribute.
|
|
180
164
|
*/
|
|
181
|
-
|
|
165
|
+
readonly Owner: Function;
|
|
182
166
|
/**
|
|
183
|
-
*
|
|
184
|
-
* Context.request, Context.get, Context.defineProperty, and ContextDecorator APIs.
|
|
185
|
-
* @param strategy - The strategy to use. By default, the strategy is Context.dispatch.
|
|
167
|
+
* The name of the property associated with the attribute.
|
|
186
168
|
*/
|
|
187
|
-
|
|
169
|
+
readonly name: string;
|
|
188
170
|
/**
|
|
189
|
-
*
|
|
190
|
-
* a context handler is not found.
|
|
191
|
-
* @param target - The target to get the context for.
|
|
192
|
-
* @param context - The context to locate.
|
|
193
|
-
* @returns The context value.
|
|
194
|
-
* @remarks
|
|
195
|
-
* Uses the default request strategy to locate the context. If no context is found
|
|
196
|
-
* then the initial value of the context is returned.
|
|
171
|
+
* The name of the attribute in HTML.
|
|
197
172
|
*/
|
|
198
|
-
|
|
173
|
+
readonly attribute: string;
|
|
199
174
|
/**
|
|
200
|
-
*
|
|
201
|
-
* @param target - The target to request the context for.
|
|
202
|
-
* @param context - The context to locate.
|
|
203
|
-
* @param callback - A callback to invoke with the context value.
|
|
204
|
-
* @param multiple - Whether the context requestor expects to handle updates
|
|
205
|
-
* to the context value after the initial request.
|
|
206
|
-
* @remarks
|
|
207
|
-
* Uses the default request strategy to locate the context.
|
|
175
|
+
* The {@link AttributeMode} that describes the behavior of this attribute.
|
|
208
176
|
*/
|
|
209
|
-
|
|
177
|
+
readonly mode: AttributeMode;
|
|
210
178
|
/**
|
|
211
|
-
*
|
|
212
|
-
*
|
|
213
|
-
* @param context - The context to locate.
|
|
214
|
-
* @param callback - The callback to invoke with the context value.
|
|
215
|
-
* @param multiple - Whether the context requestor expects to handle updates
|
|
216
|
-
* to the context value after the initial request.
|
|
217
|
-
* @remarks
|
|
218
|
-
* This API does NOT use the default request strategy. It always dispatches
|
|
219
|
-
* an event through the DOM.
|
|
179
|
+
* A {@link ValueConverter} that integrates with the property getter/setter
|
|
180
|
+
* to convert values to and from a DOM string.
|
|
220
181
|
*/
|
|
221
|
-
|
|
182
|
+
readonly converter?: ValueConverter;
|
|
222
183
|
/**
|
|
223
|
-
*
|
|
224
|
-
* @param
|
|
225
|
-
* @param
|
|
226
|
-
* @param
|
|
184
|
+
* Creates an instance of AttributeDefinition.
|
|
185
|
+
* @param Owner - The class constructor that owns this attribute.
|
|
186
|
+
* @param name - The name of the property associated with the attribute.
|
|
187
|
+
* @param attribute - The name of the attribute in HTML.
|
|
188
|
+
* @param mode - The {@link AttributeMode} that describes the behavior of this attribute.
|
|
189
|
+
* @param converter - A {@link ValueConverter} that integrates with the property getter/setter
|
|
190
|
+
* to convert values to and from a DOM string.
|
|
227
191
|
*/
|
|
228
|
-
|
|
192
|
+
constructor(Owner: Function, name: string, attribute?: string, mode?: AttributeMode, converter?: ValueConverter);
|
|
229
193
|
/**
|
|
230
|
-
*
|
|
231
|
-
* @param
|
|
232
|
-
* @param
|
|
233
|
-
* @param context - The context to handle requests for.
|
|
234
|
-
* @remarks
|
|
235
|
-
* If a context is not provided then the callback will be invoked for all context
|
|
236
|
-
* requests that are received on the target.
|
|
194
|
+
* Sets the value of the attribute/property on the source element.
|
|
195
|
+
* @param source - The source element to access.
|
|
196
|
+
* @param newValue - The value to set the attribute/property to.
|
|
237
197
|
*/
|
|
238
|
-
|
|
198
|
+
setValue(source: HTMLElement, newValue: any): void;
|
|
239
199
|
/**
|
|
240
|
-
*
|
|
241
|
-
*
|
|
242
|
-
* @param target The target to define the property on.
|
|
243
|
-
* @param propertyName The name of the property to define.
|
|
244
|
-
* @param context The context that will be used to retrieve the property value.
|
|
245
|
-
* @remarks
|
|
246
|
-
* Uses the default request strategy to locate the context and will return the
|
|
247
|
-
* initialValue if the context isn't handled.
|
|
200
|
+
* Gets the value of the attribute/property on the source element.
|
|
201
|
+
* @param source - The source element to access.
|
|
248
202
|
*/
|
|
249
|
-
|
|
250
|
-
|
|
203
|
+
getValue(source: HTMLElement): any;
|
|
204
|
+
/* Excluded from this release type: onAttributeChangedCallback */
|
|
205
|
+
private tryReflectToAttribute;
|
|
206
|
+
/* Excluded from this release type: collect */
|
|
207
|
+
}
|
|
251
208
|
|
|
252
209
|
/**
|
|
253
|
-
*
|
|
254
|
-
*
|
|
210
|
+
* The mode that specifies the runtime behavior of the attribute.
|
|
211
|
+
* @remarks
|
|
212
|
+
* By default, attributes run in `reflect` mode, propagating their property
|
|
213
|
+
* values to the DOM and DOM values to the property. The `boolean` mode also
|
|
214
|
+
* reflects values, but uses the HTML standard boolean attribute behavior,
|
|
215
|
+
* interpreting the presence of the attribute as `true` and the absence as
|
|
216
|
+
* `false`. The `fromView` behavior only updates the property value based on
|
|
217
|
+
* changes in the DOM, but does not reflect property changes back.
|
|
255
218
|
* @public
|
|
256
219
|
*/
|
|
257
|
-
declare type
|
|
220
|
+
export declare type AttributeMode = "reflect" | "boolean" | "fromView";
|
|
258
221
|
|
|
259
222
|
/**
|
|
260
|
-
*
|
|
261
|
-
*
|
|
262
|
-
* resolving the associated dependency.
|
|
223
|
+
* Captures a binding expression along with related information and capabilities.
|
|
224
|
+
*
|
|
263
225
|
* @public
|
|
264
226
|
*/
|
|
265
|
-
declare
|
|
227
|
+
export declare abstract class Binding<TSource = any, TReturn = any, TParent = any> {
|
|
228
|
+
evaluate: Expression<TSource, TReturn, TParent>;
|
|
229
|
+
policy?: DOMPolicy_2 | undefined;
|
|
230
|
+
isVolatile: boolean;
|
|
231
|
+
/**
|
|
232
|
+
* Options associated with the binding.
|
|
233
|
+
*/
|
|
234
|
+
options?: any;
|
|
235
|
+
/**
|
|
236
|
+
* Creates a binding.
|
|
237
|
+
* @param evaluate - Evaluates the binding.
|
|
238
|
+
* @param policy - The security policy to associate with this binding.
|
|
239
|
+
* @param isVolatile - Indicates whether the binding is volatile.
|
|
240
|
+
*/
|
|
241
|
+
constructor(evaluate: Expression<TSource, TReturn, TParent>, policy?: DOMPolicy_2 | undefined, isVolatile?: boolean);
|
|
242
|
+
/**
|
|
243
|
+
* Creates an observer capable of notifying a subscriber when the output of a binding changes.
|
|
244
|
+
* @param subscriber - The subscriber to changes in the binding.
|
|
245
|
+
* @param directive - The Binding directive to create the observer for.
|
|
246
|
+
*/
|
|
247
|
+
abstract createObserver(subscriber: Subscriber, directive: BindingDirective): ExpressionObserver<TSource, TReturn, TParent>;
|
|
248
|
+
}
|
|
266
249
|
|
|
267
250
|
/**
|
|
268
|
-
*
|
|
269
|
-
*
|
|
270
|
-
* A provider should inspect the `context` property of the event to determine if it has a value that can
|
|
271
|
-
* satisfy the request, calling the `callback` with the requested value if so.
|
|
251
|
+
* The directive from which a binding originates.
|
|
272
252
|
*
|
|
273
|
-
* If the requested context event contains a truthy `multiple` value, then a provider can call the callback
|
|
274
|
-
* multiple times if the value is changed, if this is the case the provider should pass a `dispose`
|
|
275
|
-
* method to the callback which requesters can invoke to indicate they no longer wish to receive these updates.
|
|
276
253
|
* @public
|
|
277
254
|
*/
|
|
278
|
-
declare
|
|
279
|
-
|
|
280
|
-
|
|
281
|
-
|
|
282
|
-
|
|
255
|
+
export declare interface BindingDirective {
|
|
256
|
+
/**
|
|
257
|
+
* The binding.
|
|
258
|
+
*/
|
|
259
|
+
readonly dataBinding: Binding;
|
|
260
|
+
/**
|
|
261
|
+
* The evaluated target aspect.
|
|
262
|
+
*/
|
|
263
|
+
readonly targetAspect?: string;
|
|
264
|
+
/**
|
|
265
|
+
* The type of aspect to target.
|
|
266
|
+
*/
|
|
267
|
+
readonly aspectType?: DOMAspect;
|
|
283
268
|
}
|
|
284
269
|
|
|
285
270
|
/**
|
|
286
|
-
* A
|
|
271
|
+
* A {@link ValueConverter} that converts to and from `boolean` values.
|
|
272
|
+
* @remarks
|
|
273
|
+
* Used automatically when the `boolean` {@link AttributeMode} is selected.
|
|
287
274
|
* @public
|
|
288
275
|
*/
|
|
289
|
-
declare
|
|
276
|
+
export declare const booleanConverter: ValueConverter;
|
|
290
277
|
|
|
291
|
-
|
|
278
|
+
/**
|
|
279
|
+
* A path discovered while parsing a template.
|
|
280
|
+
* @public
|
|
281
|
+
*/
|
|
282
|
+
export declare type CachedPath = DefaultCachedPath | RepeatCachedPath | AccessCachedPath | EventCachedPath;
|
|
292
283
|
|
|
293
284
|
/**
|
|
294
|
-
*
|
|
285
|
+
* Common metadata for paths cached while parsing a template.
|
|
295
286
|
* @public
|
|
296
287
|
*/
|
|
297
|
-
export declare
|
|
298
|
-
|
|
299
|
-
|
|
300
|
-
|
|
301
|
-
|
|
302
|
-
none(key: Key): Resolver;
|
|
303
|
-
/**
|
|
304
|
-
* Provides default singleton resolution behavior during auto-registration.
|
|
305
|
-
* @param key - The key to create the resolver for.
|
|
306
|
-
* @returns The resolver.
|
|
307
|
-
*/
|
|
308
|
-
singleton(key: Key): Resolver;
|
|
309
|
-
/**
|
|
310
|
-
* Provides default transient resolution behavior during auto-registration.
|
|
311
|
-
* @param key - The key to create the resolver for.
|
|
312
|
-
* @returns The resolver.
|
|
313
|
-
*/
|
|
314
|
-
transient(key: Key): Resolver;
|
|
315
|
-
}>;
|
|
288
|
+
export declare interface CachedPathCommon {
|
|
289
|
+
parentContext: string | null;
|
|
290
|
+
currentContext: string | null;
|
|
291
|
+
path: string;
|
|
292
|
+
}
|
|
316
293
|
|
|
317
294
|
/**
|
|
318
|
-
*
|
|
295
|
+
* A map from element names and root properties to JSON schemas.
|
|
319
296
|
* @public
|
|
320
297
|
*/
|
|
321
|
-
export declare
|
|
322
|
-
/**
|
|
323
|
-
* Installs dependency injection as the default strategy for handling
|
|
324
|
-
* all calls to Context.request.
|
|
325
|
-
* @param fallback - Creates a container if one cannot be found.
|
|
326
|
-
*/
|
|
327
|
-
installAsContextRequestStrategy(fallback?: () => DOMContainer): void;
|
|
328
|
-
/**
|
|
329
|
-
* Creates a new dependency injection container.
|
|
330
|
-
* @param config - The configuration for the container.
|
|
331
|
-
* @returns A newly created dependency injection container.
|
|
332
|
-
*/
|
|
333
|
-
createContainer(config?: Partial<ContainerConfiguration>): Container;
|
|
334
|
-
/**
|
|
335
|
-
* Finds the dependency injection container responsible for providing dependencies
|
|
336
|
-
* to the specified node.
|
|
337
|
-
* @param target - The node to find the responsible container for.
|
|
338
|
-
* @param fallback - Creates a container if one cannot be found.
|
|
339
|
-
* @returns The container responsible for providing dependencies to the node.
|
|
340
|
-
* @remarks
|
|
341
|
-
* This will be the same as the parent container if the specified node
|
|
342
|
-
* does not itself host a container configured with responsibleForOwnerRequests.
|
|
343
|
-
*/
|
|
344
|
-
findResponsibleContainer(target: EventTarget, fallback?: () => DOMContainer): DOMContainer;
|
|
345
|
-
/**
|
|
346
|
-
* Find the dependency injection container up the DOM tree from this node.
|
|
347
|
-
* @param target - The node to find the parent container for.
|
|
348
|
-
* @param fallback - Creates a container if one cannot be found.
|
|
349
|
-
* @returns The parent container of this node.
|
|
350
|
-
* @remarks
|
|
351
|
-
* This will be the same as the responsible container if the specified node
|
|
352
|
-
* does not itself host a container configured with responsibleForOwnerRequests.
|
|
353
|
-
*/
|
|
354
|
-
findParentContainer(target: EventTarget, fallback?: () => DOMContainer): DOMContainer;
|
|
355
|
-
/**
|
|
356
|
-
* Returns a dependency injection container if one is explicitly owned by the specified
|
|
357
|
-
* node. If one is not owned, then a new container is created and assigned to the node.
|
|
358
|
-
* @param target - The node to find or create the container for.
|
|
359
|
-
* @param config - The configuration for the container if one needs to be created.
|
|
360
|
-
* @returns The located or created container.
|
|
361
|
-
* @remarks
|
|
362
|
-
* This API does not search for a responsible or parent container. It looks only for a container
|
|
363
|
-
* directly defined on the specified node and creates one at that location if one does not
|
|
364
|
-
* already exist.
|
|
365
|
-
*/
|
|
366
|
-
getOrCreateDOMContainer(target?: EventTarget, config?: Partial<Omit<ContainerConfiguration, "parentLocator">>): DOMContainer;
|
|
367
|
-
/**
|
|
368
|
-
* Gets the dependency keys representing what is needed to instantiate the specified type.
|
|
369
|
-
* @param Type - The type to get the dependencies for.
|
|
370
|
-
* @returns An array of dependency keys.
|
|
371
|
-
*/
|
|
372
|
-
getDependencies(Type: Constructable | Injectable): Key[];
|
|
373
|
-
/**
|
|
374
|
-
* Defines a property on a web component class. The value of this property will
|
|
375
|
-
* be resolved from the dependency injection container responsible for the element
|
|
376
|
-
* instance, based on where it is connected in the DOM.
|
|
377
|
-
* @param target - The target to define the property on.
|
|
378
|
-
* @param propertyName - The name of the property to define.
|
|
379
|
-
* @param key - The dependency injection key.
|
|
380
|
-
* @param respectConnection - Indicates whether or not to update the property value if the
|
|
381
|
-
* hosting component is disconnected and then re-connected at a different location in the DOM.
|
|
382
|
-
* @remarks
|
|
383
|
-
* The respectConnection option is only applicable to elements that descend from FASTElement.
|
|
384
|
-
*/
|
|
385
|
-
defineProperty(target: {}, propertyName: string, key: Key, respectConnection?: boolean): void;
|
|
386
|
-
/**
|
|
387
|
-
* Creates a dependency injection key.
|
|
388
|
-
* @param nameConfigOrCallback - A friendly name for the key or a lambda that configures a
|
|
389
|
-
* default resolution for the dependency.
|
|
390
|
-
* @param configuror - If a friendly name was provided for the first parameter, then an optional
|
|
391
|
-
* lambda that configures a default resolution for the dependency can be provided second.
|
|
392
|
-
* @returns The created key.
|
|
393
|
-
* @remarks
|
|
394
|
-
* The created key can be used as a property decorator or constructor parameter decorator,
|
|
395
|
-
* in addition to its standard use in an inject array or through direct container APIs.
|
|
396
|
-
*/
|
|
397
|
-
createContext: typeof createContext;
|
|
398
|
-
/**
|
|
399
|
-
* A decorator that specifies what to inject into its target.
|
|
400
|
-
* @param dependencies - The dependencies to inject.
|
|
401
|
-
* @returns The decorator to be applied to the target class.
|
|
402
|
-
* @remarks
|
|
403
|
-
* The decorator can be used to decorate a class, listing all of the classes dependencies.
|
|
404
|
-
* Or it can be used to decorate a constructor parameter, indicating what to inject for that
|
|
405
|
-
* parameter.
|
|
406
|
-
* Or it can be used for a web component property, indicating what that property should resolve to.
|
|
407
|
-
*/
|
|
408
|
-
inject(...dependencies: Key[]): (target: any, key?: string | number, descriptor?: PropertyDescriptor | number) => void;
|
|
409
|
-
/**
|
|
410
|
-
* Registers the `target` class as a transient dependency; each time the dependency is resolved
|
|
411
|
-
* a new instance will be created.
|
|
412
|
-
*
|
|
413
|
-
* @param target - The class / constructor function to register as transient.
|
|
414
|
-
* @returns The same class, with a static `register` method that takes a container and returns the appropriate resolver.
|
|
415
|
-
*
|
|
416
|
-
* @example
|
|
417
|
-
* On an existing class
|
|
418
|
-
* ```ts
|
|
419
|
-
* class Foo { }
|
|
420
|
-
* DI.transient(Foo);
|
|
421
|
-
* ```
|
|
422
|
-
*
|
|
423
|
-
* @example
|
|
424
|
-
* Inline declaration
|
|
425
|
-
*
|
|
426
|
-
* ```ts
|
|
427
|
-
* const Foo = DI.transient(class { });
|
|
428
|
-
* // Foo is now strongly typed with register
|
|
429
|
-
* Foo.register(container);
|
|
430
|
-
* ```
|
|
431
|
-
*
|
|
432
|
-
* @public
|
|
433
|
-
*/
|
|
434
|
-
transient<T extends Constructable>(target: T & Partial<RegisterSelf<T>>): T & RegisterSelf<T>;
|
|
435
|
-
/**
|
|
436
|
-
* Registers the `target` class as a singleton dependency; the class will only be created once. Each
|
|
437
|
-
* consecutive time the dependency is resolved, the same instance will be returned.
|
|
438
|
-
*
|
|
439
|
-
* @param target - The class / constructor function to register as a singleton.
|
|
440
|
-
* @returns The same class, with a static `register` method that takes a container and returns the appropriate resolver.
|
|
441
|
-
* @example
|
|
442
|
-
* On an existing class
|
|
443
|
-
* ```ts
|
|
444
|
-
* class Foo { }
|
|
445
|
-
* DI.singleton(Foo);
|
|
446
|
-
* ```
|
|
447
|
-
*
|
|
448
|
-
* @example
|
|
449
|
-
* Inline declaration
|
|
450
|
-
* ```ts
|
|
451
|
-
* const Foo = DI.singleton(class { });
|
|
452
|
-
* // Foo is now strongly typed with register
|
|
453
|
-
* Foo.register(container);
|
|
454
|
-
* ```
|
|
455
|
-
*
|
|
456
|
-
* @public
|
|
457
|
-
*/
|
|
458
|
-
singleton<T_1 extends Constructable>(target: T_1 & Partial<RegisterSelf<T_1>>, options?: SingletonOptions): T_1 & RegisterSelf<T_1>;
|
|
459
|
-
}>;
|
|
298
|
+
export declare type CachedPathMap = Map<string, Map<string, JSONSchema>>;
|
|
460
299
|
|
|
461
300
|
/**
|
|
462
|
-
*
|
|
301
|
+
* Represents a callable type such as a function or an object with a "call" method.
|
|
463
302
|
* @public
|
|
464
303
|
*/
|
|
465
|
-
export declare
|
|
466
|
-
|
|
467
|
-
|
|
468
|
-
|
|
469
|
-
|
|
470
|
-
|
|
471
|
-
|
|
472
|
-
|
|
304
|
+
export declare type Callable = typeof Function.prototype.call | {
|
|
305
|
+
call(): void;
|
|
306
|
+
};
|
|
307
|
+
|
|
308
|
+
/**
|
|
309
|
+
* A marker interface used to capture types when interpolating Directive helpers
|
|
310
|
+
* into templates.
|
|
311
|
+
* @public
|
|
312
|
+
*/
|
|
313
|
+
export declare interface CaptureType {
|
|
314
|
+
}
|
|
315
|
+
|
|
316
|
+
/**
|
|
317
|
+
* The options used to configure child list observation.
|
|
318
|
+
* @public
|
|
319
|
+
*/
|
|
320
|
+
export declare interface ChildListDirectiveOptions<T = any> extends NodeBehaviorOptions<T>, Omit<MutationObserverInit, "subtree" | "childList"> {
|
|
473
321
|
}
|
|
474
322
|
|
|
475
323
|
/**
|
|
476
|
-
*
|
|
324
|
+
* A directive that observes the `childNodes` of an element and updates a property
|
|
325
|
+
* whenever they change.
|
|
326
|
+
* @param propertyOrOptions - The options used to configure child node observation.
|
|
477
327
|
* @public
|
|
478
328
|
*/
|
|
479
|
-
export declare
|
|
329
|
+
export declare function children<TSource = any>(propertyOrOptions: (keyof TSource & string) | ChildrenDirectiveOptions<keyof TSource & string>): CaptureType;
|
|
480
330
|
|
|
481
331
|
/**
|
|
482
|
-
*
|
|
332
|
+
* The runtime behavior for child node observation.
|
|
483
333
|
* @public
|
|
484
334
|
*/
|
|
485
|
-
export declare
|
|
335
|
+
export declare class ChildrenDirective extends NodeObservationDirective<ChildrenDirectiveOptions> {
|
|
336
|
+
private observerProperty;
|
|
486
337
|
/**
|
|
487
|
-
*
|
|
338
|
+
* Creates an instance of ChildrenDirective.
|
|
339
|
+
* @param options - The options to use in configuring the child observation behavior.
|
|
488
340
|
*/
|
|
489
|
-
|
|
341
|
+
constructor(options: ChildrenDirectiveOptions);
|
|
490
342
|
/**
|
|
491
|
-
*
|
|
492
|
-
*
|
|
493
|
-
* @param transformer - The transformer function.
|
|
343
|
+
* Begins observation of the nodes.
|
|
344
|
+
* @param target - The target to observe.
|
|
494
345
|
*/
|
|
495
|
-
|
|
346
|
+
observe(target: any): void;
|
|
496
347
|
/**
|
|
497
|
-
*
|
|
498
|
-
* @param
|
|
499
|
-
* @param dynamicDependencies - Dynamic dependencies supplied to the constructor.
|
|
348
|
+
* Disconnects observation of the nodes.
|
|
349
|
+
* @param target - The target to unobserve.
|
|
500
350
|
*/
|
|
501
|
-
|
|
351
|
+
disconnect(target: any): void;
|
|
502
352
|
/**
|
|
503
|
-
*
|
|
504
|
-
*
|
|
505
|
-
* @param container - The container the object is being constructor for.
|
|
506
|
-
* @param dynamicDependencies - Dynamic dependencies supplied to the constructor.
|
|
353
|
+
* Retrieves the raw nodes that should be assigned to the source property.
|
|
354
|
+
* @param target - The target to get the node to.
|
|
507
355
|
*/
|
|
508
|
-
|
|
509
|
-
}
|
|
510
|
-
|
|
511
|
-
/** @internal */
|
|
512
|
-
export declare class FactoryImpl<T extends Constructable = any> implements Factory<T> {
|
|
513
|
-
Type: T;
|
|
514
|
-
private readonly dependencies;
|
|
515
|
-
private transformers;
|
|
516
|
-
constructor(Type: T, dependencies: Key[]);
|
|
517
|
-
constructAsync(container: Container, dynamicDependencies?: Key[]): Promise<Resolved<T>>;
|
|
518
|
-
construct(container: Container, dynamicDependencies?: Key[]): Resolved<T>;
|
|
519
|
-
private constructCore;
|
|
520
|
-
registerTransformer(transformer: (instance: any) => any): void;
|
|
356
|
+
getNodes(target: Element): Node[];
|
|
521
357
|
}
|
|
522
358
|
|
|
523
359
|
/**
|
|
524
|
-
*
|
|
525
|
-
* The FASTContext can also be used as a decorator to declare context dependencies or as a key for DI.
|
|
360
|
+
* The options used to configure child/subtree node observation.
|
|
526
361
|
* @public
|
|
527
362
|
*/
|
|
528
|
-
declare type
|
|
529
|
-
get(target: EventTarget): T;
|
|
530
|
-
provide(target: EventTarget, value: T): void;
|
|
531
|
-
request(target: EventTarget, callback: ContextCallback<T>, multiple?: boolean): void;
|
|
532
|
-
handle(target: EventTarget, callback: (event: ContextEvent<FASTContext<T>>) => void): void;
|
|
533
|
-
};
|
|
363
|
+
export declare type ChildrenDirectiveOptions<T = any> = ChildListDirectiveOptions<T> | SubtreeDirectiveOptions<T>;
|
|
534
364
|
|
|
535
365
|
/**
|
|
536
|
-
*
|
|
537
|
-
* @remarks
|
|
538
|
-
* By default this is handled via Context.dispatch, which dispatches a ContextEvent.
|
|
366
|
+
* Describes a child custom element binding referenced by a schema path.
|
|
539
367
|
* @public
|
|
540
368
|
*/
|
|
541
|
-
declare
|
|
369
|
+
export declare interface ChildrenMap {
|
|
370
|
+
customElementName: string;
|
|
371
|
+
attributeName: string;
|
|
372
|
+
}
|
|
542
373
|
|
|
543
374
|
/**
|
|
544
|
-
*
|
|
545
|
-
*
|
|
375
|
+
* Represents a constructable class with a prototype.
|
|
546
376
|
* @public
|
|
547
377
|
*/
|
|
548
|
-
export declare
|
|
378
|
+
export declare type Class<T, C = {}> = C & Constructable<T> & {
|
|
379
|
+
/**
|
|
380
|
+
* The class's prototype;
|
|
381
|
+
*/
|
|
382
|
+
readonly prototype: T;
|
|
383
|
+
};
|
|
549
384
|
|
|
550
385
|
/**
|
|
551
|
-
* A
|
|
552
|
-
*
|
|
553
|
-
* @returns The decorator to be applied to the target class.
|
|
554
|
-
* @remarks
|
|
555
|
-
* The decorator can be used to decorate a class, listing all of the classes dependencies.
|
|
556
|
-
* Or it can be used to decorate a constructor paramter, indicating what to inject for that
|
|
557
|
-
* parameter.
|
|
558
|
-
* Or it can be used for a web component property, indicating what that property should resolve to.
|
|
559
|
-
*
|
|
386
|
+
* A function capable of compiling a template from the preprocessed form produced
|
|
387
|
+
* by the html template function into a result that can instantiate views.
|
|
560
388
|
* @public
|
|
561
389
|
*/
|
|
562
|
-
export declare
|
|
390
|
+
export declare type CompilationStrategy = (
|
|
391
|
+
/**
|
|
392
|
+
* The preprocessed HTML string or template to compile.
|
|
393
|
+
*/
|
|
394
|
+
html: string | HTMLTemplateElement,
|
|
395
|
+
/**
|
|
396
|
+
* The behavior factories used within the html that is being compiled.
|
|
397
|
+
*/
|
|
398
|
+
factories: Record<string, ViewBehaviorFactory>,
|
|
399
|
+
/**
|
|
400
|
+
* The security policy to compile the html with.
|
|
401
|
+
*/
|
|
402
|
+
policy: DOMPolicy_2) => HTMLTemplateCompilationResult;
|
|
563
403
|
|
|
564
404
|
/**
|
|
565
|
-
*
|
|
566
|
-
* a static "inject" field array of keys.
|
|
405
|
+
* Represents a ViewBehaviorFactory after the compilation process has completed.
|
|
567
406
|
* @public
|
|
568
407
|
*/
|
|
569
|
-
export declare type
|
|
570
|
-
inject?: Key[];
|
|
571
|
-
};
|
|
408
|
+
export declare type CompiledViewBehaviorFactory = Required<ViewBehaviorFactory>;
|
|
572
409
|
|
|
573
410
|
/**
|
|
574
|
-
*
|
|
411
|
+
* Common APIs related to compilation.
|
|
575
412
|
* @public
|
|
576
413
|
*/
|
|
577
|
-
export declare
|
|
414
|
+
export declare const Compiler: {
|
|
415
|
+
/**
|
|
416
|
+
* Compiles a template and associated directives into a compilation
|
|
417
|
+
* result which can be used to create views.
|
|
418
|
+
* @param html - The html string or template element to compile.
|
|
419
|
+
* @param factories - The behavior factories referenced by the template.
|
|
420
|
+
* @param policy - The security policy to compile the html with.
|
|
421
|
+
* @remarks
|
|
422
|
+
* The template that is provided for compilation is altered in-place
|
|
423
|
+
* and cannot be compiled again. If the original template must be preserved,
|
|
424
|
+
* it is recommended that you clone the original and pass the clone to this API.
|
|
425
|
+
* @public
|
|
426
|
+
*/
|
|
427
|
+
compile<TSource = any, TParent = any>(html: string | HTMLTemplateElement, factories: Record<string, ViewBehaviorFactory>, policy?: DOMPolicy_2): HTMLTemplateCompilationResult<TSource, TParent>;
|
|
578
428
|
/**
|
|
579
|
-
*
|
|
429
|
+
* Sets the default compilation strategy that will be used by the ViewTemplate whenever
|
|
430
|
+
* it needs to compile a view preprocessed with the html template function.
|
|
431
|
+
* @param strategy - The compilation strategy to use when compiling templates.
|
|
580
432
|
*/
|
|
581
|
-
|
|
433
|
+
setDefaultStrategy(strategy: CompilationStrategy): void;
|
|
582
434
|
/**
|
|
583
|
-
*
|
|
584
|
-
*
|
|
585
|
-
*
|
|
435
|
+
* Aggregates an array of strings and directives into a single directive.
|
|
436
|
+
* @param parts - A heterogeneous array of static strings interspersed with
|
|
437
|
+
* directives.
|
|
438
|
+
* @param policy - The security policy to use with the aggregated bindings.
|
|
439
|
+
* @returns A single inline directive that aggregates the behavior of all the parts.
|
|
586
440
|
*/
|
|
587
|
-
|
|
588
|
-
}
|
|
441
|
+
aggregate(parts: (string | ViewBehaviorFactory)[], policy?: DOMPolicy_2): ViewBehaviorFactory;
|
|
442
|
+
};
|
|
589
443
|
|
|
590
444
|
/**
|
|
591
|
-
*
|
|
445
|
+
* Represents styles that can be composed into the ShadowDOM of a custom element.
|
|
592
446
|
* @public
|
|
593
447
|
*/
|
|
594
|
-
export declare type
|
|
448
|
+
export declare type ComposableStyles = string | ElementStyles | CSSStyleSheet;
|
|
449
|
+
|
|
450
|
+
declare function compose<TType extends Constructable<HTMLElement> = Constructable<HTMLElement>>(this: TType, nameOrDef: string | PartialFASTElementDefinition<TType>): Promise<FASTElementDefinition<TType>>;
|
|
451
|
+
|
|
452
|
+
declare function compose<TType extends Constructable<HTMLElement> = Constructable<HTMLElement>>(type: TType, nameOrDef?: string | PartialFASTElementDefinition<TType>): Promise<FASTElementDefinition<TType>>;
|
|
595
453
|
|
|
596
454
|
/**
|
|
597
|
-
*
|
|
598
|
-
*
|
|
599
|
-
* @example
|
|
600
|
-
* You need to make your argument a function that returns the type, for example
|
|
601
|
-
* ```ts
|
|
602
|
-
* class Foo {
|
|
603
|
-
* constructor( @lazy('random') public random: () => number )
|
|
604
|
-
* }
|
|
605
|
-
* const foo = container.get(Foo); // instanceof Foo
|
|
606
|
-
* foo.random(); // throws
|
|
607
|
-
* ```
|
|
608
|
-
* would throw an exception because you haven't registered `'random'` before calling the method.
|
|
609
|
-
* @example
|
|
610
|
-
* This, would give you a new 'Math.random()' number each time.
|
|
611
|
-
* ```ts
|
|
612
|
-
* class Foo {
|
|
613
|
-
* constructor( @lazy('random') public random: () => random )
|
|
614
|
-
* }
|
|
615
|
-
* container.register(Registration.callback('random', Math.random ));
|
|
616
|
-
* container.get(Foo).random(); // some random number
|
|
617
|
-
* container.get(Foo).random(); // another random number
|
|
618
|
-
* ```
|
|
619
|
-
*
|
|
620
|
-
* `@lazy` does not manage the lifecycle of the underlying key. If you want a singleton, you have to register as a
|
|
621
|
-
* `singleton`, `transient` would also behave as you would expect, providing you a new instance each time.
|
|
455
|
+
* Determines if the reference element contains the test element in a "composed" DOM tree that
|
|
456
|
+
* ignores shadow DOM boundaries.
|
|
622
457
|
*
|
|
623
|
-
*
|
|
624
|
-
*
|
|
458
|
+
* Returns true of the test element is a descendent of the reference, or exists in
|
|
459
|
+
* a shadow DOM that is a logical descendent of the reference. Otherwise returns false.
|
|
460
|
+
* @param reference - The element to test for containment against.
|
|
461
|
+
* @param test - The element being tested for containment.
|
|
625
462
|
*
|
|
626
463
|
* @public
|
|
627
464
|
*/
|
|
628
|
-
export declare
|
|
465
|
+
export declare function composedContains(reference: HTMLElement, test: HTMLElement): boolean;
|
|
629
466
|
|
|
630
467
|
/**
|
|
631
|
-
*
|
|
632
|
-
*
|
|
633
|
-
*
|
|
634
|
-
*
|
|
635
|
-
*
|
|
636
|
-
* making this a singleton, scoped to the container or DOM's subtree.
|
|
468
|
+
* Retrieves the "composed parent" element of a node, ignoring DOM tree boundaries.
|
|
469
|
+
* When the parent of a node is a shadow-root, it will return the host
|
|
470
|
+
* element of the shadow root. Otherwise it will return the parent node or null if
|
|
471
|
+
* no parent node exists.
|
|
472
|
+
* @param element - The element for which to retrieve the composed parent
|
|
637
473
|
*
|
|
638
474
|
* @public
|
|
639
475
|
*/
|
|
640
|
-
export declare
|
|
476
|
+
export declare function composedParent<T extends HTMLElement>(element: T): HTMLElement | null;
|
|
641
477
|
|
|
642
478
|
/**
|
|
643
|
-
*
|
|
644
|
-
* @
|
|
645
|
-
* @remarks
|
|
646
|
-
* The instance is not internally cached with a resolver as newInstanceForScope does.
|
|
647
|
-
*
|
|
648
|
-
* @public
|
|
479
|
+
* Provides computed state capabilities.
|
|
480
|
+
* @beta
|
|
649
481
|
*/
|
|
650
|
-
export declare
|
|
482
|
+
export declare type ComputedBuilder = {
|
|
483
|
+
/**
|
|
484
|
+
* Callbacks related to computed state.
|
|
485
|
+
*/
|
|
486
|
+
on: {
|
|
487
|
+
/**
|
|
488
|
+
* Provides a setup callback for the computation.
|
|
489
|
+
* @param callback - The callback to run to setup the computation.
|
|
490
|
+
*/
|
|
491
|
+
setup(callback: ComputedSetupCallback): void;
|
|
492
|
+
};
|
|
493
|
+
};
|
|
651
494
|
|
|
652
495
|
/**
|
|
653
|
-
* A
|
|
654
|
-
* @
|
|
655
|
-
* ```ts
|
|
656
|
-
* class Foo {
|
|
657
|
-
* constructor( @inject('mystring') public str: string = 'somestring' )
|
|
658
|
-
* }
|
|
659
|
-
* container.get(Foo); // throws
|
|
660
|
-
* ```
|
|
661
|
-
* would fail
|
|
662
|
-
*
|
|
663
|
-
* @example
|
|
664
|
-
* ```ts
|
|
665
|
-
* class Foo {
|
|
666
|
-
* constructor( @optional('mystring') public str: string = 'somestring' )
|
|
667
|
-
* }
|
|
668
|
-
* container.get(Foo).str // somestring
|
|
669
|
-
* ```
|
|
670
|
-
* if you use it without a default it will inject `undefined`, so remember to mark your input type as
|
|
671
|
-
* possibly `undefined`!
|
|
672
|
-
*
|
|
673
|
-
* @param key - The key to optionally resolve.
|
|
674
|
-
* see {@link DI.createContext} on interactions with interfaces
|
|
675
|
-
*
|
|
676
|
-
* @public
|
|
496
|
+
* A callback that initializes the computation.
|
|
497
|
+
* @beta
|
|
677
498
|
*/
|
|
678
|
-
export declare
|
|
499
|
+
export declare type ComputedInitializer<T> = (builder: ComputedBuilder) => () => T;
|
|
679
500
|
|
|
680
501
|
/**
|
|
681
|
-
* A
|
|
682
|
-
* @
|
|
502
|
+
* A callback that enables computation setup.
|
|
503
|
+
* @beta
|
|
683
504
|
*/
|
|
684
|
-
declare type
|
|
505
|
+
export declare type ComputedSetupCallback = () => (() => void) | void;
|
|
685
506
|
|
|
686
507
|
/**
|
|
687
|
-
*
|
|
688
|
-
* @
|
|
689
|
-
|
|
508
|
+
* State whose value is computed from other dependencies.
|
|
509
|
+
* @beta
|
|
510
|
+
*/
|
|
511
|
+
export declare type ComputedState<T> = ReadonlyState<T> & Disposable & {
|
|
512
|
+
/**
|
|
513
|
+
* Subscribes to notification of changes in the state.
|
|
514
|
+
* @param subscriber - The object that is subscribing for change notification.
|
|
515
|
+
*/
|
|
516
|
+
subscribe(subscriber: Subscriber): void;
|
|
517
|
+
/**
|
|
518
|
+
* Unsubscribes from notification of changes in the state.
|
|
519
|
+
* @param subscriber - The object that is unsubscribing from change notification.
|
|
520
|
+
*/
|
|
521
|
+
unsubscribe(subscriber: Subscriber): void;
|
|
522
|
+
};
|
|
523
|
+
|
|
524
|
+
/**
|
|
525
|
+
* Creates a ComputedState.
|
|
526
|
+
* @param initialize - The initialization callback.
|
|
527
|
+
* @param name - A friendly name for this computation.
|
|
528
|
+
* @returns A ComputedState
|
|
529
|
+
* @beta
|
|
530
|
+
*/
|
|
531
|
+
export declare function computedState<T>(initialize: ComputedInitializer<T>, name?: string): ComputedState<T>;
|
|
532
|
+
|
|
533
|
+
/**
|
|
534
|
+
* Represents a type which can be constructed with the new operator.
|
|
535
|
+
*
|
|
690
536
|
* @public
|
|
691
537
|
*/
|
|
692
|
-
export declare type
|
|
538
|
+
export declare type Constructable<T = {}> = {
|
|
539
|
+
new (...args: any[]): T;
|
|
540
|
+
};
|
|
693
541
|
|
|
694
542
|
/**
|
|
695
|
-
*
|
|
543
|
+
* A type that instantiates a StyleStrategy.
|
|
696
544
|
* @public
|
|
697
545
|
*/
|
|
698
|
-
export declare type
|
|
546
|
+
export declare type ConstructibleStyleStrategy = {
|
|
699
547
|
/**
|
|
700
|
-
*
|
|
701
|
-
* @param
|
|
548
|
+
* Creates an instance of the strategy.
|
|
549
|
+
* @param styles - The styles to initialize the strategy with.
|
|
702
550
|
*/
|
|
703
|
-
|
|
704
|
-
/**
|
|
705
|
-
* Indicates whether during auto registration the object should be
|
|
706
|
-
* registered in the requesting container rather than the handling container.
|
|
707
|
-
*/
|
|
708
|
-
registerInRequestor: boolean;
|
|
551
|
+
new (styles: (string | CSSStyleSheet)[]): StyleStrategy;
|
|
709
552
|
};
|
|
710
553
|
|
|
711
554
|
/**
|
|
712
|
-
*
|
|
713
|
-
* by creating resolvers.
|
|
555
|
+
* A simple template that can create ContentView instances.
|
|
714
556
|
* @public
|
|
715
557
|
*/
|
|
716
|
-
export declare interface
|
|
558
|
+
export declare interface ContentTemplate {
|
|
717
559
|
/**
|
|
718
|
-
* Creates a
|
|
719
|
-
* @param container - The container to register the dependency within.
|
|
720
|
-
* @param key - The key to register dependency under, if overridden.
|
|
560
|
+
* Creates a simple content view instance.
|
|
721
561
|
*/
|
|
722
|
-
|
|
562
|
+
create(): ContentView;
|
|
723
563
|
}
|
|
724
564
|
|
|
725
565
|
/**
|
|
726
|
-
*
|
|
727
|
-
* to register with the container.
|
|
728
|
-
*
|
|
729
|
-
* @example
|
|
730
|
-
* ```
|
|
731
|
-
* class Foo {}
|
|
732
|
-
* const container = DI.createContainer();
|
|
733
|
-
* container.register(Registration.instance(Foo, new Foo()));
|
|
734
|
-
* container.get(Foo);
|
|
735
|
-
* ```
|
|
736
|
-
*
|
|
566
|
+
* A simple View that can be interpolated into HTML content.
|
|
737
567
|
* @public
|
|
738
568
|
*/
|
|
739
|
-
export declare
|
|
569
|
+
export declare interface ContentView {
|
|
570
|
+
readonly context: ExecutionContext;
|
|
740
571
|
/**
|
|
741
|
-
*
|
|
742
|
-
*
|
|
743
|
-
*
|
|
744
|
-
* @example
|
|
745
|
-
* ```
|
|
746
|
-
* Registration.instance(Foo, new Foo()));
|
|
747
|
-
* ```
|
|
748
|
-
*
|
|
749
|
-
* @param key - The key to register the instance under.
|
|
750
|
-
* @param value - The instance to return when the key is requested.
|
|
572
|
+
* Binds a view's behaviors to its binding source.
|
|
573
|
+
* @param source - The binding source for the view's binding behaviors.
|
|
574
|
+
* @param context - The execution context to run the view within.
|
|
751
575
|
*/
|
|
752
|
-
|
|
576
|
+
bind(source: any, context?: ExecutionContext): void;
|
|
753
577
|
/**
|
|
754
|
-
*
|
|
755
|
-
* Every time you request this {@link Key} you will get the same one back.
|
|
756
|
-
*
|
|
757
|
-
* @example
|
|
758
|
-
* ```
|
|
759
|
-
* Registration.singleton(Foo, Foo);
|
|
760
|
-
* ```
|
|
761
|
-
*
|
|
762
|
-
* @param key - The key to register the singleton under.
|
|
763
|
-
* @param value - The class to instantiate as a singleton when first requested.
|
|
578
|
+
* Unbinds a view's behaviors from its binding source and context.
|
|
764
579
|
*/
|
|
765
|
-
|
|
580
|
+
unbind(): void;
|
|
766
581
|
/**
|
|
767
|
-
*
|
|
768
|
-
*
|
|
769
|
-
*
|
|
770
|
-
* @example
|
|
771
|
-
* ```
|
|
772
|
-
* Registration.instance(Foo, Foo);
|
|
773
|
-
* ```
|
|
774
|
-
*
|
|
775
|
-
* @param key - The key to register the instance type under.
|
|
776
|
-
* @param value - The class to instantiate each time the key is requested.
|
|
582
|
+
* Inserts the view's DOM nodes before the referenced node.
|
|
583
|
+
* @param node - The node to insert the view's DOM before.
|
|
777
584
|
*/
|
|
778
|
-
|
|
585
|
+
insertBefore(node: Node): void;
|
|
779
586
|
/**
|
|
780
|
-
*
|
|
781
|
-
*
|
|
782
|
-
|
|
783
|
-
|
|
784
|
-
|
|
785
|
-
|
|
786
|
-
|
|
787
|
-
|
|
788
|
-
|
|
789
|
-
|
|
790
|
-
|
|
791
|
-
|
|
587
|
+
* Removes the view's DOM nodes.
|
|
588
|
+
* The nodes are not disposed and the view can later be re-inserted.
|
|
589
|
+
*/
|
|
590
|
+
remove(): void;
|
|
591
|
+
}
|
|
592
|
+
|
|
593
|
+
/**
|
|
594
|
+
* Transforms a template literal string into styles.
|
|
595
|
+
* @param strings - The string fragments that are interpolated with the values.
|
|
596
|
+
* @param values - The values that are interpolated with the string fragments.
|
|
597
|
+
* @remarks
|
|
598
|
+
* The css helper supports interpolation of static composable styles and CSS directives.
|
|
599
|
+
* @public
|
|
600
|
+
*/
|
|
601
|
+
export declare const css: CSSTemplateTag;
|
|
602
|
+
|
|
603
|
+
/**
|
|
604
|
+
* Directive for use in CSS templates.
|
|
605
|
+
*
|
|
606
|
+
* @public
|
|
607
|
+
*/
|
|
608
|
+
export declare interface CSSDirective {
|
|
609
|
+
/**
|
|
610
|
+
* Creates static styles to interpolate into the CSS document.
|
|
611
|
+
* @returns - the styles to interpolate into CSS
|
|
792
612
|
*/
|
|
793
|
-
|
|
613
|
+
createCSS(): ComposableStyles;
|
|
614
|
+
}
|
|
615
|
+
|
|
616
|
+
/**
|
|
617
|
+
* Instructs the css engine to provide styles during CSS template composition.
|
|
618
|
+
* @public
|
|
619
|
+
*/
|
|
620
|
+
export declare const CSSDirective: Readonly<{
|
|
794
621
|
/**
|
|
795
|
-
*
|
|
796
|
-
*
|
|
797
|
-
*
|
|
798
|
-
* @example
|
|
799
|
-
* ```
|
|
800
|
-
* Registration.cachedCallback(Foo, () => new Foo());
|
|
801
|
-
* Registration.cachedCallback(Bar, (c: Container) => new Bar(c.get(Foo)));
|
|
802
|
-
* ```
|
|
803
|
-
*
|
|
804
|
-
* @param key - The key to register the callback for.
|
|
805
|
-
* @param callback - The function that is expected to return the dependency.
|
|
806
|
-
* @remarks
|
|
807
|
-
* If you pass the same Registration to another container, the same cached value will be used.
|
|
808
|
-
* Should all references to the resolver returned be removed, the cache will expire.
|
|
622
|
+
* Gets the directive definition associated with the instance.
|
|
623
|
+
* @param instance - The directive instance to retrieve the definition for.
|
|
809
624
|
*/
|
|
810
|
-
|
|
625
|
+
getForInstance: (object: any) => CSSDirectiveDefinition<Constructable<CSSDirective>> | undefined;
|
|
811
626
|
/**
|
|
812
|
-
*
|
|
813
|
-
*
|
|
814
|
-
* @example
|
|
815
|
-
* ```
|
|
816
|
-
* Register.singleton(Foo, Foo)
|
|
817
|
-
* Register.aliasTo(Foo, MyFoos);
|
|
818
|
-
*
|
|
819
|
-
* container.getAll(MyFoos) // contains an instance of Foo
|
|
820
|
-
* ```
|
|
821
|
-
*
|
|
822
|
-
* @param originalKey - The original key that has been registered.
|
|
823
|
-
* @param aliasKey - The alias to the original key.
|
|
627
|
+
* Gets the directive definition associated with the specified type.
|
|
628
|
+
* @param type - The directive type to retrieve the definition for.
|
|
824
629
|
*/
|
|
825
|
-
|
|
630
|
+
getByType: (key: Function) => CSSDirectiveDefinition<Constructable<CSSDirective>> | undefined;
|
|
631
|
+
/**
|
|
632
|
+
* Defines a CSSDirective.
|
|
633
|
+
* @param type - The type to define as a directive.
|
|
634
|
+
*/
|
|
635
|
+
define<TType extends Constructable<CSSDirective>>(type: any): TType;
|
|
826
636
|
}>;
|
|
827
637
|
|
|
828
638
|
/**
|
|
829
|
-
*
|
|
639
|
+
* Decorator: Defines a CSSDirective.
|
|
640
|
+
* @public
|
|
641
|
+
*/
|
|
642
|
+
export declare function cssDirective(): (type: Constructable<CSSDirective>) => void;
|
|
643
|
+
|
|
644
|
+
/**
|
|
645
|
+
* Defines metadata for a CSSDirective.
|
|
830
646
|
* @public
|
|
831
647
|
*/
|
|
832
|
-
export declare interface
|
|
648
|
+
export declare interface CSSDirectiveDefinition<TType extends Constructable<CSSDirective> = Constructable<CSSDirective>> {
|
|
833
649
|
/**
|
|
834
|
-
*
|
|
835
|
-
* @param container - The container to register dependencies in.
|
|
836
|
-
* @param params - Parameters that affect the registration process.
|
|
837
|
-
* @remarks
|
|
838
|
-
* If this registry doubles as a Registration, it should return a Resolver
|
|
839
|
-
* for the registered dependency.
|
|
650
|
+
* The type that the definition provides metadata for.
|
|
840
651
|
*/
|
|
841
|
-
|
|
652
|
+
readonly type: TType;
|
|
842
653
|
}
|
|
843
654
|
|
|
844
655
|
/**
|
|
845
|
-
*
|
|
846
|
-
*
|
|
847
|
-
*
|
|
848
|
-
*
|
|
849
|
-
* The
|
|
850
|
-
* the
|
|
656
|
+
* Transforms a template literal string into styles.
|
|
657
|
+
* @param strings - The string fragments that are interpolated with the values.
|
|
658
|
+
* @param values - The values that are interpolated with the string fragments.
|
|
659
|
+
* @remarks
|
|
660
|
+
* The css helper supports interpolation of static composable styles and CSS directives.
|
|
661
|
+
* Use the .partial method to create partial CSS fragments.
|
|
662
|
+
* @public
|
|
663
|
+
*/
|
|
664
|
+
export declare type CSSTemplateTag = ((strings: TemplateStringsArray, ...values: CSSValue[]) => ElementStyles) & {
|
|
665
|
+
/**
|
|
666
|
+
* Transforms a template literal string into partial CSS.
|
|
667
|
+
* @param strings - The string fragments that are interpolated with the values.
|
|
668
|
+
* @param values - The values that are interpolated with the string fragments.
|
|
669
|
+
* @public
|
|
670
|
+
*/
|
|
671
|
+
partial(strings: TemplateStringsArray, ...values: CSSValue[]): CSSDirective;
|
|
672
|
+
};
|
|
673
|
+
|
|
674
|
+
/**
|
|
675
|
+
* Represents the types of values that can be interpolated into a template.
|
|
851
676
|
* @public
|
|
852
677
|
*/
|
|
853
|
-
export declare type
|
|
678
|
+
export declare type CSSValue = ComposableStyles | CSSDirective;
|
|
854
679
|
|
|
855
680
|
/**
|
|
856
|
-
*
|
|
681
|
+
* Decorator: Defines a platform custom element based on `FASTElement`.
|
|
682
|
+
* @param nameOrDef - The name of the element to define or a definition object
|
|
683
|
+
* that describes the element to define.
|
|
857
684
|
* @public
|
|
858
685
|
*/
|
|
859
|
-
export declare
|
|
686
|
+
export declare function customElement(nameOrDef: string | PartialFASTElementDefinition): (type: Constructable<HTMLElement>) => void;
|
|
860
687
|
|
|
861
688
|
/**
|
|
862
|
-
*
|
|
863
|
-
* how a dependency is resolved. Resolvers for transient, singleton, etc. are
|
|
864
|
-
* provided out of the box, but you can also implement Resolver yourself and supply
|
|
865
|
-
* custom logic for resolution.
|
|
689
|
+
* Metadata used to configure a custom attribute's behavior through a decorator.
|
|
866
690
|
* @public
|
|
867
691
|
*/
|
|
868
|
-
export declare
|
|
692
|
+
export declare type DecoratorAttributeConfiguration = Omit<AttributeConfiguration, "property">;
|
|
693
|
+
|
|
694
|
+
/**
|
|
695
|
+
* A path discovered from a default binding.
|
|
696
|
+
* @public
|
|
697
|
+
*/
|
|
698
|
+
export declare interface DefaultCachedPath extends CachedPathCommon {
|
|
699
|
+
type: "default";
|
|
869
700
|
}
|
|
870
701
|
|
|
871
702
|
/**
|
|
872
|
-
*
|
|
873
|
-
* injection container. Supports a standard set of object lifetimes.
|
|
703
|
+
* The default execution context for template views.
|
|
874
704
|
* @public
|
|
875
705
|
*/
|
|
876
|
-
export declare class
|
|
877
|
-
private container;
|
|
878
|
-
private key;
|
|
706
|
+
export declare class DefaultExecutionContext<TParent> implements ExecutionContext<TParent> {
|
|
879
707
|
/**
|
|
880
|
-
*
|
|
881
|
-
|
|
882
|
-
|
|
708
|
+
* The index of the current item within a repeat context.
|
|
709
|
+
*/
|
|
710
|
+
index: number;
|
|
711
|
+
/**
|
|
712
|
+
* The length of the current collection within a repeat context.
|
|
713
|
+
*/
|
|
714
|
+
length: number;
|
|
715
|
+
/**
|
|
716
|
+
* The parent data source within a nested context.
|
|
717
|
+
*/
|
|
718
|
+
readonly parent: TParent;
|
|
719
|
+
/**
|
|
720
|
+
* The parent execution context when in nested context scenarios.
|
|
721
|
+
*/
|
|
722
|
+
readonly parentContext: ExecutionContext<TParent>;
|
|
723
|
+
/**
|
|
724
|
+
* The current event within an event handler.
|
|
725
|
+
*/
|
|
726
|
+
get event(): Event;
|
|
727
|
+
/**
|
|
728
|
+
* Indicates whether the current item within a repeat context
|
|
729
|
+
* has an even index.
|
|
883
730
|
*/
|
|
884
|
-
|
|
731
|
+
get isEven(): boolean;
|
|
885
732
|
/**
|
|
886
|
-
*
|
|
887
|
-
*
|
|
888
|
-
* @returns The resolver.
|
|
733
|
+
* Indicates whether the current item within a repeat context
|
|
734
|
+
* has an odd index.
|
|
889
735
|
*/
|
|
890
|
-
|
|
736
|
+
get isOdd(): boolean;
|
|
891
737
|
/**
|
|
892
|
-
*
|
|
893
|
-
*
|
|
894
|
-
* @returns The resolver.
|
|
738
|
+
* Indicates whether the current item within a repeat context
|
|
739
|
+
* is the first item in the collection.
|
|
895
740
|
*/
|
|
896
|
-
|
|
741
|
+
get isFirst(): boolean;
|
|
897
742
|
/**
|
|
898
|
-
*
|
|
899
|
-
*
|
|
900
|
-
* @returns - The resolver.
|
|
743
|
+
* Indicates whether the current item within a repeat context
|
|
744
|
+
* is somewhere in the middle of the collection.
|
|
901
745
|
*/
|
|
902
|
-
|
|
746
|
+
get isInMiddle(): boolean;
|
|
903
747
|
/**
|
|
904
|
-
*
|
|
905
|
-
*
|
|
906
|
-
* @param value - The callback to call during resolution.
|
|
907
|
-
* @returns The resolver.
|
|
748
|
+
* Indicates whether the current item within a repeat context
|
|
749
|
+
* is the last item in the collection.
|
|
908
750
|
*/
|
|
909
|
-
|
|
751
|
+
get isLast(): boolean;
|
|
910
752
|
/**
|
|
911
|
-
*
|
|
912
|
-
* resolution is requested. The returned value is then cached and provided for all
|
|
913
|
-
* subsequent requests.
|
|
914
|
-
* @param value - The callback to call during the first resolution.
|
|
915
|
-
* @returns The resolver.
|
|
753
|
+
* Returns the typed event detail of a custom event.
|
|
916
754
|
*/
|
|
917
|
-
|
|
755
|
+
eventDetail<TDetail>(): TDetail;
|
|
918
756
|
/**
|
|
919
|
-
*
|
|
920
|
-
* @param destinationKey - The key to point the alias to.
|
|
921
|
-
* @returns The resolver.
|
|
757
|
+
* Returns the typed event target of the event.
|
|
922
758
|
*/
|
|
923
|
-
|
|
924
|
-
private registerResolver;
|
|
759
|
+
eventTarget<TTarget extends EventTarget>(): TTarget;
|
|
925
760
|
}
|
|
926
761
|
|
|
927
|
-
|
|
928
|
-
export declare class ResolverImpl implements Resolver, Registration {
|
|
929
|
-
key: Key;
|
|
930
|
-
strategy: ResolverStrategy;
|
|
931
|
-
state: any;
|
|
932
|
-
constructor(key: Key, strategy: ResolverStrategy, state: any);
|
|
933
|
-
get $isResolver(): true;
|
|
934
|
-
private resolving;
|
|
935
|
-
register(container: Container): Resolver;
|
|
936
|
-
resolveAsync(handler: Container, requestor: Container): Promise<any>;
|
|
937
|
-
resolve(handler: Container, requestor: Container): any;
|
|
938
|
-
getFactory(container: Container): Factory | null;
|
|
939
|
-
}
|
|
762
|
+
declare function define<TType extends Constructable<HTMLElement> = Constructable<HTMLElement>>(this: TType, nameOrDef: string | PartialFASTElementDefinition<TType>, extensions?: FASTElementExtension[]): Promise<TType>;
|
|
940
763
|
|
|
941
|
-
declare
|
|
942
|
-
readonly $isResolver: true;
|
|
943
|
-
resolve(handler: C, requestor: C): Resolved<K>;
|
|
944
|
-
resolveAsync(handler: C, requestor: C): Promise<Resolved<K>>;
|
|
945
|
-
getFactory?(container: C): (K extends Constructable ? Factory<K> : never) | null;
|
|
946
|
-
}
|
|
764
|
+
declare function define<TType extends Constructable<HTMLElement> = Constructable<HTMLElement>>(type: TType, nameOrDef?: string | PartialFASTElementDefinition<TType>, extensions?: FASTElementExtension[]): Promise<TType>;
|
|
947
765
|
|
|
948
|
-
/**
|
|
949
|
-
|
|
950
|
-
|
|
951
|
-
|
|
952
|
-
|
|
953
|
-
|
|
954
|
-
|
|
955
|
-
|
|
766
|
+
/**
|
|
767
|
+
* Provides a mechanism for releasing resources.
|
|
768
|
+
* @public
|
|
769
|
+
*/
|
|
770
|
+
export declare interface Disposable {
|
|
771
|
+
/**
|
|
772
|
+
* Disposes the resources.
|
|
773
|
+
*/
|
|
774
|
+
dispose(): void;
|
|
956
775
|
}
|
|
957
776
|
|
|
958
777
|
/**
|
|
959
|
-
*
|
|
778
|
+
* Common DOM APIs.
|
|
960
779
|
* @public
|
|
961
780
|
*/
|
|
962
|
-
export declare
|
|
781
|
+
export declare const DOM: Readonly<{
|
|
963
782
|
/**
|
|
964
|
-
*
|
|
965
|
-
* for the requested key.
|
|
966
|
-
* @param key - The dependency key to lookup.
|
|
967
|
-
* @param searchAncestors - Indicates whether to search the entire hierarchy of service locators.
|
|
783
|
+
* Gets the dom policy used by the templating system.
|
|
968
784
|
*/
|
|
969
|
-
|
|
785
|
+
readonly policy: DOMPolicy_2;
|
|
970
786
|
/**
|
|
971
|
-
*
|
|
972
|
-
* @param
|
|
787
|
+
* Sets the dom policy used by the templating system.
|
|
788
|
+
* @param policy - The policy to set.
|
|
789
|
+
* @remarks
|
|
790
|
+
* This API can only be called once, for security reasons. It should be
|
|
791
|
+
* called by the application developer at the start of their program.
|
|
973
792
|
*/
|
|
974
|
-
|
|
793
|
+
setPolicy(value: DOMPolicy_2): void;
|
|
975
794
|
/**
|
|
976
|
-
*
|
|
977
|
-
* @param
|
|
795
|
+
* Sets an attribute value on an element.
|
|
796
|
+
* @param element - The element to set the attribute value on.
|
|
797
|
+
* @param attributeName - The attribute name to set.
|
|
798
|
+
* @param value - The value of the attribute to set.
|
|
799
|
+
* @remarks
|
|
800
|
+
* If the value is `null` or `undefined`, the attribute is removed, otherwise
|
|
801
|
+
* it is set to the provided value using the standard `setAttribute` API.
|
|
978
802
|
*/
|
|
979
|
-
|
|
803
|
+
setAttribute(element: HTMLElement, attributeName: string, value: any): void;
|
|
980
804
|
/**
|
|
981
|
-
*
|
|
982
|
-
* @param
|
|
805
|
+
* Sets a boolean attribute value.
|
|
806
|
+
* @param element - The element to set the boolean attribute value on.
|
|
807
|
+
* @param attributeName - The attribute name to set.
|
|
808
|
+
* @param value - The value of the attribute to set.
|
|
809
|
+
* @remarks
|
|
810
|
+
* If the value is true, the attribute is added; otherwise it is removed.
|
|
983
811
|
*/
|
|
984
|
-
|
|
812
|
+
setBooleanAttribute(element: HTMLElement, attributeName: string, value: boolean): void;
|
|
813
|
+
}>;
|
|
814
|
+
|
|
815
|
+
/**
|
|
816
|
+
* The type of HTML aspect to target.
|
|
817
|
+
* @public
|
|
818
|
+
*/
|
|
819
|
+
export declare const DOMAspect: Readonly<{
|
|
985
820
|
/**
|
|
986
|
-
*
|
|
987
|
-
* resolved dependencies.
|
|
988
|
-
* @param key - The key to lookup.
|
|
821
|
+
* Not aspected.
|
|
989
822
|
*/
|
|
990
|
-
|
|
823
|
+
readonly none: 0;
|
|
991
824
|
/**
|
|
992
|
-
*
|
|
993
|
-
* resolved dependencies.
|
|
994
|
-
* @param key - The key to lookup.
|
|
825
|
+
* An attribute.
|
|
995
826
|
*/
|
|
996
|
-
|
|
827
|
+
readonly attribute: 1;
|
|
997
828
|
/**
|
|
998
|
-
*
|
|
999
|
-
* resolved dependencies.
|
|
1000
|
-
* @param key - The key to lookup.
|
|
829
|
+
* A boolean attribute.
|
|
1001
830
|
*/
|
|
1002
|
-
|
|
831
|
+
readonly booleanAttribute: 2;
|
|
1003
832
|
/**
|
|
1004
|
-
*
|
|
1005
|
-
* @param key - The key to lookup.
|
|
1006
|
-
* @param searchAncestors - Indicates whether to search the entire hierarchy of service locators.
|
|
833
|
+
* A property.
|
|
1007
834
|
*/
|
|
1008
|
-
|
|
835
|
+
readonly property: 3;
|
|
1009
836
|
/**
|
|
1010
|
-
*
|
|
1011
|
-
* @param key - The key to lookup.
|
|
1012
|
-
* @param searchAncestors - Indicates whether to search the entire hierarchy of service locators.
|
|
837
|
+
* Content
|
|
1013
838
|
*/
|
|
1014
|
-
|
|
839
|
+
readonly content: 4;
|
|
1015
840
|
/**
|
|
1016
|
-
*
|
|
1017
|
-
* @param key - The key to lookup.
|
|
1018
|
-
* @param searchAncestors - Indicates whether to search the entire hierarchy of service locators.
|
|
841
|
+
* A token list.
|
|
1019
842
|
*/
|
|
1020
|
-
|
|
1021
|
-
|
|
1022
|
-
|
|
843
|
+
readonly tokenList: 5;
|
|
844
|
+
/**
|
|
845
|
+
* An event.
|
|
846
|
+
*/
|
|
847
|
+
readonly event: 6;
|
|
848
|
+
}>;
|
|
849
|
+
|
|
850
|
+
/**
|
|
851
|
+
* The type of HTML aspect to target.
|
|
852
|
+
* @public
|
|
853
|
+
*/
|
|
854
|
+
export declare type DOMAspect = (typeof DOMAspect)[Exclude<keyof typeof DOMAspect, "none">];
|
|
855
|
+
|
|
856
|
+
/**
|
|
857
|
+
* Aspect-specific guards for a DOM Policy.
|
|
858
|
+
* @public
|
|
859
|
+
*/
|
|
860
|
+
export declare type DOMAspectGuards = {
|
|
861
|
+
/**
|
|
862
|
+
* Guards for attributes.
|
|
863
|
+
*/
|
|
864
|
+
[DOMAspect.attribute]?: DOMSinkGuards;
|
|
865
|
+
/**
|
|
866
|
+
* Guards for boolean attributes.
|
|
867
|
+
*/
|
|
868
|
+
[DOMAspect.booleanAttribute]?: DOMSinkGuards;
|
|
869
|
+
/**
|
|
870
|
+
* Guards for properties.
|
|
871
|
+
*/
|
|
872
|
+
[DOMAspect.property]?: DOMSinkGuards;
|
|
873
|
+
/**
|
|
874
|
+
* Guards for content.
|
|
875
|
+
*/
|
|
876
|
+
[DOMAspect.content]?: DOMSinkGuards;
|
|
877
|
+
/**
|
|
878
|
+
* Guards for token list manipulation.
|
|
879
|
+
*/
|
|
880
|
+
[DOMAspect.tokenList]?: DOMSinkGuards;
|
|
881
|
+
/**
|
|
882
|
+
* Guards for events.
|
|
883
|
+
*/
|
|
884
|
+
[DOMAspect.event]?: DOMSinkGuards;
|
|
885
|
+
};
|
|
886
|
+
|
|
887
|
+
/**
|
|
888
|
+
* Element-specific guards for a DOM Policy.
|
|
889
|
+
* @public
|
|
890
|
+
*/
|
|
891
|
+
export declare type DOMElementGuards = Record<string, DOMAspectGuards>;
|
|
892
|
+
|
|
893
|
+
/**
|
|
894
|
+
* Guard configuration for a DOM Policy.
|
|
895
|
+
* @public
|
|
896
|
+
*/
|
|
897
|
+
export declare type DOMGuards = {
|
|
898
|
+
/**
|
|
899
|
+
* Guards for specific elements.
|
|
900
|
+
*/
|
|
901
|
+
elements: DOMElementGuards;
|
|
902
|
+
/**
|
|
903
|
+
* General aspect guards independent of the element type.
|
|
904
|
+
*/
|
|
905
|
+
aspects: DOMAspectGuards;
|
|
906
|
+
};
|
|
907
|
+
|
|
908
|
+
/**
|
|
909
|
+
* A helper for creating DOM policies.
|
|
910
|
+
* @public
|
|
911
|
+
*/
|
|
912
|
+
export declare const DOMPolicy: Readonly<{
|
|
913
|
+
/**
|
|
914
|
+
* Creates a new DOM Policy object.
|
|
915
|
+
* @param options - The options to use in creating the policy.
|
|
916
|
+
* @returns The newly created DOMPolicy.
|
|
917
|
+
*/
|
|
918
|
+
create(options?: DOMPolicyOptions): Readonly<DOMPolicy_2>;
|
|
919
|
+
}>;
|
|
920
|
+
|
|
921
|
+
/**
|
|
922
|
+
* A security policy that FAST can use to interact with the DOM.
|
|
923
|
+
* @public
|
|
924
|
+
*/
|
|
925
|
+
declare interface DOMPolicy_2 {
|
|
926
|
+
/**
|
|
927
|
+
* Creates safe HTML from the provided value.
|
|
928
|
+
* @param value - The source to convert to safe HTML.
|
|
929
|
+
*/
|
|
930
|
+
createHTML(value: string): string;
|
|
931
|
+
/**
|
|
932
|
+
* Protects a DOM sink that intends to write to the DOM.
|
|
933
|
+
* @param tagName - The tag name for the element to write to.
|
|
934
|
+
* @param aspect - The aspect of the DOM to write to.
|
|
935
|
+
* @param aspectName - The name of the aspect to write to.
|
|
936
|
+
* @param sink - The sink that is used to write to the DOM.
|
|
937
|
+
*/
|
|
938
|
+
protect(tagName: string | null, aspect: DOMAspect, aspectName: string, sink: DOMSink): DOMSink;
|
|
939
|
+
}
|
|
940
|
+
|
|
941
|
+
/**
|
|
942
|
+
* Options for creating a DOM Policy.
|
|
943
|
+
* @public
|
|
944
|
+
*/
|
|
945
|
+
export declare type DOMPolicyOptions = {
|
|
946
|
+
/**
|
|
947
|
+
* The trusted type to use for HTML creation.
|
|
948
|
+
*/
|
|
949
|
+
trustedType?: TrustedTypesPolicy;
|
|
950
|
+
/**
|
|
951
|
+
* The DOM guards used to override or extend the defaults.
|
|
952
|
+
*/
|
|
953
|
+
guards?: Partial<DOMGuards>;
|
|
954
|
+
};
|
|
955
|
+
|
|
956
|
+
/**
|
|
957
|
+
* A function used to send values to a DOM sink.
|
|
958
|
+
* @public
|
|
959
|
+
*/
|
|
960
|
+
export declare type DOMSink = (target: Node, aspectName: string, value: any, ...args: any[]) => void;
|
|
961
|
+
|
|
962
|
+
/**
|
|
963
|
+
* A specific DOM sink guard for a node aspect.
|
|
964
|
+
* @public
|
|
965
|
+
*/
|
|
966
|
+
export declare type DOMSinkGuards = Record<string, (tagName: string | null, aspect: DOMAspect, aspectName: string, sink: DOMSink) => DOMSink>;
|
|
967
|
+
|
|
968
|
+
/**
|
|
969
|
+
* Controls the lifecycle and rendering of a `FASTElement`.
|
|
970
|
+
* @public
|
|
971
|
+
*/
|
|
972
|
+
export declare class ElementController<TElement extends HTMLElement = HTMLElement> implements Notifier, HostController<TElement> {
|
|
973
|
+
/**
|
|
974
|
+
* Internal notifier used to delegate subscriber management.
|
|
975
|
+
*/
|
|
976
|
+
private _notifier;
|
|
977
|
+
/**
|
|
978
|
+
* A map of observable properties that were set on the element before upgrade.
|
|
979
|
+
*/
|
|
980
|
+
private boundObservables;
|
|
981
|
+
/**
|
|
982
|
+
* Indicates whether the controller needs to perform initial rendering.
|
|
983
|
+
*/
|
|
984
|
+
protected needsInitialization: boolean;
|
|
985
|
+
/**
|
|
986
|
+
* Indicates whether the element has an existing shadow root (e.g. from declarative shadow DOM).
|
|
987
|
+
*/
|
|
988
|
+
protected hasExistingShadowRoot: boolean;
|
|
989
|
+
/**
|
|
990
|
+
* Resolves the isPrerendered promise.
|
|
991
|
+
*/
|
|
992
|
+
private _resolvePrerendered;
|
|
993
|
+
/**
|
|
994
|
+
* Resolves the isHydrated promise.
|
|
995
|
+
*/
|
|
996
|
+
private _resolveHydrated;
|
|
997
|
+
/**
|
|
998
|
+
* Resolves `true` when the element had an existing shadow root
|
|
999
|
+
* (from SSR or declarative shadow DOM) at connect time, `false`
|
|
1000
|
+
* otherwise.
|
|
1001
|
+
*/
|
|
1002
|
+
readonly isPrerendered: Promise<boolean>;
|
|
1003
|
+
/**
|
|
1004
|
+
* Resolves `true` after prerendered content has been successfully
|
|
1005
|
+
* hydrated, or `false` when the component is client-side rendered
|
|
1006
|
+
* or hydration is not enabled.
|
|
1007
|
+
*/
|
|
1008
|
+
readonly isHydrated: Promise<boolean>;
|
|
1009
|
+
/**
|
|
1010
|
+
* The template used to render the component.
|
|
1011
|
+
*/
|
|
1012
|
+
private _template;
|
|
1013
|
+
/**
|
|
1014
|
+
* The shadow root options for the component.
|
|
1015
|
+
*/
|
|
1016
|
+
private _shadowRootOptions;
|
|
1017
|
+
/**
|
|
1018
|
+
* The current lifecycle stage of the controller.
|
|
1019
|
+
*/
|
|
1020
|
+
protected stage: Stages;
|
|
1021
|
+
/**
|
|
1022
|
+
* A guard against connecting behaviors multiple times
|
|
1023
|
+
* during connect in scenarios where a behavior adds
|
|
1024
|
+
* another behavior during it's connectedCallback
|
|
1025
|
+
*/
|
|
1026
|
+
private guardBehaviorConnection;
|
|
1027
|
+
/**
|
|
1028
|
+
* The behaviors associated with the component.
|
|
1029
|
+
*/
|
|
1030
|
+
protected behaviors: Map<HostBehavior<TElement>, number> | null;
|
|
1031
|
+
/**
|
|
1032
|
+
* Tracks whether behaviors are connected so that
|
|
1033
|
+
* behaviors cant be connected multiple times
|
|
1034
|
+
*/
|
|
1035
|
+
private behaviorsConnected;
|
|
1036
|
+
/**
|
|
1037
|
+
* The main set of styles used for the component, independent of any
|
|
1038
|
+
* dynamically added styles.
|
|
1039
|
+
*/
|
|
1040
|
+
private _mainStyles;
|
|
1041
|
+
/**
|
|
1042
|
+
* This allows Observable.getNotifier(...) to return the Controller
|
|
1043
|
+
* when the notifier for the Controller itself is being requested. The
|
|
1044
|
+
* result is that the Observable system does not need to create a separate
|
|
1045
|
+
* instance of Notifier for observables on the Controller. The component and
|
|
1046
|
+
* the controller will now share the same notifier, removing one-object construct
|
|
1047
|
+
* per web component instance.
|
|
1048
|
+
*/
|
|
1049
|
+
private readonly $fastController;
|
|
1050
|
+
/**
|
|
1051
|
+
* The element being controlled by this controller.
|
|
1052
|
+
*/
|
|
1053
|
+
readonly source: TElement;
|
|
1054
|
+
/**
|
|
1055
|
+
* The element definition that instructs this controller
|
|
1056
|
+
* in how to handle rendering and other platform integrations.
|
|
1057
|
+
*/
|
|
1058
|
+
readonly definition: FASTElementDefinition;
|
|
1059
|
+
/**
|
|
1060
|
+
* The view associated with the custom element.
|
|
1061
|
+
* @remarks
|
|
1062
|
+
* If `null` then the element is managing its own rendering.
|
|
1063
|
+
*/
|
|
1064
|
+
readonly view: ElementView<TElement> | null;
|
|
1065
|
+
/**
|
|
1066
|
+
* Indicates whether or not the custom element has been
|
|
1067
|
+
* connected to the document.
|
|
1068
|
+
*/
|
|
1069
|
+
get isConnected(): boolean;
|
|
1070
|
+
/**
|
|
1071
|
+
* The context the expression is evaluated against.
|
|
1072
|
+
*/
|
|
1073
|
+
get context(): ExecutionContext;
|
|
1074
|
+
/**
|
|
1075
|
+
* Indicates whether the controller is bound.
|
|
1076
|
+
*/
|
|
1077
|
+
get isBound(): boolean;
|
|
1078
|
+
/**
|
|
1079
|
+
* Indicates how the source's lifetime relates to the controller's lifetime.
|
|
1080
|
+
*/
|
|
1081
|
+
get sourceLifetime(): SourceLifetime | undefined;
|
|
1082
|
+
/**
|
|
1083
|
+
* Gets/sets the template used to render the component.
|
|
1084
|
+
* @remarks
|
|
1085
|
+
* This value can only be accurately read after connect but can be set at any time.
|
|
1086
|
+
*/
|
|
1087
|
+
get template(): ElementViewTemplate<TElement> | null;
|
|
1088
|
+
set template(value: ElementViewTemplate<TElement> | null);
|
|
1089
|
+
/**
|
|
1090
|
+
* The shadow root options for the component.
|
|
1091
|
+
*/
|
|
1092
|
+
get shadowOptions(): ShadowRootOptions | undefined;
|
|
1093
|
+
set shadowOptions(value: ShadowRootOptions | undefined);
|
|
1094
|
+
/**
|
|
1095
|
+
* The main set of styles used for the component, independent
|
|
1096
|
+
* of any dynamically added styles.
|
|
1097
|
+
*/
|
|
1098
|
+
get mainStyles(): ElementStyles | null;
|
|
1099
|
+
set mainStyles(value: ElementStyles | null);
|
|
1100
|
+
/* Excluded from this release type: __constructor */
|
|
1101
|
+
/**
|
|
1102
|
+
* The subject that subscribers will receive notifications for.
|
|
1103
|
+
*/
|
|
1104
|
+
get subject(): TElement;
|
|
1105
|
+
/**
|
|
1106
|
+
* Notifies all subscribers of a property change.
|
|
1107
|
+
* @param args - The property name that changed.
|
|
1108
|
+
*/
|
|
1109
|
+
notify(args: any): void;
|
|
1110
|
+
/**
|
|
1111
|
+
* Subscribes to notification of changes in the element's state.
|
|
1112
|
+
* @param subscriber - The object that is subscribing for change notification.
|
|
1113
|
+
* @param propertyToWatch - The name of the property to watch for changes.
|
|
1114
|
+
*/
|
|
1115
|
+
subscribe(subscriber: Subscriber, propertyToWatch?: any): void;
|
|
1116
|
+
/**
|
|
1117
|
+
* Unsubscribes from notification of changes in the element's state.
|
|
1118
|
+
* @param subscriber - The object that is unsubscribing from change notification.
|
|
1119
|
+
* @param propertyToUnwatch - The name of the property to unsubscribe from.
|
|
1120
|
+
*/
|
|
1121
|
+
unsubscribe(subscriber: Subscriber, propertyToUnwatch?: any): void;
|
|
1122
|
+
/**
|
|
1123
|
+
* Registers an unbind handler with the controller.
|
|
1124
|
+
* @param behavior - An object to call when the controller unbinds.
|
|
1125
|
+
*/
|
|
1126
|
+
onUnbind(behavior: {
|
|
1127
|
+
unbind(controller: ExpressionController<TElement>): any;
|
|
1128
|
+
}): void;
|
|
1129
|
+
/**
|
|
1130
|
+
* Adds the behavior to the component.
|
|
1131
|
+
* @param behavior - The behavior to add.
|
|
1132
|
+
*/
|
|
1133
|
+
addBehavior(behavior: HostBehavior<TElement>): void;
|
|
1134
|
+
/**
|
|
1135
|
+
* Removes the behavior from the component.
|
|
1136
|
+
* @param behavior - The behavior to remove.
|
|
1137
|
+
* @param force - Forces removal even if this behavior was added more than once.
|
|
1138
|
+
*/
|
|
1139
|
+
removeBehavior(behavior: HostBehavior<TElement>, force?: boolean): void;
|
|
1140
|
+
/**
|
|
1141
|
+
* Adds styles to this element. Providing an HTMLStyleElement will attach the element instance to the shadowRoot.
|
|
1142
|
+
* @param styles - The styles to add.
|
|
1143
|
+
*/
|
|
1144
|
+
addStyles(styles: ElementStyles | HTMLStyleElement | null | undefined): void;
|
|
1145
|
+
/**
|
|
1146
|
+
* Removes styles from this element. Providing an HTMLStyleElement will detach the element instance from the shadowRoot.
|
|
1147
|
+
* @param styles - the styles to remove.
|
|
1148
|
+
*/
|
|
1149
|
+
removeStyles(styles: ElementStyles | HTMLStyleElement | null | undefined): void;
|
|
1150
|
+
/**
|
|
1151
|
+
* Runs connected lifecycle behavior on the associated element.
|
|
1152
|
+
*/
|
|
1153
|
+
connect(): void;
|
|
1154
|
+
/**
|
|
1155
|
+
* Binds any observables that were set before upgrade.
|
|
1156
|
+
*/
|
|
1157
|
+
protected bindObservables(): void;
|
|
1158
|
+
/**
|
|
1159
|
+
* Captures own-properties that shadow observable accessors on the prototype so
|
|
1160
|
+
* they can be rebound through the accessor before rendering.
|
|
1161
|
+
*/
|
|
1162
|
+
protected captureBoundObservables(): void;
|
|
1163
|
+
/**
|
|
1164
|
+
* Synchronizes late-defined attribute-map attributes from the live DOM to the
|
|
1165
|
+
* associated property values before the initial render occurs.
|
|
1166
|
+
*/
|
|
1167
|
+
protected syncLateAttributes(): void;
|
|
1168
|
+
/**
|
|
1169
|
+
* Observes late-defined attribute-map attributes that the platform does not
|
|
1170
|
+
* surface through attributeChangedCallback because they were added after
|
|
1171
|
+
* customElements.define() completed.
|
|
1172
|
+
*/
|
|
1173
|
+
protected observeLateAttributes(): void;
|
|
1174
|
+
/**
|
|
1175
|
+
* Connects any existing behaviors on the associated element.
|
|
1176
|
+
*/
|
|
1177
|
+
protected connectBehaviors(): void;
|
|
1178
|
+
/**
|
|
1179
|
+
* Disconnects any behaviors on the associated element.
|
|
1180
|
+
*/
|
|
1181
|
+
protected disconnectBehaviors(): void;
|
|
1182
|
+
/**
|
|
1183
|
+
* Runs disconnected lifecycle behavior on the associated element.
|
|
1184
|
+
*/
|
|
1185
|
+
disconnect(): void;
|
|
1186
|
+
/**
|
|
1187
|
+
* Runs the attribute changed callback for the associated element.
|
|
1188
|
+
* @param name - The name of the attribute that changed.
|
|
1189
|
+
* @param oldValue - The previous value of the attribute.
|
|
1190
|
+
* @param newValue - The new value of the attribute.
|
|
1191
|
+
*/
|
|
1192
|
+
onAttributeChangedCallback(name: string, oldValue: string | null, newValue: string | null): void;
|
|
1193
|
+
/**
|
|
1194
|
+
* Emits a custom HTML event.
|
|
1195
|
+
* @param type - The type name of the event.
|
|
1196
|
+
* @param detail - The event detail object to send with the event.
|
|
1197
|
+
* @param options - The event options. By default bubbles and composed.
|
|
1198
|
+
* @remarks
|
|
1199
|
+
* Only emits events if connected.
|
|
1200
|
+
*/
|
|
1201
|
+
emit(type: string, detail?: any, options?: Omit<CustomEventInit, "detail">): void | boolean;
|
|
1202
|
+
/**
|
|
1203
|
+
* Renders the provided template to the element.
|
|
1204
|
+
*
|
|
1205
|
+
* @param template - The template to render.
|
|
1206
|
+
* @remarks
|
|
1207
|
+
* If `null` is provided, any existing view will be removed.
|
|
1208
|
+
*/
|
|
1209
|
+
protected renderTemplate(template: ElementViewTemplate | null | undefined): void;
|
|
1210
|
+
/**
|
|
1211
|
+
* Standard client-side render: clears any stale content, clones the
|
|
1212
|
+
* compiled fragment, binds, and appends to the host.
|
|
1213
|
+
*/
|
|
1214
|
+
private renderClientSide;
|
|
1215
|
+
/**
|
|
1216
|
+
* Locates or creates a controller for the specified element.
|
|
1217
|
+
* @param element - The element to return the controller for.
|
|
1218
|
+
* @param override - Reset the controller even if one has been defined.
|
|
1219
|
+
* @remarks
|
|
1220
|
+
* The specified element must have a {@link FASTElementDefinition}
|
|
1221
|
+
* registered either through the use of the {@link customElement}
|
|
1222
|
+
* decorator or a call to `FASTElement.define`.
|
|
1223
|
+
*/
|
|
1224
|
+
static forCustomElement(element: HTMLElement, override?: boolean): ElementController;
|
|
1225
|
+
/**
|
|
1226
|
+
* Sets the strategy that ElementController.forCustomElement uses to construct
|
|
1227
|
+
* ElementController instances for an element.
|
|
1228
|
+
* @param strategy - The strategy to use.
|
|
1229
|
+
*/
|
|
1230
|
+
static setStrategy(strategy: ElementControllerStrategy): void;
|
|
1231
|
+
/* Excluded from this release type: hydrationHook */
|
|
1232
|
+
/* Excluded from this release type: installHydrationHook */
|
|
1233
|
+
}
|
|
1234
|
+
|
|
1235
|
+
/**
|
|
1236
|
+
* A type that instantiates an ElementController
|
|
1237
|
+
* @public
|
|
1238
|
+
*/
|
|
1239
|
+
export declare interface ElementControllerStrategy {
|
|
1240
|
+
new (element: HTMLElement, definition: FASTElementDefinition): ElementController;
|
|
1241
|
+
}
|
|
1242
|
+
|
|
1243
|
+
/**
|
|
1244
|
+
* Creates a function that can be used to filter a Node array, selecting only elements.
|
|
1245
|
+
* @param selector - An optional selector to restrict the filter to.
|
|
1246
|
+
* @public
|
|
1247
|
+
*/
|
|
1248
|
+
export declare const elements: (selector?: string) => ElementsFilter;
|
|
1249
|
+
|
|
1250
|
+
/**
|
|
1251
|
+
* Elements filter function type.
|
|
1252
|
+
*
|
|
1253
|
+
* @public
|
|
1254
|
+
*/
|
|
1255
|
+
export declare type ElementsFilter = (value: Node, index?: number, array?: Node[]) => boolean;
|
|
1256
|
+
|
|
1257
|
+
/**
|
|
1258
|
+
* Represents styles that can be applied to a custom element.
|
|
1259
|
+
* @public
|
|
1260
|
+
*/
|
|
1261
|
+
export declare class ElementStyles {
|
|
1262
|
+
readonly styles: ReadonlyArray<ComposableStyles>;
|
|
1263
|
+
private targets;
|
|
1264
|
+
private _strategy;
|
|
1265
|
+
/**
|
|
1266
|
+
* Gets the StyleStrategy associated with these element styles.
|
|
1267
|
+
*/
|
|
1268
|
+
get strategy(): StyleStrategy;
|
|
1269
|
+
/**
|
|
1270
|
+
* Creates an instance of ElementStyles.
|
|
1271
|
+
* @param styles - The styles that will be associated with elements.
|
|
1272
|
+
*/
|
|
1273
|
+
constructor(styles: ReadonlyArray<ComposableStyles>);
|
|
1274
|
+
/* Excluded from this release type: addStylesTo */
|
|
1275
|
+
/* Excluded from this release type: removeStylesFrom */
|
|
1276
|
+
/* Excluded from this release type: isAttachedTo */
|
|
1277
|
+
/**
|
|
1278
|
+
* Sets the strategy that handles adding/removing these styles for an element.
|
|
1279
|
+
* @param strategy - The strategy to use.
|
|
1280
|
+
*/
|
|
1281
|
+
withStrategy(Strategy: ConstructibleStyleStrategy): this;
|
|
1282
|
+
/**
|
|
1283
|
+
* Sets the default strategy type to use when creating style strategies.
|
|
1284
|
+
* @param Strategy - The strategy type to construct.
|
|
1285
|
+
*/
|
|
1286
|
+
static setDefaultStrategy(Strategy: ConstructibleStyleStrategy): void;
|
|
1287
|
+
/**
|
|
1288
|
+
* Normalizes a set of composable style options.
|
|
1289
|
+
* @param styles - The style options to normalize.
|
|
1290
|
+
* @returns A singular ElementStyles instance or undefined.
|
|
1291
|
+
*/
|
|
1292
|
+
static normalize(styles: ComposableStyles | ComposableStyles[] | undefined): ElementStyles | undefined;
|
|
1293
|
+
/**
|
|
1294
|
+
* Indicates whether the DOM supports the adoptedStyleSheets feature.
|
|
1295
|
+
*/
|
|
1296
|
+
static readonly supportsAdoptedStyleSheets: boolean;
|
|
1297
|
+
}
|
|
1298
|
+
|
|
1299
|
+
/**
|
|
1300
|
+
* A View representing DOM nodes specifically for rendering the view of a custom element.
|
|
1301
|
+
* @public
|
|
1302
|
+
*/
|
|
1303
|
+
export declare interface ElementView<TSource = any, TParent = any> extends View<TSource, TParent> {
|
|
1304
|
+
/**
|
|
1305
|
+
* Indicates how the source's lifetime relates to the controller's lifetime.
|
|
1306
|
+
*/
|
|
1307
|
+
readonly sourceLifetime?: SourceLifetime;
|
|
1308
|
+
/**
|
|
1309
|
+
* Registers an unbind handler with the controller.
|
|
1310
|
+
* @param behavior - An object to call when the controller unbinds.
|
|
1311
|
+
*/
|
|
1312
|
+
onUnbind(behavior: {
|
|
1313
|
+
unbind(controller: ViewController<TSource, TParent>): any;
|
|
1314
|
+
}): void;
|
|
1315
|
+
/**
|
|
1316
|
+
* Appends the view's DOM nodes to the referenced node.
|
|
1317
|
+
* @param node - The parent node to append the view's DOM nodes to.
|
|
1318
|
+
*/
|
|
1319
|
+
appendTo(node: Node): void;
|
|
1320
|
+
}
|
|
1321
|
+
|
|
1322
|
+
/**
|
|
1323
|
+
* A template capable of creating views specifically for rendering custom elements.
|
|
1324
|
+
* @public
|
|
1325
|
+
*/
|
|
1326
|
+
export declare interface ElementViewTemplate<TSource = any, TParent = any> {
|
|
1327
|
+
/**
|
|
1328
|
+
* Creates an ElementView instance based on this template definition.
|
|
1329
|
+
* @param hostBindingTarget - The element that host behaviors will be bound to.
|
|
1330
|
+
*/
|
|
1331
|
+
create(hostBindingTarget: Element): ElementView<TSource, TParent>;
|
|
1332
|
+
/**
|
|
1333
|
+
* Creates an HTMLView from this template, binds it to the source, and then appends it to the host.
|
|
1334
|
+
* @param source - The data source to bind the template to.
|
|
1335
|
+
* @param host - The Element where the template will be rendered.
|
|
1336
|
+
* @param hostBindingTarget - An HTML element to target the host bindings at if different from the
|
|
1337
|
+
* host that the template is being attached to.
|
|
1338
|
+
*/
|
|
1339
|
+
render(source: TSource, host: Node, hostBindingTarget?: Element): ElementView<TSource, TParent>;
|
|
1340
|
+
}
|
|
1341
|
+
|
|
1342
|
+
/**
|
|
1343
|
+
* A readonly, empty array.
|
|
1344
|
+
* @remarks
|
|
1345
|
+
* Typically returned by APIs that return arrays when there are
|
|
1346
|
+
* no actual items to return.
|
|
1347
|
+
* @public
|
|
1348
|
+
*/
|
|
1349
|
+
export declare const emptyArray: readonly never[];
|
|
1350
|
+
|
|
1351
|
+
/**
|
|
1352
|
+
* Enables human-readable FAST debug messages.
|
|
1353
|
+
* @public
|
|
1354
|
+
*/
|
|
1355
|
+
export declare function enableDebug(): void;
|
|
1356
|
+
|
|
1357
|
+
/**
|
|
1358
|
+
* A path discovered from an event binding.
|
|
1359
|
+
* @public
|
|
1360
|
+
*/
|
|
1361
|
+
export declare interface EventCachedPath extends CachedPathCommon {
|
|
1362
|
+
type: "event";
|
|
1363
|
+
}
|
|
1364
|
+
|
|
1365
|
+
/**
|
|
1366
|
+
* Provides additional contextual information available to behaviors and expressions.
|
|
1367
|
+
* @public
|
|
1368
|
+
*/
|
|
1369
|
+
export declare interface ExecutionContext<TParent = any> {
|
|
1370
|
+
/**
|
|
1371
|
+
* The index of the current item within a repeat context.
|
|
1372
|
+
*/
|
|
1373
|
+
index: number;
|
|
1374
|
+
/**
|
|
1375
|
+
* The length of the current collection within a repeat context.
|
|
1376
|
+
*/
|
|
1377
|
+
length: number;
|
|
1378
|
+
/**
|
|
1379
|
+
* The parent data source within a nested context.
|
|
1380
|
+
*/
|
|
1381
|
+
parent: TParent;
|
|
1382
|
+
/**
|
|
1383
|
+
* The parent execution context when in nested context scenarios.
|
|
1384
|
+
*/
|
|
1385
|
+
parentContext: ExecutionContext<TParent>;
|
|
1386
|
+
/**
|
|
1387
|
+
* The current event within an event handler.
|
|
1388
|
+
*/
|
|
1389
|
+
readonly event: Event;
|
|
1390
|
+
/**
|
|
1391
|
+
* Indicates whether the current item within a repeat context
|
|
1392
|
+
* has an even index.
|
|
1393
|
+
*/
|
|
1394
|
+
readonly isEven: boolean;
|
|
1395
|
+
/**
|
|
1396
|
+
* Indicates whether the current item within a repeat context
|
|
1397
|
+
* has an odd index.
|
|
1398
|
+
*/
|
|
1399
|
+
readonly isOdd: boolean;
|
|
1400
|
+
/**
|
|
1401
|
+
* Indicates whether the current item within a repeat context
|
|
1402
|
+
* is the first item in the collection.
|
|
1403
|
+
*/
|
|
1404
|
+
readonly isFirst: boolean;
|
|
1405
|
+
/**
|
|
1406
|
+
* Indicates whether the current item within a repeat context
|
|
1407
|
+
* is somewhere in the middle of the collection.
|
|
1408
|
+
*/
|
|
1409
|
+
readonly isInMiddle: boolean;
|
|
1410
|
+
/**
|
|
1411
|
+
* Indicates whether the current item within a repeat context
|
|
1412
|
+
* is the last item in the collection.
|
|
1413
|
+
*/
|
|
1414
|
+
readonly isLast: boolean;
|
|
1415
|
+
/**
|
|
1416
|
+
* Returns the typed event detail of a custom event.
|
|
1417
|
+
*/
|
|
1418
|
+
eventDetail<TDetail>(): TDetail;
|
|
1419
|
+
/**
|
|
1420
|
+
* Returns the typed event target of the event.
|
|
1421
|
+
*/
|
|
1422
|
+
eventTarget<TTarget extends EventTarget>(): TTarget;
|
|
1423
|
+
}
|
|
1424
|
+
|
|
1425
|
+
/**
|
|
1426
|
+
* Provides additional contextual information available to behaviors and expressions.
|
|
1427
|
+
* @public
|
|
1428
|
+
*/
|
|
1429
|
+
export declare const ExecutionContext: Readonly<{
|
|
1430
|
+
/**
|
|
1431
|
+
* A default execution context.
|
|
1432
|
+
*/
|
|
1433
|
+
default: ExecutionContext<any>;
|
|
1434
|
+
/**
|
|
1435
|
+
* Gets the current event.
|
|
1436
|
+
* @returns An event object.
|
|
1437
|
+
*/
|
|
1438
|
+
getEvent(): Event | null;
|
|
1439
|
+
/**
|
|
1440
|
+
* Sets the current event.
|
|
1441
|
+
* @param event - An event object.
|
|
1442
|
+
*/
|
|
1443
|
+
setEvent(event: Event | null): void;
|
|
1444
|
+
}>;
|
|
1445
|
+
|
|
1446
|
+
/**
|
|
1447
|
+
* The signature of an arrow function capable of being evaluated
|
|
1448
|
+
* against source data and within an execution context.
|
|
1449
|
+
* @public
|
|
1450
|
+
*/
|
|
1451
|
+
export declare type Expression<TSource = any, TReturn = any, TParent = any> = (source: TSource, context: ExecutionContext<TParent>) => TReturn;
|
|
1452
|
+
|
|
1453
|
+
/**
|
|
1454
|
+
* Controls the lifecycle of an expression and provides relevant context.
|
|
1455
|
+
* @public
|
|
1456
|
+
*/
|
|
1457
|
+
export declare interface ExpressionController<TSource = any, TParent = any> {
|
|
1458
|
+
/**
|
|
1459
|
+
* The source the expression is evaluated against.
|
|
1460
|
+
*/
|
|
1461
|
+
readonly source: TSource;
|
|
1462
|
+
/**
|
|
1463
|
+
* Indicates how the source's lifetime relates to the controller's lifetime.
|
|
1464
|
+
*/
|
|
1465
|
+
readonly sourceLifetime?: SourceLifetime;
|
|
1466
|
+
/**
|
|
1467
|
+
* The context the expression is evaluated against.
|
|
1468
|
+
*/
|
|
1469
|
+
readonly context: ExecutionContext<TParent>;
|
|
1470
|
+
/**
|
|
1471
|
+
* Indicates whether the controller is bound.
|
|
1472
|
+
*/
|
|
1473
|
+
readonly isBound: boolean;
|
|
1474
|
+
/**
|
|
1475
|
+
* Registers an unbind handler with the controller.
|
|
1476
|
+
* @param behavior - An object to call when the controller unbinds.
|
|
1477
|
+
*/
|
|
1478
|
+
onUnbind(behavior: {
|
|
1479
|
+
unbind(controller: ExpressionController<TSource, TParent>): any;
|
|
1480
|
+
}): void;
|
|
1481
|
+
}
|
|
1482
|
+
|
|
1483
|
+
/**
|
|
1484
|
+
* Enables evaluation of and subscription to a binding.
|
|
1485
|
+
* @public
|
|
1486
|
+
*/
|
|
1487
|
+
export declare interface ExpressionNotifier<TSource = any, TReturn = any, TParent = any> extends Notifier, ExpressionObserver<TSource, TReturn, TParent>, Disposable {
|
|
1488
|
+
/**
|
|
1489
|
+
* Observes the expression.
|
|
1490
|
+
* @param source - The source for the expression.
|
|
1491
|
+
* @param context - The context for the expression.
|
|
1492
|
+
*/
|
|
1493
|
+
observe(source: TSource, context?: ExecutionContext): TReturn;
|
|
1494
|
+
/**
|
|
1495
|
+
* Gets {@link ObservationRecord|ObservationRecords} that the {@link ExpressionNotifier}
|
|
1496
|
+
* is observing.
|
|
1497
|
+
*/
|
|
1498
|
+
records(): IterableIterator<ObservationRecord>;
|
|
1499
|
+
/**
|
|
1500
|
+
* Sets the update mode used by the observer.
|
|
1501
|
+
* @param isAsync - Indicates whether updates should be asynchronous.
|
|
1502
|
+
* @remarks
|
|
1503
|
+
* By default, the update mode is asynchronous, since that provides the best
|
|
1504
|
+
* performance for template rendering scenarios. Passing false to setMode will
|
|
1505
|
+
* instead cause the observer to notify subscribers immediately when changes occur.
|
|
1506
|
+
*/
|
|
1507
|
+
setMode(isAsync: boolean): void;
|
|
1508
|
+
}
|
|
1509
|
+
|
|
1510
|
+
/**
|
|
1511
|
+
* Observes an expression for changes.
|
|
1512
|
+
* @public
|
|
1513
|
+
*/
|
|
1514
|
+
export declare interface ExpressionObserver<TSource = any, TReturn = any, TParent = any> {
|
|
1515
|
+
/**
|
|
1516
|
+
* Binds the expression to the source.
|
|
1517
|
+
* @param controller - The controller that manages the lifecycle and related
|
|
1518
|
+
* context for the expression.
|
|
1519
|
+
*/
|
|
1520
|
+
bind(controller: ExpressionController<TSource, TParent>): TReturn;
|
|
1521
|
+
}
|
|
1522
|
+
|
|
1523
|
+
/**
|
|
1524
|
+
* The FAST messaging API for warnings and errors.
|
|
1525
|
+
* @public
|
|
1526
|
+
*/
|
|
1527
|
+
export declare const FAST: {
|
|
1528
|
+
/**
|
|
1529
|
+
* Sends a warning to the developer.
|
|
1530
|
+
* @param code - The warning code to send.
|
|
1531
|
+
* @param values - Values relevant for the warning message.
|
|
1532
|
+
*/
|
|
1533
|
+
warn(_code: number, _values?: Record<string, any>): void;
|
|
1534
|
+
/**
|
|
1535
|
+
* Creates an error from a code.
|
|
1536
|
+
* @param code - The error code.
|
|
1537
|
+
* @param values - Values relevant for the error message.
|
|
1538
|
+
*/
|
|
1539
|
+
error(code: number, _values?: Record<string, any>): Error;
|
|
1540
|
+
/**
|
|
1541
|
+
* Adds debug messages for errors and warnings.
|
|
1542
|
+
* @param messages - The message dictionary to add.
|
|
1543
|
+
*/
|
|
1544
|
+
addMessages(messages: Record<number, string>): void;
|
|
1545
|
+
};
|
|
1546
|
+
|
|
1547
|
+
/**
|
|
1548
|
+
* Represents a custom element based on the FASTElement infrastructure.
|
|
1549
|
+
* @public
|
|
1550
|
+
*/
|
|
1551
|
+
export declare interface FASTElement extends HTMLElement {
|
|
1552
|
+
/**
|
|
1553
|
+
* The underlying controller that handles the lifecycle and rendering of
|
|
1554
|
+
* this FASTElement.
|
|
1555
|
+
*/
|
|
1556
|
+
readonly $fastController: ElementController;
|
|
1557
|
+
/**
|
|
1558
|
+
* Emits a custom HTML event.
|
|
1559
|
+
* @param type - The type name of the event.
|
|
1560
|
+
* @param detail - The event detail object to send with the event.
|
|
1561
|
+
* @param options - The event options. By default bubbles and composed.
|
|
1562
|
+
* @remarks
|
|
1563
|
+
* Only emits events if the element is connected.
|
|
1564
|
+
*/
|
|
1565
|
+
$emit(type: string, detail?: any, options?: Omit<CustomEventInit, "detail">): boolean | void;
|
|
1566
|
+
/**
|
|
1567
|
+
* The connected callback for this FASTElement.
|
|
1568
|
+
* @remarks
|
|
1569
|
+
* This method is invoked by the platform whenever this FASTElement
|
|
1570
|
+
* becomes connected to the document.
|
|
1571
|
+
*/
|
|
1572
|
+
connectedCallback(): void;
|
|
1573
|
+
/**
|
|
1574
|
+
* The disconnected callback for this FASTElement.
|
|
1575
|
+
* @remarks
|
|
1576
|
+
* This method is invoked by the platform whenever this FASTElement
|
|
1577
|
+
* becomes disconnected from the document.
|
|
1578
|
+
*/
|
|
1579
|
+
disconnectedCallback(): void;
|
|
1580
|
+
/**
|
|
1581
|
+
* The attribute changed callback for this FASTElement.
|
|
1582
|
+
* @param name - The name of the attribute that changed.
|
|
1583
|
+
* @param oldValue - The previous value of the attribute.
|
|
1584
|
+
* @param newValue - The new value of the attribute.
|
|
1585
|
+
* @remarks
|
|
1586
|
+
* This method is invoked by the platform whenever an observed
|
|
1587
|
+
* attribute of FASTElement has a value change.
|
|
1588
|
+
*/
|
|
1589
|
+
attributeChangedCallback(name: string, oldValue: string | null, newValue: string | null): void;
|
|
1590
|
+
}
|
|
1591
|
+
|
|
1592
|
+
/**
|
|
1593
|
+
* A minimal base class for FASTElements that also provides
|
|
1594
|
+
* static helpers for working with FASTElements.
|
|
1595
|
+
* @public
|
|
1596
|
+
*/
|
|
1597
|
+
export declare const FASTElement: {
|
|
1598
|
+
new (): FASTElement;
|
|
1599
|
+
define: typeof define;
|
|
1600
|
+
compose: typeof compose;
|
|
1601
|
+
from: typeof from;
|
|
1602
|
+
};
|
|
1603
|
+
|
|
1604
|
+
/**
|
|
1605
|
+
* Defines metadata for a FASTElement.
|
|
1606
|
+
* @public
|
|
1607
|
+
*/
|
|
1608
|
+
export declare class FASTElementDefinition<TType extends Constructable<HTMLElement> = Constructable<HTMLElement>> {
|
|
1609
|
+
private platformDefined;
|
|
1610
|
+
/**
|
|
1611
|
+
* The type this element definition describes.
|
|
1612
|
+
*/
|
|
1613
|
+
readonly type: TType;
|
|
1614
|
+
/**
|
|
1615
|
+
* Indicates if this element has been defined in at least one registry.
|
|
1616
|
+
*/
|
|
1617
|
+
get isDefined(): boolean;
|
|
1618
|
+
/**
|
|
1619
|
+
* The name of the custom element.
|
|
1620
|
+
*/
|
|
1621
|
+
readonly name: string;
|
|
1622
|
+
/**
|
|
1623
|
+
* The custom attributes of the custom element.
|
|
1624
|
+
*/
|
|
1625
|
+
readonly attributes: ReadonlyArray<AttributeDefinition>;
|
|
1626
|
+
/**
|
|
1627
|
+
* A map enabling lookup of attribute by associated property name.
|
|
1628
|
+
*/
|
|
1629
|
+
readonly propertyLookup: Record<string, AttributeDefinition>;
|
|
1630
|
+
/**
|
|
1631
|
+
* A map enabling lookup of property by associated attribute name.
|
|
1632
|
+
*/
|
|
1633
|
+
readonly attributeLookup: Record<string, AttributeDefinition>;
|
|
1634
|
+
/**
|
|
1635
|
+
* The template to render for the custom element.
|
|
1636
|
+
*/
|
|
1637
|
+
template?: ElementViewTemplate<InstanceType<TType>>;
|
|
1638
|
+
/**
|
|
1639
|
+
* The styles to associate with the custom element.
|
|
1640
|
+
*/
|
|
1641
|
+
readonly styles?: ElementStyles;
|
|
1642
|
+
/**
|
|
1643
|
+
* Options controlling the creation of the custom element's shadow DOM.
|
|
1644
|
+
*/
|
|
1645
|
+
shadowOptions?: ShadowRootOptions;
|
|
1646
|
+
/**
|
|
1647
|
+
* Options controlling how the custom element is defined with the platform.
|
|
1648
|
+
*/
|
|
1649
|
+
readonly elementOptions: ElementDefinitionOptions;
|
|
1650
|
+
/**
|
|
1651
|
+
* The registry to register this component in by default.
|
|
1652
|
+
*/
|
|
1653
|
+
readonly registry: CustomElementRegistry;
|
|
1654
|
+
/**
|
|
1655
|
+
* Lifecycle callbacks for template events.
|
|
1656
|
+
*/
|
|
1657
|
+
readonly lifecycleCallbacks?: TemplateLifecycleCallbacks;
|
|
1658
|
+
/**
|
|
1659
|
+
* The optional schema associated with the custom element definition.
|
|
1660
|
+
* Declarative templates assign this automatically during template resolution.
|
|
1661
|
+
* Non-declarative callers can provide one for schema-driven extensions.
|
|
1662
|
+
*/
|
|
1663
|
+
schema?: Schema;
|
|
1664
|
+
/**
|
|
1665
|
+
* The definition has been registered to the FAST element registry.
|
|
1666
|
+
*/
|
|
1667
|
+
static isRegistered: Record<string, Function>;
|
|
1668
|
+
private constructor();
|
|
1669
|
+
/**
|
|
1670
|
+
* Defines a custom element based on this definition.
|
|
1671
|
+
* @param registry - The element registry to define the element in.
|
|
1672
|
+
* @param extensions - An optional array of extension callbacks to invoke
|
|
1673
|
+
* with this definition before platform registration.
|
|
1674
|
+
* @remarks
|
|
1675
|
+
* This operation is idempotent per registry.
|
|
1676
|
+
*/
|
|
1677
|
+
define(registry?: CustomElementRegistry, extensions?: FASTElementExtension[]): this;
|
|
1678
|
+
/**
|
|
1679
|
+
* Creates an instance of FASTElementDefinition.
|
|
1680
|
+
* @param type - The type this definition is being created for.
|
|
1681
|
+
* @param nameOrDef - The name of the element to define or a config object
|
|
1682
|
+
* that describes the element to define.
|
|
1683
|
+
*/
|
|
1684
|
+
static compose<TType extends Constructable<HTMLElement> = Constructable<HTMLElement>>(type: TType, nameOrDef?: string | PartialFASTElementDefinition<TType>): Promise<FASTElementDefinition<TType>>;
|
|
1685
|
+
/* Excluded from this release type: registerBaseType */
|
|
1686
|
+
/**
|
|
1687
|
+
* Gets the element definition associated with the specified type.
|
|
1688
|
+
* @param type - The custom element type to retrieve the definition for.
|
|
1689
|
+
*/
|
|
1690
|
+
static readonly getByType: (key: Function) => FASTElementDefinition<Constructable<HTMLElement>> | undefined;
|
|
1691
|
+
/**
|
|
1692
|
+
* Gets the element definition associated with the instance.
|
|
1693
|
+
* @param instance - The custom element instance to retrieve the definition for.
|
|
1694
|
+
*/
|
|
1695
|
+
static readonly getForInstance: (object: any) => FASTElementDefinition<Constructable<HTMLElement>> | undefined;
|
|
1696
|
+
/* Excluded from this release type: register */
|
|
1697
|
+
}
|
|
1698
|
+
|
|
1699
|
+
/**
|
|
1700
|
+
* A callback that receives a FASTElementDefinition during element registration.
|
|
1701
|
+
* Extensions are invoked before the element is registered with the platform,
|
|
1702
|
+
* allowing plugins to inspect or act on the resolved definition.
|
|
1703
|
+
* @public
|
|
1704
|
+
*/
|
|
1705
|
+
export declare type FASTElementExtension = (definition: FASTElementDefinition) => void;
|
|
1706
|
+
|
|
1707
|
+
/* Excluded from this release type: fastElementRegistry */
|
|
1708
|
+
|
|
1709
|
+
/**
|
|
1710
|
+
* Resolves an element template from a composed definition.
|
|
1711
|
+
* @public
|
|
1712
|
+
*/
|
|
1713
|
+
export declare type FASTElementTemplateResolver<TType extends Constructable<HTMLElement> = Constructable<HTMLElement>> = (definition: FASTElementDefinition<TType>) => ElementViewTemplate<InstanceType<TType>> | Promise<ElementViewTemplate<InstanceType<TType>>>;
|
|
1714
|
+
|
|
1715
|
+
declare function from<TBase extends typeof HTMLElement>(BaseType: TBase): new () => InstanceType<TBase> & FASTElement;
|
|
1716
|
+
|
|
1717
|
+
/**
|
|
1718
|
+
* Represents an object that can contribute behavior to a host.
|
|
1719
|
+
* @public
|
|
1720
|
+
*/
|
|
1721
|
+
export declare interface HostBehavior<TSource = any> {
|
|
1722
|
+
/**
|
|
1723
|
+
* Executed when this behavior is attached to a controller.
|
|
1724
|
+
* @param controller - Controls the behavior lifecycle.
|
|
1725
|
+
*/
|
|
1726
|
+
addedCallback?(controller: HostController<TSource>): void;
|
|
1727
|
+
/**
|
|
1728
|
+
* Executed when this behavior is detached from a controller.
|
|
1729
|
+
* @param controller - Controls the behavior lifecycle.
|
|
1730
|
+
*/
|
|
1731
|
+
removedCallback?(controller: HostController<TSource>): void;
|
|
1732
|
+
/**
|
|
1733
|
+
* Executed when this behavior's host is connected.
|
|
1734
|
+
* @param controller - Controls the behavior lifecycle.
|
|
1735
|
+
*/
|
|
1736
|
+
connectedCallback?(controller: HostController<TSource>): void;
|
|
1737
|
+
/**
|
|
1738
|
+
* Executed when this behavior's host is disconnected.
|
|
1739
|
+
* @param controller - Controls the behavior lifecycle.
|
|
1740
|
+
*/
|
|
1741
|
+
disconnectedCallback?(controller: HostController<TSource>): void;
|
|
1742
|
+
}
|
|
1743
|
+
|
|
1744
|
+
/**
|
|
1745
|
+
* Controls the lifecycle and context of behaviors and styles
|
|
1746
|
+
* associated with a component host.
|
|
1747
|
+
* @public
|
|
1748
|
+
*/
|
|
1749
|
+
export declare interface HostController<TSource = any> extends ExpressionController<TSource> {
|
|
1750
|
+
/**
|
|
1751
|
+
* Indicates whether the host is connected or not.
|
|
1752
|
+
*/
|
|
1753
|
+
readonly isConnected: boolean;
|
|
1754
|
+
/**
|
|
1755
|
+
* The main set of styles used for the component, independent
|
|
1756
|
+
* of any behavior-specific styles.
|
|
1757
|
+
*/
|
|
1758
|
+
mainStyles: ElementStyles | null;
|
|
1759
|
+
/**
|
|
1760
|
+
* Adds the behavior to the component.
|
|
1761
|
+
* @param behavior - The behavior to add.
|
|
1762
|
+
*/
|
|
1763
|
+
addBehavior(behavior: HostBehavior<TSource>): void;
|
|
1764
|
+
/**
|
|
1765
|
+
* Removes the behavior from the component.
|
|
1766
|
+
* @param behavior - The behavior to remove.
|
|
1767
|
+
* @param force - Forces removal even if this behavior was added more than once.
|
|
1768
|
+
*/
|
|
1769
|
+
removeBehavior(behavior: HostBehavior<TSource>, force?: boolean): void;
|
|
1770
|
+
/**
|
|
1771
|
+
* Adds styles to this element. Providing an HTMLStyleElement will attach the element instance to the shadowRoot.
|
|
1772
|
+
* @param styles - The styles to add.
|
|
1773
|
+
*/
|
|
1774
|
+
addStyles(styles: ElementStyles | HTMLStyleElement | null | undefined): void;
|
|
1775
|
+
/**
|
|
1776
|
+
* Removes styles from this element. Providing an HTMLStyleElement will detach the element instance from the shadowRoot.
|
|
1777
|
+
* @param styles - the styles to remove.
|
|
1778
|
+
*/
|
|
1779
|
+
removeStyles(styles: ElementStyles | HTMLStyleElement | null | undefined): void;
|
|
1780
|
+
}
|
|
1781
|
+
|
|
1782
|
+
/**
|
|
1783
|
+
* Transforms a template literal string into a ViewTemplate.
|
|
1784
|
+
* @param strings - The string fragments that are interpolated with the values.
|
|
1785
|
+
* @param values - The values that are interpolated with the string fragments.
|
|
1786
|
+
* @remarks
|
|
1787
|
+
* The html helper supports interpolation of strings, numbers, binding expressions,
|
|
1788
|
+
* other template instances, and Directive instances.
|
|
1789
|
+
* @public
|
|
1790
|
+
*/
|
|
1791
|
+
export declare const html: HTMLTemplateTag;
|
|
1792
|
+
|
|
1793
|
+
/**
|
|
1794
|
+
* The central binding directive that bridges data expressions and DOM updates.
|
|
1795
|
+
*
|
|
1796
|
+
* HTMLBindingDirective fulfills three roles simultaneously:
|
|
1797
|
+
* - **HTMLDirective**: Produces placeholder HTML via createHTML() during template authoring.
|
|
1798
|
+
* - **ViewBehaviorFactory**: Creates behaviors (returns itself) during view creation.
|
|
1799
|
+
* - **ViewBehavior / EventListener**: Attaches to a DOM node during bind, manages
|
|
1800
|
+
* expression observers for reactive updates, and handles DOM events directly.
|
|
1801
|
+
*
|
|
1802
|
+
* The aspectType (set by HTMLDirective.assignAspect during template processing)
|
|
1803
|
+
* determines which DOM "sink" function is used to apply values — e.g.,
|
|
1804
|
+
* setAttribute for attributes, addEventListener for events, textContent for content.
|
|
1805
|
+
*
|
|
1806
|
+
* @public
|
|
1807
|
+
*/
|
|
1808
|
+
export declare class HTMLBindingDirective implements HTMLDirective, ViewBehaviorFactory, ViewBehavior, Aspected, BindingDirective {
|
|
1809
|
+
dataBinding: Binding;
|
|
1810
|
+
private data;
|
|
1811
|
+
private updateTarget;
|
|
1812
|
+
/**
|
|
1813
|
+
* The unique id of the factory.
|
|
1814
|
+
*/
|
|
1815
|
+
id: string;
|
|
1816
|
+
/**
|
|
1817
|
+
* The structural id of the DOM node to which the created behavior will apply.
|
|
1818
|
+
*/
|
|
1819
|
+
targetNodeId: string;
|
|
1820
|
+
/**
|
|
1821
|
+
* The tagname associated with the target node.
|
|
1822
|
+
*/
|
|
1823
|
+
targetTagName: string | null;
|
|
1824
|
+
/**
|
|
1825
|
+
* The policy that the created behavior must run under.
|
|
1826
|
+
*/
|
|
1827
|
+
policy: DOMPolicy_2;
|
|
1828
|
+
/**
|
|
1829
|
+
* The original source aspect exactly as represented in markup.
|
|
1830
|
+
*/
|
|
1831
|
+
sourceAspect: string;
|
|
1832
|
+
/**
|
|
1833
|
+
* The evaluated target aspect, determined after processing the source.
|
|
1834
|
+
*/
|
|
1835
|
+
targetAspect: string;
|
|
1836
|
+
/**
|
|
1837
|
+
* The type of aspect to target.
|
|
1838
|
+
*/
|
|
1839
|
+
aspectType: DOMAspect;
|
|
1840
|
+
/**
|
|
1841
|
+
* Creates an instance of HTMLBindingDirective.
|
|
1842
|
+
* @param dataBinding - The binding configuration to apply.
|
|
1843
|
+
*/
|
|
1844
|
+
constructor(dataBinding: Binding);
|
|
1845
|
+
/**
|
|
1846
|
+
* Creates HTML to be used within a template.
|
|
1847
|
+
* @param add - Can be used to add behavior factories to a template.
|
|
1848
|
+
*/
|
|
1849
|
+
createHTML(add: AddViewBehaviorFactory): string;
|
|
1850
|
+
/**
|
|
1851
|
+
* Creates a behavior.
|
|
1852
|
+
*/
|
|
1853
|
+
createBehavior(): ViewBehavior;
|
|
1854
|
+
/* Excluded from this release type: bind */
|
|
1855
|
+
/* Excluded from this release type: unbind */
|
|
1856
|
+
/* Excluded from this release type: handleEvent */
|
|
1857
|
+
/* Excluded from this release type: handleChange */
|
|
1858
|
+
}
|
|
1859
|
+
|
|
1860
|
+
/**
|
|
1861
|
+
* Instructs the template engine to apply behavior to a node.
|
|
1862
|
+
* @public
|
|
1863
|
+
*/
|
|
1864
|
+
export declare interface HTMLDirective {
|
|
1865
|
+
/**
|
|
1866
|
+
* Creates HTML to be used within a template.
|
|
1867
|
+
* @param add - Can be used to add behavior factories to a template.
|
|
1868
|
+
*/
|
|
1869
|
+
createHTML(add: AddViewBehaviorFactory): string;
|
|
1870
|
+
}
|
|
1871
|
+
|
|
1872
|
+
/**
|
|
1873
|
+
* Instructs the template engine to apply behavior to a node.
|
|
1874
|
+
* @public
|
|
1875
|
+
*/
|
|
1876
|
+
export declare const HTMLDirective: Readonly<{
|
|
1877
|
+
/**
|
|
1878
|
+
* Gets the directive definition associated with the instance.
|
|
1879
|
+
* @param instance - The directive instance to retrieve the definition for.
|
|
1880
|
+
*/
|
|
1881
|
+
getForInstance: (object: any) => HTMLDirectiveDefinition<Constructable<HTMLDirective>> | undefined;
|
|
1882
|
+
/**
|
|
1883
|
+
* Gets the directive definition associated with the specified type.
|
|
1884
|
+
* @param type - The directive type to retrieve the definition for.
|
|
1885
|
+
*/
|
|
1886
|
+
getByType: (key: Function) => HTMLDirectiveDefinition<Constructable<HTMLDirective>> | undefined;
|
|
1887
|
+
/**
|
|
1888
|
+
* Defines an HTMLDirective based on the options.
|
|
1889
|
+
* @param type - The type to define as a directive.
|
|
1890
|
+
* @param options - Options that specify the directive's application.
|
|
1891
|
+
*/
|
|
1892
|
+
define<TType extends Constructable<HTMLDirective>>(type: TType, options?: PartialHTMLDirectiveDefinition): TType;
|
|
1893
|
+
/**
|
|
1894
|
+
* Determines the DOM aspect type for a directive based on attribute name prefix.
|
|
1895
|
+
* The prefix convention maps to aspect types as follows:
|
|
1896
|
+
* - No prefix (e.g. "class") → DOMAspect.attribute
|
|
1897
|
+
* - ":" prefix (e.g. ":value") → DOMAspect.property (":classList" → DOMAspect.tokenList)
|
|
1898
|
+
* - "?" prefix (e.g. "?disabled") → DOMAspect.booleanAttribute
|
|
1899
|
+
* - `@` prefix (e.g. `@click`) → DOMAspect.event
|
|
1900
|
+
* - Falsy or absent value → DOMAspect.content (see remarks)
|
|
1901
|
+
* @param directive - The directive to assign the aspect to.
|
|
1902
|
+
* @param value - The value to base the aspect determination on.
|
|
1903
|
+
* @remarks
|
|
1904
|
+
* If a falsy value is provided, then the content aspect will be assigned.
|
|
1905
|
+
*/
|
|
1906
|
+
assignAspect(directive: Aspected, value?: string): void;
|
|
1907
|
+
}>;
|
|
1908
|
+
|
|
1909
|
+
/**
|
|
1910
|
+
* Decorator: Defines an HTMLDirective.
|
|
1911
|
+
* @param options - Provides options that specify the directive's application.
|
|
1912
|
+
* @public
|
|
1913
|
+
*/
|
|
1914
|
+
export declare function htmlDirective(options?: PartialHTMLDirectiveDefinition): (type: Constructable<HTMLDirective>) => void;
|
|
1915
|
+
|
|
1916
|
+
/**
|
|
1917
|
+
* Defines metadata for an HTMLDirective.
|
|
1918
|
+
* @public
|
|
1919
|
+
*/
|
|
1920
|
+
export declare interface HTMLDirectiveDefinition<TType extends Constructable<HTMLDirective> = Constructable<HTMLDirective>> extends Required<PartialHTMLDirectiveDefinition> {
|
|
1921
|
+
/**
|
|
1922
|
+
* The type that the definition provides metadata for.
|
|
1923
|
+
*/
|
|
1924
|
+
readonly type: TType;
|
|
1925
|
+
}
|
|
1926
|
+
|
|
1927
|
+
/**
|
|
1928
|
+
* The result of a template compilation operation.
|
|
1929
|
+
* @public
|
|
1930
|
+
*/
|
|
1931
|
+
export declare interface HTMLTemplateCompilationResult<TSource = any, TParent = any> {
|
|
1932
|
+
/**
|
|
1933
|
+
* Creates a view instance.
|
|
1934
|
+
* @param hostBindingTarget - The host binding target for the view.
|
|
1935
|
+
*/
|
|
1936
|
+
createView(hostBindingTarget?: Element): HTMLView<TSource, TParent>;
|
|
1937
|
+
readonly factories: CompiledViewBehaviorFactory[];
|
|
1938
|
+
}
|
|
1939
|
+
|
|
1940
|
+
/**
|
|
1941
|
+
* Transforms a template literal string into a ViewTemplate.
|
|
1942
|
+
* @param strings - The string fragments that are interpolated with the values.
|
|
1943
|
+
* @param values - The values that are interpolated with the string fragments.
|
|
1944
|
+
* @remarks
|
|
1945
|
+
* The html helper supports interpolation of strings, numbers, binding expressions,
|
|
1946
|
+
* other template instances, and Directive instances.
|
|
1947
|
+
* @public
|
|
1948
|
+
*/
|
|
1949
|
+
export declare type HTMLTemplateTag = (<TSource = any, TParent = any>(strings: TemplateStringsArray, ...values: TemplateValue<TSource, TParent>[]) => ViewTemplate<TSource, TParent>) & {
|
|
1950
|
+
/**
|
|
1951
|
+
* Transforms a template literal string into partial HTML.
|
|
1952
|
+
* @param html - The HTML string fragment to interpolate.
|
|
1953
|
+
* @public
|
|
1954
|
+
*/
|
|
1955
|
+
partial(html: string): InlineTemplateDirective;
|
|
1956
|
+
};
|
|
1957
|
+
|
|
1958
|
+
/**
|
|
1959
|
+
* The standard View implementation, which also implements ElementView and SyntheticView.
|
|
1960
|
+
* @public
|
|
1961
|
+
*/
|
|
1962
|
+
export declare class HTMLView<TSource = any, TParent = any> extends DefaultExecutionContext<TParent> implements ElementView<TSource, TParent>, SyntheticView<TSource, TParent>, ExecutionContext<TParent> {
|
|
1963
|
+
private fragment;
|
|
1964
|
+
private factories;
|
|
1965
|
+
readonly targets: ViewBehaviorTargets;
|
|
1966
|
+
private behaviors;
|
|
1967
|
+
private unbindables;
|
|
1968
|
+
/**
|
|
1969
|
+
* The data that the view is bound to.
|
|
1970
|
+
*/
|
|
1971
|
+
source: TSource | null;
|
|
1972
|
+
/**
|
|
1973
|
+
* Indicates whether the controller is bound.
|
|
1974
|
+
*/
|
|
1975
|
+
isBound: boolean;
|
|
1976
|
+
/**
|
|
1977
|
+
* Indicates how the source's lifetime relates to the controller's lifetime.
|
|
1978
|
+
*/
|
|
1979
|
+
readonly sourceLifetime: SourceLifetime;
|
|
1980
|
+
/* Excluded from this release type: _skipAttrUpdates */
|
|
1981
|
+
/**
|
|
1982
|
+
* A promise that resolves with `true` after prerendered content
|
|
1983
|
+
* has been hydrated, or `false` when the view is client-side
|
|
1984
|
+
* rendered. Resolves once the first bind completes.
|
|
1985
|
+
*/
|
|
1986
|
+
isPrerendered: Promise<boolean>;
|
|
1987
|
+
/**
|
|
1988
|
+
* Resolves `true` after prerendered content has been hydrated,
|
|
1989
|
+
* `false` when client-side rendered or hydration not enabled.
|
|
1990
|
+
*/
|
|
1991
|
+
isHydrated: Promise<boolean>;
|
|
1992
|
+
/**
|
|
1993
|
+
* The execution context the view is running within.
|
|
1994
|
+
*/
|
|
1995
|
+
context: ExecutionContext<TParent>;
|
|
1996
|
+
/**
|
|
1997
|
+
* The first DOM node in the range of nodes that make up the view.
|
|
1998
|
+
*/
|
|
1999
|
+
firstChild: Node;
|
|
2000
|
+
/**
|
|
2001
|
+
* The last DOM node in the range of nodes that make up the view.
|
|
2002
|
+
*/
|
|
2003
|
+
lastChild: Node;
|
|
2004
|
+
/**
|
|
2005
|
+
* Constructs an instance of HTMLView.
|
|
2006
|
+
* @param fragment - The html fragment that contains the nodes for this view.
|
|
2007
|
+
* @param behaviors - The behaviors to be applied to this view.
|
|
2008
|
+
*/
|
|
2009
|
+
constructor(fragment: DocumentFragment, factories: ReadonlyArray<CompiledViewBehaviorFactory>, targets: ViewBehaviorTargets);
|
|
2010
|
+
/**
|
|
2011
|
+
* Appends the view's DOM nodes to the referenced node.
|
|
2012
|
+
* @param node - The parent node to append the view's DOM nodes to.
|
|
2013
|
+
*/
|
|
2014
|
+
appendTo(node: Node): void;
|
|
2015
|
+
/**
|
|
2016
|
+
* Inserts the view's DOM nodes before the referenced node.
|
|
2017
|
+
* @param node - The node to insert the view's DOM before.
|
|
2018
|
+
*/
|
|
2019
|
+
insertBefore(node: Node): void;
|
|
2020
|
+
/**
|
|
2021
|
+
* Removes the view's DOM nodes.
|
|
2022
|
+
* The nodes are not disposed and the view can later be re-inserted.
|
|
2023
|
+
*/
|
|
2024
|
+
remove(): void;
|
|
2025
|
+
/**
|
|
2026
|
+
* Removes the view and unbinds its behaviors, disposing of DOM nodes afterward.
|
|
2027
|
+
* Once a view has been disposed, it cannot be inserted or bound again.
|
|
2028
|
+
*/
|
|
2029
|
+
dispose(): void;
|
|
2030
|
+
onUnbind(behavior: {
|
|
2031
|
+
unbind(controller: ViewController<TSource, TParent>): void;
|
|
2032
|
+
}): void;
|
|
2033
|
+
/**
|
|
2034
|
+
* Binds a view's behaviors to its binding source.
|
|
2035
|
+
*
|
|
2036
|
+
* On the first call, this iterates through all compiled factories, calling
|
|
2037
|
+
* createBehavior() on each to produce a ViewBehavior instance (e.g., an
|
|
2038
|
+
* HTMLBindingDirective), and then immediately binds it. This is where event
|
|
2039
|
+
* listeners are registered, expression observers are created, and initial
|
|
2040
|
+
* DOM values are set.
|
|
2041
|
+
*
|
|
2042
|
+
* On subsequent calls with a new source, existing behaviors are re-bound
|
|
2043
|
+
* to the new data source, which re-evaluates all binding expressions and
|
|
2044
|
+
* updates the DOM accordingly.
|
|
2045
|
+
*
|
|
2046
|
+
* @param source - The binding source for the view's binding behaviors.
|
|
2047
|
+
* @param context - The execution context to run the behaviors within.
|
|
2048
|
+
*/
|
|
2049
|
+
bind(source: TSource, context?: ExecutionContext<TParent>): void;
|
|
2050
|
+
/**
|
|
2051
|
+
* Unbinds a view's behaviors from its binding source.
|
|
2052
|
+
*/
|
|
2053
|
+
unbind(): void;
|
|
2054
|
+
private evaluateUnbindables;
|
|
2055
|
+
/**
|
|
2056
|
+
* Efficiently disposes of a contiguous range of synthetic view instances.
|
|
2057
|
+
* @param views - A contiguous range of views to be disposed.
|
|
2058
|
+
*/
|
|
2059
|
+
static disposeContiguousBatch(views: SyntheticView[]): void;
|
|
2060
|
+
}
|
|
2061
|
+
|
|
2062
|
+
/**
|
|
2063
|
+
* Inlines a template into another template.
|
|
2064
|
+
* @public
|
|
2065
|
+
*/
|
|
2066
|
+
export declare class InlineTemplateDirective implements HTMLDirective {
|
|
2067
|
+
private html;
|
|
2068
|
+
private factories;
|
|
2069
|
+
/**
|
|
2070
|
+
* An empty template partial.
|
|
2071
|
+
*/
|
|
2072
|
+
static readonly empty: InlineTemplateDirective;
|
|
2073
|
+
/**
|
|
2074
|
+
* Creates an instance of InlineTemplateDirective.
|
|
2075
|
+
* @param template - The template to inline.
|
|
2076
|
+
*/
|
|
2077
|
+
constructor(html: string, factories?: Record<string, ViewBehaviorFactory>);
|
|
2078
|
+
/**
|
|
2079
|
+
* Creates HTML to be used within a template.
|
|
2080
|
+
* @param add - Can be used to add behavior factories to a template.
|
|
2081
|
+
*/
|
|
2082
|
+
createHTML(add: AddViewBehaviorFactory): string;
|
|
2083
|
+
}
|
|
2084
|
+
|
|
2085
|
+
/**
|
|
2086
|
+
* A JSON schema describing a root property.
|
|
2087
|
+
* @public
|
|
2088
|
+
*/
|
|
2089
|
+
export declare interface JSONSchema extends JSONSchemaCommon {
|
|
2090
|
+
$schema: string;
|
|
2091
|
+
$id: string;
|
|
2092
|
+
$defs?: Record<string, JSONSchemaDefinition>;
|
|
2093
|
+
}
|
|
2094
|
+
|
|
2095
|
+
/**
|
|
2096
|
+
* Common properties shared by schema nodes.
|
|
2097
|
+
* @public
|
|
2098
|
+
*/
|
|
2099
|
+
export declare interface JSONSchemaCommon {
|
|
2100
|
+
type?: string;
|
|
2101
|
+
properties?: any;
|
|
2102
|
+
items?: any;
|
|
2103
|
+
anyOf?: Array<any>;
|
|
2104
|
+
$ref?: string;
|
|
2105
|
+
/**
|
|
2106
|
+
* Stamped by `applyConfigToSchema` when an `ObserverMapConfig` excludes
|
|
2107
|
+
* this path. When `false`, the proxy system skips observation for this
|
|
2108
|
+
* node and (if all descendants are also `false`) its subtree.
|
|
2109
|
+
*/
|
|
2110
|
+
$observe?: boolean;
|
|
2111
|
+
}
|
|
2112
|
+
|
|
2113
|
+
/**
|
|
2114
|
+
* A reusable JSON schema definition.
|
|
2115
|
+
* @public
|
|
2116
|
+
*/
|
|
2117
|
+
export declare interface JSONSchemaDefinition extends JSONSchemaCommon {
|
|
2118
|
+
$fast_context: string;
|
|
2119
|
+
$fast_parent_contexts: Array<string>;
|
|
2120
|
+
}
|
|
2121
|
+
|
|
2122
|
+
/**
|
|
2123
|
+
* Observes array lengths.
|
|
2124
|
+
* @public
|
|
2125
|
+
*/
|
|
2126
|
+
export declare interface LengthObserver extends Subscriber {
|
|
2127
|
+
/**
|
|
2128
|
+
* The length of the observed array.
|
|
2129
|
+
*/
|
|
2130
|
+
length: number;
|
|
2131
|
+
}
|
|
2132
|
+
|
|
2133
|
+
/**
|
|
2134
|
+
* Enables observing the length of an array.
|
|
2135
|
+
* @param array - The array to observe the length of.
|
|
2136
|
+
* @returns The length of the array.
|
|
2137
|
+
* @public
|
|
2138
|
+
*/
|
|
2139
|
+
export declare function lengthOf<T>(array: readonly T[]): number;
|
|
2140
|
+
|
|
2141
|
+
/**
|
|
2142
|
+
* Creates an event listener binding.
|
|
2143
|
+
* @param expression - The binding to invoke when the event is raised.
|
|
2144
|
+
* @param options - Event listener options.
|
|
2145
|
+
* @returns A binding configuration.
|
|
2146
|
+
* @public
|
|
2147
|
+
*/
|
|
2148
|
+
export declare function listener<T = any>(expression: Expression<T>, options?: AddEventListenerOptions): Binding<T>;
|
|
2149
|
+
|
|
2150
|
+
/**
|
|
2151
|
+
* Common APIs related to markup generation.
|
|
2152
|
+
* @public
|
|
2153
|
+
*/
|
|
2154
|
+
export declare const Markup: Readonly<{
|
|
2155
|
+
/**
|
|
2156
|
+
* Creates a placeholder string suitable for marking out a location *within*
|
|
2157
|
+
* an attribute value or HTML content.
|
|
2158
|
+
* @param index - The directive index to create the placeholder for.
|
|
2159
|
+
* @remarks
|
|
2160
|
+
* Used internally by binding directives.
|
|
2161
|
+
*/
|
|
2162
|
+
interpolation: (id: string) => string;
|
|
2163
|
+
/**
|
|
2164
|
+
* Creates a placeholder that manifests itself as an attribute on an
|
|
2165
|
+
* element.
|
|
2166
|
+
* @param attributeName - The name of the custom attribute.
|
|
2167
|
+
* @param index - The directive index to create the placeholder for.
|
|
2168
|
+
* @remarks
|
|
2169
|
+
* Used internally by attribute directives such as `ref`, `slotted`, and `children`.
|
|
2170
|
+
*/
|
|
2171
|
+
attribute: (id: string) => string;
|
|
2172
|
+
/**
|
|
2173
|
+
* Creates a placeholder that manifests itself as a marker within the DOM structure.
|
|
2174
|
+
* @param index - The directive index to create the placeholder for.
|
|
2175
|
+
* @remarks
|
|
2176
|
+
* Used internally by structural directives such as `repeat`.
|
|
2177
|
+
*/
|
|
2178
|
+
comment: (id: string) => string;
|
|
2179
|
+
}>;
|
|
2180
|
+
|
|
2181
|
+
/**
|
|
2182
|
+
* Options for configuring node observation behavior.
|
|
2183
|
+
* @public
|
|
2184
|
+
*/
|
|
2185
|
+
export declare interface NodeBehaviorOptions<T = any> {
|
|
2186
|
+
/**
|
|
2187
|
+
* The property to assign the observed nodes to.
|
|
2188
|
+
*/
|
|
2189
|
+
property: T;
|
|
2190
|
+
/**
|
|
2191
|
+
* Filters nodes that are synced with the property.
|
|
2192
|
+
* Called one time for each element in the array.
|
|
2193
|
+
* @param value - The Node that is being inspected.
|
|
2194
|
+
* @param index - The index of the node within the array.
|
|
2195
|
+
* @param array - The Node array that is being filtered.
|
|
2196
|
+
*/
|
|
2197
|
+
filter?: ElementsFilter;
|
|
2198
|
+
}
|
|
2199
|
+
|
|
2200
|
+
/**
|
|
2201
|
+
* A base class for node observation.
|
|
2202
|
+
* @public
|
|
2203
|
+
* @remarks
|
|
2204
|
+
* Internally used by the SlottedDirective and the ChildrenDirective.
|
|
2205
|
+
*/
|
|
2206
|
+
export declare abstract class NodeObservationDirective<T extends NodeBehaviorOptions> extends StatelessAttachedAttributeDirective<T> {
|
|
2207
|
+
private _id;
|
|
2208
|
+
private _controllerProperty;
|
|
2209
|
+
/**
|
|
2210
|
+
* The unique id of the factory.
|
|
2211
|
+
*/
|
|
2212
|
+
get id(): string;
|
|
2213
|
+
set id(value: string);
|
|
2214
|
+
/**
|
|
2215
|
+
* The structural id of the DOM node to which the created behavior will apply.
|
|
2216
|
+
*/
|
|
2217
|
+
targetNodeId: string;
|
|
2218
|
+
/**
|
|
2219
|
+
* Bind this behavior to the source.
|
|
2220
|
+
* @param source - The source to bind to.
|
|
2221
|
+
* @param context - The execution context that the binding is operating within.
|
|
2222
|
+
* @param targets - The targets that behaviors in a view can attach to.
|
|
2223
|
+
*/
|
|
2224
|
+
bind(controller: ViewController): void;
|
|
2225
|
+
/**
|
|
2226
|
+
* Unbinds this behavior from the source.
|
|
2227
|
+
* @param source - The source to unbind from.
|
|
2228
|
+
* @param context - The execution context that the binding is operating within.
|
|
2229
|
+
* @param targets - The targets that behaviors in a view can attach to.
|
|
2230
|
+
*/
|
|
2231
|
+
unbind(controller: ViewController): void;
|
|
2232
|
+
/**
|
|
2233
|
+
* Gets the data source for the target.
|
|
2234
|
+
* @param target - The target to get the source for.
|
|
2235
|
+
* @returns The source.
|
|
2236
|
+
*/
|
|
2237
|
+
protected getSource(target: Node): any;
|
|
2238
|
+
/**
|
|
2239
|
+
* Updates the source property with the computed nodes.
|
|
2240
|
+
* @param source - The source object to assign the nodes property to.
|
|
2241
|
+
* @param value - The nodes to assign to the source object property.
|
|
2242
|
+
*/
|
|
2243
|
+
protected updateTarget(source: any, value: ReadonlyArray<any>): void;
|
|
2244
|
+
/**
|
|
2245
|
+
* Computes the set of nodes that should be assigned to the source property.
|
|
2246
|
+
* @param target - The target to compute the nodes for.
|
|
2247
|
+
* @returns The computed nodes.
|
|
2248
|
+
* @remarks
|
|
2249
|
+
* Applies filters if provided.
|
|
2250
|
+
*/
|
|
2251
|
+
protected computeNodes(target: any): Node[];
|
|
2252
|
+
/**
|
|
2253
|
+
* Begins observation of the nodes.
|
|
2254
|
+
* @param target - The target to observe.
|
|
2255
|
+
*/
|
|
2256
|
+
protected abstract observe(target: any): void;
|
|
2257
|
+
/**
|
|
2258
|
+
* Disconnects observation of the nodes.
|
|
2259
|
+
* @param target - The target to unobserve.
|
|
2260
|
+
*/
|
|
2261
|
+
protected abstract disconnect(target: any): void;
|
|
2262
|
+
/**
|
|
2263
|
+
* Retrieves the raw nodes that should be assigned to the source property.
|
|
2264
|
+
* @param target - The target to get the node to.
|
|
2265
|
+
*/
|
|
2266
|
+
protected abstract getNodes(target: any): Node[];
|
|
2267
|
+
}
|
|
2268
|
+
|
|
2269
|
+
/**
|
|
2270
|
+
* Normalizes the input value into a binding.
|
|
2271
|
+
* @param value - The value to create the default binding for.
|
|
2272
|
+
* @returns A binding configuration for the provided value.
|
|
2273
|
+
* @public
|
|
2274
|
+
*/
|
|
2275
|
+
export declare function normalizeBinding<TSource = any, TReturn = any, TParent = any>(value: Expression<TSource, TReturn, TParent> | Binding<TSource, TReturn, TParent> | {}): Binding<TSource, TReturn, TParent>;
|
|
2276
|
+
|
|
2277
|
+
/**
|
|
2278
|
+
* Provides change notifications for an observed subject.
|
|
2279
|
+
* @public
|
|
2280
|
+
*/
|
|
2281
|
+
export declare interface Notifier {
|
|
2282
|
+
/**
|
|
2283
|
+
* The object that subscribers will receive notifications for.
|
|
2284
|
+
*/
|
|
2285
|
+
readonly subject: any;
|
|
2286
|
+
/**
|
|
2287
|
+
* Notifies all subscribers, based on the args.
|
|
2288
|
+
* @param args - Data passed along to subscribers during notification.
|
|
2289
|
+
* @remarks
|
|
2290
|
+
* In some implementations, the args may be used to target specific subscribers.
|
|
2291
|
+
* This is usually in the case where a propertyName was passed during subscription.
|
|
2292
|
+
*/
|
|
2293
|
+
notify(args: any): void;
|
|
2294
|
+
/**
|
|
2295
|
+
* Subscribes to notification of changes in an object's state.
|
|
2296
|
+
* @param subscriber - The object that is subscribing for change notification.
|
|
2297
|
+
* @param propertyToWatch - The name of the property that the subscriber is interested in watching for changes.
|
|
2298
|
+
* @remarks
|
|
2299
|
+
* Some implementation may or may not require the propertyToWatch.
|
|
2300
|
+
*/
|
|
2301
|
+
subscribe(subscriber: Subscriber, propertyToWatch?: any): void;
|
|
2302
|
+
/**
|
|
2303
|
+
* Unsubscribes from notification of changes in an object's state.
|
|
2304
|
+
* @param subscriber - The object that is unsubscribing from change notification.
|
|
2305
|
+
* @param propertyToUnwatch - The name of the property that the subscriber is no longer interested in watching.
|
|
2306
|
+
* @remarks
|
|
2307
|
+
* Some implementation may or may not require the propertyToUnwatch.
|
|
2308
|
+
*/
|
|
2309
|
+
unsubscribe(subscriber: Subscriber, propertyToUnwatch?: any): void;
|
|
2310
|
+
}
|
|
2311
|
+
|
|
2312
|
+
/**
|
|
2313
|
+
* A {@link ValueConverter} that converts to and from `boolean` values. `null`, `undefined`, `""`,
|
|
2314
|
+
* and `void` values are converted to `null`.
|
|
2315
|
+
* @public
|
|
2316
|
+
*/
|
|
2317
|
+
export declare const nullableBooleanConverter: ValueConverter;
|
|
2318
|
+
|
|
2319
|
+
/**
|
|
2320
|
+
* A {@link ValueConverter} that converts to and from `number` values.
|
|
2321
|
+
* @remarks
|
|
2322
|
+
* This converter allows for nullable numbers, returning `null` if the
|
|
2323
|
+
* input was `null`, `undefined`, or `NaN`.
|
|
2324
|
+
* @public
|
|
2325
|
+
*/
|
|
2326
|
+
export declare const nullableNumberConverter: ValueConverter;
|
|
2327
|
+
|
|
2328
|
+
/**
|
|
2329
|
+
* Common Observable APIs.
|
|
2330
|
+
* @public
|
|
2331
|
+
*/
|
|
2332
|
+
export declare const Observable: Readonly<{
|
|
2333
|
+
/* Excluded from this release type: setArrayObserverFactory */
|
|
2334
|
+
/**
|
|
2335
|
+
* Gets a notifier for an object or Array.
|
|
2336
|
+
* @param source - The object or Array to get the notifier for.
|
|
2337
|
+
*/
|
|
2338
|
+
getNotifier: <T extends Notifier = Notifier>(source: any) => T;
|
|
2339
|
+
/**
|
|
2340
|
+
* Records a property change for a source object.
|
|
2341
|
+
* @param source - The object to record the change against.
|
|
2342
|
+
* @param propertyName - The property to track as changed.
|
|
2343
|
+
*/
|
|
2344
|
+
track(source: unknown, propertyName: string): void;
|
|
2345
|
+
/**
|
|
2346
|
+
* Notifies watchers that the currently executing property getter or function is volatile
|
|
2347
|
+
* with respect to its observable dependencies.
|
|
2348
|
+
*/
|
|
2349
|
+
trackVolatile(): void;
|
|
2350
|
+
/**
|
|
2351
|
+
* Notifies subscribers of a source object of changes.
|
|
2352
|
+
* @param source - the object to notify of changes.
|
|
2353
|
+
* @param args - The change args to pass to subscribers.
|
|
2354
|
+
*/
|
|
2355
|
+
notify(source: unknown, args: any): void;
|
|
2356
|
+
/**
|
|
2357
|
+
* Defines an observable property on an object or prototype.
|
|
2358
|
+
* @param target - The target object to define the observable on.
|
|
2359
|
+
* @param nameOrAccessor - The name of the property to define as observable;
|
|
2360
|
+
* or a custom accessor that specifies the property name and accessor implementation.
|
|
2361
|
+
*/
|
|
2362
|
+
defineProperty(target: {}, nameOrAccessor: string | Accessor): void;
|
|
2363
|
+
/**
|
|
2364
|
+
* Finds all the observable accessors defined on the target,
|
|
2365
|
+
* including its prototype chain.
|
|
2366
|
+
* @param target - The target object to search for accessor on.
|
|
2367
|
+
*/
|
|
2368
|
+
getAccessors: (target: {}) => Accessor[];
|
|
2369
|
+
/**
|
|
2370
|
+
* Creates a {@link ExpressionNotifier} that can watch the
|
|
2371
|
+
* provided {@link Expression} for changes.
|
|
2372
|
+
* @param expression - The binding to observe.
|
|
2373
|
+
* @param initialSubscriber - An initial subscriber to changes in the binding value.
|
|
2374
|
+
* @param isVolatileBinding - Indicates whether the binding's dependency list must be re-evaluated on every value evaluation.
|
|
2375
|
+
*/
|
|
2376
|
+
binding<TSource = any, TReturn = any>(expression: Expression<TSource, TReturn, any>, initialSubscriber?: Subscriber, isVolatileBinding?: boolean): ExpressionNotifier<TSource, TReturn, any>;
|
|
2377
|
+
/**
|
|
2378
|
+
* Determines whether a binding expression is volatile and needs to have its dependency list re-evaluated
|
|
2379
|
+
* on every evaluation of the value.
|
|
2380
|
+
* @param expression - The binding to inspect.
|
|
2381
|
+
*/
|
|
2382
|
+
isVolatileBinding<TSource_1 = any, TReturn_1 = any>(expression: Expression<TSource_1, TReturn_1, any>): boolean;
|
|
2383
|
+
}>;
|
|
2384
|
+
|
|
2385
|
+
/**
|
|
2386
|
+
* Decorator: Defines an observable property on the target.
|
|
2387
|
+
* @param target - The target to define the observable on.
|
|
2388
|
+
* @param nameOrAccessor - The property name or accessor to define the observable as.
|
|
2389
|
+
* @public
|
|
2390
|
+
*/
|
|
2391
|
+
export declare function observable(target: {}, nameOrAccessor: string | Accessor): void;
|
|
2392
|
+
|
|
2393
|
+
/**
|
|
2394
|
+
* A record of observable property access.
|
|
2395
|
+
* @public
|
|
2396
|
+
*/
|
|
2397
|
+
export declare interface ObservationRecord {
|
|
2398
|
+
/**
|
|
2399
|
+
* The source object with an observable property that was accessed.
|
|
2400
|
+
*/
|
|
2401
|
+
propertySource: any;
|
|
2402
|
+
/**
|
|
2403
|
+
* The name of the observable property on {@link ObservationRecord.propertySource} that was accessed.
|
|
2404
|
+
*/
|
|
2405
|
+
propertyName: string;
|
|
2406
|
+
}
|
|
2407
|
+
|
|
2408
|
+
/**
|
|
2409
|
+
* Creates a one time binding
|
|
2410
|
+
* @param expression - The binding to refresh when signaled.
|
|
2411
|
+
* @param policy - The security policy to associate with th binding.
|
|
2412
|
+
* @returns A binding configuration.
|
|
2413
|
+
* @public
|
|
2414
|
+
*/
|
|
2415
|
+
export declare function oneTime<T = any>(expression: Expression<T>, policy?: DOMPolicy_2): Binding<T>;
|
|
2416
|
+
|
|
2417
|
+
/**
|
|
2418
|
+
* Creates an standard binding.
|
|
2419
|
+
* @param expression - The binding to refresh when changed.
|
|
2420
|
+
* @param policy - The security policy to associate with th binding.
|
|
2421
|
+
* @param isVolatile - Indicates whether the binding is volatile or not.
|
|
2422
|
+
* @returns A binding configuration.
|
|
2423
|
+
* @public
|
|
2424
|
+
*/
|
|
2425
|
+
export declare function oneWay<T = any>(expression: Expression<T>, policy?: DOMPolicy_2, isVolatile?: boolean): Binding<T>;
|
|
2426
|
+
|
|
2427
|
+
/**
|
|
2428
|
+
* A read/write stateful value associated with an owner.
|
|
2429
|
+
* @beta
|
|
2430
|
+
*/
|
|
2431
|
+
export declare type OwnedState<T> = ReadonlyOwnedState<T> & {
|
|
2432
|
+
/**
|
|
2433
|
+
* Sets
|
|
2434
|
+
* @param owner - The object to set the state for the owner.
|
|
2435
|
+
* @param value - The new state value.
|
|
2436
|
+
*/
|
|
2437
|
+
set(owner: any, value: T): void;
|
|
2438
|
+
/**
|
|
2439
|
+
* Creates a readonly version of the state.
|
|
2440
|
+
*/
|
|
2441
|
+
asReadonly(): ReadonlyOwnedState<T>;
|
|
2442
|
+
};
|
|
2443
|
+
|
|
2444
|
+
/**
|
|
2445
|
+
* Creates a reactive state that has its value associated with a specific owner.
|
|
2446
|
+
* @param value - The initial value or a factory that provides an initial value for each owner.
|
|
2447
|
+
* @param options - Options to customize the state or a friendly name.
|
|
2448
|
+
* @returns An OwnedState instance.
|
|
2449
|
+
* @beta
|
|
2450
|
+
*/
|
|
2451
|
+
export declare function ownedState<T>(value: T | (() => T), options?: string | StateOptions): OwnedState<T>;
|
|
2452
|
+
|
|
2453
|
+
/**
|
|
2454
|
+
* Common APIs related to content parsing.
|
|
2455
|
+
* @public
|
|
2456
|
+
*/
|
|
2457
|
+
export declare const Parser: Readonly<{
|
|
2458
|
+
/**
|
|
2459
|
+
* Parses text content or HTML attribute content, separating out the static strings
|
|
2460
|
+
* from the directives.
|
|
2461
|
+
* @param value - The content or attribute string to parse.
|
|
2462
|
+
* @param factories - A list of directives to search for in the string.
|
|
2463
|
+
* @returns A heterogeneous array of static strings interspersed with
|
|
2464
|
+
* directives or null if no directives are found in the string.
|
|
2465
|
+
*/
|
|
2466
|
+
parse(value: string, factories: Record<string, ViewBehaviorFactory>): (string | ViewBehaviorFactory)[] | null;
|
|
2467
|
+
}>;
|
|
2468
|
+
|
|
2469
|
+
/**
|
|
2470
|
+
* Represents metadata configuration for a custom element.
|
|
2471
|
+
* @public
|
|
2472
|
+
*/
|
|
2473
|
+
export declare interface PartialFASTElementDefinition<TType extends Constructable<HTMLElement> = Constructable<HTMLElement>> {
|
|
2474
|
+
/**
|
|
2475
|
+
* The name of the custom element.
|
|
2476
|
+
*/
|
|
2477
|
+
readonly name: string;
|
|
2478
|
+
/**
|
|
2479
|
+
* The template, or template resolver, for the custom element.
|
|
2480
|
+
*/
|
|
2481
|
+
readonly template?: ElementViewTemplate<InstanceType<TType>> | FASTElementTemplateResolver<TType>;
|
|
2482
|
+
/**
|
|
2483
|
+
* The styles to associate with the custom element.
|
|
2484
|
+
*/
|
|
2485
|
+
readonly styles?: ComposableStyles | ComposableStyles[];
|
|
2486
|
+
/**
|
|
2487
|
+
* The custom attributes of the custom element.
|
|
2488
|
+
*/
|
|
2489
|
+
readonly attributes?: (AttributeConfiguration | string)[];
|
|
2490
|
+
/**
|
|
2491
|
+
* Options controlling the creation of the custom element's shadow DOM.
|
|
2492
|
+
* @remarks
|
|
2493
|
+
* If not provided, defaults to an open shadow root. Provide null
|
|
2494
|
+
* to render to the associated template to the light DOM instead.
|
|
2495
|
+
*/
|
|
2496
|
+
readonly shadowOptions?: Partial<ShadowRootOptions> | null;
|
|
2497
|
+
/**
|
|
2498
|
+
* Options controlling how the custom element is defined with the platform.
|
|
2499
|
+
*/
|
|
2500
|
+
readonly elementOptions?: ElementDefinitionOptions;
|
|
2501
|
+
/**
|
|
2502
|
+
* The registry to register this component in by default.
|
|
2503
|
+
* @remarks
|
|
2504
|
+
* If not provided, defaults to the global registry.
|
|
2505
|
+
*/
|
|
2506
|
+
readonly registry?: CustomElementRegistry;
|
|
2507
|
+
/**
|
|
2508
|
+
* Lifecycle callbacks for template events.
|
|
2509
|
+
*/
|
|
2510
|
+
readonly lifecycleCallbacks?: TemplateLifecycleCallbacks;
|
|
2511
|
+
/**
|
|
2512
|
+
* The optional schema associated with the custom element definition.
|
|
2513
|
+
* Declarative templates assign this automatically during template resolution.
|
|
2514
|
+
* Non-declarative callers can provide one for schema-driven extensions.
|
|
2515
|
+
*/
|
|
2516
|
+
readonly schema?: Schema;
|
|
2517
|
+
}
|
|
2518
|
+
|
|
2519
|
+
/**
|
|
2520
|
+
* Represents metadata configuration for an HTMLDirective.
|
|
2521
|
+
* @public
|
|
2522
|
+
*/
|
|
2523
|
+
export declare interface PartialHTMLDirectiveDefinition {
|
|
2524
|
+
/**
|
|
2525
|
+
* Indicates whether the directive needs access to template contextual information
|
|
2526
|
+
* such as the sourceAspect, targetAspect, and aspectType.
|
|
2527
|
+
*/
|
|
2528
|
+
aspected?: boolean;
|
|
2529
|
+
}
|
|
2530
|
+
|
|
2531
|
+
/**
|
|
2532
|
+
* An implementation of Notifier that allows subscribers to be notified
|
|
2533
|
+
* of individual property changes on an object.
|
|
2534
|
+
* @public
|
|
2535
|
+
*/
|
|
2536
|
+
export declare class PropertyChangeNotifier implements Notifier {
|
|
2537
|
+
private subscribers;
|
|
2538
|
+
private subjectSubscribers;
|
|
2539
|
+
/**
|
|
2540
|
+
* The subject that property changes are being notified for.
|
|
2541
|
+
*/
|
|
2542
|
+
readonly subject: any;
|
|
2543
|
+
/**
|
|
2544
|
+
* Creates an instance of PropertyChangeNotifier for the specified subject.
|
|
2545
|
+
* @param subject - The object that subscribers will receive notifications for.
|
|
2546
|
+
*/
|
|
2547
|
+
constructor(subject: any);
|
|
2548
|
+
/**
|
|
2549
|
+
* Notifies all subscribers, based on the specified property.
|
|
2550
|
+
* @param propertyName - The property name, passed along to subscribers during notification.
|
|
2551
|
+
*/
|
|
2552
|
+
notify(propertyName: string): void;
|
|
2553
|
+
/**
|
|
2554
|
+
* Subscribes to notification of changes in an object's state.
|
|
2555
|
+
* @param subscriber - The object that is subscribing for change notification.
|
|
2556
|
+
* @param propertyToWatch - The name of the property that the subscriber is interested in watching for changes.
|
|
2557
|
+
*/
|
|
2558
|
+
subscribe(subscriber: Subscriber, propertyToWatch?: string): void;
|
|
2559
|
+
/**
|
|
2560
|
+
* Unsubscribes from notification of changes in an object's state.
|
|
2561
|
+
* @param subscriber - The object that is unsubscribing from change notification.
|
|
2562
|
+
* @param propertyToUnwatch - The name of the property that the subscriber is no longer interested in watching.
|
|
2563
|
+
*/
|
|
2564
|
+
unsubscribe(subscriber: Subscriber, propertyToUnwatch?: string): void;
|
|
2565
|
+
}
|
|
2566
|
+
|
|
2567
|
+
/**
|
|
2568
|
+
* Converts a plain object to a reactive, observable object.
|
|
2569
|
+
* @param object - The object to make reactive.
|
|
2570
|
+
* @param deep - Indicates whether or not to deeply convert the oject.
|
|
2571
|
+
* @returns The converted object.
|
|
2572
|
+
* @beta
|
|
2573
|
+
*/
|
|
2574
|
+
export declare function reactive<T>(object: T, deep?: boolean): T;
|
|
2575
|
+
|
|
2576
|
+
/**
|
|
2577
|
+
* A readonly stateful value associated with an object owner.
|
|
2578
|
+
* @beta
|
|
2579
|
+
*/
|
|
2580
|
+
export declare type ReadonlyOwnedState<T> = {
|
|
2581
|
+
/**
|
|
2582
|
+
* Gets the current stateful value for the owner.
|
|
2583
|
+
*/
|
|
2584
|
+
(owner: any): T;
|
|
2585
|
+
};
|
|
2586
|
+
|
|
2587
|
+
/**
|
|
2588
|
+
* A readonly stateful value.
|
|
2589
|
+
* @beta
|
|
2590
|
+
*/
|
|
2591
|
+
export declare type ReadonlyState<T> = {
|
|
2592
|
+
/**
|
|
2593
|
+
* Gets the current state value.
|
|
2594
|
+
*/
|
|
2595
|
+
(): T;
|
|
2596
|
+
/**
|
|
2597
|
+
* Gets the current state value.
|
|
2598
|
+
*/
|
|
2599
|
+
readonly current: T;
|
|
2600
|
+
};
|
|
2601
|
+
|
|
2602
|
+
/**
|
|
2603
|
+
* A directive that observes the updates a property with a reference to the element.
|
|
2604
|
+
* @param propertyName - The name of the property to assign the reference to.
|
|
2605
|
+
* @public
|
|
2606
|
+
*/
|
|
2607
|
+
export declare const ref: <TSource = any>(propertyName: keyof TSource & string) => CaptureType;
|
|
2608
|
+
|
|
2609
|
+
/**
|
|
2610
|
+
* The runtime behavior for template references.
|
|
2611
|
+
* @public
|
|
2612
|
+
*/
|
|
2613
|
+
export declare class RefDirective extends StatelessAttachedAttributeDirective<string> {
|
|
2614
|
+
/**
|
|
2615
|
+
* The structural id of the DOM node to which the created behavior will apply.
|
|
2616
|
+
*/
|
|
2617
|
+
targetNodeId: string;
|
|
2618
|
+
/**
|
|
2619
|
+
* Bind this behavior.
|
|
2620
|
+
* @param controller - The view controller that manages the lifecycle of this behavior.
|
|
2621
|
+
*/
|
|
2622
|
+
bind(controller: ViewController): void;
|
|
2623
|
+
}
|
|
2624
|
+
|
|
2625
|
+
/**
|
|
2626
|
+
* Configuration for registering a path with a schema.
|
|
2627
|
+
* @public
|
|
2628
|
+
*/
|
|
2629
|
+
export declare interface RegisterPathConfig {
|
|
2630
|
+
rootPropertyName: string;
|
|
2631
|
+
pathConfig: CachedPath;
|
|
2632
|
+
childrenMap: ChildrenMap | null;
|
|
2633
|
+
}
|
|
2634
|
+
|
|
2635
|
+
/**
|
|
2636
|
+
* Creates a RenderDirective for use in advanced rendering scenarios.
|
|
2637
|
+
* @param value - The binding expression that returns the data to be rendered. The expression
|
|
2638
|
+
* can also return a Node to render directly.
|
|
2639
|
+
* @param template - A template to render the data with
|
|
2640
|
+
* or a string to indicate which RenderInstruction to use when looking up a RenderInstruction.
|
|
2641
|
+
* Expressions can also be provided to dynamically determine either the template or the name.
|
|
2642
|
+
* @returns A RenderDirective suitable for use in a template.
|
|
2643
|
+
* @remarks
|
|
2644
|
+
* If no binding is provided, then a default binding that returns the source is created.
|
|
2645
|
+
* If no template is provided, then a binding is created that will use registered
|
|
2646
|
+
* RenderInstructions to determine the view.
|
|
2647
|
+
* If the template binding returns a string, then it will be used to look up a
|
|
2648
|
+
* RenderInstruction to determine the view.
|
|
2649
|
+
* @public
|
|
2650
|
+
*/
|
|
2651
|
+
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;
|
|
2652
|
+
|
|
2653
|
+
/**
|
|
2654
|
+
* A Behavior that enables advanced rendering.
|
|
2655
|
+
* @public
|
|
2656
|
+
*/
|
|
2657
|
+
export declare class RenderBehavior<TSource = any> implements ViewBehavior, Subscriber {
|
|
2658
|
+
private directive;
|
|
2659
|
+
private location;
|
|
2660
|
+
private controller;
|
|
2661
|
+
private view;
|
|
2662
|
+
private template;
|
|
2663
|
+
private templateBindingObserver;
|
|
2664
|
+
private data;
|
|
2665
|
+
private dataBindingObserver;
|
|
2666
|
+
/**
|
|
2667
|
+
* Creates an instance of RenderBehavior.
|
|
2668
|
+
* @param directive - The render directive that created this behavior.
|
|
2669
|
+
*/
|
|
2670
|
+
constructor(directive: RenderDirective);
|
|
2671
|
+
/**
|
|
2672
|
+
* Bind this behavior.
|
|
2673
|
+
* @param controller - The view controller that manages the lifecycle of this behavior.
|
|
2674
|
+
*/
|
|
2675
|
+
bind(controller: ViewController): void;
|
|
2676
|
+
/**
|
|
2677
|
+
* Unbinds this behavior.
|
|
2678
|
+
* @param controller - The view controller that manages the lifecycle of this behavior.
|
|
2679
|
+
*/
|
|
2680
|
+
unbind(controller: ViewController): void;
|
|
2681
|
+
/* Excluded from this release type: handleChange */
|
|
2682
|
+
private bindView;
|
|
2683
|
+
private refreshView;
|
|
2684
|
+
}
|
|
2685
|
+
|
|
2686
|
+
/**
|
|
2687
|
+
* A Directive that enables use of the RenderBehavior.
|
|
2688
|
+
* @public
|
|
2689
|
+
*/
|
|
2690
|
+
export declare class RenderDirective<TSource = any> implements HTMLDirective, ViewBehaviorFactory, BindingDirective {
|
|
2691
|
+
readonly dataBinding: Binding<TSource>;
|
|
2692
|
+
readonly templateBinding: Binding<TSource, ContentTemplate>;
|
|
2693
|
+
readonly templateBindingDependsOnData: boolean;
|
|
2694
|
+
/**
|
|
2695
|
+
* The structural id of the DOM node to which the created behavior will apply.
|
|
2696
|
+
*/
|
|
2697
|
+
targetNodeId: string;
|
|
2698
|
+
/**
|
|
2699
|
+
* Creates an instance of RenderDirective.
|
|
2700
|
+
* @param dataBinding - A binding expression that returns the data to render.
|
|
2701
|
+
* @param templateBinding - A binding expression that returns the template to use to render the data.
|
|
2702
|
+
*/
|
|
2703
|
+
constructor(dataBinding: Binding<TSource>, templateBinding: Binding<TSource, ContentTemplate>, templateBindingDependsOnData: boolean);
|
|
2704
|
+
/**
|
|
2705
|
+
* Creates HTML to be used within a template.
|
|
2706
|
+
* @param add - Can be used to add behavior factories to a template.
|
|
2707
|
+
*/
|
|
2708
|
+
createHTML(add: AddViewBehaviorFactory): string;
|
|
2709
|
+
/**
|
|
2710
|
+
* Creates a behavior.
|
|
2711
|
+
* @param targets - The targets available for behaviors to be attached to.
|
|
2712
|
+
*/
|
|
2713
|
+
createBehavior(): RenderBehavior<TSource>;
|
|
2714
|
+
}
|
|
2715
|
+
|
|
2716
|
+
/**
|
|
2717
|
+
* A directive that enables list rendering.
|
|
2718
|
+
* @param items - The array to render.
|
|
2719
|
+
* @param template - The template or a template binding used obtain a template
|
|
2720
|
+
* to render for each item in the array.
|
|
2721
|
+
* @param options - Options used to turn on special repeat features.
|
|
2722
|
+
* @public
|
|
2723
|
+
*/
|
|
2724
|
+
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;
|
|
2725
|
+
|
|
2726
|
+
/**
|
|
2727
|
+
* A behavior that renders a template for each item in an array.
|
|
2728
|
+
* @public
|
|
2729
|
+
*/
|
|
2730
|
+
export declare class RepeatBehavior<TSource = any> implements ViewBehavior, Subscriber {
|
|
2731
|
+
private directive;
|
|
2732
|
+
private location;
|
|
2733
|
+
private controller;
|
|
2734
|
+
private template;
|
|
2735
|
+
private templateBindingObserver;
|
|
2736
|
+
private items;
|
|
2737
|
+
private itemsObserver;
|
|
2738
|
+
private itemsBindingObserver;
|
|
2739
|
+
private bindView;
|
|
2740
|
+
/* Excluded from this release type: views */
|
|
2741
|
+
/**
|
|
2742
|
+
* Creates an instance of RepeatBehavior.
|
|
2743
|
+
* @param location - The location in the DOM to render the repeat.
|
|
2744
|
+
* @param dataBinding - The array to render.
|
|
2745
|
+
* @param isItemsBindingVolatile - Indicates whether the items binding has volatile dependencies.
|
|
2746
|
+
* @param templateBinding - The template to render for each item.
|
|
2747
|
+
* @param isTemplateBindingVolatile - Indicates whether the template binding has volatile dependencies.
|
|
2748
|
+
* @param options - Options used to turn on special repeat features.
|
|
2749
|
+
*/
|
|
2750
|
+
constructor(directive: RepeatDirective);
|
|
2751
|
+
/**
|
|
2752
|
+
* Bind this behavior.
|
|
2753
|
+
* @param controller - The view controller that manages the lifecycle of this behavior.
|
|
2754
|
+
*/
|
|
2755
|
+
bind(controller: ViewController): void;
|
|
2756
|
+
/**
|
|
2757
|
+
* Unbinds this behavior.
|
|
2758
|
+
*/
|
|
2759
|
+
unbind(): void;
|
|
2760
|
+
/**
|
|
2761
|
+
* Handles changes in the array, its items, and the repeat template.
|
|
2762
|
+
* @param source - The source of the change.
|
|
2763
|
+
* @param args - The details about what was changed.
|
|
2764
|
+
*/
|
|
2765
|
+
handleChange(source: any, args: Splice[] | Sort[] | ExpressionObserver): void;
|
|
2766
|
+
private observeItems;
|
|
2767
|
+
private updateSortedViews;
|
|
2768
|
+
private updateSplicedViews;
|
|
2769
|
+
private refreshAllViews;
|
|
2770
|
+
private unbindAllViews;
|
|
2771
|
+
private hydrateViews;
|
|
2772
|
+
}
|
|
2773
|
+
|
|
2774
|
+
/**
|
|
2775
|
+
* A path discovered from a repeat directive.
|
|
2776
|
+
* @public
|
|
2777
|
+
*/
|
|
2778
|
+
export declare interface RepeatCachedPath extends CachedPathCommon {
|
|
2779
|
+
type: "repeat";
|
|
2780
|
+
}
|
|
2781
|
+
|
|
2782
|
+
/**
|
|
2783
|
+
* A directive that configures list rendering.
|
|
2784
|
+
* @public
|
|
2785
|
+
*/
|
|
2786
|
+
export declare class RepeatDirective<TSource = any> implements HTMLDirective, ViewBehaviorFactory, BindingDirective {
|
|
2787
|
+
readonly dataBinding: Binding<TSource>;
|
|
2788
|
+
readonly templateBinding: Binding<TSource, SyntheticViewTemplate>;
|
|
2789
|
+
readonly options: RepeatOptions;
|
|
2790
|
+
/**
|
|
2791
|
+
* The structural id of the DOM node to which the created behavior will apply.
|
|
2792
|
+
*/
|
|
2793
|
+
targetNodeId: string;
|
|
2794
|
+
/**
|
|
2795
|
+
* Creates a placeholder string based on the directive's index within the template.
|
|
2796
|
+
* @param index - The index of the directive within the template.
|
|
2797
|
+
*/
|
|
2798
|
+
createHTML(add: AddViewBehaviorFactory): string;
|
|
2799
|
+
/**
|
|
2800
|
+
* Creates an instance of RepeatDirective.
|
|
2801
|
+
* @param dataBinding - The binding that provides the array to render.
|
|
2802
|
+
* @param templateBinding - The template binding used to obtain a template to render for each item in the array.
|
|
2803
|
+
* @param options - Options used to turn on special repeat features.
|
|
2804
|
+
*/
|
|
2805
|
+
constructor(dataBinding: Binding<TSource>, templateBinding: Binding<TSource, SyntheticViewTemplate>, options: RepeatOptions);
|
|
2806
|
+
/**
|
|
2807
|
+
* Creates a behavior for the provided target node.
|
|
2808
|
+
* @param target - The node instance to create the behavior for.
|
|
2809
|
+
*/
|
|
2810
|
+
createBehavior(): RepeatBehavior<TSource>;
|
|
2811
|
+
}
|
|
2812
|
+
|
|
2813
|
+
/**
|
|
2814
|
+
* Options for configuring repeat behavior.
|
|
2815
|
+
* @public
|
|
2816
|
+
*/
|
|
2817
|
+
export declare interface RepeatOptions {
|
|
2818
|
+
/**
|
|
2819
|
+
* Enables index, length, and dependent positioning updates in item templates.
|
|
2820
|
+
*/
|
|
2821
|
+
positioning?: boolean;
|
|
2822
|
+
/**
|
|
2823
|
+
* Enables view recycling
|
|
2824
|
+
*/
|
|
2825
|
+
recycle?: boolean;
|
|
2826
|
+
}
|
|
2827
|
+
|
|
2828
|
+
/**
|
|
2829
|
+
* A constructed JSON schema from a template
|
|
2830
|
+
* @public
|
|
2831
|
+
*/
|
|
2832
|
+
export declare class Schema {
|
|
2833
|
+
/**
|
|
2834
|
+
* The name of the custom element
|
|
2835
|
+
*/
|
|
2836
|
+
private customElementName;
|
|
2837
|
+
/**
|
|
2838
|
+
* Instance-level JSON schema map describing each root property
|
|
2839
|
+
*/
|
|
2840
|
+
private schemaMap;
|
|
2841
|
+
constructor(name: string);
|
|
2842
|
+
/**
|
|
2843
|
+
* Add a path to a schema
|
|
2844
|
+
* @param config - The path registration configuration.
|
|
2845
|
+
*/
|
|
2846
|
+
addPath(config: RegisterPathConfig): void;
|
|
2847
|
+
/**
|
|
2848
|
+
* Gets the JSON schema for a property name
|
|
2849
|
+
* @param rootPropertyName - the root property the JSON schema is mapped to
|
|
2850
|
+
* @returns The JSON schema for the root property
|
|
2851
|
+
*/
|
|
2852
|
+
getSchema(rootPropertyName: string): JSONSchema | null;
|
|
2853
|
+
/**
|
|
2854
|
+
* Gets root properties
|
|
2855
|
+
* @returns IterableIterator<string>
|
|
2856
|
+
*/
|
|
2857
|
+
getRootProperties(): IterableIterator<string>;
|
|
2858
|
+
/**
|
|
2859
|
+
* Get a path split into property names
|
|
2860
|
+
* @param path - The dot syntax path, e.g. `a.b.c`.
|
|
2861
|
+
* @returns An array of items in the path
|
|
2862
|
+
*/
|
|
2863
|
+
private getSplitPath;
|
|
2864
|
+
/**
|
|
2865
|
+
* Gets the path to the $def
|
|
2866
|
+
* @param context - The context name. For example, `item in items` creates the `item` context.
|
|
2867
|
+
* @returns A string to use as a $ref
|
|
2868
|
+
*/
|
|
2869
|
+
private getDefsPath;
|
|
2870
|
+
/**
|
|
2871
|
+
* Get the schema $id
|
|
2872
|
+
* @param customElementName - The custom element name
|
|
2873
|
+
* @param propertyName - The property name
|
|
2874
|
+
* @returns The ID that can be used in the JSON schema as $id
|
|
2875
|
+
*/
|
|
2876
|
+
private getSchemaId;
|
|
2877
|
+
/**
|
|
2878
|
+
* Add a new JSON schema to the JSON schema map
|
|
2879
|
+
* @param propertyName - The name of the property to assign this JSON schema to.
|
|
2880
|
+
*/
|
|
2881
|
+
private addNewSchema;
|
|
2882
|
+
/**
|
|
2883
|
+
* Add properties to a context
|
|
2884
|
+
* @param schema - The schema to add the properties to.
|
|
2885
|
+
* @param splitPath - The path split into property/context names.
|
|
2886
|
+
* @param context - The path context.
|
|
2887
|
+
*/
|
|
2888
|
+
private addPropertiesToAContext;
|
|
2889
|
+
/**
|
|
2890
|
+
* Add properties to an object
|
|
2891
|
+
* @param schema - The schema to add the properties to.
|
|
2892
|
+
* @param splitPath - The path split into property/context names.
|
|
2893
|
+
* @param context - The path context.
|
|
2894
|
+
* @param type - The data type (see JSON schema for details).
|
|
2895
|
+
*/
|
|
2896
|
+
private addPropertiesToAnObject;
|
|
2897
|
+
/**
|
|
2898
|
+
* Add an array to an object property
|
|
2899
|
+
* @param schema - The schema to add the properties to.
|
|
2900
|
+
* @param context - The name of the context.
|
|
2901
|
+
*/
|
|
2902
|
+
private addArrayToAnObject;
|
|
2903
|
+
/**
|
|
2904
|
+
* Add a context to the $defs property
|
|
2905
|
+
* @param schema - The schema to use.
|
|
2906
|
+
* @param propertyName - The name of the property the context belongs to.
|
|
2907
|
+
* @param currentContext - The current context.
|
|
2908
|
+
* @param parentContext - The parent context.
|
|
2909
|
+
* @returns
|
|
2910
|
+
*/
|
|
2911
|
+
private addContext;
|
|
2912
|
+
/**
|
|
2913
|
+
* Get parent contexts
|
|
2914
|
+
* @param schema - The schema to use.
|
|
2915
|
+
* @param parentContext - The parent context.
|
|
2916
|
+
* @param contexts - A list of parent contexts.
|
|
2917
|
+
* @returns
|
|
2918
|
+
*/
|
|
2919
|
+
private getParentContexts;
|
|
2920
|
+
}
|
|
2921
|
+
|
|
2922
|
+
/**
|
|
2923
|
+
* Module-level registry that maps custom element names to their schema maps.
|
|
2924
|
+
* Used for cross-element `$ref` resolution (e.g. nested element schemas).
|
|
2925
|
+
* Each Schema instance registers itself here on construction.
|
|
2926
|
+
* @public
|
|
2927
|
+
*/
|
|
2928
|
+
export declare const schemaRegistry: CachedPathMap;
|
|
2929
|
+
|
|
2930
|
+
/**
|
|
2931
|
+
* Shadow root initialization options.
|
|
2932
|
+
* @public
|
|
2933
|
+
*/
|
|
2934
|
+
export declare interface ShadowRootOptions extends ShadowRootInit {
|
|
2935
|
+
/**
|
|
2936
|
+
* A registry that provides the custom elements visible
|
|
2937
|
+
* from within this shadow root.
|
|
2938
|
+
* @beta
|
|
2939
|
+
*/
|
|
2940
|
+
registry?: CustomElementRegistry;
|
|
2941
|
+
}
|
|
2942
|
+
|
|
2943
|
+
/**
|
|
2944
|
+
* The gateway to signal APIs.
|
|
2945
|
+
* @public
|
|
2946
|
+
*/
|
|
2947
|
+
export declare const Signal: Readonly<{
|
|
2948
|
+
/**
|
|
2949
|
+
* Subscribes to a signal.
|
|
2950
|
+
* @param signal - The signal to subscribe to.
|
|
2951
|
+
* @param subscriber - The subscriber.
|
|
2952
|
+
*/
|
|
2953
|
+
subscribe(signal: string, subscriber: Subscriber): void;
|
|
2954
|
+
/**
|
|
2955
|
+
* Unsubscribes from the signal.
|
|
2956
|
+
* @param signal - The signal to unsubscribe from.
|
|
2957
|
+
* @param subscriber - The subscriber.
|
|
2958
|
+
*/
|
|
2959
|
+
unsubscribe(signal: string, subscriber: Subscriber): void;
|
|
2960
|
+
/**
|
|
2961
|
+
* Sends the specified signal to subscribers.
|
|
2962
|
+
* @param signal - The signal to send.
|
|
2963
|
+
*/
|
|
2964
|
+
send(signal: string): void;
|
|
2965
|
+
}>;
|
|
2966
|
+
|
|
2967
|
+
/**
|
|
2968
|
+
* Creates a signal binding configuration with the supplied options.
|
|
2969
|
+
* @param expression - The binding to refresh when signaled.
|
|
2970
|
+
* @param options - The signal name or a binding to use to retrieve the signal name.
|
|
2971
|
+
* @param policy - The security policy to associate with th binding.
|
|
2972
|
+
* @returns A binding configuration.
|
|
2973
|
+
* @public
|
|
2974
|
+
*/
|
|
2975
|
+
export declare function signal<T = any>(expression: Expression<T>, options: string | Expression<T>, policy?: DOMPolicy_2): Binding<T>;
|
|
2976
|
+
|
|
2977
|
+
/**
|
|
2978
|
+
* A directive that observes the `assignedNodes()` of a slot and updates a property
|
|
2979
|
+
* whenever they change.
|
|
2980
|
+
* @param propertyOrOptions - The options used to configure slotted node observation.
|
|
2981
|
+
* @public
|
|
2982
|
+
*/
|
|
2983
|
+
export declare function slotted<TSource = any>(propertyOrOptions: (keyof TSource & string) | SlottedDirectiveOptions<keyof TSource & string>): CaptureType;
|
|
2984
|
+
|
|
2985
|
+
/**
|
|
2986
|
+
* The runtime behavior for slotted node observation.
|
|
2987
|
+
* @public
|
|
2988
|
+
*/
|
|
2989
|
+
export declare class SlottedDirective extends NodeObservationDirective<SlottedDirectiveOptions> {
|
|
2990
|
+
/**
|
|
2991
|
+
* Begins observation of the nodes.
|
|
2992
|
+
* @param target - The target to observe.
|
|
2993
|
+
*/
|
|
2994
|
+
observe(target: EventSource): void;
|
|
2995
|
+
/**
|
|
2996
|
+
* Disconnects observation of the nodes.
|
|
2997
|
+
* @param target - The target to unobserve.
|
|
2998
|
+
*/
|
|
2999
|
+
disconnect(target: EventSource): void;
|
|
3000
|
+
/**
|
|
3001
|
+
* Retrieves the raw nodes that should be assigned to the source property.
|
|
3002
|
+
* @param target - The target to get the node to.
|
|
3003
|
+
*/
|
|
3004
|
+
getNodes(target: HTMLSlotElement): Node[];
|
|
3005
|
+
/* Excluded from this release type: handleEvent */
|
|
3006
|
+
}
|
|
3007
|
+
|
|
3008
|
+
/**
|
|
3009
|
+
* The options used to configure slotted node observation.
|
|
3010
|
+
* @public
|
|
3011
|
+
*/
|
|
3012
|
+
export declare interface SlottedDirectiveOptions<T = any> extends NodeBehaviorOptions<T>, AssignedNodesOptions {
|
|
3013
|
+
}
|
|
3014
|
+
|
|
3015
|
+
/**
|
|
3016
|
+
* A sort array indicates new index positions of array items.
|
|
3017
|
+
* @public
|
|
3018
|
+
*/
|
|
3019
|
+
export declare class Sort {
|
|
3020
|
+
sorted?: number[] | undefined;
|
|
3021
|
+
/**
|
|
3022
|
+
* Creates a sort update.
|
|
3023
|
+
* @param sorted - The updated index of sorted items.
|
|
3024
|
+
*/
|
|
3025
|
+
constructor(sorted?: number[] | undefined);
|
|
3026
|
+
}
|
|
3027
|
+
|
|
3028
|
+
/**
|
|
3029
|
+
* Enables observing the sorted property of an array.
|
|
3030
|
+
* @param array - The array to observe the sorted property of.
|
|
3031
|
+
* @returns The sorted property.
|
|
3032
|
+
* @public
|
|
3033
|
+
*/
|
|
3034
|
+
export declare function sortedCount<T>(array: readonly T[]): number;
|
|
3035
|
+
|
|
3036
|
+
/**
|
|
3037
|
+
* Observes array sort.
|
|
3038
|
+
* @public
|
|
3039
|
+
*/
|
|
3040
|
+
export declare interface SortObserver extends Subscriber {
|
|
3041
|
+
/**
|
|
3042
|
+
* The sorted times on the observed array, this should be incremented every time
|
|
3043
|
+
* an item in the array changes location.
|
|
3044
|
+
*/
|
|
3045
|
+
sorted: number;
|
|
3046
|
+
}
|
|
3047
|
+
|
|
3048
|
+
/**
|
|
3049
|
+
* Describes how the source's lifetime relates to its controller's lifetime.
|
|
3050
|
+
* @public
|
|
3051
|
+
*/
|
|
3052
|
+
export declare const SourceLifetime: Readonly<{
|
|
3053
|
+
/**
|
|
3054
|
+
* The source to controller lifetime relationship is unknown.
|
|
3055
|
+
*/
|
|
3056
|
+
readonly unknown: undefined;
|
|
3057
|
+
/**
|
|
3058
|
+
* The source and controller lifetimes are coupled to one another.
|
|
3059
|
+
* They can/will be GC'd together.
|
|
3060
|
+
*/
|
|
3061
|
+
readonly coupled: 1;
|
|
3062
|
+
}>;
|
|
3063
|
+
|
|
3064
|
+
/**
|
|
3065
|
+
* Describes how the source's lifetime relates to its controller's lifetime.
|
|
3066
|
+
* @public
|
|
3067
|
+
*/
|
|
3068
|
+
export declare type SourceLifetime = (typeof SourceLifetime)[keyof typeof SourceLifetime];
|
|
3069
|
+
|
|
3070
|
+
/**
|
|
3071
|
+
* A splice map is a representation of how a previous array of items
|
|
3072
|
+
* was transformed into a new array of items. Conceptually it is a list of
|
|
3073
|
+
* tuples of
|
|
3074
|
+
*
|
|
3075
|
+
* (index, removed, addedCount)
|
|
3076
|
+
*
|
|
3077
|
+
* which are kept in ascending index order of. The tuple represents that at
|
|
3078
|
+
* the |index|, |removed| sequence of items were removed, and counting forward
|
|
3079
|
+
* from |index|, |addedCount| items were added.
|
|
3080
|
+
* @public
|
|
3081
|
+
*/
|
|
3082
|
+
export declare class Splice {
|
|
3083
|
+
index: number;
|
|
3084
|
+
removed: any[];
|
|
3085
|
+
addedCount: number;
|
|
3086
|
+
/**
|
|
3087
|
+
* Indicates that this splice represents a complete array reset.
|
|
3088
|
+
*/
|
|
3089
|
+
reset?: boolean;
|
|
3090
|
+
/**
|
|
3091
|
+
* Creates a splice.
|
|
3092
|
+
* @param index - The index that the splice occurs at.
|
|
3093
|
+
* @param removed - The items that were removed.
|
|
3094
|
+
* @param addedCount - The number of items that were added.
|
|
3095
|
+
*/
|
|
3096
|
+
constructor(index: number, removed: any[], addedCount: number);
|
|
3097
|
+
/**
|
|
3098
|
+
* Adjusts the splice index based on the provided array.
|
|
3099
|
+
* @param array - The array to adjust to.
|
|
3100
|
+
* @returns The same splice, mutated based on the reference array.
|
|
3101
|
+
*/
|
|
3102
|
+
adjustTo(array: any[]): this;
|
|
3103
|
+
}
|
|
3104
|
+
|
|
3105
|
+
/**
|
|
3106
|
+
* An approach to tracking changes in an array.
|
|
3107
|
+
* @public
|
|
3108
|
+
*/
|
|
3109
|
+
export declare interface SpliceStrategy {
|
|
3110
|
+
/**
|
|
3111
|
+
* The level of feature support the splice strategy provides.
|
|
3112
|
+
*/
|
|
3113
|
+
readonly support: SpliceStrategySupport;
|
|
3114
|
+
/**
|
|
3115
|
+
* Normalizes the splices before delivery to array change subscribers.
|
|
3116
|
+
* @param previous - The previous version of the array if a reset has taken place.
|
|
3117
|
+
* @param current - The current version of the array.
|
|
3118
|
+
* @param changes - The set of changes tracked against the array.
|
|
3119
|
+
*/
|
|
3120
|
+
normalize(previous: unknown[] | undefined, current: unknown[], changes: Splice[] | undefined): readonly Splice[];
|
|
3121
|
+
/**
|
|
3122
|
+
* Performs and tracks a pop operation on an array.
|
|
3123
|
+
* @param array - The array to track the change for.
|
|
3124
|
+
* @param observer - The observer to register the change with.
|
|
3125
|
+
* @param pop - The operation to perform.
|
|
3126
|
+
* @param args - The arguments for the operation.
|
|
3127
|
+
*/
|
|
3128
|
+
pop(array: any[], observer: ArrayObserver, pop: typeof Array.prototype.pop, args: any[]): any;
|
|
3129
|
+
/**
|
|
3130
|
+
* Performs and tracks a push operation on an array.
|
|
3131
|
+
* @param array - The array to track the change for.
|
|
3132
|
+
* @param observer - The observer to register the change with.
|
|
3133
|
+
* @param push - The operation to perform.
|
|
3134
|
+
* @param args - The arguments for the operation.
|
|
3135
|
+
*/
|
|
3136
|
+
push(array: any[], observer: ArrayObserver, push: typeof Array.prototype.push, args: any[]): any;
|
|
3137
|
+
/**
|
|
3138
|
+
* Performs and tracks a reverse operation on an array.
|
|
3139
|
+
* @param array - The array to track the change for.
|
|
3140
|
+
* @param observer - The observer to register the change with.
|
|
3141
|
+
* @param reverse - The operation to perform.
|
|
3142
|
+
* @param args - The arguments for the operation.
|
|
3143
|
+
*/
|
|
3144
|
+
reverse(array: any[], observer: ArrayObserver, reverse: typeof Array.prototype.reverse, args: any[]): any;
|
|
3145
|
+
/**
|
|
3146
|
+
* Performs and tracks a shift operation on an array.
|
|
3147
|
+
* @param array - The array to track the change for.
|
|
3148
|
+
* @param observer - The observer to register the change with.
|
|
3149
|
+
* @param shift - The operation to perform.
|
|
3150
|
+
* @param args - The arguments for the operation.
|
|
3151
|
+
*/
|
|
3152
|
+
shift(array: any[], observer: ArrayObserver, shift: typeof Array.prototype.shift, args: any[]): any;
|
|
3153
|
+
/**
|
|
3154
|
+
* Performs and tracks a sort operation on an array.
|
|
3155
|
+
* @param array - The array to track the change for.
|
|
3156
|
+
* @param observer - The observer to register the change with.
|
|
3157
|
+
* @param sort - The operation to perform.
|
|
3158
|
+
* @param args - The arguments for the operation.
|
|
3159
|
+
*/
|
|
3160
|
+
sort(array: any[], observer: ArrayObserver, sort: typeof Array.prototype.sort, args: any[]): any[];
|
|
3161
|
+
/**
|
|
3162
|
+
* Performs and tracks a splice operation on an array.
|
|
3163
|
+
* @param array - The array to track the change for.
|
|
3164
|
+
* @param observer - The observer to register the change with.
|
|
3165
|
+
* @param splice - The operation to perform.
|
|
3166
|
+
* @param args - The arguments for the operation.
|
|
3167
|
+
*/
|
|
3168
|
+
splice(array: any[], observer: ArrayObserver, splice: typeof Array.prototype.splice, args: any[]): any;
|
|
3169
|
+
/**
|
|
3170
|
+
* Performs and tracks an unshift operation on an array.
|
|
3171
|
+
* @param array - The array to track the change for.
|
|
3172
|
+
* @param observer - The observer to register the change with.
|
|
3173
|
+
* @param unshift - The operation to perform.
|
|
3174
|
+
* @param args - The arguments for the operation.
|
|
3175
|
+
*/
|
|
3176
|
+
unshift(array: any[], observer: ArrayObserver, unshift: typeof Array.prototype.unshift, args: any[]): any[];
|
|
3177
|
+
}
|
|
3178
|
+
|
|
3179
|
+
/**
|
|
3180
|
+
* Functionality related to tracking changes in arrays.
|
|
3181
|
+
* @public
|
|
3182
|
+
*/
|
|
3183
|
+
export declare const SpliceStrategy: Readonly<{
|
|
3184
|
+
/**
|
|
3185
|
+
* A set of changes that represent a full array reset.
|
|
3186
|
+
*/
|
|
3187
|
+
readonly reset: Splice[];
|
|
3188
|
+
/**
|
|
3189
|
+
* Sets the default strategy to use for array observers.
|
|
3190
|
+
* @param strategy - The splice strategy to use.
|
|
3191
|
+
*/
|
|
3192
|
+
readonly setDefaultStrategy: (strategy: SpliceStrategy) => void;
|
|
3193
|
+
}>;
|
|
3194
|
+
|
|
3195
|
+
/**
|
|
3196
|
+
* Indicates what level of feature support the splice
|
|
3197
|
+
* strategy provides.
|
|
3198
|
+
* @public
|
|
3199
|
+
*/
|
|
3200
|
+
export declare const SpliceStrategySupport: Readonly<{
|
|
3201
|
+
/**
|
|
3202
|
+
* Only supports resets.
|
|
3203
|
+
*/
|
|
3204
|
+
readonly reset: 1;
|
|
3205
|
+
/**
|
|
3206
|
+
* Supports tracking splices and resets.
|
|
3207
|
+
*/
|
|
3208
|
+
readonly splice: 2;
|
|
3209
|
+
/**
|
|
3210
|
+
* Supports tracking splices and resets, while applying some form
|
|
3211
|
+
* of optimization, such as merging, to the splices.
|
|
3212
|
+
*/
|
|
3213
|
+
readonly optimized: 3;
|
|
3214
|
+
}>;
|
|
3215
|
+
|
|
3216
|
+
/**
|
|
3217
|
+
* The available values for SpliceStrategySupport.
|
|
3218
|
+
* @public
|
|
3219
|
+
*/
|
|
3220
|
+
export declare type SpliceStrategySupport = (typeof SpliceStrategySupport)[keyof typeof SpliceStrategySupport];
|
|
3221
|
+
|
|
3222
|
+
/**
|
|
3223
|
+
* The various lifecycle stages of an ElementController.
|
|
3224
|
+
* @public
|
|
3225
|
+
*/
|
|
3226
|
+
export declare const enum Stages {
|
|
3227
|
+
/** The element is in the process of connecting. */
|
|
3228
|
+
connecting = 0,
|
|
3229
|
+
/** The element is connected. */
|
|
3230
|
+
connected = 1,
|
|
3231
|
+
/** The element is in the process of disconnecting. */
|
|
3232
|
+
disconnecting = 2,
|
|
3233
|
+
/** The element is disconnected. */
|
|
3234
|
+
disconnected = 3
|
|
3235
|
+
}
|
|
3236
|
+
|
|
3237
|
+
/**
|
|
3238
|
+
* A read/write stateful value.
|
|
3239
|
+
* @beta
|
|
3240
|
+
*/
|
|
3241
|
+
export declare type State<T> = ReadonlyState<T> & {
|
|
3242
|
+
/**
|
|
3243
|
+
* Gets or sets the current state value.
|
|
3244
|
+
*/
|
|
3245
|
+
current: T;
|
|
3246
|
+
/**
|
|
3247
|
+
* Sets the current state value.
|
|
3248
|
+
* @param value - The new state value.
|
|
3249
|
+
*/
|
|
3250
|
+
set(value: T): void;
|
|
3251
|
+
/**
|
|
3252
|
+
* Creates a readonly version of the state.
|
|
3253
|
+
*/
|
|
3254
|
+
asReadonly(): ReadonlyState<T>;
|
|
3255
|
+
};
|
|
3256
|
+
|
|
3257
|
+
/**
|
|
3258
|
+
* Creates a reactive state value.
|
|
3259
|
+
* @param value - The initial state value.
|
|
3260
|
+
* @param options - Options to customize the state or a friendly name.
|
|
3261
|
+
* @returns A State instance.
|
|
3262
|
+
* @beta
|
|
3263
|
+
*/
|
|
3264
|
+
export declare function state<T>(value: T, options?: string | StateOptions): State<T>;
|
|
3265
|
+
|
|
3266
|
+
/**
|
|
3267
|
+
* A base class used for attribute directives that don't need internal state.
|
|
3268
|
+
* @public
|
|
3269
|
+
*/
|
|
3270
|
+
export declare abstract class StatelessAttachedAttributeDirective<TOptions> implements HTMLDirective, ViewBehaviorFactory, ViewBehavior {
|
|
3271
|
+
protected options: TOptions;
|
|
3272
|
+
/**
|
|
3273
|
+
* Creates an instance of RefDirective.
|
|
3274
|
+
* @param options - The options to use in configuring the directive.
|
|
3275
|
+
*/
|
|
3276
|
+
constructor(options: TOptions);
|
|
3277
|
+
/**
|
|
3278
|
+
* Creates a placeholder string based on the directive's index within the template.
|
|
3279
|
+
* @param index - The index of the directive within the template.
|
|
3280
|
+
* @remarks
|
|
3281
|
+
* Creates a custom attribute placeholder.
|
|
3282
|
+
*/
|
|
3283
|
+
createHTML(add: AddViewBehaviorFactory): string;
|
|
3284
|
+
/**
|
|
3285
|
+
* Creates a behavior.
|
|
3286
|
+
* @param targets - The targets available for behaviors to be attached to.
|
|
3287
|
+
*/
|
|
3288
|
+
createBehavior(): ViewBehavior;
|
|
3289
|
+
/**
|
|
3290
|
+
* Bind this behavior.
|
|
3291
|
+
* @param controller - The view controller that manages the lifecycle of this behavior.
|
|
3292
|
+
*/
|
|
3293
|
+
abstract bind(controller: ViewController): void;
|
|
3294
|
+
}
|
|
3295
|
+
|
|
3296
|
+
/**
|
|
3297
|
+
* Options for creating state.
|
|
3298
|
+
* @beta
|
|
3299
|
+
*/
|
|
3300
|
+
export declare type StateOptions = {
|
|
3301
|
+
/**
|
|
3302
|
+
* Indicates whether to deeply make the state value observable.
|
|
3303
|
+
*/
|
|
3304
|
+
deep?: boolean;
|
|
3305
|
+
/**
|
|
3306
|
+
* A friendly name for the state.
|
|
3307
|
+
*/
|
|
3308
|
+
name?: string;
|
|
3309
|
+
};
|
|
3310
|
+
|
|
1023
3311
|
/**
|
|
1024
|
-
*
|
|
3312
|
+
* Implemented to provide specific behavior when adding/removing styles
|
|
3313
|
+
* for elements.
|
|
1025
3314
|
* @public
|
|
1026
3315
|
*/
|
|
1027
|
-
export declare
|
|
3316
|
+
export declare interface StyleStrategy {
|
|
3317
|
+
/**
|
|
3318
|
+
* Adds styles to the target.
|
|
3319
|
+
* @param target - The target to add the styles to.
|
|
3320
|
+
*/
|
|
3321
|
+
addStylesTo(target: StyleTarget): void;
|
|
3322
|
+
/**
|
|
3323
|
+
* Removes styles from the target.
|
|
3324
|
+
* @param target - The target to remove the styles from.
|
|
3325
|
+
*/
|
|
3326
|
+
removeStylesFrom(target: StyleTarget): void;
|
|
3327
|
+
}
|
|
1028
3328
|
|
|
1029
3329
|
/**
|
|
1030
|
-
*
|
|
1031
|
-
* consecutive time the dependency is resolved, the same instance will be returned.
|
|
1032
|
-
*
|
|
1033
|
-
* @example
|
|
1034
|
-
* ```ts
|
|
1035
|
-
* @singleton()
|
|
1036
|
-
* class Foo { }
|
|
1037
|
-
* ```
|
|
1038
|
-
*
|
|
3330
|
+
* A node that can be targeted by styles.
|
|
1039
3331
|
* @public
|
|
1040
3332
|
*/
|
|
1041
|
-
export declare
|
|
3333
|
+
export declare interface StyleTarget extends Pick<Node, "getRootNode"> {
|
|
3334
|
+
/**
|
|
3335
|
+
* Stylesheets to be adopted by the node.
|
|
3336
|
+
*/
|
|
3337
|
+
adoptedStyleSheets?: CSSStyleSheet[];
|
|
3338
|
+
/**
|
|
3339
|
+
* Adds styles to the target by appending the styles.
|
|
3340
|
+
* @param styles - The styles element to add.
|
|
3341
|
+
*/
|
|
3342
|
+
append(styles: HTMLStyleElement): void;
|
|
3343
|
+
/**
|
|
3344
|
+
* Removes styles from the target.
|
|
3345
|
+
* @param styles - The styles element to remove.
|
|
3346
|
+
*/
|
|
3347
|
+
removeChild(styles: HTMLStyleElement): void;
|
|
3348
|
+
/**
|
|
3349
|
+
* Returns all element descendants of node that match selectors.
|
|
3350
|
+
* @param selectors - The CSS selector to use for the query.
|
|
3351
|
+
*/
|
|
3352
|
+
querySelectorAll<E extends Element = Element>(selectors: string): NodeListOf<E>;
|
|
3353
|
+
}
|
|
1042
3354
|
|
|
1043
3355
|
/**
|
|
3356
|
+
* Implemented by objects that are interested in change notifications.
|
|
1044
3357
|
* @public
|
|
1045
3358
|
*/
|
|
1046
|
-
export declare
|
|
3359
|
+
export declare interface Subscriber {
|
|
3360
|
+
/**
|
|
3361
|
+
* Called when a subject this instance has subscribed to changes.
|
|
3362
|
+
* @param subject - The subject of the change.
|
|
3363
|
+
* @param args - The event args detailing the change that occurred.
|
|
3364
|
+
*/
|
|
3365
|
+
handleChange(subject: any, args: any): void;
|
|
3366
|
+
}
|
|
1047
3367
|
|
|
1048
3368
|
/**
|
|
1049
|
-
*
|
|
1050
|
-
*
|
|
1051
|
-
*
|
|
1052
|
-
* @param target - The class / constructor function to register as a singleton.
|
|
1053
|
-
*
|
|
1054
|
-
* @example
|
|
1055
|
-
* ```ts
|
|
1056
|
-
* @singleton()
|
|
1057
|
-
* class Foo { }
|
|
1058
|
-
* ```
|
|
3369
|
+
* An implementation of {@link Notifier} that efficiently keeps track of
|
|
3370
|
+
* subscribers interested in a specific change notification on an
|
|
3371
|
+
* observable subject.
|
|
1059
3372
|
*
|
|
3373
|
+
* @remarks
|
|
3374
|
+
* This set is optimized for the most common scenario of 1 or 2 subscribers.
|
|
3375
|
+
* With this in mind, it can store a subscriber in an internal field, allowing it to avoid Array#push operations.
|
|
3376
|
+
* If the set ever exceeds two subscribers, it upgrades to an array automatically.
|
|
3377
|
+
* @public
|
|
3378
|
+
*/
|
|
3379
|
+
export declare class SubscriberSet implements Notifier {
|
|
3380
|
+
private sub1;
|
|
3381
|
+
private sub2;
|
|
3382
|
+
private spillover;
|
|
3383
|
+
/**
|
|
3384
|
+
* The object that subscribers will receive notifications for.
|
|
3385
|
+
*/
|
|
3386
|
+
readonly subject: any;
|
|
3387
|
+
/**
|
|
3388
|
+
* Creates an instance of SubscriberSet for the specified subject.
|
|
3389
|
+
* @param subject - The subject that subscribers will receive notifications from.
|
|
3390
|
+
* @param initialSubscriber - An initial subscriber to changes.
|
|
3391
|
+
*/
|
|
3392
|
+
constructor(subject: any, initialSubscriber?: Subscriber);
|
|
3393
|
+
/**
|
|
3394
|
+
* Checks whether the provided subscriber has been added to this set.
|
|
3395
|
+
* @param subscriber - The subscriber to test for inclusion in this set.
|
|
3396
|
+
*/
|
|
3397
|
+
has(subscriber: Subscriber): boolean;
|
|
3398
|
+
/**
|
|
3399
|
+
* Subscribes to notification of changes in an object's state.
|
|
3400
|
+
* @param subscriber - The object that is subscribing for change notification.
|
|
3401
|
+
*/
|
|
3402
|
+
subscribe(subscriber: Subscriber): void;
|
|
3403
|
+
/**
|
|
3404
|
+
* Unsubscribes from notification of changes in an object's state.
|
|
3405
|
+
* @param subscriber - The object that is unsubscribing from change notification.
|
|
3406
|
+
*/
|
|
3407
|
+
unsubscribe(subscriber: Subscriber): void;
|
|
3408
|
+
/**
|
|
3409
|
+
* Notifies all subscribers.
|
|
3410
|
+
* @param args - Data passed along to subscribers during notification.
|
|
3411
|
+
*/
|
|
3412
|
+
notify(args: any): void;
|
|
3413
|
+
}
|
|
3414
|
+
|
|
3415
|
+
/**
|
|
3416
|
+
* The options used to configure subtree observation.
|
|
3417
|
+
* @public
|
|
3418
|
+
*/
|
|
3419
|
+
export declare interface SubtreeDirectiveOptions<T = any> extends NodeBehaviorOptions<T>, Omit<MutationObserverInit, "subtree" | "childList"> {
|
|
3420
|
+
/**
|
|
3421
|
+
* Indicates that child subtrees should be observed for changes.
|
|
3422
|
+
*/
|
|
3423
|
+
subtree: boolean;
|
|
3424
|
+
/**
|
|
3425
|
+
* When subtrees are observed, a query selector is required to indicate
|
|
3426
|
+
* which of potentially many nodes should be assigned to the property.
|
|
3427
|
+
*/
|
|
3428
|
+
selector: string;
|
|
3429
|
+
}
|
|
3430
|
+
|
|
3431
|
+
/**
|
|
3432
|
+
* A view representing a range of DOM nodes which can be added/removed ad hoc.
|
|
3433
|
+
* @public
|
|
3434
|
+
*/
|
|
3435
|
+
export declare interface SyntheticView<TSource = any, TParent = any> extends View<TSource, TParent> {
|
|
3436
|
+
/**
|
|
3437
|
+
* The first DOM node in the range of nodes that make up the view.
|
|
3438
|
+
*/
|
|
3439
|
+
readonly firstChild: Node;
|
|
3440
|
+
/**
|
|
3441
|
+
* The last DOM node in the range of nodes that make up the view.
|
|
3442
|
+
*/
|
|
3443
|
+
readonly lastChild: Node;
|
|
3444
|
+
/**
|
|
3445
|
+
* Inserts the view's DOM nodes before the referenced node.
|
|
3446
|
+
* @param node - The node to insert the view's DOM before.
|
|
3447
|
+
*/
|
|
3448
|
+
insertBefore(node: Node): void;
|
|
3449
|
+
/**
|
|
3450
|
+
* Removes the view's DOM nodes.
|
|
3451
|
+
* The nodes are not disposed and the view can later be re-inserted.
|
|
3452
|
+
*/
|
|
3453
|
+
remove(): void;
|
|
3454
|
+
}
|
|
3455
|
+
|
|
3456
|
+
/**
|
|
3457
|
+
* A template capable of rendering views not specifically connected to custom elements.
|
|
3458
|
+
* @public
|
|
3459
|
+
*/
|
|
3460
|
+
export declare interface SyntheticViewTemplate<TSource = any, TParent = any> {
|
|
3461
|
+
/**
|
|
3462
|
+
* Creates a SyntheticView instance based on this template definition.
|
|
3463
|
+
*/
|
|
3464
|
+
create(): SyntheticView<TSource, TParent>;
|
|
3465
|
+
/**
|
|
3466
|
+
* Returns a directive that can inline the template.
|
|
3467
|
+
*/
|
|
3468
|
+
inline(): CaptureType;
|
|
3469
|
+
}
|
|
3470
|
+
|
|
3471
|
+
/**
|
|
3472
|
+
* Lifecycle callbacks for template events.
|
|
3473
|
+
* @public
|
|
3474
|
+
*/
|
|
3475
|
+
export declare interface TemplateLifecycleCallbacks {
|
|
3476
|
+
/**
|
|
3477
|
+
* Called after the JS class definition has been registered.
|
|
3478
|
+
*/
|
|
3479
|
+
elementDidRegister?(name: string): void;
|
|
3480
|
+
/**
|
|
3481
|
+
* Called before the template has been evaluated and assigned.
|
|
3482
|
+
*/
|
|
3483
|
+
templateWillUpdate?(name: string): void;
|
|
3484
|
+
/**
|
|
3485
|
+
* Called after the template has been assigned to the definition.
|
|
3486
|
+
*/
|
|
3487
|
+
templateDidUpdate?(name: string): void;
|
|
3488
|
+
/**
|
|
3489
|
+
* Called after the custom element has been defined.
|
|
3490
|
+
*/
|
|
3491
|
+
elementDidDefine?(name: string): void;
|
|
3492
|
+
/**
|
|
3493
|
+
* Called before an individual element's hydration begins.
|
|
3494
|
+
*/
|
|
3495
|
+
elementWillHydrate?(source: HTMLElement): void;
|
|
3496
|
+
/**
|
|
3497
|
+
* Called after an individual element's hydration has finished.
|
|
3498
|
+
*/
|
|
3499
|
+
elementDidHydrate?(source: HTMLElement): void;
|
|
3500
|
+
}
|
|
3501
|
+
|
|
3502
|
+
/**
|
|
3503
|
+
* Represents the types of values that can be interpolated into a template.
|
|
3504
|
+
* @public
|
|
3505
|
+
*/
|
|
3506
|
+
export declare type TemplateValue<TSource, TParent = any> = Expression<TSource, any, TParent> | Binding<TSource, any, TParent> | HTMLDirective | CaptureType;
|
|
3507
|
+
|
|
3508
|
+
/**
|
|
3509
|
+
* A policy for use with the standard trustedTypes platform API.
|
|
1060
3510
|
* @public
|
|
1061
3511
|
*/
|
|
1062
|
-
export declare
|
|
3512
|
+
export declare type TrustedTypesPolicy = {
|
|
3513
|
+
/**
|
|
3514
|
+
* Creates trusted HTML.
|
|
3515
|
+
* @param html - The HTML to clear as trustworthy.
|
|
3516
|
+
*/
|
|
3517
|
+
createHTML(html: string): string;
|
|
3518
|
+
};
|
|
1063
3519
|
|
|
1064
|
-
|
|
3520
|
+
/**
|
|
3521
|
+
* Creates a default binding.
|
|
3522
|
+
* @param expression - The binding to refresh when changed.
|
|
3523
|
+
* @param optionsOrChangeEvent - The binding options or the name of the change event to use.
|
|
3524
|
+
* @param policy - The security policy to associate with the binding.
|
|
3525
|
+
* @param isBindingVolatile - Indicates whether the binding is volatile or not.
|
|
3526
|
+
* @returns A binding.
|
|
3527
|
+
* @public
|
|
3528
|
+
*/
|
|
3529
|
+
export declare function twoWay<T = any>(expression: Expression<T>, optionsOrChangeEvent?: TwoWayBindingOptions | string, policy?: DOMPolicy_2, isBindingVolatile?: boolean): Binding<T>;
|
|
1065
3530
|
|
|
1066
|
-
|
|
1067
|
-
|
|
3531
|
+
/**
|
|
3532
|
+
* The twoWay binding options.
|
|
3533
|
+
* @public
|
|
3534
|
+
*/
|
|
3535
|
+
export declare type TwoWayBindingOptions = {
|
|
3536
|
+
changeEvent?: string;
|
|
3537
|
+
fromView?: (value: any) => any;
|
|
1068
3538
|
};
|
|
1069
3539
|
|
|
1070
3540
|
/**
|
|
1071
|
-
*
|
|
1072
|
-
* to the requestor.
|
|
3541
|
+
* The settings required to enable two-way binding.
|
|
1073
3542
|
* @public
|
|
1074
3543
|
*/
|
|
1075
|
-
declare
|
|
1076
|
-
|
|
3544
|
+
export declare interface TwoWaySettings {
|
|
3545
|
+
/**
|
|
3546
|
+
* Determines which event to listen to, to detect changes in the view.
|
|
3547
|
+
* @param bindingSource - The directive to determine the change event for.
|
|
3548
|
+
* @param target - The target element to determine the change event for.
|
|
3549
|
+
*/
|
|
3550
|
+
determineChangeEvent(bindingSource: BindingDirective, target: HTMLElement): string;
|
|
3551
|
+
}
|
|
1077
3552
|
|
|
1078
3553
|
/**
|
|
1079
|
-
*
|
|
1080
|
-
* a new instance will be created.
|
|
1081
|
-
*
|
|
1082
|
-
* @example
|
|
1083
|
-
* ```ts
|
|
1084
|
-
* @transient()
|
|
1085
|
-
* class Foo { }
|
|
1086
|
-
* ```
|
|
1087
|
-
*
|
|
3554
|
+
* Enables configuring two-way binding settings.
|
|
1088
3555
|
* @public
|
|
1089
3556
|
*/
|
|
1090
|
-
export declare
|
|
3557
|
+
export declare const TwoWaySettings: Readonly<{
|
|
3558
|
+
/**
|
|
3559
|
+
* Configures two-way binding.
|
|
3560
|
+
* @param settings - The settings to use for the two-way binding system.
|
|
3561
|
+
*/
|
|
3562
|
+
configure(settings: TwoWaySettings): void;
|
|
3563
|
+
}>;
|
|
3564
|
+
|
|
3565
|
+
/* Excluded from this release type: TypeDefinition */
|
|
3566
|
+
|
|
3567
|
+
/* Excluded from this release type: TypeRegistry */
|
|
3568
|
+
|
|
3569
|
+
/* Excluded from this release type: UnobservableMutationObserver */
|
|
1091
3570
|
|
|
1092
3571
|
/**
|
|
1093
|
-
*
|
|
1094
|
-
* a new instance will be created.
|
|
1095
|
-
*
|
|
1096
|
-
* @param target - The class / constructor function to register as transient.
|
|
1097
|
-
*
|
|
1098
|
-
* @example
|
|
1099
|
-
* ```ts
|
|
1100
|
-
* @transient()
|
|
1101
|
-
* class Foo { }
|
|
1102
|
-
* ```
|
|
1103
|
-
*
|
|
3572
|
+
* A work queue used to synchronize writes to the DOM.
|
|
1104
3573
|
* @public
|
|
1105
3574
|
*/
|
|
1106
|
-
export declare
|
|
3575
|
+
export declare interface UpdateQueue {
|
|
3576
|
+
/**
|
|
3577
|
+
* Schedules DOM update work in the next batch.
|
|
3578
|
+
* @param callable - The callable function or object to queue.
|
|
3579
|
+
*/
|
|
3580
|
+
enqueue(callable: Callable): void;
|
|
3581
|
+
/**
|
|
3582
|
+
* Resolves with the next DOM update.
|
|
3583
|
+
*/
|
|
3584
|
+
next(): Promise<void>;
|
|
3585
|
+
/**
|
|
3586
|
+
* Immediately processes all work previously scheduled
|
|
3587
|
+
* through enqueue.
|
|
3588
|
+
* @remarks
|
|
3589
|
+
* This also forces next() promises
|
|
3590
|
+
* to resolve.
|
|
3591
|
+
*/
|
|
3592
|
+
process(): void;
|
|
3593
|
+
/**
|
|
3594
|
+
* Sets the update mode used by enqueue.
|
|
3595
|
+
* @param isAsync - Indicates whether DOM updates should be asynchronous.
|
|
3596
|
+
* @remarks
|
|
3597
|
+
* By default, the update mode is asynchronous, since that provides the best
|
|
3598
|
+
* performance in the browser. Passing false to setMode will instead cause
|
|
3599
|
+
* the queue to be immediately processed for each call to enqueue. However,
|
|
3600
|
+
* ordering will still be preserved so that nested tasks do not run until
|
|
3601
|
+
* after parent tasks complete.
|
|
3602
|
+
*/
|
|
3603
|
+
setMode(isAsync: boolean): void;
|
|
3604
|
+
}
|
|
3605
|
+
|
|
3606
|
+
/**
|
|
3607
|
+
* The default UpdateQueue.
|
|
3608
|
+
* @public
|
|
3609
|
+
*/
|
|
3610
|
+
export declare const Updates: UpdateQueue;
|
|
3611
|
+
|
|
3612
|
+
/**
|
|
3613
|
+
* Represents objects that can convert values to and from
|
|
3614
|
+
* view or model representations.
|
|
3615
|
+
* @public
|
|
3616
|
+
*/
|
|
3617
|
+
export declare interface ValueConverter {
|
|
3618
|
+
/**
|
|
3619
|
+
* Converts a value from its representation in the model, to a representation for the view.
|
|
3620
|
+
* @param value - The value to convert to a view representation.
|
|
3621
|
+
*/
|
|
3622
|
+
toView(value: any): any;
|
|
3623
|
+
/**
|
|
3624
|
+
* Converts a value from its representation in the view, to a representation for the model.
|
|
3625
|
+
* @param value - The value to convert to a model representation.
|
|
3626
|
+
*/
|
|
3627
|
+
fromView(value: any): any;
|
|
3628
|
+
}
|
|
3629
|
+
|
|
3630
|
+
/**
|
|
3631
|
+
* Represents a collection of DOM nodes which can be bound to a data source.
|
|
3632
|
+
* @public
|
|
3633
|
+
*/
|
|
3634
|
+
export declare interface View<TSource = any, TParent = any> extends Disposable {
|
|
3635
|
+
/**
|
|
3636
|
+
* The execution context the view is running within.
|
|
3637
|
+
*/
|
|
3638
|
+
readonly context: ExecutionContext<TParent>;
|
|
3639
|
+
/**
|
|
3640
|
+
* The data that the view is bound to.
|
|
3641
|
+
*/
|
|
3642
|
+
readonly source: TSource | null;
|
|
3643
|
+
/**
|
|
3644
|
+
* Indicates whether the controller is bound.
|
|
3645
|
+
*/
|
|
3646
|
+
readonly isBound: boolean;
|
|
3647
|
+
/**
|
|
3648
|
+
* Binds a view's behaviors to its binding source.
|
|
3649
|
+
* @param source - The binding source for the view's binding behaviors.
|
|
3650
|
+
*/
|
|
3651
|
+
bind(source: TSource, context?: ExecutionContext<TParent>): void;
|
|
3652
|
+
/**
|
|
3653
|
+
* Unbinds a view's behaviors from its binding source and context.
|
|
3654
|
+
*/
|
|
3655
|
+
unbind(): void;
|
|
3656
|
+
}
|
|
3657
|
+
|
|
3658
|
+
/**
|
|
3659
|
+
* Represents an object that can contribute behavior to a view.
|
|
3660
|
+
* @public
|
|
3661
|
+
*/
|
|
3662
|
+
export declare interface ViewBehavior<TSource = any, TParent = any> {
|
|
3663
|
+
/**
|
|
3664
|
+
* Bind this behavior.
|
|
3665
|
+
* @param controller - The view controller that manages the lifecycle of this behavior.
|
|
3666
|
+
*/
|
|
3667
|
+
bind(controller: ViewController<TSource, TParent>): void;
|
|
3668
|
+
}
|
|
3669
|
+
|
|
3670
|
+
/**
|
|
3671
|
+
* A factory that can create a {@link ViewBehavior} associated with a particular
|
|
3672
|
+
* location within a DOM fragment.
|
|
3673
|
+
* @public
|
|
3674
|
+
*/
|
|
3675
|
+
export declare interface ViewBehaviorFactory {
|
|
3676
|
+
/**
|
|
3677
|
+
* The unique id of the factory.
|
|
3678
|
+
*/
|
|
3679
|
+
id?: string;
|
|
3680
|
+
/**
|
|
3681
|
+
* The structural id of the DOM node to which the created behavior will apply.
|
|
3682
|
+
*/
|
|
3683
|
+
targetNodeId?: string;
|
|
3684
|
+
/**
|
|
3685
|
+
* The tag name of the DOM node to which the created behavior will apply.
|
|
3686
|
+
*/
|
|
3687
|
+
targetTagName?: string | null;
|
|
3688
|
+
/**
|
|
3689
|
+
* The policy that the created behavior must run under.
|
|
3690
|
+
*/
|
|
3691
|
+
policy?: DOMPolicy_2;
|
|
3692
|
+
/**
|
|
3693
|
+
* Creates a behavior.
|
|
3694
|
+
*/
|
|
3695
|
+
createBehavior(): ViewBehavior;
|
|
3696
|
+
}
|
|
3697
|
+
|
|
3698
|
+
/**
|
|
3699
|
+
* Bridges between ViewBehaviors and HostBehaviors, enabling a host to
|
|
3700
|
+
* control ViewBehaviors.
|
|
3701
|
+
* @public
|
|
3702
|
+
*/
|
|
3703
|
+
export declare interface ViewBehaviorOrchestrator<TSource = any, TParent = any> extends ViewController<TSource, TParent>, HostBehavior<TSource> {
|
|
3704
|
+
/**
|
|
3705
|
+
*
|
|
3706
|
+
* @param nodeId - The structural id of the DOM node to which a behavior will apply.
|
|
3707
|
+
* @param target - The DOM node associated with the id.
|
|
3708
|
+
*/
|
|
3709
|
+
addTarget(nodeId: string, target: Node): void;
|
|
3710
|
+
/**
|
|
3711
|
+
* Adds a behavior.
|
|
3712
|
+
* @param behavior - The behavior to add.
|
|
3713
|
+
*/
|
|
3714
|
+
addBehavior(behavior: ViewBehavior): void;
|
|
3715
|
+
/**
|
|
3716
|
+
* Adds a behavior factory.
|
|
3717
|
+
* @param factory - The behavior factory to add.
|
|
3718
|
+
* @param target - The target the factory will create behaviors for.
|
|
3719
|
+
*/
|
|
3720
|
+
addBehaviorFactory(factory: ViewBehaviorFactory, target: Node): void;
|
|
3721
|
+
}
|
|
3722
|
+
|
|
3723
|
+
/**
|
|
3724
|
+
* Bridges between ViewBehaviors and HostBehaviors, enabling a host to
|
|
3725
|
+
* control ViewBehaviors.
|
|
3726
|
+
* @public
|
|
3727
|
+
*/
|
|
3728
|
+
export declare const ViewBehaviorOrchestrator: Readonly<{
|
|
3729
|
+
/**
|
|
3730
|
+
* Creates a ViewBehaviorOrchestrator.
|
|
3731
|
+
* @param source - The source to to associate behaviors with.
|
|
3732
|
+
* @returns A ViewBehaviorOrchestrator.
|
|
3733
|
+
*/
|
|
3734
|
+
create<TSource = any, TParent = any>(source: TSource): ViewBehaviorOrchestrator<TSource, TParent>;
|
|
3735
|
+
}>;
|
|
3736
|
+
|
|
3737
|
+
/**
|
|
3738
|
+
* The target nodes available to a behavior.
|
|
3739
|
+
* @public
|
|
3740
|
+
*/
|
|
3741
|
+
export declare type ViewBehaviorTargets = {
|
|
3742
|
+
[id: string]: Node;
|
|
3743
|
+
};
|
|
3744
|
+
|
|
3745
|
+
/**
|
|
3746
|
+
* Controls the lifecycle of a view and provides relevant context.
|
|
3747
|
+
* @public
|
|
3748
|
+
*/
|
|
3749
|
+
export declare interface ViewController<TSource = any, TParent = any> extends ExpressionController<TSource, TParent> {
|
|
3750
|
+
/**
|
|
3751
|
+
* The parts of the view that are targeted by view behaviors.
|
|
3752
|
+
*/
|
|
3753
|
+
readonly targets: ViewBehaviorTargets;
|
|
3754
|
+
/* Excluded from this release type: _skipAttrUpdates */
|
|
3755
|
+
/**
|
|
3756
|
+
* Resolves `true` when the view's host element had prerendered
|
|
3757
|
+
* content (existing shadow root).
|
|
3758
|
+
*/
|
|
3759
|
+
readonly isPrerendered?: Promise<boolean>;
|
|
3760
|
+
/**
|
|
3761
|
+
* Resolves `true` after prerendered content has been hydrated,
|
|
3762
|
+
* `false` when client-side rendered or hydration not enabled.
|
|
3763
|
+
*/
|
|
3764
|
+
readonly isHydrated?: Promise<boolean>;
|
|
3765
|
+
}
|
|
1107
3766
|
|
|
1108
|
-
|
|
3767
|
+
/**
|
|
3768
|
+
* A template capable of creating HTMLView instances or rendering directly to DOM.
|
|
3769
|
+
* @public
|
|
3770
|
+
*/
|
|
3771
|
+
export declare class ViewTemplate<TSource = any, TParent = any> implements ElementViewTemplate<TSource, TParent>, SyntheticViewTemplate<TSource, TParent> {
|
|
3772
|
+
private policy?;
|
|
3773
|
+
private result;
|
|
3774
|
+
/**
|
|
3775
|
+
* The html representing what this template will
|
|
3776
|
+
* instantiate, including placeholders for directives.
|
|
3777
|
+
*/
|
|
3778
|
+
readonly html: string | HTMLTemplateElement;
|
|
3779
|
+
/**
|
|
3780
|
+
* The directives that will be connected to placeholders in the html.
|
|
3781
|
+
*/
|
|
3782
|
+
readonly factories: Record<string, ViewBehaviorFactory>;
|
|
3783
|
+
/**
|
|
3784
|
+
* Creates an instance of ViewTemplate.
|
|
3785
|
+
* @param html - The html representing what this template will instantiate, including placeholders for directives.
|
|
3786
|
+
* @param factories - The directives that will be connected to placeholders in the html.
|
|
3787
|
+
* @param policy - The security policy to use when compiling this template.
|
|
3788
|
+
*/
|
|
3789
|
+
constructor(html: string | HTMLTemplateElement, factories?: Record<string, ViewBehaviorFactory>, policy?: DOMPolicy_2 | undefined);
|
|
3790
|
+
/* Excluded from this release type: compile */
|
|
3791
|
+
/**
|
|
3792
|
+
* Returns a directive that can inline the template.
|
|
3793
|
+
*/
|
|
3794
|
+
inline(): CaptureType;
|
|
3795
|
+
/**
|
|
3796
|
+
* Sets the DOMPolicy for this template.
|
|
3797
|
+
* @param policy - The policy to associated with this template.
|
|
3798
|
+
* @returns The modified template instance.
|
|
3799
|
+
* @remarks
|
|
3800
|
+
* The DOMPolicy can only be set once for a template and cannot be
|
|
3801
|
+
* set after the template is compiled.
|
|
3802
|
+
*/
|
|
3803
|
+
withPolicy(policy: DOMPolicy_2): this;
|
|
3804
|
+
/**
|
|
3805
|
+
* Creates an HTMLView from this template, binds it to the source, and then appends it to the host.
|
|
3806
|
+
* @param source - The data source to bind the template to.
|
|
3807
|
+
* @param host - The Element where the template will be rendered.
|
|
3808
|
+
* @param hostBindingTarget - An HTML element to target the host bindings at if different from the
|
|
3809
|
+
* host that the template is being attached to.
|
|
3810
|
+
*/
|
|
3811
|
+
render(source: TSource, host: Node, hostBindingTarget?: Element): HTMLView<TSource, TParent>;
|
|
3812
|
+
/**
|
|
3813
|
+
* Creates an HTMLView instance based on this template definition.
|
|
3814
|
+
* @param hostBindingTarget - The element that host behaviors will be bound to.
|
|
3815
|
+
*/
|
|
3816
|
+
create(hostBindingTarget?: Element): HTMLView<TSource, TParent>;
|
|
3817
|
+
/**
|
|
3818
|
+
* Processes the tagged template literal's static strings and interpolated values and
|
|
3819
|
+
* creates a ViewTemplate.
|
|
3820
|
+
*
|
|
3821
|
+
* For each interpolated value:
|
|
3822
|
+
* 1. Functions (binding expressions, e.g., `x => x.name`) → wrapped in a one-way HTMLBindingDirective
|
|
3823
|
+
* 2. Binding instances → wrapped in an HTMLBindingDirective
|
|
3824
|
+
* 3. HTMLDirective instances → used as-is
|
|
3825
|
+
* 4. Static values (strings, numbers) → wrapped in a one-time HTMLBindingDirective
|
|
3826
|
+
*
|
|
3827
|
+
* Each directive's createHTML() is called with an `add` callback that registers
|
|
3828
|
+
* the factory in the factories record under a unique ID and returns that ID.
|
|
3829
|
+
* The directive inserts a placeholder marker (e.g., `fast-abc123{0}fast-abc123`) into
|
|
3830
|
+
* the HTML string so the compiler can later find and associate it with the factory.
|
|
3831
|
+
*
|
|
3832
|
+
* Aspect detection happens here too: the `lastAttributeNameRegex` checks whether
|
|
3833
|
+
* the placeholder appears inside an attribute value, and if so, assignAspect()
|
|
3834
|
+
* sets the correct DOMAspect (attribute, property, event, etc.) based on the
|
|
3835
|
+
* attribute name prefix.
|
|
3836
|
+
*
|
|
3837
|
+
* @param strings - The static strings to create the template with.
|
|
3838
|
+
* @param values - The dynamic values to create the template with.
|
|
3839
|
+
* @param policy - The DOMPolicy to associated with the template.
|
|
3840
|
+
* @returns A ViewTemplate.
|
|
3841
|
+
* @remarks
|
|
3842
|
+
* This API should not be used directly under normal circumstances because constructing
|
|
3843
|
+
* a template in this way, if not done properly, can open up the application to XSS
|
|
3844
|
+
* attacks. When using this API, provide a strong DOMPolicy that can properly sanitize
|
|
3845
|
+
* and also be sure to manually sanitize all static strings particularly if they can
|
|
3846
|
+
* come from user input.
|
|
3847
|
+
*/
|
|
3848
|
+
static create<TSource = any, TParent = any>(strings: string[], values: TemplateValue<TSource, TParent>[], policy?: DOMPolicy_2): ViewTemplate<TSource, TParent>;
|
|
3849
|
+
}
|
|
1109
3850
|
|
|
1110
3851
|
/**
|
|
1111
|
-
*
|
|
3852
|
+
* Decorator: Marks a property getter as having volatile observable dependencies.
|
|
3853
|
+
* @param target - The target that the property is defined on.
|
|
3854
|
+
* @param name - The property name.
|
|
3855
|
+
* @param name - The existing descriptor.
|
|
1112
3856
|
* @public
|
|
1113
3857
|
*/
|
|
1114
|
-
declare
|
|
3858
|
+
export declare function volatile(target: {}, name: string | Accessor, descriptor: PropertyDescriptor): PropertyDescriptor;
|
|
3859
|
+
|
|
3860
|
+
/**
|
|
3861
|
+
* Deeply subscribes to changes in existing observable objects.
|
|
3862
|
+
* @param object - The observable object to watch.
|
|
3863
|
+
* @param subscriber - The handler to call when changes are made to the object.
|
|
3864
|
+
* @returns A disposable that can be used to unsubscribe from change updates.
|
|
3865
|
+
* @beta
|
|
3866
|
+
*/
|
|
3867
|
+
export declare function watch(object: any, subscriber: Subscriber | ((subject: any, args: any) => void)): Disposable;
|
|
1115
3868
|
|
|
1116
|
-
/**
|
|
1117
|
-
|
|
3869
|
+
/**
|
|
3870
|
+
* A directive that enables basic conditional rendering in a template.
|
|
3871
|
+
* @param condition - The condition to test for rendering.
|
|
3872
|
+
* @param templateOrTemplateBinding - The template or a binding that gets
|
|
3873
|
+
* the template to render when the condition is true.
|
|
3874
|
+
* @param elseTemplateOrTemplateBinding - Optional template or binding that that
|
|
3875
|
+
* gets the template to render when the conditional is false.
|
|
3876
|
+
* @public
|
|
3877
|
+
*/
|
|
3878
|
+
export declare function when<TSource = any, TReturn = any, TParent = any>(condition: Expression<TSource, TReturn, TParent> | boolean, templateOrTemplateBinding: SyntheticViewTemplate<TSource, TParent> | Expression<TSource, SyntheticViewTemplate<TSource, TParent>, TParent>, elseTemplateOrTemplateBinding?: SyntheticViewTemplate<TSource, TParent> | Expression<TSource, SyntheticViewTemplate<TSource, TParent>, TParent>): CaptureType;
|
|
1118
3879
|
|
|
1119
3880
|
export { }
|