@microsoft/fast-element 1.10.5 → 2.0.0-beta.10

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 (122) hide show
  1. package/.eslintrc.json +1 -12
  2. package/CHANGELOG.json +629 -6
  3. package/CHANGELOG.md +152 -5
  4. package/dist/dts/components/attributes.d.ts +14 -1
  5. package/dist/dts/components/{controller.d.ts → element-controller.d.ts} +32 -32
  6. package/dist/dts/components/fast-definitions.d.ts +51 -11
  7. package/dist/dts/components/fast-element.d.ts +18 -23
  8. package/dist/dts/context.d.ts +157 -0
  9. package/dist/{esm/observation/behavior.js → dts/debug.d.ts} +0 -0
  10. package/dist/dts/di/di.d.ts +899 -0
  11. package/dist/dts/index.d.ts +17 -16
  12. package/dist/dts/index.debug.d.ts +2 -0
  13. package/dist/dts/index.rollup.d.ts +2 -0
  14. package/dist/dts/index.rollup.debug.d.ts +3 -0
  15. package/dist/dts/interfaces.d.ts +176 -0
  16. package/dist/dts/metadata.d.ts +25 -0
  17. package/dist/dts/observation/arrays.d.ts +207 -0
  18. package/dist/dts/observation/notifier.d.ts +18 -18
  19. package/dist/dts/observation/observable.d.ts +117 -34
  20. package/dist/dts/observation/update-queue.d.ts +40 -0
  21. package/dist/dts/pending-task.d.ts +20 -0
  22. package/dist/dts/platform.d.ts +23 -66
  23. package/dist/dts/polyfills.d.ts +8 -0
  24. package/dist/dts/state/exports.d.ts +3 -0
  25. package/dist/dts/state/reactive.d.ts +8 -0
  26. package/dist/dts/state/state.d.ts +141 -0
  27. package/dist/dts/state/visitor.d.ts +6 -0
  28. package/dist/dts/state/watch.d.ts +10 -0
  29. package/dist/dts/styles/css-directive.d.ts +44 -6
  30. package/dist/dts/styles/css.d.ts +19 -3
  31. package/dist/dts/styles/element-styles.d.ts +49 -63
  32. package/dist/dts/styles/host.d.ts +68 -0
  33. package/dist/dts/templating/binding-signal.d.ts +21 -0
  34. package/dist/dts/templating/binding-two-way.d.ts +39 -0
  35. package/dist/dts/templating/binding.d.ts +101 -70
  36. package/dist/dts/templating/children.d.ts +18 -15
  37. package/dist/dts/templating/compiler.d.ts +46 -28
  38. package/dist/dts/templating/dom.d.ts +41 -0
  39. package/dist/dts/templating/html-directive.d.ts +239 -45
  40. package/dist/dts/templating/markup.d.ts +48 -0
  41. package/dist/dts/templating/node-observation.d.ts +45 -30
  42. package/dist/dts/templating/ref.d.ts +6 -20
  43. package/dist/dts/templating/render.d.ts +272 -0
  44. package/dist/dts/templating/repeat.d.ts +36 -33
  45. package/dist/dts/templating/slotted.d.ts +13 -14
  46. package/dist/dts/templating/template.d.ts +28 -22
  47. package/dist/dts/templating/view.d.ts +82 -24
  48. package/dist/dts/templating/when.d.ts +3 -3
  49. package/dist/dts/testing/exports.d.ts +3 -0
  50. package/dist/dts/testing/fakes.d.ts +4 -0
  51. package/dist/dts/testing/fixture.d.ts +84 -0
  52. package/dist/dts/testing/timeout.d.ts +7 -0
  53. package/dist/{tsdoc-metadata.json → dts/tsdoc-metadata.json} +1 -1
  54. package/dist/dts/utilities.d.ts +22 -0
  55. package/dist/esm/components/attributes.js +38 -28
  56. package/dist/esm/components/{controller.js → element-controller.js} +150 -140
  57. package/dist/esm/components/fast-definitions.js +48 -46
  58. package/dist/esm/components/fast-element.js +31 -12
  59. package/dist/esm/context.js +163 -0
  60. package/dist/esm/debug.js +61 -0
  61. package/dist/esm/di/di.js +1435 -0
  62. package/dist/esm/index.debug.js +2 -0
  63. package/dist/esm/index.js +20 -14
  64. package/dist/esm/index.rollup.debug.js +3 -0
  65. package/dist/esm/index.rollup.js +2 -0
  66. package/dist/esm/interfaces.js +12 -1
  67. package/dist/esm/metadata.js +60 -0
  68. package/dist/esm/observation/arrays.js +570 -0
  69. package/dist/esm/observation/notifier.js +27 -35
  70. package/dist/esm/observation/observable.js +116 -149
  71. package/dist/esm/observation/update-queue.js +67 -0
  72. package/dist/esm/pending-task.js +16 -0
  73. package/dist/esm/platform.js +60 -42
  74. package/dist/esm/polyfills.js +85 -0
  75. package/dist/esm/state/exports.js +3 -0
  76. package/dist/esm/state/reactive.js +34 -0
  77. package/dist/esm/state/state.js +148 -0
  78. package/dist/esm/state/visitor.js +28 -0
  79. package/dist/esm/state/watch.js +36 -0
  80. package/dist/esm/styles/css-directive.js +29 -13
  81. package/dist/esm/styles/css.js +29 -42
  82. package/dist/esm/styles/element-styles.js +79 -104
  83. package/dist/esm/styles/host.js +1 -0
  84. package/dist/esm/templating/binding-signal.js +83 -0
  85. package/dist/esm/templating/binding-two-way.js +103 -0
  86. package/dist/esm/templating/binding.js +189 -159
  87. package/dist/esm/templating/children.js +33 -23
  88. package/dist/esm/templating/compiler.js +258 -152
  89. package/dist/esm/templating/dom.js +49 -0
  90. package/dist/esm/templating/html-directive.js +193 -36
  91. package/dist/esm/templating/markup.js +75 -0
  92. package/dist/esm/templating/node-observation.js +51 -45
  93. package/dist/esm/templating/ref.js +8 -25
  94. package/dist/esm/templating/render.js +391 -0
  95. package/dist/esm/templating/repeat.js +83 -79
  96. package/dist/esm/templating/slotted.js +23 -20
  97. package/dist/esm/templating/template.js +51 -93
  98. package/dist/esm/templating/view.js +125 -46
  99. package/dist/esm/templating/when.js +6 -4
  100. package/dist/esm/testing/exports.js +3 -0
  101. package/dist/esm/testing/fakes.js +76 -0
  102. package/dist/esm/testing/fixture.js +86 -0
  103. package/dist/esm/testing/timeout.js +24 -0
  104. package/dist/esm/utilities.js +44 -0
  105. package/dist/fast-element.api.json +12153 -5373
  106. package/dist/fast-element.d.ts +1448 -696
  107. package/dist/fast-element.debug.js +4107 -0
  108. package/dist/fast-element.debug.min.js +1 -0
  109. package/dist/fast-element.js +3817 -4029
  110. package/dist/fast-element.min.js +1 -1
  111. package/dist/fast-element.untrimmed.d.ts +2814 -0
  112. package/docs/api-report.md +567 -254
  113. package/docs/fast-element-2-changes.md +15 -0
  114. package/karma.conf.cjs +6 -17
  115. package/package.json +76 -15
  116. package/dist/dts/dom.d.ts +0 -112
  117. package/dist/dts/observation/array-change-records.d.ts +0 -48
  118. package/dist/dts/observation/array-observer.d.ts +0 -9
  119. package/dist/dts/observation/behavior.d.ts +0 -19
  120. package/dist/esm/dom.js +0 -207
  121. package/dist/esm/observation/array-change-records.js +0 -326
  122. package/dist/esm/observation/array-observer.js +0 -177
@@ -1,10 +1,3 @@
1
- /**
2
- * A reference to globalThis, with support
3
- * for browsers that don't yet support the spec.
4
- * @public
5
- */
6
- export declare const $global: Global;
7
-
8
1
  /**
9
2
  * Represents a getter/setter property accessor on an object.
10
3
  * @public
@@ -28,43 +21,134 @@ export declare interface Accessor {
28
21
  }
29
22
 
30
23
  /**
31
- * A directive that attaches special behavior to an element via a custom attribute.
24
+ * Used to add behaviors when constructing styles.
25
+ * @public
26
+ */
27
+ export declare type AddBehavior = (behavior: HostBehavior<HTMLElement>) => void;
28
+
29
+ /**
30
+ * Used to add behavior factories when constructing templates.
31
+ * @public
32
+ */
33
+ export declare type AddViewBehaviorFactory = (factory: ViewBehaviorFactory) => string;
34
+
35
+ /* Excluded from this release type: AdoptedStyleSheetsStrategy */
36
+
37
+ /**
38
+ * An observer for arrays.
32
39
  * @public
33
40
  */
34
- export declare class AttachedBehaviorHTMLDirective<T = any> extends HTMLDirective {
35
- private name;
36
- private behavior;
37
- private options;
41
+ export declare interface ArrayObserver extends SubscriberSet {
38
42
  /**
39
- *
40
- * @param name - The name of the behavior; used as a custom attribute on the element.
41
- * @param behavior - The behavior to instantiate and attach to the element.
42
- * @param options - Options to pass to the behavior during creation.
43
+ * The strategy to use for tracking changes.
43
44
  */
44
- constructor(name: string, behavior: AttachedBehaviorType<T>, options: T);
45
+ strategy: SpliceStrategy | null;
45
46
  /**
46
- * Creates a placeholder string based on the directive's index within the template.
47
- * @param index - The index of the directive within the template.
47
+ * The length observer for the array.
48
+ */
49
+ readonly lengthObserver: LengthObserver;
50
+ /**
51
+ * Adds a splice to the list of changes.
52
+ * @param splice - The splice to add.
53
+ */
54
+ addSplice(splice: Splice): void;
55
+ /**
56
+ * Indicates that a reset change has occurred.
57
+ * @param oldCollection - The collection as it was before the reset.
58
+ */
59
+ reset(oldCollection: any[] | undefined): void;
60
+ /**
61
+ * Flushes the changes to subscribers.
62
+ */
63
+ flush(): void;
64
+ }
65
+
66
+ /**
67
+ * An observer for arrays.
68
+ * @public
69
+ */
70
+ export declare const ArrayObserver: Readonly<{
71
+ /**
72
+ * Enables the array observation mechanism.
48
73
  * @remarks
49
- * Creates a custom attribute placeholder.
74
+ * Array observation is enabled automatically when using the
75
+ * {@link RepeatDirective}, so calling this API manually is
76
+ * not typically necessary.
50
77
  */
51
- createPlaceholder(index: number): string;
78
+ readonly enable: () => void;
79
+ }>;
80
+
81
+ /**
82
+ * The type of HTML aspect to target.
83
+ * @public
84
+ */
85
+ export declare const Aspect: Readonly<{
52
86
  /**
53
- * Creates a behavior for the provided target node.
54
- * @param target - The node instance to create the behavior for.
87
+ * Not aspected.
88
+ */
89
+ readonly none: 0;
90
+ /**
91
+ * An attribute.
92
+ */
93
+ readonly attribute: 1;
94
+ /**
95
+ * A boolean attribute.
96
+ */
97
+ readonly booleanAttribute: 2;
98
+ /**
99
+ * A property.
100
+ */
101
+ readonly property: 3;
102
+ /**
103
+ * Content
104
+ */
105
+ readonly content: 4;
106
+ /**
107
+ * A token list.
108
+ */
109
+ readonly tokenList: 5;
110
+ /**
111
+ * An event.
112
+ */
113
+ readonly event: 6;
114
+ /**
115
+ *
116
+ * @param directive - The directive to assign the aspect to.
117
+ * @param value - The value to base the aspect determination on.
55
118
  * @remarks
56
- * Creates an instance of the `behavior` type this directive was constructed with
57
- * and passes the target and options to that `behavior`'s constructor.
119
+ * If a falsy value is provided, then the content aspect will be assigned.
58
120
  */
59
- createBehavior(target: Node): Behavior;
60
- }
121
+ readonly assign: (directive: Aspected, value?: string) => void;
122
+ }>;
61
123
 
62
124
  /**
63
- * Describes the shape of a behavior constructor that can be created by
64
- * an {@link AttachedBehaviorHTMLDirective}.
125
+ * The type of HTML aspect to target.
65
126
  * @public
66
127
  */
67
- export declare type AttachedBehaviorType<T = any> = new (target: any, options: T) => Behavior;
128
+ export declare type Aspect = typeof Aspect[Exclude<keyof typeof Aspect, "assign" | "none">];
129
+
130
+ /**
131
+ * Represents something that applies to a specific aspect of the DOM.
132
+ * @public
133
+ */
134
+ export declare interface Aspected {
135
+ /**
136
+ * The original source aspect exactly as represented in markup.
137
+ */
138
+ sourceAspect: string;
139
+ /**
140
+ * The evaluated target aspect, determined after processing the source.
141
+ */
142
+ targetAspect: string;
143
+ /**
144
+ * The type of aspect to target.
145
+ */
146
+ aspectType: Aspect;
147
+ /**
148
+ * A binding if one is associated with the aspect.
149
+ */
150
+ dataBinding?: Binding;
151
+ }
68
152
 
69
153
  /**
70
154
  * Decorator: Specifies an HTML attribute.
@@ -92,6 +176,17 @@ export declare type AttributeConfiguration = {
92
176
  converter?: ValueConverter;
93
177
  };
94
178
 
179
+ /**
180
+ * Metadata used to configure a custom attribute's behavior.
181
+ * @public
182
+ */
183
+ export declare const AttributeConfiguration: Readonly<{
184
+ /**
185
+ * Locates all attribute configurations associated with a type.
186
+ */
187
+ locate: (target: {}) => AttributeConfiguration[];
188
+ }>;
189
+
95
190
  /**
96
191
  * An implementation of {@link Accessor} that supports reactivity,
97
192
  * change callbacks, attribute reflection, and type conversion for
@@ -145,16 +240,9 @@ export declare class AttributeDefinition implements Accessor {
145
240
  * @param source - The source element to access.
146
241
  */
147
242
  getValue(source: HTMLElement): any;
148
- /** @internal */
149
- onAttributeChangedCallback(element: HTMLElement, value: any): void;
243
+ /* Excluded from this release type: onAttributeChangedCallback */
150
244
  private tryReflectToAttribute;
151
- /**
152
- * Collects all attribute definitions associated with the owner.
153
- * @param Owner - The class constructor to collect attribute for.
154
- * @param attributeLists - Any existing attributes to collect and merge with those associated with the owner.
155
- * @internal
156
- */
157
- static collect(Owner: Function, ...attributeLists: (ReadonlyArray<string | AttributeConfiguration> | undefined)[]): ReadonlyArray<AttributeDefinition>;
245
+ /* Excluded from this release type: collect */
158
246
  }
159
247
 
160
248
  /**
@@ -168,109 +256,41 @@ export declare class AttributeDefinition implements Accessor {
168
256
  * changes in the DOM, but does not reflect property changes back.
169
257
  * @public
170
258
  */
171
- export declare type AttributeMode = "reflect" | "boolean" | "fromView";
259
+ export declare type AttributeMode = typeof reflectMode | typeof booleanMode | "fromView";
172
260
 
173
261
  /**
174
- * Represents and object that can contribute behavior to a view or
175
- * element's bind/unbind operations.
262
+ * Creates an standard binding.
263
+ * @param binding - The binding to refresh when changed.
264
+ * @param isVolatile - Indicates whether the binding is volatile or not.
265
+ * @returns A binding configuration.
176
266
  * @public
177
267
  */
