@microsoft/fast-element 1.10.2 → 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 (95) hide show
  1. package/.eslintrc.json +1 -12
  2. package/CHANGELOG.json +321 -1
  3. package/CHANGELOG.md +52 -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 +27 -35
  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 +13633 -5266
  75. package/dist/fast-element.d.ts +1434 -578
  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 +3574 -4020
  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 +4 -4
  85. package/docs/guide/defining-elements.md +2 -2
  86. package/docs/guide/next-steps.md +2 -2
  87. package/docs/guide/observables-and-state.md +1 -1
  88. package/docs/guide/using-directives.md +1 -1
  89. package/karma.conf.cjs +6 -17
  90. package/package.json +46 -14
  91. package/dist/dts/dom.d.ts +0 -112
  92. package/dist/dts/observation/array-change-records.d.ts +0 -48
  93. package/dist/dts/observation/array-observer.d.ts +0 -9
  94. package/dist/esm/dom.js +0 -207
  95. package/dist/esm/observation/array-observer.js +0 -177
@@ -1,10 +1,3 @@
1
- /**
2
- * A reference to globalThis, with support
3
- * for browsers that don't yet support the spec.
4
- * @public
5
- */
6
- export declare const $global: Global;
7
-
8
1
  /**
9
2
  * Represents a getter/setter property accessor on an object.
10
3
  * @public
@@ -28,43 +21,132 @@ export declare interface Accessor {
28
21
  }
29
22
 
30
23
  /**
31
- * A directive that attaches special behavior to an element via a custom attribute.
24
+ * Used to add behaviors when constructing styles.
32
25
  * @public
33
26
  */
34
- export declare class AttachedBehaviorHTMLDirective<T = any> extends HTMLDirective {
35
- private name;
36
- private behavior;
37
- private options;
27
+ export declare type AddBehavior = (behavior: Behavior<HTMLElement>) => void;
28
+
29
+ /**
30
+ * Used to add behavior factories when constructing templates.
31
+ * @public
32
+ */
33
+ export declare type AddViewBehaviorFactory = (factory: ViewBehaviorFactory) => string;
34
+
35
+ /* Excluded from this release type: AdoptedStyleSheetsStrategy */
36
+
37
+ /**
38
+ * An observer for arrays.
39
+ * @public
40
+ */
41
+ export declare interface ArrayObserver extends SubscriberSet {
38
42
  /**
39
- *
40
- * @param name - The name of the behavior; used as a custom attribute on the element.
41
- * @param behavior - The behavior to instantiate and attach to the element.
42
- * @param options - Options to pass to the behavior during creation.
43
+ * The strategy to use for tracking changes.
43
44
  */
44
- constructor(name: string, behavior: AttachedBehaviorType<T>, options: T);
45
+ strategy: SpliceStrategy | null;
45
46
  /**
46
- * Creates a placeholder string based on the directive's index within the template.
47
- * @param index - The index of the directive within the template.
48
- * @remarks
49
- * Creates a custom attribute placeholder.
47
+ * The length observer for the array.
50
48
  */
51
- createPlaceholder(index: number): string;
49
+ readonly lengthObserver: LengthObserver;
52
50
  /**
53
- * Creates a behavior for the provided target node.
54
- * @param target - The node instance to create the behavior for.
55
- * @remarks
56
- * Creates an instance of the `behavior` type this directive was constructed with
57
- * and passes the target and options to that `behavior`'s constructor.
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
58
  */
59
- createBehavior(target: Node): Behavior;
59
+ reset(oldCollection: any[] | undefined): void;
60
+ /**
61
+ * Flushes the changes to subscribers.
62
+ */
63
+ flush(): void;
60
64
  }
61
65
 
62
66
  /**
63
- * Describes the shape of a behavior constructor that can be created by
64
- * 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.
65
124
  * @public
66
125
  */
67
- export declare type AttachedBehaviorType<T = any> = new (target: any, options: T) => Behavior;
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.
130
+ * @public
131
+ */
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
+ }
68
150
 
69
151
  /**
70
152
  * Decorator: Specifies an HTML attribute.
@@ -145,16 +227,9 @@ export declare class AttributeDefinition implements Accessor {
145
227
  * @param source - The source element to access.
146
228
  */
147
229
  getValue(source: HTMLElement): any;
148
- /** @internal */
149
- onAttributeChangedCallback(element: HTMLElement, value: any): void;
230
+ /* Excluded from this release type: onAttributeChangedCallback */
150
231
  private tryReflectToAttribute;
151
- /**
152
- * Collects all attribute definitions associated with the owner.
153
- * @param Owner - The class constructor to collect attribute for.
154
- * @param attributeLists - Any existing attributes to collect and merge with those associated with the owner.
155
- * @internal
156
- */
157
- static collect(Owner: Function, ...attributeLists: (ReadonlyArray<string | AttributeConfiguration> | undefined)[]): ReadonlyArray<AttributeDefinition>;
232
+ /* Excluded from this release type: collect */
158
233
  }
159
234
 
160
235
  /**
@@ -168,109 +243,124 @@ export declare class AttributeDefinition implements Accessor {
168
243
  * changes in the DOM, but does not reflect property changes back.
169
244
  * @public
170
245
  */
171
- export declare type AttributeMode = "reflect" | "boolean" | "fromView";
246
+ export declare type AttributeMode = typeof reflectMode | typeof booleanMode | "fromView";
172
247
 
173
248
  /**
174
- * Represents and object that can contribute behavior to a view or
249
+ * Represents an object that can contribute behavior to a view or
175
250
  * element's bind/unbind operations.
176
251
  * @public
177
252
  */
