@microsoft/fast-element 2.10.4 → 3.0.0-rc.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.
Files changed (211) hide show
  1. package/CHANGELOG.md +52 -2
  2. package/README.md +244 -1
  3. package/dist/arrays/arrays.api.json +2621 -0
  4. package/dist/context/context.api.json +13 -13
  5. package/dist/declarative/declarative.api.json +8483 -0
  6. package/dist/di/di.api.json +16 -16
  7. package/dist/dts/__test__/helpers.d.ts +6 -0
  8. package/dist/dts/array-observer.d.ts +2 -0
  9. package/dist/dts/arrays.d.ts +2 -0
  10. package/dist/dts/attr.d.ts +1 -0
  11. package/dist/dts/binding/binding.d.ts +15 -5
  12. package/dist/dts/binding/one-time.d.ts +1 -1
  13. package/dist/dts/binding/one-way.d.ts +1 -1
  14. package/dist/dts/binding/signal.d.ts +6 -6
  15. package/dist/dts/binding/two-way.d.ts +2 -1
  16. package/dist/dts/binding.d.ts +7 -0
  17. package/dist/dts/components/attributes.d.ts +1 -4
  18. package/dist/dts/components/definition-schema-transforms.d.ts +9 -0
  19. package/dist/dts/components/element-controller.d.ts +80 -114
  20. package/dist/dts/components/element-hydration.d.ts +1 -1
  21. package/dist/dts/components/enable-hydration.d.ts +54 -0
  22. package/dist/dts/components/fast-definitions.d.ts +98 -46
  23. package/dist/dts/components/fast-element.d.ts +43 -16
  24. package/dist/dts/components/hydration-tracker.d.ts +83 -0
  25. package/dist/dts/components/hydration.d.ts +23 -53
  26. package/dist/dts/components/schema.d.ts +205 -0
  27. package/dist/dts/context.d.ts +13 -13
  28. package/dist/dts/css.d.ts +3 -0
  29. package/dist/dts/debug.d.ts +5 -1
  30. package/dist/dts/declarative/attribute-map.d.ts +58 -0
  31. package/dist/dts/declarative/debug.d.ts +4 -0
  32. package/dist/dts/declarative/index.d.ts +14 -0
  33. package/dist/dts/declarative/interfaces.d.ts +8 -0
  34. package/dist/dts/declarative/observer-map-utilities.d.ts +58 -0
  35. package/dist/dts/declarative/observer-map.d.ts +89 -0
  36. package/dist/dts/declarative/runtime.d.ts +5 -0
  37. package/dist/dts/declarative/syntax.d.ts +21 -0
  38. package/dist/dts/declarative/template-bridge.d.ts +33 -0
  39. package/dist/dts/declarative/template-parser.d.ts +98 -0
  40. package/dist/dts/declarative/template.d.ts +10 -0
  41. package/dist/dts/declarative/utilities.d.ts +358 -0
  42. package/dist/dts/di/di.d.ts +7 -7
  43. package/dist/dts/directives/children.d.ts +2 -0
  44. package/dist/dts/directives/node-observation.d.ts +2 -0
  45. package/dist/dts/directives/ref.d.ts +2 -0
  46. package/dist/dts/directives/repeat.d.ts +4 -0
  47. package/dist/dts/directives/slotted.d.ts +2 -0
  48. package/dist/dts/directives/when.d.ts +3 -0
  49. package/dist/dts/dom-policy.d.ts +23 -5
  50. package/dist/dts/dom.d.ts +4 -16
  51. package/dist/dts/html.d.ts +5 -0
  52. package/dist/dts/hydration/diagnostics.d.ts +93 -0
  53. package/dist/dts/hydration/hydration-debugger.d.ts +35 -0
  54. package/dist/dts/hydration/messages.d.ts +62 -0
  55. package/dist/dts/hydration/runtime.d.ts +7 -0
  56. package/dist/dts/hydration/target-builder.d.ts +40 -12
  57. package/dist/dts/hydration.d.ts +18 -0
  58. package/dist/dts/index.d.ts +42 -42
  59. package/dist/dts/index.debug.d.ts +0 -1
  60. package/dist/dts/index.rollup.debug.d.ts +0 -1
  61. package/dist/dts/interfaces.d.ts +2 -49
  62. package/dist/dts/observable.d.ts +3 -6
  63. package/dist/dts/observation/arrays.d.ts +1 -1
  64. package/dist/dts/observation/observable.d.ts +3 -3
  65. package/dist/dts/observation/update-queue.d.ts +1 -1
  66. package/dist/dts/platform.d.ts +45 -8
  67. package/dist/dts/registry.d.ts +1 -0
  68. package/dist/dts/render.d.ts +7 -0
  69. package/dist/dts/schema.d.ts +1 -0
  70. package/dist/dts/state/exports.d.ts +1 -1
  71. package/dist/dts/state/state.d.ts +2 -2
  72. package/dist/dts/styles/css-directive.d.ts +5 -12
  73. package/dist/dts/styles/css.d.ts +5 -7
  74. package/dist/dts/styles/element-styles.d.ts +0 -10
  75. package/dist/dts/styles.d.ts +6 -0
  76. package/dist/dts/templating/compiler.d.ts +1 -1
  77. package/dist/dts/templating/html-binding-directive.d.ts +10 -2
  78. package/dist/dts/templating/html-directive.d.ts +19 -1
  79. package/dist/dts/templating/hydration-view.d.ts +130 -0
  80. package/dist/dts/templating/render.d.ts +1 -1
  81. package/dist/dts/templating/repeat.d.ts +1 -1
  82. package/dist/dts/templating/template.d.ts +15 -7
  83. package/dist/dts/templating/view.d.ts +25 -102
  84. package/dist/dts/templating.d.ts +10 -0
  85. package/dist/dts/testing/exports.d.ts +2 -2
  86. package/dist/dts/testing/fakes.d.ts +4 -4
  87. package/dist/dts/updates.d.ts +1 -0
  88. package/dist/dts/volatile.d.ts +2 -0
  89. package/dist/esm/__test__/helpers.js +22 -0
  90. package/dist/esm/__test__/setup-node.js +18 -0
  91. package/dist/esm/array-observer.js +1 -0
  92. package/dist/esm/arrays.js +1 -0
  93. package/dist/esm/attr.js +1 -0
  94. package/dist/esm/binding/normalize.js +1 -1
  95. package/dist/esm/binding/signal.js +4 -4
  96. package/dist/esm/binding/two-way.js +3 -3
  97. package/dist/esm/binding.js +4 -0
  98. package/dist/esm/components/attributes.js +18 -11
  99. package/dist/esm/components/definition-schema-transforms.js +23 -0
  100. package/dist/esm/components/element-controller.js +206 -270
  101. package/dist/esm/components/element-hydration.js +1 -1
  102. package/dist/esm/components/enable-hydration.js +124 -0
  103. package/dist/esm/components/fast-definitions.js +219 -56
  104. package/dist/esm/components/fast-element.js +18 -27
  105. package/dist/esm/components/hydration-tracker.js +122 -0
  106. package/dist/esm/components/hydration.js +137 -140
  107. package/dist/esm/components/schema.js +253 -0
  108. package/dist/esm/context.js +6 -6
  109. package/dist/esm/css.js +3 -0
  110. package/dist/esm/debug.js +27 -26
  111. package/dist/esm/declarative/attribute-map.js +122 -0
  112. package/dist/esm/declarative/debug.js +4 -0
  113. package/dist/esm/declarative/index.js +4 -0
  114. package/dist/esm/declarative/interfaces.js +9 -0
  115. package/dist/esm/declarative/observer-map-utilities.js +565 -0
  116. package/dist/esm/declarative/observer-map.js +216 -0
  117. package/dist/esm/declarative/runtime.js +14 -0
  118. package/dist/esm/declarative/syntax.js +36 -0
  119. package/dist/esm/declarative/template-bridge.js +160 -0
  120. package/dist/esm/declarative/template-parser.js +306 -0
  121. package/dist/esm/declarative/template.js +143 -0
  122. package/dist/esm/declarative/utilities.js +1069 -0
  123. package/dist/esm/di/di.js +8 -9
  124. package/dist/esm/directives/children.js +1 -0
  125. package/dist/esm/directives/node-observation.js +1 -0
  126. package/dist/esm/directives/ref.js +1 -0
  127. package/dist/esm/directives/repeat.js +1 -0
  128. package/dist/esm/directives/slotted.js +1 -0
  129. package/dist/esm/directives/when.js +1 -0
  130. package/dist/esm/dom-policy.js +35 -6
  131. package/dist/esm/dom.js +1 -1
  132. package/dist/esm/html.js +2 -0
  133. package/dist/esm/hydration/diagnostics.js +50 -0
  134. package/dist/esm/hydration/hydration-debugger.js +112 -0
  135. package/dist/esm/hydration/messages.js +84 -0
  136. package/dist/esm/hydration/runtime.js +33 -0
  137. package/dist/esm/hydration/target-builder.js +144 -91
  138. package/dist/esm/hydration.js +6 -0
  139. package/dist/esm/index.debug.js +2 -1
  140. package/dist/esm/index.js +38 -29
  141. package/dist/esm/index.rollup.debug.js +3 -2
  142. package/dist/esm/index.rollup.js +1 -1
  143. package/dist/esm/interfaces.js +2 -45
  144. package/dist/esm/metadata.js +2 -8
  145. package/dist/esm/observable.js +1 -4
  146. package/dist/esm/observation/arrays.js +1 -1
  147. package/dist/esm/observation/notifier.js +2 -4
  148. package/dist/esm/observation/observable.js +5 -5
  149. package/dist/esm/observation/update-queue.js +47 -58
  150. package/dist/esm/platform.js +31 -30
  151. package/dist/esm/registry.js +1 -0
  152. package/dist/esm/render.js +1 -0
  153. package/dist/esm/schema.js +1 -0
  154. package/dist/esm/state/exports.js +1 -1
  155. package/dist/esm/styles/css-directive.js +1 -2
  156. package/dist/esm/styles/css.js +15 -56
  157. package/dist/esm/styles/element-styles.js +69 -15
  158. package/dist/esm/styles.js +2 -0
  159. package/dist/esm/templating/html-binding-directive.js +11 -9
  160. package/dist/esm/templating/hydration-view.js +228 -0
  161. package/dist/esm/templating/render.js +39 -18
  162. package/dist/esm/templating/repeat.js +69 -33
  163. package/dist/esm/templating/template.js +7 -7
  164. package/dist/esm/templating/view.js +25 -234
  165. package/dist/esm/templating.js +7 -0
  166. package/dist/esm/testing/exports.js +2 -2
  167. package/dist/esm/testing/fixture.js +2 -2
  168. package/dist/esm/testing/timeout.js +2 -2
  169. package/dist/esm/updates.js +1 -0
  170. package/dist/esm/volatile.js +1 -0
  171. package/dist/fast-element.api.json +14389 -11138
  172. package/dist/fast-element.d.ts +3651 -809
  173. package/dist/fast-element.debug.js +5666 -4722
  174. package/dist/fast-element.debug.min.js +2 -2
  175. package/dist/fast-element.js +5394 -4381
  176. package/dist/fast-element.min.js +2 -2
  177. package/dist/fast-element.untrimmed.d.ts +923 -472
  178. package/dist/hydration/hydration.api.json +6460 -0
  179. package/dist/styles/styles.api.json +2672 -0
  180. package/package.json +165 -45
  181. package/ARCHITECTURE_FASTELEMENT.md +0 -63
  182. package/ARCHITECTURE_HTML_TAGGED_TEMPLATE_LITERAL.md +0 -36
  183. package/ARCHITECTURE_INTRO.md +0 -10
  184. package/ARCHITECTURE_OVERVIEW.md +0 -52
  185. package/ARCHITECTURE_UPDATES.md +0 -11
  186. package/CHANGELOG.json +0 -2275
  187. package/DESIGN.md +0 -510
  188. package/api-extractor.context.json +0 -14
  189. package/api-extractor.di.json +0 -14
  190. package/biome.json +0 -4
  191. package/dist/dts/components/install-hydration.d.ts +0 -1
  192. package/dist/dts/pending-task.d.ts +0 -32
  193. package/dist/dts/styles/css-binding-directive.d.ts +0 -60
  194. package/dist/dts/templating/install-hydratable-view-templates.d.ts +0 -1
  195. package/dist/esm/components/install-hydration.js +0 -3
  196. package/dist/esm/pending-task.js +0 -28
  197. package/dist/esm/polyfills.js +0 -60
  198. package/dist/esm/styles/css-binding-directive.js +0 -76
  199. package/dist/esm/templating/install-hydratable-view-templates.js +0 -23
  200. package/docs/ACKNOWLEDGEMENTS.md +0 -12
  201. package/docs/api-report.api.md +0 -1122
  202. package/docs/context/api-report.api.md +0 -69
  203. package/docs/di/api-report.api.md +0 -315
  204. package/docs/fast-element-2-changes.md +0 -15
  205. package/playwright.config.ts +0 -26
  206. package/scripts/run-api-extractor.js +0 -51
  207. package/test/index.html +0 -11
  208. package/test/main.ts +0 -104
  209. package/test/vite.config.ts +0 -19
  210. package/tsconfig.api-extractor.json +0 -6
  211. /package/dist/dts/{polyfills.d.ts → __test__/setup-node.d.ts} +0 -0
