@microsoft/fast-element 1.10.2 → 2.0.0-beta.3

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 (104) hide show
  1. package/.eslintrc.json +1 -12
  2. package/CHANGELOG.json +387 -1
  3. package/CHANGELOG.md +74 -2
  4. package/README.md +2 -2
  5. package/dist/dts/components/attributes.d.ts +4 -1
  6. package/dist/dts/components/controller.d.ts +12 -11
  7. package/dist/dts/components/fast-definitions.d.ts +10 -2
  8. package/dist/dts/components/fast-element.d.ts +12 -5
  9. package/dist/dts/context.d.ts +157 -0
  10. package/dist/dts/debug.d.ts +1 -0
  11. package/dist/dts/hooks.d.ts +20 -0
  12. package/dist/dts/index.d.ts +16 -15
  13. package/dist/dts/index.debug.d.ts +2 -0
  14. package/dist/dts/index.rollup.d.ts +2 -0
  15. package/dist/dts/index.rollup.debug.d.ts +3 -0
  16. package/dist/dts/interfaces.d.ts +145 -0
  17. package/dist/dts/metadata.d.ts +25 -0
  18. package/dist/dts/observation/arrays.d.ts +207 -0
  19. package/dist/dts/observation/behavior.d.ts +4 -4
  20. package/dist/dts/observation/notifier.d.ts +18 -18
  21. package/dist/dts/observation/observable.d.ts +56 -18
  22. package/dist/dts/observation/splice-strategies.d.ts +13 -0
  23. package/dist/dts/observation/update-queue.d.ts +40 -0
  24. package/dist/dts/platform.d.ts +18 -67
  25. package/dist/dts/polyfills.d.ts +8 -0
  26. package/dist/dts/styles/css-directive.d.ts +43 -5
  27. package/dist/dts/styles/css.d.ts +19 -3
  28. package/dist/dts/styles/element-styles.d.ts +42 -62
  29. package/dist/dts/templating/binding-signal.d.ts +38 -0
  30. package/dist/dts/templating/binding-two-way.d.ts +56 -0
  31. package/dist/dts/templating/binding.d.ts +233 -65
  32. package/dist/dts/templating/children.d.ts +18 -15
  33. package/dist/dts/templating/compiler.d.ts +46 -28
  34. package/dist/dts/templating/dom.d.ts +41 -0
  35. package/dist/dts/templating/html-directive.d.ts +181 -43
  36. package/dist/dts/templating/markup.d.ts +48 -0
  37. package/dist/dts/templating/node-observation.d.ts +45 -29
  38. package/dist/dts/templating/ref.d.ts +6 -12
  39. package/dist/dts/templating/repeat.d.ts +26 -14
  40. package/dist/dts/templating/slotted.d.ts +13 -14
  41. package/dist/dts/templating/template.d.ts +27 -21
  42. package/dist/dts/templating/view.d.ts +15 -22
  43. package/dist/{tsdoc-metadata.json → dts/tsdoc-metadata.json} +1 -1
  44. package/dist/dts/utilities.d.ts +40 -0
  45. package/dist/esm/components/attributes.js +25 -24
  46. package/dist/esm/components/controller.js +77 -57
  47. package/dist/esm/components/fast-definitions.js +16 -22
  48. package/dist/esm/components/fast-element.js +10 -2
  49. package/dist/esm/context.js +159 -0
  50. package/dist/esm/debug.js +30 -0
  51. package/dist/esm/hooks.js +32 -0
  52. package/dist/esm/index.debug.js +2 -0
  53. package/dist/esm/index.js +19 -14
  54. package/dist/esm/index.rollup.debug.js +3 -0
  55. package/dist/esm/index.rollup.js +2 -0
  56. package/dist/esm/interfaces.js +8 -1
  57. package/dist/esm/metadata.js +60 -0
  58. package/dist/esm/observation/arrays.js +269 -0
  59. package/dist/esm/observation/notifier.js +27 -35
  60. package/dist/esm/observation/observable.js +93 -68
  61. package/dist/esm/observation/{array-change-records.js → splice-strategies.js} +136 -62
  62. package/dist/esm/observation/update-queue.js +67 -0
  63. package/dist/esm/platform.js +36 -42
  64. package/dist/esm/polyfills.js +85 -0
  65. package/dist/esm/styles/css-directive.js +29 -13
  66. package/dist/esm/styles/css.js +27 -40
  67. package/dist/esm/styles/element-styles.js +65 -104
  68. package/dist/esm/templating/binding-signal.js +84 -0
  69. package/dist/esm/templating/binding-two-way.js +82 -0
  70. package/dist/esm/templating/binding.js +306 -153
  71. package/dist/esm/templating/children.js +33 -23
  72. package/dist/esm/templating/compiler.js +236 -152
  73. package/dist/esm/templating/dom.js +49 -0
  74. package/dist/esm/templating/html-directive.js +128 -40
  75. package/dist/esm/templating/markup.js +75 -0
  76. package/dist/esm/templating/node-observation.js +50 -45
  77. package/dist/esm/templating/ref.js +7 -16
  78. package/dist/esm/templating/repeat.js +39 -36
  79. package/dist/esm/templating/slotted.js +23 -20
  80. package/dist/esm/templating/template.js +51 -95
  81. package/dist/esm/templating/view.js +44 -43
  82. package/dist/esm/templating/when.js +2 -1
  83. package/dist/esm/utilities.js +139 -0
  84. package/dist/fast-element.api.json +11789 -5377
  85. package/dist/fast-element.d.ts +1178 -530
  86. package/dist/fast-element.debug.js +3722 -0
  87. package/dist/fast-element.debug.min.js +1 -0
  88. package/dist/fast-element.js +3484 -4033
  89. package/dist/fast-element.min.js +1 -1
  90. package/dist/fast-element.untrimmed.d.ts +2699 -0
  91. package/docs/api-report.md +472 -219
  92. package/docs/fast-element-2-changes.md +15 -0
  93. package/docs/guide/declaring-templates.md +4 -4
  94. package/docs/guide/defining-elements.md +2 -2
  95. package/docs/guide/next-steps.md +2 -2
  96. package/docs/guide/observables-and-state.md +1 -1
  97. package/docs/guide/using-directives.md +1 -1
  98. package/karma.conf.cjs +6 -17
  99. package/package.json +63 -15
  100. package/dist/dts/dom.d.ts +0 -112
  101. package/dist/dts/observation/array-change-records.d.ts +0 -48
  102. package/dist/dts/observation/array-observer.d.ts +0 -9
  103. package/dist/esm/dom.js +0 -207
  104. 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.
32
25
  * @public
33
26
  */
34
- export declare class AttachedBehaviorHTMLDirective<T = any> extends HTMLDirective {
35
- private name;
36
- private behavior;
37
- private options;
27
+ export declare type AddBehavior = (behavior: Behavior<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.
39
+ * @public
40
+ */
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
+ }>;
123
+
124
+ /**
125
+ * The type of HTML aspect to target.
126
+ * @public
127
+ */
128
+ export declare type Aspect = typeof Aspect[Exclude<keyof typeof Aspect, "assign" | "none">];
61
129
 
62
130
  /**
63
- * Describes the shape of a behavior constructor that can be created by
64
- * an {@link AttachedBehaviorHTMLDirective}.
131
+ * Represents something that applies to a specific aspect of the DOM.
65
132
  * @public
66
133
  */
67
- export declare type AttachedBehaviorType<T = any> = new (target: any, options: T) => Behavior;
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
+ binding?: Binding;
151
+ }
68
152
 
69
153
  /**
70
154
  * Decorator: Specifies an HTML attribute.
@@ -145,16 +229,9 @@ export declare class AttributeDefinition implements Accessor {
145
229
  * @param source - The source element to access.
146
230
  */
147
231
  getValue(source: HTMLElement): any;
148
- /** @internal */
149
- onAttributeChangedCallback(element: HTMLElement, value: any): void;
232
+ /* Excluded from this release type: onAttributeChangedCallback */
150
233
  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>;
234
+ /* Excluded from this release type: collect */
158
235
  }
159
236
 
160
237
  /**
@@ -168,27 +245,36 @@ export declare class AttributeDefinition implements Accessor {
168
245
  * changes in the DOM, but does not reflect property changes back.
169
246
  * @public
170
247
  */
171
- export declare type AttributeMode = "reflect" | "boolean" | "fromView";
248
+ export declare type AttributeMode = typeof reflectMode | typeof booleanMode | "fromView";
172
249
 
173
250
  /**
174
- * Represents and object that can contribute behavior to a view or
251
+ * Represents an object that can contribute behavior to a view or
175
252
  * element's bind/unbind operations.
176
253
  * @public
177
254
  */
