@lushly-dev/fast-element 3.0.1-preview.0 → 3.0.1-preview.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +12 -0
- package/dist/command/command.api.json +7857 -0
- package/dist/context/context.api.json +1084 -0
- package/dist/declarative/declarative.api.json +8130 -0
- package/dist/definition-schema/definition-schema.api.json +2689 -0
- package/dist/di/di.api.json +4945 -0
- package/dist/dts/arrays.d.ts +2 -0
- package/dist/dts/binding/binding.d.ts +59 -0
- package/dist/dts/binding/exports.d.ts +9 -0
- package/dist/dts/binding/normalize.d.ts +9 -0
- package/dist/dts/binding/one-time.d.ts +11 -0
- package/dist/dts/binding/one-way.d.ts +20 -0
- package/dist/dts/binding/signal.d.ts +36 -0
- package/dist/dts/binding/two-way.d.ts +44 -0
- package/dist/dts/command/behavior.d.ts +94 -0
- package/dist/dts/command/behaviors/confirm-behavior.d.ts +139 -0
- package/dist/dts/command/behaviors/undo-behavior.d.ts +178 -0
- package/dist/dts/command/command.d.ts +79 -0
- package/dist/dts/command/component-registry.d.ts +50 -0
- package/dist/dts/command/components/confirm-dialog.d.ts +117 -0
- package/dist/dts/command/index.d.ts +21 -0
- package/dist/dts/command/registry.d.ts +201 -0
- package/dist/dts/command/schema-validation.d.ts +45 -0
- package/dist/dts/command/types.d.ts +332 -0
- package/dist/dts/command/validation.d.ts +116 -0
- package/dist/dts/command/weak-ref.d.ts +11 -0
- package/dist/dts/components/attributes.d.ts +153 -0
- package/dist/dts/components/definition-schema-transforms.d.ts +9 -0
- package/dist/dts/components/element-controller.d.ts +349 -0
- package/dist/dts/components/element-hydration.d.ts +2 -0
- package/dist/dts/components/enable-hydration.d.ts +66 -0
- package/dist/dts/components/fast-definitions.d.ts +211 -0
- package/dist/dts/components/fast-element-registry.d.ts +23 -0
- package/dist/dts/components/fast-element.d.ts +91 -0
- package/dist/dts/components/hydration-tracker.d.ts +110 -0
- package/dist/dts/components/hydration.d.ts +52 -0
- package/dist/dts/components/schema.d.ts +205 -0
- package/dist/dts/context.d.ts +171 -0
- package/dist/dts/debug.d.ts +5 -0
- package/dist/dts/declarative/attribute-map.d.ts +58 -0
- package/dist/dts/declarative/debug.d.ts +4 -0
- package/dist/dts/declarative/index.d.ts +14 -0
- package/dist/dts/declarative/interfaces.d.ts +8 -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 +358 -0
- package/dist/dts/definition-schema/api.d.ts +42 -0
- package/dist/dts/definition-schema/cem.d.ts +78 -0
- package/dist/dts/definition-schema/extension.d.ts +18 -0
- package/dist/dts/definition-schema/extract.d.ts +38 -0
- package/dist/dts/definition-schema/index.d.ts +9 -0
- package/dist/dts/definition-schema/storage.d.ts +35 -0
- package/dist/dts/definition-schema/types.d.ts +176 -0
- package/dist/dts/dev-mode.d.ts +13 -0
- package/dist/dts/di/di.d.ts +894 -0
- package/dist/dts/dom-policy.d.ts +101 -0
- package/dist/dts/dom.d.ts +88 -0
- package/dist/dts/hydration/diagnostics.d.ts +93 -0
- package/dist/dts/hydration/exports.d.ts +18 -0
- package/dist/dts/hydration/hydration-debugger.d.ts +35 -0
- package/dist/dts/hydration/messages.d.ts +62 -0
- package/dist/dts/hydration/runtime.d.ts +7 -0
- package/dist/dts/hydration/target-builder.d.ts +107 -0
- package/dist/dts/index.d.ts +51 -0
- package/dist/dts/index.debug.d.ts +1 -0
- package/dist/dts/index.rollup.d.ts +1 -0
- package/dist/dts/index.rollup.debug.d.ts +1 -0
- package/dist/dts/interfaces.d.ts +106 -0
- package/dist/dts/metadata.d.ts +26 -0
- package/dist/dts/observation/arrays.d.ts +248 -0
- package/dist/dts/observation/notifier.d.ts +127 -0
- package/dist/dts/observation/observable.d.ts +276 -0
- package/dist/dts/observation/update-queue.d.ts +40 -0
- package/dist/dts/observation/volatile.d.ts +9 -0
- package/dist/dts/platform.d.ts +87 -0
- package/dist/dts/registry.d.ts +2 -0
- package/dist/dts/render.d.ts +7 -0
- package/dist/dts/schema.d.ts +1 -0
- package/dist/dts/scoped/detection.d.ts +55 -0
- package/dist/dts/scoped/index.d.ts +68 -0
- package/dist/dts/scoped/mixin.d.ts +118 -0
- package/dist/dts/scoped/registry.d.ts +76 -0
- package/dist/dts/scoped/types.d.ts +48 -0
- package/dist/dts/state/exports.d.ts +3 -0
- package/dist/dts/state/reactive.d.ts +8 -0
- package/dist/dts/state/state.d.ts +141 -0
- package/dist/dts/state/visitor.d.ts +6 -0
- package/dist/dts/state/watch.d.ts +10 -0
- package/dist/dts/styles/css-directive.d.ts +50 -0
- package/dist/dts/styles/css.d.ts +34 -0
- package/dist/dts/styles/element-styles.d.ts +61 -0
- package/dist/dts/styles/host.d.ts +65 -0
- package/dist/dts/styles/style-strategy.d.ts +42 -0
- package/dist/dts/templating/children.d.ts +62 -0
- package/dist/dts/templating/compiler.d.ts +54 -0
- package/dist/dts/templating/html-binding-directive.d.ts +155 -0
- package/dist/dts/templating/html-directive.d.ts +218 -0
- package/dist/dts/templating/html.d.ts +1 -0
- package/dist/dts/templating/hydration-view.d.ts +130 -0
- package/dist/dts/templating/markup.d.ts +48 -0
- package/dist/dts/templating/node-observation.d.ts +99 -0
- package/dist/dts/templating/ref.d.ts +23 -0
- package/dist/dts/templating/render.d.ts +318 -0
- package/dist/dts/templating/repeat.d.ts +131 -0
- package/dist/dts/templating/slotted.d.ts +38 -0
- package/dist/dts/templating/template.d.ts +221 -0
- package/dist/dts/templating/view.d.ts +268 -0
- package/dist/dts/templating/when.d.ts +12 -0
- package/dist/dts/testing/exports.d.ts +3 -0
- package/dist/dts/testing/fakes.d.ts +16 -0
- package/dist/dts/testing/fixture.d.ts +84 -0
- package/dist/dts/testing/models.d.ts +20 -0
- package/dist/dts/testing/timeout.d.ts +7 -0
- package/dist/dts/trust/index.d.ts +8 -0
- package/dist/dts/trust/types.d.ts +48 -0
- package/dist/dts/trust/utils.d.ts +26 -0
- package/dist/dts/tsdoc-metadata.json +11 -0
- package/dist/dts/utilities.d.ts +76 -0
- package/dist/esm/arrays.js +1 -0
- package/dist/esm/binding/binding.js +18 -0
- package/dist/esm/binding/exports.js +6 -0
- package/dist/esm/binding/normalize.js +17 -0
- package/dist/esm/binding/one-time.js +21 -0
- package/dist/esm/binding/one-way.js +30 -0
- package/dist/esm/binding/signal.js +99 -0
- package/dist/esm/binding/two-way.js +109 -0
- package/dist/esm/command/behavior.js +155 -0
- package/dist/esm/command/behaviors/confirm-behavior.js +225 -0
- package/dist/esm/command/behaviors/undo-behavior.js +313 -0
- package/dist/esm/command/command.js +104 -0
- package/dist/esm/command/component-registry.js +107 -0
- package/dist/esm/command/components/confirm-dialog.js +370 -0
- package/dist/esm/command/index.js +22 -0
- package/dist/esm/command/registry.js +755 -0
- package/dist/esm/command/schema-validation.js +194 -0
- package/dist/esm/command/types.js +86 -0
- package/dist/esm/command/validation.js +508 -0
- package/dist/esm/command/weak-ref.js +5 -0
- package/dist/esm/components/attributes.js +219 -0
- package/dist/esm/components/definition-schema-transforms.js +23 -0
- package/dist/esm/components/element-controller.js +840 -0
- package/dist/esm/components/element-hydration.js +2 -0
- package/dist/esm/components/enable-hydration.js +123 -0
- package/dist/esm/components/fast-definitions.js +294 -0
- package/dist/esm/components/fast-element-registry.js +67 -0
- package/dist/esm/components/fast-element.js +82 -0
- package/dist/esm/components/hydration-tracker.js +211 -0
- package/dist/esm/components/hydration.js +187 -0
- package/dist/esm/components/schema.js +253 -0
- package/dist/esm/context.js +185 -0
- package/dist/esm/debug.js +71 -0
- package/dist/esm/declarative/attribute-map.js +122 -0
- package/dist/esm/declarative/debug.js +4 -0
- package/dist/esm/declarative/index.js +10 -0
- package/dist/esm/declarative/interfaces.js +9 -0
- package/dist/esm/declarative/observer-map-utilities.js +565 -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 +160 -0
- package/dist/esm/declarative/template-parser.js +306 -0
- package/dist/esm/declarative/template.js +116 -0
- package/dist/esm/declarative/utilities.js +1069 -0
- package/dist/esm/definition-schema/api.js +129 -0
- package/dist/esm/definition-schema/cem.js +89 -0
- package/dist/esm/definition-schema/extension.js +53 -0
- package/dist/esm/definition-schema/extract.js +167 -0
- package/dist/esm/definition-schema/index.js +8 -0
- package/dist/esm/definition-schema/storage.js +58 -0
- package/dist/esm/definition-schema/types.js +8 -0
- package/dist/esm/dev-mode.js +22 -0
- package/dist/esm/di/di.js +1441 -0
- package/dist/esm/dom-policy.js +374 -0
- package/dist/esm/dom.js +101 -0
- package/dist/esm/hydration/diagnostics.js +50 -0
- package/dist/esm/hydration/exports.js +6 -0
- package/dist/esm/hydration/hydration-debugger.js +112 -0
- package/dist/esm/hydration/messages.js +84 -0
- package/dist/esm/hydration/runtime.js +33 -0
- package/dist/esm/hydration/target-builder.js +264 -0
- package/dist/esm/index.debug.js +3 -0
- package/dist/esm/index.js +49 -0
- package/dist/esm/index.rollup.debug.js +6 -0
- package/dist/esm/index.rollup.js +4 -0
- package/dist/esm/interfaces.js +55 -0
- package/dist/esm/metadata.js +57 -0
- package/dist/esm/observation/arrays.js +661 -0
- package/dist/esm/observation/notifier.js +162 -0
- package/dist/esm/observation/observable.js +324 -0
- package/dist/esm/observation/update-queue.js +56 -0
- package/dist/esm/observation/volatile.js +16 -0
- package/dist/esm/platform.js +98 -0
- package/dist/esm/registry.js +2 -0
- package/dist/esm/render.js +1 -0
- package/dist/esm/schema.js +1 -0
- package/dist/esm/scoped/detection.js +102 -0
- package/dist/esm/scoped/index.js +69 -0
- package/dist/esm/scoped/mixin.js +127 -0
- package/dist/esm/scoped/registry.js +125 -0
- package/dist/esm/scoped/types.js +4 -0
- package/dist/esm/state/exports.js +3 -0
- package/dist/esm/state/reactive.js +34 -0
- package/dist/esm/state/state.js +148 -0
- package/dist/esm/state/visitor.js +28 -0
- package/dist/esm/state/watch.js +36 -0
- package/dist/esm/styles/css-directive.js +36 -0
- package/dist/esm/styles/css.js +56 -0
- package/dist/esm/styles/element-styles.js +144 -0
- package/dist/esm/styles/host.js +1 -0
- package/dist/esm/styles/style-strategy.js +1 -0
- package/dist/esm/templating/children.js +67 -0
- package/dist/esm/templating/compiler.js +359 -0
- package/dist/esm/templating/html-binding-directive.js +288 -0
- package/dist/esm/templating/html-directive.js +113 -0
- package/dist/esm/templating/html.js +1 -0
- package/dist/esm/templating/hydration-view.js +228 -0
- package/dist/esm/templating/markup.js +83 -0
- package/dist/esm/templating/node-observation.js +84 -0
- package/dist/esm/templating/ref.js +21 -0
- package/dist/esm/templating/render.js +468 -0
- package/dist/esm/templating/repeat.js +434 -0
- package/dist/esm/templating/slotted.js +49 -0
- package/dist/esm/templating/template.js +206 -0
- package/dist/esm/templating/view.js +298 -0
- package/dist/esm/templating/when.js +22 -0
- package/dist/esm/testing/exports.js +3 -0
- package/dist/esm/testing/fakes.js +107 -0
- package/dist/esm/testing/fixture.js +86 -0
- package/dist/esm/testing/models.js +58 -0
- package/dist/esm/testing/timeout.js +24 -0
- package/dist/esm/trust/index.js +7 -0
- package/dist/esm/trust/types.js +6 -0
- package/dist/esm/trust/utils.js +126 -0
- package/dist/esm/utilities.js +140 -0
- package/dist/fast-element.api.json +26798 -0
- package/dist/fast-element.d.ts +3985 -0
- package/dist/fast-element.debug.js +7604 -0
- package/dist/fast-element.debug.min.js +3 -0
- package/dist/fast-element.js +7603 -0
- package/dist/fast-element.min.js +3 -0
- package/dist/fast-element.untrimmed.d.ts +4103 -0
- package/dist/observation/arrays/arrays.api.json +2621 -0
- package/dist/scoped/scoped.api.json +891 -0
- package/dist/trust/trust.api.json +629 -0
- package/package.json +21 -23
|
@@ -0,0 +1,58 @@
|
|
|
1
|
+
import { type FASTElementExtension } from "../components/fast-definitions.js";
|
|
2
|
+
import type { Schema } from "../components/schema.js";
|
|
3
|
+
export { type AccessCachedPath, type CachedPath, type CachedPathCommon, type CachedPathMap, type ChildrenMap, type DefaultCachedPath, type EventCachedPath, type JSONSchema, type JSONSchemaCommon, type JSONSchemaDefinition, type RegisterPathConfig, type RepeatCachedPath, Schema, schemaRegistry, } from "../components/schema.js";
|
|
4
|
+
/**
|
|
5
|
+
* Configuration object for the attributeMap extension.
|
|
6
|
+
* Omitting all fields uses the default attribute-mapping behavior.
|
|
7
|
+
* @public
|
|
8
|
+
*/
|
|
9
|
+
export interface AttributeMapConfig {
|
|
10
|
+
/**
|
|
11
|
+
* Strategy for mapping template binding keys to HTML attribute names.
|
|
12
|
+
*
|
|
13
|
+
* - `"camelCase"` (default): the binding key is treated as a camelCase property
|
|
14
|
+
* name and the attribute name is derived by converting it to
|
|
15
|
+
* kebab-case (e.g. `{{fooBar}}` → property `fooBar`, attribute
|
|
16
|
+
* `foo-bar`). This matches the build-time `attribute-name-strategy`
|
|
17
|
+
* option in `@microsoft/fast-build`.
|
|
18
|
+
* - `"none"`: the binding key is used as-is for both the
|
|
19
|
+
* property name and the attribute name (e.g. `{{foo-bar}}` →
|
|
20
|
+
* property `foo-bar`, attribute `foo-bar`).
|
|
21
|
+
*/
|
|
22
|
+
"attribute-name-strategy"?: "none" | "camelCase";
|
|
23
|
+
}
|
|
24
|
+
/**
|
|
25
|
+
* Creates a FAST element extension that enables schema-driven attribute mapping
|
|
26
|
+
* for the resolved definition. When called without arguments, uses the default
|
|
27
|
+
* attribute-mapping behavior. The extension uses `definition.schema` immediately
|
|
28
|
+
* for manual schemas, or the schema generated/augmented by `declarativeTemplate()`.
|
|
29
|
+
* @public
|
|
30
|
+
*/
|
|
31
|
+
export declare function attributeMap(config?: AttributeMapConfig): FASTElementExtension;
|
|
32
|
+
/**
|
|
33
|
+
* AttributeMap provides functionality for detecting simple (leaf) properties in
|
|
34
|
+
* a generated JSON schema and defining them as attr properties on a class prototype.
|
|
35
|
+
*
|
|
36
|
+
* A property is a candidate for attr when its schema entry has no nested `properties`,
|
|
37
|
+
* no `type`, and no `anyOf` — for example, a plain `foo` binding.
|
|
38
|
+
*
|
|
39
|
+
* When `attribute-name-strategy` is `"camelCase"` (the default), the binding key is treated as a
|
|
40
|
+
* camelCase property name and the HTML attribute name is derived by converting it to
|
|
41
|
+
* kebab-case (e.g. property `fooBar` → attribute `foo-bar`). This matches the
|
|
42
|
+
* build-time `attribute-name-strategy` option in `@microsoft/fast-build`.
|
|
43
|
+
*
|
|
44
|
+
* When `attribute-name-strategy` is `"none"`, the binding key is used
|
|
45
|
+
* as both the attribute name and property name — no normalization is applied.
|
|
46
|
+
*
|
|
47
|
+
* Properties already decorated with `attr` or `observable` on the class are left
|
|
48
|
+
* untouched.
|
|
49
|
+
* @public
|
|
50
|
+
*/
|
|
51
|
+
export declare class AttributeMap {
|
|
52
|
+
private schema;
|
|
53
|
+
private classPrototype;
|
|
54
|
+
private definition;
|
|
55
|
+
private config;
|
|
56
|
+
constructor(classPrototype: any, schema: Schema, definition?: any, config?: AttributeMapConfig);
|
|
57
|
+
defineProperties(): void;
|
|
58
|
+
}
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
export { AttributeConfiguration, AttributeDefinition, type AttributeMode, type ValueConverter, } from "../components/attributes.js";
|
|
2
|
+
export { FASTElementDefinition, type FASTElementExtension, type FASTElementTemplateResolver, type PartialFASTElementDefinition, type ShadowRootOptions, } from "../components/fast-definitions.js";
|
|
3
|
+
export { type AccessCachedPath, type CachedPath, type CachedPathCommon, type CachedPathMap, type ChildrenMap, type DefaultCachedPath, type EventCachedPath, type JSONSchema, type JSONSchemaCommon, type JSONSchemaDefinition, type RegisterPathConfig, type RepeatCachedPath, Schema, schemaRegistry, } from "../components/schema.js";
|
|
4
|
+
export { DOMAspect, type DOMSink } from "../dom.js";
|
|
5
|
+
export { type DOMAspectGuards, type DOMElementGuards, type DOMGuards, DOMPolicy, type DOMPolicyOptions, type DOMSinkGuards, } from "../dom-policy.js";
|
|
6
|
+
export type { Constructable, TrustedTypesPolicy } from "../interfaces.js";
|
|
7
|
+
export type { Accessor } from "../observation/observable.js";
|
|
8
|
+
export { type ComposableStyles, type ConstructibleStyleStrategy, ElementStyles, } from "../styles/element-styles.js";
|
|
9
|
+
export type { StyleStrategy, StyleTarget } from "../styles/style-strategy.js";
|
|
10
|
+
export type { ViewBehavior, ViewBehaviorFactory, } from "../templating/html-directive.js";
|
|
11
|
+
export { type CaptureType, type ElementViewTemplate, type HTMLTemplateCompilationResult, type SyntheticViewTemplate, type TemplateValue, ViewTemplate, } from "../templating/template.js";
|
|
12
|
+
export { type ElementView, HTMLView } from "../templating/view.js";
|
|
13
|
+
export { declarativeTemplate } from "./template.js";
|
|
14
|
+
export { type ResolvedStringsAndValues, TemplateParser } from "./template-parser.js";
|
|
@@ -0,0 +1,58 @@
|
|
|
1
|
+
import { type JSONSchema, type JSONSchemaDefinition } from "../components/schema.js";
|
|
2
|
+
/**
|
|
3
|
+
* Find a definition
|
|
4
|
+
* This may exist as a $ref at the root or as a $ref in any anyOf or not at all
|
|
5
|
+
* if the Observer Map has not been enabled on a child component
|
|
6
|
+
* @param schema - The JSON schema to find the ref in
|
|
7
|
+
* @returns The definition or null
|
|
8
|
+
* @public
|
|
9
|
+
*/
|
|
10
|
+
export declare function findDef(schema: JSONSchema | JSONSchemaDefinition): string | null;
|
|
11
|
+
/**
|
|
12
|
+
* Assign observables to data
|
|
13
|
+
* @param schema - The schema
|
|
14
|
+
* @param rootSchema - The root schema mapping to the root property
|
|
15
|
+
* @param data - The data
|
|
16
|
+
* @param target - The target custom element
|
|
17
|
+
* @param rootProperty - The root property
|
|
18
|
+
* @returns
|
|
19
|
+
* @public
|
|
20
|
+
*/
|
|
21
|
+
export declare function assignObservables(schema: JSONSchema | JSONSchemaDefinition, rootSchema: JSONSchema, data: any, target: any, rootProperty: string): typeof Proxy;
|
|
22
|
+
/**
|
|
23
|
+
* Assign a proxy to an object
|
|
24
|
+
* @param schema - The current schema
|
|
25
|
+
* @param rootSchema - The root schema for the root property
|
|
26
|
+
* @param target - The target custom element
|
|
27
|
+
* @param rootProperty - The root property
|
|
28
|
+
* @param object - The object to assign the proxy to
|
|
29
|
+
* @returns Proxy object
|
|
30
|
+
* @public
|
|
31
|
+
*/
|
|
32
|
+
export declare function assignProxy(schema: JSONSchema | JSONSchemaDefinition, rootSchema: JSONSchema, target: any, rootProperty: string, object: any): typeof Proxy;
|
|
33
|
+
/**
|
|
34
|
+
* Deeply compares two objects for equality.
|
|
35
|
+
*
|
|
36
|
+
* @param obj1 - First object to compare
|
|
37
|
+
* @param obj2 - Second object to compare
|
|
38
|
+
* @returns True if the objects are deeply equal, false otherwise
|
|
39
|
+
* @public
|
|
40
|
+
*/
|
|
41
|
+
export declare function deepEqual(obj1: any, obj2: any): boolean;
|
|
42
|
+
/**
|
|
43
|
+
* Checks if a value is a plain object (not an array, null, or other type).
|
|
44
|
+
*
|
|
45
|
+
* @param value - The value to check
|
|
46
|
+
* @returns True if the value is a plain object, false otherwise
|
|
47
|
+
* @public
|
|
48
|
+
*/
|
|
49
|
+
export declare function isPlainObject(value: any): value is Record<string, any>;
|
|
50
|
+
/**
|
|
51
|
+
* Deeply merges the source object into the target object.
|
|
52
|
+
*
|
|
53
|
+
* @param target - The target object to merge into
|
|
54
|
+
* @param source - The source object to merge from
|
|
55
|
+
* @returns boolean indicating whether changes were made
|
|
56
|
+
* @public
|
|
57
|
+
*/
|
|
58
|
+
export declare function deepMerge(target: any, source: any): boolean;
|
|
@@ -0,0 +1,89 @@
|
|
|
1
|
+
import { type FASTElementExtension } from "../components/fast-definitions.js";
|
|
2
|
+
import type { Schema } from "../components/schema.js";
|
|
3
|
+
export { type AccessCachedPath, type CachedPath, type CachedPathCommon, type CachedPathMap, type ChildrenMap, type DefaultCachedPath, type EventCachedPath, type JSONSchema, type JSONSchemaCommon, type JSONSchemaDefinition, type RegisterPathConfig, type RepeatCachedPath, Schema, schemaRegistry, } from "../components/schema.js";
|
|
4
|
+
/**
|
|
5
|
+
* A node in the observer-map path tree.
|
|
6
|
+
*
|
|
7
|
+
* - `true` → observe this path and all descendants (unless overridden by children).
|
|
8
|
+
* - `false` → do NOT observe this path or its descendants (unless overridden by children).
|
|
9
|
+
* - `ObserverMapPathNode` → configure child paths individually;
|
|
10
|
+
* the node itself is observed if `$observe` is true (default when parent is observed).
|
|
11
|
+
* @public
|
|
12
|
+
*/
|
|
13
|
+
export type ObserverMapPathEntry = boolean | ObserverMapPathNode;
|
|
14
|
+
/**
|
|
15
|
+
* A node object in the observer-map path tree.
|
|
16
|
+
*
|
|
17
|
+
* `$observe` controls whether this node itself is observed.
|
|
18
|
+
* When omitted the value is inherited from the nearest ancestor
|
|
19
|
+
* that explicitly sets `$observe`. At the root level the default is `true`.
|
|
20
|
+
*
|
|
21
|
+
* Child property overrides are keyed by property name.
|
|
22
|
+
* @public
|
|
23
|
+
*/
|
|
24
|
+
export interface ObserverMapPathNode {
|
|
25
|
+
$observe?: boolean;
|
|
26
|
+
[propertyName: string]: ObserverMapPathEntry | undefined;
|
|
27
|
+
}
|
|
28
|
+
/**
|
|
29
|
+
* Configuration object for the observerMap extension.
|
|
30
|
+
* `schema` enables non-declarative/manual schema use.
|
|
31
|
+
* When `properties` is omitted, every root property is observed. When
|
|
32
|
+
* `properties` is present, only listed root properties participate in
|
|
33
|
+
* observer-map observation.
|
|
34
|
+
* @public
|
|
35
|
+
*/
|
|
36
|
+
export interface ObserverMapConfig {
|
|
37
|
+
/**
|
|
38
|
+
* The schema to use for observer-map configuration.
|
|
39
|
+
* Pass this for non-declarative/manual schema use. When omitted, the
|
|
40
|
+
* extension uses the schema on the FAST element definition.
|
|
41
|
+
*/
|
|
42
|
+
schema?: Schema;
|
|
43
|
+
/**
|
|
44
|
+
* Per-root-property observation control.
|
|
45
|
+
* Keys are root property names discovered in the template schema.
|
|
46
|
+
* Only root properties listed here participate in observer-map observation.
|
|
47
|
+
* Omitting this field observes every discovered root property.
|
|
48
|
+
*/
|
|
49
|
+
properties?: {
|
|
50
|
+
[rootProperty: string]: ObserverMapPathEntry;
|
|
51
|
+
};
|
|
52
|
+
}
|
|
53
|
+
/**
|
|
54
|
+
* Creates a FAST element extension that enables schema-driven observer mapping
|
|
55
|
+
* for the resolved definition. When called without arguments, observes every
|
|
56
|
+
* discovered root property. The extension uses `config.schema`,
|
|
57
|
+
* `definition.schema`, or the schema generated by `declarativeTemplate()`.
|
|
58
|
+
* @public
|
|
59
|
+
*/
|
|
60
|
+
export declare function observerMap(config?: ObserverMapConfig): FASTElementExtension;
|
|
61
|
+
/**
|
|
62
|
+
* ObserverMap provides functionality for caching binding paths, extracting root properties,
|
|
63
|
+
* and defining observable properties on class prototypes
|
|
64
|
+
* @public
|
|
65
|
+
*/
|
|
66
|
+
export declare class ObserverMap {
|
|
67
|
+
private schema;
|
|
68
|
+
private classPrototype;
|
|
69
|
+
private config;
|
|
70
|
+
constructor(classPrototype: any, schema: Schema, config?: ObserverMapConfig);
|
|
71
|
+
defineProperties(): void;
|
|
72
|
+
/**
|
|
73
|
+
* Creates a proxy for an object that intercepts property mutations and triggers Observable notifications
|
|
74
|
+
* @param target - The target instance that owns the root property
|
|
75
|
+
* @param rootProperty - The name of the root property for notification purposes
|
|
76
|
+
* @param object - The object to wrap with a proxy
|
|
77
|
+
* @param schema - The schema for the element
|
|
78
|
+
* @returns A proxy that triggers notifications on property mutations
|
|
79
|
+
*/
|
|
80
|
+
private getAndAssignObservables;
|
|
81
|
+
/**
|
|
82
|
+
* Creates a property change handler function for observable properties
|
|
83
|
+
* This handler is called when an observable property transitions from undefined to a defined value
|
|
84
|
+
* @param propertyName - The name of the property for which to create the change handler
|
|
85
|
+
* @param existingChangedMethod - Optional existing changed method to call after the instance resolver logic
|
|
86
|
+
* @returns A function that handles property changes and sets up proxies for object values
|
|
87
|
+
*/
|
|
88
|
+
private defineChanged;
|
|
89
|
+
}
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
export declare const attributeDirectivePrefix: string;
|
|
2
|
+
export declare const clientSideCloseExpression: string;
|
|
3
|
+
export declare const clientSideOpenExpression: string;
|
|
4
|
+
export declare const closeExpression: string;
|
|
5
|
+
/**
|
|
6
|
+
* Event argument accessor for declarative event bindings.
|
|
7
|
+
* @public
|
|
8
|
+
*/
|
|
9
|
+
export declare const eventArgAccessor: string;
|
|
10
|
+
/**
|
|
11
|
+
* Execution context accessor for declarative event bindings.
|
|
12
|
+
* @public
|
|
13
|
+
*/
|
|
14
|
+
export declare const executionContextAccessor: string;
|
|
15
|
+
export declare const openExpression: string;
|
|
16
|
+
export declare const repeatDirectiveClose: string;
|
|
17
|
+
export declare const repeatDirectiveOpen: string;
|
|
18
|
+
export declare const unescapedCloseExpression: string;
|
|
19
|
+
export declare const unescapedOpenExpression: string;
|
|
20
|
+
export declare const whenDirectiveClose: string;
|
|
21
|
+
export declare const whenDirectiveOpen: string;
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
import type { FASTElementDefinition } from "../components/fast-definitions.js";
|
|
2
|
+
import type { ElementViewTemplate } from "../templating/template.js";
|
|
3
|
+
/**
|
|
4
|
+
* Publishes a concrete template for a definition.
|
|
5
|
+
* @internal
|
|
6
|
+
*/
|
|
7
|
+
export interface TemplatePublisher {
|
|
8
|
+
publishTemplate(definition: FASTElementDefinition): ElementViewTemplate | Promise<ElementViewTemplate>;
|
|
9
|
+
}
|
|
10
|
+
/**
|
|
11
|
+
* Coordinates declarative template publishers and FAST element definitions.
|
|
12
|
+
* Requests are keyed by registry + element name so scoped registries can
|
|
13
|
+
* resolve templates independently.
|
|
14
|
+
* @internal
|
|
15
|
+
*/
|
|
16
|
+
export declare class DeclarativeTemplateBridge {
|
|
17
|
+
private readonly buckets;
|
|
18
|
+
requestTemplate(definition: FASTElementDefinition): Promise<ElementViewTemplate>;
|
|
19
|
+
registerPublisher(registry: CustomElementRegistry, name: string | undefined, publisher: TemplatePublisher): void;
|
|
20
|
+
unregisterPublisher(registry: CustomElementRegistry, name: string | undefined, publisher: TemplatePublisher): void;
|
|
21
|
+
movePublisher(registry: CustomElementRegistry, previousName: string | undefined, nextName: string | undefined, publisher: TemplatePublisher): void;
|
|
22
|
+
private getBucket;
|
|
23
|
+
private processBucket;
|
|
24
|
+
private resetPublisherRequests;
|
|
25
|
+
private resolveRequest;
|
|
26
|
+
private rejectRequest;
|
|
27
|
+
private cleanupBucket;
|
|
28
|
+
}
|
|
29
|
+
/**
|
|
30
|
+
* Shared template bridge storage for the current FAST runtime.
|
|
31
|
+
* @internal
|
|
32
|
+
*/
|
|
33
|
+
export declare const declarativeTemplateBridge: DeclarativeTemplateBridge;
|
|
@@ -0,0 +1,98 @@
|
|
|
1
|
+
import type { Schema } from "../components/schema.js";
|
|
2
|
+
import { ViewTemplate } from "../templating/template.js";
|
|
3
|
+
/**
|
|
4
|
+
* The return type for {@link TemplateParser.parse}.
|
|
5
|
+
* @public
|
|
6
|
+
*/
|
|
7
|
+
export interface ResolvedStringsAndValues {
|
|
8
|
+
strings: Array<string>;
|
|
9
|
+
values: Array<any>;
|
|
10
|
+
}
|
|
11
|
+
/**
|
|
12
|
+
* Converts declarative HTML template markup into the `strings` and `values`
|
|
13
|
+
* arrays that `ViewTemplate.create()` consumes.
|
|
14
|
+
*
|
|
15
|
+
* This class is intentionally stateless across invocations — all mutable
|
|
16
|
+
* parsing state lives on the call stack or in the `TemplateResolutionContext`.
|
|
17
|
+
*
|
|
18
|
+
* The parsing pipeline is fully synchronous — no promises are allocated
|
|
19
|
+
* during template resolution.
|
|
20
|
+
* @public
|
|
21
|
+
*/
|
|
22
|
+
export declare class TemplateParser {
|
|
23
|
+
/**
|
|
24
|
+
* Parse declarative HTML into strings and values for ViewTemplate creation.
|
|
25
|
+
* @param innerHTML - The transformed innerHTML to parse.
|
|
26
|
+
* @param schema - The Schema instance for property tracking.
|
|
27
|
+
* @returns The resolved strings and values.
|
|
28
|
+
*/
|
|
29
|
+
parse(innerHTML: string, schema: Schema): ResolvedStringsAndValues;
|
|
30
|
+
/**
|
|
31
|
+
* Create a ViewTemplate from resolved strings and values.
|
|
32
|
+
* @param strings - The strings array.
|
|
33
|
+
* @param values - The interpreted values.
|
|
34
|
+
*/
|
|
35
|
+
createTemplate(strings: Array<string>, values: Array<any>): ViewTemplate<any, any>;
|
|
36
|
+
/**
|
|
37
|
+
* Resolve strings and values from an innerHTML string.
|
|
38
|
+
* @param rootPropertyName - The root property name for schema registration.
|
|
39
|
+
* @param innerHTML - The innerHTML.
|
|
40
|
+
* @param context - The template resolution context.
|
|
41
|
+
*/
|
|
42
|
+
private resolveStringsAndValues;
|
|
43
|
+
/**
|
|
44
|
+
* Resolve a template directive (when/repeat).
|
|
45
|
+
* @param rootPropertyName - The root property name for schema registration.
|
|
46
|
+
* @param behaviorConfig - The directive behavior configuration object.
|
|
47
|
+
* @param externalValues - The interpreted values from the parent.
|
|
48
|
+
* @param innerHTML - The innerHTML.
|
|
49
|
+
* @param context - The template resolution context.
|
|
50
|
+
*/
|
|
51
|
+
private resolveTemplateDirective;
|
|
52
|
+
/**
|
|
53
|
+
* Resolve an attribute directive (children/slotted/ref).
|
|
54
|
+
* @param name - The name of the directive.
|
|
55
|
+
* @param propName - The property name to pass to the directive.
|
|
56
|
+
* @param externalValues - The interpreted values from the parent.
|
|
57
|
+
*/
|
|
58
|
+
private resolveAttributeDirective;
|
|
59
|
+
/**
|
|
60
|
+
* Resolve an access binding — shared by content bindings, boolean-attribute
|
|
61
|
+
* fallback, and default attribute bindings.
|
|
62
|
+
* @returns An object with the resolved binding function and the updated rootPropertyName.
|
|
63
|
+
*/
|
|
64
|
+
private resolveAccessBinding;
|
|
65
|
+
/**
|
|
66
|
+
* Resolve an event binding (the "\@" aspect).
|
|
67
|
+
* @returns An object with the event binding function and the updated rootPropertyName.
|
|
68
|
+
*/
|
|
69
|
+
private resolveEventBinding;
|
|
70
|
+
/**
|
|
71
|
+
* Resolve a content data binding (`{{expression}}` in text content).
|
|
72
|
+
*/
|
|
73
|
+
private resolveContentBinding;
|
|
74
|
+
/**
|
|
75
|
+
* Resolve an attribute data binding (`{{expression}}` in an HTML attribute).
|
|
76
|
+
* Dispatches to event, expression, or access binding handlers based on aspect.
|
|
77
|
+
*/
|
|
78
|
+
private resolveAttributeBinding;
|
|
79
|
+
/**
|
|
80
|
+
* Resolve an attribute directive binding (`f-children`, `f-slotted`, `f-ref`).
|
|
81
|
+
*/
|
|
82
|
+
private resolveAttributeDirectiveBinding;
|
|
83
|
+
/**
|
|
84
|
+
* Dispatcher for data binding resolution. Routes to the appropriate handler
|
|
85
|
+
* based on the binding subtype.
|
|
86
|
+
*/
|
|
87
|
+
private resolveDataBinding;
|
|
88
|
+
/**
|
|
89
|
+
* Resolver of the innerHTML string. Finds the next binding or directive
|
|
90
|
+
* in the HTML and dispatches to the appropriate handler.
|
|
91
|
+
* @param rootPropertyName - The root property name for schema registration.
|
|
92
|
+
* @param innerHTML - The innerHTML to parse.
|
|
93
|
+
* @param strings - Accumulator for literal HTML segments and running previous-string.
|
|
94
|
+
* @param values - The values array (accumulates binding functions and directives).
|
|
95
|
+
* @param context - The template resolution context.
|
|
96
|
+
*/
|
|
97
|
+
private resolveInnerHTML;
|
|
98
|
+
}
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import type { FASTElementTemplateResolver } from "../components/fast-definitions.js";
|
|
2
|
+
import type { Constructable } from "../interfaces.js";
|
|
3
|
+
/**
|
|
4
|
+
* Returns a declarative template resolver that waits for the matching
|
|
5
|
+
* `<f-template>` element and resolves it into a concrete `ViewTemplate`.
|
|
6
|
+
*
|
|
7
|
+
* @public
|
|
8
|
+
*/
|
|
9
|
+
export declare function declarativeTemplate<TType extends Constructable<HTMLElement> = Constructable<HTMLElement>>(): FASTElementTemplateResolver<TType>;
|