@@ -0,0 +1,205 @@
1
+ type FastContextMetaData = "$fast_context";
2
+ type FastContextsMetaData = "$fast_parent_contexts";
3
+ /**
4
+ * Describes a child custom element binding referenced by a schema path.
5
+ * @public
6
+ */
7
+ export interface ChildrenMap {
8
+ customElementName: string;
9
+ attributeName: string;
10
+ }
11
+ /**
12
+ * A reusable JSON schema definition.
13
+ * @public
14
+ */
15
+ export interface JSONSchemaDefinition extends JSONSchemaCommon {
16
+ $fast_context: string;
17
+ $fast_parent_contexts: Array<string>;
18
+ }
19
+ /**
20
+ * Common properties shared by schema nodes.
21
+ * @public
22
+ */
23
+ export interface JSONSchemaCommon {
24
+ type?: string;
25
+ properties?: any;
26
+ items?: any;
27
+ anyOf?: Array<any>;
28
+ $ref?: string;
29
+ /**
30
+ * Stamped by `applyConfigToSchema` when an `ObserverMapConfig` excludes
31
+ * this path. When `false`, the proxy system skips observation for this
32
+ * node and (if all descendants are also `false`) its subtree.
33
+ */
34
+ $observe?: boolean;
35
+ }
36
+ /**
37
+ * A JSON schema describing a root property.
38
+ * @public
39
+ */
40
+ export interface JSONSchema extends JSONSchemaCommon {
41
+ $schema: string;
42
+ $id: string;
43
+ $defs?: Record<string, JSONSchemaDefinition>;
44
+ }
45
+ /**
46
+ * Common metadata for paths cached while parsing a template.
47
+ * @public
48
+ */
49
+ export interface CachedPathCommon {
50
+ parentContext: string | null;
51
+ currentContext: string | null;
52
+ path: string;
53
+ }
54
+ /**
55
+ * A path discovered from an access expression.
56
+ * @public
57
+ */
58
+ export interface AccessCachedPath extends CachedPathCommon {
59
+ type: "access";
60
+ }
61
+ /**
62
+ * A path discovered from a default binding.
63
+ * @public
64
+ */
65
+ export interface DefaultCachedPath extends CachedPathCommon {
66
+ type: "default";
67
+ }
68
+ /**
69
+ * A path discovered from an event binding.
70
+ * @public
71
+ */
72
+ export interface EventCachedPath extends CachedPathCommon {
73
+ type: "event";
74
+ }
75
+ /**
76
+ * A path discovered from a repeat directive.
77
+ * @public
78
+ */
79
+ export interface RepeatCachedPath extends CachedPathCommon {
80
+ type: "repeat";
81
+ }
82
+ /**
83
+ * A path discovered while parsing a template.
84
+ * @public
85
+ */
86
+ export type CachedPath = DefaultCachedPath | RepeatCachedPath | AccessCachedPath | EventCachedPath;
87
+ /**
88
+ * A map from element names and root properties to JSON schemas.
89
+ * @public
90
+ */
91
+ export type CachedPathMap = Map<string, Map<string, JSONSchema>>;
92
+ /**
93
+ * Configuration for registering a path with a schema.
94
+ * @public
95
+ */
96
+ export interface RegisterPathConfig {
97
+ rootPropertyName: string;
98
+ pathConfig: CachedPath;
99
+ childrenMap: ChildrenMap | null;
100
+ }
101
+ export declare const fastContextMetaData: FastContextMetaData;
102
+ export declare const fastContextsMetaData: FastContextsMetaData;
103
+ export declare const defsPropertyName = "$defs";
104
+ export declare const refPropertyName = "$ref";
105
+ /**
106
+ * Module-level registry that maps custom element names to their schema maps.
107
+ * Used for cross-element `$ref` resolution (e.g. nested element schemas).
108
+ * Each Schema instance registers itself here on construction.
109
+ * @public
110
+ */
111
+ export declare const schemaRegistry: CachedPathMap;
112
+ /**
113
+ * A constructed JSON schema from a template
114
+ * @public
115
+ */
116
+ export declare class Schema {
117
+ /**
118
+ * The name of the custom element
119
+ */
120
+ private customElementName;
121
+ /**
122
+ * Instance-level JSON schema map describing each root property
123
+ */
124
+ private schemaMap;
125
+ constructor(name: string);
126
+ /**
127
+ * Add a path to a schema
128
+ * @param config - The path registration configuration.
129
+ */
130
+ addPath(config: RegisterPathConfig): void;
131
+ /**
132
+ * Gets the JSON schema for a property name
133
+ * @param rootPropertyName - the root property the JSON schema is mapped to
134
+ * @returns The JSON schema for the root property
135
+ */
136
+ getSchema(rootPropertyName: string): JSONSchema | null;
137
+ /**
138
+ * Gets root properties
139
+ * @returns IterableIterator<string>
140
+ */
141
+ getRootProperties(): IterableIterator<string>;
142
+ /**
143
+ * Get a path split into property names
144
+ * @param path - The dot syntax path, e.g. `a.b.c`.
145
+ * @returns An array of items in the path
146
+ */
147
+ private getSplitPath;
148
+ /**
149
+ * Gets the path to the $def
150
+ * @param context - The context name. For example, `item in items` creates the `item` context.
151
+ * @returns A string to use as a $ref
152
+ */
153
+ private getDefsPath;
154
+ /**
155
+ * Get the schema $id
156
+ * @param customElementName - The custom element name
157
+ * @param propertyName - The property name
158
+ * @returns The ID that can be used in the JSON schema as $id
159
+ */
160
+ private getSchemaId;
161
+ /**
162
+ * Add a new JSON schema to the JSON schema map
163
+ * @param propertyName - The name of the property to assign this JSON schema to.
164
+ */
165
+ private addNewSchema;
166
+ /**
167
+ * Add properties to a context
168
+ * @param schema - The schema to add the properties to.
169
+ * @param splitPath - The path split into property/context names.
170
+ * @param context - The path context.
171
+ */
172
+ private addPropertiesToAContext;
173
+ /**
174
+ * Add properties to an object
175
+ * @param schema - The schema to add the properties to.
176
+ * @param splitPath - The path split into property/context names.
177
+ * @param context - The path context.
178
+ * @param type - The data type (see JSON schema for details).
179
+ */
180
+ private addPropertiesToAnObject;
181
+ /**
182
+ * Add an array to an object property
183
+ * @param schema - The schema to add the properties to.
184
+ * @param context - The name of the context.
185
+ */
186
+ private addArrayToAnObject;
187
+ /**
188
+ * Add a context to the $defs property
189
+ * @param schema - The schema to use.
190
+ * @param propertyName - The name of the property the context belongs to.
191
+ * @param currentContext - The current context.
192
+ * @param parentContext - The parent context.
193
+ * @returns
194
+ */
195
+ private addContext;
196
+ /**
197
+ * Get parent contexts
198
+ * @param schema - The schema to use.
199
+ * @param parentContext - The parent context.
200
+ * @param contexts - A list of parent contexts.
201
+ * @returns
202
+ */
203
+ private getParentContexts;
204
+ }
205
+ export {};
@@ -56,7 +56,7 @@ export declare const Context: Readonly<{
56
56
  * @param name - The name to use for the connext. Useful in debugging.
57
57
  * @param initialValue - An optional initial value to use if a context handler isn't found.
58
58
  */
59
- create<T_1 = unknown>(name: string, initialValue?: T_1 | undefined): FASTContext<T_1>;
59
+ create<T = unknown>(name: string, initialValue?: T): FASTContext<T>;
60
60
  /**
61
61
  * Sets the strategy used by all FAST-specific context requests made through the
62
62
  * Context.request, Context.get, Context.defineProperty, and ContextDecorator APIs.
@@ -73,7 +73,7 @@ export declare const Context: Readonly<{
73
73
  * Uses the default request strategy to locate the context. If no context is found
74
74
  * then the initial value of the context is returned.
75
75
  */
76
- get<T_2 extends UnknownContext>(target: EventTarget, context: T_2): ContextType<T_2>;
76
+ get<T extends UnknownContext>(target: EventTarget, context: T): ContextType<T>;
77
77
  /**
78
78
  * Requests the context value for the target node.
79
79
  * @param target - The target to request the context for.
@@ -84,7 +84,7 @@ export declare const Context: Readonly<{
84
84
  * @remarks
85
85
  * Uses the default request strategy to locate the context.
86
86
  */
87
- request<T_3 extends UnknownContext>(target: EventTarget, context: T_3, callback: ContextCallback<ContextType<T_3>>, multiple?: boolean): void;
87
+ request<T extends UnknownContext>(target: EventTarget, context: T, callback: ContextCallback<ContextType<T>>, multiple?: boolean): void;
88
88
  /**
89
89
  *
90
90
  * @param target - The target to dispatch the context event on.
@@ -96,14 +96,14 @@ export declare const Context: Readonly<{
96
96
  * This API does NOT use the default request strategy. It always dispatches
97
97
  * an event through the DOM.
98
98
  */
99
- dispatch<T_4 extends UnknownContext>(target: EventTarget, context: T_4, callback: ContextCallback<ContextType<T_4>>, multiple?: boolean): void;
99
+ dispatch<T extends UnknownContext>(target: EventTarget, context: T, callback: ContextCallback<ContextType<T>>, multiple?: boolean): void;
100
100
  /**
101
101
  * Enables an event target to provide a context value.
102
- * @param target The target to provide the context value for.
103
- * @param context The context to provide the value for.
104
- * @param value The value to provide for the context.
102
+ * @param target - The target to provide the context value for.
103
+ * @param context - The context to provide the value for.
104
+ * @param value - The value to provide for the context.
105
105
  */
106
- provide<T_5 extends UnknownContext>(target: EventTarget, context: T_5, value: ContextType<T_5>): void;
106
+ provide<T extends UnknownContext>(target: EventTarget, context: T, value: ContextType<T>): void;
107
107
  /**
108
108
  *
109
109
  * @param target - The target on which to handle context requests.
@@ -113,18 +113,18 @@ export declare const Context: Readonly<{
113
113
  * If a context is not provided then the callback will be invoked for all context
114
114
  * requests that are received on the target.
115
115
  */
116
- handle<T_6 extends UnknownContext>(target: EventTarget, callback: (event: ContextEvent<T_6>) => void, context?: T_6 | undefined): void;
116
+ handle<T extends UnknownContext>(target: EventTarget, callback: (event: ContextEvent<T>) => void, context?: T): void;
117
117
  /**
118
118
  * Defines a getter-only property on the target that will return the context
119
119
  * value for the target.
120
- * @param target The target to define the property on.
121
- * @param propertyName The name of the property to define.
122
- * @param context The context that will be used to retrieve the property value.
120
+ * @param target - The target to define the property on.
121
+ * @param propertyName - The name of the property to define.
122
+ * @param context - The context that will be used to retrieve the property value.
123
123
  * @remarks
124
124
  * Uses the default request strategy to locate the context and will return the
125
125
  * initialValue if the context isn't handled.
126
126
  */
127
- defineProperty<T_7 extends UnknownContext>(target: Constructable<EventTarget> | EventTarget, propertyName: string, context: T_7): void;
127
+ defineProperty<T extends UnknownContext>(target: Constructable<EventTarget> | EventTarget, propertyName: string, context: T): void;
128
128
  }>;
