@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
|
@@ -22,6 +22,10 @@ export interface ElementViewTemplate<TSource = any, TParent = any> {
|
|
|
22
22
|
*/
|
|
23
23
|
render(source: TSource, host: Node, hostBindingTarget?: Element): ElementView<TSource, TParent>;
|
|
24
24
|
}
|
|
25
|
+
/**
|
|
26
|
+
* A template capable of hydrating an element view from existing DOM nodes.
|
|
27
|
+
* @beta
|
|
28
|
+
*/
|
|
25
29
|
export interface HydratableElementViewTemplate<TSource = any, TParent = any> extends ElementViewTemplate<TSource, TParent> {
|
|
26
30
|
hydrate(firstChild: Node, lastChild: Node, hostBindingTarget?: Element): ElementView<TSource, TParent>;
|
|
27
31
|
}
|
|
@@ -30,7 +34,7 @@ export interface HydratableElementViewTemplate<TSource = any, TParent = any> ext
|
|
|
30
34
|
* into templates.
|
|
31
35
|
* @public
|
|
32
36
|
*/
|
|
33
|
-
export interface CaptureType
|
|
37
|
+
export interface CaptureType {
|
|
34
38
|
}
|
|
35
39
|
/**
|
|
36
40
|
* A template capable of rendering views not specifically connected to custom elements.
|
|
@@ -44,8 +48,12 @@ export interface SyntheticViewTemplate<TSource = any, TParent = any> {
|
|
|
44
48
|
/**
|
|
45
49
|
* Returns a directive that can inline the template.
|
|
46
50
|
*/
|
|
47
|
-
inline(): CaptureType
|
|
51
|
+
inline(): CaptureType;
|
|
48
52
|
}
|
|
53
|
+
/**
|
|
54
|
+
* A template capable of hydrating a synthetic view from existing DOM nodes.
|
|
55
|
+
* @beta
|
|
56
|
+
*/
|
|
49
57
|
export interface HydratableSyntheticViewTemplate<TSource = any, TParent = any> extends SyntheticViewTemplate {
|
|
50
58
|
hydrate(firstChild: Node, lastChild: Node): SyntheticView<TSource, TParent>;
|
|
51
59
|
}
|
|
@@ -65,7 +73,7 @@ export interface HTMLTemplateCompilationResult<TSource = any, TParent = any> {
|
|
|
65
73
|
* Represents the types of values that can be interpolated into a template.
|
|
66
74
|
* @public
|
|
67
75
|
*/
|
|
68
|
-
export type TemplateValue<TSource, TParent = any> = Expression<TSource, any, TParent> | Binding<TSource, any, TParent> | HTMLDirective | CaptureType
|
|
76
|
+
export type TemplateValue<TSource, TParent = any> = Expression<TSource, any, TParent> | Binding<TSource, any, TParent> | HTMLDirective | CaptureType;
|
|
69
77
|
/**
|
|
70
78
|
* Inlines a template into another template.
|
|
71
79
|
* @public
|
|
@@ -115,15 +123,10 @@ export declare class ViewTemplate<TSource = any, TParent = any> implements Eleme
|
|
|
115
123
|
* @internal
|
|
116
124
|
*/
|
|
117
125
|
compile(): HTMLTemplateCompilationResult<TSource, TParent>;
|
|
118
|
-
/**
|
|
119
|
-
* Creates an HTMLView instance based on this template definition.
|
|
120
|
-
* @param hostBindingTarget - The element that host behaviors will be bound to.
|
|
121
|
-
*/
|
|
122
|
-
create(hostBindingTarget?: Element): HTMLView<TSource, TParent>;
|
|
123
126
|
/**
|
|
124
127
|
* Returns a directive that can inline the template.
|
|
125
128
|
*/
|
|
126
|
-
inline(): CaptureType
|
|
129
|
+
inline(): CaptureType;
|
|
127
130
|
/**
|
|
128
131
|
* Sets the DOMPolicy for this template.
|
|
129
132
|
* @param policy - The policy to associated with this template.
|
|
@@ -141,6 +144,11 @@ export declare class ViewTemplate<TSource = any, TParent = any> implements Eleme
|
|
|
141
144
|
* host that the template is being attached to.
|
|
142
145
|
*/
|
|
143
146
|
render(source: TSource, host: Node, hostBindingTarget?: Element): HTMLView<TSource, TParent>;
|
|
147
|
+
/**
|
|
148
|
+
* Creates an HTMLView instance based on this template definition.
|
|
149
|
+
* @param hostBindingTarget - The element that host behaviors will be bound to.
|
|
150
|
+
*/
|
|
151
|
+
create(hostBindingTarget?: Element): HTMLView<TSource, TParent>;
|
|
144
152
|
/**
|
|
145
153
|
* Processes the tagged template literal's static strings and interpolated values and
|
|
146
154
|
* creates a ViewTemplate.
|
|
@@ -1,9 +1,6 @@
|
|
|
1
|
-
import { Hydratable } from "../components/hydration.js";
|
|
2
|
-
import { type ViewBehaviorBoundaries } from "../hydration/target-builder.js";
|
|
3
1
|
import type { Disposable } from "../interfaces.js";
|
|
4
2
|
import { ExecutionContext, SourceLifetime } from "../observation/observable.js";
|
|
5
|
-
import type {
|
|
6
|
-
import type { CompiledViewBehaviorFactory, ViewBehaviorFactory, ViewBehaviorTargets, ViewController } from "./html-directive.js";
|
|
3
|
+
import type { CompiledViewBehaviorFactory, ViewBehaviorTargets, ViewController } from "./html-directive.js";
|
|
7
4
|
/**
|
|
8
5
|
* Represents a collection of DOM nodes which can be bound to a data source.
|
|
9
6
|
* @public
|
|
@@ -77,7 +74,12 @@ export interface SyntheticView<TSource = any, TParent = any> extends View<TSourc
|
|
|
77
74
|
*/
|
|
78
75
|
remove(): void;
|
|
79
76
|
}
|
|
80
|
-
declare
|
|
77
|
+
export declare function removeNodeSequence(firstNode: Node, lastNode: Node): void;
|
|
78
|
+
/**
|
|
79
|
+
* The default execution context for template views.
|
|
80
|
+
* @public
|
|
81
|
+
*/
|
|
82
|
+
export declare class DefaultExecutionContext<TParent> implements ExecutionContext<TParent> {
|
|
81
83
|
/**
|
|
82
84
|
* The index of the current item within a repeat context.
|
|
83
85
|
*/
|
|
@@ -154,6 +156,24 @@ export declare class HTMLView<TSource = any, TParent = any> extends DefaultExecu
|
|
|
154
156
|
* Indicates how the source's lifetime relates to the controller's lifetime.
|
|
155
157
|
*/
|
|
156
158
|
readonly sourceLifetime: SourceLifetime;
|
|
159
|
+
/**
|
|
160
|
+
* When true, directives skip attribute/booleanAttribute DOM
|
|
161
|
+
* updates during bind(). Set only during the prerendered bind
|
|
162
|
+
* window and cleared immediately after.
|
|
163
|
+
* @internal
|
|
164
|
+
*/
|
|
165
|
+
_skipAttrUpdates: boolean;
|
|
166
|
+
/**
|
|
167
|
+
* A promise that resolves with `true` after prerendered content
|
|
168
|
+
* has been hydrated, or `false` when the view is client-side
|
|
169
|
+
* rendered. Resolves once the first bind completes.
|
|
170
|
+
*/
|
|
171
|
+
isPrerendered: Promise<boolean>;
|
|
172
|
+
/**
|
|
173
|
+
* Resolves `true` after prerendered content has been hydrated,
|
|
174
|
+
* `false` when client-side rendered or hydration not enabled.
|
|
175
|
+
*/
|
|
176
|
+
isHydrated: Promise<boolean>;
|
|
157
177
|
/**
|
|
158
178
|
* The execution context the view is running within.
|
|
159
179
|
*/
|
|
@@ -223,100 +243,3 @@ export declare class HTMLView<TSource = any, TParent = any> extends DefaultExecu
|
|
|
223
243
|
*/
|
|
224
244
|
static disposeContiguousBatch(views: SyntheticView[]): void;
|
|
225
245
|
}
|
|
226
|
-
/** @public */
|
|
227
|
-
export interface HydratableView<TSource = any, TParent = any> extends ElementView, SyntheticView, DefaultExecutionContext<TParent> {
|
|
228
|
-
[Hydratable]: symbol;
|
|
229
|
-
readonly bindingViewBoundaries: Record<string, ViewNodes>;
|
|
230
|
-
readonly hydrationStage: keyof typeof HydrationStage;
|
|
231
|
-
}
|
|
232
|
-
export interface ViewNodes {
|
|
233
|
-
first: Node;
|
|
234
|
-
last: Node;
|
|
235
|
-
}
|
|
236
|
-
export declare const HydrationStage: {
|
|
237
|
-
readonly unhydrated: "unhydrated";
|
|
238
|
-
readonly hydrating: "hydrating";
|
|
239
|
-
readonly hydrated: "hydrated";
|
|
240
|
-
};
|
|
241
|
-
/** @public */
|
|
242
|
-
export declare class HydrationBindingError extends Error {
|
|
243
|
-
/**
|
|
244
|
-
* The factory that was unable to be bound
|
|
245
|
-
*/
|
|
246
|
-
readonly factory: ViewBehaviorFactory;
|
|
247
|
-
/**
|
|
248
|
-
* A DocumentFragment containing a clone of the
|
|
249
|
-
* view's Nodes.
|
|
250
|
-
*/
|
|
251
|
-
readonly fragment: DocumentFragment;
|
|
252
|
-
/**
|
|
253
|
-
* String representation of the HTML in the template that
|
|
254
|
-
* threw the binding error.
|
|
255
|
-
*/
|
|
256
|
-
readonly templateString: string;
|
|
257
|
-
constructor(
|
|
258
|
-
/**
|
|
259
|
-
* The error message
|
|
260
|
-
*/
|
|
261
|
-
message: string | undefined,
|
|
262
|
-
/**
|
|
263
|
-
* The factory that was unable to be bound
|
|
264
|
-
*/
|
|
265
|
-
factory: ViewBehaviorFactory,
|
|
266
|
-
/**
|
|
267
|
-
* A DocumentFragment containing a clone of the
|
|
268
|
-
* view's Nodes.
|
|
269
|
-
*/
|
|
270
|
-
fragment: DocumentFragment,
|
|
271
|
-
/**
|
|
272
|
-
* String representation of the HTML in the template that
|
|
273
|
-
* threw the binding error.
|
|
274
|
-
*/
|
|
275
|
-
templateString: string);
|
|
276
|
-
}
|
|
277
|
-
export declare class HydrationView<TSource = any, TParent = any> extends DefaultExecutionContext<TParent> implements HydratableView {
|
|
278
|
-
readonly firstChild: Node;
|
|
279
|
-
readonly lastChild: Node;
|
|
280
|
-
private sourceTemplate;
|
|
281
|
-
private hostBindingTarget?;
|
|
282
|
-
[Hydratable]: symbol;
|
|
283
|
-
context: ExecutionContext<any>;
|
|
284
|
-
source: TSource | null;
|
|
285
|
-
isBound: boolean;
|
|
286
|
-
get hydrationStage(): "unhydrated" | "hydrating" | "hydrated";
|
|
287
|
-
get targets(): ViewBehaviorTargets;
|
|
288
|
-
get bindingViewBoundaries(): ViewBehaviorBoundaries;
|
|
289
|
-
readonly sourceLifetime: SourceLifetime;
|
|
290
|
-
private unbindables;
|
|
291
|
-
private fragment;
|
|
292
|
-
private behaviors;
|
|
293
|
-
private factories;
|
|
294
|
-
private _hydrationStage;
|
|
295
|
-
private _bindingViewBoundaries;
|
|
296
|
-
private _targets;
|
|
297
|
-
constructor(firstChild: Node, lastChild: Node, sourceTemplate: ViewTemplate, hostBindingTarget?: Element | undefined);
|
|
298
|
-
/**
|
|
299
|
-
* no-op. Hydrated views are don't need to be moved from a documentFragment
|
|
300
|
-
* to the target node.
|
|
301
|
-
*/
|
|
302
|
-
insertBefore(node: Node): void;
|
|
303
|
-
/**
|
|
304
|
-
* Appends the view to a node. In cases where this is called before the
|
|
305
|
-
* view has been removed, the method will no-op.
|
|
306
|
-
* @param node - the node to append the view to.
|
|
307
|
-
*/
|
|
308
|
-
appendTo(node: Node): void;
|
|
309
|
-
remove(): void;
|
|
310
|
-
bind(source: TSource, context?: ExecutionContext<any>): void;
|
|
311
|
-
unbind(): void;
|
|
312
|
-
/**
|
|
313
|
-
* Removes the view and unbinds its behaviors, disposing of DOM nodes afterward.
|
|
314
|
-
* Once a view has been disposed, it cannot be inserted or bound again.
|
|
315
|
-
*/
|
|
316
|
-
dispose(): void;
|
|
317
|
-
onUnbind(behavior: {
|
|
318
|
-
unbind(controller: ViewController<TSource, TParent>): void;
|
|
319
|
-
}): void;
|
|
320
|
-
private evaluateUnbindables;
|
|
321
|
-
}
|
|
322
|
-
export {};
|
|
@@ -9,4 +9,4 @@ import type { CaptureType, SyntheticViewTemplate } from "./template.js";
|
|
|
9
9
|
* gets the template to render when the conditional is false.
|
|
10
10
|
* @public
|
|
11
11
|
*/
|
|
12
|
-
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
|
|
12
|
+
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;
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
export type { Binding, BindingDirective } from "./binding/binding.js";
|
|
2
|
+
export type { DOMAspect, DOMPolicy } from "./dom.js";
|
|
3
|
+
export type { ExecutionContext, ExpressionController, SourceLifetime, } from "./observation/observable.js";
|
|
4
|
+
export { type CompilationStrategy, Compiler } from "./templating/compiler.js";
|
|
5
|
+
export { type ContentTemplate, type ContentView, HTMLBindingDirective, } from "./templating/html-binding-directive.js";
|
|
6
|
+
export { type AddViewBehaviorFactory, type Aspected, type CompiledViewBehaviorFactory, HTMLDirective, type HTMLDirectiveDefinition, htmlDirective, type PartialHTMLDirectiveDefinition, StatelessAttachedAttributeDirective, type ViewBehavior, type ViewBehaviorFactory, type ViewBehaviorTargets, type ViewController, } from "./templating/html-directive.js";
|
|
7
|
+
export { Markup, Parser } from "./templating/markup.js";
|
|
8
|
+
export { RenderBehavior, RenderDirective, render } from "./templating/render.js";
|
|
9
|
+
export { type CaptureType, type ElementViewTemplate, type HTMLTemplateCompilationResult, type HTMLTemplateTag, InlineTemplateDirective, type SyntheticViewTemplate, type TemplateValue, ViewTemplate, } from "./templating/template.js";
|
|
10
|
+
export { type ElementView, HTMLView, type SyntheticView, type View, } from "./templating/view.js";
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { type UpdateQueue, Updates } from "./observation/update-queue.js";
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { ArrayObserver, Sort, Splice, SpliceStrategy, SpliceStrategySupport, } from "./observation/arrays.js";
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { lengthOf, Sort, Splice, SpliceStrategy, SpliceStrategySupport, sortedCount, } from "./observation/arrays.js";
|
package/dist/esm/attr.js
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { AttributeConfiguration, AttributeDefinition, attr, booleanConverter, nullableBooleanConverter, nullableNumberConverter, } from "./components/attributes.js";
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { isFunction } from "../interfaces.js";
|
|
2
2
|
import { Binding } from "./binding.js";
|
|
3
|
-
import { oneWay } from "./one-way.js";
|
|
4
3
|
import { oneTime } from "./one-time.js";
|
|
4
|
+
import { oneWay } from "./one-way.js";
|
|
5
5
|
/**
|
|
6
6
|
* Normalizes the input value into a binding.
|
|
7
7
|
* @param value - The value to create the default binding for.
|
|
@@ -9,8 +9,8 @@ const subscribers = Object.create(null);
|
|
|
9
9
|
export const Signal = Object.freeze({
|
|
10
10
|
/**
|
|
11
11
|
* Subscribes to a signal.
|
|
12
|
-
* @param signal The signal to subscribe to.
|
|
13
|
-
* @param subscriber The subscriber.
|
|
12
|
+
* @param signal - The signal to subscribe to.
|
|
13
|
+
* @param subscriber - The subscriber.
|
|
14
14
|
*/
|
|
15
15
|
subscribe(signal, subscriber) {
|
|
16
16
|
const found = subscribers[signal];
|
|
@@ -25,8 +25,8 @@ export const Signal = Object.freeze({
|
|
|
25
25
|
},
|
|
26
26
|
/**
|
|
27
27
|
* Unsubscribes from the signal.
|
|
28
|
-
* @param signal The signal to unsubscribe from.
|
|
29
|
-
* @param subscriber The subscriber.
|
|
28
|
+
* @param signal - The signal to unsubscribe from.
|
|
29
|
+
* @param subscriber - The subscriber.
|
|
30
30
|
*/
|
|
31
31
|
unsubscribe(signal, subscriber) {
|
|
32
32
|
const found = subscribers[signal];
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { isString, Message } from "../interfaces.js";
|
|
2
|
-
import {
|
|
2
|
+
import { Observable, } from "../observation/observable.js";
|
|
3
3
|
import { FAST, makeSerializationNoop } from "../platform.js";
|
|
4
4
|
import { Binding } from "./binding.js";
|
|
5
5
|
const defaultOptions = {
|
|
@@ -12,6 +12,7 @@ let twoWaySettings = {
|
|
|
12
12
|
};
|
|
13
13
|
/**
|
|
14
14
|
* Enables configuring two-way binding settings.
|
|
15
|
+
* @public
|
|
15
16
|
*/
|
|
16
17
|
export const TwoWaySettings = Object.freeze({
|
|
17
18
|
/**
|
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { DOM } from "../dom.js";
|
|
2
2
|
import { isString } from "../interfaces.js";
|
|
3
|
+
import { Observable } from "../observation/observable.js";
|
|
3
4
|
import { Updates } from "../observation/update-queue.js";
|
|
4
|
-
import { DOM } from "../dom.js";
|
|
5
5
|
import { createMetadataLocator } from "../platform.js";
|
|
6
6
|
const booleanMode = "boolean";
|
|
7
7
|
const reflectMode = "reflect";
|
|
@@ -70,7 +70,7 @@ export const nullableNumberConverter = {
|
|
|
70
70
|
fromView: toNumber,
|
|
71
71
|
};
|
|
72
72
|
/**
|
|
73
|
-
* An implementation of
|
|
73
|
+
* An implementation of `Accessor` that supports reactivity,
|
|
74
74
|
* change callbacks, attribute reflection, and type conversion for
|
|
75
75
|
* custom elements.
|
|
76
76
|
* @public
|
|
@@ -146,10 +146,13 @@ export class AttributeDefinition {
|
|
|
146
146
|
guards.add(element);
|
|
147
147
|
const latestValue = element[this.fieldName];
|
|
148
148
|
switch (mode) {
|
|
149
|
-
case reflectMode:
|
|
149
|
+
case reflectMode: {
|
|
150
150
|
const converter = this.converter;
|
|
151
|
-
DOM.setAttribute(element, this.attribute, converter !== void 0
|
|
151
|
+
DOM.setAttribute(element, this.attribute, converter !== void 0
|
|
152
|
+
? converter.toView(latestValue)
|
|
153
|
+
: latestValue);
|
|
152
154
|
break;
|
|
155
|
+
}
|
|
153
156
|
case booleanMode:
|
|
154
157
|
DOM.setBooleanAttribute(element, this.attribute, latestValue);
|
|
155
158
|
break;
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
const definitionSchemaTransformsKey = Symbol("definitionSchemaTransforms");
|
|
2
|
+
let schemaTransformOrder = 0;
|
|
3
|
+
export function setDefinitionSchemaTransform(definition, key, transform, priority) {
|
|
4
|
+
var _a;
|
|
5
|
+
const target = definition;
|
|
6
|
+
const transforms = ((_a = target[definitionSchemaTransformsKey]) !== null && _a !== void 0 ? _a : (target[definitionSchemaTransformsKey] = []));
|
|
7
|
+
const existingIndex = transforms.findIndex(record => record.key === key);
|
|
8
|
+
if (existingIndex !== -1) {
|
|
9
|
+
transforms.splice(existingIndex, 1);
|
|
10
|
+
}
|
|
11
|
+
transforms.push({
|
|
12
|
+
key,
|
|
13
|
+
transform,
|
|
14
|
+
order: schemaTransformOrder++,
|
|
15
|
+
priority,
|
|
16
|
+
});
|
|
17
|
+
transforms.sort((a, b) => a.priority - b.priority || a.order - b.order);
|
|
18
|
+
}
|
|
19
|
+
export function getDefinitionSchemaTransforms(definition) {
|
|
20
|
+
var _a;
|
|
21
|
+
const transforms = definition === null || definition === void 0 ? void 0 : definition[definitionSchemaTransformsKey];
|
|
22
|
+
return (_a = transforms === null || transforms === void 0 ? void 0 : transforms.map(record => record.transform)) !== null && _a !== void 0 ? _a : [];
|
|
23
|
+
}
|