178
- export declare interface Behavior {
179
- /**
180
- * Bind this behavior to the source.
181
- * @param source - The source to bind to.
182
- * @param context - The execution context that the binding is operating within.
183
- */
184
- bind(source: unknown, context: ExecutionContext): void;
185
- /**
186
- * Unbinds this behavior from the source.
187
- * @param source - The source to unbind from.
188
- */
189
- unbind(source: unknown): void;
190
- }
191
-
192
- /**
193
- * The signature of an arrow function capable of being evaluated
194
- * as part of a template binding update.
195
- * @public
196
- */
197
- export declare type Binding<TSource = any, TReturn = any, TParent = any> = (source: TSource, context: ExecutionContext<TParent>) => TReturn;
198
-
199
- /**
200
- * A behavior that updates content and attributes based on a configured
201
- * BindingDirective.
202
- * @public
203
- */
204
- export declare class BindingBehavior implements Behavior {
205
- /** @internal */
206
- source: unknown;
207
- /** @internal */
208
- context: ExecutionContext | null;
209
- /** @internal */
210
- bindingObserver: BindingObserver | null;
211
- /** @internal */
212
- classVersions: Record<string, number>;
213
- /** @internal */
214
- version: number;
215
- /** @internal */
216
- target: any;
217
- /** @internal */
218
- binding: Binding;
219
- /** @internal */
220
- isBindingVolatile: boolean;
221
- /** @internal */
222
- updateTarget: typeof updatePropertyTarget;
223
- /** @internal */
224
- targetName?: string;
225
- /**
226
- * Bind this behavior to the source.
227
- * @param source - The source to bind to.
228
- * @param context - The execution context that the binding is operating within.
229
- */
230
- bind: typeof normalBind;
231
- /**
232
- * Unbinds this behavior from the source.
233
- * @param source - The source to unbind from.
234
- */
235
- unbind: typeof normalUnbind;
236
- /**
237
- * Creates an instance of BindingBehavior.
238
- * @param target - The target of the data updates.
239
- * @param binding - The binding that returns the latest value for an update.
240
- * @param isBindingVolatile - Indicates whether the binding has volatile dependencies.
241
- * @param bind - The operation to perform during binding.
242
- * @param unbind - The operation to perform during unbinding.
243
- * @param updateTarget - The operation to perform when updating.
244
- * @param targetName - The name of the target attribute or property to update.
245
- */
246
- constructor(target: any, binding: Binding, isBindingVolatile: boolean, bind: typeof normalBind, unbind: typeof normalUnbind, updateTarget: typeof updatePropertyTarget, targetName?: string);
247
- /** @internal */
248
- handleChange(): void;
249
- /** @internal */
250
- handleEvent(event: Event): void;
251
- }
268
+ export declare function bind<T = any>(binding: Expression<T>, isVolatile?: boolean): Binding<T>;
252
269
 
253
270
  /**
254
- * Enables evaluation of and subscription to a binding.
271
+ * Captures a binding expression along with related information and capabilities.
272
+ *
255
273
  * @public
256
274
  */
