@microsoft/fast-element 1.10.0 → 2.0.0-beta.1

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