178
- export declare interface Behavior {
253
+ export declare interface Behavior<TSource = any, TParent = any, TContext extends ExecutionContext<TParent> = RootContext> {
179
254
  /**
180
255
  * Bind this behavior to the source.
181
256
  * @param source - The source to bind to.
182
257
  * @param context - The execution context that the binding is operating within.
183
258
  */
184
- bind(source: unknown, context: ExecutionContext): void;
259
+ bind(source: TSource, context: TContext): void;
185
260
  /**
186
261
  * Unbinds this behavior from the source.
187
262
  * @param source - The source to unbind from.
188
263
  */
189
- unbind(source: unknown): void;
264
+ unbind(source: TSource, context: TContext): void;
190
265
  }
191
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
+
192
276
  /**
193
277
  * The signature of an arrow function capable of being evaluated
194
278
  * as part of a template binding update.
195
279
  * @public
196
280
  */
197
- 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;
198
282
 
199
283
  /**
200
- * A behavior that updates content and attributes based on a configured
201
- * BindingDirective.
284
+ * Describes the configuration for a binding expression.
202
285
  * @public
203
286
  */
204
- export declare class BindingBehavior implements Behavior {
205
- /** @internal */
206
- source: unknown;
207
- /** @internal */
208
- context: ExecutionContext | null;
209
- /** @internal */
210
- bindingObserver: BindingObserver | null;
211
- /** @internal */
212
- classVersions: Record<string, number>;
213
- /** @internal */
214
- version: number;
215
- /** @internal */
216
- target: any;
217
- /** @internal */
218
- binding: Binding;
219
- /** @internal */
220
- isBindingVolatile: boolean;
221
- /** @internal */
222
- updateTarget: typeof updatePropertyTarget;
223
- /** @internal */
224
- targetName?: string;
287
+ export declare interface BindingConfig<T = any> {
225
288
  /**
226
- * Bind this behavior to the source.
227
- * @param source - The source to bind to.
228
- * @param context - The execution context that the binding is operating within.
289
+ * The binding mode to configure the binding with.
229
290
  */
230
- bind: typeof normalBind;
291
+ mode: BindingMode;
231
292
  /**
232
- * Unbinds this behavior from the source.
233
- * @param source - The source to unbind from.
293
+ * Options to be supplied to the binding behaviors.
234
294
  */
235
- 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<{
236
303
  /**
237
- * Creates an instance of BindingBehavior.
238
- * @param target - The target of the data updates.
239
- * @param binding - The binding that returns the latest value for an update.
240
- * @param isBindingVolatile - Indicates whether the binding has volatile dependencies.
241
- * @param bind - The operation to perform during binding.
242
- * @param unbind - The operation to perform during unbinding.
243
- * @param updateTarget - The operation to perform when updating.
244
- * @param targetName - The name of the target attribute or property to update.
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.
245
308
  */
246
- constructor(target: any, binding: Binding, isBindingVolatile: boolean, bind: typeof normalBind, unbind: typeof normalUnbind, updateTarget: typeof updatePropertyTarget, targetName?: string);
247
- /** @internal */
248
- handleChange(): void;
249
- /** @internal */
250
- handleEvent(event: Event): void;
251
- }
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
+ }>;
252
337
 
253
338
  /**
254
339
  * Enables evaluation of and subscription to a binding.
255
340
  * @public
256
341
  */
257
- 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 {
258
343
  /**
259
344
  * Begins observing the binding for the source and returns the current value.
260
345
  * @param source - The source that the binding is based on.
261
346
  * @param context - The execution context to execute the binding within.
262
347
  * @returns The value of the binding.
263
348
  */
264
- observe(source: TSource, context: ExecutionContext<TParent>): TReturn;
265
- /**
266
- * Unsubscribe from all dependent observables of the binding.
267
- */
268
- disconnect(): void;
349
+ observe(source: TSource, context?: ExecutionContext<TParent>): TReturn;
269
350
  /**
270
351
  * Gets {@link ObservationRecord|ObservationRecords} that the {@link BindingObserver}
271
352
  * is observing.
272
353
  */
273
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;
274
364
  }
275
365
 
276
366
  /**
@@ -281,6 +371,8 @@ export declare interface BindingObserver<TSource = any, TReturn = any, TParent =
281
371
  */
282
372
  export declare const booleanConverter: ValueConverter;
283
373
 
374
+ declare const booleanMode = "boolean";
375
+
284
376
  /**
285
377
  * Represents a callable type such as a function or an object with a "call" method.
286
378
  * @public
@@ -297,11 +389,80 @@ export declare type Callable = typeof Function.prototype.call | {
297
389
  export declare interface CaptureType<TSource> {
298
390
  }
299
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
+
300
461
  /**
301
462
  * The options used to configure child list observation.
302
463
  * @public
303
464
  */
304
- 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"> {
305
466
  }
306
467
 
307
468
  /**
@@ -310,78 +471,109 @@ export declare interface ChildListBehaviorOptions<T = any> extends NodeBehaviorO
310
471
  * @param propertyOrOptions - The options used to configure child node observation.
311
472
  * @public
312
473
  */
313
- 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>;
314
475
 
315
476
  /**
316
477
  * The runtime behavior for child node observation.
317
478
  * @public
318
479
  */
319
- export declare class ChildrenBehavior extends NodeObservationBehavior<ChildrenBehaviorOptions> {
320
- private observer;
480
+ export declare class ChildrenDirective extends NodeObservationDirective<ChildrenDirectiveOptions> {
481
+ private observerProperty;
321
482
  /**
322
- * Creates an instance of ChildrenBehavior.
323
- * @param target - The element target to observe children on.
324
- * @param options - The options to use when observing the element children.
483
+ * Creates an instance of ChildrenDirective.
484
+ * @param options - The options to use in configuring the child observation behavior.
325
485
  */
326
- constructor(target: HTMLElement, options: ChildrenBehaviorOptions);
486
+ constructor(options: ChildrenDirectiveOptions);
327
487
  /**
328
488
  * Begins observation of the nodes.
489
+ * @param target - The target to observe.
329
490
  */
330
- observe(): void;
491
+ observe(target: any): void;
331
492
  /**
332
493
  * Disconnects observation of the nodes.
494
+ * @param target - The target to unobserve.
333
495
  */
334
- disconnect(): void;
496
+ disconnect(target: any): void;
335
497
  /**
336
- * 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.
337
500
  */
338
- protected getNodes(): ChildNode[];
501
+ getNodes(target: Element): Node[];
502
+ private handleEvent;
339
503
  }
340
504
 
341
505
  /**
342
506
  * The options used to configure child/subtree node observation.
343
507
  * @public
344
508
  */
345
- 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;
346
537
 
347
538
  /**
348
- * The result of compiling a template and its directives.
349
- * @beta
539
+ * Common APIs related to compilation.
540
+ * @public
350
541
  */
351
- export declare interface CompilationResult {
542
+ export declare const Compiler: {
352
543
  /**
353
- * 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.
354
549
  */
355
- fragment: DocumentFragment;
550
+ setHTMLPolicy(policy: TrustedTypesPolicy): void;
356
551
  /**
357
- * 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
358
561
  */
359
- 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>;
360
563
  /**
361
- * The behaviors that should be applied to the host element that
362
- * 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.
363
567
  */
364
- hostBehaviorFactories: NodeBehaviorFactory[];
568
+ setDefaultStrategy(strategy: CompilationStrategy): void;
365
569
  /**
366
- * An index offset to apply to BehaviorFactory target indexes when
367
- * 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.
368
574
  */
369
- targetOffset: number;
370
- }
371
-
372
- /**
373
- * Compiles a template and associated directives into a raw compilation
374
- * result which include a cloneable DocumentFragment and factories capable
375
- * of attaching runtime behavior to nodes within the fragment.
376
- * @param template - The template to compile.
377
- * @param directives - The directives referenced by the template.
378
- * @remarks
379
- * The template that is provided for compilation is altered in-place
380
- * and cannot be compiled again. If the original template must be preserved,
381
- * it is recommended that you clone the original and pass the clone to this API.
382
- * @public
383
- */
384
- export declare function compileTemplate(template: HTMLTemplateElement, directives: ReadonlyArray<HTMLDirective>): CompilationResult;
575
+ aggregate(parts: (string | ViewBehaviorFactory)[]): ViewBehaviorFactory;
576
+ };
385
577
 
386
578
  /**
387
579
  * Represents styles that can be composed into the ShadowDOM of a custom element.
@@ -398,14 +590,27 @@ export declare type Constructable<T = {}> = {
398
590
  new (...args: any[]): T;
399
591
  };
400
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
+
401
605
  /**
402
606
  * Controls the lifecycle and rendering of a `FASTElement`.
403
607
  * @public
404
608
  */
405
- export declare class Controller extends PropertyChangeNotifier {
609
+ export declare class Controller<TElement extends HTMLElement = HTMLElement> extends PropertyChangeNotifier {
406
610
  private boundObservables;
407
611
  private behaviors;
408
612
  private needsInitialization;
613
+ private hasExistingShadowRoot;
409
614
  private _template;
410
615
  private _styles;
411
616
  private _isConnected;
@@ -421,7 +626,7 @@ export declare class Controller extends PropertyChangeNotifier {
421
626
  /**
422
627
  * The element being controlled by this controller.
423
628
  */
424
- readonly element: HTMLElement;
629
+ readonly element: TElement;
425
630
  /**
426
631
  * The element definition that instructs this controller
427
632
  * in how to handle rendering and other platform integrations.
@@ -432,7 +637,7 @@ export declare class Controller extends PropertyChangeNotifier {
432
637
  * @remarks
433
638
  * If `null` then the element is managing its own rendering.
434
639
  */
435
- readonly view: ElementView | null;
640
+ readonly view: ElementView<TElement> | null;
436
641
  /**
437
642
  * Indicates whether or not the custom element has been
438
643
  * connected to the document.
@@ -444,8 +649,8 @@ export declare class Controller extends PropertyChangeNotifier {
444
649
  * @remarks
445
650
  * This value can only be accurately read after connect but can be set at any time.
446
651
  */
447
- get template(): ElementViewTemplate | null;
448
- set template(value: ElementViewTemplate | null);
652
+ get template(): ElementViewTemplate<TElement> | null;
653
+ set template(value: ElementViewTemplate<TElement> | null);
449
654
  /**
450
655
  * Gets/sets the primary styles used for the component.
451
656
  * @remarks
@@ -453,35 +658,28 @@ export declare class Controller extends PropertyChangeNotifier {
453
658
  */
454
659
  get styles(): ElementStyles | null;
455
660
  set styles(value: ElementStyles | null);
456
- /**
457
- * Creates a Controller to control the specified element.
458
- * @param element - The element to be controlled by this controller.
459
- * @param definition - The element definition metadata that instructs this
460
- * controller in how to handle rendering and other platform integrations.
461
- * @internal
462
- */
463
- constructor(element: HTMLElement, definition: FASTElementDefinition);
661
+ /* Excluded from this release type: __constructor */
464
662
  /**
465
663
  * Adds styles to this element. Providing an HTMLStyleElement will attach the element instance to the shadowRoot.
466
664
  * @param styles - The styles to add.
467
665
  */
468
- addStyles(styles: ElementStyles | HTMLStyleElement): void;
666
+ addStyles(styles: ElementStyles | HTMLStyleElement | null | undefined): void;
469
667
  /**
470
668
  * Removes styles from this element. Providing an HTMLStyleElement will detach the element instance from the shadowRoot.
471
669
  * @param styles - the styles to remove.
472
670
  */
473
- removeStyles(styles: ElementStyles | HTMLStyleElement): void;
671
+ removeStyles(styles: ElementStyles | HTMLStyleElement | null | undefined): void;
474
672
  /**
475
673
  * Adds behaviors to this element.
476
674
  * @param behaviors - The behaviors to add.
477
675
  */
478
- addBehaviors(behaviors: ReadonlyArray<Behavior>): void;
676
+ addBehaviors(behaviors: ReadonlyArray<Behavior<TElement>>): void;
479
677
  /**
480
678
  * Removes behaviors from this element.
481
679
  * @param behaviors - The behaviors to remove.
482
680
  * @param force - Forces unbinding of behaviors.
483
681
  */
484
- removeBehaviors(behaviors: ReadonlyArray<Behavior>, force?: boolean): void;
682
+ removeBehaviors(behaviors: ReadonlyArray<Behavior<TElement>>, force?: boolean): void;
485
683
  /**
486
684
  * Runs connected lifecycle behavior on the associated element.
487
685
  */
@@ -496,7 +694,7 @@ export declare class Controller extends PropertyChangeNotifier {
496
694
  * @param oldValue - The previous value of the attribute.
497
695
  * @param newValue - The new value of the attribute.
498
696
  */
499
- onAttributeChangedCallback(name: string, oldValue: string, newValue: string): void;
697
+ onAttributeChangedCallback(name: string, oldValue: string | null, newValue: string | null): void;
500
698
  /**
501
699
  * Emits a custom HTML event.
502
700
  * @param type - The type name of the event.
@@ -519,6 +717,8 @@ export declare class Controller extends PropertyChangeNotifier {
519
717
  static forCustomElement(element: HTMLElement): Controller;
520
718
  }
521
719
 
720
+ /* Excluded from this release type: createTypeRegistry */
721
+
522
722
  /**
523
723
  * Transforms a template literal string into styles.
524
724
  * @param strings - The string fragments that are interpolated with the values.
@@ -527,33 +727,85 @@ export declare class Controller extends PropertyChangeNotifier {
527
727
  * The css helper supports interpolation of strings and ElementStyle instances.
528
728
  * @public
529
729
  */
530
- export declare function css(strings: TemplateStringsArray, ...values: (ComposableStyles | CSSDirective)[]): ElementStyles;
730
+ export declare const css: CSSTemplateTag;
531
731
 
532
732
  /**
533
733
  * Directive for use in {@link css}.
534
734
  *
535
735
  * @public
536
736
  */
537
- export declare class CSSDirective {
737
+ export declare interface CSSDirective {
538
738
  /**
539
739
  * Creates a CSS fragment to interpolate into the CSS document.
540
740
  * @returns - the string to interpolate into CSS
541
741
  */
542
- 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>> {
543
779
  /**
544
- * Creates a behavior to bind to the host element.
545
- * @returns - the behavior to bind to the host element, or undefined.
780
+ * The type that the definition provides metadata for.
546
781
  */
547
- createBehavior(): Behavior | undefined;
782
+ readonly type: TType;
548
783
  }
549
784
 
550
785
  /**
551
- * 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.
552
793
  * @param strings - The string fragments that are interpolated with the values.
553
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.
554
798
  * @public
555
799
  */
556
- 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
+ };
557
809
 
558
810
  /**
559
811
  * Decorator: Defines a platform custom element based on `FASTElement`.
@@ -561,7 +813,7 @@ export declare function cssPartial(strings: TemplateStringsArray, ...values: (Co
561
813
  * that describes the element to define.
562
814
  * @public
563
815
  */
564
- export declare function customElement(nameOrDef: string | PartialFASTElementDefinition): (type: Function) => void;
816
+ export declare function customElement(nameOrDef: string | PartialFASTElementDefinition): (type: Constructable<HTMLElement>) => void;
565
817
 
566
818
  /**
567
819
  * Metadata used to configure a custom attribute's behavior through a decorator.
@@ -570,97 +822,61 @@ export declare function customElement(nameOrDef: string | PartialFASTElementDefi
570
822
  export declare type DecoratorAttributeConfiguration = Omit<AttributeConfiguration, "property">;
571
823
 
572
824
  /**
573
- * The default execution context used in binding expressions.
825
+ * The default binding options.
574
826
  * @public
575
827
  */
576
- export declare const defaultExecutionContext: ExecutionContext<any, any>;
828
+ export declare type DefaultBindingOptions = AddEventListenerOptions;
577
829
 
578
830
  /**
579
- * Common DOM APIs.
831
+ * The default twoWay binding options.
580
832
  * @public
581
833
  */
582
- 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 {
583
844
  /**
584
- * Indicates whether the DOM supports the adoptedStyleSheets feature.
845
+ * Disposes the resources.
585
846
  */
586
- supportsAdoptedStyleSheets: boolean;
847
+ dispose(): void;
848
+ }
849
+
850
+ /**
851
+ * Common DOM APIs.
852
+ * @public
853
+ */
854
+ export declare const DOM: Readonly<{
587
855
  /**
588
- * Sets the HTML trusted types policy used by the templating engine.
589
- * @param policy - The policy to set for HTML.
590
- * @remarks
591
- * This API can only be called once, for security reasons. It should be
592
- * called by the application developer at the start of their program.
856
+ * @deprecated
857
+ * Use Updates.enqueue().
593
858
  */
594
- setHTMLPolicy(policy: TrustedTypesPolicy): void;
859
+ queueUpdate: (callable: Callable) => void;
595
860
  /**
596
- * Turns a string into trusted HTML using the configured trusted types policy.
597
- * @param html - The string to turn into trusted HTML.
598
- * @remarks
599
- * Used internally by the template engine when creating templates
600
- * and setting innerHTML.
861
+ * @deprecated
862
+ * Use Updates.next()
601
863
  */
602
- createHTML(html: string): string;
864
+ nextUpdate: () => Promise<void>;
603
865
  /**
604
- * Determines if the provided node is a template marker used by the runtime.
605
- * @param node - The node to test.
866
+ * @deprecated
867
+ * Use Updates.process()
606
868
  */
607
- isMarker(node: Node): node is Comment;
869
+ processUpdates: () => void;
608
870
  /**
609
- * Given a marker node, extract the {@link HTMLDirective} index from the placeholder.
610
- * @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.
611
878
  */
612
- extractDirectiveIndexFromMarker(node: Comment): number;
613
- /**
614
- * Creates a placeholder string suitable for marking out a location *within*
615
- * an attribute value or HTML content.
616
- * @param index - The directive index to create the placeholder for.
617
- * @remarks
618
- * Used internally by binding directives.
619
- */
620
- createInterpolationPlaceholder(index: number): string;
621
- /**
622
- * Creates a placeholder that manifests itself as an attribute on an
623
- * element.
624
- * @param attributeName - The name of the custom attribute.
625
- * @param index - The directive index to create the placeholder for.
626
- * @remarks
627
- * Used internally by attribute directives such as `ref`, `slotted`, and `children`.
628
- */
629
- createCustomAttributePlaceholder(attributeName: string, index: number): string;
630
- /**
631
- * Creates a placeholder that manifests itself as a marker within the DOM structure.
632
- * @param index - The directive index to create the placeholder for.
633
- * @remarks
634
- * Used internally by structural directives such as `repeat`.
635
- */
636
- createBlockPlaceholder(index: number): string;
637
- /**
638
- * Schedules DOM update work in the next async batch.
639
- * @param callable - The callable function or object to queue.
640
- */
641
- queueUpdate: (callable: Callable) => void;
642
- /**
643
- * Immediately processes all work previously scheduled
644
- * through queueUpdate.
645
- * @remarks
646
- * This also forces nextUpdate promises
647
- * to resolve.
648
- */
649
- processUpdates: () => void;
650
- /**
651
- * Resolves with the next DOM update.
652
- */
653
- nextUpdate(): Promise<void>;
654
- /**
655
- * Sets an attribute value on an element.
656
- * @param element - The element to set the attribute value on.
657
- * @param attributeName - The attribute name to set.
658
- * @param value - The value of the attribute to set.
659
- * @remarks
660
- * If the value is `null` or `undefined`, the attribute is removed, otherwise
661
- * it is set to the provided value using the standard `setAttribute` API.
662
- */
663
- setAttribute(element: HTMLElement, attributeName: string, value: any): void;
879
+ setAttribute(element: HTMLElement, attributeName: string, value: any): void;
664
880
  /**
665
881
  * Sets a boolean attribute value.
666
882
  * @param element - The element to set the boolean attribute value on.
@@ -670,16 +886,6 @@ export declare const DOM: Readonly<{
670
886
  * If the value is true, the attribute is added; otherwise it is removed.
671
887
  */
672
888
  setBooleanAttribute(element: HTMLElement, attributeName: string, value: boolean): void;
673
- /**
674
- * Removes all the child nodes of the provided parent node.
675
- * @param parent - The node to remove the children from.
676
- */
677
- removeChildNodes(parent: Node): void;
678
- /**
679
- * Creates a TreeWalker configured to walk a template fragment.
680
- * @param fragment - The fragment to walk.
681
- */
682
- createTemplateWalker(fragment: DocumentFragment): TreeWalker;
683
889
  }>;
684
890
 
685
891
  /**
@@ -687,7 +893,7 @@ export declare const DOM: Readonly<{
687
893
  * @param selector - An optional selector to restrict the filter to.
688
894
  * @public
689
895
  */
690
- export declare function elements(selector?: string): ElementsFilter;
896
+ export declare const elements: (selector?: string) => ElementsFilter;
691
897
 
692
898
  /**
693
899
  * Elements filter function type.
@@ -696,44 +902,56 @@ export declare function elements(selector?: string): ElementsFilter;
696
902
  */
697
903
  export declare type ElementsFilter = (value: Node, index: number, array: Node[]) => boolean;
698
904
 
699
- /**
700
- * Creates an ElementStyles instance for an array of ComposableStyles.
701
- * @public
702
- */
703
- export declare type ElementStyleFactory = (styles: ReadonlyArray<ComposableStyles>) => ElementStyles;
704
-
705
905
  /**
706
906
  * Represents styles that can be applied to a custom element.
707
907
  * @public
708
908
  */
709
- export declare abstract class ElementStyles {
909
+ export declare class ElementStyles {
910
+ readonly styles: ReadonlyArray<ComposableStyles>;
710
911
  private targets;
711
- /** @internal */
712
- abstract readonly styles: ReadonlyArray<ComposableStyles>;
713
- /** @internal */
714
- abstract readonly behaviors: ReadonlyArray<Behavior> | null;
715
- /** @internal */
716
- addStylesTo(target: StyleTarget): void;
717
- /** @internal */
718
- removeStylesFrom(target: StyleTarget): void;
719
- /** @internal */
720
- isAttachedTo(target: StyleTarget): boolean;
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 */
721
929
  /**
722
930
  * Associates behaviors with this set of styles.
723
931
  * @param behaviors - The behaviors to associate.
724
932
  */
725
- 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;
726
939
  /**
727
- * Create ElementStyles from ComposableStyles.
940
+ * Sets the default strategy type to use when creating style strategies.
941
+ * @param Strategy - The strategy type to construct.
728
942
  */
729
- static readonly create: ElementStyleFactory;
943
+ static setDefaultStrategy(Strategy: ConstructibleStyleStrategy): void;
944
+ /**
945
+ * Indicates whether the DOM supports the adoptedStyleSheets feature.
946
+ */
947
+ static readonly supportsAdoptedStyleSheets: boolean;
730
948
  }
731
949
 
732
950
  /**
733
951
  * A View representing DOM nodes specifically for rendering the view of a custom element.
734
952
  * @public
735
953
  */
736
- export declare interface ElementView extends View {
954
+ export declare interface ElementView<TSource = any, TParent = any> extends View<TSource, TParent, RootContext> {
737
955
  /**
738
956
  * Appends the view's DOM nodes to the referenced node.
739
957
  * @param node - The parent node to append the view's DOM nodes to.
@@ -745,12 +963,13 @@ export declare interface ElementView extends View {
745
963
  * A template capable of creating views specifically for rendering custom elements.
746
964
  * @public
747
965
  */
748
- export declare interface ElementViewTemplate {
966
+ export declare interface ElementViewTemplate<TSource = any, TParent = any> {
967
+ type: "element";
749
968
  /**
750
969
  * Creates an ElementView instance based on this template definition.
751
970
  * @param hostBindingTarget - The element that host behaviors will be bound to.
752
971
  */
753
- create(hostBindingTarget: Element): ElementView;
972
+ create(hostBindingTarget: Element): ElementView<TSource, TParent>;
754
973
  /**
755
974
  * Creates an HTMLView from this template, binds it to the source, and then appends it to the host.
756
975
  * @param source - The data source to bind the template to.
@@ -758,7 +977,7 @@ export declare interface ElementViewTemplate {
758
977
  * @param hostBindingTarget - An HTML element to target the host bindings at if different from the
759
978
  * host that the template is being attached to.
760
979
  */
761
- render(source: any, host: Node, hostBindingTarget?: Element): HTMLView;
980
+ render(source: TSource, host: Node, hostBindingTarget?: Element): ElementView<TSource, TParent>;
762
981
  }
763
982
 
764
983
  /**
@@ -766,89 +985,72 @@ export declare interface ElementViewTemplate {
766
985
  * @remarks
767
986
  * Typically returned by APIs that return arrays when there are
768
987
  * no actual items to return.
769
- * @internal
770
- */
771
- export declare const emptyArray: readonly never[];
772
-
773
- /**
774
- * Enables the array observation mechanism.
775
- * @remarks
776
- * Array observation is enabled automatically when using the
777
- * {@link RepeatDirective}, so calling this API manually is
778
- * not typically necessary.
779
988
  * @public
780
989
  */
781
- export declare function enableArrayObservation(): void;
990
+ export declare const emptyArray: readonly never[];
782
991
 
783
992
  /**
784
- * Provides additional contextual information available to behaviors and expressions.
993
+ * A binding behavior for handling events.
785
994
  * @public
786
995
  */
787
- export declare class ExecutionContext<TParent = any, TGrandparent = any> {
788
- /**
789
- * The index of the current item within a repeat context.
790
- */
791
- index: number;
792
- /**
793
- * The length of the current collection within a repeat context.
794
- */
795
- length: number;
796
- /**
797
- * The parent data object within a repeat context.
798
- */
799
- parent: TParent;
996
+ export declare class EventBinding {
997
+ readonly directive: HTMLBindingDirective;
998
+ private contextProperty;
999
+ private sourceProperty;
800
1000
  /**
801
- * The parent execution context when in nested context scenarios.
802
- */
803
- parentContext: ExecutionContext<TGrandparent>;
804
- /**
805
- * The current event within an event handler.
806
- */
807
- get event(): Event;
808
- /**
809
- * Indicates whether the current item within a repeat context
810
- * has an even index.
1001
+ * Creates an instance of EventBinding.
1002
+ * @param directive - The directive that has the configuration for this behavior.
811
1003
  */
812
- get isEven(): boolean;
1004
+ constructor(directive: HTMLBindingDirective);
813
1005
  /**
814
- * Indicates whether the current item within a repeat context
815
- * has an odd index.
816
- */
817
- get isOdd(): boolean;
818
- /**
819
- * Indicates whether the current item within a repeat context
820
- * 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.
821
1010
  */
822
- get isFirst(): boolean;
1011
+ bind(source: any, context: ExecutionContext, targets: ViewBehaviorTargets): void;
823
1012
  /**
824
- * Indicates whether the current item within a repeat context
825
- * 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.
826
1017
  */
827
- get isInMiddle(): boolean;
1018
+ unbind(source: any, context: ExecutionContext, targets: ViewBehaviorTargets): void;
828
1019
  /**
829
- * Indicates whether the current item within a repeat context
830
- * is the last item in the collection.
1020
+ * Creates a behavior.
1021
+ * @param targets - The targets available for behaviors to be attached to.
831
1022
  */
832
- 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 */
833
1034
  /**
834
- * Sets the event for the current execution context.
835
- * @param event - The event to set.
836
- * @internal
1035
+ * Creates a new root execution context.
1036
+ * @returns A new execution context.
837
1037
  */
838
- static setEvent(event: Event | null): void;
839
- }
1038
+ create(): RootContext;
1039
+ }>;
840
1040
 
841
1041
  /**
842
- * The FAST global.
843
- * @internal
1042
+ * Represents some sort of execution context.
1043
+ * @public
844
1044
  */
845
- 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 */
846
1048
 
847
1049
  /**
848
1050
  * Represents a custom element based on the FASTElement infrastructure.
849
1051
  * @public
850
1052
  */
851
- export declare interface FASTElement {
1053
+ export declare interface FASTElement extends HTMLElement {
852
1054
  /**
853
1055
  * The underlying controller that handles the lifecycle and rendering of
854
1056
  * this FASTElement.
@@ -886,7 +1088,7 @@ export declare interface FASTElement {
886
1088
  * This method is invoked by the platform whenever an observed
887
1089
  * attribute of FASTElement has a value change.
888
1090
  */
889
- attributeChangedCallback(name: string, oldValue: string, newValue: string): void;
1091
+ attributeChangedCallback(name: string, oldValue: string | null, newValue: string | null): void;
890
1092
  }
891
1093
 
892
1094
  /**
@@ -910,14 +1112,14 @@ export declare const FASTElement: (new () => HTMLElement & FASTElement) & {
910
1112
  * @param nameOrDef - The name of the element to define or a definition object
911
1113
  * that describes the element to define.
912
1114
  */
913
- define<TType extends Function>(type: TType, nameOrDef?: string | PartialFASTElementDefinition | undefined): TType;
1115
+ define<TType extends Constructable<HTMLElement>>(type: TType, nameOrDef?: string | PartialFASTElementDefinition): TType;
914
1116
  };
915
1117
 
916
1118
  /**
917
1119
  * Defines metadata for a FASTElement.
918
1120
  * @public
919
1121
  */
920
- export declare class FASTElementDefinition<TType extends Function = Function> {
1122
+ export declare class FASTElementDefinition<TType extends Constructable<HTMLElement> = Constructable<HTMLElement>> {
921
1123
  private observedAttributes;
922
1124
  /**
923
1125
  * The type this element definition describes.
@@ -975,45 +1177,18 @@ export declare class FASTElementDefinition<TType extends Function = Function> {
975
1177
  * Gets the element definition associated with the specified type.
976
1178
  * @param type - The custom element type to retrieve the definition for.
977
1179
  */
978
- static readonly forType: <TType_1 extends Function>(key: TType_1) => FASTElementDefinition<Function> | undefined;
979
- }
980
-
981
- /**
982
- * The FAST global.
983
- * @internal
984
- */
985
- export declare interface FASTGlobal {
986
- /**
987
- * The list of loaded versions.
988
- */
989
- readonly versions: string[];
1180
+ static readonly getByType: (key: Function) => FASTElementDefinition<Constructable<HTMLElement>> | undefined;
990
1181
  /**
991
- * Gets a kernel value.
992
- * @param id - The id to get the value for.
993
- * @param initialize - Creates the initial value for the id if not already existing.
1182
+ * Gets the element definition associated with the instance.
1183
+ * @param instance - The custom element instance to retrieve the definition for.
994
1184
  */
995
- getById<T>(id: string | number): T | null;
996
- getById<T>(id: string | number, initialize: () => T): T;
1185
+ static readonly getForInstance: (object: any) => FASTElementDefinition<Constructable<HTMLElement>> | undefined;
997
1186
  }
998
1187
 
999
- /**
1000
- * The platform global type.
1001
- * @public
1002
- */
1003
- export declare type Global = typeof globalThis & {
1004
- /**
1005
- * Enables working with trusted types.
1006
- */
1007
- trustedTypes: TrustedTypes;
1008
- /**
1009
- * The FAST global.
1010
- * @internal
1011
- */
1012
- readonly FAST: FASTGlobal;
1013
- };
1188
+ /* Excluded from this release type: FASTGlobal */
1014
1189
 
1015
1190
  /**
1016
- * Transforms a template literal string into a renderable ViewTemplate.
1191
+ * Transforms a template literal string into a ViewTemplate.
1017
1192
  * @param strings - The string fragments that are interpolated with the values.
1018
1193
  * @param values - The values that are interpolated with the string fragments.
1019
1194
  * @remarks
@@ -1021,80 +1196,138 @@ export declare type Global = typeof globalThis & {
1021
1196
  * other template instances, and Directive instances.
1022
1197
  * @public
1023
1198
  */
1024
- 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>;
1025
1200
 
1026
1201
  /**
1027
- * A directive that configures data binding to element content and attributes.
1202
+ * A directive that applies bindings.
1028
1203
  * @public
1029
1204
  */
1030
- export declare class HTMLBindingDirective extends TargetedHTMLDirective {
1205
+ export declare class HTMLBindingDirective implements HTMLDirective, ViewBehaviorFactory, Aspected {
1031
1206
  binding: Binding;
1032
- private cleanedTargetName?;
1033
- private originalTargetName?;
1034
- private bind;
1035
- private unbind;
1036
- private updateTarget;
1037
- private isBindingVolatile;
1207
+ mode: BindingMode;
1208
+ options: any;
1209
+ private factory;
1038
1210
  /**
1039
- * Creates an instance of BindingDirective.
1040
- * @param binding - A binding that returns the data used to update the DOM.
1211
+ * The unique id of the factory.
1041
1212
  */
1042
- constructor(binding: Binding);
1213
+ id: string;
1043
1214
  /**
1044
- * Gets/sets the name of the attribute or property that this
1045
- * binding is targeting.
1215
+ * The structural id of the DOM node to which the created behavior will apply.
1046
1216
  */
1047
- get targetName(): string | undefined;
1048
- set targetName(value: string | undefined);
1217
+ nodeId: string;
1049
1218
  /**
1050
- * Makes this binding target the content of an element rather than
1051
- * a particular attribute or property.
1219
+ * The original source aspect exactly as represented in markup.
1052
1220
  */
1053
- targetAtContent(): void;
1221
+ sourceAspect: string;
1054
1222
  /**
1055
- * Creates the runtime BindingBehavior instance based on the configuration
1056
- * information stored in the BindingDirective.
1057
- * @param target - The target node that the binding behavior should attach to.
1223
+ * The evaluated target aspect, determined after processing the source.
1058
1224
  */
1059
- createBehavior(target: Node): BindingBehavior;
1225
+ targetAspect: string;
1226
+ /**
1227
+ * The type of aspect to target.
1228
+ */
1229
+ aspectType: Aspect;
1230
+ /**
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.
1235
+ */
1236
+ constructor(binding: Binding, mode: BindingMode, options: any);
1237
+ /**
1238
+ * Creates HTML to be used within a template.
1239
+ * @param add - Can be used to add behavior factories to a template.
1240
+ */
1241
+ createHTML(add: AddViewBehaviorFactory): string;
1242
+ /**
1243
+ * Creates a behavior.
1244
+ * @param targets - The targets available for behaviors to be attached to.
1245
+ */
1246
+ createBehavior(targets: ViewBehaviorTargets): ViewBehavior;
1060
1247
  }
1061
1248
 
1062
1249
  /**
1063
1250
  * Instructs the template engine to apply behavior to a node.
1064
1251
  * @public
1065
1252
  */
1066
- export declare abstract class HTMLDirective implements NodeBehaviorFactory {
1253
+ export declare interface HTMLDirective {
1067
1254
  /**
1068
- * 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.
1069
1257
  */
1070
- 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<{
1071
1266
  /**
1072
- * Creates a placeholder string based on the directive's index within the template.
1073
- * @param index - The index of the directive within the template.
1267
+ * Gets the directive definition associated with the instance.
1268
+ * @param instance - The directive instance to retrieve the definition for.
1074
1269
  */
1075
- abstract createPlaceholder(index: number): string;
1270
+ getForInstance: (object: any) => HTMLDirectiveDefinition<Constructable<HTMLDirective>> | undefined;
1076
1271
  /**
1077
- * Creates a behavior for the provided target node.
1078
- * @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.
1298
+ */
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.
1079
1310
  */
1080
- abstract createBehavior(target: Node): Behavior;
1311
+ createView(hostBindingTarget?: Element): HTMLView<TSource, TParent, TContext>;
1081
1312
  }
1082
1313
 
1083
1314
  /**
1084
1315
  * The standard View implementation, which also implements ElementView and SyntheticView.
1085
1316
  * @public
1086
1317
  */
1087
- 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> {
1088
1319
  private fragment;
1320
+ private factories;
1321
+ private targets;
1089
1322
  private behaviors;
1090
1323
  /**
1091
1324
  * The data that the view is bound to.
1092
1325
  */
1093
- source: any | null;
1326
+ source: TSource | null;
1094
1327
  /**
1095
1328
  * The execution context the view is running within.
1096
1329
  */
1097
- context: ExecutionContext | null;
1330
+ context: TContext | null;
1098
1331
  /**
1099
1332
  * The first DOM node in the range of nodes that make up the view.
1100
1333
  */
@@ -1108,7 +1341,7 @@ export declare class HTMLView implements ElementView, SyntheticView {
1108
1341
  * @param fragment - The html fragment that contains the nodes for this view.
1109
1342
  * @param behaviors - The behaviors to be applied to this view.
1110
1343
  */
1111
- constructor(fragment: DocumentFragment, behaviors: Behavior[]);
1344
+ constructor(fragment: DocumentFragment, factories: ReadonlyArray<ViewBehaviorFactory>, targets: ViewBehaviorTargets);
1112
1345
  /**
1113
1346
  * Appends the view's DOM nodes to the referenced node.
1114
1347
  * @param node - The parent node to append the view's DOM nodes to.
@@ -1134,7 +1367,7 @@ export declare class HTMLView implements ElementView, SyntheticView {
1134
1367
  * @param source - The binding source for the view's binding behaviors.
1135
1368
  * @param context - The execution context to run the behaviors within.
1136
1369
  */
1137
- bind(source: unknown, context: ExecutionContext): void;
1370
+ bind(source: TSource, context: TContext): void;
1138
1371
  /**
1139
1372
  * Unbinds a view's behaviors from its binding source.
1140
1373
  */
@@ -1147,41 +1380,127 @@ export declare class HTMLView implements ElementView, SyntheticView {
1147
1380
  }
1148
1381
 
1149
1382
  /**
1150
- * Core services shared across FAST instances.
1151
- * @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
1152
1390
  */
1153
- export declare const enum KernelServiceId {
1154
- updateQueue = 1,
1155
- observable = 2,
1156
- contextEvent = 3,
1157
- elementRegistry = 4
1158
- }
1391
+ export declare const item: <TItem = any, TParent = any>(strings: TemplateStringsArray, ...values: TemplateValue<TItem, TParent, ItemContext<TParent>>[]) => ItemViewTemplate<TItem, TParent>;
1159
1392
 
1160
1393
  /**
1161
- * Reverses all readonly members, making them mutable.
1162
- * @internal
1394
+ * Provides additional contextual information when inside a repeat item template.s
1395
+ * @public
1163
1396
  */
1164
- export declare type Mutable<T> = {
1165
- -readonly [P in keyof T]: T[P];
1166
- };
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
+ }
1167
1438
 
1168
1439
  /**
1169
- * A factory that can create a {@link Behavior} associated with a particular
1170
- * location within a DOM fragment.
1440
+ * A template capable of rendering item views not specifically connected to custom elements.
1171
1441
  * @public
1172
1442
  */
1173
- export declare interface NodeBehaviorFactory {
1443
+ export declare interface ItemViewTemplate<TSource = any, TParent = any> {
1444
+ type: "item";
1174
1445
  /**
1175
- * The index of the DOM node to which the created behavior will apply.
1446
+ * Creates a SyntheticView instance based on this template definition.
1176
1447
  */
1177
- 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 {
1178
1465
  /**
1179
- * Creates a behavior for the provided target node.
1180
- * @param target - The node instance to create the behavior for.
1466
+ * The length of the observed array.
1181
1467
  */
1182
- createBehavior(target: Node): Behavior;
1468
+ length: number;
1183
1469
  }
1184
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
+
1185
1504
  /**
1186
1505
  * Options for configuring node observation behavior.
1187
1506
  * @public
@@ -1203,61 +1522,72 @@ export declare interface NodeBehaviorOptions<T = any> {
1203
1522
 
1204
1523
  /**
1205
1524
  * A base class for node observation.
1206
- * @internal
1525
+ * @public
1526
+ * @remarks
1527
+ * Internally used by the SlottedDirective and the ChildrenDirective.
1207
1528
  */
1208
- declare abstract class NodeObservationBehavior<T extends NodeBehaviorOptions> implements Behavior {
1209
- protected target: HTMLElement;
1210
- protected options: T;
1211
- private source;
1212
- private shouldUpdate;
1529
+ export declare abstract class NodeObservationDirective<T extends NodeBehaviorOptions> extends StatelessAttachedAttributeDirective<T> {
1530
+ private sourceProperty;
1213
1531
  /**
1214
- * Creates an instance of NodeObservationBehavior.
1215
- * @param target - The target to assign the nodes property on.
1216
- * @param options - The options to use in configuring node observation.
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.
1217
1536
  */
1218
- constructor(target: HTMLElement, options: T);
1537
+ bind(source: any, context: ExecutionContext, targets: ViewBehaviorTargets): void;
1219
1538
  /**
1220
- * 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.
1221
1543
  */
1222
- abstract observe(): void;
1544
+ unbind(source: any, context: ExecutionContext, targets: ViewBehaviorTargets): void;
1223
1545
  /**
1224
- * 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.
1225
1549
  */
1226
- abstract disconnect(): void;
1550
+ protected getSource(target: Node): any;
1227
1551
  /**
1228
- * 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.
1229
1555
  */
1230
- protected abstract getNodes(): Node[];
1556
+ protected updateTarget(source: any, value: ReadonlyArray<any>): void;
1231
1557
  /**
1232
- * Bind this behavior to the source.
1233
- * @param source - The source to bind to.
1234
- * @param context - The execution context that the binding is operating within.
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.
1235
1563
  */
1236
- bind(source: any): void;
1564
+ protected computeNodes(target: any): Node[];
1237
1565
  /**
1238
- * Unbinds this behavior from the source.
1239
- * @param source - The source to unbind from.
1566
+ * Begins observation of the nodes.
1567
+ * @param target - The target to observe.
1240
1568
  */
1241
- unbind(): void;
1242
- /** @internal */
1243
- handleEvent(): void;
1244
- private computeNodes;
1245
- 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[];
1246
1580
  }
1247
1581
 
1248
- declare function normalBind(this: BindingBehavior, source: unknown, context: ExecutionContext): void;
1249
-
1250
- declare function normalUnbind(this: BindingBehavior): void;
1251
-
1252
1582
  /**
1253
- * Provides change notification for a source object.
1583
+ * Provides change notifications for an observed subject.
1254
1584
  * @public
1255
1585
  */
1256
1586
  export declare interface Notifier {
1257
1587
  /**
1258
- * The source object that this notifier provides change notification for.
1588
+ * The object that subscribers will receive notifications for.
1259
1589
  */
1260
- readonly source: any;
1590
+ readonly subject: any;
1261
1591
  /**
1262
1592
  * Notifies all subscribers, based on the args.
1263
1593
  * @param args - Data passed along to subscribers during notification.
@@ -1298,16 +1628,12 @@ export declare const nullableNumberConverter: ValueConverter;
1298
1628
  * @public
1299
1629
  */
1300
1630
  export declare const Observable: Readonly<{
1301
- /**
1302
- * @internal
1303
- * @param factory - The factory used to create array observers.
1304
- */
1305
- setArrayObserverFactory(factory: (collection: any[]) => Notifier): void;
1631
+ /* Excluded from this release type: setArrayObserverFactory */
1306
1632
  /**
1307
1633
  * Gets a notifier for an object or Array.
1308
1634
  * @param source - The object or Array to get the notifier for.
1309
1635
  */
1310
- getNotifier: (source: any) => Notifier;
1636
+ getNotifier: <T extends Notifier = Notifier>(source: any) => T;
1311
1637
  /**
1312
1638
  * Records a property change for a source object.
1313
1639
  * @param source - The object to record the change against.
@@ -1345,13 +1671,13 @@ export declare const Observable: Readonly<{
1345
1671
  * @param initialSubscriber - An initial subscriber to changes in the binding value.
1346
1672
  * @param isVolatileBinding - Indicates whether the binding's dependency list must be re-evaluated on every value evaluation.
1347
1673
  */
1348
- 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>;
1349
1675
  /**
1350
1676
  * Determines whether a binding expression is volatile and needs to have its dependency list re-evaluated
1351
1677
  * on every evaluation of the value.
1352
1678
  * @param binding - The binding to inspect.
1353
1679
  */
1354
- 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;
1355
1681
  }>;
1356
1682
 
1357
1683
  /**
@@ -1377,6 +1703,48 @@ export declare interface ObservationRecord {
1377
1703
  propertyName: string;
1378
1704
  }
1379
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
+
1380
1748
  /**
1381
1749
  * Represents metadata configuration for a custom element.
1382
1750
  * @public
@@ -1408,6 +1776,18 @@ export declare interface PartialFASTElementDefinition {
1408
1776
  readonly elementOptions?: ElementDefinitionOptions;
1409
1777
  }
1410
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
+
1411
1791
  /**
1412
1792
  * An implementation of Notifier that allows subscribers to be notified
1413
1793
  * of individual property changes on an object.
@@ -1415,16 +1795,16 @@ export declare interface PartialFASTElementDefinition {
1415
1795
  */
1416
1796
  export declare class PropertyChangeNotifier implements Notifier {
1417
1797
  private subscribers;
1418
- private sourceSubscribers;
1798
+ private subjectSubscribers;
1419
1799
  /**
1420
- * The source that property changes are being notified for.
1800
+ * The subject that property changes are being notified for.
1421
1801
  */
1422
- readonly source: any;
1802
+ readonly subject: any;
1423
1803
  /**
1424
- * Creates an instance of PropertyChangeNotifier for the specified source.
1425
- * @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.
1426
1806
  */
1427
- constructor(source: any);
1807
+ constructor(subject: any);
1428
1808
  /**
1429
1809
  * Notifies all subscribers, based on the specified property.
1430
1810
  * @param propertyName - The property name, passed along to subscribers during notification.
@@ -1449,27 +1829,20 @@ export declare class PropertyChangeNotifier implements Notifier {
1449
1829
  * @param propertyName - The name of the property to assign the reference to.
1450
1830
  * @public
1451
1831
  */
1452
- 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>;
1453
1833
 
1454
1834
  /**
1455
1835
  * The runtime behavior for template references.
1456
1836
  * @public
1457
1837
  */
1458
- export declare class RefBehavior implements Behavior {
1459
- private target;
1460
- private propertyName;
1461
- /**
1462
- * Creates an instance of RefBehavior.
1463
- * @param target - The element to reference.
1464
- * @param propertyName - The name of the property to assign the reference to.
1465
- */
1466
- constructor(target: HTMLElement, propertyName: string);
1838
+ export declare class RefDirective extends StatelessAttachedAttributeDirective<string> {
1467
1839
  /**
1468
1840
  * Bind this behavior to the source.
1469
1841
  * @param source - The source to bind to.
1470
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.
1471
1844
  */
1472
- bind(source: any): void;
1845
+ bind(source: any, context: ExecutionContext, targets: ViewBehaviorTargets): void;
1473
1846
  /**
1474
1847
  * Unbinds this behavior from the source.
1475
1848
  * @param source - The source to unbind from.
@@ -1477,6 +1850,8 @@ export declare class RefBehavior implements Behavior {
1477
1850
  unbind(): void;
1478
1851
  }
1479
1852
 
1853
+ declare const reflectMode = "reflect";
1854
+
1480
1855
  /**
1481
1856
  * A directive that enables list rendering.
1482
1857
  * @param itemsBinding - The array to render.
@@ -1485,7 +1860,55 @@ export declare class RefBehavior implements Behavior {
1485
1860
  * @param options - Options used to turn on special repeat features.
1486
1861
  * @public
1487
1862
  */
1488
- 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>;
1489
1912
 
1490
1913
  /**
1491
1914
  * A behavior that renders a template for each item in an array.
@@ -1503,7 +1926,7 @@ export declare class RepeatBehavior<TSource = any> implements Behavior, Subscrib
1503
1926
  private items;
1504
1927
  private itemsObserver;
1505
1928
  private itemsBindingObserver;
1506
- private originalContext;
1929
+ private context;
1507
1930
  private childContext;
1508
1931
  private bindView;
1509
1932
  /**
@@ -1527,7 +1950,11 @@ export declare class RepeatBehavior<TSource = any> implements Behavior, Subscrib
1527
1950
  * @param source - The source to unbind from.
1528
1951
  */
1529
1952
  unbind(): void;
1530
- /** @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
+ */
1531
1958
  handleChange(source: any, args: Splice[]): void;
1532
1959
  private observeItems;
1533
1960
  private updateViews;
@@ -1539,17 +1966,25 @@ export declare class RepeatBehavior<TSource = any> implements Behavior, Subscrib
1539
1966
  * A directive that configures list rendering.
1540
1967
  * @public
1541
1968
  */
1542
- export declare class RepeatDirective<TSource = any> extends HTMLDirective {
1543
- private itemsBinding;
1544
- private templateBinding;
1545
- 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;
1546
1973
  private isItemsBindingVolatile;
1547
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;
1548
1983
  /**
1549
1984
  * Creates a placeholder string based on the directive's index within the template.
1550
1985
  * @param index - The index of the directive within the template.
1551
1986
  */
1552
- createPlaceholder: (index: number) => string;
1987
+ createHTML(add: AddViewBehaviorFactory): string;
1553
1988
  /**
1554
1989
  * Creates an instance of RepeatDirective.
1555
1990
  * @param itemsBinding - The binding that provides the array to render.
@@ -1561,7 +1996,7 @@ export declare class RepeatDirective<TSource = any> extends HTMLDirective {
1561
1996
  * Creates a behavior for the provided target node.
1562
1997
  * @param target - The node instance to create the behavior for.
1563
1998
  */
1564
- createBehavior(target: Node): RepeatBehavior<TSource>;
1999
+ createBehavior(targets: ViewBehaviorTargets): RepeatBehavior<TSource>;
1565
2000
  }
1566
2001
 
1567
2002
  /**
@@ -1579,63 +2014,319 @@ export declare interface RepeatOptions {
1579
2014
  recycle?: boolean;
1580
2015
  }
1581
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
+
1582
2079
  /**
1583
2080
  * A directive that observes the `assignedNodes()` of a slot and updates a property
1584
2081
  * whenever they change.
1585
2082
  * @param propertyOrOptions - The options used to configure slotted node observation.
1586
2083
  * @public
1587
2084
  */
1588
- 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>;
1589
2086
 
1590
2087
  /**
1591
2088
  * The runtime behavior for slotted node observation.
1592
2089
  * @public
1593
2090
  */
1594
- export declare class SlottedBehavior extends NodeObservationBehavior<SlottedBehaviorOptions> {
1595
- /**
1596
- * Creates an instance of SlottedBehavior.
1597
- * @param target - The slot element target to observe.
1598
- * @param options - The options to use when observing the slot.
1599
- */
1600
- constructor(target: HTMLSlotElement, options: SlottedBehaviorOptions);
2091
+ export declare class SlottedDirective extends NodeObservationDirective<SlottedDirectiveOptions> {
1601
2092
  /**
1602
2093
  * Begins observation of the nodes.
2094
+ * @param target - The target to observe.
1603
2095
  */
1604
- observe(): void;
2096
+ observe(target: EventSource): void;
1605
2097
  /**
1606
2098
  * Disconnects observation of the nodes.
2099
+ * @param target - The target to unobserve.
1607
2100
  */
1608
- disconnect(): void;
2101
+ disconnect(target: EventSource): void;
1609
2102
  /**
1610
- * 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.
1611
2105
  */
1612
- protected getNodes(): Node[];
2106
+ getNodes(target: HTMLSlotElement): Node[];
2107
+ /* Excluded from this release type: handleEvent */
1613
2108
  }
1614
2109
 
1615
2110
  /**
1616
2111
  * The options used to configure slotted node observation.
1617
2112
  * @public
1618
2113
  */
1619
- export declare interface SlottedBehaviorOptions<T = any> extends NodeBehaviorOptions<T>, AssignedNodesOptions {
2114
+ export declare interface SlottedDirectiveOptions<T = any> extends NodeBehaviorOptions<T>, AssignedNodesOptions {
1620
2115
  }
1621
2116
 
1622
2117
  /**
1623
- * 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.
1624
2127
  * @public
1625
2128
  */
1626
- export declare interface Splice {
2129
+ export declare class Splice {
2130
+ index: number;
2131
+ removed: any[];
2132
+ addedCount: number;
1627
2133
  /**
1628
- * The index that the splice occurs at.
2134
+ * Indicates that this splice represents a complete array reset.
1629
2135
  */
1630
- index: number;
2136
+ reset?: boolean;
1631
2137
  /**
1632
- * 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.
1633
2142
  */
1634
- removed: any[];
2143
+ constructor(index: number, removed: any[], addedCount: number);
1635
2144
  /**
1636
- * 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.
1637
2148
  */
1638
- 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;
1639
2330
  }
1640
2331
 
1641
2332
  /**
@@ -1652,12 +2343,6 @@ export declare interface StyleTarget {
1652
2343
  * @param styles - The styles element to add.
1653
2344
  */
1654
2345
  append(styles: HTMLStyleElement): void;
1655
- /**
1656
- * Adds styles to the target by prepending the styles.
1657
- * @param styles - The styles element to add.
1658
- * @deprecated - use append()
1659
- */
1660
- prepend(styles: HTMLStyleElement): void;
1661
2346
  /**
1662
2347
  * Removes styles from the target.
1663
2348
  * @param styles - The styles element to remove.
@@ -1676,17 +2361,17 @@ export declare interface StyleTarget {
1676
2361
  */
1677
2362
  export declare interface Subscriber {
1678
2363
  /**
1679
- * Called when a source this instance has subscribed to changes.
1680
- * @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.
1681
2366
  * @param args - The event args detailing the change that occurred.
1682
2367
  */
1683
- handleChange(source: any, args: any): void;
2368
+ handleChange(subject: any, args: any): void;
1684
2369
  }
1685
2370
 
1686
2371
  /**
1687
2372
  * An implementation of {@link Notifier} that efficiently keeps track of
1688
2373
  * subscribers interested in a specific change notification on an
1689
- * observable source.
2374
+ * observable subject.
1690
2375
  *
1691
2376
  * @remarks
1692
2377
  * This set is optimized for the most common scenario of 1 or 2 subscribers.
@@ -1699,15 +2384,15 @@ export declare class SubscriberSet implements Notifier {
1699
2384
  private sub2;
1700
2385
  private spillover;
1701
2386
  /**
1702
- * The source that this subscriber set is reporting changes for.
2387
+ * The object that subscribers will receive notifications for.
1703
2388
  */
1704
- readonly source: any;
2389
+ readonly subject: any;
1705
2390
  /**
1706
- * Creates an instance of SubscriberSet for the specified source.
1707
- * @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.
1708
2393
  * @param initialSubscriber - An initial subscriber to changes.
1709
2394
  */
1710
- constructor(source: any, initialSubscriber?: Subscriber);
2395
+ constructor(subject: any, initialSubscriber?: Subscriber);
1711
2396
  /**
1712
2397
  * Checks whether the provided subscriber has been added to this set.
1713
2398
  * @param subscriber - The subscriber to test for inclusion in this set.
@@ -1734,7 +2419,7 @@ export declare class SubscriberSet implements Notifier {
1734
2419
  * The options used to configure subtree observation.
1735
2420
  * @public
1736
2421
  */
1737
- 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"> {
1738
2423
  /**
1739
2424
  * Indicates that child subtrees should be observed for changes.
1740
2425
  */
@@ -1750,7 +2435,7 @@ export declare interface SubtreeBehaviorOptions<T = any> extends Omit<NodeBehavi
1750
2435
  * A view representing a range of DOM nodes which can be added/removed ad hoc.
1751
2436
  * @public
1752
2437
  */
1753
- 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> {
1754
2439
  /**
1755
2440
  * The first DOM node in the range of nodes that make up the view.
1756
2441
  */
@@ -1769,46 +2454,25 @@ export declare interface SyntheticView extends View {
1769
2454
  * The nodes are not disposed and the view can later be re-inserted.
1770
2455
  */
1771
2456
  remove(): void;
1772
- /**
1773
- * Removes the view and unbinds its behaviors, disposing of DOM nodes afterward.
1774
- * Once a view has been disposed, it cannot be inserted or bound again.
1775
- */
1776
- dispose(): void;
1777
2457
  }
1778
2458
 
1779
2459
  /**
1780
2460
  * A template capable of rendering views not specifically connected to custom elements.
1781
2461
  * @public
1782
2462
  */
1783
- 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";
1784
2465
  /**
1785
2466
  * Creates a SyntheticView instance based on this template definition.
1786
2467
  */
1787
- create(): SyntheticView;
1788
- }
1789
-
1790
- /**
1791
- * A {@link HTMLDirective} that targets a named attribute or property on a node.
1792
- * @public
1793
- */
1794
- export declare abstract class TargetedHTMLDirective extends HTMLDirective {
1795
- /**
1796
- * Gets/sets the name of the attribute or property that this
1797
- * directive is targeting on the associated node.
1798
- */
1799
- abstract targetName: string | undefined;
1800
- /**
1801
- * Creates a placeholder string based on the directive's index within the template.
1802
- * @param index - The index of the directive within the template.
1803
- */
1804
- createPlaceholder: (index: number) => string;
2468
+ create(): SyntheticView<TSource, TParent, TContext>;
1805
2469
  }
1806
2470
 
1807
2471
  /**
1808
2472
  * Represents the types of values that can be interpolated into a template.
1809
2473
  * @public
1810
2474
  */
1811
- 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>;
1812
2476
 
1813
2477
  /**
1814
2478
  * Enables working with trusted types.
@@ -1835,7 +2499,154 @@ export declare type TrustedTypesPolicy = {
1835
2499
  createHTML(html: string): string;
1836
2500
  };
1837
2501
 
1838
- 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
+ }
1839
2650
 
1840
2651
  /**
1841
2652
  * Represents objects that can convert values to and from
@@ -1859,43 +2670,88 @@ export declare interface ValueConverter {
1859
2670
  * Represents a collection of DOM nodes which can be bound to a data source.
1860
2671
  * @public
1861
2672
  */
1862
- export declare interface View {
2673
+ export declare interface View<TSource = any, TParent = any, TContext extends ExecutionContext<TParent> = ExecutionContext<TParent>> extends Disposable {
1863
2674
  /**
1864
2675
  * The execution context the view is running within.
1865
2676
  */
1866
- readonly context: ExecutionContext | null;
2677
+ readonly context: TContext | null;
1867
2678
  /**
1868
2679
  * The data that the view is bound to.
1869
2680
  */
1870
- readonly source: any | null;
2681
+ readonly source: TSource | null;
1871
2682
  /**
1872
2683
  * Binds a view's behaviors to its binding source.
1873
2684
  * @param source - The binding source for the view's binding behaviors.
1874
2685
  * @param context - The execution context to run the view within.
1875
2686
  */
1876
- bind(source: unknown, context: ExecutionContext): void;
2687
+ bind(source: TSource, context: TContext): void;
1877
2688
  /**
1878
2689
  * Unbinds a view's behaviors from its binding source and context.
1879
2690
  */
1880
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> {
1881
2699
  /**
1882
- * Removes the view and unbinds its behaviors, disposing of DOM nodes afterward.
1883
- * Once a view has been disposed, it cannot be inserted or bound again.
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.
1884
2704
  */
1885
- 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;
1886
2734
  }
1887
2735
 
2736
+ /**
2737
+ * The target nodes available to a behavior.
2738
+ * @public
2739
+ */
2740
+ export declare type ViewBehaviorTargets = {
2741
+ [id: string]: Node;
2742
+ };
2743
+
1888
2744
  /**
1889
2745
  * A template capable of creating HTMLView instances or rendering directly to DOM.
1890
2746
  * @public
1891
2747
  */
1892
- export declare class ViewTemplate<TSource = any, TParent = any> implements ElementViewTemplate, SyntheticViewTemplate {
1893
- private behaviorCount;
1894
- private hasHostBehaviors;
1895
- private fragment;
1896
- private targetOffset;
1897
- private viewBehaviorFactories;
1898
- private hostBehaviorFactories;
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;
1899
2755
  /**
1900
2756
  * The html representing what this template will
1901
2757
  * instantiate, including placeholders for directives.
@@ -1904,18 +2760,18 @@ export declare class ViewTemplate<TSource = any, TParent = any> implements Eleme
1904
2760
  /**
1905
2761
  * The directives that will be connected to placeholders in the html.
1906
2762
  */
1907
- readonly directives: ReadonlyArray<HTMLDirective>;
2763
+ readonly factories: Record<string, ViewBehaviorFactory>;
1908
2764
  /**
1909
2765
  * Creates an instance of ViewTemplate.
1910
2766
  * @param html - The html representing what this template will instantiate, including placeholders for directives.
1911
- * @param directives - The directives that will be connected to placeholders in the html.
2767
+ * @param factories - The directives that will be connected to placeholders in the html.
1912
2768
  */
1913
- constructor(html: string | HTMLTemplateElement, directives: ReadonlyArray<HTMLDirective>);
2769
+ constructor(html: string | HTMLTemplateElement, factories: Record<string, ViewBehaviorFactory>);
1914
2770
  /**
1915
2771
  * Creates an HTMLView instance based on this template definition.
1916
2772
  * @param hostBindingTarget - The element that host behaviors will be bound to.
1917
2773
  */
1918
- create(hostBindingTarget?: Element): HTMLView;
2774
+ create(hostBindingTarget?: Element): HTMLView<TSource, TParent, TContext>;
1919
2775
  /**
1920
2776
  * Creates an HTMLView from this template, binds it to the source, and then appends it to the host.
1921
2777
  * @param source - The data source to bind the template to.
@@ -1923,7 +2779,7 @@ export declare class ViewTemplate<TSource = any, TParent = any> implements Eleme
1923
2779
  * @param hostBindingTarget - An HTML element to target the host bindings at if different from the
1924
2780
  * host that the template is being attached to.
1925
2781
  */
1926
- render(source: TSource, host: Node | string, hostBindingTarget?: Element): HTMLView;
2782
+ render(source: TSource, host: Node, hostBindingTarget?: Element, context?: TContext): HTMLView<TSource, TParent, TContext>;
1927
2783
  }
1928
2784
 
1929
2785
  /**