@microsoft/fast-element 2.0.0-beta.2 → 2.0.0-beta.5

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 (54) hide show
  1. package/CHANGELOG.json +147 -0
  2. package/CHANGELOG.md +42 -1
  3. package/dist/dts/components/fast-definitions.d.ts +9 -8
  4. package/dist/dts/components/fast-element.d.ts +12 -24
  5. package/dist/dts/context.d.ts +1 -1
  6. package/dist/dts/di/di.d.ts +858 -0
  7. package/dist/dts/hooks.d.ts +2 -2
  8. package/dist/dts/interfaces.d.ts +40 -7
  9. package/dist/dts/observation/observable.d.ts +19 -13
  10. package/dist/dts/styles/element-styles.d.ts +6 -0
  11. package/dist/dts/templating/binding-signal.d.ts +10 -27
  12. package/dist/dts/templating/binding-two-way.d.ts +16 -41
  13. package/dist/dts/templating/binding.d.ts +79 -118
  14. package/dist/dts/templating/html-directive.d.ts +31 -3
  15. package/dist/dts/templating/render.d.ts +277 -0
  16. package/dist/dts/templating/repeat.d.ts +12 -16
  17. package/dist/dts/templating/template.d.ts +3 -3
  18. package/dist/dts/templating/when.d.ts +3 -3
  19. package/dist/dts/testing/exports.d.ts +2 -0
  20. package/dist/dts/testing/fixture.d.ts +90 -0
  21. package/dist/dts/testing/timeout.d.ts +7 -0
  22. package/dist/esm/components/fast-definitions.js +25 -27
  23. package/dist/esm/components/fast-element.js +20 -11
  24. package/dist/esm/context.js +5 -1
  25. package/dist/esm/debug.js +36 -4
  26. package/dist/esm/di/di.js +1351 -0
  27. package/dist/esm/observation/arrays.js +303 -2
  28. package/dist/esm/observation/observable.js +11 -6
  29. package/dist/esm/platform.js +1 -1
  30. package/dist/esm/styles/element-styles.js +14 -0
  31. package/dist/esm/templating/binding-signal.js +56 -61
  32. package/dist/esm/templating/binding-two-way.js +56 -34
  33. package/dist/esm/templating/binding.js +137 -156
  34. package/dist/esm/templating/compiler.js +30 -7
  35. package/dist/esm/templating/html-directive.js +16 -2
  36. package/dist/esm/templating/render.js +392 -0
  37. package/dist/esm/templating/repeat.js +57 -40
  38. package/dist/esm/templating/template.js +8 -5
  39. package/dist/esm/templating/view.js +3 -1
  40. package/dist/esm/templating/when.js +5 -4
  41. package/dist/esm/testing/exports.js +2 -0
  42. package/dist/esm/testing/fixture.js +88 -0
  43. package/dist/esm/testing/timeout.js +24 -0
  44. package/dist/fast-element.api.json +2828 -2758
  45. package/dist/fast-element.d.ts +218 -230
  46. package/dist/fast-element.debug.js +656 -257
  47. package/dist/fast-element.debug.min.js +1 -1
  48. package/dist/fast-element.js +620 -253
  49. package/dist/fast-element.min.js +1 -1
  50. package/dist/fast-element.untrimmed.d.ts +226 -235
  51. package/docs/api-report.md +88 -91
  52. package/package.json +15 -6
  53. package/dist/dts/observation/splice-strategies.d.ts +0 -13
  54. package/dist/esm/observation/splice-strategies.js +0 -400
@@ -115,8 +115,10 @@ export declare const Aspect: Readonly<{
115
115
  *
116
116
  * @param directive - The directive to assign the aspect to.
117
117
  * @param value - The value to base the aspect determination on.
118
+ * @remarks
119
+ * If a falsy value is provided, then the content aspect will be assigned.
118
120
  */
119
- readonly assign: (directive: Aspected, value: string) => void;
121
+ readonly assign: (directive: Aspected, value?: string) => void;
120
122
  }>;
121
123
 
122
124
  /**
@@ -145,7 +147,7 @@ export declare interface Aspected {
145
147
  /**
146
148
  * A binding if one is associated with the aspect.
147
149
  */
148
- binding?: Binding;
150
+ dataBinding?: Binding;
149
151
  }
150
152
 
151
153
  /**
@@ -265,102 +267,80 @@ export declare interface Behavior<TSource = any, TParent = any> {
265
267
  }
266
268
 
267
269
  /**
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.
270
+ * Creates an standard binding.
271
+ * @param binding - The binding to refresh when changed.
272
+ * @param isVolatile - Indicates whether the binding is volatile or not.
273
+ * @returns A binding configuration.
272
274
  * @public
273
275
  */