178
- export declare interface Behavior {
255
+ export declare interface Behavior<TSource = any, TParent = any> {
179
256
  /**
180
257
  * Bind this behavior to the source.
181
258
  * @param source - The source to bind to.
182
259
  * @param context - The execution context that the binding is operating within.
183
260
  */
184
- bind(source: unknown, context: ExecutionContext): void;
261
+ bind(source: TSource, context: ExecutionContext<TParent>): void;
185
262
  /**
186
263
  * Unbinds this behavior from the source.
187
264
  * @param source - The source to unbind from.
188
265
  */
189
- unbind(source: unknown): void;
266
+ unbind(source: TSource, context: ExecutionContext<TParent>): void;
190
267
  }
191
268
 
269
+ /**
270
+ * Creates a binding directive with the specified configuration.
271
+ * @param binding - The binding expression.
272
+ * @param config - The binding configuration.
273
+ * @returns A binding directive.
274
+ * @public
275
+ */
276
+ export declare function bind<T = any>(binding: Binding<T>, config?: BindingConfig | DefaultBindingOptions): CaptureType<T>;
277
+
192
278
  /**
193
279
  * The signature of an arrow function capable of being evaluated
194
280
  * as part of a template binding update.
@@ -197,80 +283,86 @@ export declare interface Behavior {
197
283
  export declare type Binding<TSource = any, TReturn = any, TParent = any> = (source: TSource, context: ExecutionContext<TParent>) => TReturn;
198
284
 
199
285
  /**
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;
286
+ * Describes the configuration for a binding expression.
287
+ * @public
288
+ */
289
+ export declare interface BindingConfig<T = any> {
225
290
  /**
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.
291
+ * The binding mode to configure the binding with.
229
292
  */
230
- bind: typeof normalBind;
293
+ mode: BindingMode;
231
294
  /**
232
- * Unbinds this behavior from the source.
233
- * @param source - The source to unbind from.
295
+ * Options to be supplied to the binding behaviors.
234
296
  */
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;
297
+ options: T;
251
298
  }
252
299
 
300
+ /**
301
+ * Describes the configuration for a binding expression.
302
+ * @public
303
+ */
304
+ export declare const BindingConfig: Readonly<{
305
+ /**
306
+ * Creates a binding configuration based on the provided mode and options.
307
+ * @param mode - The mode to use for the configuration.
308
+ * @param defaultOptions - The default options to use for the configuration.
309
+ * @returns A new binding configuration.
310
+ */
311
+ define<T>(mode: BindingMode, defaultOptions: T): BindingConfig<T> & BindingConfigResolver<T>;
312
+ }>;
313
+
314
+ /**
315
+ * Creates a new binding configuration based on the supplied options.
316
+ * @public
317
+ */
318
+ export declare type BindingConfigResolver<T> = (options: T) => BindingConfig<T>;
319
+
320
+ /**
321
+ * Describes how aspects of an HTML element will be affected by bindings.
322
+ * @public
323
+ */
324
+ export declare type BindingMode = Record<Aspect, (directive: HTMLBindingDirective) => Pick<ViewBehaviorFactory, "createBehavior">>;
325
+
326
+ /**
327
+ * Describes how aspects of an HTML element will be affected by bindings.
328
+ * @public
329
+ */
330
+ export declare const BindingMode: Readonly<{
331
+ /**
332
+ * Creates a binding mode based on the supplied behavior types.
333
+ * @param UpdateType - The base behavior type used to update aspects.
334
+ * @param EventType - The base behavior type used to respond to events.
335
+ * @returns A new binding mode.
336
+ */
337
+ define(UpdateType: typeof UpdateBinding, EventType?: typeof EventBinding): BindingMode;
338
+ }>;
339
+
253
340
  /**
254
341
  * Enables evaluation of and subscription to a binding.
255
342
  * @public
256
343
  */
257
- export declare interface BindingObserver<TSource = any, TReturn = any, TParent = any> extends Notifier {
344
+ export declare interface BindingObserver<TSource = any, TReturn = any, TParent = any> extends Notifier, Disposable {
258
345
  /**
259
346
  * Begins observing the binding for the source and returns the current value.
260
347
  * @param source - The source that the binding is based on.
261
348
  * @param context - The execution context to execute the binding within.
262
349
  * @returns The value of the binding.
263
350
  */
264
- observe(source: TSource, context: ExecutionContext<TParent>): TReturn;
265
- /**
266
- * Unsubscribe from all dependent observables of the binding.
267
- */
268
- disconnect(): void;
351
+ observe(source: TSource, context?: ExecutionContext<TParent>): TReturn;
269
352
  /**
270
353
  * Gets {@link ObservationRecord|ObservationRecords} that the {@link BindingObserver}
271
354
  * is observing.
272
355
  */
273
356
  records(): IterableIterator<ObservationRecord>;
357
+ /**
358
+ * Sets the update mode used by the observer.
359
+ * @param isAsync - Indicates whether updates should be asynchronous.
360
+ * @remarks
361
+ * By default, the update mode is asynchronous, since that provides the best
362
+ * performance for template rendering scenarios. Passing false to setMode will
363
+ * instead cause the observer to notify subscribers immediately when changes occur.
364
+ */
365
+ setMode(isAsync: boolean): void;
274
366
  }
275
367
 
276
368
  /**
@@ -281,6 +373,8 @@ export declare interface BindingObserver<TSource = any, TReturn = any, TParent =
281
373
  */
282
374
  export declare const booleanConverter: ValueConverter;
283
375
 
376
+ declare const booleanMode = "boolean";
377
+
284
378
  /**
285
379
  * Represents a callable type such as a function or an object with a "call" method.
286
380
  * @public
@@ -297,11 +391,47 @@ export declare type Callable = typeof Function.prototype.call | {
297
391
  export declare interface CaptureType<TSource> {
298
392
  }
299
393
 
394
+ /**
395
+ * A binding behavior for bindings that change.
396
+ * @public
397
+ */
398
+ export declare class ChangeBinding extends UpdateBinding {
399
+ private isBindingVolatile;
400
+ private observerProperty;
401
+ /**
402
+ * Creates an instance of ChangeBinding.
403
+ * @param directive - The directive that has the configuration for this behavior.
404
+ * @param updateTarget - The function used to update the target with the latest value.
405
+ */
406
+ constructor(directive: HTMLBindingDirective, updateTarget: UpdateTarget);
407
+ /**
408
+ * Returns the binding observer used to update the node.
409
+ * @param target - The target node.
410
+ * @returns A BindingObserver.
411
+ */
412
+ protected getObserver(target: Node): BindingObserver;
413
+ /**
414
+ * Bind this behavior to the source.
415
+ * @param source - The source to bind to.
416
+ * @param context - The execution context that the binding is operating within.
417
+ * @param targets - The targets that behaviors in a view can attach to.
418
+ */
419
+ bind(source: any, context: ExecutionContext, targets: ViewBehaviorTargets): void;
420
+ /**
421
+ * Unbinds this behavior from the source.
422
+ * @param source - The source to unbind from.
423
+ * @param context - The execution context that the binding is operating within.
424
+ * @param targets - The targets that behaviors in a view can attach to.
425
+ */
426
+ unbind(source: any, context: ExecutionContext, targets: ViewBehaviorTargets): void;
427
+ /* Excluded from this release type: handleChange */
428
+ }
429
+
300
430
  /**
301
431
  * The options used to configure child list observation.
302
432
  * @public
303
433
  */
304
- export declare interface ChildListBehaviorOptions<T = any> extends NodeBehaviorOptions<T>, Omit<MutationObserverInit, "subtree" | "childList"> {
434
+ export declare interface ChildListDirectiveOptions<T = any> extends NodeBehaviorOptions<T>, Omit<MutationObserverInit, "subtree" | "childList"> {
305
435
  }
306
436
 
307
437
  /**
@@ -310,78 +440,97 @@ export declare interface ChildListBehaviorOptions<T = any> extends NodeBehaviorO
310
440
  * @param propertyOrOptions - The options used to configure child node observation.
311
441
  * @public
312
442
  */
313
- export declare function children<T = any>(propertyOrOptions: (keyof T & string) | ChildrenBehaviorOptions<keyof T & string>): CaptureType<T>;
443
+ export declare function children<T = any>(propertyOrOptions: (keyof T & string) | ChildrenDirectiveOptions<keyof T & string>): CaptureType<T>;
314
444
 
315
445
  /**
316
446
  * The runtime behavior for child node observation.
317
447
  * @public
318
448
  */
319
- export declare class ChildrenBehavior extends NodeObservationBehavior<ChildrenBehaviorOptions> {
320
- private observer;
449
+ export declare class ChildrenDirective extends NodeObservationDirective<ChildrenDirectiveOptions> {
450
+ private observerProperty;
321
451
  /**
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.
452
+ * Creates an instance of ChildrenDirective.
453
+ * @param options - The options to use in configuring the child observation behavior.
325
454
  */
326
- constructor(target: HTMLElement, options: ChildrenBehaviorOptions);
455
+ constructor(options: ChildrenDirectiveOptions);
327
456
  /**
328
457
  * Begins observation of the nodes.
458
+ * @param target - The target to observe.
329
459
  */
330
- observe(): void;
460
+ observe(target: any): void;
331
461
  /**
332
462
  * Disconnects observation of the nodes.
463
+ * @param target - The target to unobserve.
333
464
  */
334
- disconnect(): void;
465
+ disconnect(target: any): void;
335
466
  /**
336
- * Retrieves the nodes that should be assigned to the target.
467
+ * Retrieves the raw nodes that should be assigned to the source property.
468
+ * @param target - The target to get the node to.
337
469
  */
338
- protected getNodes(): ChildNode[];
470
+ getNodes(target: Element): Node[];
471
+ private handleEvent;
339
472
  }
340
473
 
341
474
  /**
342
475
  * The options used to configure child/subtree node observation.
343
476
  * @public
344
477
  */
345
- export declare type ChildrenBehaviorOptions<T = any> = ChildListBehaviorOptions<T> | SubtreeBehaviorOptions<T>;
478
+ export declare type ChildrenDirectiveOptions<T = any> = ChildListDirectiveOptions<T> | SubtreeDirectiveOptions<T>;
346
479
 
347
480
  /**
348
- * The result of compiling a template and its directives.
349
- * @beta
481
+ * A function capable of compiling a template from the preprocessed form produced
482
+ * by the html template function into a result that can instantiate views.
483
+ * @public
484
+ */
485
+ export declare type CompilationStrategy = (
486
+ /**
487
+ * The preprocessed HTML string or template to compile.
350
488
  */
351
- export declare interface CompilationResult {
489
+ html: string | HTMLTemplateElement,
490
+ /**
491
+ * The behavior factories used within the html that is being compiled.
492
+ */
493
+ factories: Record<string, ViewBehaviorFactory>) => HTMLTemplateCompilationResult;
494
+
495
+ /**
496
+ * Common APIs related to compilation.
497
+ * @public
498
+ */
499
+ export declare const Compiler: {
352
500
  /**
353
- * A cloneable DocumentFragment representing the compiled HTML.
501
+ * Sets the HTML trusted types policy used by the compiler.
502
+ * @param policy - The policy to set for HTML.
503
+ * @remarks
504
+ * This API can only be called once, for security reasons. It should be
505
+ * called by the application developer at the start of their program.
354
506
  */
355
- fragment: DocumentFragment;
507
+ setHTMLPolicy(policy: TrustedTypesPolicy): void;
356
508
  /**
357
- * The behaviors that should be applied to the template's HTML.
509
+ * Compiles a template and associated directives into a compilation
510
+ * result which can be used to create views.
511
+ * @param html - The html string or template element to compile.
512
+ * @param directives - The directives referenced by the template.
513
+ * @remarks
514
+ * The template that is provided for compilation is altered in-place
515
+ * and cannot be compiled again. If the original template must be preserved,
516
+ * it is recommended that you clone the original and pass the clone to this API.
517
+ * @public
358
518
  */
359
- viewBehaviorFactories: NodeBehaviorFactory[];
519
+ compile<TSource = any, TParent = any>(html: string | HTMLTemplateElement, directives: Record<string, ViewBehaviorFactory>): HTMLTemplateCompilationResult<TSource, TParent>;
360
520
  /**
361
- * The behaviors that should be applied to the host element that
362
- * the template is rendered into.
521
+ * Sets the default compilation strategy that will be used by the ViewTemplate whenever
522
+ * it needs to compile a view preprocessed with the html template function.
523
+ * @param strategy - The compilation strategy to use when compiling templates.
363
524
  */
364
- hostBehaviorFactories: NodeBehaviorFactory[];
525
+ setDefaultStrategy(strategy: CompilationStrategy): void;
365
526
  /**
366
- * An index offset to apply to BehaviorFactory target indexes when
367
- * matching factories to targets.
527
+ * Aggregates an array of strings and directives into a single directive.
528
+ * @param parts - A heterogeneous array of static strings interspersed with
529
+ * directives.
530
+ * @returns A single inline directive that aggregates the behavior of all the parts.
368
531
  */
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;
532
+ aggregate(parts: (string | ViewBehaviorFactory)[]): ViewBehaviorFactory;
533
+ };
385
534
 
386
535
  /**
387
536
  * Represents styles that can be composed into the ShadowDOM of a custom element.
@@ -398,14 +547,27 @@ export declare type Constructable<T = {}> = {
398
547
  new (...args: any[]): T;
399
548
  };
400
549
 
550
+ /**
551
+ * A type that instantiates a StyleStrategy.
552
+ * @public
553
+ */
554
+ export declare type ConstructibleStyleStrategy = {
555
+ /**
556
+ * Creates an instance of the strategy.
557
+ * @param styles - The styles to initialize the strategy with.
558
+ */
559
+ new (styles: (string | CSSStyleSheet)[]): StyleStrategy;
560
+ };
561
+
401
562
  /**
402
563
  * Controls the lifecycle and rendering of a `FASTElement`.
403
564
  * @public
404
565
  */
405
- export declare class Controller extends PropertyChangeNotifier {
566
+ export declare class Controller<TElement extends HTMLElement = HTMLElement> extends PropertyChangeNotifier {
406
567
  private boundObservables;
407
568
  private behaviors;
408
569
  private needsInitialization;
570
+ private hasExistingShadowRoot;
409
571
  private _template;
410
572
  private _styles;
411
573
  private _isConnected;
@@ -421,7 +583,7 @@ export declare class Controller extends PropertyChangeNotifier {
421
583
  /**
422
584
  * The element being controlled by this controller.
423
585
  */
424
- readonly element: HTMLElement;
586
+ readonly element: TElement;
425
587
  /**
426
588
  * The element definition that instructs this controller
427
589
  * in how to handle rendering and other platform integrations.
@@ -432,7 +594,7 @@ export declare class Controller extends PropertyChangeNotifier {
432
594
  * @remarks
433
595
  * If `null` then the element is managing its own rendering.
434
596
  */
435
- readonly view: ElementView | null;
597
+ readonly view: ElementView<TElement> | null;
436
598
  /**
437
599
  * Indicates whether or not the custom element has been
438
600
  * connected to the document.
@@ -444,8 +606,8 @@ export declare class Controller extends PropertyChangeNotifier {
444
606
  * @remarks
445
607
  * This value can only be accurately read after connect but can be set at any time.
446
608
  */
447
- get template(): ElementViewTemplate | null;
448
- set template(value: ElementViewTemplate | null);
609
+ get template(): ElementViewTemplate<TElement> | null;
610
+ set template(value: ElementViewTemplate<TElement> | null);
449
611
  /**
450
612
  * Gets/sets the primary styles used for the component.
451
613
  * @remarks
@@ -453,35 +615,28 @@ export declare class Controller extends PropertyChangeNotifier {
453
615
  */
454
616
  get styles(): ElementStyles | null;
455
617
  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);
618
+ /* Excluded from this release type: __constructor */
464
619
  /**
465
620
  * Adds styles to this element. Providing an HTMLStyleElement will attach the element instance to the shadowRoot.
466
621
  * @param styles - The styles to add.
467
622
  */
468
- addStyles(styles: ElementStyles | HTMLStyleElement): void;
623
+ addStyles(styles: ElementStyles | HTMLStyleElement | null | undefined): void;
469
624
  /**
470
625
  * Removes styles from this element. Providing an HTMLStyleElement will detach the element instance from the shadowRoot.
471
626
  * @param styles - the styles to remove.
472
627
  */
473
- removeStyles(styles: ElementStyles | HTMLStyleElement): void;
628
+ removeStyles(styles: ElementStyles | HTMLStyleElement | null | undefined): void;
474
629
  /**
475
630
  * Adds behaviors to this element.
476
631
  * @param behaviors - The behaviors to add.
477
632
  */
478
- addBehaviors(behaviors: ReadonlyArray<Behavior>): void;
633
+ addBehaviors(behaviors: ReadonlyArray<Behavior<TElement>>): void;
479
634
  /**
480
635
  * Removes behaviors from this element.
481
636
  * @param behaviors - The behaviors to remove.
482
637
  * @param force - Forces unbinding of behaviors.
483
638
  */
484
- removeBehaviors(behaviors: ReadonlyArray<Behavior>, force?: boolean): void;
639
+ removeBehaviors(behaviors: ReadonlyArray<Behavior<TElement>>, force?: boolean): void;
485
640
  /**
486
641
  * Runs connected lifecycle behavior on the associated element.
487
642
  */
@@ -496,7 +651,7 @@ export declare class Controller extends PropertyChangeNotifier {
496
651
  * @param oldValue - The previous value of the attribute.
497
652
  * @param newValue - The new value of the attribute.
498
653
  */
499
- onAttributeChangedCallback(name: string, oldValue: string, newValue: string): void;
654
+ onAttributeChangedCallback(name: string, oldValue: string | null, newValue: string | null): void;
500
655
  /**
501
656
  * Emits a custom HTML event.
502
657
  * @param type - The type name of the event.
@@ -519,6 +674,8 @@ export declare class Controller extends PropertyChangeNotifier {
519
674
  static forCustomElement(element: HTMLElement): Controller;
520
675
  }
521
676
 
677
+ /* Excluded from this release type: createTypeRegistry */
678
+
522
679
  /**
523
680
  * Transforms a template literal string into styles.
524
681
  * @param strings - The string fragments that are interpolated with the values.
@@ -527,33 +684,85 @@ export declare class Controller extends PropertyChangeNotifier {
527
684
  * The css helper supports interpolation of strings and ElementStyle instances.
528
685
  * @public
529
686
  */
530
- export declare function css(strings: TemplateStringsArray, ...values: (ComposableStyles | CSSDirective)[]): ElementStyles;
687
+ export declare const css: CSSTemplateTag;
531
688
 
532
689
  /**
533
690
  * Directive for use in {@link css}.
534
691
  *
535
692
  * @public
536
693
  */
537
- export declare class CSSDirective {
694
+ export declare interface CSSDirective {
538
695
  /**
539
696
  * Creates a CSS fragment to interpolate into the CSS document.
540
697
  * @returns - the string to interpolate into CSS
541
698
  */
542
- createCSS(): ComposableStyles;
699
+ createCSS(add: AddBehavior): ComposableStyles;
700
+ }
701
+
702
+ /**
703
+ * Instructs the css engine to provide dynamic styles or
704
+ * associate behaviors with styles.
705
+ * @public
706
+ */
707
+ export declare const CSSDirective: Readonly<{
708
+ /**
709
+ * Gets the directive definition associated with the instance.
710
+ * @param instance - The directive instance to retrieve the definition for.
711
+ */
712
+ getForInstance: (object: any) => CSSDirectiveDefinition<Constructable<CSSDirective>> | undefined;
713
+ /**
714
+ * Gets the directive definition associated with the specified type.
715
+ * @param type - The directive type to retrieve the definition for.
716
+ */
717
+ getByType: (key: Function) => CSSDirectiveDefinition<Constructable<CSSDirective>> | undefined;
543
718
  /**
544
- * Creates a behavior to bind to the host element.
545
- * @returns - the behavior to bind to the host element, or undefined.
719
+ * Defines a CSSDirective.
720
+ * @param type - The type to define as a directive.
546
721
  */
547
- createBehavior(): Behavior | undefined;
722
+ define<TType extends Constructable<CSSDirective>>(type: any): TType;
723
+ }>;
724
+
725
+ /**
726
+ * Decorator: Defines a CSSDirective.
727
+ * @public
728
+ */
729
+ export declare function cssDirective(): (type: Constructable<CSSDirective>) => void;
730
+
731
+ /**
732
+ * Defines metadata for a CSSDirective.
733
+ * @public
734
+ */
735
+ export declare interface CSSDirectiveDefinition<TType extends Constructable<CSSDirective> = Constructable<CSSDirective>> {
736
+ /**
737
+ * The type that the definition provides metadata for.
738
+ */
739
+ readonly type: TType;
548
740
  }
549
741
 
550
742
  /**
551
- * Transforms a template literal string into partial CSS.
743
+ * @deprecated Use css.partial instead.
744
+ * @public
745
+ */
746
+ export declare const cssPartial: (strings: TemplateStringsArray, ...values: (ComposableStyles | CSSDirective)[]) => CSSDirective;
747
+
748
+ /**
749
+ * Transforms a template literal string into styles.
552
750
  * @param strings - The string fragments that are interpolated with the values.
553
751
  * @param values - The values that are interpolated with the string fragments.
752
+ * @remarks
753
+ * The css helper supports interpolation of strings and ElementStyle instances.
754
+ * Use the .partial method to create partial CSS fragments.
554
755
  * @public
555
756
  */
556
- export declare function cssPartial(strings: TemplateStringsArray, ...values: (ComposableStyles | CSSDirective)[]): CSSDirective;
757
+ export declare type CSSTemplateTag = ((strings: TemplateStringsArray, ...values: (ComposableStyles | CSSDirective)[]) => ElementStyles) & {
758
+ /**
759
+ * Transforms a template literal string into partial CSS.
760
+ * @param strings - The string fragments that are interpolated with the values.
761
+ * @param values - The values that are interpolated with the string fragments.
762
+ * @public
763
+ */
764
+ partial(strings: TemplateStringsArray, ...values: (ComposableStyles | CSSDirective)[]): CSSDirective;
765
+ };
557
766
 
558
767
  /**
559
768
  * Decorator: Defines a platform custom element based on `FASTElement`.
@@ -561,7 +770,7 @@ export declare function cssPartial(strings: TemplateStringsArray, ...values: (Co
561
770
  * that describes the element to define.
562
771
  * @public
563
772
  */
564
- export declare function customElement(nameOrDef: string | PartialFASTElementDefinition): (type: Function) => void;
773
+ export declare function customElement(nameOrDef: string | PartialFASTElementDefinition): (type: Constructable<HTMLElement>) => void;
565
774
 
566
775
  /**
567
776
  * Metadata used to configure a custom attribute's behavior through a decorator.
@@ -570,87 +779,42 @@ export declare function customElement(nameOrDef: string | PartialFASTElementDefi
570
779
  export declare type DecoratorAttributeConfiguration = Omit<AttributeConfiguration, "property">;
571
780
 
572
781
  /**
573
- * The default execution context used in binding expressions.
782
+ * The default binding options.
574
783
  * @public
575
784
  */
576
- export declare const defaultExecutionContext: ExecutionContext<any, any>;
785
+ export declare type DefaultBindingOptions = AddEventListenerOptions;
577
786
 
578
787
  /**
579
- * Common DOM APIs.
788
+ * Provides a mechanism for releasing resources.
580
789
  * @public
581
790
  */
582
- export declare const DOM: Readonly<{
583
- /**
584
- * Indicates whether the DOM supports the adoptedStyleSheets feature.
585
- */
586
- supportsAdoptedStyleSheets: boolean;
587
- /**
588
- * Sets the HTML trusted types policy used by the templating engine.
589
- * @param policy - The policy to set for HTML.
590
- * @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.
593
- */
594
- setHTMLPolicy(policy: TrustedTypesPolicy): void;
595
- /**
596
- * Turns a string into trusted HTML using the configured trusted types policy.
597
- * @param html - The string to turn into trusted HTML.
598
- * @remarks
599
- * Used internally by the template engine when creating templates
600
- * and setting innerHTML.
601
- */
602
- createHTML(html: string): string;
603
- /**
604
- * Determines if the provided node is a template marker used by the runtime.
605
- * @param node - The node to test.
606
- */
607
- isMarker(node: Node): node is Comment;
608
- /**
609
- * Given a marker node, extract the {@link HTMLDirective} index from the placeholder.
610
- * @param node - The marker node to extract the index from.
611
- */
612
- extractDirectiveIndexFromMarker(node: Comment): number;
613
- /**
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.
617
- * @remarks
618
- * Used internally by binding directives.
619
- */
620
- createInterpolationPlaceholder(index: number): string;
791
+ export declare interface Disposable {
621
792
  /**
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`.
628
- */
629
- createCustomAttributePlaceholder(attributeName: string, index: number): string;
630
- /**
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.
633
- * @remarks
634
- * Used internally by structural directives such as `repeat`.
793
+ * Disposes the resources.
635
794
  */
636
- createBlockPlaceholder(index: number): string;
795
+ dispose(): void;
796
+ }
797
+
798
+ /**
799
+ * Common DOM APIs.
800
+ * @public
801
+ */
802
+ export declare const DOM: Readonly<{
637
803
  /**
638
- * Schedules DOM update work in the next async batch.
639
- * @param callable - The callable function or object to queue.
804
+ * @deprecated
805
+ * Use Updates.enqueue().
640
806
  */
641
807
  queueUpdate: (callable: Callable) => void;
642
808
  /**
643
- * Immediately processes all work previously scheduled
644
- * through queueUpdate.
645
- * @remarks
646
- * This also forces nextUpdate promises
647
- * to resolve.
809
+ * @deprecated
810
+ * Use Updates.next()
648
811
  */
649
- processUpdates: () => void;
812
+ nextUpdate: () => Promise<void>;
650
813
  /**
651
- * Resolves with the next DOM update.
814
+ * @deprecated
815
+ * Use Updates.process()
652
816
  */
653
- nextUpdate(): Promise<void>;
817
+ processUpdates: () => void;
654
818
  /**
655
819
  * Sets an attribute value on an element.
656
820
  * @param element - The element to set the attribute value on.
@@ -670,16 +834,6 @@ export declare const DOM: Readonly<{
670
834
  * If the value is true, the attribute is added; otherwise it is removed.
671
835
  */
672
836
  setBooleanAttribute(element: HTMLElement, attributeName: string, value: boolean): void;
673
- /**
674
- * Removes all the child nodes of the provided parent node.
675
- * @param parent - The node to remove the children from.
676
- */
677
- removeChildNodes(parent: Node): void;
678
- /**
679
- * Creates a TreeWalker configured to walk a template fragment.
680
- * @param fragment - The fragment to walk.
681
- */
682
- createTemplateWalker(fragment: DocumentFragment): TreeWalker;
683
837
  }>;
684
838
 
685
839
  /**
@@ -687,7 +841,7 @@ export declare const DOM: Readonly<{
687
841
  * @param selector - An optional selector to restrict the filter to.
688
842
  * @public
689
843
  */
690
- export declare function elements(selector?: string): ElementsFilter;
844
+ export declare const elements: (selector?: string) => ElementsFilter;
691
845
 
692
846
  /**
693
847
  * Elements filter function type.
@@ -696,44 +850,56 @@ export declare function elements(selector?: string): ElementsFilter;
696
850
  */
697
851
  export declare type ElementsFilter = (value: Node, index: number, array: Node[]) => boolean;
698
852
 
699
- /**
700
- * Creates an ElementStyles instance for an array of ComposableStyles.
701
- * @public
702
- */
703
- export declare type ElementStyleFactory = (styles: ReadonlyArray<ComposableStyles>) => ElementStyles;
704
-
705
853
  /**
706
854
  * Represents styles that can be applied to a custom element.
707
855
  * @public
708
856
  */
709
- export declare abstract class ElementStyles {
857
+ export declare class ElementStyles {
858
+ readonly styles: ReadonlyArray<ComposableStyles>;
710
859
  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;
860
+ private _strategy;
861
+ /**
862
+ * The behaviors associated with this set of styles.
863
+ */
864
+ readonly behaviors: ReadonlyArray<Behavior<HTMLElement>> | null;
865
+ /**
866
+ * Gets the StyleStrategy associated with these element styles.
867
+ */
868
+ get strategy(): StyleStrategy;
869
+ /**
870
+ * Creates an instance of ElementStyles.
871
+ * @param styles - The styles that will be associated with elements.
872
+ */
873
+ constructor(styles: ReadonlyArray<ComposableStyles>);
874
+ /* Excluded from this release type: addStylesTo */
875
+ /* Excluded from this release type: removeStylesFrom */
876
+ /* Excluded from this release type: isAttachedTo */
721
877
  /**
722
878
  * Associates behaviors with this set of styles.
723
879
  * @param behaviors - The behaviors to associate.
724
880
  */
725
- withBehaviors(...behaviors: Behavior[]): this;
881
+ withBehaviors(...behaviors: Behavior<HTMLElement>[]): this;
882
+ /**
883
+ * Sets the strategy that handles adding/removing these styles for an element.
884
+ * @param strategy - The strategy to use.
885
+ */
886
+ withStrategy(Strategy: ConstructibleStyleStrategy): this;
726
887
  /**
727
- * Create ElementStyles from ComposableStyles.
888
+ * Sets the default strategy type to use when creating style strategies.
889
+ * @param Strategy - The strategy type to construct.
728
890
  */
729
- static readonly create: ElementStyleFactory;
891
+ static setDefaultStrategy(Strategy: ConstructibleStyleStrategy): void;
892
+ /**
893
+ * Indicates whether the DOM supports the adoptedStyleSheets feature.
894
+ */
895
+ static readonly supportsAdoptedStyleSheets: boolean;
730
896
  }
731
897
 
732
898
  /**
733
899
  * A View representing DOM nodes specifically for rendering the view of a custom element.
734
900
  * @public
735
901
  */
736
- export declare interface ElementView extends View {
902
+ export declare interface ElementView<TSource = any, TParent = any> extends View<TSource, TParent> {
737
903
  /**
738
904
  * Appends the view's DOM nodes to the referenced node.
739
905
  * @param node - The parent node to append the view's DOM nodes to.
@@ -745,12 +911,12 @@ export declare interface ElementView extends View {
745
911
  * A template capable of creating views specifically for rendering custom elements.
746
912
  * @public
747
913
  */
748
- export declare interface ElementViewTemplate {
914
+ export declare interface ElementViewTemplate<TSource = any, TParent = any> {
749
915
  /**
750
916
  * Creates an ElementView instance based on this template definition.
751
917
  * @param hostBindingTarget - The element that host behaviors will be bound to.
752
918
  */
753
- create(hostBindingTarget: Element): ElementView;
919
+ create(hostBindingTarget: Element): ElementView<TSource, TParent>;
754
920
  /**
755
921
  * Creates an HTMLView from this template, binds it to the source, and then appends it to the host.
756
922
  * @param source - The data source to bind the template to.
@@ -758,7 +924,7 @@ export declare interface ElementViewTemplate {
758
924
  * @param hostBindingTarget - An HTML element to target the host bindings at if different from the
759
925
  * host that the template is being attached to.
760
926
  */
761
- render(source: any, host: Node, hostBindingTarget?: Element): HTMLView;
927
+ render(source: TSource, host: Node, hostBindingTarget?: Element): ElementView<TSource, TParent>;
762
928
  }
763
929
 
764
930
  /**
@@ -766,25 +932,54 @@ export declare interface ElementViewTemplate {
766
932
  * @remarks
767
933
  * Typically returned by APIs that return arrays when there are
768
934
  * no actual items to return.
769
- * @internal
935
+ * @public
770
936
  */
771
937
  export declare const emptyArray: readonly never[];
772
938
 
773
939
  /**
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.
940
+ * A binding behavior for handling events.
779
941
  * @public
780
942
  */
781
- export declare function enableArrayObservation(): void;
943
+ export declare class EventBinding {
944
+ readonly directive: HTMLBindingDirective;
945
+ private contextProperty;
946
+ private sourceProperty;
947
+ /**
948
+ * Creates an instance of EventBinding.
949
+ * @param directive - The directive that has the configuration for this behavior.
950
+ */
951
+ constructor(directive: HTMLBindingDirective);
952
+ /**
953
+ * Bind this behavior to the source.
954
+ * @param source - The source to bind to.
955
+ * @param context - The execution context that the binding is operating within.
956
+ * @param targets - The targets that behaviors in a view can attach to.
957
+ */
958
+ bind(source: any, context: ExecutionContext, targets: ViewBehaviorTargets): void;
959
+ /**
960
+ * Unbinds this behavior from the source.
961
+ * @param source - The source to unbind from.
962
+ * @param context - The execution context that the binding is operating within.
963
+ * @param targets - The targets that behaviors in a view can attach to.
964
+ */
965
+ unbind(source: any, context: ExecutionContext, targets: ViewBehaviorTargets): void;
966
+ /**
967
+ * Creates a behavior.
968
+ * @param targets - The targets available for behaviors to be attached to.
969
+ */
970
+ createBehavior(targets: ViewBehaviorTargets): ViewBehavior;
971
+ /* Excluded from this release type: handleEvent */
972
+ }
782
973
 
783
974
  /**
784
975
  * Provides additional contextual information available to behaviors and expressions.
785
976
  * @public
786
977
  */
787
- export declare class ExecutionContext<TParent = any, TGrandparent = any> {
978
+ export declare class ExecutionContext<TParentSource = any> {
979
+ /**
980
+ * The default execution context.
981
+ */
982
+ static readonly default: ExecutionContext<any>;
788
983
  /**
789
984
  * The index of the current item within a repeat context.
790
985
  */
@@ -794,13 +989,14 @@ export declare class ExecutionContext<TParent = any, TGrandparent = any> {
794
989
  */
795
990
  length: number;
796
991
  /**
797
- * The parent data object within a repeat context.
992
+ * The parent data source within a nested context.
798
993
  */
799
- parent: TParent;
994
+ readonly parent: TParentSource;
800
995
  /**
801
996
  * The parent execution context when in nested context scenarios.
802
997
  */
803
- parentContext: ExecutionContext<TGrandparent>;
998
+ readonly parentContext: ExecutionContext<TParentSource>;
999
+ private constructor();
804
1000
  /**
805
1001
  * The current event within an event handler.
806
1002
  */
@@ -831,24 +1027,47 @@ export declare class ExecutionContext<TParent = any, TGrandparent = any> {
831
1027
  */
832
1028
  get isLast(): boolean;
833
1029
  /**
834
- * Sets the event for the current execution context.
835
- * @param event - The event to set.
836
- * @internal
1030
+ * Returns the typed event detail of a custom event.
1031
+ */
1032
+ eventDetail<TDetail>(): TDetail;
1033
+ /**
1034
+ * Returns the typed event target of the event.
1035
+ */
1036
+ eventTarget<TTarget extends EventTarget>(): TTarget;
1037
+ /**
1038
+ * Updates the position/size on a context associated with a list item.
1039
+ * @param index - The new index of the item.
1040
+ * @param length - The new length of the list.
1041
+ */
1042
+ updatePosition(index: number, length: number): void;
1043
+ /**
1044
+ * Creates a new execution context descendent from the current context.
1045
+ * @param source - The source for the context if different than the parent.
1046
+ * @returns A child execution context.
1047
+ */
1048
+ createChildContext<TParentSource>(parentSource: TParentSource): ExecutionContext<TParentSource>;
1049
+ /**
1050
+ * Creates a new execution context descent suitable for use in list rendering.
1051
+ * @param item - The list item to serve as the source.
1052
+ * @param index - The index of the item in the list.
1053
+ * @param length - The length of the list.
1054
+ */
1055
+ createItemContext(index: number, length: number): ExecutionContext<TParentSource>;
1056
+ /* Excluded from this release type: setEvent */
1057
+ /**
1058
+ * Creates a new root execution context.
1059
+ * @returns A new execution context.
837
1060
  */
838
- static setEvent(event: Event | null): void;
1061
+ static create(): ExecutionContext;
839
1062
  }
840
1063
 
841
- /**
842
- * The FAST global.
843
- * @internal
844
- */
845
- export declare const FAST: FASTGlobal;
1064
+ /* Excluded from this release type: FAST */
846
1065
 
847
1066
  /**
848
1067
  * Represents a custom element based on the FASTElement infrastructure.
849
1068
  * @public
850
1069
  */
851
- export declare interface FASTElement {
1070
+ export declare interface FASTElement extends HTMLElement {
852
1071
  /**
853
1072
  * The underlying controller that handles the lifecycle and rendering of
854
1073
  * this FASTElement.
@@ -886,7 +1105,7 @@ export declare interface FASTElement {
886
1105
  * This method is invoked by the platform whenever an observed
887
1106
  * attribute of FASTElement has a value change.
888
1107
  */
889
- attributeChangedCallback(name: string, oldValue: string, newValue: string): void;
1108
+ attributeChangedCallback(name: string, oldValue: string | null, newValue: string | null): void;
890
1109
  }
891
1110
 
892
1111
  /**
@@ -910,14 +1129,20 @@ export declare const FASTElement: (new () => HTMLElement & FASTElement) & {
910
1129
  * @param nameOrDef - The name of the element to define or a definition object
911
1130
  * that describes the element to define.
912
1131
  */
913
- define<TType extends Function>(type: TType, nameOrDef?: string | PartialFASTElementDefinition | undefined): TType;
1132
+ define<TType extends Constructable<HTMLElement>>(type: TType, nameOrDef?: string | PartialFASTElementDefinition): TType;
1133
+ /**
1134
+ * Defines metadata for a FASTElement which can be used to later define the element.
1135
+ * IMPORTANT: This API will be renamed to "compose" in a future beta.
1136
+ * @public
1137
+ */
1138
+ metadata<TType_1 extends Constructable<HTMLElement> = Constructable<HTMLElement>>(type: TType_1, nameOrDef?: string | PartialFASTElementDefinition): FASTElementDefinition<TType_1>;
914
1139
  };
915
1140
 
916
1141
  /**
917
1142
  * Defines metadata for a FASTElement.
918
1143
  * @public
919
1144
  */
920
- export declare class FASTElementDefinition<TType extends Function = Function> {
1145
+ export declare class FASTElementDefinition<TType extends Constructable<HTMLElement> = Constructable<HTMLElement>> {
921
1146
  private observedAttributes;
922
1147
  /**
923
1148
  * The type this element definition describes.
@@ -969,51 +1194,26 @@ export declare class FASTElementDefinition<TType extends Function = Function> {
969
1194
  /**
970
1195
  * Defines a custom element based on this definition.
971
1196
  * @param registry - The element registry to define the element in.
1197
+ * @remarks
1198
+ * This operation is idempotent per registry.
972
1199
  */
973
1200
  define(registry?: CustomElementRegistry): this;
974
1201
  /**
975
1202
  * Gets the element definition associated with the specified type.
976
1203
  * @param type - The custom element type to retrieve the definition for.
977
1204
  */
978
- static readonly forType: <TType_1 extends Function>(key: TType_1) => FASTElementDefinition<Function> | undefined;
979
- }
980
-
981
- /**
982
- * The FAST global.
983
- * @internal
984
- */
985
- export declare interface FASTGlobal {
986
- /**
987
- * The list of loaded versions.
988
- */
989
- readonly versions: string[];
1205
+ static readonly getByType: (key: Function) => FASTElementDefinition<Constructable<HTMLElement>> | undefined;
990
1206
  /**
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.
1207
+ * Gets the element definition associated with the instance.
1208
+ * @param instance - The custom element instance to retrieve the definition for.
994
1209
  */
995
- getById<T>(id: string | number): T | null;
996
- getById<T>(id: string | number, initialize: () => T): T;
1210
+ static readonly getForInstance: (object: any) => FASTElementDefinition<Constructable<HTMLElement>> | undefined;
997
1211
  }
998
1212
 
999
- /**
1000
- * The platform global type.
1001
- * @public
1002
- */
1003
- export declare type Global = typeof globalThis & {
1004
- /**
1005
- * Enables working with trusted types.
1006
- */
1007
- trustedTypes: TrustedTypes;
1008
- /**
1009
- * The FAST global.
1010
- * @internal
1011
- */
1012
- readonly FAST: FASTGlobal;
1013
- };
1213
+ /* Excluded from this release type: FASTGlobal */
1014
1214
 
1015
1215
  /**
1016
- * Transforms a template literal string into a renderable ViewTemplate.
1216
+ * Transforms a template literal string into a ViewTemplate.
1017
1217
  * @param strings - The string fragments that are interpolated with the values.
1018
1218
  * @param values - The values that are interpolated with the string fragments.
1019
1219
  * @remarks
@@ -1024,77 +1224,135 @@ export declare type Global = typeof globalThis & {
1024
1224
  export declare function html<TSource = any, TParent = any>(strings: TemplateStringsArray, ...values: TemplateValue<TSource, TParent>[]): ViewTemplate<TSource, TParent>;
1025
1225
 
1026
1226
  /**
1027
- * A directive that configures data binding to element content and attributes.
1227
+ * A directive that applies bindings.
1028
1228
  * @public
1029
1229
  */
1030
- export declare class HTMLBindingDirective extends TargetedHTMLDirective {
1230
+ export declare class HTMLBindingDirective implements HTMLDirective, ViewBehaviorFactory, Aspected {
1031
1231
  binding: Binding;
1032
- private cleanedTargetName?;
1033
- private originalTargetName?;
1034
- private bind;
1035
- private unbind;
1036
- private updateTarget;
1037
- private isBindingVolatile;
1232
+ mode: BindingMode;
1233
+ options: any;
1234
+ private factory;
1235
+ /**
1236
+ * The unique id of the factory.
1237
+ */
1238
+ id: string;
1239
+ /**
1240
+ * The structural id of the DOM node to which the created behavior will apply.
1241
+ */
1242
+ nodeId: string;
1243
+ /**
1244
+ * The original source aspect exactly as represented in markup.
1245
+ */
1246
+ sourceAspect: string;
1247
+ /**
1248
+ * The evaluated target aspect, determined after processing the source.
1249
+ */
1250
+ targetAspect: string;
1038
1251
  /**
1039
- * Creates an instance of BindingDirective.
1040
- * @param binding - A binding that returns the data used to update the DOM.
1252
+ * The type of aspect to target.
1041
1253
  */
1042
- constructor(binding: Binding);
1254
+ aspectType: Aspect;
1043
1255
  /**
1044
- * Gets/sets the name of the attribute or property that this
1045
- * binding is targeting.
1256
+ * Creates an instance of HTMLBindingDirective.
1257
+ * @param binding - The binding to apply.
1258
+ * @param mode - The binding mode to use when applying the binding.
1259
+ * @param options - The options to configure the binding with.
1046
1260
  */
1047
- get targetName(): string | undefined;
1048
- set targetName(value: string | undefined);
1261
+ constructor(binding: Binding, mode: BindingMode, options: any);
1049
1262
  /**
1050
- * Makes this binding target the content of an element rather than
1051
- * a particular attribute or property.
1263
+ * Creates HTML to be used within a template.
1264
+ * @param add - Can be used to add behavior factories to a template.
1052
1265
  */
1053
- targetAtContent(): void;
1266
+ createHTML(add: AddViewBehaviorFactory): string;
1054
1267
  /**
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.
1268
+ * Creates a behavior.
1269
+ * @param targets - The targets available for behaviors to be attached to.
1058
1270
  */
1059
- createBehavior(target: Node): BindingBehavior;
1271
+ createBehavior(targets: ViewBehaviorTargets): ViewBehavior;
1060
1272
  }
1061
1273
 
1062
1274
  /**
1063
1275
  * Instructs the template engine to apply behavior to a node.
1064
1276
  * @public
1065
1277
  */
1066
- export declare abstract class HTMLDirective implements NodeBehaviorFactory {
1278
+ export declare interface HTMLDirective {
1067
1279
  /**
1068
- * The index of the DOM node to which the created behavior will apply.
1280
+ * Creates HTML to be used within a template.
1281
+ * @param add - Can be used to add behavior factories to a template.
1069
1282
  */
1070
- targetIndex: number;
1283
+ createHTML(add: AddViewBehaviorFactory): string;
1284
+ }
1285
+
1286
+ /**
1287
+ * Instructs the template engine to apply behavior to a node.
1288
+ * @public
1289
+ */
1290
+ export declare const HTMLDirective: Readonly<{
1071
1291
  /**
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.
1292
+ * Gets the directive definition associated with the instance.
1293
+ * @param instance - The directive instance to retrieve the definition for.
1074
1294
  */
1075
- abstract createPlaceholder(index: number): string;
1295
+ getForInstance: (object: any) => HTMLDirectiveDefinition<Constructable<HTMLDirective>> | undefined;
1076
1296
  /**
1077
- * Creates a behavior for the provided target node.
1078
- * @param target - The node instance to create the behavior for.
1297
+ * Gets the directive definition associated with the specified type.
1298
+ * @param type - The directive type to retrieve the definition for.
1079
1299
  */
1080
- abstract createBehavior(target: Node): Behavior;
1300
+ getByType: (key: Function) => HTMLDirectiveDefinition<Constructable<HTMLDirective>> | undefined;
1301
+ /**
1302
+ * Defines an HTMLDirective based on the options.
1303
+ * @param type - The type to define as a directive.
1304
+ * @param options - Options that specify the directive's application.
1305
+ */
1306
+ define<TType extends Constructable<HTMLDirective>>(type: TType, options?: PartialHTMLDirectiveDefinition): TType;
1307
+ }>;
1308
+
1309
+ /**
1310
+ * Decorator: Defines an HTMLDirective.
1311
+ * @param options - Provides options that specify the directive's application.
1312
+ * @public
1313
+ */
1314
+ export declare function htmlDirective(options?: PartialHTMLDirectiveDefinition): (type: Constructable<HTMLDirective>) => void;
1315
+
1316
+ /**
1317
+ * Defines metadata for an HTMLDirective.
1318
+ * @public
1319
+ */
1320
+ export declare interface HTMLDirectiveDefinition<TType extends Constructable<HTMLDirective> = Constructable<HTMLDirective>> extends Required<PartialHTMLDirectiveDefinition> {
1321
+ /**
1322
+ * The type that the definition provides metadata for.
1323
+ */
1324
+ readonly type: TType;
1325
+ }
1326
+
1327
+ /**
1328
+ * The result of a template compilation operation.
1329
+ * @public
1330
+ */
1331
+ export declare interface HTMLTemplateCompilationResult<TSource = any, TParent = any> {
1332
+ /**
1333
+ * Creates a view instance.
1334
+ * @param hostBindingTarget - The host binding target for the view.
1335
+ */
1336
+ createView(hostBindingTarget?: Element): HTMLView<TSource, TParent>;
1081
1337
  }
1082
1338
 
1083
1339
  /**
1084
1340
  * The standard View implementation, which also implements ElementView and SyntheticView.
1085
1341
  * @public
1086
1342
  */
1087
- export declare class HTMLView implements ElementView, SyntheticView {
1343
+ export declare class HTMLView<TSource = any, TParent = any> implements ElementView<TSource, TParent>, SyntheticView<TSource, TParent> {
1088
1344
  private fragment;
1345
+ private factories;
1346
+ private targets;
1089
1347
  private behaviors;
1090
1348
  /**
1091
1349
  * The data that the view is bound to.
1092
1350
  */
1093
- source: any | null;
1351
+ source: TSource | null;
1094
1352
  /**
1095
1353
  * The execution context the view is running within.
1096
1354
  */
1097
- context: ExecutionContext | null;
1355
+ context: ExecutionContext<TParent> | null;
1098
1356
  /**
1099
1357
  * The first DOM node in the range of nodes that make up the view.
1100
1358
  */
@@ -1108,7 +1366,7 @@ export declare class HTMLView implements ElementView, SyntheticView {
1108
1366
  * @param fragment - The html fragment that contains the nodes for this view.
1109
1367
  * @param behaviors - The behaviors to be applied to this view.
1110
1368
  */
1111
- constructor(fragment: DocumentFragment, behaviors: Behavior[]);
1369
+ constructor(fragment: DocumentFragment, factories: ReadonlyArray<ViewBehaviorFactory>, targets: ViewBehaviorTargets);
1112
1370
  /**
1113
1371
  * Appends the view's DOM nodes to the referenced node.
1114
1372
  * @param node - The parent node to append the view's DOM nodes to.
@@ -1134,7 +1392,7 @@ export declare class HTMLView implements ElementView, SyntheticView {
1134
1392
  * @param source - The binding source for the view's binding behaviors.
1135
1393
  * @param context - The execution context to run the behaviors within.
1136
1394
  */
1137
- bind(source: unknown, context: ExecutionContext): void;
1395
+ bind(source: TSource, context: ExecutionContext<TParent>): void;
1138
1396
  /**
1139
1397
  * Unbinds a view's behaviors from its binding source.
1140
1398
  */
@@ -1147,40 +1405,56 @@ export declare class HTMLView implements ElementView, SyntheticView {
1147
1405
  }
1148
1406
 
1149
1407
  /**
1150
- * Core services shared across FAST instances.
1151
- * @internal
1408
+ * Observes array lengths.
1409
+ * @public
1152
1410
  */
1153
- export declare const enum KernelServiceId {
1154
- updateQueue = 1,
1155
- observable = 2,
1156
- contextEvent = 3,
1157
- elementRegistry = 4
1411
+ export declare interface LengthObserver extends Subscriber {
1412
+ /**
1413
+ * The length of the observed array.
1414
+ */
1415
+ length: number;
1158
1416
  }
1159
1417
 
1160
1418
  /**
1161
- * Reverses all readonly members, making them mutable.
1162
- * @internal
1419
+ * Enables observing the length of an array.
1420
+ * @param array - The array to observe the length of.
1421
+ * @returns The length of the array.
1422
+ * @public
1163
1423
  */
1164
- export declare type Mutable<T> = {
1165
- -readonly [P in keyof T]: T[P];
1166
- };
1424
+ export declare function lengthOf<T>(array: readonly T[]): number;
1167
1425
 
1168
1426
  /**
1169
- * A factory that can create a {@link Behavior} associated with a particular
1170
- * location within a DOM fragment.
1427
+ * Common APIs related to markup generation.
1171
1428
  * @public
1172
1429
  */
1173
- export declare interface NodeBehaviorFactory {
1430
+ export declare const Markup: Readonly<{
1174
1431
  /**
1175
- * The index of the DOM node to which the created behavior will apply.
1432
+ * Creates a placeholder string suitable for marking out a location *within*
1433
+ * an attribute value or HTML content.
1434
+ * @param index - The directive index to create the placeholder for.
1435
+ * @remarks
1436
+ * Used internally by binding directives.
1176
1437
  */
1177
- targetIndex: number;
1438
+ interpolation: (id: string) => string;
1178
1439
  /**
1179
- * Creates a behavior for the provided target node.
1180
- * @param target - The node instance to create the behavior for.
1440
+ * Creates a placeholder that manifests itself as an attribute on an
1441
+ * element.
1442
+ * @param attributeName - The name of the custom attribute.
1443
+ * @param index - The directive index to create the placeholder for.
1444
+ * @remarks
1445
+ * Used internally by attribute directives such as `ref`, `slotted`, and `children`.
1181
1446
  */
1182
- createBehavior(target: Node): Behavior;
1183
- }
1447
+ attribute: (id: string) => string;
1448
+ /**
1449
+ * Creates a placeholder that manifests itself as a marker within the DOM structure.
1450
+ * @param index - The directive index to create the placeholder for.
1451
+ * @remarks
1452
+ * Used internally by structural directives such as `repeat`.
1453
+ */
1454
+ comment: (id: string) => string;
1455
+ }>;
1456
+
1457
+ /* Excluded from this release type: Mutable */
1184
1458
 
1185
1459
  /**
1186
1460
  * Options for configuring node observation behavior.
@@ -1203,61 +1477,72 @@ export declare interface NodeBehaviorOptions<T = any> {
1203
1477
 
1204
1478
  /**
1205
1479
  * A base class for node observation.
1206
- * @internal
1480
+ * @public
1481
+ * @remarks
1482
+ * Internally used by the SlottedDirective and the ChildrenDirective.
1207
1483
  */
1208
- declare abstract class NodeObservationBehavior<T extends NodeBehaviorOptions> implements Behavior {
1209
- protected target: HTMLElement;
1210
- protected options: T;
1211
- private source;
1212
- private shouldUpdate;
1484
+ export declare abstract class NodeObservationDirective<T extends NodeBehaviorOptions> extends StatelessAttachedAttributeDirective<T> {
1485
+ private sourceProperty;
1213
1486
  /**
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.
1487
+ * Bind this behavior to the source.
1488
+ * @param source - The source to bind to.
1489
+ * @param context - The execution context that the binding is operating within.
1490
+ * @param targets - The targets that behaviors in a view can attach to.
1217
1491
  */
1218
- constructor(target: HTMLElement, options: T);
1492
+ bind(source: any, context: ExecutionContext, targets: ViewBehaviorTargets): void;
1219
1493
  /**
1220
- * Begins observation of the nodes.
1494
+ * Unbinds this behavior from the source.
1495
+ * @param source - The source to unbind from.
1496
+ * @param context - The execution context that the binding is operating within.
1497
+ * @param targets - The targets that behaviors in a view can attach to.
1221
1498
  */
1222
- abstract observe(): void;
1499
+ unbind(source: any, context: ExecutionContext, targets: ViewBehaviorTargets): void;
1223
1500
  /**
1224
- * Disconnects observation of the nodes.
1501
+ * Gets the data source for the target.
1502
+ * @param target - The target to get the source for.
1503
+ * @returns The source.
1225
1504
  */
1226
- abstract disconnect(): void;
1505
+ protected getSource(target: Node): any;
1227
1506
  /**
1228
- * Retrieves the nodes that should be assigned to the target.
1507
+ * Updates the source property with the computed nodes.
1508
+ * @param source - The source object to assign the nodes property to.
1509
+ * @param value - The nodes to assign to the source object property.
1229
1510
  */
1230
- protected abstract getNodes(): Node[];
1511
+ protected updateTarget(source: any, value: ReadonlyArray<any>): void;
1231
1512
  /**
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.
1513
+ * Computes the set of nodes that should be assigned to the source property.
1514
+ * @param target - The target to compute the nodes for.
1515
+ * @returns The computed nodes.
1516
+ * @remarks
1517
+ * Applies filters if provided.
1235
1518
  */
1236
- bind(source: any): void;
1519
+ protected computeNodes(target: any): Node[];
1237
1520
  /**
1238
- * Unbinds this behavior from the source.
1239
- * @param source - The source to unbind from.
1521
+ * Begins observation of the nodes.
1522
+ * @param target - The target to observe.
1240
1523
  */
1241
- unbind(): void;
1242
- /** @internal */
1243
- handleEvent(): void;
1244
- private computeNodes;
1245
- private updateTarget;
1524
+ protected abstract observe(target: any): void;
1525
+ /**
1526
+ * Disconnects observation of the nodes.
1527
+ * @param target - The target to unobserve.
1528
+ */
1529
+ protected abstract disconnect(target: any): void;
1530
+ /**
1531
+ * Retrieves the raw nodes that should be assigned to the source property.
1532
+ * @param target - The target to get the node to.
1533
+ */
1534
+ protected abstract getNodes(target: any): Node[];
1246
1535
  }
1247
1536
 
1248
- declare function normalBind(this: BindingBehavior, source: unknown, context: ExecutionContext): void;
1249
-
1250
- declare function normalUnbind(this: BindingBehavior): void;
1251
-
1252
1537
  /**
1253
- * Provides change notification for a source object.
1538
+ * Provides change notifications for an observed subject.
1254
1539
  * @public
1255
1540
  */
1256
1541
  export declare interface Notifier {
1257
1542
  /**
1258
- * The source object that this notifier provides change notification for.
1543
+ * The object that subscribers will receive notifications for.
1259
1544
  */
1260
- readonly source: any;
1545
+ readonly subject: any;
1261
1546
  /**
1262
1547
  * Notifies all subscribers, based on the args.
1263
1548
  * @param args - Data passed along to subscribers during notification.
@@ -1298,16 +1583,12 @@ export declare const nullableNumberConverter: ValueConverter;
1298
1583
  * @public
1299
1584
  */
1300
1585
  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;
1586
+ /* Excluded from this release type: setArrayObserverFactory */
1306
1587
  /**
1307
1588
  * Gets a notifier for an object or Array.
1308
1589
  * @param source - The object or Array to get the notifier for.
1309
1590
  */
1310
- getNotifier: (source: any) => Notifier;
1591
+ getNotifier: <T extends Notifier = Notifier>(source: any) => T;
1311
1592
  /**
1312
1593
  * Records a property change for a source object.
1313
1594
  * @param source - The object to record the change against.
@@ -1345,13 +1626,13 @@ export declare const Observable: Readonly<{
1345
1626
  * @param initialSubscriber - An initial subscriber to changes in the binding value.
1346
1627
  * @param isVolatileBinding - Indicates whether the binding's dependency list must be re-evaluated on every value evaluation.
1347
1628
  */
1348
- binding<TSource = any, TReturn = any, TParent = any>(binding: Binding<TSource, TReturn, TParent>, initialSubscriber?: Subscriber | undefined, isVolatileBinding?: boolean): BindingObserver<TSource, TReturn, TParent>;
1629
+ binding<TSource = any, TReturn = any>(binding: Binding<TSource, TReturn, any>, initialSubscriber?: Subscriber, isVolatileBinding?: boolean): BindingObserver<TSource, TReturn, any>;
1349
1630
  /**
1350
1631
  * Determines whether a binding expression is volatile and needs to have its dependency list re-evaluated
1351
1632
  * on every evaluation of the value.
1352
1633
  * @param binding - The binding to inspect.
1353
1634
  */
1354
- isVolatileBinding<TSource_1 = any, TReturn_1 = any, TParent_1 = any>(binding: Binding<TSource_1, TReturn_1, TParent_1>): boolean;
1635
+ isVolatileBinding<TSource_1 = any, TReturn_1 = any>(binding: Binding<TSource_1, TReturn_1, any>): boolean;
1355
1636
  }>;
1356
1637
 
1357
1638
  /**
@@ -1377,6 +1658,48 @@ export declare interface ObservationRecord {
1377
1658
  propertyName: string;
1378
1659
  }
1379
1660
 
1661
+ /**
1662
+ * The default onChange binding configuration.
1663
+ * @public
1664
+ */
1665
+ export declare const onChange: BindingConfig<AddEventListenerOptions> & BindingConfigResolver<AddEventListenerOptions>;
1666
+
1667
+ /**
1668
+ * The default onTime binding configuration.
1669
+ * @public
1670
+ */
1671
+ export declare const oneTime: BindingConfig<AddEventListenerOptions> & BindingConfigResolver<AddEventListenerOptions>;
1672
+
1673
+ /**
1674
+ * A binding behavior for one-time bindings.
1675
+ * @public
1676
+ */
1677
+ export declare class OneTimeBinding extends UpdateBinding {
1678
+ /**
1679
+ * Bind this behavior to the source.
1680
+ * @param source - The source to bind to.
1681
+ * @param context - The execution context that the binding is operating within.
1682
+ * @param targets - The targets that behaviors in a view can attach to.
1683
+ */
1684
+ bind(source: any, context: ExecutionContext, targets: ViewBehaviorTargets): void;
1685
+ }
1686
+
1687
+ /**
1688
+ * Common APIs related to content parsing.
1689
+ * @public
1690
+ */
1691
+ export declare const Parser: Readonly<{
1692
+ /**
1693
+ * Parses text content or HTML attribute content, separating out the static strings
1694
+ * from the directives.
1695
+ * @param value - The content or attribute string to parse.
1696
+ * @param factories - A list of directives to search for in the string.
1697
+ * @returns A heterogeneous array of static strings interspersed with
1698
+ * directives or null if no directives are found in the string.
1699
+ */
1700
+ parse(value: string, factories: Record<string, ViewBehaviorFactory>): (string | ViewBehaviorFactory)[] | null;
1701
+ }>;
1702
+
1380
1703
  /**
1381
1704
  * Represents metadata configuration for a custom element.
1382
1705
  * @public
@@ -1408,6 +1731,18 @@ export declare interface PartialFASTElementDefinition {
1408
1731
  readonly elementOptions?: ElementDefinitionOptions;
1409
1732
  }
1410
1733
 
1734
+ /**
1735
+ * Represents metadata configuration for an HTMLDirective.
1736
+ * @public
1737
+ */
1738
+ export declare interface PartialHTMLDirectiveDefinition {
1739
+ /**
1740
+ * Indicates whether the directive needs access to template contextual information
1741
+ * such as the sourceAspect, targetAspect, and aspectType.
1742
+ */
1743
+ aspected?: boolean;
1744
+ }
1745
+
1411
1746
  /**
1412
1747
  * An implementation of Notifier that allows subscribers to be notified
1413
1748
  * of individual property changes on an object.
@@ -1415,16 +1750,16 @@ export declare interface PartialFASTElementDefinition {
1415
1750
  */
1416
1751
  export declare class PropertyChangeNotifier implements Notifier {
1417
1752
  private subscribers;
1418
- private sourceSubscribers;
1753
+ private subjectSubscribers;
1419
1754
  /**
1420
- * The source that property changes are being notified for.
1755
+ * The subject that property changes are being notified for.
1421
1756
  */
1422
- readonly source: any;
1757
+ readonly subject: any;
1423
1758
  /**
1424
- * Creates an instance of PropertyChangeNotifier for the specified source.
1425
- * @param source - The object source that subscribers will receive notifications from.
1759
+ * Creates an instance of PropertyChangeNotifier for the specified subject.
1760
+ * @param subject - The object that subscribers will receive notifications for.
1426
1761
  */
1427
- constructor(source: any);
1762
+ constructor(subject: any);
1428
1763
  /**
1429
1764
  * Notifies all subscribers, based on the specified property.
1430
1765
  * @param propertyName - The property name, passed along to subscribers during notification.
@@ -1449,27 +1784,20 @@ export declare class PropertyChangeNotifier implements Notifier {
1449
1784
  * @param propertyName - The name of the property to assign the reference to.
1450
1785
  * @public
1451
1786
  */
1452
- export declare function ref<T = any>(propertyName: keyof T & string): CaptureType<T>;
1787
+ export declare const ref: <T = any>(propertyName: keyof T & string) => CaptureType<T>;
1453
1788
 
1454
1789
  /**
1455
1790
  * The runtime behavior for template references.
1456
1791
  * @public
1457
1792
  */
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);
1793
+ export declare class RefDirective extends StatelessAttachedAttributeDirective<string> {
1467
1794
  /**
1468
1795
  * Bind this behavior to the source.
1469
1796
  * @param source - The source to bind to.
1470
1797
  * @param context - The execution context that the binding is operating within.
1798
+ * @param targets - The targets that behaviors in a view can attach to.
1471
1799
  */
1472
- bind(source: any): void;
1800
+ bind(source: any, context: ExecutionContext, targets: ViewBehaviorTargets): void;
1473
1801
  /**
1474
1802
  * Unbinds this behavior from the source.
1475
1803
  * @param source - The source to unbind from.
@@ -1477,6 +1805,8 @@ export declare class RefBehavior implements Behavior {
1477
1805
  unbind(): void;
1478
1806
  }
1479
1807
 
1808
+ declare const reflectMode = "reflect";
1809
+
1480
1810
  /**
1481
1811
  * A directive that enables list rendering.
1482
1812
  * @param itemsBinding - The array to render.
@@ -1485,7 +1815,7 @@ export declare class RefBehavior implements Behavior {
1485
1815
  * @param options - Options used to turn on special repeat features.
1486
1816
  * @public
1487
1817
  */
1488
- export declare function repeat<TSource = any, TItem = any>(itemsBinding: Binding<TSource, readonly TItem[]>, templateOrTemplateBinding: SyntheticViewTemplate | Binding<TSource, SyntheticViewTemplate>, options?: RepeatOptions): CaptureType<TSource>;
1818
+ export declare function repeat<TSource = any, TArray extends ReadonlyArray<any> = ReadonlyArray<any>>(itemsBinding: Binding<TSource, TArray, ExecutionContext<TSource>>, templateOrTemplateBinding: ViewTemplate | Binding<TSource, ViewTemplate>, options?: RepeatOptions): CaptureType<TSource>;
1489
1819
 
1490
1820
  /**
1491
1821
  * A behavior that renders a template for each item in an array.
@@ -1503,7 +1833,7 @@ export declare class RepeatBehavior<TSource = any> implements Behavior, Subscrib
1503
1833
  private items;
1504
1834
  private itemsObserver;
1505
1835
  private itemsBindingObserver;
1506
- private originalContext;
1836
+ private context;
1507
1837
  private childContext;
1508
1838
  private bindView;
1509
1839
  /**
@@ -1527,7 +1857,11 @@ export declare class RepeatBehavior<TSource = any> implements Behavior, Subscrib
1527
1857
  * @param source - The source to unbind from.
1528
1858
  */
1529
1859
  unbind(): void;
1530
- /** @internal */
1860
+ /**
1861
+ * Handles changes in the array, its items, and the repeat template.
1862
+ * @param source - The source of the change.
1863
+ * @param args - The details about what was changed.
1864
+ */
1531
1865
  handleChange(source: any, args: Splice[]): void;
1532
1866
  private observeItems;
1533
1867
  private updateViews;
@@ -1539,17 +1873,25 @@ export declare class RepeatBehavior<TSource = any> implements Behavior, Subscrib
1539
1873
  * A directive that configures list rendering.
1540
1874
  * @public
1541
1875
  */
1542
- export declare class RepeatDirective<TSource = any> extends HTMLDirective {
1543
- private itemsBinding;
1544
- private templateBinding;
1545
- private options;
1876
+ export declare class RepeatDirective<TSource = any> implements HTMLDirective, ViewBehaviorFactory {
1877
+ readonly itemsBinding: Binding;
1878
+ readonly templateBinding: Binding<TSource, SyntheticViewTemplate>;
1879
+ readonly options: RepeatOptions;
1546
1880
  private isItemsBindingVolatile;
1547
1881
  private isTemplateBindingVolatile;
1882
+ /**
1883
+ * The unique id of the factory.
1884
+ */
1885
+ id: string;
1886
+ /**
1887
+ * The structural id of the DOM node to which the created behavior will apply.
1888
+ */
1889
+ nodeId: string;
1548
1890
  /**
1549
1891
  * Creates a placeholder string based on the directive's index within the template.
1550
1892
  * @param index - The index of the directive within the template.
1551
1893
  */
1552
- createPlaceholder: (index: number) => string;
1894
+ createHTML(add: AddViewBehaviorFactory): string;
1553
1895
  /**
1554
1896
  * Creates an instance of RepeatDirective.
1555
1897
  * @param itemsBinding - The binding that provides the array to render.
@@ -1561,7 +1903,7 @@ export declare class RepeatDirective<TSource = any> extends HTMLDirective {
1561
1903
  * Creates a behavior for the provided target node.
1562
1904
  * @param target - The node instance to create the behavior for.
1563
1905
  */
1564
- createBehavior(target: Node): RepeatBehavior<TSource>;
1906
+ createBehavior(targets: ViewBehaviorTargets): RepeatBehavior<TSource>;
1565
1907
  }
1566
1908
 
1567
1909
  /**
@@ -1585,57 +1927,251 @@ export declare interface RepeatOptions {
1585
1927
  * @param propertyOrOptions - The options used to configure slotted node observation.
1586
1928
  * @public
1587
1929
  */
1588
- export declare function slotted<T = any>(propertyOrOptions: (keyof T & string) | SlottedBehaviorOptions<keyof T & string>): CaptureType<T>;
1930
+ export declare function slotted<T = any>(propertyOrOptions: (keyof T & string) | SlottedDirectiveOptions<keyof T & string>): CaptureType<T>;
1589
1931
 
1590
1932
  /**
1591
1933
  * The runtime behavior for slotted node observation.
1592
1934
  * @public
1593
1935
  */
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);
1936
+ export declare class SlottedDirective extends NodeObservationDirective<SlottedDirectiveOptions> {
1601
1937
  /**
1602
1938
  * Begins observation of the nodes.
1939
+ * @param target - The target to observe.
1603
1940
  */
1604
- observe(): void;
1941
+ observe(target: EventSource): void;
1605
1942
  /**
1606
1943
  * Disconnects observation of the nodes.
1944
+ * @param target - The target to unobserve.
1607
1945
  */
1608
- disconnect(): void;
1946
+ disconnect(target: EventSource): void;
1609
1947
  /**
1610
- * Retrieves the nodes that should be assigned to the target.
1948
+ * Retrieves the raw nodes that should be assigned to the source property.
1949
+ * @param target - The target to get the node to.
1611
1950
  */
1612
- protected getNodes(): Node[];
1951
+ getNodes(target: HTMLSlotElement): Node[];
1952
+ /* Excluded from this release type: handleEvent */
1613
1953
  }
1614
1954
 
1615
1955
  /**
1616
1956
  * The options used to configure slotted node observation.
1617
1957
  * @public
1618
1958
  */
1619
- export declare interface SlottedBehaviorOptions<T = any> extends NodeBehaviorOptions<T>, AssignedNodesOptions {
1959
+ export declare interface SlottedDirectiveOptions<T = any> extends NodeBehaviorOptions<T>, AssignedNodesOptions {
1620
1960
  }
1621
1961
 
1622
1962
  /**
1623
- * Represents a set of splice-based changes against an Array.
1963
+ * A splice map is a representation of how a previous array of items
1964
+ * was transformed into a new array of items. Conceptually it is a list of
1965
+ * tuples of
1966
+ *
1967
+ * (index, removed, addedCount)
1968
+ *
1969
+ * which are kept in ascending index order of. The tuple represents that at
1970
+ * the |index|, |removed| sequence of items were removed, and counting forward
1971
+ * from |index|, |addedCount| items were added.
1624
1972
  * @public
1625
1973
  */
1626
- export declare interface Splice {
1974
+ export declare class Splice {
1975
+ index: number;
1976
+ removed: any[];
1977
+ addedCount: number;
1627
1978
  /**
1628
- * The index that the splice occurs at.
1979
+ * Indicates that this splice represents a complete array reset.
1629
1980
  */
1630
- index: number;
1981
+ reset?: boolean;
1631
1982
  /**
1632
- * The items that were removed.
1983
+ * Creates a splice.
1984
+ * @param index - The index that the splice occurs at.
1985
+ * @param removed - The items that were removed.
1986
+ * @param addedCount - The number of items that were added.
1633
1987
  */
1634
- removed: any[];
1988
+ constructor(index: number, removed: any[], addedCount: number);
1635
1989
  /**
1636
- * The number of items that were added.
1990
+ * Adjusts the splice index based on the provided array.
1991
+ * @param array - The array to adjust to.
1992
+ * @returns The same splice, mutated based on the reference array.
1637
1993
  */
1638
- addedCount: number;
1994
+ adjustTo(array: any[]): this;
1995
+ }
1996
+
1997
+ /**
1998
+ * An approach to tracking changes in an array.
1999
+ * @public
2000
+ */
2001
+ export declare interface SpliceStrategy {
2002
+ /**
2003
+ * The level of feature support the splice strategy provides.
2004
+ */
2005
+ readonly support: SpliceStrategySupport;
2006
+ /**
2007
+ * Normalizes the splices before delivery to array change subscribers.
2008
+ * @param previous - The previous version of the array if a reset has taken place.
2009
+ * @param current - The current version of the array.
2010
+ * @param changes - The set of changes tracked against the array.
2011
+ */
2012
+ normalize(previous: unknown[] | undefined, current: unknown[], changes: Splice[] | undefined): readonly Splice[];
2013
+ /**
2014
+ * Performs and tracks a pop operation on an array.
2015
+ * @param array - The array to track the change for.
2016
+ * @param observer - The observer to register the change with.
2017
+ * @param pop - The operation to perform.
2018
+ * @param args - The arguments for the operation.
2019
+ */
2020
+ pop(array: any[], observer: ArrayObserver, pop: typeof Array.prototype.pop, args: any[]): any;
2021
+ /**
2022
+ * Performs and tracks a push operation on an array.
2023
+ * @param array - The array to track the change for.
2024
+ * @param observer - The observer to register the change with.
2025
+ * @param push - The operation to perform.
2026
+ * @param args - The arguments for the operation.
2027
+ */
2028
+ push(array: any[], observer: ArrayObserver, push: typeof Array.prototype.push, args: any[]): any;
2029
+ /**
2030
+ * Performs and tracks a reverse operation on an array.
2031
+ * @param array - The array to track the change for.
2032
+ * @param observer - The observer to register the change with.
2033
+ * @param reverse - The operation to perform.
2034
+ * @param args - The arguments for the operation.
2035
+ */
2036
+ reverse(array: any[], observer: ArrayObserver, reverse: typeof Array.prototype.reverse, args: any[]): any;
2037
+ /**
2038
+ * Performs and tracks a shift operation on an array.
2039
+ * @param array - The array to track the change for.
2040
+ * @param observer - The observer to register the change with.
2041
+ * @param shift - The operation to perform.
2042
+ * @param args - The arguments for the operation.
2043
+ */
2044
+ shift(array: any[], observer: ArrayObserver, shift: typeof Array.prototype.shift, args: any[]): any;
2045
+ /**
2046
+ * Performs and tracks a sort operation on an array.
2047
+ * @param array - The array to track the change for.
2048
+ * @param observer - The observer to register the change with.
2049
+ * @param sort - The operation to perform.
2050
+ * @param args - The arguments for the operation.
2051
+ */
2052
+ sort(array: any[], observer: ArrayObserver, sort: typeof Array.prototype.sort, args: any[]): any[];
2053
+ /**
2054
+ * Performs and tracks a splice operation on an array.
2055
+ * @param array - The array to track the change for.
2056
+ * @param observer - The observer to register the change with.
2057
+ * @param splice - The operation to perform.
2058
+ * @param args - The arguments for the operation.
2059
+ */
2060
+ splice(array: any[], observer: ArrayObserver, splice: typeof Array.prototype.splice, args: any[]): any;
2061
+ /**
2062
+ * Performs and tracks an unshift operation on an array.
2063
+ * @param array - The array to track the change for.
2064
+ * @param observer - The observer to register the change with.
2065
+ * @param unshift - The operation to perform.
2066
+ * @param args - The arguments for the operation.
2067
+ */
2068
+ unshift(array: any[], observer: ArrayObserver, unshift: typeof Array.prototype.unshift, args: any[]): any[];
2069
+ }
2070
+
2071
+ /**
2072
+ * Functionality related to tracking changes in arrays.
2073
+ * @public
2074
+ */
2075
+ export declare const SpliceStrategy: Readonly<{
2076
+ /**
2077
+ * A set of changes that represent a full array reset.
2078
+ */
2079
+ readonly reset: Splice[];
2080
+ /**
2081
+ * Sets the default strategy to use for array observers.
2082
+ * @param strategy - The splice strategy to use.
2083
+ */
2084
+ readonly setDefaultStrategy: (strategy: SpliceStrategy) => void;
2085
+ }>;
2086
+
2087
+ /**
2088
+ * Indicates what level of feature support the splice
2089
+ * strategy provides.
2090
+ * @public
2091
+ */
2092
+ export declare const SpliceStrategySupport: Readonly<{
2093
+ /**
2094
+ * Only supports resets.
2095
+ */
2096
+ readonly reset: 1;
2097
+ /**
2098
+ * Supports tracking splices and resets.
2099
+ */
2100
+ readonly splice: 2;
2101
+ /**
2102
+ * Supports tracking splices and resets, while applying some form
2103
+ * of optimization, such as merging, to the splices.
2104
+ */
2105
+ readonly optimized: 3;
2106
+ }>;
2107
+
2108
+ /**
2109
+ * The available values for SpliceStrategySupport.
2110
+ * @public
2111
+ */
2112
+ export declare type SpliceStrategySupport = typeof SpliceStrategySupport[keyof typeof SpliceStrategySupport];
2113
+
2114
+ /**
2115
+ * A base class used for attribute directives that don't need internal state.
2116
+ * @public
2117
+ */
2118
+ export declare abstract class StatelessAttachedAttributeDirective<T> implements HTMLDirective, ViewBehaviorFactory, ViewBehavior {
2119
+ protected options: T;
2120
+ /**
2121
+ * The unique id of the factory.
2122
+ */
2123
+ id: string;
2124
+ /**
2125
+ * The structural id of the DOM node to which the created behavior will apply.
2126
+ */
2127
+ nodeId: string;
2128
+ /**
2129
+ * Creates an instance of RefDirective.
2130
+ * @param options - The options to use in configuring the directive.
2131
+ */
2132
+ constructor(options: T);
2133
+ /**
2134
+ * Creates a behavior.
2135
+ * @param targets - The targets available for behaviors to be attached to.
2136
+ */
2137
+ createBehavior(targets: ViewBehaviorTargets): ViewBehavior;
2138
+ /**
2139
+ * Creates a placeholder string based on the directive's index within the template.
2140
+ * @param index - The index of the directive within the template.
2141
+ * @remarks
2142
+ * Creates a custom attribute placeholder.
2143
+ */
2144
+ createHTML(add: AddViewBehaviorFactory): string;
2145
+ /**
2146
+ * Bind this behavior to the source.
2147
+ * @param source - The source to bind to.
2148
+ * @param context - The execution context that the binding is operating within.
2149
+ * @param targets - The targets that behaviors in a view can attach to.
2150
+ */
2151
+ abstract bind(source: any, context: ExecutionContext, targets: ViewBehaviorTargets): void;
2152
+ /**
2153
+ * Unbinds this behavior from the source.
2154
+ * @param source - The source to unbind from.
2155
+ */
2156
+ abstract unbind(source: any, context: ExecutionContext, targets: ViewBehaviorTargets): void;
2157
+ }
2158
+
2159
+ /**
2160
+ * Implemented to provide specific behavior when adding/removing styles
2161
+ * for elements.
2162
+ * @public
2163
+ */
2164
+ export declare interface StyleStrategy {
2165
+ /**
2166
+ * Adds styles to the target.
2167
+ * @param target - The target to add the styles to.
2168
+ */
2169
+ addStylesTo(target: StyleTarget): void;
2170
+ /**
2171
+ * Removes styles from the target.
2172
+ * @param target - The target to remove the styles from.
2173
+ */
2174
+ removeStylesFrom(target: StyleTarget): void;
1639
2175
  }
1640
2176
 
1641
2177
  /**
@@ -1652,12 +2188,6 @@ export declare interface StyleTarget {
1652
2188
  * @param styles - The styles element to add.
1653
2189
  */
1654
2190
  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
2191
  /**
1662
2192
  * Removes styles from the target.
1663
2193
  * @param styles - The styles element to remove.
@@ -1676,17 +2206,17 @@ export declare interface StyleTarget {
1676
2206
  */
1677
2207
  export declare interface Subscriber {
1678
2208
  /**
1679
- * Called when a source this instance has subscribed to changes.
1680
- * @param source - The source of the change.
2209
+ * Called when a subject this instance has subscribed to changes.
2210
+ * @param subject - The subject of the change.
1681
2211
  * @param args - The event args detailing the change that occurred.
1682
2212
  */
1683
- handleChange(source: any, args: any): void;
2213
+ handleChange(subject: any, args: any): void;
1684
2214
  }
1685
2215
 
1686
2216
  /**
1687
2217
  * An implementation of {@link Notifier} that efficiently keeps track of
1688
2218
  * subscribers interested in a specific change notification on an
1689
- * observable source.
2219
+ * observable subject.
1690
2220
  *
1691
2221
  * @remarks
1692
2222
  * This set is optimized for the most common scenario of 1 or 2 subscribers.
@@ -1699,15 +2229,15 @@ export declare class SubscriberSet implements Notifier {
1699
2229
  private sub2;
1700
2230
  private spillover;
1701
2231
  /**
1702
- * The source that this subscriber set is reporting changes for.
2232
+ * The object that subscribers will receive notifications for.
1703
2233
  */
1704
- readonly source: any;
2234
+ readonly subject: any;
1705
2235
  /**
1706
- * Creates an instance of SubscriberSet for the specified source.
1707
- * @param source - The object source that subscribers will receive notifications from.
2236
+ * Creates an instance of SubscriberSet for the specified subject.
2237
+ * @param subject - The subject that subscribers will receive notifications from.
1708
2238
  * @param initialSubscriber - An initial subscriber to changes.
1709
2239
  */
1710
- constructor(source: any, initialSubscriber?: Subscriber);
2240
+ constructor(subject: any, initialSubscriber?: Subscriber);
1711
2241
  /**
1712
2242
  * Checks whether the provided subscriber has been added to this set.
1713
2243
  * @param subscriber - The subscriber to test for inclusion in this set.
@@ -1734,7 +2264,7 @@ export declare class SubscriberSet implements Notifier {
1734
2264
  * The options used to configure subtree observation.
1735
2265
  * @public
1736
2266
  */
1737
- export declare interface SubtreeBehaviorOptions<T = any> extends Omit<NodeBehaviorOptions<T>, "filter">, Omit<MutationObserverInit, "subtree" | "childList"> {
2267
+ export declare interface SubtreeDirectiveOptions<T = any> extends NodeBehaviorOptions<T>, Omit<MutationObserverInit, "subtree" | "childList"> {
1738
2268
  /**
1739
2269
  * Indicates that child subtrees should be observed for changes.
1740
2270
  */
@@ -1750,7 +2280,7 @@ export declare interface SubtreeBehaviorOptions<T = any> extends Omit<NodeBehavi
1750
2280
  * A view representing a range of DOM nodes which can be added/removed ad hoc.
1751
2281
  * @public
1752
2282
  */
1753
- export declare interface SyntheticView extends View {
2283
+ export declare interface SyntheticView<TSource = any, TParent = any> extends View<TSource, TParent> {
1754
2284
  /**
1755
2285
  * The first DOM node in the range of nodes that make up the view.
1756
2286
  */
@@ -1769,11 +2299,6 @@ export declare interface SyntheticView extends View {
1769
2299
  * The nodes are not disposed and the view can later be re-inserted.
1770
2300
  */
1771
2301
  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
2302
  }
1778
2303
 
1779
2304
  /**
@@ -1784,31 +2309,14 @@ export declare interface SyntheticViewTemplate<TSource = any, TParent = any> {
1784
2309
  /**
1785
2310
  * Creates a SyntheticView instance based on this template definition.
1786
2311
  */
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;
2312
+ create(): SyntheticView<TSource, TParent>;
1805
2313
  }
1806
2314
 
1807
2315
  /**
1808
2316
  * Represents the types of values that can be interpolated into a template.
1809
2317
  * @public
1810
2318
  */
1811
- export declare type TemplateValue<TScope, TParent = any> = Binding<TScope, any, TParent> | string | number | HTMLDirective | CaptureType<TScope>;
2319
+ export declare type TemplateValue<TSource, TParent = any> = Binding<TSource, any, TParent> | HTMLDirective | CaptureType<TSource>;
1812
2320
 
1813
2321
  /**
1814
2322
  * Enables working with trusted types.
@@ -1835,7 +2343,107 @@ export declare type TrustedTypesPolicy = {
1835
2343
  createHTML(html: string): string;
1836
2344
  };
1837
2345
 
1838
- declare function updatePropertyTarget(this: BindingBehavior, value: unknown): void;
2346
+ /* Excluded from this release type: TypeDefinition */
2347
+
2348
+ /* Excluded from this release type: TypeRegistry */
2349
+
2350
+ /**
2351
+ * A base binding behavior for DOM updates.
2352
+ * @public
2353
+ */
2354
+ export declare class UpdateBinding implements ViewBehavior {
2355
+ readonly directive: HTMLBindingDirective;
2356
+ protected updateTarget: UpdateTarget;
2357
+ /**
2358
+ * Creates an instance of UpdateBinding.
2359
+ * @param directive - The directive that has the configuration for this behavior.
2360
+ * @param updateTarget - The function used to update the target with the latest value.
2361
+ */
2362
+ constructor(directive: HTMLBindingDirective, updateTarget: UpdateTarget);
2363
+ /**
2364
+ * Bind this behavior to the source.
2365
+ * @param source - The source to bind to.
2366
+ * @param context - The execution context that the binding is operating within.
2367
+ * @param targets - The targets that behaviors in a view can attach to.
2368
+ */
2369
+ bind(source: any, context: ExecutionContext, targets: ViewBehaviorTargets): void;
2370
+ /**
2371
+ * Unbinds this behavior from the source.
2372
+ * @param source - The source to unbind from.
2373
+ * @param context - The execution context that the binding is operating within.
2374
+ * @param targets - The targets that behaviors in a view can attach to.
2375
+ */
2376
+ unbind(source: any, context: ExecutionContext, targets: ViewBehaviorTargets): void;
2377
+ /**
2378
+ * Creates a behavior.
2379
+ * @param targets - The targets available for behaviors to be attached to.
2380
+ */
2381
+ createBehavior(targets: ViewBehaviorTargets): ViewBehavior;
2382
+ }
2383
+
2384
+ /**
2385
+ * A work queue used to synchronize writes to the DOM.
2386
+ * @public
2387
+ */
2388
+ export declare interface UpdateQueue {
2389
+ /**
2390
+ * Schedules DOM update work in the next batch.
2391
+ * @param callable - The callable function or object to queue.
2392
+ */
2393
+ enqueue(callable: Callable): void;
2394
+ /**
2395
+ * Resolves with the next DOM update.
2396
+ */
2397
+ next(): Promise<void>;
2398
+ /**
2399
+ * Immediately processes all work previously scheduled
2400
+ * through enqueue.
2401
+ * @remarks
2402
+ * This also forces next() promises
2403
+ * to resolve.
2404
+ */
2405
+ process(): void;
2406
+ /**
2407
+ * Sets the update mode used by enqueue.
2408
+ * @param isAsync - Indicates whether DOM updates should be asynchronous.
2409
+ * @remarks
2410
+ * By default, the update mode is asynchronous, since that provides the best
2411
+ * performance in the browser. Passing false to setMode will instead cause
2412
+ * the queue to be immediately processed for each call to enqueue. However,
2413
+ * ordering will still be preserved so that nested tasks do not run until
2414
+ * after parent tasks complete.
2415
+ */
2416
+ setMode(isAsync: boolean): void;
2417
+ }
2418
+
2419
+ /**
2420
+ * The default UpdateQueue.
2421
+ * @public
2422
+ */
2423
+ export declare const Updates: UpdateQueue;
2424
+
2425
+ /**
2426
+ * A target update function.
2427
+ * @param this - The "this" context for the update.
2428
+ * @param target - The node that is targeted by the update.
2429
+ * @param aspect - The aspect of the node that is being targeted.
2430
+ * @param value - The value to assign to the aspect.
2431
+ * @param source - The source object that the value was derived from.
2432
+ * @param context - The execution context that the binding is being run under.
2433
+ * @public
2434
+ */
2435
+ export declare type UpdateTarget = (this: UpdateTargetThis, target: Node, aspect: string, value: any, source: any, context: ExecutionContext) => void;
2436
+
2437
+ /**
2438
+ * The "this" context for an update target function.
2439
+ * @public
2440
+ */
2441
+ export declare interface UpdateTargetThis {
2442
+ /**
2443
+ * The directive configuration for the update.
2444
+ */
2445
+ directive: HTMLBindingDirective;
2446
+ }
1839
2447
 
1840
2448
  /**
1841
2449
  * Represents objects that can convert values to and from
@@ -1859,43 +2467,83 @@ export declare interface ValueConverter {
1859
2467
  * Represents a collection of DOM nodes which can be bound to a data source.
1860
2468
  * @public
1861
2469
  */
1862
- export declare interface View {
2470
+ export declare interface View<TSource = any, TParent = any> extends Disposable {
1863
2471
  /**
1864
2472
  * The execution context the view is running within.
1865
2473
  */
1866
- readonly context: ExecutionContext | null;
2474
+ readonly context: ExecutionContext<TParent> | null;
1867
2475
  /**
1868
2476
  * The data that the view is bound to.
1869
2477
  */
1870
- readonly source: any | null;
2478
+ readonly source: TSource | null;
1871
2479
  /**
1872
2480
  * Binds a view's behaviors to its binding source.
1873
2481
  * @param source - The binding source for the view's binding behaviors.
1874
2482
  * @param context - The execution context to run the view within.
1875
2483
  */
1876
- bind(source: unknown, context: ExecutionContext): void;
2484
+ bind(source: TSource, context: ExecutionContext<TParent>): void;
1877
2485
  /**
1878
2486
  * Unbinds a view's behaviors from its binding source and context.
1879
2487
  */
1880
2488
  unbind(): void;
2489
+ }
2490
+
2491
+ /**
2492
+ * Represents an object that can contribute behavior to a view.
2493
+ * @public
2494
+ */
2495
+ export declare interface ViewBehavior<TSource = any, TParent = any> {
1881
2496
  /**
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.
2497
+ * Bind this behavior to the source.
2498
+ * @param source - The source to bind to.
2499
+ * @param context - The execution context that the binding is operating within.
2500
+ * @param targets - The targets that behaviors in a view can attach to.
1884
2501
  */
1885
- dispose(): void;
2502
+ bind(source: TSource, context: ExecutionContext<TParent>, targets: ViewBehaviorTargets): void;
2503
+ /**
2504
+ * Unbinds this behavior from the source.
2505
+ * @param source - The source to unbind from.
2506
+ * @param context - The execution context that the binding is operating within.
2507
+ * @param targets - The targets that behaviors in a view can attach to.
2508
+ */
2509
+ unbind(source: TSource, context: ExecutionContext<TParent>, targets: ViewBehaviorTargets): void;
2510
+ }
2511
+
2512
+ /**
2513
+ * A factory that can create a {@link Behavior} associated with a particular
2514
+ * location within a DOM fragment.
2515
+ * @public
2516
+ */
2517
+ export declare interface ViewBehaviorFactory {
2518
+ /**
2519
+ * The unique id of the factory.
2520
+ */
2521
+ id: string;
2522
+ /**
2523
+ * The structural id of the DOM node to which the created behavior will apply.
2524
+ */
2525
+ nodeId: string;
2526
+ /**
2527
+ * Creates a behavior.
2528
+ * @param targets - The targets available for behaviors to be attached to.
2529
+ */
2530
+ createBehavior(targets: ViewBehaviorTargets): Behavior | ViewBehavior;
1886
2531
  }
1887
2532
 
2533
+ /**
2534
+ * The target nodes available to a behavior.
2535
+ * @public
2536
+ */
2537
+ export declare type ViewBehaviorTargets = {
2538
+ [id: string]: Node;
2539
+ };
2540
+
1888
2541
  /**
1889
2542
  * A template capable of creating HTMLView instances or rendering directly to DOM.
1890
2543
  * @public
1891
2544
  */
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;
2545
+ export declare class ViewTemplate<TSource = any, TParent = any> implements ElementViewTemplate<TSource, TParent>, SyntheticViewTemplate<TSource, TParent> {
2546
+ private result;
1899
2547
  /**
1900
2548
  * The html representing what this template will
1901
2549
  * instantiate, including placeholders for directives.
@@ -1904,18 +2552,18 @@ export declare class ViewTemplate<TSource = any, TParent = any> implements Eleme
1904
2552
  /**
1905
2553
  * The directives that will be connected to placeholders in the html.
1906
2554
  */
1907
- readonly directives: ReadonlyArray<HTMLDirective>;
2555
+ readonly factories: Record<string, ViewBehaviorFactory>;
1908
2556
  /**
1909
2557
  * Creates an instance of ViewTemplate.
1910
2558
  * @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.
2559
+ * @param factories - The directives that will be connected to placeholders in the html.
1912
2560
  */
1913
- constructor(html: string | HTMLTemplateElement, directives: ReadonlyArray<HTMLDirective>);
2561
+ constructor(html: string | HTMLTemplateElement, factories: Record<string, ViewBehaviorFactory>);
1914
2562
  /**
1915
2563
  * Creates an HTMLView instance based on this template definition.
1916
2564
  * @param hostBindingTarget - The element that host behaviors will be bound to.
1917
2565
  */
1918
- create(hostBindingTarget?: Element): HTMLView;
2566
+ create(hostBindingTarget?: Element): HTMLView<TSource, TParent>;
1919
2567
  /**
1920
2568
  * Creates an HTMLView from this template, binds it to the source, and then appends it to the host.
1921
2569
  * @param source - The data source to bind the template to.
@@ -1923,7 +2571,7 @@ export declare class ViewTemplate<TSource = any, TParent = any> implements Eleme
1923
2571
  * @param hostBindingTarget - An HTML element to target the host bindings at if different from the
1924
2572
  * host that the template is being attached to.
1925
2573
  */
1926
- render(source: TSource, host: Node | string, hostBindingTarget?: Element): HTMLView;
2574
+ render(source: TSource, host: Node, hostBindingTarget?: Element, context?: ExecutionContext): HTMLView<TSource, TParent>;
1927
2575
  }
1928
2576
 
1929
2577
  /**