129
129
  /**
130
130
  * An unknown context type.
@@ -0,0 +1,3 @@
1
+ export { type CSSTemplateTag, type CSSValue, css } from "./styles/css.js";
2
+ export { CSSDirective, type CSSDirectiveDefinition, cssDirective, } from "./styles/css-directive.js";
3
+ export { type ComposableStyles, ElementStyles, } from "./styles/element-styles.js";
@@ -1 +1,5 @@
1
- export {};
1
+ /**
2
+ * Enables human-readable FAST debug messages.
3
+ * @public
4
+ */
5
+ export declare function enableDebug(): void;
@@ -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,4 @@
1
+ export declare const debugMessages: {
2
+ [2000]: string;
3
+ [2001]: string;
4
+ };
@@ -0,0 +1,14 @@
1
+ export type { AttributeConfiguration, AttributeDefinition, AttributeMode, ValueConverter, } from "../components/attributes.js";
2
+ export type { FASTElementDefinition, FASTElementExtension, FASTElementTemplateResolver, PartialFASTElementDefinition, ShadowRootOptions, TemplateLifecycleCallbacks, } from "../components/fast-definitions.js";
3
+ export { type AccessCachedPath, type CachedPath, type CachedPathCommon, type CachedPathMap, type ChildrenMap, type DefaultCachedPath, type EventCachedPath, type JSONSchema, type JSONSchemaCommon, type JSONSchemaDefinition, type RegisterPathConfig, type RepeatCachedPath, Schema, schemaRegistry, } from "../components/schema.js";
4
+ export type { DOMAspect, 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, 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, ElementViewTemplate, HTMLTemplateCompilationResult, SyntheticViewTemplate, 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,8 @@
1
+ /**
2
+ * Warning and error messages.
3
+ * @internal
4
+ */
5
+ export declare const enum Message {
6
+ noTemplateProvided = 2000,
7
+ moreThanOneTemplateProvided = 2001
8
+ }
@@ -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,5 @@
1
+ /**
2
+ * Installs the declarative runtime debug messages.
3
+ * @internal
4
+ */
5
+ export declare function ensureDeclarativeRuntime(): void;
@@ -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;