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