257
- export declare interface BindingObserver<TSource = any, TReturn = any, TParent = any> extends Notifier {
275
+ export declare abstract class Binding<TSource = any, TReturn = any, TParent = any> {
276
+ evaluate: Expression<TSource, TReturn, TParent>;
277
+ isVolatile: boolean;
258
278
  /**
259
- * Begins observing the binding for the source and returns the current value.
260
- * @param source - The source that the binding is based on.
261
- * @param context - The execution context to execute the binding within.
262
- * @returns The value of the binding.
279
+ * Options associated with the binding.
263
280
  */
264
- observe(source: TSource, context: ExecutionContext<TParent>): TReturn;
281
+ options?: any;
265
282
  /**
266
- * Unsubscribe from all dependent observables of the binding.
283
+ * Creates a binding.
284
+ * @param evaluate - Evaluates the binding.
285
+ * @param isVolatile - Indicates whether the binding is volatile.
267
286
  */
268
- disconnect(): void;
287
+ constructor(evaluate: Expression<TSource, TReturn, TParent>, isVolatile?: boolean);
269
288
  /**
270
- * Gets {@link ObservationRecord|ObservationRecords} that the {@link BindingObserver}
271
- * is observing.
289
+ * Creates an observer capable of notifying a subscriber when the output of a binding changes.
290
+ * @param directive - The HTML Directive to create the observer for.
291
+ * @param subscriber - The subscriber to changes in the binding.
272
292
  */
273
- records(): IterableIterator<ObservationRecord>;
293
+ abstract createObserver(directive: HTMLDirective, subscriber: Subscriber): ExpressionObserver<TSource, TReturn, TParent>;
274
294
  }
275
295
 
276
296
  /**
@@ -281,6 +301,8 @@ export declare interface BindingObserver<TSource = any, TReturn = any, TParent =
281
301
  */
282
302
  export declare const booleanConverter: ValueConverter;
283
303
 
304
+ declare const booleanMode = "boolean";
305
+
284
306
  /**
285
307
  * Represents a callable type such as a function or an object with a "call" method.
286
308
  * @public
@@ -294,14 +316,14 @@ export declare type Callable = typeof Function.prototype.call | {
294
316
  * into templates.
295
317
  * @public
296
318
  */
297
- export declare interface CaptureType<TSource> {
319
+ export declare interface CaptureType<TSource, TParent> {
298
320
  }
299
321
 
300
322
  /**
301
323
  * The options used to configure child list observation.
302
324
  * @public
303
325
  */
304
- export declare interface ChildListBehaviorOptions<T = any> extends NodeBehaviorOptions<T>, Omit<MutationObserverInit, "subtree" | "childList"> {
326
+ export declare interface ChildListDirectiveOptions<T = any> extends NodeBehaviorOptions<T>, Omit<MutationObserverInit, "subtree" | "childList"> {
305
327
  }
306
328
 
307
329
  /**
@@ -310,78 +332,97 @@ export declare interface ChildListBehaviorOptions<T = any> extends NodeBehaviorO
310
332
  * @param propertyOrOptions - The options used to configure child node observation.
311
333
  * @public
312
334
  */
313
- export declare function children<T = any>(propertyOrOptions: (keyof T & string) | ChildrenBehaviorOptions<keyof T & string>): CaptureType<T>;
335
+ export declare function children<TSource = any, TParent = any>(propertyOrOptions: (keyof TSource & string) | ChildrenDirectiveOptions<keyof TSource & string>): CaptureType<TSource, TParent>;
314
336
 
315
337
  /**
316
338
  * The runtime behavior for child node observation.
317
339
  * @public
318
340
  */
319
- export declare class ChildrenBehavior extends NodeObservationBehavior<ChildrenBehaviorOptions> {
320
- private observer;
341
+ export declare class ChildrenDirective extends NodeObservationDirective<ChildrenDirectiveOptions> {
342
+ private observerProperty;
321
343
  /**
322
- * Creates an instance of ChildrenBehavior.
323
- * @param target - The element target to observe children on.
324
- * @param options - The options to use when observing the element children.
344
+ * Creates an instance of ChildrenDirective.
345
+ * @param options - The options to use in configuring the child observation behavior.
325
346
  */
326
- constructor(target: HTMLElement, options: ChildrenBehaviorOptions);
347
+ constructor(options: ChildrenDirectiveOptions);
327
348
  /**
328
349
  * Begins observation of the nodes.
350
+ * @param target - The target to observe.
329
351
  */
330
- observe(): void;
352
+ observe(target: any): void;
331
353
  /**
332
354
  * Disconnects observation of the nodes.
355
+ * @param target - The target to unobserve.
333
356
  */
334
- disconnect(): void;
357
+ disconnect(target: any): void;
335
358
  /**
336
- * Retrieves the nodes that should be assigned to the target.
359
+ * Retrieves the raw nodes that should be assigned to the source property.
360
+ * @param target - The target to get the node to.
337
361
  */
338
- protected getNodes(): ChildNode[];
362
+ getNodes(target: Element): Node[];
363
+ private handleEvent;
339
364
  }
340
365
 
341
366
  /**
342
367
  * The options used to configure child/subtree node observation.
343
368
  * @public
344
369
  */
345
- export declare type ChildrenBehaviorOptions<T = any> = ChildListBehaviorOptions<T> | SubtreeBehaviorOptions<T>;
370
+ export declare type ChildrenDirectiveOptions<T = any> = ChildListDirectiveOptions<T> | SubtreeDirectiveOptions<T>;
346
371
 
347
372
  /**
348
- * The result of compiling a template and its directives.
349
- * @beta
373
+ * A function capable of compiling a template from the preprocessed form produced
374
+ * by the html template function into a result that can instantiate views.
375
+ * @public
350
376
  */
351
- export declare interface CompilationResult {
377
+ export declare type CompilationStrategy = (
378
+ /**
379
+ * The preprocessed HTML string or template to compile.
380
+ */
381
+ html: string | HTMLTemplateElement,
382
+ /**
383
+ * The behavior factories used within the html that is being compiled.
384
+ */
385
+ factories: Record<string, ViewBehaviorFactory>) => HTMLTemplateCompilationResult;
386
+
387
+ /**
388
+ * Common APIs related to compilation.
389
+ * @public
390
+ */
391
+ export declare const Compiler: {
352
392
  /**
353
- * A cloneable DocumentFragment representing the compiled HTML.
393
+ * Sets the HTML trusted types policy used by the compiler.
394
+ * @param policy - The policy to set for HTML.
395
+ * @remarks
396
+ * This API can only be called once, for security reasons. It should be
397
+ * called by the application developer at the start of their program.
354
398
  */
355
- fragment: DocumentFragment;
399
+ setHTMLPolicy(policy: TrustedTypesPolicy): void;
356
400
  /**
357
- * The behaviors that should be applied to the template's HTML.
401
+ * Compiles a template and associated directives into a compilation
402
+ * result which can be used to create views.
403
+ * @param html - The html string or template element to compile.
404
+ * @param directives - The directives referenced by the template.
405
+ * @remarks
406
+ * The template that is provided for compilation is altered in-place
407
+ * and cannot be compiled again. If the original template must be preserved,
408
+ * it is recommended that you clone the original and pass the clone to this API.
409
+ * @public
358
410
  */
359
- viewBehaviorFactories: NodeBehaviorFactory[];
411
+ compile<TSource = any, TParent = any>(html: string | HTMLTemplateElement, directives: Record<string, ViewBehaviorFactory>): HTMLTemplateCompilationResult<TSource, TParent>;
360
412
  /**
361
- * The behaviors that should be applied to the host element that
362
- * the template is rendered into.
413
+ * Sets the default compilation strategy that will be used by the ViewTemplate whenever
414
+ * it needs to compile a view preprocessed with the html template function.
415
+ * @param strategy - The compilation strategy to use when compiling templates.
363
416
  */
364
- hostBehaviorFactories: NodeBehaviorFactory[];
417
+ setDefaultStrategy(strategy: CompilationStrategy): void;
365
418
  /**
366
- * An index offset to apply to BehaviorFactory target indexes when
367
- * matching factories to targets.
419
+ * Aggregates an array of strings and directives into a single directive.
420
+ * @param parts - A heterogeneous array of static strings interspersed with
421
+ * directives.
422
+ * @returns A single inline directive that aggregates the behavior of all the parts.
368
423
  */
369
- targetOffset: number;
370
- }
371
-
372
- /**
373
- * Compiles a template and associated directives into a raw compilation
374
- * result which include a cloneable DocumentFragment and factories capable
375
- * of attaching runtime behavior to nodes within the fragment.
376
- * @param template - The template to compile.
377
- * @param directives - The directives referenced by the template.
378
- * @remarks
379
- * The template that is provided for compilation is altered in-place
380
- * and cannot be compiled again. If the original template must be preserved,
381
- * it is recommended that you clone the original and pass the clone to this API.
382
- * @public
383
- */
384
- export declare function compileTemplate(template: HTMLTemplateElement, directives: ReadonlyArray<HTMLDirective>): CompilationResult;
424
+ aggregate(parts: (string | ViewBehaviorFactory)[]): ViewBehaviorFactory;
425
+ };
385
426
 
386
427
  /**
387
428
  * Represents styles that can be composed into the ShadowDOM of a custom element.
@@ -389,6 +430,10 @@ export declare function compileTemplate(template: HTMLTemplateElement, directive
389
430
  */
390
431
  export declare type ComposableStyles = string | ElementStyles | CSSStyleSheet;
391
432
 
433
+ declare function compose<TType extends Constructable<HTMLElement> = Constructable<HTMLElement>>(this: TType, nameOrDef: string | PartialFASTElementDefinition): FASTElementDefinition<TType>;
434
+
435
+ declare function compose<TType extends Constructable<HTMLElement> = Constructable<HTMLElement>>(type: TType, nameOrDef?: string | PartialFASTElementDefinition): FASTElementDefinition<TType>;
436
+
392
437
  /**
393
438
  * Allows for the creation of Constructable mixin classes.
394
439
  *
@@ -399,126 +444,60 @@ export declare type Constructable<T = {}> = {
399
444
  };
400
445
 
401
446
  /**
402
- * Controls the lifecycle and rendering of a `FASTElement`.
447
+ * A type that instantiates a StyleStrategy.
403
448
  * @public
404
449
  */
405
- export declare class Controller extends PropertyChangeNotifier {
406
- private boundObservables;
407
- private behaviors;
408
- private needsInitialization;
409
- private _template;
410
- private _styles;
411
- private _isConnected;
412
- /**
413
- * This allows Observable.getNotifier(...) to return the Controller
414
- * when the notifier for the Controller itself is being requested. The
415
- * result is that the Observable system does not need to create a separate
416
- * instance of Notifier for observables on the Controller. The component and
417
- * the controller will now share the same notifier, removing one-object construct
418
- * per web component instance.
419
- */
420
- private readonly $fastController;
450
+ export declare type ConstructibleStyleStrategy = {
421
451
  /**
422
- * The element being controlled by this controller.
452
+ * Creates an instance of the strategy.
453
+ * @param styles - The styles to initialize the strategy with.
423
454
  */
424
- readonly element: HTMLElement;
425
- /**
426
- * The element definition that instructs this controller
427
- * in how to handle rendering and other platform integrations.
428
- */
429
- readonly definition: FASTElementDefinition;
430
- /**
431
- * The view associated with the custom element.
432
- * @remarks
433
- * If `null` then the element is managing its own rendering.
434
- */
435
- readonly view: ElementView | null;
436
- /**
437
- * Indicates whether or not the custom element has been
438
- * connected to the document.
439
- */
440
- get isConnected(): boolean;
441
- private setIsConnected;
442
- /**
443
- * Gets/sets the template used to render the component.
444
- * @remarks
445
- * This value can only be accurately read after connect but can be set at any time.
446
- */
447
- get template(): ElementViewTemplate | null;
448
- set template(value: ElementViewTemplate | null);
449
- /**
450
- * Gets/sets the primary styles used for the component.
451
- * @remarks
452
- * This value can only be accurately read after connect but can be set at any time.
453
- */
454
- get styles(): ElementStyles | null;
455
- set styles(value: ElementStyles | null);
456
- /**
457
- * Creates a Controller to control the specified element.
458
- * @param element - The element to be controlled by this controller.
459
- * @param definition - The element definition metadata that instructs this
460
- * controller in how to handle rendering and other platform integrations.
461
- * @internal
462
- */
463
- constructor(element: HTMLElement, definition: FASTElementDefinition);
464
- /**
465
- * Adds styles to this element. Providing an HTMLStyleElement will attach the element instance to the shadowRoot.
466
- * @param styles - The styles to add.
467
- */
468
- addStyles(styles: ElementStyles | HTMLStyleElement): void;
469
- /**
470
- * Removes styles from this element. Providing an HTMLStyleElement will detach the element instance from the shadowRoot.
471
- * @param styles - the styles to remove.
472
- */
473
- removeStyles(styles: ElementStyles | HTMLStyleElement): void;
474
- /**
475
- * Adds behaviors to this element.
476
- * @param behaviors - The behaviors to add.
477
- */
478
- addBehaviors(behaviors: ReadonlyArray<Behavior>): void;
479
- /**
480
- * Removes behaviors from this element.
481
- * @param behaviors - The behaviors to remove.
482
- * @param force - Forces unbinding of behaviors.
483
- */
484
- removeBehaviors(behaviors: ReadonlyArray<Behavior>, force?: boolean): void;
455
+ new (styles: (string | CSSStyleSheet)[]): StyleStrategy;
456
+ };
457
+
458
+ /**
459
+ * A simple template that can create ContentView instances.
460
+ * @public
461
+ */
462
+ export declare interface ContentTemplate {
485
463
  /**
486
- * Runs connected lifecycle behavior on the associated element.
464
+ * Creates a simple content view instance.
487
465
  */
488
- onConnectedCallback(): void;
466
+ create(): ContentView;
467
+ }
468
+
469
+ /**
470
+ * A simple View that can be interpolated into HTML content.
471
+ * @public
472
+ */
473
+ export declare interface ContentView {
474
+ readonly context: ExecutionContext;
489
475
  /**
490
- * Runs disconnected lifecycle behavior on the associated element.
476
+ * Binds a view's behaviors to its binding source.
477
+ * @param source - The binding source for the view's binding behaviors.
478
+ * @param context - The execution context to run the view within.
491
479
  */
492
- onDisconnectedCallback(): void;
480
+ bind(source: any, context?: ExecutionContext): void;
493
481
  /**
494
- * Runs the attribute changed callback for the associated element.
495
- * @param name - The name of the attribute that changed.
496
- * @param oldValue - The previous value of the attribute.
497
- * @param newValue - The new value of the attribute.
482
+ * Unbinds a view's behaviors from its binding source and context.
498
483
  */
499
- onAttributeChangedCallback(name: string, oldValue: string, newValue: string): void;
484
+ unbind(): void;
500
485
  /**
501
- * Emits a custom HTML event.
502
- * @param type - The type name of the event.
503
- * @param detail - The event detail object to send with the event.
504
- * @param options - The event options. By default bubbles and composed.
505
- * @remarks
506
- * Only emits events if connected.
486
+ * Inserts the view's DOM nodes before the referenced node.
487
+ * @param node - The node to insert the view's DOM before.
507
488
  */
508
- emit(type: string, detail?: any, options?: Omit<CustomEventInit, "detail">): void | boolean;
509
- private finishInitialization;
510
- private renderTemplate;
489
+ insertBefore(node: Node): void;
511
490
  /**
512
- * Locates or creates a controller for the specified element.
513
- * @param element - The element to return the controller for.
514
- * @remarks
515
- * The specified element must have a {@link FASTElementDefinition}
516
- * registered either through the use of the {@link customElement}
517
- * decorator or a call to `FASTElement.define`.
491
+ * Removes the view's DOM nodes.
492
+ * The nodes are not disposed and the view can later be re-inserted.
518
493
  */
519
- static forCustomElement(element: HTMLElement): Controller;
494
+ remove(): void;
520
495
  }
521
496
 
497
+ /* Excluded from this release type: createMetadataLocator */
498
+
499
+ /* Excluded from this release type: createTypeRegistry */
500
+
522
501
  /**
523
502
  * Transforms a template literal string into styles.
524
503
  * @param strings - The string fragments that are interpolated with the values.
@@ -527,33 +506,85 @@ export declare class Controller extends PropertyChangeNotifier {
527
506
  * The css helper supports interpolation of strings and ElementStyle instances.
528
507
  * @public
529
508
  */
530
- export declare function css(strings: TemplateStringsArray, ...values: (ComposableStyles | CSSDirective)[]): ElementStyles;
509
+ export declare const css: CSSTemplateTag;
531
510
 
532
511
  /**
533
512
  * Directive for use in {@link css}.
534
513
  *
535
514
  * @public
536
515
  */
537
- export declare class CSSDirective {
516
+ export declare interface CSSDirective {
538
517
  /**
539
518
  * Creates a CSS fragment to interpolate into the CSS document.
540
519
  * @returns - the string to interpolate into CSS
541
520
  */
542
- createCSS(): ComposableStyles;
521
+ createCSS(add: AddBehavior): ComposableStyles;
522
+ }
523
+
524
+ /**
525
+ * Instructs the css engine to provide dynamic styles or
526
+ * associate behaviors with styles.
527
+ * @public
528
+ */
529
+ export declare const CSSDirective: Readonly<{
530
+ /**
531
+ * Gets the directive definition associated with the instance.
532
+ * @param instance - The directive instance to retrieve the definition for.
533
+ */
534
+ getForInstance: (object: any) => CSSDirectiveDefinition<Constructable<CSSDirective>> | undefined;
535
+ /**
536
+ * Gets the directive definition associated with the specified type.
537
+ * @param type - The directive type to retrieve the definition for.
538
+ */
539
+ getByType: (key: Function) => CSSDirectiveDefinition<Constructable<CSSDirective>> | undefined;
540
+ /**
541
+ * Defines a CSSDirective.
542
+ * @param type - The type to define as a directive.
543
+ */
544
+ define<TType extends Constructable<CSSDirective>>(type: any): TType;
545
+ }>;
546
+
547
+ /**
548
+ * Decorator: Defines a CSSDirective.
549
+ * @public
550
+ */
551
+ export declare function cssDirective(): (type: Constructable<CSSDirective>) => void;
552
+
553
+ /**
554
+ * Defines metadata for a CSSDirective.
555
+ * @public
556
+ */
557
+ export declare interface CSSDirectiveDefinition<TType extends Constructable<CSSDirective> = Constructable<CSSDirective>> {
543
558
  /**
544
- * Creates a behavior to bind to the host element.
545
- * @returns - the behavior to bind to the host element, or undefined.
559
+ * The type that the definition provides metadata for.
546
560
  */
547
- createBehavior(): Behavior | undefined;
561
+ readonly type: TType;
548
562
  }
549
563
 
550
564
  /**
551
- * Transforms a template literal string into partial CSS.
565
+ * @deprecated Use css.partial instead.
566
+ * @public
567
+ */
568
+ export declare const cssPartial: (strings: TemplateStringsArray, ...values: (ComposableStyles | CSSDirective)[]) => CSSDirective;
569
+
570
+ /**
571
+ * Transforms a template literal string into styles.
552
572
  * @param strings - The string fragments that are interpolated with the values.
553
573
  * @param values - The values that are interpolated with the string fragments.
574
+ * @remarks
575
+ * The css helper supports interpolation of strings and ElementStyle instances.
576
+ * Use the .partial method to create partial CSS fragments.
554
577
  * @public
555
578
  */
556
- export declare function cssPartial(strings: TemplateStringsArray, ...values: (ComposableStyles | CSSDirective)[]): CSSDirective;
579
+ export declare type CSSTemplateTag = ((strings: TemplateStringsArray, ...values: (ComposableStyles | CSSDirective)[]) => ElementStyles) & {
580
+ /**
581
+ * Transforms a template literal string into partial CSS.
582
+ * @param strings - The string fragments that are interpolated with the values.
583
+ * @param values - The values that are interpolated with the string fragments.
584
+ * @public
585
+ */
586
+ partial(strings: TemplateStringsArray, ...values: (ComposableStyles | CSSDirective)[]): CSSDirective;
587
+ };
557
588
 
558
589
  /**
559
590
  * Decorator: Defines a platform custom element based on `FASTElement`.
@@ -561,7 +592,7 @@ export declare function cssPartial(strings: TemplateStringsArray, ...values: (Co
561
592
  * that describes the element to define.
562
593
  * @public
563
594
  */
564
- export declare function customElement(nameOrDef: string | PartialFASTElementDefinition): (type: Function) => void;
595
+ export declare function customElement(nameOrDef: string | PartialFASTElementDefinition): (type: Constructable<HTMLElement>) => void;
565
596
 
566
597
  /**
567
598
  * Metadata used to configure a custom attribute's behavior through a decorator.
@@ -569,11 +600,20 @@ export declare function customElement(nameOrDef: string | PartialFASTElementDefi
569
600
  */
570
601
  export declare type DecoratorAttributeConfiguration = Omit<AttributeConfiguration, "property">;
571
602
 
603
+ declare function define<TType extends Constructable<HTMLElement> = Constructable<HTMLElement>>(this: TType, nameOrDef: string | PartialFASTElementDefinition): TType;
604
+
605
+ declare function define<TType extends Constructable<HTMLElement> = Constructable<HTMLElement>>(type: TType, nameOrDef?: string | PartialFASTElementDefinition): TType;
606
+
572
607
  /**
573
- * The default execution context used in binding expressions.
608
+ * Provides a mechanism for releasing resources.
574
609
  * @public
575
610
  */
576
- export declare const defaultExecutionContext: ExecutionContext<any, any>;
611
+ export declare interface Disposable {
612
+ /**
613
+ * Disposes the resources.
614
+ */
615
+ dispose(): void;
616
+ }
577
617
 
578
618
  /**
579
619
  * Common DOM APIs.
@@ -581,159 +621,225 @@ export declare const defaultExecutionContext: ExecutionContext<any, any>;
581
621
  */
582
622
  export declare const DOM: Readonly<{
583
623
  /**
584
- * Indicates whether the DOM supports the adoptedStyleSheets feature.
624
+ * @deprecated
625
+ * Use Updates.enqueue().
626
+ */
627
+ queueUpdate: (callable: Callable) => void;
628
+ /**
629
+ * @deprecated
630
+ * Use Updates.next()
585
631
  */
586
- supportsAdoptedStyleSheets: boolean;
632
+ nextUpdate: () => Promise<void>;
587
633
  /**
588
- * Sets the HTML trusted types policy used by the templating engine.
589
- * @param policy - The policy to set for HTML.
634
+ * @deprecated
635
+ * Use Updates.process()
636
+ */
637
+ processUpdates: () => void;
638
+ /**
639
+ * Sets an attribute value on an element.
640
+ * @param element - The element to set the attribute value on.
641
+ * @param attributeName - The attribute name to set.
642
+ * @param value - The value of the attribute to set.
590
643
  * @remarks
591
- * This API can only be called once, for security reasons. It should be
592
- * called by the application developer at the start of their program.
644
+ * If the value is `null` or `undefined`, the attribute is removed, otherwise
645
+ * it is set to the provided value using the standard `setAttribute` API.
593
646
  */
594
- setHTMLPolicy(policy: TrustedTypesPolicy): void;
647
+ setAttribute(element: HTMLElement, attributeName: string, value: any): void;
595
648
  /**
596
- * Turns a string into trusted HTML using the configured trusted types policy.
597
- * @param html - The string to turn into trusted HTML.
649
+ * Sets a boolean attribute value.
650
+ * @param element - The element to set the boolean attribute value on.
651
+ * @param attributeName - The attribute name to set.
652
+ * @param value - The value of the attribute to set.
598
653
  * @remarks
599
- * Used internally by the template engine when creating templates
600
- * and setting innerHTML.
654
+ * If the value is true, the attribute is added; otherwise it is removed.
601
655
  */
602
- createHTML(html: string): string;
656
+ setBooleanAttribute(element: HTMLElement, attributeName: string, value: boolean): void;
657
+ }>;
658
+
659
+ /**
660
+ * Controls the lifecycle and rendering of a `FASTElement`.
661
+ * @public
662
+ */
663
+ export declare class ElementController<TElement extends HTMLElement = HTMLElement> extends PropertyChangeNotifier implements HostController<TElement> {
664
+ private boundObservables;
665
+ private needsInitialization;
666
+ private hasExistingShadowRoot;
667
+ private _template;
668
+ private _isConnected;
669
+ private behaviors;
670
+ private _mainStyles;
671
+ /**
672
+ * This allows Observable.getNotifier(...) to return the Controller
673
+ * when the notifier for the Controller itself is being requested. The
674
+ * result is that the Observable system does not need to create a separate
675
+ * instance of Notifier for observables on the Controller. The component and
676
+ * the controller will now share the same notifier, removing one-object construct
677
+ * per web component instance.
678
+ */
679
+ private readonly $fastController;
603
680
  /**
604
- * Determines if the provided node is a template marker used by the runtime.
605
- * @param node - The node to test.
681
+ * The element being controlled by this controller.
606
682
  */
607
- isMarker(node: Node): node is Comment;
683
+ readonly source: TElement;
608
684
  /**
609
- * Given a marker node, extract the {@link HTMLDirective} index from the placeholder.
610
- * @param node - The marker node to extract the index from.
685
+ * The element definition that instructs this controller
686
+ * in how to handle rendering and other platform integrations.
611
687
  */
612
- extractDirectiveIndexFromMarker(node: Comment): number;
688
+ readonly definition: FASTElementDefinition;
613
689
  /**
614
- * Creates a placeholder string suitable for marking out a location *within*
615
- * an attribute value or HTML content.
616
- * @param index - The directive index to create the placeholder for.
690
+ * The view associated with the custom element.
617
691
  * @remarks
618
- * Used internally by binding directives.
692
+ * If `null` then the element is managing its own rendering.
619
693
  */
620
- createInterpolationPlaceholder(index: number): string;
694
+ readonly view: ElementView<TElement> | null;
621
695
  /**
622
- * Creates a placeholder that manifests itself as an attribute on an
623
- * element.
624
- * @param attributeName - The name of the custom attribute.
625
- * @param index - The directive index to create the placeholder for.
626
- * @remarks
627
- * Used internally by attribute directives such as `ref`, `slotted`, and `children`.
696
+ * Indicates whether or not the custom element has been
697
+ * connected to the document.
628
698
  */
629
- createCustomAttributePlaceholder(attributeName: string, index: number): string;
699
+ get isConnected(): boolean;
700
+ private setIsConnected;
630
701
  /**
631
- * Creates a placeholder that manifests itself as a marker within the DOM structure.
632
- * @param index - The directive index to create the placeholder for.
702
+ * Gets/sets the template used to render the component.
633
703
  * @remarks
634
- * Used internally by structural directives such as `repeat`.
704
+ * This value can only be accurately read after connect but can be set at any time.
635
705
  */
636
- createBlockPlaceholder(index: number): string;
706
+ get template(): ElementViewTemplate<TElement> | null;
707
+ set template(value: ElementViewTemplate<TElement> | null);
637
708
  /**
638
- * Schedules DOM update work in the next async batch.
639
- * @param callable - The callable function or object to queue.
709
+ * The main set of styles used for the component, independent
710
+ * of any dynamically added styles.
640
711
  */
641
- queueUpdate: (callable: Callable) => void;
712
+ get mainStyles(): ElementStyles | null;
713
+ set mainStyles(value: ElementStyles | null);
714
+ /* Excluded from this release type: __constructor */
642
715
  /**
643
- * Immediately processes all work previously scheduled
644
- * through queueUpdate.
645
- * @remarks
646
- * This also forces nextUpdate promises
647
- * to resolve.
716
+ * Adds the behavior to the component.
717
+ * @param behavior - The behavior to add.
648
718
  */
649
- processUpdates: () => void;
719
+ addBehavior(behavior: HostBehavior<TElement>): void;
650
720
  /**
651
- * Resolves with the next DOM update.
721
+ * Removes the behavior from the component.
722
+ * @param behavior - The behavior to remove.
723
+ * @param force - Forces removal even if this behavior was added more than once.
652
724
  */
653
- nextUpdate(): Promise<void>;
725
+ removeBehavior(behavior: HostBehavior<TElement>, force?: boolean): void;
654
726
  /**
655
- * Sets an attribute value on an element.
656
- * @param element - The element to set the attribute value on.
657
- * @param attributeName - The attribute name to set.
658
- * @param value - The value of the attribute to set.
659
- * @remarks
660
- * If the value is `null` or `undefined`, the attribute is removed, otherwise
661
- * it is set to the provided value using the standard `setAttribute` API.
727
+ * Adds styles to this element. Providing an HTMLStyleElement will attach the element instance to the shadowRoot.
728
+ * @param styles - The styles to add.
662
729
  */
663
- setAttribute(element: HTMLElement, attributeName: string, value: any): void;
730
+ addStyles(styles: ElementStyles | HTMLStyleElement | null | undefined): void;
664
731
  /**
665
- * Sets a boolean attribute value.
666
- * @param element - The element to set the boolean attribute value on.
667
- * @param attributeName - The attribute name to set.
668
- * @param value - The value of the attribute to set.
669
- * @remarks
670
- * If the value is true, the attribute is added; otherwise it is removed.
732
+ * Removes styles from this element. Providing an HTMLStyleElement will detach the element instance from the shadowRoot.
733
+ * @param styles - the styles to remove.
671
734
  */
672
- setBooleanAttribute(element: HTMLElement, attributeName: string, value: boolean): void;
735
+ removeStyles(styles: ElementStyles | HTMLStyleElement | null | undefined): void;
673
736
  /**
674
- * Removes all the child nodes of the provided parent node.
675
- * @param parent - The node to remove the children from.
737
+ * Runs connected lifecycle behavior on the associated element.
676
738
  */
677
- removeChildNodes(parent: Node): void;
739
+ connect(): void;
678
740
  /**
679
- * Creates a TreeWalker configured to walk a template fragment.
680
- * @param fragment - The fragment to walk.
741
+ * Runs disconnected lifecycle behavior on the associated element.
681
742
  */
682
- createTemplateWalker(fragment: DocumentFragment): TreeWalker;
683
- }>;
743
+ disconnect(): void;
744
+ /**
745
+ * Runs the attribute changed callback for the associated element.
746
+ * @param name - The name of the attribute that changed.
747
+ * @param oldValue - The previous value of the attribute.
748
+ * @param newValue - The new value of the attribute.
749
+ */
750
+ onAttributeChangedCallback(name: string, oldValue: string | null, newValue: string | null): void;
751
+ /**
752
+ * Emits a custom HTML event.
753
+ * @param type - The type name of the event.
754
+ * @param detail - The event detail object to send with the event.
755
+ * @param options - The event options. By default bubbles and composed.
756
+ * @remarks
757
+ * Only emits events if connected.
758
+ */
759
+ emit(type: string, detail?: any, options?: Omit<CustomEventInit, "detail">): void | boolean;
760
+ private finishInitialization;
761
+ private renderTemplate;
762
+ /**
763
+ * Locates or creates a controller for the specified element.
764
+ * @param element - The element to return the controller for.
765
+ * @remarks
766
+ * The specified element must have a {@link FASTElementDefinition}
767
+ * registered either through the use of the {@link customElement}
768
+ * decorator or a call to `FASTElement.define`.
769
+ */
770
+ static forCustomElement(element: HTMLElement): ElementController;
771
+ }
684
772
 
685
773
  /**
686
774
  * Creates a function that can be used to filter a Node array, selecting only elements.
687
775
  * @param selector - An optional selector to restrict the filter to.
688
776
  * @public
689
777
  */
690
- export declare function elements(selector?: string): ElementsFilter;
778
+ export declare const elements: (selector?: string) => ElementsFilter;
691
779
 
692
780
  /**
693
781
  * Elements filter function type.
694
782
  *
695
783
  * @public
696
784
  */
697
- export declare type ElementsFilter = (value: Node, index: number, array: Node[]) => boolean;
698
-
699
- /**
700
- * Creates an ElementStyles instance for an array of ComposableStyles.
701
- * @public
702
- */
703
- export declare type ElementStyleFactory = (styles: ReadonlyArray<ComposableStyles>) => ElementStyles;
785
+ export declare type ElementsFilter = (value: Node, index?: number, array?: Node[]) => boolean;
704
786
 
705
787
  /**
706
788
  * Represents styles that can be applied to a custom element.
707
789
  * @public
708
790
  */
709
- export declare abstract class ElementStyles {
791
+ export declare class ElementStyles {
792
+ readonly styles: ReadonlyArray<ComposableStyles>;
710
793
  private targets;
711
- /** @internal */
712
- abstract readonly styles: ReadonlyArray<ComposableStyles>;
713
- /** @internal */
714
- abstract readonly behaviors: ReadonlyArray<Behavior> | null;
715
- /** @internal */
716
- addStylesTo(target: StyleTarget): void;
717
- /** @internal */
718
- removeStylesFrom(target: StyleTarget): void;
719
- /** @internal */
720
- isAttachedTo(target: StyleTarget): boolean;
794
+ private _strategy;
795
+ /**
796
+ * The behaviors associated with this set of styles.
797
+ */
798
+ readonly behaviors: ReadonlyArray<HostBehavior<HTMLElement>> | null;
799
+ /**
800
+ * Gets the StyleStrategy associated with these element styles.
801
+ */
802
+ get strategy(): StyleStrategy;
803
+ /**
804
+ * Creates an instance of ElementStyles.
805
+ * @param styles - The styles that will be associated with elements.
806
+ */
807
+ constructor(styles: ReadonlyArray<ComposableStyles>);
808
+ /* Excluded from this release type: addStylesTo */
809
+ /* Excluded from this release type: removeStylesFrom */
810
+ /* Excluded from this release type: isAttachedTo */
811
+ /**
812
+ * Associates behaviors with this set of styles.
813
+ * @param behaviors - The behaviors to associate.
814
+ */
815
+ withBehaviors(...behaviors: HostBehavior<HTMLElement>[]): this;
816
+ /**
817
+ * Sets the strategy that handles adding/removing these styles for an element.
818
+ * @param strategy - The strategy to use.
819
+ */
820
+ withStrategy(Strategy: ConstructibleStyleStrategy): this;
821
+ /**
822
+ * Sets the default strategy type to use when creating style strategies.
823
+ * @param Strategy - The strategy type to construct.
824
+ */
825
+ static setDefaultStrategy(Strategy: ConstructibleStyleStrategy): void;
721
826
  /**
722
- * Associates behaviors with this set of styles.
723
- * @param behaviors - The behaviors to associate.
827
+ * Normalizes a set of composable style options.
828
+ * @param styles - The style options to normalize.
829
+ * @returns A singular ElementStyles instance or undefined.
724
830
  */
725
- withBehaviors(...behaviors: Behavior[]): this;
831
+ static normalize(styles: ComposableStyles | ComposableStyles[] | undefined): ElementStyles | undefined;
726
832
  /**
727
- * Create ElementStyles from ComposableStyles.
833
+ * Indicates whether the DOM supports the adoptedStyleSheets feature.
728
834
  */
729
- static readonly create: ElementStyleFactory;
835
+ static readonly supportsAdoptedStyleSheets: boolean;
730
836
  }
731
837
 
732
838
  /**
733
839
  * A View representing DOM nodes specifically for rendering the view of a custom element.
734
840
  * @public
735
841
  */
736
- export declare interface ElementView extends View {
842
+ export declare interface ElementView<TSource = any, TParent = any> extends View<TSource, TParent> {
737
843
  /**
738
844
  * Appends the view's DOM nodes to the referenced node.
739
845
  * @param node - The parent node to append the view's DOM nodes to.
@@ -745,12 +851,12 @@ export declare interface ElementView extends View {
745
851
  * A template capable of creating views specifically for rendering custom elements.
746
852
  * @public
747
853
  */
748
- export declare interface ElementViewTemplate {
854
+ export declare interface ElementViewTemplate<TSource = any, TParent = any> {
749
855
  /**
750
856
  * Creates an ElementView instance based on this template definition.
751
857
  * @param hostBindingTarget - The element that host behaviors will be bound to.
752
858
  */
753
- create(hostBindingTarget: Element): ElementView;
859
+ create(hostBindingTarget: Element): ElementView<TSource, TParent>;
754
860
  /**
755
861
  * Creates an HTMLView from this template, binds it to the source, and then appends it to the host.
756
862
  * @param source - The data source to bind the template to.
@@ -758,7 +864,7 @@ export declare interface ElementViewTemplate {
758
864
  * @param hostBindingTarget - An HTML element to target the host bindings at if different from the
759
865
  * host that the template is being attached to.
760
866
  */
761
- render(source: any, host: Node, hostBindingTarget?: Element): HTMLView;
867
+ render(source: TSource, host: Node, hostBindingTarget?: Element): ElementView<TSource, TParent>;
762
868
  }
763
869
 
764
870
  /**
@@ -766,25 +872,15 @@ export declare interface ElementViewTemplate {
766
872
  * @remarks
767
873
  * Typically returned by APIs that return arrays when there are
768
874
  * no actual items to return.
769
- * @internal
770
- */
771
- export declare const emptyArray: readonly never[];
772
-
773
- /**
774
- * Enables the array observation mechanism.
775
- * @remarks
776
- * Array observation is enabled automatically when using the
777
- * {@link RepeatDirective}, so calling this API manually is
778
- * not typically necessary.
779
875
  * @public
780
876
  */
781
- export declare function enableArrayObservation(): void;
877
+ export declare const emptyArray: readonly never[];
782
878
 
783
879
  /**
784
880
  * Provides additional contextual information available to behaviors and expressions.
785
881
  * @public
786
882
  */
787
- export declare class ExecutionContext<TParent = any, TGrandparent = any> {
883
+ export declare interface ExecutionContext<TParent = any> {
788
884
  /**
789
885
  * The index of the current item within a repeat context.
790
886
  */
@@ -794,66 +890,162 @@ export declare class ExecutionContext<TParent = any, TGrandparent = any> {
794
890
  */
795
891
  length: number;
796
892
  /**
797
- * The parent data object within a repeat context.
893
+ * The parent data source within a nested context.
798
894
  */
799
895
  parent: TParent;
800
896
  /**
801
897
  * The parent execution context when in nested context scenarios.
802
898
  */
803
- parentContext: ExecutionContext<TGrandparent>;
899
+ parentContext: ExecutionContext<TParent>;
804
900
  /**
805
901
  * The current event within an event handler.
806
902
  */
807
- get event(): Event;
903
+ readonly event: Event;
808
904
  /**
809
905
  * Indicates whether the current item within a repeat context
810
906
  * has an even index.
811
907
  */
812
- get isEven(): boolean;
908
+ readonly isEven: boolean;
813
909
  /**
814
910
  * Indicates whether the current item within a repeat context
815
911
  * has an odd index.
816
912
  */
817
- get isOdd(): boolean;
913
+ readonly isOdd: boolean;
818
914
  /**
819
915
  * Indicates whether the current item within a repeat context
820
916
  * is the first item in the collection.
821
917
  */
822
- get isFirst(): boolean;
918
+ readonly isFirst: boolean;
823
919
  /**
824
920
  * Indicates whether the current item within a repeat context
825
921
  * is somewhere in the middle of the collection.
826
922
  */
827
- get isInMiddle(): boolean;
923
+ readonly isInMiddle: boolean;
828
924
  /**
829
925
  * Indicates whether the current item within a repeat context
830
926
  * is the last item in the collection.
831
927
  */
832
- get isLast(): boolean;
928
+ readonly isLast: boolean;
929
+ /**
930
+ * Returns the typed event detail of a custom event.
931
+ */
932
+ eventDetail<TDetail>(): TDetail;
933
+ /**
934
+ * Returns the typed event target of the event.
935
+ */
936
+ eventTarget<TTarget extends EventTarget>(): TTarget;
937
+ }
938
+
939
+ /**
940
+ * Provides additional contextual information available to behaviors and expressions.
941
+ * @public
942
+ */
943
+ export declare const ExecutionContext: Readonly<{
944
+ /**
945
+ * A default execution context.
946
+ */
947
+ default: ExecutionContext<any>;
948
+ /**
949
+ * Gets the current event.
950
+ * @returns An event object.
951
+ */
952
+ getEvent(): Event | null;
953
+ /**
954
+ * Sets the current event.
955
+ * @param event - An event object.
956
+ */
957
+ setEvent(event: Event | null): void;
958
+ }>;
959
+
960
+ /**
961
+ * The signature of an arrow function capable of being evaluated
962
+ * against source data and within an execution context.
963
+ * @public
964
+ */
965
+ export declare type Expression<TSource = any, TReturn = any, TParent = any> = (source: TSource, context: ExecutionContext<TParent>) => TReturn;
966
+
967
+ /**
968
+ * Controls the lifecycle of an expression and provides relevant context.
969
+ * @public
970
+ */
971
+ export declare interface ExpressionController<TSource = any, TParent = any> {
972
+ /**
973
+ * The source the expression is evaluated against.
974
+ */
975
+ readonly source: TSource;
976
+ /**
977
+ * Indicates how the source's lifetime relates to the controller's lifetime.
978
+ */
979
+ readonly sourceLifetime?: SourceLifetime;
980
+ /**
981
+ * The context the expression is evaluated against.
982
+ */
983
+ readonly context: ExecutionContext<TParent>;
984
+ /**
985
+ * Indicates whether the controller is bound.
986
+ */
987
+ readonly isBound: boolean;
988
+ /**
989
+ * Registers an unbind handler with the controller.
990
+ * @param behavior - An object to call when the controller unbinds.
991
+ */
992
+ onUnbind(behavior: {
993
+ unbind(controller: ExpressionController<TSource, TParent>): any;
994
+ }): void;
995
+ }
996
+
997
+ /**
998
+ * Enables evaluation of and subscription to a binding.
999
+ * @public
1000
+ */
1001
+ export declare interface ExpressionNotifier<TSource = any, TReturn = any, TParent = any> extends Notifier, ExpressionObserver<TSource, TReturn, TParent>, Disposable {
1002
+ /**
1003
+ * Observes the expression.
1004
+ * @param source - The source for the expression.
1005
+ * @param context - The context for the expression.
1006
+ */
1007
+ observe(source: TSource, context?: ExecutionContext): TReturn;
1008
+ /**
1009
+ * Gets {@link ObservationRecord|ObservationRecords} that the {@link ExpressionNotifier}
1010
+ * is observing.
1011
+ */
1012
+ records(): IterableIterator<ObservationRecord>;
833
1013
  /**
834
- * Sets the event for the current execution context.
835
- * @param event - The event to set.
836
- * @internal
1014
+ * Sets the update mode used by the observer.
1015
+ * @param isAsync - Indicates whether updates should be asynchronous.
1016
+ * @remarks
1017
+ * By default, the update mode is asynchronous, since that provides the best
1018
+ * performance for template rendering scenarios. Passing false to setMode will
1019
+ * instead cause the observer to notify subscribers immediately when changes occur.
837
1020
  */
838
- static setEvent(event: Event | null): void;
1021
+ setMode(isAsync: boolean): void;
839
1022
  }
840
1023
 
841
1024
  /**
842
- * The FAST global.
843
- * @internal
1025
+ * Observes an expression for changes.
1026
+ * @public
844
1027
  */
845
- export declare const FAST: FASTGlobal;
1028
+ export declare interface ExpressionObserver<TSource = any, TReturn = any, TParent = any> {
1029
+ /**
1030
+ * Binds the expression to the source.
1031
+ * @param controller - The controller that manages the lifecycle and related
1032
+ * context for the expression.
1033
+ */
1034
+ bind(controller: ExpressionController<TSource, TParent>): TReturn;
1035
+ }
1036
+
1037
+ /* Excluded from this release type: FAST */
846
1038
 
847
1039
  /**
848
1040
  * Represents a custom element based on the FASTElement infrastructure.
849
1041
  * @public
850
1042
  */
851
- export declare interface FASTElement {
1043
+ export declare interface FASTElement extends HTMLElement {
852
1044
  /**
853
1045
  * The underlying controller that handles the lifecycle and rendering of
854
1046
  * this FASTElement.
855
1047
  */
856
- readonly $fastController: Controller;
1048
+ readonly $fastController: ElementController;
857
1049
  /**
858
1050
  * Emits a custom HTML event.
859
1051
  * @param type - The type name of the event.
@@ -886,7 +1078,7 @@ export declare interface FASTElement {
886
1078
  * This method is invoked by the platform whenever an observed
887
1079
  * attribute of FASTElement has a value change.
888
1080
  */
889
- attributeChangedCallback(name: string, oldValue: string, newValue: string): void;
1081
+ attributeChangedCallback(name: string, oldValue: string | null, newValue: string | null): void;
890
1082
  }
891
1083
 
892
1084
  /**
@@ -894,31 +1086,19 @@ export declare interface FASTElement {
894
1086
  * static helpers for working with FASTElements.
895
1087
  * @public
896
1088
  */
897
- export declare const FASTElement: (new () => HTMLElement & FASTElement) & {
898
- /**
899
- * Creates a new FASTElement base class inherited from the
900
- * provided base type.
901
- * @param BaseType - The base element type to inherit from.
902
- */
903
- from<TBase extends {
904
- new (): HTMLElement;
905
- prototype: HTMLElement;
906
- }>(BaseType: TBase): new () => InstanceType<TBase> & FASTElement;
907
- /**
908
- * Defines a platform custom element based on the provided type and definition.
909
- * @param type - The custom element type to define.
910
- * @param nameOrDef - The name of the element to define or a definition object
911
- * that describes the element to define.
912
- */
913
- define<TType extends Function>(type: TType, nameOrDef?: string | PartialFASTElementDefinition | undefined): TType;
1089
+ export declare const FASTElement: {
1090
+ new (): FASTElement;
1091
+ define: typeof define;
1092
+ compose: typeof compose;
1093
+ from: typeof from;
914
1094
  };
915
1095
 
916
1096
  /**
917
1097
  * Defines metadata for a FASTElement.
918
1098
  * @public
919
1099
  */
920
- export declare class FASTElementDefinition<TType extends Function = Function> {
921
- private observedAttributes;
1100
+ export declare class FASTElementDefinition<TType extends Constructable<HTMLElement> = Constructable<HTMLElement>> {
1101
+ private platformDefined;
922
1102
  /**
923
1103
  * The type this element definition describes.
924
1104
  */
@@ -954,66 +1134,118 @@ export declare class FASTElementDefinition<TType extends Function = Function> {
954
1134
  /**
955
1135
  * Options controlling the creation of the custom element's shadow DOM.
956
1136
  */
957
- readonly shadowOptions?: ShadowRootInit;
1137
+ readonly shadowOptions?: ShadowRootOptions;
958
1138
  /**
959
1139
  * Options controlling how the custom element is defined with the platform.
960
1140
  */
961
- readonly elementOptions?: ElementDefinitionOptions;
1141
+ readonly elementOptions: ElementDefinitionOptions;
962
1142
  /**
963
- * Creates an instance of FASTElementDefinition.
964
- * @param type - The type this definition is being created for.
965
- * @param nameOrConfig - The name of the element to define or a config object
966
- * that describes the element to define.
1143
+ * The registry to register this component in by default.
967
1144
  */
968
- constructor(type: TType, nameOrConfig?: PartialFASTElementDefinition | string);
1145
+ readonly registry: CustomElementRegistry;
1146
+ private constructor();
969
1147
  /**
970
1148
  * Defines a custom element based on this definition.
971
1149
  * @param registry - The element registry to define the element in.
1150
+ * @remarks
1151
+ * This operation is idempotent per registry.
972
1152
  */
973
1153
  define(registry?: CustomElementRegistry): this;
1154
+ /**
1155
+ * Creates an instance of FASTElementDefinition.
1156
+ * @param type - The type this definition is being created for.
1157
+ * @param nameOrDef - The name of the element to define or a config object
1158
+ * that describes the element to define.
1159
+ */
1160
+ static compose<TType extends Constructable<HTMLElement> = Constructable<HTMLElement>>(type: TType, nameOrDef?: string | PartialFASTElementDefinition): FASTElementDefinition<TType>;
1161
+ /* Excluded from this release type: registerBaseType */
974
1162
  /**
975
1163
  * Gets the element definition associated with the specified type.
976
1164
  * @param type - The custom element type to retrieve the definition for.
977
1165
  */
978
- static readonly forType: <TType_1 extends Function>(key: TType_1) => FASTElementDefinition<Function> | undefined;
1166
+ static readonly getByType: (key: Function) => FASTElementDefinition<Constructable<HTMLElement>> | undefined;
1167
+ /**
1168
+ * Gets the element definition associated with the instance.
1169
+ * @param instance - The custom element instance to retrieve the definition for.
1170
+ */
1171
+ static readonly getForInstance: (object: any) => FASTElementDefinition<Constructable<HTMLElement>> | undefined;
979
1172
  }
980
1173
 
1174
+ /* Excluded from this release type: FASTGlobal */
1175
+
1176
+ declare function from<TBase extends typeof HTMLElement>(BaseType: TBase): new () => InstanceType<TBase> & FASTElement;
1177
+
981
1178
  /**
982
- * The FAST global.
983
- * @internal
1179
+ * Represents an object that can contribute behavior to a host.
1180
+ * @public
984
1181
  */
985
- export declare interface FASTGlobal {
1182
+ export declare interface HostBehavior<TSource = any> {
1183
+ /**
1184
+ * Executed when this behavior is attached to a controller.
1185
+ * @param controller - Controls the behavior lifecycle.
1186
+ */
1187
+ addedCallback?(controller: HostController<TSource>): void;
1188
+ /**
1189
+ * Executed when this behavior is detached from a controller.
1190
+ * @param controller - Controls the behavior lifecycle.
1191
+ */
1192
+ removedCallback?(controller: HostController<TSource>): void;
986
1193
  /**
987
- * The list of loaded versions.
1194
+ * Executed when this behavior's host is connected.
1195
+ * @param controller - Controls the behavior lifecycle.
988
1196
  */
989
- readonly versions: string[];
1197
+ connectedCallback?(controller: HostController<TSource>): void;
990
1198
  /**
991
- * Gets a kernel value.
992
- * @param id - The id to get the value for.
993
- * @param initialize - Creates the initial value for the id if not already existing.
1199
+ * Executed when this behavior's host is disconnected.
1200
+ * @param controller - Controls the behavior lifecycle.
994
1201
  */
995
- getById<T>(id: string | number): T | null;
996
- getById<T>(id: string | number, initialize: () => T): T;
1202
+ disconnectedCallback?(controller: HostController<TSource>): void;
997
1203
  }
998
1204
 
999
1205
  /**
1000
- * The platform global type.
1206
+ * Controls the lifecycle and context of behaviors and styles
1207
+ * associated with a component host.
1001
1208
  * @public
1002
1209
  */
1003
- export declare type Global = typeof globalThis & {
1210
+ export declare interface HostController<TSource = any> {
1004
1211
  /**
1005
- * Enables working with trusted types.
1212
+ * The component source.
1006
1213
  */
1007
- trustedTypes: TrustedTypes;
1214
+ readonly source: TSource;
1008
1215
  /**
1009
- * The FAST global.
1010
- * @internal
1216
+ * Indicates whether the host is connected or not.
1011
1217
  */
1012
- readonly FAST: FASTGlobal;
1013
- };
1218
+ readonly isConnected: boolean;
1219
+ /**
1220
+ * The main set of styles used for the component, independent
1221
+ * of any behavior-specific styles.
1222
+ */
1223
+ mainStyles: ElementStyles | null;
1224
+ /**
1225
+ * Adds the behavior to the component.
1226
+ * @param behavior - The behavior to add.
1227
+ */
1228
+ addBehavior(behavior: HostBehavior<TSource>): void;
1229
+ /**
1230
+ * Removes the behavior from the component.
1231
+ * @param behavior - The behavior to remove.
1232
+ * @param force - Forces removal even if this behavior was added more than once.
1233
+ */
1234
+ removeBehavior(behavior: HostBehavior<TSource>, force?: boolean): void;
1235
+ /**
1236
+ * Adds styles to this element. Providing an HTMLStyleElement will attach the element instance to the shadowRoot.
1237
+ * @param styles - The styles to add.
1238
+ */
1239
+ addStyles(styles: ElementStyles | HTMLStyleElement | null | undefined): void;
1240
+ /**
1241
+ * Removes styles from this element. Providing an HTMLStyleElement will detach the element instance from the shadowRoot.
1242
+ * @param styles - the styles to remove.
1243
+ */
1244
+ removeStyles(styles: ElementStyles | HTMLStyleElement | null | undefined): void;
1245
+ }
1014
1246
 
1015
1247
  /**
1016
- * Transforms a template literal string into a renderable ViewTemplate.
1248
+ * Transforms a template literal string into a ViewTemplate.
1017
1249
  * @param strings - The string fragments that are interpolated with the values.
1018
1250
  * @param values - The values that are interpolated with the string fragments.
1019
1251
  * @remarks
@@ -1024,77 +1256,200 @@ export declare type Global = typeof globalThis & {
1024
1256
  export declare function html<TSource = any, TParent = any>(strings: TemplateStringsArray, ...values: TemplateValue<TSource, TParent>[]): ViewTemplate<TSource, TParent>;
1025
1257
 
1026
1258
  /**
1027
- * A directive that configures data binding to element content and attributes.
1259
+ * A directive that applies bindings.
1028
1260
  * @public
1029
1261
  */
1030
- export declare class HTMLBindingDirective extends TargetedHTMLDirective {
1031
- binding: Binding;
1032
- private cleanedTargetName?;
1033
- private originalTargetName?;
1034
- private bind;
1035
- private unbind;
1262
+ export declare class HTMLBindingDirective implements HTMLDirective, ViewBehaviorFactory, ViewBehavior, Aspected {
1263
+ dataBinding: Binding;
1264
+ private data;
1036
1265
  private updateTarget;
1037
- private isBindingVolatile;
1038
1266
  /**
1039
- * Creates an instance of BindingDirective.
1040
- * @param binding - A binding that returns the data used to update the DOM.
1267
+ * The unique id of the factory.
1268
+ */
1269
+ id: string;
1270
+ /**
1271
+ * The structural id of the DOM node to which the created behavior will apply.
1272
+ */
1273
+ nodeId: string;
1274
+ /**
1275
+ * The original source aspect exactly as represented in markup.
1276
+ */
1277
+ sourceAspect: string;
1278
+ /**
1279
+ * The evaluated target aspect, determined after processing the source.
1280
+ */
1281
+ targetAspect: string;
1282
+ /**
1283
+ * The type of aspect to target.
1041
1284
  */
1042
- constructor(binding: Binding);
1285
+ aspectType: Aspect;
1043
1286
  /**
1044
- * Gets/sets the name of the attribute or property that this
1045
- * binding is targeting.
1287
+ * Creates an instance of HTMLBindingDirective.
1288
+ * @param dataBinding - The binding configuration to apply.
1046
1289
  */
1047
- get targetName(): string | undefined;
1048
- set targetName(value: string | undefined);
1290
+ constructor(dataBinding: Binding);
1049
1291
  /**
1050
- * Makes this binding target the content of an element rather than
1051
- * a particular attribute or property.
1292
+ * Creates HTML to be used within a template.
1293
+ * @param add - Can be used to add behavior factories to a template.
1052
1294
  */
1053
- targetAtContent(): void;
1295
+ createHTML(add: AddViewBehaviorFactory): string;
1054
1296
  /**
1055
- * Creates the runtime BindingBehavior instance based on the configuration
1056
- * information stored in the BindingDirective.
1057
- * @param target - The target node that the binding behavior should attach to.
1297
+ * Creates a behavior.
1058
1298
  */
1059
- createBehavior(target: Node): BindingBehavior;
1299
+ createBehavior(): ViewBehavior;
1300
+ /* Excluded from this release type: bindDefault */
1301
+ /* Excluded from this release type: bind */
1302
+ /* Excluded from this release type: bindContent */
1303
+ /* Excluded from this release type: bindEvent */
1304
+ /* Excluded from this release type: unbind */
1305
+ /* Excluded from this release type: handleEvent */
1306
+ /* Excluded from this release type: handleChange */
1060
1307
  }
1061
1308
 
1062
1309
  /**
1063
1310
  * Instructs the template engine to apply behavior to a node.
1064
1311
  * @public
1065
1312
  */
1066
- export declare abstract class HTMLDirective implements NodeBehaviorFactory {
1313
+ export declare interface HTMLDirective {
1067
1314
  /**
1068
- * The index of the DOM node to which the created behavior will apply.
1315
+ * Creates HTML to be used within a template.
1316
+ * @param add - Can be used to add behavior factories to a template.
1069
1317
  */
1070
- targetIndex: number;
1318
+ createHTML(add: AddViewBehaviorFactory): string;
1319
+ }
1320
+
1321
+ /**
1322
+ * Instructs the template engine to apply behavior to a node.
1323
+ * @public
1324
+ */
1325
+ export declare const HTMLDirective: Readonly<{
1071
1326
  /**
1072
- * Creates a placeholder string based on the directive's index within the template.
1073
- * @param index - The index of the directive within the template.
1327
+ * Gets the directive definition associated with the instance.
1328
+ * @param instance - The directive instance to retrieve the definition for.
1074
1329
  */
1075
- abstract createPlaceholder(index: number): string;
1330
+ getForInstance: (object: any) => HTMLDirectiveDefinition<Constructable<HTMLDirective>> | undefined;
1076
1331
  /**
1077
- * Creates a behavior for the provided target node.
1078
- * @param target - The node instance to create the behavior for.
1332
+ * Gets the directive definition associated with the specified type.
1333
+ * @param type - The directive type to retrieve the definition for.
1334
+ */
1335
+ getByType: (key: Function) => HTMLDirectiveDefinition<Constructable<HTMLDirective>> | undefined;
1336
+ /**
1337
+ * Defines an HTMLDirective based on the options.
1338
+ * @param type - The type to define as a directive.
1339
+ * @param options - Options that specify the directive's application.
1340
+ */
1341
+ define<TType extends Constructable<HTMLDirective>>(type: TType, options?: PartialHTMLDirectiveDefinition): TType;
1342
+ }>;
1343
+
1344
+ /**
1345
+ * Decorator: Defines an HTMLDirective.
1346
+ * @param options - Provides options that specify the directive's application.
1347
+ * @public
1348
+ */
1349
+ export declare function htmlDirective(options?: PartialHTMLDirectiveDefinition): (type: Constructable<HTMLDirective>) => void;
1350
+
1351
+ /**
1352
+ * Defines metadata for an HTMLDirective.
1353
+ * @public
1354
+ */
1355
+ export declare interface HTMLDirectiveDefinition<TType extends Constructable<HTMLDirective> = Constructable<HTMLDirective>> extends Required<PartialHTMLDirectiveDefinition> {
1356
+ /**
1357
+ * The type that the definition provides metadata for.
1358
+ */
1359
+ readonly type: TType;
1360
+ }
1361
+
1362
+ /**
1363
+ * The result of a template compilation operation.
1364
+ * @public
1365
+ */
1366
+ export declare interface HTMLTemplateCompilationResult<TSource = any, TParent = any> {
1367
+ /**
1368
+ * Creates a view instance.
1369
+ * @param hostBindingTarget - The host binding target for the view.
1079
1370
  */
1080
- abstract createBehavior(target: Node): Behavior;
1371
+ createView(hostBindingTarget?: Element): HTMLView<TSource, TParent>;
1081
1372
  }
1082
1373
 
1083
1374
  /**
1084
1375
  * The standard View implementation, which also implements ElementView and SyntheticView.
1085
1376
  * @public
1086
1377
  */
1087
- export declare class HTMLView implements ElementView, SyntheticView {
1378
+ export declare class HTMLView<TSource = any, TParent = any> implements ElementView<TSource, TParent>, SyntheticView<TSource, TParent>, ExecutionContext<TParent> {
1088
1379
  private fragment;
1380
+ private factories;
1381
+ readonly targets: ViewBehaviorTargets;
1089
1382
  private behaviors;
1383
+ private unbindables;
1090
1384
  /**
1091
1385
  * The data that the view is bound to.
1092
1386
  */
1093
- source: any | null;
1387
+ source: TSource | null;
1388
+ /**
1389
+ * Indicates whether the controller is bound.
1390
+ */
1391
+ isBound: boolean;
1392
+ /**
1393
+ * Indicates how the source's lifetime relates to the controller's lifetime.
1394
+ */
1395
+ readonly sourceLifetime: SourceLifetime;
1094
1396
  /**
1095
1397
  * The execution context the view is running within.
1096
1398
  */
1097
- context: ExecutionContext | null;
1399
+ context: ExecutionContext<TParent>;
1400
+ /**
1401
+ * The index of the current item within a repeat context.
1402
+ */
1403
+ index: number;
1404
+ /**
1405
+ * The length of the current collection within a repeat context.
1406
+ */
1407
+ length: number;
1408
+ /**
1409
+ * The parent data source within a nested context.
1410
+ */
1411
+ readonly parent: TParent;
1412
+ /**
1413
+ * The parent execution context when in nested context scenarios.
1414
+ */
1415
+ readonly parentContext: ExecutionContext<TParent>;
1416
+ /**
1417
+ * The current event within an event handler.
1418
+ */
1419
+ get event(): Event;
1420
+ /**
1421
+ * Indicates whether the current item within a repeat context
1422
+ * has an even index.
1423
+ */
1424
+ get isEven(): boolean;
1425
+ /**
1426
+ * Indicates whether the current item within a repeat context
1427
+ * has an odd index.
1428
+ */
1429
+ get isOdd(): boolean;
1430
+ /**
1431
+ * Indicates whether the current item within a repeat context
1432
+ * is the first item in the collection.
1433
+ */
1434
+ get isFirst(): boolean;
1435
+ /**
1436
+ * Indicates whether the current item within a repeat context
1437
+ * is somewhere in the middle of the collection.
1438
+ */
1439
+ get isInMiddle(): boolean;
1440
+ /**
1441
+ * Indicates whether the current item within a repeat context
1442
+ * is the last item in the collection.
1443
+ */
1444
+ get isLast(): boolean;
1445
+ /**
1446
+ * Returns the typed event detail of a custom event.
1447
+ */
1448
+ eventDetail<TDetail>(): TDetail;
1449
+ /**
1450
+ * Returns the typed event target of the event.
1451
+ */
1452
+ eventTarget<TTarget extends EventTarget>(): TTarget;
1098
1453
  /**
1099
1454
  * The first DOM node in the range of nodes that make up the view.
1100
1455
  */
@@ -1108,7 +1463,7 @@ export declare class HTMLView implements ElementView, SyntheticView {
1108
1463
  * @param fragment - The html fragment that contains the nodes for this view.
1109
1464
  * @param behaviors - The behaviors to be applied to this view.
1110
1465
  */
1111
- constructor(fragment: DocumentFragment, behaviors: Behavior[]);
1466
+ constructor(fragment: DocumentFragment, factories: ReadonlyArray<ViewBehaviorFactory>, targets: ViewBehaviorTargets);
1112
1467
  /**
1113
1468
  * Appends the view's DOM nodes to the referenced node.
1114
1469
  * @param node - The parent node to append the view's DOM nodes to.
@@ -1129,16 +1484,20 @@ export declare class HTMLView implements ElementView, SyntheticView {
1129
1484
  * Once a view has been disposed, it cannot be inserted or bound again.
1130
1485
  */
1131
1486
  dispose(): void;
1487
+ onUnbind(behavior: {
1488
+ unbind(controller: ViewController<TSource, TParent>): any;
1489
+ }): void;
1132
1490
  /**
1133
1491
  * Binds a view's behaviors to its binding source.
1134
1492
  * @param source - The binding source for the view's binding behaviors.
1135
1493
  * @param context - The execution context to run the behaviors within.
1136
1494
  */
1137
- bind(source: unknown, context: ExecutionContext): void;
1495
+ bind(source: TSource, context?: ExecutionContext<TParent>): void;
1138
1496
  /**
1139
1497
  * Unbinds a view's behaviors from its binding source.
1140
1498
  */
1141
1499
  unbind(): void;
1500
+ private evaluateUnbindables;
1142
1501
  /**
1143
1502
  * Efficiently disposes of a contiguous range of synthetic view instances.
1144
1503
  * @param views - A contiguous range of views to be disposed.
@@ -1147,40 +1506,65 @@ export declare class HTMLView implements ElementView, SyntheticView {
1147
1506
  }
1148
1507
 
1149
1508
  /**
1150
- * Core services shared across FAST instances.
1151
- * @internal
1509
+ * Observes array lengths.
1510
+ * @public
1152
1511
  */
1153
- export declare const enum KernelServiceId {
1154
- updateQueue = 1,
1155
- observable = 2,
1156
- contextEvent = 3,
1157
- elementRegistry = 4
1512
+ export declare interface LengthObserver extends Subscriber {
1513
+ /**
1514
+ * The length of the observed array.
1515
+ */
1516
+ length: number;
1158
1517
  }
1159
1518
 
1160
1519
  /**
1161
- * Reverses all readonly members, making them mutable.
1162
- * @internal
1520
+ * Enables observing the length of an array.
1521
+ * @param array - The array to observe the length of.
1522
+ * @returns The length of the array.
1523
+ * @public
1163
1524
  */
1164
- export declare type Mutable<T> = {
1165
- -readonly [P in keyof T]: T[P];
1166
- };
1525
+ export declare function lengthOf<T>(array: readonly T[]): number;
1167
1526
 
1168
1527
  /**
1169
- * A factory that can create a {@link Behavior} associated with a particular
1170
- * location within a DOM fragment.
1528
+ * Creates an event listener binding.
1529
+ * @param binding - The binding to invoke when the event is raised.
1530
+ * @param options - Event listener options.
1531
+ * @returns A binding configuration.
1532
+ * @public
1533
+ */
1534
+ export declare function listener<T = any>(binding: Expression<T>, options?: AddEventListenerOptions): Binding<T>;
1535
+
1536
+ /**
1537
+ * Common APIs related to markup generation.
1171
1538
  * @public
1172
1539
  */
1173
- export declare interface NodeBehaviorFactory {
1540
+ export declare const Markup: Readonly<{
1174
1541
  /**
1175
- * The index of the DOM node to which the created behavior will apply.
1542
+ * Creates a placeholder string suitable for marking out a location *within*
1543
+ * an attribute value or HTML content.
1544
+ * @param index - The directive index to create the placeholder for.
1545
+ * @remarks
1546
+ * Used internally by binding directives.
1176
1547
  */
1177
- targetIndex: number;
1548
+ interpolation: (id: string) => string;
1178
1549
  /**
1179
- * Creates a behavior for the provided target node.
1180
- * @param target - The node instance to create the behavior for.
1550
+ * Creates a placeholder that manifests itself as an attribute on an
1551
+ * element.
1552
+ * @param attributeName - The name of the custom attribute.
1553
+ * @param index - The directive index to create the placeholder for.
1554
+ * @remarks
1555
+ * Used internally by attribute directives such as `ref`, `slotted`, and `children`.
1181
1556
  */
1182
- createBehavior(target: Node): Behavior;
1183
- }
1557
+ attribute: (id: string) => string;
1558
+ /**
1559
+ * Creates a placeholder that manifests itself as a marker within the DOM structure.
1560
+ * @param index - The directive index to create the placeholder for.
1561
+ * @remarks
1562
+ * Used internally by structural directives such as `repeat`.
1563
+ */
1564
+ comment: (id: string) => string;
1565
+ }>;
1566
+
1567
+ /* Excluded from this release type: Mutable */
1184
1568
 
1185
1569
  /**
1186
1570
  * Options for configuring node observation behavior.
@@ -1203,61 +1587,80 @@ export declare interface NodeBehaviorOptions<T = any> {
1203
1587
 
1204
1588
  /**
1205
1589
  * A base class for node observation.
1206
- * @internal
1590
+ * @public
1591
+ * @remarks
1592
+ * Internally used by the SlottedDirective and the ChildrenDirective.
1207
1593
  */
1208
- declare abstract class NodeObservationBehavior<T extends NodeBehaviorOptions> implements Behavior {
1209
- protected target: HTMLElement;
1210
- protected options: T;
1211
- private source;
1212
- private shouldUpdate;
1594
+ export declare abstract class NodeObservationDirective<T extends NodeBehaviorOptions> extends StatelessAttachedAttributeDirective<T> {
1595
+ private sourceProperty;
1213
1596
  /**
1214
- * Creates an instance of NodeObservationBehavior.
1215
- * @param target - The target to assign the nodes property on.
1216
- * @param options - The options to use in configuring node observation.
1597
+ * Bind this behavior to the source.
1598
+ * @param source - The source to bind to.
1599
+ * @param context - The execution context that the binding is operating within.
1600
+ * @param targets - The targets that behaviors in a view can attach to.
1217
1601
  */
1218
- constructor(target: HTMLElement, options: T);
1602
+ bind(controller: ViewController): void;
1219
1603
  /**
1220
- * Begins observation of the nodes.
1604
+ * Unbinds this behavior from the source.
1605
+ * @param source - The source to unbind from.
1606
+ * @param context - The execution context that the binding is operating within.
1607
+ * @param targets - The targets that behaviors in a view can attach to.
1221
1608
  */
1222
- abstract observe(): void;
1609
+ unbind(controller: ViewController): void;
1223
1610
  /**
1224
- * Disconnects observation of the nodes.
1611
+ * Gets the data source for the target.
1612
+ * @param target - The target to get the source for.
1613
+ * @returns The source.
1225
1614
  */
1226
- abstract disconnect(): void;
1615
+ protected getSource(target: Node): any;
1227
1616
  /**
1228
- * Retrieves the nodes that should be assigned to the target.
1617
+ * Updates the source property with the computed nodes.
1618
+ * @param source - The source object to assign the nodes property to.
1619
+ * @param value - The nodes to assign to the source object property.
1229
1620
  */
1230
- protected abstract getNodes(): Node[];
1621
+ protected updateTarget(source: any, value: ReadonlyArray<any>): void;
1231
1622
  /**
1232
- * Bind this behavior to the source.
1233
- * @param source - The source to bind to.
1234
- * @param context - The execution context that the binding is operating within.
1623
+ * Computes the set of nodes that should be assigned to the source property.
1624
+ * @param target - The target to compute the nodes for.
1625
+ * @returns The computed nodes.
1626
+ * @remarks
1627
+ * Applies filters if provided.
1235
1628
  */
1236
- bind(source: any): void;
1629
+ protected computeNodes(target: any): Node[];
1237
1630
  /**
1238
- * Unbinds this behavior from the source.
1239
- * @param source - The source to unbind from.
1631
+ * Begins observation of the nodes.
1632
+ * @param target - The target to observe.
1240
1633
  */
1241
- unbind(): void;
1242
- /** @internal */
1243
- handleEvent(): void;
1244
- private computeNodes;
1245
- private updateTarget;
1634
+ protected abstract observe(target: any): void;
1635
+ /**
1636
+ * Disconnects observation of the nodes.
1637
+ * @param target - The target to unobserve.
1638
+ */
1639
+ protected abstract disconnect(target: any): void;
1640
+ /**
1641
+ * Retrieves the raw nodes that should be assigned to the source property.
1642
+ * @param target - The target to get the node to.
1643
+ */
1644
+ protected abstract getNodes(target: any): Node[];
1246
1645
  }
1247
1646
 
1248
- declare function normalBind(this: BindingBehavior, source: unknown, context: ExecutionContext): void;
1249
-
1250
- declare function normalUnbind(this: BindingBehavior): void;
1647
+ /**
1648
+ * Normalizes the input value into a binding.
1649
+ * @param value - The value to create the default binding for.
1650
+ * @returns A binding configuration for the provided value.
1651
+ * @public
1652
+ */
1653
+ export declare function normalizeBinding<TSource = any, TReturn = any, TParent = any>(value: Expression<TSource, TReturn, TParent> | Binding<TSource, TReturn, TParent> | {}): Binding<TSource, TReturn, TParent>;
1251
1654
 
1252
1655
  /**
1253
- * Provides change notification for a source object.
1656
+ * Provides change notifications for an observed subject.
1254
1657
  * @public
1255
1658
  */
1256
1659
  export declare interface Notifier {
1257
1660
  /**
1258
- * The source object that this notifier provides change notification for.
1661
+ * The object that subscribers will receive notifications for.
1259
1662
  */
1260
- readonly source: any;
1663
+ readonly subject: any;
1261
1664
  /**
1262
1665
  * Notifies all subscribers, based on the args.
1263
1666
  * @param args - Data passed along to subscribers during notification.
@@ -1298,16 +1701,12 @@ export declare const nullableNumberConverter: ValueConverter;
1298
1701
  * @public
1299
1702
  */
1300
1703
  export declare const Observable: Readonly<{
1301
- /**
1302
- * @internal
1303
- * @param factory - The factory used to create array observers.
1304
- */
1305
- setArrayObserverFactory(factory: (collection: any[]) => Notifier): void;
1704
+ /* Excluded from this release type: setArrayObserverFactory */
1306
1705
  /**
1307
1706
  * Gets a notifier for an object or Array.
1308
1707
  * @param source - The object or Array to get the notifier for.
1309
1708
  */
1310
- getNotifier: (source: any) => Notifier;
1709
+ getNotifier: <T extends Notifier = Notifier>(source: any) => T;
1311
1710
  /**
1312
1711
  * Records a property change for a source object.
1313
1712
  * @param source - The object to record the change against.
@@ -1339,19 +1738,19 @@ export declare const Observable: Readonly<{
1339
1738
  */
1340
1739
  getAccessors: (target: {}) => Accessor[];
1341
1740
  /**
1342
- * Creates a {@link BindingObserver} that can watch the
1343
- * provided {@link Binding} for changes.
1344
- * @param binding - The binding to observe.
1741
+ * Creates a {@link ExpressionNotifier} that can watch the
1742
+ * provided {@link Expression} for changes.
1743
+ * @param expression - The binding to observe.
1345
1744
  * @param initialSubscriber - An initial subscriber to changes in the binding value.
1346
1745
  * @param isVolatileBinding - Indicates whether the binding's dependency list must be re-evaluated on every value evaluation.
1347
1746
  */
1348
- binding<TSource = any, TReturn = any, TParent = any>(binding: Binding<TSource, TReturn, TParent>, initialSubscriber?: Subscriber | undefined, isVolatileBinding?: boolean): BindingObserver<TSource, TReturn, TParent>;
1747
+ binding<TSource = any, TReturn = any>(expression: Expression<TSource, TReturn, any>, initialSubscriber?: Subscriber, isVolatileBinding?: boolean): ExpressionNotifier<TSource, TReturn, any>;
1349
1748
  /**
1350
1749
  * Determines whether a binding expression is volatile and needs to have its dependency list re-evaluated
1351
1750
  * on every evaluation of the value.
1352
- * @param binding - The binding to inspect.
1751
+ * @param expression - The binding to inspect.
1353
1752
  */
1354
- isVolatileBinding<TSource_1 = any, TReturn_1 = any, TParent_1 = any>(binding: Binding<TSource_1, TReturn_1, TParent_1>): boolean;
1753
+ isVolatileBinding<TSource_1 = any, TReturn_1 = any>(expression: Expression<TSource_1, TReturn_1, any>): boolean;
1355
1754
  }>;
1356
1755
 
1357
1756
  /**
@@ -1377,6 +1776,30 @@ export declare interface ObservationRecord {
1377
1776
  propertyName: string;
1378
1777
  }
1379
1778
 
1779
+ /**
1780
+ * Creates a one time binding
1781
+ * @param binding - The binding to refresh when signaled.
1782
+ * @returns A binding configuration.
1783
+ * @public
1784
+ */
1785
+ export declare function oneTime<T = any>(binding: Expression<T>): Binding<T>;
1786
+
1787
+ /**
1788
+ * Common APIs related to content parsing.
1789
+ * @public
1790
+ */
1791
+ export declare const Parser: Readonly<{
1792
+ /**
1793
+ * Parses text content or HTML attribute content, separating out the static strings
1794
+ * from the directives.
1795
+ * @param value - The content or attribute string to parse.
1796
+ * @param factories - A list of directives to search for in the string.
1797
+ * @returns A heterogeneous array of static strings interspersed with
1798
+ * directives or null if no directives are found in the string.
1799
+ */
1800
+ parse(value: string, factories: Record<string, ViewBehaviorFactory>): (string | ViewBehaviorFactory)[] | null;
1801
+ }>;
1802
+
1380
1803
  /**
1381
1804
  * Represents metadata configuration for a custom element.
1382
1805
  * @public
@@ -1400,12 +1823,33 @@ export declare interface PartialFASTElementDefinition {
1400
1823
  readonly attributes?: (AttributeConfiguration | string)[];
1401
1824
  /**
1402
1825
  * Options controlling the creation of the custom element's shadow DOM.
1826
+ * @remarks
1827
+ * If not provided, defaults to an open shadow root. Provide null
1828
+ * to render to the associated template to the light DOM instead.
1403
1829
  */
1404
- readonly shadowOptions?: Partial<ShadowRootInit> | null;
1830
+ readonly shadowOptions?: Partial<ShadowRootOptions> | null;
1405
1831
  /**
1406
1832
  * Options controlling how the custom element is defined with the platform.
1407
1833
  */
1408
1834
  readonly elementOptions?: ElementDefinitionOptions;
1835
+ /**
1836
+ * The registry to register this component in by default.
1837
+ * @remarks
1838
+ * If not provided, defaults to the global registry.
1839
+ */
1840
+ readonly registry?: CustomElementRegistry;
1841
+ }
1842
+
1843
+ /**
1844
+ * Represents metadata configuration for an HTMLDirective.
1845
+ * @public
1846
+ */
1847
+ export declare interface PartialHTMLDirectiveDefinition {
1848
+ /**
1849
+ * Indicates whether the directive needs access to template contextual information
1850
+ * such as the sourceAspect, targetAspect, and aspectType.
1851
+ */
1852
+ aspected?: boolean;
1409
1853
  }
1410
1854
 
1411
1855
  /**
@@ -1415,16 +1859,16 @@ export declare interface PartialFASTElementDefinition {
1415
1859
  */
1416
1860
  export declare class PropertyChangeNotifier implements Notifier {
1417
1861
  private subscribers;
1418
- private sourceSubscribers;
1862
+ private subjectSubscribers;
1419
1863
  /**
1420
- * The source that property changes are being notified for.
1864
+ * The subject that property changes are being notified for.
1421
1865
  */
1422
- readonly source: any;
1866
+ readonly subject: any;
1423
1867
  /**
1424
- * Creates an instance of PropertyChangeNotifier for the specified source.
1425
- * @param source - The object source that subscribers will receive notifications from.
1868
+ * Creates an instance of PropertyChangeNotifier for the specified subject.
1869
+ * @param subject - The object that subscribers will receive notifications for.
1426
1870
  */
1427
- constructor(source: any);
1871
+ constructor(subject: any);
1428
1872
  /**
1429
1873
  * Notifies all subscribers, based on the specified property.
1430
1874
  * @param propertyName - The property name, passed along to subscribers during notification.
@@ -1449,86 +1893,72 @@ export declare class PropertyChangeNotifier implements Notifier {
1449
1893
  * @param propertyName - The name of the property to assign the reference to.
1450
1894
  * @public
1451
1895
  */
1452
- export declare function ref<T = any>(propertyName: keyof T & string): CaptureType<T>;
1896
+ export declare const ref: <TSource = any, TParent = any>(propertyName: keyof TSource & string) => CaptureType<TSource, TParent>;
1453
1897
 
1454
1898
  /**
1455
1899
  * The runtime behavior for template references.
1456
1900
  * @public
1457
1901
  */
1458
- export declare class RefBehavior implements Behavior {
1459
- private target;
1460
- private propertyName;
1461
- /**
1462
- * Creates an instance of RefBehavior.
1463
- * @param target - The element to reference.
1464
- * @param propertyName - The name of the property to assign the reference to.
1465
- */
1466
- constructor(target: HTMLElement, propertyName: string);
1467
- /**
1468
- * Bind this behavior to the source.
1469
- * @param source - The source to bind to.
1470
- * @param context - The execution context that the binding is operating within.
1471
- */
1472
- bind(source: any): void;
1902
+ export declare class RefDirective extends StatelessAttachedAttributeDirective<string> {
1473
1903
  /**
1474
- * Unbinds this behavior from the source.
1475
- * @param source - The source to unbind from.
1904
+ * Bind this behavior.
1905
+ * @param controller - The view controller that manages the lifecycle of this behavior.
1476
1906
  */
1477
- unbind(): void;
1907
+ bind(controller: ViewController): void;
1478
1908
  }
1479
1909
 
1910
+ declare const reflectMode = "reflect";
1911
+
1480
1912
  /**
1481
1913
  * A directive that enables list rendering.
1482
- * @param itemsBinding - The array to render.
1483
- * @param templateOrTemplateBinding - The template or a template binding used obtain a template
1914
+ * @param items - The array to render.
1915
+ * @param template - The template or a template binding used obtain a template
1484
1916
  * to render for each item in the array.
1485
1917
  * @param options - Options used to turn on special repeat features.
1486
1918
  * @public
1487
1919
  */
1488
- export declare function repeat<TSource = any, TItem = any>(itemsBinding: Binding<TSource, readonly TItem[]>, templateOrTemplateBinding: SyntheticViewTemplate | Binding<TSource, SyntheticViewTemplate>, options?: RepeatOptions): CaptureType<TSource>;
1920
+ 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>;
1489
1921
 
1490
1922
  /**
1491
1923
  * A behavior that renders a template for each item in an array.
1492
1924
  * @public
1493
1925
  */
1494
- export declare class RepeatBehavior<TSource = any> implements Behavior, Subscriber {
1926
+ export declare class RepeatBehavior<TSource = any> implements ViewBehavior, Subscriber {
1927
+ private directive;
1495
1928
  private location;
1496
- private itemsBinding;
1497
- private templateBinding;
1498
- private options;
1499
- private source;
1929
+ private controller;
1500
1930
  private views;
1501
1931
  private template;
1502
1932
  private templateBindingObserver;
1503
1933
  private items;
1504
1934
  private itemsObserver;
1505
1935
  private itemsBindingObserver;
1506
- private originalContext;
1507
- private childContext;
1508
1936
  private bindView;
1509
1937
  /**
1510
1938
  * Creates an instance of RepeatBehavior.
1511
1939
  * @param location - The location in the DOM to render the repeat.
1512
- * @param itemsBinding - The array to render.
1940
+ * @param dataBinding - The array to render.
1513
1941
  * @param isItemsBindingVolatile - Indicates whether the items binding has volatile dependencies.
1514
1942
  * @param templateBinding - The template to render for each item.
1515
1943
  * @param isTemplateBindingVolatile - Indicates whether the template binding has volatile dependencies.
1516
1944
  * @param options - Options used to turn on special repeat features.
1517
1945
  */
1518
- constructor(location: Node, itemsBinding: Binding<TSource, any[]>, isItemsBindingVolatile: boolean, templateBinding: Binding<TSource, SyntheticViewTemplate>, isTemplateBindingVolatile: boolean, options: RepeatOptions);
1946
+ constructor(directive: RepeatDirective);
1519
1947
  /**
1520
- * Bind this behavior to the source.
1521
- * @param source - The source to bind to.
1522
- * @param context - The execution context that the binding is operating within.
1948
+ * Bind this behavior.
1949
+ * @param controller - The view controller that manages the lifecycle of this behavior.
1523
1950
  */
1524
- bind(source: TSource, context: ExecutionContext): void;
1951
+ bind(controller: ViewController): void;
1525
1952
  /**
1526
- * Unbinds this behavior from the source.
1527
- * @param source - The source to unbind from.
1953
+ * Unbinds this behavior.
1528
1954
  */
1529
1955
  unbind(): void;
1530
- /** @internal */
1531
- handleChange(source: any, args: Splice[]): void;
1956
+ /**
1957
+ * Handles changes in the array, its items, and the repeat template.
1958
+ * @param source - The source of the change.
1959
+ * @param args - The details about what was changed.
1960
+ */
1961
+ handleChange(source: any, args: Splice[] | ExpressionObserver): void;
1532
1962
  private observeItems;
1533
1963
  private updateViews;
1534
1964
  private refreshAllViews;
@@ -1539,29 +1969,35 @@ export declare class RepeatBehavior<TSource = any> implements Behavior, Subscrib
1539
1969
  * A directive that configures list rendering.
1540
1970
  * @public
1541
1971
  */
1542
- export declare class RepeatDirective<TSource = any> extends HTMLDirective {
1543
- readonly itemsBinding: Binding;
1972
+ export declare class RepeatDirective<TSource = any> implements HTMLDirective, ViewBehaviorFactory {
1973
+ readonly dataBinding: Binding<TSource>;
1544
1974
  readonly templateBinding: Binding<TSource, SyntheticViewTemplate>;
1545
1975
  readonly options: RepeatOptions;
1546
- private isItemsBindingVolatile;
1547
- private isTemplateBindingVolatile;
1976
+ /**
1977
+ * The unique id of the factory.
1978
+ */
1979
+ id: string;
1980
+ /**
1981
+ * The structural id of the DOM node to which the created behavior will apply.
1982
+ */
1983
+ nodeId: string;
1548
1984
  /**
1549
1985
  * Creates a placeholder string based on the directive's index within the template.
1550
1986
  * @param index - The index of the directive within the template.
1551
1987
  */
1552
- createPlaceholder: (index: number) => string;
1988
+ createHTML(add: AddViewBehaviorFactory): string;
1553
1989
  /**
1554
1990
  * Creates an instance of RepeatDirective.
1555
- * @param itemsBinding - The binding that provides the array to render.
1991
+ * @param dataBinding - The binding that provides the array to render.
1556
1992
  * @param templateBinding - The template binding used to obtain a template to render for each item in the array.
1557
1993
  * @param options - Options used to turn on special repeat features.
1558
1994
  */
1559
- constructor(itemsBinding: Binding, templateBinding: Binding<TSource, SyntheticViewTemplate>, options: RepeatOptions);
1995
+ constructor(dataBinding: Binding<TSource>, templateBinding: Binding<TSource, SyntheticViewTemplate>, options: RepeatOptions);
1560
1996
  /**
1561
1997
  * Creates a behavior for the provided target node.
1562
1998
  * @param target - The node instance to create the behavior for.
1563
1999
  */
1564
- createBehavior(target: Node): RepeatBehavior<TSource>;
2000
+ createBehavior(): RepeatBehavior<TSource>;
1565
2001
  }
1566
2002
 
1567
2003
  /**
@@ -1579,63 +2015,285 @@ export declare interface RepeatOptions {
1579
2015
  recycle?: boolean;
1580
2016
  }
1581
2017
 
2018
+ /**
2019
+ * Shadow root initialization options.
2020
+ * @public
2021
+ */
2022
+ export declare interface ShadowRootOptions extends ShadowRootInit {
2023
+ /**
2024
+ * A registry that provides the custom elements visible
2025
+ * from within this shadow root.
2026
+ * @beta
2027
+ */
2028
+ registry?: CustomElementRegistry;
2029
+ }
2030
+
1582
2031
  /**
1583
2032
  * A directive that observes the `assignedNodes()` of a slot and updates a property
1584
2033
  * whenever they change.
1585
2034
  * @param propertyOrOptions - The options used to configure slotted node observation.
1586
2035
  * @public
1587
2036
  */
1588
- export declare function slotted<T = any>(propertyOrOptions: (keyof T & string) | SlottedBehaviorOptions<keyof T & string>): CaptureType<T>;
2037
+ export declare function slotted<TSource = any, TParent = any>(propertyOrOptions: (keyof TSource & string) | SlottedDirectiveOptions<keyof TSource & string>): CaptureType<TSource, TParent>;
1589
2038
 
1590
2039
  /**
1591
2040
  * The runtime behavior for slotted node observation.
1592
2041
  * @public
1593
2042
  */
1594
- export declare class SlottedBehavior extends NodeObservationBehavior<SlottedBehaviorOptions> {
1595
- /**
1596
- * Creates an instance of SlottedBehavior.
1597
- * @param target - The slot element target to observe.
1598
- * @param options - The options to use when observing the slot.
1599
- */
1600
- constructor(target: HTMLSlotElement, options: SlottedBehaviorOptions);
2043
+ export declare class SlottedDirective extends NodeObservationDirective<SlottedDirectiveOptions> {
1601
2044
  /**
1602
2045
  * Begins observation of the nodes.
2046
+ * @param target - The target to observe.
1603
2047
  */
1604
- observe(): void;
2048
+ observe(target: EventSource): void;
1605
2049
  /**
1606
2050
  * Disconnects observation of the nodes.
2051
+ * @param target - The target to unobserve.
1607
2052
  */
1608
- disconnect(): void;
2053
+ disconnect(target: EventSource): void;
1609
2054
  /**
1610
- * Retrieves the nodes that should be assigned to the target.
2055
+ * Retrieves the raw nodes that should be assigned to the source property.
2056
+ * @param target - The target to get the node to.
1611
2057
  */
1612
- protected getNodes(): Node[];
2058
+ getNodes(target: HTMLSlotElement): Node[];
2059
+ /* Excluded from this release type: handleEvent */
1613
2060
  }
1614
2061
 
1615
2062
  /**
1616
2063
  * The options used to configure slotted node observation.
1617
2064
  * @public
1618
2065
  */
1619
- export declare interface SlottedBehaviorOptions<T = any> extends NodeBehaviorOptions<T>, AssignedNodesOptions {
2066
+ export declare interface SlottedDirectiveOptions<T = any> extends NodeBehaviorOptions<T>, AssignedNodesOptions {
1620
2067
  }
1621
2068
 
1622
2069
  /**
1623
- * Represents a set of splice-based changes against an Array.
2070
+ * Describes how the source's lifetime relates to its controller's lifetime.
1624
2071
  * @public
1625
2072
  */
1626
- export declare interface Splice {
2073
+ export declare const SourceLifetime: Readonly<{
1627
2074
  /**
1628
- * The index that the splice occurs at.
2075
+ * The source to controller lifetime relationship is unknown.
1629
2076
  */
1630
- index: number;
2077
+ readonly unknown: undefined;
1631
2078
  /**
1632
- * The items that were removed.
2079
+ * The source and controller lifetimes are coupled to one another.
2080
+ * They can/will be GC'd together.
1633
2081
  */
2082
+ readonly coupled: 1;
2083
+ }>;
2084
+
2085
+ /**
2086
+ * Describes how the source's lifetime relates to its controller's lifetime.
2087
+ * @public
2088
+ */
2089
+ export declare type SourceLifetime = typeof SourceLifetime[keyof typeof SourceLifetime];
2090
+
2091
+ /**
2092
+ * A splice map is a representation of how a previous array of items
2093
+ * was transformed into a new array of items. Conceptually it is a list of
2094
+ * tuples of
2095
+ *
2096
+ * (index, removed, addedCount)
2097
+ *
2098
+ * which are kept in ascending index order of. The tuple represents that at
2099
+ * the |index|, |removed| sequence of items were removed, and counting forward
2100
+ * from |index|, |addedCount| items were added.
2101
+ * @public
2102
+ */
2103
+ export declare class Splice {
2104
+ index: number;
1634
2105
  removed: any[];
2106
+ addedCount: number;
1635
2107
  /**
1636
- * The number of items that were added.
2108
+ * Indicates that this splice represents a complete array reset.
1637
2109
  */
1638
- addedCount: number;
2110
+ reset?: boolean;
2111
+ /**
2112
+ * Creates a splice.
2113
+ * @param index - The index that the splice occurs at.
2114
+ * @param removed - The items that were removed.
2115
+ * @param addedCount - The number of items that were added.
2116
+ */
2117
+ constructor(index: number, removed: any[], addedCount: number);
2118
+ /**
2119
+ * Adjusts the splice index based on the provided array.
2120
+ * @param array - The array to adjust to.
2121
+ * @returns The same splice, mutated based on the reference array.
2122
+ */
2123
+ adjustTo(array: any[]): this;
2124
+ }
2125
+
2126
+ /**
2127
+ * An approach to tracking changes in an array.
2128
+ * @public
2129
+ */
2130
+ export declare interface SpliceStrategy {
2131
+ /**
2132
+ * The level of feature support the splice strategy provides.
2133
+ */
2134
+ readonly support: SpliceStrategySupport;
2135
+ /**
2136
+ * Normalizes the splices before delivery to array change subscribers.
2137
+ * @param previous - The previous version of the array if a reset has taken place.
2138
+ * @param current - The current version of the array.
2139
+ * @param changes - The set of changes tracked against the array.
2140
+ */
2141
+ normalize(previous: unknown[] | undefined, current: unknown[], changes: Splice[] | undefined): readonly Splice[];
2142
+ /**
2143
+ * Performs and tracks a pop operation on an array.
2144
+ * @param array - The array to track the change for.
2145
+ * @param observer - The observer to register the change with.
2146
+ * @param pop - The operation to perform.
2147
+ * @param args - The arguments for the operation.
2148
+ */
2149
+ pop(array: any[], observer: ArrayObserver, pop: typeof Array.prototype.pop, args: any[]): any;
2150
+ /**
2151
+ * Performs and tracks a push operation on an array.
2152
+ * @param array - The array to track the change for.
2153
+ * @param observer - The observer to register the change with.
2154
+ * @param push - The operation to perform.
2155
+ * @param args - The arguments for the operation.
2156
+ */
2157
+ push(array: any[], observer: ArrayObserver, push: typeof Array.prototype.push, args: any[]): any;
2158
+ /**
2159
+ * Performs and tracks a reverse operation on an array.
2160
+ * @param array - The array to track the change for.
2161
+ * @param observer - The observer to register the change with.
2162
+ * @param reverse - The operation to perform.
2163
+ * @param args - The arguments for the operation.
2164
+ */
2165
+ reverse(array: any[], observer: ArrayObserver, reverse: typeof Array.prototype.reverse, args: any[]): any;
2166
+ /**
2167
+ * Performs and tracks a shift operation on an array.
2168
+ * @param array - The array to track the change for.
2169
+ * @param observer - The observer to register the change with.
2170
+ * @param shift - The operation to perform.
2171
+ * @param args - The arguments for the operation.
2172
+ */
2173
+ shift(array: any[], observer: ArrayObserver, shift: typeof Array.prototype.shift, args: any[]): any;
2174
+ /**
2175
+ * Performs and tracks a sort operation on an array.
2176
+ * @param array - The array to track the change for.
2177
+ * @param observer - The observer to register the change with.
2178
+ * @param sort - The operation to perform.
2179
+ * @param args - The arguments for the operation.
2180
+ */
2181
+ sort(array: any[], observer: ArrayObserver, sort: typeof Array.prototype.sort, args: any[]): any[];
2182
+ /**
2183
+ * Performs and tracks a splice operation on an array.
2184
+ * @param array - The array to track the change for.
2185
+ * @param observer - The observer to register the change with.
2186
+ * @param splice - The operation to perform.
2187
+ * @param args - The arguments for the operation.
2188
+ */
2189
+ splice(array: any[], observer: ArrayObserver, splice: typeof Array.prototype.splice, args: any[]): any;
2190
+ /**
2191
+ * Performs and tracks an unshift operation on an array.
2192
+ * @param array - The array to track the change for.
2193
+ * @param observer - The observer to register the change with.
2194
+ * @param unshift - The operation to perform.
2195
+ * @param args - The arguments for the operation.
2196
+ */
2197
+ unshift(array: any[], observer: ArrayObserver, unshift: typeof Array.prototype.unshift, args: any[]): any[];
2198
+ }
2199
+
2200
+ /**
2201
+ * Functionality related to tracking changes in arrays.
2202
+ * @public
2203
+ */
2204
+ export declare const SpliceStrategy: Readonly<{
2205
+ /**
2206
+ * A set of changes that represent a full array reset.
2207
+ */
2208
+ readonly reset: Splice[];
2209
+ /**
2210
+ * Sets the default strategy to use for array observers.
2211
+ * @param strategy - The splice strategy to use.
2212
+ */
2213
+ readonly setDefaultStrategy: (strategy: SpliceStrategy) => void;
2214
+ }>;
2215
+
2216
+ /**
2217
+ * Indicates what level of feature support the splice
2218
+ * strategy provides.
2219
+ * @public
2220
+ */
2221
+ export declare const SpliceStrategySupport: Readonly<{
2222
+ /**
2223
+ * Only supports resets.
2224
+ */
2225
+ readonly reset: 1;
2226
+ /**
2227
+ * Supports tracking splices and resets.
2228
+ */
2229
+ readonly splice: 2;
2230
+ /**
2231
+ * Supports tracking splices and resets, while applying some form
2232
+ * of optimization, such as merging, to the splices.
2233
+ */
2234
+ readonly optimized: 3;
2235
+ }>;
2236
+
2237
+ /**
2238
+ * The available values for SpliceStrategySupport.
2239
+ * @public
2240
+ */
2241
+ export declare type SpliceStrategySupport = typeof SpliceStrategySupport[keyof typeof SpliceStrategySupport];
2242
+
2243
+ /**
2244
+ * A base class used for attribute directives that don't need internal state.
2245
+ * @public
2246
+ */
2247
+ export declare abstract class StatelessAttachedAttributeDirective<TOptions> implements HTMLDirective, ViewBehaviorFactory, ViewBehavior {
2248
+ protected options: TOptions;
2249
+ /**
2250
+ * The unique id of the factory.
2251
+ */
2252
+ id: string;
2253
+ /**
2254
+ * The structural id of the DOM node to which the created behavior will apply.
2255
+ */
2256
+ nodeId: string;
2257
+ /**
2258
+ * Creates an instance of RefDirective.
2259
+ * @param options - The options to use in configuring the directive.
2260
+ */
2261
+ constructor(options: TOptions);
2262
+ /**
2263
+ * Creates a placeholder string based on the directive's index within the template.
2264
+ * @param index - The index of the directive within the template.
2265
+ * @remarks
2266
+ * Creates a custom attribute placeholder.
2267
+ */
2268
+ createHTML(add: AddViewBehaviorFactory): string;
2269
+ /**
2270
+ * Creates a behavior.
2271
+ * @param targets - The targets available for behaviors to be attached to.
2272
+ */
2273
+ createBehavior(): ViewBehavior;
2274
+ /**
2275
+ * Bind this behavior.
2276
+ * @param controller - The view controller that manages the lifecycle of this behavior.
2277
+ */
2278
+ abstract bind(controller: ViewController): void;
2279
+ }
2280
+
2281
+ /**
2282
+ * Implemented to provide specific behavior when adding/removing styles
2283
+ * for elements.
2284
+ * @public
2285
+ */
2286
+ export declare interface StyleStrategy {
2287
+ /**
2288
+ * Adds styles to the target.
2289
+ * @param target - The target to add the styles to.
2290
+ */
2291
+ addStylesTo(target: StyleTarget): void;
2292
+ /**
2293
+ * Removes styles from the target.
2294
+ * @param target - The target to remove the styles from.
2295
+ */
2296
+ removeStylesFrom(target: StyleTarget): void;
1639
2297
  }
1640
2298
 
1641
2299
  /**
@@ -1652,12 +2310,6 @@ export declare interface StyleTarget {
1652
2310
  * @param styles - The styles element to add.
1653
2311
  */
1654
2312
  append(styles: HTMLStyleElement): void;
1655
- /**
1656
- * Adds styles to the target by prepending the styles.
1657
- * @param styles - The styles element to add.
1658
- * @deprecated - use append()
1659
- */
1660
- prepend(styles: HTMLStyleElement): void;
1661
2313
  /**
1662
2314
  * Removes styles from the target.
1663
2315
  * @param styles - The styles element to remove.
@@ -1676,17 +2328,17 @@ export declare interface StyleTarget {
1676
2328
  */
1677
2329
  export declare interface Subscriber {
1678
2330
  /**
1679
- * Called when a source this instance has subscribed to changes.
1680
- * @param source - The source of the change.
2331
+ * Called when a subject this instance has subscribed to changes.
2332
+ * @param subject - The subject of the change.
1681
2333
  * @param args - The event args detailing the change that occurred.
1682
2334
  */
1683
- handleChange(source: any, args: any): void;
2335
+ handleChange(subject: any, args: any): void;
1684
2336
  }
1685
2337
 
1686
2338
  /**
1687
2339
  * An implementation of {@link Notifier} that efficiently keeps track of
1688
2340
  * subscribers interested in a specific change notification on an
1689
- * observable source.
2341
+ * observable subject.
1690
2342
  *
1691
2343
  * @remarks
1692
2344
  * This set is optimized for the most common scenario of 1 or 2 subscribers.
@@ -1699,15 +2351,15 @@ export declare class SubscriberSet implements Notifier {
1699
2351
  private sub2;
1700
2352
  private spillover;
1701
2353
  /**
1702
- * The source that this subscriber set is reporting changes for.
2354
+ * The object that subscribers will receive notifications for.
1703
2355
  */
1704
- readonly source: any;
2356
+ readonly subject: any;
1705
2357
  /**
1706
- * Creates an instance of SubscriberSet for the specified source.
1707
- * @param source - The object source that subscribers will receive notifications from.
2358
+ * Creates an instance of SubscriberSet for the specified subject.
2359
+ * @param subject - The subject that subscribers will receive notifications from.
1708
2360
  * @param initialSubscriber - An initial subscriber to changes.
1709
2361
  */
1710
- constructor(source: any, initialSubscriber?: Subscriber);
2362
+ constructor(subject: any, initialSubscriber?: Subscriber);
1711
2363
  /**
1712
2364
  * Checks whether the provided subscriber has been added to this set.
1713
2365
  * @param subscriber - The subscriber to test for inclusion in this set.
@@ -1734,7 +2386,7 @@ export declare class SubscriberSet implements Notifier {
1734
2386
  * The options used to configure subtree observation.
1735
2387
  * @public
1736
2388
  */
1737
- export declare interface SubtreeBehaviorOptions<T = any> extends Omit<NodeBehaviorOptions<T>, "filter">, Omit<MutationObserverInit, "subtree" | "childList"> {
2389
+ export declare interface SubtreeDirectiveOptions<T = any> extends NodeBehaviorOptions<T>, Omit<MutationObserverInit, "subtree" | "childList"> {
1738
2390
  /**
1739
2391
  * Indicates that child subtrees should be observed for changes.
1740
2392
  */
@@ -1750,7 +2402,7 @@ export declare interface SubtreeBehaviorOptions<T = any> extends Omit<NodeBehavi
1750
2402
  * A view representing a range of DOM nodes which can be added/removed ad hoc.
1751
2403
  * @public
1752
2404
  */
1753
- export declare interface SyntheticView extends View {
2405
+ export declare interface SyntheticView<TSource = any, TParent = any> extends View<TSource, TParent> {
1754
2406
  /**
1755
2407
  * The first DOM node in the range of nodes that make up the view.
1756
2408
  */
@@ -1769,11 +2421,6 @@ export declare interface SyntheticView extends View {
1769
2421
  * The nodes are not disposed and the view can later be re-inserted.
1770
2422
  */
1771
2423
  remove(): void;
1772
- /**
1773
- * Removes the view and unbinds its behaviors, disposing of DOM nodes afterward.
1774
- * Once a view has been disposed, it cannot be inserted or bound again.
1775
- */
1776
- dispose(): void;
1777
2424
  }
1778
2425
 
1779
2426
  /**
@@ -1784,31 +2431,14 @@ export declare interface SyntheticViewTemplate<TSource = any, TParent = any> {
1784
2431
  /**
1785
2432
  * Creates a SyntheticView instance based on this template definition.
1786
2433
  */
1787
- create(): SyntheticView;
1788
- }
1789
-
1790
- /**
1791
- * A {@link HTMLDirective} that targets a named attribute or property on a node.
1792
- * @public
1793
- */
1794
- export declare abstract class TargetedHTMLDirective extends HTMLDirective {
1795
- /**
1796
- * Gets/sets the name of the attribute or property that this
1797
- * directive is targeting on the associated node.
1798
- */
1799
- abstract targetName: string | undefined;
1800
- /**
1801
- * Creates a placeholder string based on the directive's index within the template.
1802
- * @param index - The index of the directive within the template.
1803
- */
1804
- createPlaceholder: (index: number) => string;
2434
+ create(): SyntheticView<TSource, TParent>;
1805
2435
  }
1806
2436
 
1807
2437
  /**
1808
2438
  * Represents the types of values that can be interpolated into a template.
1809
2439
  * @public
1810
2440
  */
1811
- export declare type TemplateValue<TScope, TParent = any> = Binding<TScope, any, TParent> | string | number | HTMLDirective | CaptureType<TScope>;
2441
+ export declare type TemplateValue<TSource, TParent = any> = Expression<TSource, any, TParent> | Binding<TSource, any, TParent> | HTMLDirective | CaptureType<TSource, TParent>;
1812
2442
 
1813
2443
  /**
1814
2444
  * Enables working with trusted types.
@@ -1835,7 +2465,50 @@ export declare type TrustedTypesPolicy = {
1835
2465
  createHTML(html: string): string;
1836
2466
  };
1837
2467
 
1838
- declare function updatePropertyTarget(this: BindingBehavior, value: unknown): void;
2468
+ /* Excluded from this release type: TypeDefinition */
2469
+
2470
+ /* Excluded from this release type: TypeRegistry */
2471
+
2472
+ /**
2473
+ * A work queue used to synchronize writes to the DOM.
2474
+ * @public
2475
+ */
2476
+ export declare interface UpdateQueue {
2477
+ /**
2478
+ * Schedules DOM update work in the next batch.
2479
+ * @param callable - The callable function or object to queue.
2480
+ */
2481
+ enqueue(callable: Callable): void;
2482
+ /**
2483
+ * Resolves with the next DOM update.
2484
+ */
2485
+ next(): Promise<void>;
2486
+ /**
2487
+ * Immediately processes all work previously scheduled
2488
+ * through enqueue.
2489
+ * @remarks
2490
+ * This also forces next() promises
2491
+ * to resolve.
2492
+ */
2493
+ process(): void;
2494
+ /**
2495
+ * Sets the update mode used by enqueue.
2496
+ * @param isAsync - Indicates whether DOM updates should be asynchronous.
2497
+ * @remarks
2498
+ * By default, the update mode is asynchronous, since that provides the best
2499
+ * performance in the browser. Passing false to setMode will instead cause
2500
+ * the queue to be immediately processed for each call to enqueue. However,
2501
+ * ordering will still be preserved so that nested tasks do not run until
2502
+ * after parent tasks complete.
2503
+ */
2504
+ setMode(isAsync: boolean): void;
2505
+ }
2506
+
2507
+ /**
2508
+ * The default UpdateQueue.
2509
+ * @public
2510
+ */
2511
+ export declare const Updates: UpdateQueue;
1839
2512
 
1840
2513
  /**
1841
2514
  * Represents objects that can convert values to and from
@@ -1859,43 +2532,122 @@ export declare interface ValueConverter {
1859
2532
  * Represents a collection of DOM nodes which can be bound to a data source.
1860
2533
  * @public
1861
2534
  */
1862
- export declare interface View {
2535
+ export declare interface View<TSource = any, TParent = any> extends Disposable {
1863
2536
  /**
1864
2537
  * The execution context the view is running within.
1865
2538
  */
1866
- readonly context: ExecutionContext | null;
2539
+ readonly context: ExecutionContext<TParent>;
1867
2540
  /**
1868
2541
  * The data that the view is bound to.
1869
2542
  */
1870
- readonly source: any | null;
2543
+ readonly source: TSource | null;
1871
2544
  /**
1872
2545
  * Binds a view's behaviors to its binding source.
1873
2546
  * @param source - The binding source for the view's binding behaviors.
1874
- * @param context - The execution context to run the view within.
1875
2547
  */
1876
- bind(source: unknown, context: ExecutionContext): void;
2548
+ bind(source: TSource, context?: ExecutionContext<TParent>): void;
1877
2549
  /**
1878
2550
  * Unbinds a view's behaviors from its binding source and context.
1879
2551
  */
1880
2552
  unbind(): void;
2553
+ }
2554
+
2555
+ /**
2556
+ * Represents an object that can contribute behavior to a view.
2557
+ * @public
2558
+ */
2559
+ export declare interface ViewBehavior<TSource = any, TParent = any> {
1881
2560
  /**
1882
- * Removes the view and unbinds its behaviors, disposing of DOM nodes afterward.
1883
- * Once a view has been disposed, it cannot be inserted or bound again.
2561
+ * Bind this behavior.
2562
+ * @param controller - The view controller that manages the lifecycle of this behavior.
1884
2563
  */
1885
- dispose(): void;
2564
+ bind(controller: ViewController<TSource, TParent>): void;
2565
+ }
2566
+
2567
+ /**
2568
+ * A factory that can create a {@link ViewBehavior} associated with a particular
2569
+ * location within a DOM fragment.
2570
+ * @public
2571
+ */
2572
+ export declare interface ViewBehaviorFactory {
2573
+ /**
2574
+ * The unique id of the factory.
2575
+ */
2576
+ id: string;
2577
+ /**
2578
+ * The structural id of the DOM node to which the created behavior will apply.
2579
+ */
2580
+ nodeId: string;
2581
+ /**
2582
+ * Creates a behavior.
2583
+ */
2584
+ createBehavior(): ViewBehavior;
2585
+ }
2586
+
2587
+ /**
2588
+ * Bridges between ViewBehaviors and HostBehaviors, enabling a host to
2589
+ * control ViewBehaviors.
2590
+ * @public
2591
+ */
2592
+ export declare interface ViewBehaviorOrchestrator<TSource = any, TParent = any> extends ViewController<TSource, TParent>, HostBehavior<TSource> {
2593
+ /**
2594
+ *
2595
+ * @param nodeId - The structural id of the DOM node to which a behavior will apply.
2596
+ * @param target - The DOM node associated with the id.
2597
+ */
2598
+ addTarget(nodeId: string, target: Node): void;
2599
+ /**
2600
+ * Adds a behavior.
2601
+ * @param behavior - The behavior to add.
2602
+ */
2603
+ addBehavior(behavior: ViewBehavior): void;
2604
+ /**
2605
+ * Adds a behavior factory.
2606
+ * @param factory - The behavior factory to add.
2607
+ * @param target - The target the factory will create behaviors for.
2608
+ */
2609
+ addBehaviorFactory(factory: ViewBehaviorFactory, target: Node): void;
2610
+ }
2611
+
2612
+ /**
2613
+ * Bridges between ViewBehaviors and HostBehaviors, enabling a host to
2614
+ * control ViewBehaviors.
2615
+ * @public
2616
+ */
2617
+ export declare const ViewBehaviorOrchestrator: Readonly<{
2618
+ /**
2619
+ * Creates a ViewBehaviorOrchestrator.
2620
+ * @param source - The source to to associate behaviors with.
2621
+ * @returns A ViewBehaviorOrchestrator.
2622
+ */
2623
+ create<TSource = any, TParent = any>(source: TSource): ViewBehaviorOrchestrator<TSource, TParent>;
2624
+ }>;
2625
+
2626
+ /**
2627
+ * The target nodes available to a behavior.
2628
+ * @public
2629
+ */
2630
+ export declare type ViewBehaviorTargets = {
2631
+ [id: string]: Node;
2632
+ };
2633
+
2634
+ /**
2635
+ * Controls the lifecycle of a view and provides relevant context.
2636
+ * @public
2637
+ */
2638
+ export declare interface ViewController<TSource = any, TParent = any> extends ExpressionController<TSource, TParent> {
2639
+ /**
2640
+ * The parts of the view that are targeted by view behaviors.
2641
+ */
2642
+ readonly targets: ViewBehaviorTargets;
1886
2643
  }
1887
2644
 
1888
2645
  /**
1889
2646
  * A template capable of creating HTMLView instances or rendering directly to DOM.
1890
2647
  * @public
1891
2648
  */
1892
- export declare class ViewTemplate<TSource = any, TParent = any> implements ElementViewTemplate, SyntheticViewTemplate {
1893
- private behaviorCount;
1894
- private hasHostBehaviors;
1895
- private fragment;
1896
- private targetOffset;
1897
- private viewBehaviorFactories;
1898
- private hostBehaviorFactories;
2649
+ export declare class ViewTemplate<TSource = any, TParent = any> implements ElementViewTemplate<TSource, TParent>, SyntheticViewTemplate<TSource, TParent> {
2650
+ private result;
1899
2651
  /**
1900
2652
  * The html representing what this template will
1901
2653
  * instantiate, including placeholders for directives.
@@ -1904,18 +2656,18 @@ export declare class ViewTemplate<TSource = any, TParent = any> implements Eleme
1904
2656
  /**
1905
2657
  * The directives that will be connected to placeholders in the html.
1906
2658
  */
1907
- readonly directives: ReadonlyArray<HTMLDirective>;
2659
+ readonly factories: Record<string, ViewBehaviorFactory>;
1908
2660
  /**
1909
2661
  * Creates an instance of ViewTemplate.
1910
2662
  * @param html - The html representing what this template will instantiate, including placeholders for directives.
1911
- * @param directives - The directives that will be connected to placeholders in the html.
2663
+ * @param factories - The directives that will be connected to placeholders in the html.
1912
2664
  */
1913
- constructor(html: string | HTMLTemplateElement, directives: ReadonlyArray<HTMLDirective>);
2665
+ constructor(html: string | HTMLTemplateElement, factories: Record<string, ViewBehaviorFactory>);
1914
2666
  /**
1915
2667
  * Creates an HTMLView instance based on this template definition.
1916
2668
  * @param hostBindingTarget - The element that host behaviors will be bound to.
1917
2669
  */
1918
- create(hostBindingTarget?: Element): HTMLView;
2670
+ create(hostBindingTarget?: Element): HTMLView<TSource, TParent>;
1919
2671
  /**
1920
2672
  * Creates an HTMLView from this template, binds it to the source, and then appends it to the host.
1921
2673
  * @param source - The data source to bind the template to.
@@ -1923,7 +2675,7 @@ export declare class ViewTemplate<TSource = any, TParent = any> implements Eleme
1923
2675
  * @param hostBindingTarget - An HTML element to target the host bindings at if different from the
1924
2676
  * host that the template is being attached to.
1925
2677
  */
1926
- render(source: TSource, host: Node | string, hostBindingTarget?: Element): HTMLView;
2678
+ render(source: TSource, host: Node, hostBindingTarget?: Element): HTMLView<TSource, TParent>;
1927
2679
  }
1928
2680
 
1929
2681
  /**
@@ -1937,11 +2689,11 @@ export declare function volatile(target: {}, name: string | Accessor, descriptor
1937
2689
 
1938
2690
  /**
1939
2691
  * A directive that enables basic conditional rendering in a template.
1940
- * @param binding - The condition to test for rendering.
2692
+ * @param condition - The condition to test for rendering.
1941
2693
  * @param templateOrTemplateBinding - The template or a binding that gets
1942
2694
  * the template to render when the condition is true.
1943
2695
  * @public
1944
2696
  */
1945
- export declare function when<TSource = any, TReturn = any>(binding: Binding<TSource, TReturn>, templateOrTemplateBinding: SyntheticViewTemplate | Binding<TSource, SyntheticViewTemplate>): CaptureType<TSource>;
2697
+ 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>): CaptureType<TSource, TParent>;
1946
2698
 
1947
2699
  export { }