274
- export declare function bind<T = any>(binding: Binding<T>, config?: BindingConfig | DefaultBindingOptions): CaptureType<T>;
276
+ export declare function bind<T = any>(binding: Expression<T>, isVolatile?: boolean): Binding<T>;
275
277
 
276
278
  /**
277
- * The signature of an arrow function capable of being evaluated
278
- * as part of a template binding update.
279
- * @public
280
- */
281
- export declare type Binding<TSource = any, TReturn = any, TParent = any> = (source: TSource, context: ExecutionContext<TParent>) => TReturn;
282
-
283
- /**
284
- * Describes the configuration for a binding expression.
279
+ * Captures a binding expression along with related information and capabilities.
280
+ *
285
281
  * @public
286
282
  */
287
- export declare interface BindingConfig<T = any> {
283
+ export declare abstract class Binding<TSource = any, TReturn = any, TParent = any> {
284
+ /**
285
+ * Options associated with the binding.
286
+ */
287
+ options?: any;
288
288
  /**
289
- * The binding mode to configure the binding with.
289
+ * Whether or not the binding is volatile.
290
290
  */
291
- mode: BindingMode;
291
+ isVolatile?: boolean;
292
292
  /**
293
- * Options to be supplied to the binding behaviors.
293
+ * Evaluates the binding expression.
294
294
  */
295
- options: T;
295
+ evaluate: Expression<TSource, TReturn, TParent>;
296
+ /**
297
+ * Creates an observer capable of notifying a subscriber when the output of a binding changes.
298
+ * @param directive - The HTML Directive to create the observer for.
299
+ * @param subscriber - The subscriber to changes in the binding.
300
+ */
301
+ abstract createObserver(directive: HTMLDirective, subscriber: Subscriber): ExpressionObserver<TSource, TReturn, TParent>;
296
302
  }
297
303
 
298
304
  /**
299
- * Describes the configuration for a binding expression.
305
+ * A binding behavior for bindings that change.
300
306
  * @public
301
307
  */
302
- export declare const BindingConfig: Readonly<{
308
+ export declare class BindingBehavior implements ViewBehavior {
309
+ readonly directive: HTMLBindingDirective;
310
+ protected updateTarget: UpdateTarget;
311
+ private observerProperty;
303
312
  /**
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.
313
+ * Creates an instance of ChangeBinding.
314
+ * @param directive - The directive that has the configuration for this behavior.
315
+ * @param updateTarget - The function used to update the target with the latest value.
308
316
  */
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<{
317
+ constructor(directive: HTMLBindingDirective, updateTarget: UpdateTarget);
329
318
  /**
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.
319
+ * Bind this behavior to the source.
320
+ * @param source - The source to bind to.
321
+ * @param context - The execution context that the binding is operating within.
322
+ * @param targets - The targets that behaviors in a view can attach to.
334
323
  */
335
- define(UpdateType: typeof UpdateBinding, EventType?: typeof EventBinding): BindingMode;
336
- }>;
337
-
338
- /**
339
- * Enables evaluation of and subscription to a binding.
340
- * @public
341
- */
342
- export declare interface BindingObserver<TSource = any, TReturn = any, TParent = any> extends Notifier, Disposable {
324
+ bind(source: any, context: ExecutionContext, targets: ViewBehaviorTargets): void;
343
325
  /**
344
- * Begins observing the binding for the source and returns the current value.
345
- * @param source - The source that the binding is based on.
346
- * @param context - The execution context to execute the binding within.
347
- * @returns The value of the binding.
326
+ * Unbinds this behavior from the source.
327
+ * @param source - The source to unbind from.
328
+ * @param context - The execution context that the binding is operating within.
329
+ * @param targets - The targets that behaviors in a view can attach to.
348
330
  */
349
- observe(source: TSource, context?: ExecutionContext<TParent>): TReturn;
331
+ unbind(source: any, context: ExecutionContext, targets: ViewBehaviorTargets): void;
332
+ /* Excluded from this release type: handleChange */
350
333
  /**
351
- * Gets {@link ObservationRecord|ObservationRecords} that the {@link BindingObserver}
352
- * is observing.
334
+ * Returns the binding observer used to update the node.
335
+ * @param target - The target node.
336
+ * @returns A BindingObserver.
353
337
  */
354
- records(): IterableIterator<ObservationRecord>;
338
+ protected getObserver(target: Node): ExpressionObserver;
355
339
  /**
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.
340
+ * Creates a behavior.
341
+ * @param targets - The targets available for behaviors to be attached to.
362
342
  */
363
- setMode(isAsync: boolean): void;
343
+ createBehavior(targets: ViewBehaviorTargets): ViewBehavior;
364
344
  }
365
345
 
366
346
  /**
@@ -389,42 +369,6 @@ export declare type Callable = typeof Function.prototype.call | {
389
369
  export declare interface CaptureType<TSource> {
390
370
  }
391
371
 
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
372
  /**
429
373
  * The options used to configure child list observation.
430
374
  * @public
@@ -536,6 +480,10 @@ export declare const Compiler: {
536
480
  */
537
481
  export declare type ComposableStyles = string | ElementStyles | CSSStyleSheet;
538
482
 
483
+ declare function compose<TType extends Constructable<HTMLElement> = Constructable<HTMLElement>>(this: TType, nameOrDef: string | PartialFASTElementDefinition): FASTElementDefinition<TType>;
484
+
485
+ declare function compose<TType extends Constructable<HTMLElement> = Constructable<HTMLElement>>(type: TType, nameOrDef?: string | PartialFASTElementDefinition): FASTElementDefinition<TType>;
486
+
539
487
  /**
540
488
  * Allows for the creation of Constructable mixin classes.
541
489
  *
@@ -557,6 +505,58 @@ export declare type ConstructibleStyleStrategy = {
557
505
  new (styles: (string | CSSStyleSheet)[]): StyleStrategy;
558
506
  };
559
507
 
508
+ /**
509
+ * A special binding behavior that can bind node content.
510
+ * @public
511
+ */
512
+ export declare class ContentBehavior extends BindingBehavior {
513
+ /**
514
+ * Unbinds this behavior from the source.
515
+ * @param source - The source to unbind from.
516
+ * @param context - The execution context that the binding is operating within.
517
+ * @param targets - The targets that behaviors in a view can attach to.
518
+ */
519
+ unbind(source: any, context: ExecutionContext, targets: ViewBehaviorTargets): void;
520
+ }
521
+
522
+ /**
523
+ * A simple template that can create ContentView instances.
524
+ * @public
525
+ */
526
+ export declare interface ContentTemplate {
527
+ /**
528
+ * Creates a simple content view instance.
529
+ */
530
+ create(): ContentView;
531
+ }
532
+
533
+ /**
534
+ * A simple View that can be interpolated into HTML content.
535
+ * @public
536
+ */
537
+ export declare interface ContentView {
538
+ /**
539
+ * Binds a view's behaviors to its binding source.
540
+ * @param source - The binding source for the view's binding behaviors.
541
+ * @param context - The execution context to run the view within.
542
+ */
543
+ bind(source: any, context: ExecutionContext): void;
544
+ /**
545
+ * Unbinds a view's behaviors from its binding source and context.
546
+ */
547
+ unbind(): void;
548
+ /**
549
+ * Inserts the view's DOM nodes before the referenced node.
550
+ * @param node - The node to insert the view's DOM before.
551
+ */
552
+ insertBefore(node: Node): void;
553
+ /**
554
+ * Removes the view's DOM nodes.
555
+ * The nodes are not disposed and the view can later be re-inserted.
556
+ */
557
+ remove(): void;
558
+ }
559
+
560
560
  /**
561
561
  * Controls the lifecycle and rendering of a `FASTElement`.
562
562
  * @public
@@ -776,11 +776,9 @@ export declare function customElement(nameOrDef: string | PartialFASTElementDefi
776
776
  */
777
777
  export declare type DecoratorAttributeConfiguration = Omit<AttributeConfiguration, "property">;
778
778
 
779
- /**
780
- * The default binding options.
781
- * @public
782
- */
783
- export declare type DefaultBindingOptions = AddEventListenerOptions;
779
+ declare function define<TType extends Constructable<HTMLElement> = Constructable<HTMLElement>>(this: TType, nameOrDef: string | PartialFASTElementDefinition): TType;
780
+
781
+ declare function define<TType extends Constructable<HTMLElement> = Constructable<HTMLElement>>(type: TType, nameOrDef?: string | PartialFASTElementDefinition): TType;
784
782
 
785
783
  /**
786
784
  * Provides a mechanism for releasing resources.
@@ -887,6 +885,12 @@ export declare class ElementStyles {
887
885
  * @param Strategy - The strategy type to construct.
888
886
  */
889
887
  static setDefaultStrategy(Strategy: ConstructibleStyleStrategy): void;
888
+ /**
889
+ * Normalizes a set of composable style options.
890
+ * @param styles - The style options to normalize.
891
+ * @returns A singular ElementStyles instance or undefined.
892
+ */
893
+ static normalize(styles: ComposableStyles | ComposableStyles[] | undefined): ElementStyles | undefined;
890
894
  /**
891
895
  * Indicates whether the DOM supports the adoptedStyleSheets feature.
892
896
  */
@@ -938,7 +942,7 @@ export declare const emptyArray: readonly never[];
938
942
  * A binding behavior for handling events.
939
943
  * @public
940
944
  */
941
- export declare class EventBinding {
945
+ export declare class EventBehavior {
942
946
  readonly directive: HTMLBindingDirective;
943
947
  private contextProperty;
944
948
  private sourceProperty;
@@ -1059,6 +1063,48 @@ export declare class ExecutionContext<TParentSource = any> {
1059
1063
  static create(): ExecutionContext;
1060
1064
  }
1061
1065
 
1066
+ /**
1067
+ * The signature of an arrow function capable of being evaluated
1068
+ * against source data and within an execution context.
1069
+ * @public
1070
+ */
1071
+ export declare type Expression<TSource = any, TReturn = any, TParent = any> = (source: TSource, context: ExecutionContext<TParent>) => TReturn;
1072
+
1073
+ /**
1074
+ * Enables evaluation of and subscription to a binding.
1075
+ * @public
1076
+ */
1077
+ export declare interface ExpressionNotifier<TSource = any, TReturn = any, TParent = any> extends Notifier, ExpressionObserver<TSource, TReturn, TParent> {
1078
+ /**
1079
+ * Gets {@link ObservationRecord|ObservationRecords} that the {@link ExpressionNotifier}
1080
+ * is observing.
1081
+ */
1082
+ records(): IterableIterator<ObservationRecord>;
1083
+ /**
1084
+ * Sets the update mode used by the observer.
1085
+ * @param isAsync - Indicates whether updates should be asynchronous.
1086
+ * @remarks
1087
+ * By default, the update mode is asynchronous, since that provides the best
1088
+ * performance for template rendering scenarios. Passing false to setMode will
1089
+ * instead cause the observer to notify subscribers immediately when changes occur.
1090
+ */
1091
+ setMode(isAsync: boolean): void;
1092
+ }
1093
+
1094
+ /**
1095
+ * Observes a binding for changes.
1096
+ *
1097
+ * @public
1098
+ */
1099
+ export declare interface ExpressionObserver<TSource = any, TReturn = any, TParent = any> extends Disposable {
1100
+ /**
1101
+ * Begins observing the binding.
1102
+ * @param source - The source to pass to the binding.
1103
+ * @param context - The context to pass to the binding.
1104
+ */
1105
+ observe(source: TSource, context?: ExecutionContext<TParent>): TReturn;
1106
+ }
1107
+
1062
1108
  /* Excluded from this release type: FAST */
1063
1109
 
1064
1110
  /**
@@ -1111,29 +1157,11 @@ export declare interface FASTElement extends HTMLElement {
1111
1157
  * static helpers for working with FASTElements.
1112
1158
  * @public
1113
1159
  */
1114
- export declare const FASTElement: (new () => HTMLElement & FASTElement) & {
1115
- /**
1116
- * Creates a new FASTElement base class inherited from the
1117
- * provided base type.
1118
- * @param BaseType - The base element type to inherit from.
1119
- */
1120
- from<TBase extends {
1121
- new (): HTMLElement;
1122
- prototype: HTMLElement;
1123
- }>(BaseType: TBase): new () => InstanceType<TBase> & FASTElement;
1124
- /**
1125
- * Defines a platform custom element based on the provided type and definition.
1126
- * @param type - The custom element type to define.
1127
- * @param nameOrDef - The name of the element to define or a definition object
1128
- * that describes the element to define.
1129
- */
1130
- define<TType extends Constructable<HTMLElement>>(type: TType, nameOrDef?: string | PartialFASTElementDefinition): TType;
1131
- /**
1132
- * Defines metadata for a FASTElement which can be used to later define the element.
1133
- * IMPORTANT: This API will be renamed to "compose" in a future beta.
1134
- * @public
1135
- */
1136
- metadata<TType_1 extends Constructable<HTMLElement> = Constructable<HTMLElement>>(type: TType_1, nameOrDef?: string | PartialFASTElementDefinition): FASTElementDefinition<TType_1>;
1160
+ export declare const FASTElement: {
1161
+ new (): FASTElement;
1162
+ define: typeof define;
1163
+ compose: typeof compose;
1164
+ from: typeof from;
1137
1165
  };
1138
1166
 
1139
1167
  /**
@@ -1141,7 +1169,7 @@ export declare const FASTElement: (new () => HTMLElement & FASTElement) & {
1141
1169
  * @public
1142
1170
  */
1143
1171
  export declare class FASTElementDefinition<TType extends Constructable<HTMLElement> = Constructable<HTMLElement>> {
1144
- private observedAttributes;
1172
+ private platformDefined;
1145
1173
  /**
1146
1174
  * The type this element definition describes.
1147
1175
  */
@@ -1182,13 +1210,7 @@ export declare class FASTElementDefinition<TType extends Constructable<HTMLEleme
1182
1210
  * Options controlling how the custom element is defined with the platform.
1183
1211
  */
1184
1212
  readonly elementOptions?: ElementDefinitionOptions;
1185
- /**
1186
- * Creates an instance of FASTElementDefinition.
1187
- * @param type - The type this definition is being created for.
1188
- * @param nameOrConfig - The name of the element to define or a config object
1189
- * that describes the element to define.
1190
- */
1191
- constructor(type: TType, nameOrConfig?: PartialFASTElementDefinition | string);
1213
+ private constructor();
1192
1214
  /**
1193
1215
  * Defines a custom element based on this definition.
1194
1216
  * @param registry - The element registry to define the element in.
@@ -1196,6 +1218,13 @@ export declare class FASTElementDefinition<TType extends Constructable<HTMLEleme
1196
1218
  * This operation is idempotent per registry.
1197
1219
  */
1198
1220
  define(registry?: CustomElementRegistry): this;
1221
+ /**
1222
+ * Creates an instance of FASTElementDefinition.
1223
+ * @param type - The type this definition is being created for.
1224
+ * @param nameOrDef - The name of the element to define or a config object
1225
+ * that describes the element to define.
1226
+ */
1227
+ static compose<TType extends Constructable<HTMLElement> = Constructable<HTMLElement>>(type: TType, nameOrDef?: string | PartialFASTElementDefinition): FASTElementDefinition<TType>;
1199
1228
  /**
1200
1229
  * Gets the element definition associated with the specified type.
1201
1230
  * @param type - The custom element type to retrieve the definition for.
@@ -1210,6 +1239,8 @@ export declare class FASTElementDefinition<TType extends Constructable<HTMLEleme
1210
1239
 
1211
1240
  /* Excluded from this release type: FASTGlobal */
1212
1241
 
1242
+ declare function from<TBase extends typeof HTMLElement>(BaseType: TBase): new () => InstanceType<TBase> & FASTElement;
1243
+
1213
1244
  /**
1214
1245
  * Transforms a template literal string into a ViewTemplate.
1215
1246
  * @param strings - The string fragments that are interpolated with the values.
@@ -1226,9 +1257,7 @@ export declare function html<TSource = any, TParent = any>(strings: TemplateStri
1226
1257
  * @public
1227
1258
  */
1228
1259
  export declare class HTMLBindingDirective implements HTMLDirective, ViewBehaviorFactory, Aspected {
1229
- binding: Binding;
1230
- mode: BindingMode;
1231
- options: any;
1260
+ dataBinding: Binding;
1232
1261
  private factory;
1233
1262
  /**
1234
1263
  * The unique id of the factory.
@@ -1252,11 +1281,9 @@ export declare class HTMLBindingDirective implements HTMLDirective, ViewBehavior
1252
1281
  aspectType: Aspect;
1253
1282
  /**
1254
1283
  * Creates an instance of HTMLBindingDirective.
1255
- * @param binding - The binding to apply.
1256
- * @param mode - The binding mode to use when applying the binding.
1257
- * @param options - The options to configure the binding with.
1284
+ * @param dataBinding - The binding configuration to apply.
1258
1285
  */
1259
- constructor(binding: Binding, mode: BindingMode, options: any);
1286
+ constructor(dataBinding: Binding);
1260
1287
  /**
1261
1288
  * Creates HTML to be used within a template.
1262
1289
  * @param add - Can be used to add behavior factories to a template.
@@ -1421,6 +1448,15 @@ export declare interface LengthObserver extends Subscriber {
1421
1448
  */
1422
1449
  export declare function lengthOf<T>(array: readonly T[]): number;
1423
1450
 
1451
+ /**
1452
+ * Creates an event listener binding.
1453
+ * @param binding - The binding to invoke when the event is raised.
1454
+ * @param options - Event listener options.
1455
+ * @returns A binding configuration.
1456
+ * @public
1457
+ */
1458
+ export declare function listener<T = any>(binding: Expression<T>, options?: AddEventListenerOptions): Binding<T>;
1459
+
1424
1460
  /**
1425
1461
  * Common APIs related to markup generation.
1426
1462
  * @public
@@ -1532,6 +1568,14 @@ export declare abstract class NodeObservationDirective<T extends NodeBehaviorOpt
1532
1568
  protected abstract getNodes(target: any): Node[];
1533
1569
  }
1534
1570
 
1571
+ /**
1572
+ * Normalizes the input value into a binding.
1573
+ * @param value - The value to create the default binding for.
1574
+ * @returns A binding configuration for the provided value.
1575
+ * @public
1576
+ */
1577
+ export declare function normalizeBinding<TSource = any, TReturn = any, TParent = any>(value: Expression<TSource, TReturn, TParent> | Binding<TSource, TReturn, TParent> | {}): Binding<TSource, TReturn, TParent>;
1578
+
1535
1579
  /**
1536
1580
  * Provides change notifications for an observed subject.
1537
1581
  * @public
@@ -1618,19 +1662,19 @@ export declare const Observable: Readonly<{
1618
1662
  */
1619
1663
  getAccessors: (target: {}) => Accessor[];
1620
1664
  /**
1621
- * Creates a {@link BindingObserver} that can watch the
1622
- * provided {@link Binding} for changes.
1665
+ * Creates a {@link ExpressionNotifier} that can watch the
1666
+ * provided {@link Expression} for changes.
1623
1667
  * @param binding - The binding to observe.
1624
1668
  * @param initialSubscriber - An initial subscriber to changes in the binding value.
1625
1669
  * @param isVolatileBinding - Indicates whether the binding's dependency list must be re-evaluated on every value evaluation.
1626
1670
  */
1627
- binding<TSource = any, TReturn = any>(binding: Binding<TSource, TReturn, any>, initialSubscriber?: Subscriber, isVolatileBinding?: boolean): BindingObserver<TSource, TReturn, any>;
1671
+ binding<TSource = any, TReturn = any>(binding: Expression<TSource, TReturn, any>, initialSubscriber?: Subscriber, isVolatileBinding?: boolean): ExpressionNotifier<TSource, TReturn, any>;
1628
1672
  /**
1629
1673
  * Determines whether a binding expression is volatile and needs to have its dependency list re-evaluated
1630
1674
  * on every evaluation of the value.
1631
1675
  * @param binding - The binding to inspect.
1632
1676
  */
1633
- isVolatileBinding<TSource_1 = any, TReturn_1 = any>(binding: Binding<TSource_1, TReturn_1, any>): boolean;
1677
+ isVolatileBinding<TSource_1 = any, TReturn_1 = any>(binding: Expression<TSource_1, TReturn_1, any>): boolean;
1634
1678
  }>;
1635
1679
 
1636
1680
  /**
@@ -1657,30 +1701,12 @@ export declare interface ObservationRecord {
1657
1701
  }
1658
1702
 
1659
1703
  /**
1660
- * The default onChange binding configuration.
1661
- * @public
1662
- */
1663
- export declare const onChange: BindingConfig<AddEventListenerOptions> & BindingConfigResolver<AddEventListenerOptions>;
1664
-
1665
- /**
1666
- * The default onTime binding configuration.
1667
- * @public
1668
- */
1669
- export declare const oneTime: BindingConfig<AddEventListenerOptions> & BindingConfigResolver<AddEventListenerOptions>;
1670
-
1671
- /**
1672
- * A binding behavior for one-time bindings.
1704
+ * Creates a one time binding
1705
+ * @param binding - The binding to refresh when signaled.
1706
+ * @returns A binding configuration.
1673
1707
  * @public
1674
1708
  */
1675
- export declare class OneTimeBinding extends UpdateBinding {
1676
- /**
1677
- * Bind this behavior to the source.
1678
- * @param source - The source to bind to.
1679
- * @param context - The execution context that the binding is operating within.
1680
- * @param targets - The targets that behaviors in a view can attach to.
1681
- */
1682
- bind(source: any, context: ExecutionContext, targets: ViewBehaviorTargets): void;
1683
- }
1709
+ export declare function oneTime<T = any>(binding: Expression<T>): Binding<T>;
1684
1710
 
1685
1711
  /**
1686
1712
  * Common APIs related to content parsing.
@@ -1807,23 +1833,21 @@ declare const reflectMode = "reflect";
1807
1833
 
1808
1834
  /**
1809
1835
  * A directive that enables list rendering.
1810
- * @param itemsBinding - The array to render.
1811
- * @param templateOrTemplateBinding - The template or a template binding used obtain a template
1836
+ * @param items - The array to render.
1837
+ * @param template - The template or a template binding used obtain a template
1812
1838
  * to render for each item in the array.
1813
1839
  * @param options - Options used to turn on special repeat features.
1814
1840
  * @public
1815
1841
  */
1816
- export declare function repeat<TSource = any, TArray extends ReadonlyArray<any> = ReadonlyArray<any>>(itemsBinding: Binding<TSource, TArray, ExecutionContext<TSource>>, templateOrTemplateBinding: ViewTemplate | Binding<TSource, ViewTemplate>, options?: RepeatOptions): CaptureType<TSource>;
1842
+ export declare function repeat<TSource = any, TArray extends ReadonlyArray<any> = ReadonlyArray<any>>(items: Expression<TSource, TArray, ExecutionContext<TSource>> | Binding<TSource, TArray> | ReadonlyArray<any>, template: Expression<TSource, ViewTemplate> | Binding<TSource, ViewTemplate> | ViewTemplate, options?: RepeatOptions): CaptureType<TSource>;
1817
1843
 
1818
1844
  /**
1819
1845
  * A behavior that renders a template for each item in an array.
1820
1846
  * @public
1821
1847
  */
1822
1848
  export declare class RepeatBehavior<TSource = any> implements Behavior, Subscriber {
1849
+ private directive;
1823
1850
  private location;
1824
- private itemsBinding;
1825
- private templateBinding;
1826
- private options;
1827
1851
  private source;
1828
1852
  private views;
1829
1853
  private template;
@@ -1837,13 +1861,13 @@ export declare class RepeatBehavior<TSource = any> implements Behavior, Subscrib
1837
1861
  /**
1838
1862
  * Creates an instance of RepeatBehavior.
1839
1863
  * @param location - The location in the DOM to render the repeat.
1840
- * @param itemsBinding - The array to render.
1864
+ * @param dataBinding - The array to render.
1841
1865
  * @param isItemsBindingVolatile - Indicates whether the items binding has volatile dependencies.
1842
1866
  * @param templateBinding - The template to render for each item.
1843
1867
  * @param isTemplateBindingVolatile - Indicates whether the template binding has volatile dependencies.
1844
1868
  * @param options - Options used to turn on special repeat features.
1845
1869
  */
1846
- constructor(location: Node, itemsBinding: Binding<TSource, any[]>, isItemsBindingVolatile: boolean, templateBinding: Binding<TSource, SyntheticViewTemplate>, isTemplateBindingVolatile: boolean, options: RepeatOptions);
1870
+ constructor(directive: RepeatDirective, location: Node);
1847
1871
  /**
1848
1872
  * Bind this behavior to the source.
1849
1873
  * @param source - The source to bind to.
@@ -1860,7 +1884,7 @@ export declare class RepeatBehavior<TSource = any> implements Behavior, Subscrib
1860
1884
  * @param source - The source of the change.
1861
1885
  * @param args - The details about what was changed.
1862
1886
  */
1863
- handleChange(source: any, args: Splice[]): void;
1887
+ handleChange(source: any, args: Splice[] | ExpressionObserver): void;
1864
1888
  private observeItems;
1865
1889
  private updateViews;
1866
1890
  private refreshAllViews;
@@ -1872,11 +1896,9 @@ export declare class RepeatBehavior<TSource = any> implements Behavior, Subscrib
1872
1896
  * @public
1873
1897
  */
1874
1898
  export declare class RepeatDirective<TSource = any> implements HTMLDirective, ViewBehaviorFactory {
1875
- readonly itemsBinding: Binding;
1899
+ readonly dataBinding: Binding<TSource>;
1876
1900
  readonly templateBinding: Binding<TSource, SyntheticViewTemplate>;
1877
1901
  readonly options: RepeatOptions;
1878
- private isItemsBindingVolatile;
1879
- private isTemplateBindingVolatile;
1880
1902
  /**
1881
1903
  * The unique id of the factory.
1882
1904
  */
@@ -1892,11 +1914,11 @@ export declare class RepeatDirective<TSource = any> implements HTMLDirective, Vi
1892
1914
  createHTML(add: AddViewBehaviorFactory): string;
1893
1915
  /**
1894
1916
  * Creates an instance of RepeatDirective.
1895
- * @param itemsBinding - The binding that provides the array to render.
1917
+ * @param dataBinding - The binding that provides the array to render.
1896
1918
  * @param templateBinding - The template binding used to obtain a template to render for each item in the array.
1897
1919
  * @param options - Options used to turn on special repeat features.
1898
1920
  */
1899
- constructor(itemsBinding: Binding, templateBinding: Binding<TSource, SyntheticViewTemplate>, options: RepeatOptions);
1921
+ constructor(dataBinding: Binding<TSource>, templateBinding: Binding<TSource, SyntheticViewTemplate>, options: RepeatOptions);
1900
1922
  /**
1901
1923
  * Creates a behavior for the provided target node.
1902
1924
  * @param target - The node instance to create the behavior for.
@@ -2314,7 +2336,7 @@ export declare interface SyntheticViewTemplate<TSource = any, TParent = any> {
2314
2336
  * Represents the types of values that can be interpolated into a template.
2315
2337
  * @public
2316
2338
  */
2317
- export declare type TemplateValue<TSource, TParent = any> = Binding<TSource, any, TParent> | HTMLDirective | CaptureType<TSource>;
2339
+ export declare type TemplateValue<TSource, TParent = any> = Expression<TSource, any, TParent> | Binding<TSource, any, TParent> | HTMLDirective | CaptureType<TSource>;
2318
2340
 
2319
2341
  /**
2320
2342
  * Enables working with trusted types.
@@ -2345,40 +2367,6 @@ export declare type TrustedTypesPolicy = {
2345
2367
 
2346
2368
  /* Excluded from this release type: TypeRegistry */
2347
2369
 
2348
- /**
2349
- * A base binding behavior for DOM updates.
2350
- * @public
2351
- */
2352
- export declare class UpdateBinding implements ViewBehavior {
2353
- readonly directive: HTMLBindingDirective;
2354
- protected updateTarget: UpdateTarget;
2355
- /**
2356
- * Creates an instance of UpdateBinding.
2357
- * @param directive - The directive that has the configuration for this behavior.
2358
- * @param updateTarget - The function used to update the target with the latest value.
2359
- */
2360
- constructor(directive: HTMLBindingDirective, updateTarget: UpdateTarget);
2361
- /**
2362
- * Bind this behavior to the source.
2363
- * @param source - The source to bind to.
2364
- * @param context - The execution context that the binding is operating within.
2365
- * @param targets - The targets that behaviors in a view can attach to.
2366
- */
2367
- bind(source: any, context: ExecutionContext, targets: ViewBehaviorTargets): void;
2368
- /**
2369
- * Unbinds this behavior from the source.
2370
- * @param source - The source to unbind from.
2371
- * @param context - The execution context that the binding is operating within.
2372
- * @param targets - The targets that behaviors in a view can attach to.
2373
- */
2374
- unbind(source: any, context: ExecutionContext, targets: ViewBehaviorTargets): void;
2375
- /**
2376
- * Creates a behavior.
2377
- * @param targets - The targets available for behaviors to be attached to.
2378
- */
2379
- createBehavior(targets: ViewBehaviorTargets): ViewBehavior;
2380
- }
2381
-
2382
2370
  /**
2383
2371
  * A work queue used to synchronize writes to the DOM.
2384
2372
  * @public
@@ -2583,11 +2571,11 @@ export declare function volatile(target: {}, name: string | Accessor, descriptor
2583
2571
 
2584
2572
  /**
2585
2573
  * A directive that enables basic conditional rendering in a template.
2586
- * @param binding - The condition to test for rendering.
2574
+ * @param condition - The condition to test for rendering.
2587
2575
  * @param templateOrTemplateBinding - The template or a binding that gets
2588
2576
  * the template to render when the condition is true.
2589
2577
  * @public
2590
2578
  */
2591
- export declare function when<TSource = any, TReturn = any>(binding: Binding<TSource, TReturn>, templateOrTemplateBinding: SyntheticViewTemplate | Binding<TSource, SyntheticViewTemplate>): CaptureType<TSource>;
2579
+ export declare function when<TSource = any, TReturn = any>(condition: Expression<TSource, TReturn> | boolean, templateOrTemplateBinding: SyntheticViewTemplate | Expression<TSource, SyntheticViewTemplate>): CaptureType<TSource>;
2592
2580
 
2593
2581
  export { }