@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,358 @@
|
|
|
1
|
+
import { type JSONSchema, type Schema } from "../components/schema.js";
|
|
2
|
+
import { attributeDirectivePrefix, clientSideCloseExpression, clientSideOpenExpression, closeExpression, eventArgAccessor, executionContextAccessor, openExpression } from "./syntax.js";
|
|
3
|
+
export { assignObservables, assignProxy, deepEqual, deepMerge, findDef, isPlainObject, } from "./observer-map-utilities.js";
|
|
4
|
+
/**
|
|
5
|
+
* Declarative behavior type.
|
|
6
|
+
* @public
|
|
7
|
+
*/
|
|
8
|
+
export type BehaviorType = "dataBinding" | "templateDirective";
|
|
9
|
+
/**
|
|
10
|
+
* Declarative attribute directive names.
|
|
11
|
+
* @public
|
|
12
|
+
*/
|
|
13
|
+
export type AttributeDirective = "children" | "slotted" | "ref";
|
|
14
|
+
/**
|
|
15
|
+
* Declarative data binding marker type.
|
|
16
|
+
* @public
|
|
17
|
+
*/
|
|
18
|
+
export type DataBindingBindingType = "client" | "default" | "unescaped";
|
|
19
|
+
/**
|
|
20
|
+
* Base behavior configuration.
|
|
21
|
+
* @public
|
|
22
|
+
*/
|
|
23
|
+
export interface BehaviorConfig {
|
|
24
|
+
type: BehaviorType;
|
|
25
|
+
}
|
|
26
|
+
/**
|
|
27
|
+
* Declarative schema path type.
|
|
28
|
+
* @public
|
|
29
|
+
*/
|
|
30
|
+
export type PathType = "access" | "default" | "event" | "repeat";
|
|
31
|
+
/**
|
|
32
|
+
* Content binding behavior configuration.
|
|
33
|
+
* @public
|
|
34
|
+
*/
|
|
35
|
+
export interface ContentDataBindingBehaviorConfig extends BaseDataBindingBehaviorConfig {
|
|
36
|
+
subtype: "content";
|
|
37
|
+
}
|
|
38
|
+
/**
|
|
39
|
+
* Attribute binding behavior configuration.
|
|
40
|
+
* @public
|
|
41
|
+
*/
|
|
42
|
+
export interface AttributeDataBindingBehaviorConfig extends BaseDataBindingBehaviorConfig {
|
|
43
|
+
subtype: "attribute";
|
|
44
|
+
aspect: "@" | ":" | "?" | null;
|
|
45
|
+
}
|
|
46
|
+
/**
|
|
47
|
+
* Attribute directive binding behavior configuration.
|
|
48
|
+
* @public
|
|
49
|
+
*/
|
|
50
|
+
export interface AttributeDirectiveBindingBehaviorConfig extends BaseDataBindingBehaviorConfig {
|
|
51
|
+
subtype: "attributeDirective";
|
|
52
|
+
name: AttributeDirective;
|
|
53
|
+
}
|
|
54
|
+
/**
|
|
55
|
+
* Declarative data binding behavior configuration.
|
|
56
|
+
* @public
|
|
57
|
+
*/
|
|
58
|
+
export type DataBindingBehaviorConfig = ContentDataBindingBehaviorConfig | AttributeDataBindingBehaviorConfig | AttributeDirectiveBindingBehaviorConfig;
|
|
59
|
+
/**
|
|
60
|
+
* Base data binding behavior configuration.
|
|
61
|
+
* @public
|
|
62
|
+
*/
|
|
63
|
+
export interface BaseDataBindingBehaviorConfig extends BehaviorConfig {
|
|
64
|
+
type: "dataBinding";
|
|
65
|
+
bindingType: DataBindingBindingType;
|
|
66
|
+
openingStartIndex: number;
|
|
67
|
+
openingEndIndex: number;
|
|
68
|
+
closingStartIndex: number;
|
|
69
|
+
closingEndIndex: number;
|
|
70
|
+
}
|
|
71
|
+
/**
|
|
72
|
+
* Declarative template directive names.
|
|
73
|
+
* @public
|
|
74
|
+
*/
|
|
75
|
+
export type TemplateDirective = "when" | "repeat";
|
|
76
|
+
/**
|
|
77
|
+
* Template directive behavior configuration.
|
|
78
|
+
* @public
|
|
79
|
+
*/
|
|
80
|
+
export interface TemplateDirectiveBehaviorConfig extends BehaviorConfig {
|
|
81
|
+
type: "templateDirective";
|
|
82
|
+
name: TemplateDirective;
|
|
83
|
+
value: string;
|
|
84
|
+
openingTagStartIndex: number;
|
|
85
|
+
openingTagEndIndex: number;
|
|
86
|
+
closingTagStartIndex: number;
|
|
87
|
+
closingTagEndIndex: number;
|
|
88
|
+
}
|
|
89
|
+
/**
|
|
90
|
+
* Map between child component attribute references and custom element names.
|
|
91
|
+
* @public
|
|
92
|
+
*/
|
|
93
|
+
export interface ChildrenMap {
|
|
94
|
+
customElementName: string;
|
|
95
|
+
attributeName: string;
|
|
96
|
+
}
|
|
97
|
+
/**
|
|
98
|
+
* Prefix used for execution context paths.
|
|
99
|
+
* @public
|
|
100
|
+
*/
|
|
101
|
+
export declare const contextPrefixDot: string;
|
|
102
|
+
export { attributeDirectivePrefix, clientSideCloseExpression, clientSideOpenExpression, closeExpression, eventArgAccessor, executionContextAccessor, openExpression, };
|
|
103
|
+
/**
|
|
104
|
+
* The type of a parsed event handler argument.
|
|
105
|
+
* @public
|
|
106
|
+
*/
|
|
107
|
+
export type EventArgType = "event" | "context" | "binding";
|
|
108
|
+
/**
|
|
109
|
+
* A parsed event handler argument descriptor.
|
|
110
|
+
* @public
|
|
111
|
+
*/
|
|
112
|
+
export interface ParsedEventArg {
|
|
113
|
+
type: EventArgType;
|
|
114
|
+
/** The raw argument string, present only when `type` is `"binding"`. */
|
|
115
|
+
rawArg?: string;
|
|
116
|
+
}
|
|
117
|
+
/**
|
|
118
|
+
* Parses the arguments string of an event handler binding into an array of
|
|
119
|
+
* typed argument descriptors. Unrecognised tokens are returned as `"binding"`
|
|
120
|
+
* type with their raw string preserved.
|
|
121
|
+
*
|
|
122
|
+
* Special arguments:
|
|
123
|
+
* - `$e` — resolves to the DOM event object
|
|
124
|
+
* - `$c` — resolves to the full execution context object
|
|
125
|
+
*
|
|
126
|
+
* Any other token is treated as a binding path and resolved against the current
|
|
127
|
+
* data source.
|
|
128
|
+
*
|
|
129
|
+
* @param argsString - The raw arguments string from between the parentheses,
|
|
130
|
+
* e.g. `""`, `"$e"`, `"$c"`, or `"$e, $c"`.
|
|
131
|
+
* @returns An array of {@link ParsedEventArg} descriptors.
|
|
132
|
+
* @public
|
|
133
|
+
*/
|
|
134
|
+
export declare function parseEventArgs(argsString: string): ParsedEventArg[];
|
|
135
|
+
/**
|
|
136
|
+
* Logical operator tokens.
|
|
137
|
+
* @public
|
|
138
|
+
*/
|
|
139
|
+
export declare const LogicalOperator: {
|
|
140
|
+
readonly AND: "&&";
|
|
141
|
+
readonly OR: "||";
|
|
142
|
+
};
|
|
143
|
+
/**
|
|
144
|
+
* Logical operator token.
|
|
145
|
+
* @public
|
|
146
|
+
*/
|
|
147
|
+
export type LogicalOperator = (typeof LogicalOperator)[keyof typeof LogicalOperator];
|
|
148
|
+
/**
|
|
149
|
+
* Comparison operator tokens.
|
|
150
|
+
* @public
|
|
151
|
+
*/
|
|
152
|
+
export declare const ComparisonOperator: {
|
|
153
|
+
readonly ACCESS: "access";
|
|
154
|
+
readonly EQUALS: "==";
|
|
155
|
+
readonly GREATER_THAN: ">";
|
|
156
|
+
readonly GREATER_THAN_OR_EQUALS: ">=";
|
|
157
|
+
readonly LESS_THAN: "<";
|
|
158
|
+
readonly LESS_THAN_OR_EQUALS: "<=";
|
|
159
|
+
readonly NOT: "!";
|
|
160
|
+
readonly NOT_EQUALS: "!=";
|
|
161
|
+
};
|
|
162
|
+
/**
|
|
163
|
+
* Comparison operator token.
|
|
164
|
+
* @public
|
|
165
|
+
*/
|
|
166
|
+
export type ComparisonOperator = (typeof ComparisonOperator)[keyof typeof ComparisonOperator];
|
|
167
|
+
/**
|
|
168
|
+
* Declarative expression operator tokens.
|
|
169
|
+
* @public
|
|
170
|
+
*/
|
|
171
|
+
export declare const Operator: {
|
|
172
|
+
readonly AND: "&&";
|
|
173
|
+
readonly OR: "||";
|
|
174
|
+
readonly ACCESS: "access";
|
|
175
|
+
readonly EQUALS: "==";
|
|
176
|
+
readonly GREATER_THAN: ">";
|
|
177
|
+
readonly GREATER_THAN_OR_EQUALS: ">=";
|
|
178
|
+
readonly LESS_THAN: "<";
|
|
179
|
+
readonly LESS_THAN_OR_EQUALS: "<=";
|
|
180
|
+
readonly NOT: "!";
|
|
181
|
+
readonly NOT_EQUALS: "!=";
|
|
182
|
+
};
|
|
183
|
+
/**
|
|
184
|
+
* Declarative expression operator token.
|
|
185
|
+
* @public
|
|
186
|
+
*/
|
|
187
|
+
export type Operator = (typeof Operator)[keyof typeof Operator];
|
|
188
|
+
/**
|
|
189
|
+
* Get the index of the next matching tag
|
|
190
|
+
* @param openingTagStartSlice - The slice starting from the opening tag
|
|
191
|
+
* @param openingTag - The opening tag string
|
|
192
|
+
* @param closingTag - The closing tag
|
|
193
|
+
* @param openingTagStartIndex - The opening tag start index derived from the innerHTML
|
|
194
|
+
* @returns index
|
|
195
|
+
* @public
|
|
196
|
+
*/
|
|
197
|
+
export declare function getIndexOfNextMatchingTag(openingTagStartSlice: string, openingTag: string, closingTag: string, openingTagStartIndex: number): number;
|
|
198
|
+
/**
|
|
199
|
+
* Get the next behavior
|
|
200
|
+
* @param innerHTML - The innerHTML string to evaluate
|
|
201
|
+
* @param offset - The current offset in the original string.
|
|
202
|
+
* @returns DataBindingBehaviorConfig | DirectiveBehaviorConfig | null - A configuration object or null
|
|
203
|
+
* @public
|
|
204
|
+
*/
|
|
205
|
+
export declare function getNextBehavior(innerHTML: string, offset?: number): DataBindingBehaviorConfig | TemplateDirectiveBehaviorConfig | null;
|
|
206
|
+
/**
|
|
207
|
+
* Create a function to resolve a value from an object using a path with dot syntax.
|
|
208
|
+
* e.g. "foo.bar"
|
|
209
|
+
* @param path - The dot syntax path to an objects property.
|
|
210
|
+
* @param contextPath - The current repeat context path.
|
|
211
|
+
* @param level - The current repeat nesting level.
|
|
212
|
+
* @param rootSchema - The root schema for resolving context paths.
|
|
213
|
+
* @returns A function to access the value from a given path.
|
|
214
|
+
* @public
|
|
215
|
+
*/
|
|
216
|
+
export declare function pathResolver(path: string, contextPath: string | null, level: number, rootSchema: JSONSchema): (accessibleObject: any, context: any) => any;
|
|
217
|
+
/**
|
|
218
|
+
* Creates a binding resolver and records the binding path in the schema.
|
|
219
|
+
* @param previousString - The previous literal string before the binding.
|
|
220
|
+
* @param rootPropertyName - The current root property name.
|
|
221
|
+
* @param path - The binding path to resolve.
|
|
222
|
+
* @param parentContext - The parent repeat context.
|
|
223
|
+
* @param type - The schema path type.
|
|
224
|
+
* @param schema - The schema to record paths in.
|
|
225
|
+
* @param currentContext - The current repeat context.
|
|
226
|
+
* @param level - The current repeat nesting level.
|
|
227
|
+
* @returns A function that resolves the binding path.
|
|
228
|
+
* @public
|
|
229
|
+
*/
|
|
230
|
+
export declare function bindingResolver(previousString: string | null, rootPropertyName: string | null, path: string, parentContext: string | null, type: PathType, schema: Schema, currentContext: string | null, level: number): (accessibleObject: any, context: any) => any;
|
|
231
|
+
/**
|
|
232
|
+
* Creates a resolver for a chained expression and records its paths in the schema.
|
|
233
|
+
* @param rootPropertyName - The current root property name.
|
|
234
|
+
* @param expression - The expression to resolve.
|
|
235
|
+
* @param parentContext - The parent repeat context.
|
|
236
|
+
* @param level - The current repeat nesting level.
|
|
237
|
+
* @param schema - The schema to record paths in.
|
|
238
|
+
* @returns A function that resolves the expression.
|
|
239
|
+
* @public
|
|
240
|
+
*/
|
|
241
|
+
export declare function expressionResolver(rootPropertyName: string | null, expression: ChainedExpression, parentContext: string | null, level: number, schema: Schema): (accessibleObject: any, context: any) => any;
|
|
242
|
+
/**
|
|
243
|
+
* Extracts all paths from a ChainedExpression, including nested expressions
|
|
244
|
+
* @param chainedExpression - The chained expression to extract paths from
|
|
245
|
+
* @returns A Set containing all unique paths found in the expression chain
|
|
246
|
+
* @public
|
|
247
|
+
*/
|
|
248
|
+
export declare function extractPathsFromChainedExpression(chainedExpression: ChainedExpression): Set<string>;
|
|
249
|
+
/**
|
|
250
|
+
* Declarative expression descriptor.
|
|
251
|
+
* @public
|
|
252
|
+
*/
|
|
253
|
+
export interface DeclarativeExpression {
|
|
254
|
+
operator: Operator;
|
|
255
|
+
left: string;
|
|
256
|
+
leftIsValue: boolean | null;
|
|
257
|
+
right: string | boolean | number | null;
|
|
258
|
+
rightIsValue: boolean | null;
|
|
259
|
+
}
|
|
260
|
+
/**
|
|
261
|
+
* Declarative chained expression descriptor.
|
|
262
|
+
* @public
|
|
263
|
+
*/
|
|
264
|
+
export interface ChainedExpression {
|
|
265
|
+
operator?: LogicalOperator;
|
|
266
|
+
expression: DeclarativeExpression;
|
|
267
|
+
next?: ChainedExpression;
|
|
268
|
+
}
|
|
269
|
+
/**
|
|
270
|
+
* Gets the expression chain as a configuration object
|
|
271
|
+
* @param value - The binding string value
|
|
272
|
+
* @returns - A configuration object containing information about the expression
|
|
273
|
+
* @public
|
|
274
|
+
*/
|
|
275
|
+
export declare function getExpressionChain(value: string): ChainedExpression | void;
|
|
276
|
+
/**
|
|
277
|
+
* This is the transform utility for rationalizing declarative HTML syntax
|
|
278
|
+
* with bindings in the ViewTemplate
|
|
279
|
+
* @param innerHTML - The innerHTML to transform.
|
|
280
|
+
* @param index - The index to start the current slice of HTML to evaluate.
|
|
281
|
+
* @public
|
|
282
|
+
*/
|
|
283
|
+
export declare function transformInnerHTML(innerHTML: string, index?: number): string;
|
|
284
|
+
/**
|
|
285
|
+
* Tag name of the HTML element whose contents are auto-escaped to render
|
|
286
|
+
* code samples literally. Inside this element FAST binding delimiters
|
|
287
|
+
* (`{{...}}`, `{{{...}}}`, `{...}`) are neutralised by replacing each
|
|
288
|
+
* `{` / `}` with the HTML numeric character reference `{` /
|
|
289
|
+
* `}` so the literal text is rendered instead of a binding.
|
|
290
|
+
*
|
|
291
|
+
* The escape behaviour is split between the server-side renderer
|
|
292
|
+
* (`escape_code_sample_elements` in `microsoft-fast-build`) and the
|
|
293
|
+
* client-side `<f-template>` parser (`escapeBracesInCodeElements`
|
|
294
|
+
* below):
|
|
295
|
+
*
|
|
296
|
+
* - Curly-brace escape runs in **both** server and client because
|
|
297
|
+
* `{` / `}` are decoded to literal `{` / `}` in the DOM
|
|
298
|
+
* and the `.innerHTML` serializer does not re-encode them — so the
|
|
299
|
+
* server-side escape would otherwise be undone on the client.
|
|
300
|
+
* - Angle brackets of FAST directive tags (`<f-when>`, `</f-when>`,
|
|
301
|
+
* `<f-repeat>`, `</f-repeat>`, case-insensitive) inside this element
|
|
302
|
+
* are escaped on the **server only**. The DOM serializer
|
|
303
|
+
* re-encodes `<` / `>` in text content automatically, so the client
|
|
304
|
+
* never sees raw directive tags inside `<code>` regardless of what
|
|
305
|
+
* the page source contained.
|
|
306
|
+
* - Real HTML elements (`<button>`) and custom elements (`<my-widget>`)
|
|
307
|
+
* inside this element keep their angle brackets and continue to
|
|
308
|
+
* render as live DOM elements; only the brace-binding syntax inside
|
|
309
|
+
* their text and attribute values is neutralised.
|
|
310
|
+
* @public
|
|
311
|
+
*/
|
|
312
|
+
export declare const codeElementName = "code";
|
|
313
|
+
/**
|
|
314
|
+
* Preprocess an HTML string by escaping FAST brace characters inside every
|
|
315
|
+
* `<code>` element. Mirrors part of the brace/angle-bracket escaping
|
|
316
|
+
* behaviour of Microsoft WebUI's `webui-press` markdown renderer so that
|
|
317
|
+
* example template snippets inside `<code>` render literally instead of
|
|
318
|
+
* being interpreted as bindings.
|
|
319
|
+
*
|
|
320
|
+
* Nested `<code>` elements are handled via depth tracking. The pass is
|
|
321
|
+
* idempotent because `{` / `}` inside an already-processed `<code>` have
|
|
322
|
+
* been replaced with entities, so a second pass finds nothing to escape.
|
|
323
|
+
*
|
|
324
|
+
* This is the client-side half of a two-stage escape — see the JSDoc on
|
|
325
|
+
* {@link codeElementName} for why only braces are handled here and
|
|
326
|
+
* `<` / `>` are exclusively handled on the server.
|
|
327
|
+
* @public
|
|
328
|
+
*/
|
|
329
|
+
export declare function escapeBracesInCodeElements(innerHTML: string): string;
|
|
330
|
+
/**
|
|
331
|
+
* Resolves boolean logic
|
|
332
|
+
* used for f-when and boolean attributes
|
|
333
|
+
* @param rootPropertyName - The current root property name.
|
|
334
|
+
* @param expression - The chained expression to resolve.
|
|
335
|
+
* @param parentContext - The parent repeat context.
|
|
336
|
+
* @param level - The current repeat nesting level.
|
|
337
|
+
* @param schema - The schema to record paths in.
|
|
338
|
+
* @returns - A binding that resolves the chained expression logic
|
|
339
|
+
* @public
|
|
340
|
+
*/
|
|
341
|
+
export declare function getBooleanBinding(rootPropertyName: string | null, expression: ChainedExpression, parentContext: string | null, level: number, schema: Schema): (x: boolean, c: any) => any;
|
|
342
|
+
/**
|
|
343
|
+
* Get the root property name
|
|
344
|
+
* @param rootPropertyName - The root property
|
|
345
|
+
* @param path - The dot syntax path
|
|
346
|
+
* @param context - The context created by a repeat
|
|
347
|
+
* @param type - The type of path binding
|
|
348
|
+
* @returns
|
|
349
|
+
* @public
|
|
350
|
+
*/
|
|
351
|
+
export declare function getRootPropertyName(rootPropertyName: string | null, path: string, context: null | string, type: PathType): string | null;
|
|
352
|
+
/**
|
|
353
|
+
* Get details of bindings to the attributes of child custom elements
|
|
354
|
+
* @param previousString - The previous string before the binding
|
|
355
|
+
* @returns null, or a custom element name and attribute name
|
|
356
|
+
* @public
|
|
357
|
+
*/
|
|
358
|
+
export declare function getChildrenMap(previousString: string | null): ChildrenMap | null;
|
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
import type { ComponentSchema, SchemaDiff } from "./types.js";
|
|
2
|
+
/**
|
|
3
|
+
* Retrieves the schema for a custom element by its tag name.
|
|
4
|
+
* @param name - The custom element tag name.
|
|
5
|
+
* @param registry - The custom element registry (defaults to global customElements).
|
|
6
|
+
* @returns The component schema if found, undefined otherwise.
|
|
7
|
+
* @public
|
|
8
|
+
*/
|
|
9
|
+
export declare function getSchema(name: string, registry?: CustomElementRegistry): ComponentSchema | undefined;
|
|
10
|
+
/**
|
|
11
|
+
* Retrieves the schema for a custom element by its tag name, throwing if not found.
|
|
12
|
+
* @param name - The custom element tag name.
|
|
13
|
+
* @param registry - The custom element registry (defaults to global customElements).
|
|
14
|
+
* @returns The component schema.
|
|
15
|
+
* @throws TypeError if no schema is found for the element.
|
|
16
|
+
* @public
|
|
17
|
+
*/
|
|
18
|
+
export declare function getSchemaOrThrow(name: string, registry?: CustomElementRegistry): ComponentSchema;
|
|
19
|
+
/**
|
|
20
|
+
* Retrieves the schema for a FASTElement class directly.
|
|
21
|
+
* @param cls - The FASTElement class constructor.
|
|
22
|
+
* @returns The component schema.
|
|
23
|
+
* @throws TypeError if the class is not a registered FASTElement.
|
|
24
|
+
* @public
|
|
25
|
+
*/
|
|
26
|
+
export declare function getComponentSchema(cls: Function): ComponentSchema;
|
|
27
|
+
/**
|
|
28
|
+
* Retrieves all registered component schemas for a given registry.
|
|
29
|
+
* @param registry - The custom element registry (defaults to global customElements).
|
|
30
|
+
* @returns A Map of tag names to component schemas.
|
|
31
|
+
* @public
|
|
32
|
+
*/
|
|
33
|
+
export declare function getAllSchemas(registry?: CustomElementRegistry): Map<string, ComponentSchema>;
|
|
34
|
+
/**
|
|
35
|
+
* Compares two component schemas and returns the differences.
|
|
36
|
+
* Used to detect breaking changes between versions.
|
|
37
|
+
* @param a - The original schema (before).
|
|
38
|
+
* @param b - The new schema (after).
|
|
39
|
+
* @returns A SchemaDiff object describing the changes.
|
|
40
|
+
* @public
|
|
41
|
+
*/
|
|
42
|
+
export declare function diffSchemas(a: ComponentSchema, b: ComponentSchema): SchemaDiff;
|
|
@@ -0,0 +1,78 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Custom Elements Manifest 2.1.0 root structure.
|
|
3
|
+
* @public
|
|
4
|
+
*/
|
|
5
|
+
export interface CustomElementsManifest {
|
|
6
|
+
schemaVersion: "2.1.0";
|
|
7
|
+
modules: ManifestModule[];
|
|
8
|
+
}
|
|
9
|
+
/**
|
|
10
|
+
* A JavaScript module containing custom element declarations.
|
|
11
|
+
* @public
|
|
12
|
+
*/
|
|
13
|
+
export interface ManifestModule {
|
|
14
|
+
kind: "javascript-module";
|
|
15
|
+
path: string;
|
|
16
|
+
declarations: ManifestDeclaration[];
|
|
17
|
+
}
|
|
18
|
+
/**
|
|
19
|
+
* A custom element class declaration.
|
|
20
|
+
* @public
|
|
21
|
+
*/
|
|
22
|
+
export interface ManifestDeclaration {
|
|
23
|
+
kind: "class";
|
|
24
|
+
customElement: true;
|
|
25
|
+
name: string;
|
|
26
|
+
tagName: string;
|
|
27
|
+
description?: string;
|
|
28
|
+
members: Array<{
|
|
29
|
+
kind: "field";
|
|
30
|
+
name: string;
|
|
31
|
+
type: {
|
|
32
|
+
text: string;
|
|
33
|
+
};
|
|
34
|
+
}>;
|
|
35
|
+
events: Array<{
|
|
36
|
+
name: string;
|
|
37
|
+
type: {
|
|
38
|
+
text: string;
|
|
39
|
+
};
|
|
40
|
+
}>;
|
|
41
|
+
slots: Array<{
|
|
42
|
+
name: string;
|
|
43
|
+
description?: string;
|
|
44
|
+
}>;
|
|
45
|
+
cssProperties: Array<{
|
|
46
|
+
name: string;
|
|
47
|
+
default?: string;
|
|
48
|
+
}>;
|
|
49
|
+
}
|
|
50
|
+
/**
|
|
51
|
+
* Converts a kebab-case string to PascalCase.
|
|
52
|
+
* @param str - The kebab-case string to convert.
|
|
53
|
+
* @returns The PascalCase version of the string.
|
|
54
|
+
* @example
|
|
55
|
+
* toPascalCase('my-button') // 'MyButton'
|
|
56
|
+
* toPascalCase('my-cool-element') // 'MyCoolElement'
|
|
57
|
+
* @public
|
|
58
|
+
*/
|
|
59
|
+
export declare function toPascalCase(str: string): string;
|
|
60
|
+
/**
|
|
61
|
+
* Generates a Custom Elements Manifest (CEM 2.1.0) from registered schemas.
|
|
62
|
+
*
|
|
63
|
+
* @param registry - The custom element registry to export from (defaults to global customElements).
|
|
64
|
+
* @returns A Custom Elements Manifest object conforming to CEM 2.1.0 schema.
|
|
65
|
+
*
|
|
66
|
+
* @remarks
|
|
67
|
+
* The manifest groups each component into its own module with a synthesized path
|
|
68
|
+
* based on the tag name (e.g., `my-button.js`). This is suitable for documentation
|
|
69
|
+
* and tooling purposes but may not reflect actual file paths.
|
|
70
|
+
*
|
|
71
|
+
* @example
|
|
72
|
+
* ```typescript
|
|
73
|
+
* const manifest = toCustomElementsManifest();
|
|
74
|
+
* console.log(JSON.stringify(manifest, null, 2));
|
|
75
|
+
* ```
|
|
76
|
+
* @public
|
|
77
|
+
*/
|
|
78
|
+
export declare function toCustomElementsManifest(registry?: CustomElementRegistry): CustomElementsManifest;
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import { type FASTElementExtension } from "../components/fast-definitions.js";
|
|
2
|
+
/**
|
|
3
|
+
* Extracts and stores the Agent Definition Schema for a FAST element.
|
|
4
|
+
* @internal
|
|
5
|
+
*/
|
|
6
|
+
export declare const definitionSchemaExtension: FASTElementExtension;
|
|
7
|
+
/**
|
|
8
|
+
* Enables automatic Definition Schema extraction for subsequently defined FAST elements.
|
|
9
|
+
* Call this before element definitions are registered.
|
|
10
|
+
* @returns A callback that disables automatic extraction.
|
|
11
|
+
* @public
|
|
12
|
+
*/
|
|
13
|
+
export declare function enableDefinitionSchema(): () => void;
|
|
14
|
+
/**
|
|
15
|
+
* Disables automatic Definition Schema extraction.
|
|
16
|
+
* @public
|
|
17
|
+
*/
|
|
18
|
+
export declare function disableDefinitionSchema(): void;
|
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
import type { FASTElementDefinition } from "../components/fast-definitions.js";
|
|
2
|
+
import type { ElementStyles } from "../styles/element-styles.js";
|
|
3
|
+
import type { ElementViewTemplate } from "../templating/template.js";
|
|
4
|
+
import type { CommandSchema, ComponentSchema, CSSPropertySchema, PropertySchema, SlotSchema } from "./types.js";
|
|
5
|
+
/**
|
|
6
|
+
* Extracts property schemas from a FASTElementDefinition's attributes.
|
|
7
|
+
* @param definition - The FASTElementDefinition to extract properties from.
|
|
8
|
+
* @returns An array of PropertySchema objects.
|
|
9
|
+
*/
|
|
10
|
+
export declare function extractProperties(definition: FASTElementDefinition): PropertySchema[];
|
|
11
|
+
/**
|
|
12
|
+
* Extracts slot schemas from a template.
|
|
13
|
+
* Returns empty array in SSR environments where document is undefined.
|
|
14
|
+
* @param template - The ElementViewTemplate to extract slots from.
|
|
15
|
+
* @returns An array of SlotSchema objects.
|
|
16
|
+
*/
|
|
17
|
+
export declare function extractSlots(template: ElementViewTemplate | undefined): SlotSchema[];
|
|
18
|
+
/**
|
|
19
|
+
* Extracts CSS custom property schemas from styles.
|
|
20
|
+
* Uses naive regex extraction (v1); will upgrade to CSSTree in v2.
|
|
21
|
+
* @param styles - The ElementStyles to extract CSS properties from.
|
|
22
|
+
* @returns An array of CSSPropertySchema objects.
|
|
23
|
+
*/
|
|
24
|
+
export declare function extractCSSProperties(styles: ElementStyles | undefined): CSSPropertySchema[];
|
|
25
|
+
/**
|
|
26
|
+
* Extracts command schemas from a component class via `command` metadata.
|
|
27
|
+
* @param type - The class constructor to extract commands from.
|
|
28
|
+
* @returns An array of CommandSchema objects.
|
|
29
|
+
*/
|
|
30
|
+
export declare function extractCommands(type: Function): CommandSchema[];
|
|
31
|
+
/**
|
|
32
|
+
* Builds a complete ComponentSchema from a FASTElementDefinition.
|
|
33
|
+
* Combines property, slot, CSS property, and command extraction.
|
|
34
|
+
* @param definition - The FASTElementDefinition to build a schema from.
|
|
35
|
+
* @param type - The class constructor for the component.
|
|
36
|
+
* @returns A complete ComponentSchema object.
|
|
37
|
+
*/
|
|
38
|
+
export declare function buildSchema(definition: FASTElementDefinition, type: Function): ComponentSchema;
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Public API for the Definition Schema system.
|
|
3
|
+
* Enables AI agents to query component capabilities via JSON introspection.
|
|
4
|
+
*/
|
|
5
|
+
export type { PropertyType, ComponentSchema, PropertySchema, AriaHint, EventSchema, SlotSchema, CSSPropertySchema, CommandSchema, SchemaDiff, JSONSchema, } from "./types.js";
|
|
6
|
+
export type { CustomElementsManifest, ManifestDeclaration, ManifestModule, } from "./cem.js";
|
|
7
|
+
export { getSchema, getSchemaOrThrow, getComponentSchema, getAllSchemas, diffSchemas, } from "./api.js";
|
|
8
|
+
export { toCustomElementsManifest, toPascalCase } from "./cem.js";
|
|
9
|
+
export { disableDefinitionSchema, enableDefinitionSchema } from "./extension.js";
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
import type { ComponentSchema } from "./types.js";
|
|
2
|
+
/**
|
|
3
|
+
* Stores a component schema associated with its class constructor.
|
|
4
|
+
* @param cls - The class constructor for the component.
|
|
5
|
+
* @param schema - The component schema to store.
|
|
6
|
+
*/
|
|
7
|
+
export declare function storeSchema(cls: Function, schema: ComponentSchema): void;
|
|
8
|
+
/**
|
|
9
|
+
* Retrieves a component schema by its class constructor.
|
|
10
|
+
* @param cls - The class constructor to look up.
|
|
11
|
+
* @returns The component schema if found, undefined otherwise.
|
|
12
|
+
*/
|
|
13
|
+
export declare function getSchemaByClass(cls: Function): ComponentSchema | undefined;
|
|
14
|
+
/**
|
|
15
|
+
* Registers a tag name to class mapping within a registry.
|
|
16
|
+
* @param name - The custom element tag name.
|
|
17
|
+
* @param cls - The class constructor for the component.
|
|
18
|
+
* @param registry - The custom element registry (defaults to global customElements).
|
|
19
|
+
*/
|
|
20
|
+
export declare function registerTag(name: string, cls: Function, registry?: CustomElementRegistry): void;
|
|
21
|
+
/**
|
|
22
|
+
* Retrieves a class constructor by its tag name within a registry.
|
|
23
|
+
* @param name - The custom element tag name to look up.
|
|
24
|
+
* @param registry - The custom element registry (defaults to global customElements).
|
|
25
|
+
* @returns The class constructor if found, undefined otherwise.
|
|
26
|
+
*/
|
|
27
|
+
export declare function getClassByTag(name: string, registry?: CustomElementRegistry): Function | undefined;
|
|
28
|
+
/**
|
|
29
|
+
* Gets the tag map for a specific registry.
|
|
30
|
+
* Used internally by getAllSchemas to iterate over registered tags.
|
|
31
|
+
* @param registry - The custom element registry.
|
|
32
|
+
* @returns The Map of tag names to classes, or undefined if no tags registered.
|
|
33
|
+
* @internal
|
|
34
|
+
*/
|
|
35
|
+
export declare function getRegistryTagMap(registry?: CustomElementRegistry): Map<string, Function> | undefined;
|