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

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 (50) hide show
  1. package/CHANGELOG.json +81 -0
  2. package/CHANGELOG.md +20 -1
  3. package/dist/dts/components/fast-definitions.d.ts +9 -8
  4. package/dist/dts/components/fast-element.d.ts +8 -4
  5. package/dist/dts/context.d.ts +1 -1
  6. package/dist/dts/di/di.d.ts +854 -0
  7. package/dist/dts/hooks.d.ts +2 -2
  8. package/dist/dts/interfaces.d.ts +38 -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 +28 -2
  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 +16 -8
  24. package/dist/esm/context.js +5 -1
  25. package/dist/esm/debug.js +34 -4
  26. package/dist/esm/di/di.js +1349 -0
  27. package/dist/esm/observation/observable.js +4 -4
  28. package/dist/esm/platform.js +1 -1
  29. package/dist/esm/styles/element-styles.js +14 -0
  30. package/dist/esm/templating/binding-signal.js +56 -61
  31. package/dist/esm/templating/binding-two-way.js +51 -35
  32. package/dist/esm/templating/binding.js +137 -156
  33. package/dist/esm/templating/compiler.js +29 -7
  34. package/dist/esm/templating/html-directive.js +12 -1
  35. package/dist/esm/templating/render.js +392 -0
  36. package/dist/esm/templating/repeat.js +54 -40
  37. package/dist/esm/templating/template.js +8 -5
  38. package/dist/esm/templating/when.js +5 -4
  39. package/dist/esm/testing/exports.js +2 -0
  40. package/dist/esm/testing/fixture.js +88 -0
  41. package/dist/esm/testing/timeout.js +24 -0
  42. package/dist/fast-element.api.json +3257 -3151
  43. package/dist/fast-element.d.ts +210 -209
  44. package/dist/fast-element.debug.js +329 -248
  45. package/dist/fast-element.debug.min.js +1 -1
  46. package/dist/fast-element.js +295 -244
  47. package/dist/fast-element.min.js +1 -1
  48. package/dist/fast-element.untrimmed.d.ts +218 -214
  49. package/docs/api-report.md +83 -85
  50. package/package.json +13 -1
@@ -147,7 +147,7 @@ export declare interface Aspected {
147
147
  /**
148
148
  * A binding if one is associated with the aspect.
149
149
  */
150
- binding?: Binding;
150
+ dataBinding?: Binding;
151
151
  }
152
152
 
153
153
  /**
@@ -267,102 +267,80 @@ export declare interface Behavior<TSource = any, TParent = any> {
267
267
  }
268
268
 
269
269
  /**
270
- * Creates a binding directive with the specified configuration.
271
- * @param binding - The binding expression.
272
- * @param config - The binding configuration.
273
- * @returns A binding directive.
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.
274
274
  * @public
275
275
  */
276
- 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>;
277
277
 
278
278
  /**
279
- * The signature of an arrow function capable of being evaluated
280
- * as part of a template binding update.
281
- * @public
282
- */
283
- export declare type Binding<TSource = any, TReturn = any, TParent = any> = (source: TSource, context: ExecutionContext<TParent>) => TReturn;
284
-
285
- /**
286
- * Describes the configuration for a binding expression.
279
+ * Captures a binding expression along with related information and capabilities.
280
+ *
287
281
  * @public
288
282
  */
289
- 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;
290
288
  /**
291
- * The binding mode to configure the binding with.
289
+ * Whether or not the binding is volatile.
292
290
  */
293
- mode: BindingMode;
291
+ isVolatile?: boolean;
294
292
  /**
295
- * Options to be supplied to the binding behaviors.
293
+ * Evaluates the binding expression.
296
294
  */
297
- 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>;
298
302
  }
299
303
 
300
304
  /**
301
- * Describes the configuration for a binding expression.
305
+ * A binding behavior for bindings that change.
302
306
  * @public
303
307
  */
304
- export declare const BindingConfig: Readonly<{
308
+ export declare class BindingBehavior implements ViewBehavior {
309
+ readonly directive: HTMLBindingDirective;
310
+ protected updateTarget: UpdateTarget;
311
+ private observerProperty;
305
312
  /**
306
- * Creates a binding configuration based on the provided mode and options.
307
- * @param mode - The mode to use for the configuration.
308
- * @param defaultOptions - The default options to use for the configuration.
309
- * @returns A new binding configuration.
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.
310
316
  */
311
- define<T>(mode: BindingMode, defaultOptions: T): BindingConfig<T> & BindingConfigResolver<T>;
312
- }>;
313
-
314
- /**
315
- * Creates a new binding configuration based on the supplied options.
316
- * @public
317
- */
318
- export declare type BindingConfigResolver<T> = (options: T) => BindingConfig<T>;
319
-
320
- /**
321
- * Describes how aspects of an HTML element will be affected by bindings.
322
- * @public
323
- */
324
- export declare type BindingMode = Record<Aspect, (directive: HTMLBindingDirective) => Pick<ViewBehaviorFactory, "createBehavior">>;
325
-
326
- /**
327
- * Describes how aspects of an HTML element will be affected by bindings.
328
- * @public
329
- */
330
- export declare const BindingMode: Readonly<{
317
+ constructor(directive: HTMLBindingDirective, updateTarget: UpdateTarget);
331
318
  /**
332
- * Creates a binding mode based on the supplied behavior types.
333
- * @param UpdateType - The base behavior type used to update aspects.
334
- * @param EventType - The base behavior type used to respond to events.
335
- * @returns A new binding mode.
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.
336
323
  */
337
- define(UpdateType: typeof UpdateBinding, EventType?: typeof EventBinding): BindingMode;
338
- }>;
339
-
340
- /**
341
- * Enables evaluation of and subscription to a binding.
342
- * @public
343
- */
344
- export declare interface BindingObserver<TSource = any, TReturn = any, TParent = any> extends Notifier, Disposable {
324
+ bind(source: any, context: ExecutionContext, targets: ViewBehaviorTargets): void;
345
325
  /**
346
- * Begins observing the binding for the source and returns the current value.
347
- * @param source - The source that the binding is based on.
348
- * @param context - The execution context to execute the binding within.
349
- * @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.
350
330
  */
351
- observe(source: TSource, context?: ExecutionContext<TParent>): TReturn;
331
+ unbind(source: any, context: ExecutionContext, targets: ViewBehaviorTargets): void;
332
+ /* Excluded from this release type: handleChange */
352
333
  /**
353
- * Gets {@link ObservationRecord|ObservationRecords} that the {@link BindingObserver}
354
- * is observing.
334
+ * Returns the binding observer used to update the node.
335
+ * @param target - The target node.
336
+ * @returns A BindingObserver.
355
337
  */
356
- records(): IterableIterator<ObservationRecord>;
338
+ protected getObserver(target: Node): ExpressionObserver;
357
339
  /**
358
- * Sets the update mode used by the observer.
359
- * @param isAsync - Indicates whether updates should be asynchronous.
360
- * @remarks
361
- * By default, the update mode is asynchronous, since that provides the best
362
- * performance for template rendering scenarios. Passing false to setMode will
363
- * instead cause the observer to notify subscribers immediately when changes occur.
340
+ * Creates a behavior.
341
+ * @param targets - The targets available for behaviors to be attached to.
364
342
  */
365
- setMode(isAsync: boolean): void;
343
+ createBehavior(targets: ViewBehaviorTargets): ViewBehavior;
366
344
  }
367
345
 
368
346
  /**
@@ -391,42 +369,6 @@ export declare type Callable = typeof Function.prototype.call | {
391
369
  export declare interface CaptureType<TSource> {
392
370
  }
393
371
 
394
- /**
395
- * A binding behavior for bindings that change.
396
- * @public
397
- */
398
- export declare class ChangeBinding extends UpdateBinding {
399
- private isBindingVolatile;
400
- private observerProperty;
401
- /**
402
- * Creates an instance of ChangeBinding.
403
- * @param directive - The directive that has the configuration for this behavior.
404
- * @param updateTarget - The function used to update the target with the latest value.
405
- */
406
- constructor(directive: HTMLBindingDirective, updateTarget: UpdateTarget);
407
- /**
408
- * Returns the binding observer used to update the node.
409
- * @param target - The target node.
410
- * @returns A BindingObserver.
411
- */
412
- protected getObserver(target: Node): BindingObserver;
413
- /**
414
- * Bind this behavior to the source.
415
- * @param source - The source to bind to.
416
- * @param context - The execution context that the binding is operating within.
417
- * @param targets - The targets that behaviors in a view can attach to.
418
- */
419
- bind(source: any, context: ExecutionContext, targets: ViewBehaviorTargets): void;
420
- /**
421
- * Unbinds this behavior from the source.
422
- * @param source - The source to unbind from.
423
- * @param context - The execution context that the binding is operating within.
424
- * @param targets - The targets that behaviors in a view can attach to.
425
- */
426
- unbind(source: any, context: ExecutionContext, targets: ViewBehaviorTargets): void;
427
- /* Excluded from this release type: handleChange */
428
- }
429
-
430
372
  /**
431
373
  * The options used to configure child list observation.
432
374
  * @public
@@ -538,6 +480,10 @@ export declare const Compiler: {
538
480
  */
539
481
  export declare type ComposableStyles = string | ElementStyles | CSSStyleSheet;
540
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
+
541
487
  /**
542
488
  * Allows for the creation of Constructable mixin classes.
543
489
  *
@@ -559,6 +505,58 @@ export declare type ConstructibleStyleStrategy = {
559
505
  new (styles: (string | CSSStyleSheet)[]): StyleStrategy;
560
506
  };
561
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
+
562
560
  /**
563
561
  * Controls the lifecycle and rendering of a `FASTElement`.
564
562
  * @public
@@ -778,11 +776,9 @@ export declare function customElement(nameOrDef: string | PartialFASTElementDefi
778
776
  */
779
777
  export declare type DecoratorAttributeConfiguration = Omit<AttributeConfiguration, "property">;
780
778
 
781
- /**
782
- * The default binding options.
783
- * @public
784
- */
785
- 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;
786
782
 
787
783
  /**
788
784
  * Provides a mechanism for releasing resources.
@@ -889,6 +885,12 @@ export declare class ElementStyles {
889
885
  * @param Strategy - The strategy type to construct.
890
886
  */
891
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;
892
894
  /**
893
895
  * Indicates whether the DOM supports the adoptedStyleSheets feature.
894
896
  */
@@ -940,7 +942,7 @@ export declare const emptyArray: readonly never[];
940
942
  * A binding behavior for handling events.
941
943
  * @public
942
944
  */
943
- export declare class EventBinding {
945
+ export declare class EventBehavior {
944
946
  readonly directive: HTMLBindingDirective;
945
947
  private contextProperty;
946
948
  private sourceProperty;
@@ -1061,6 +1063,48 @@ export declare class ExecutionContext<TParentSource = any> {
1061
1063
  static create(): ExecutionContext;
1062
1064
  }
1063
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
+
1064
1108
  /* Excluded from this release type: FAST */
1065
1109
 
1066
1110
  /**
@@ -1129,13 +1173,12 @@ export declare const FASTElement: (new () => HTMLElement & FASTElement) & {
1129
1173
  * @param nameOrDef - The name of the element to define or a definition object
1130
1174
  * that describes the element to define.
1131
1175
  */
1132
- define<TType extends Constructable<HTMLElement>>(type: TType, nameOrDef?: string | PartialFASTElementDefinition): TType;
1176
+ define: typeof define;
1133
1177
  /**
1134
1178
  * Defines metadata for a FASTElement which can be used to later define the element.
1135
- * IMPORTANT: This API will be renamed to "compose" in a future beta.
1136
1179
  * @public
1137
1180
  */
1138
- metadata<TType_1 extends Constructable<HTMLElement> = Constructable<HTMLElement>>(type: TType_1, nameOrDef?: string | PartialFASTElementDefinition): FASTElementDefinition<TType_1>;
1181
+ compose: typeof compose;
1139
1182
  };
1140
1183
 
1141
1184
  /**
@@ -1143,7 +1186,7 @@ export declare const FASTElement: (new () => HTMLElement & FASTElement) & {
1143
1186
  * @public
1144
1187
  */
1145
1188
  export declare class FASTElementDefinition<TType extends Constructable<HTMLElement> = Constructable<HTMLElement>> {
1146
- private observedAttributes;
1189
+ private platformDefined;
1147
1190
  /**
1148
1191
  * The type this element definition describes.
1149
1192
  */
@@ -1184,13 +1227,7 @@ export declare class FASTElementDefinition<TType extends Constructable<HTMLEleme
1184
1227
  * Options controlling how the custom element is defined with the platform.
1185
1228
  */
1186
1229
  readonly elementOptions?: ElementDefinitionOptions;
1187
- /**
1188
- * Creates an instance of FASTElementDefinition.
1189
- * @param type - The type this definition is being created for.
1190
- * @param nameOrConfig - The name of the element to define or a config object
1191
- * that describes the element to define.
1192
- */
1193
- constructor(type: TType, nameOrConfig?: PartialFASTElementDefinition | string);
1230
+ private constructor();
1194
1231
  /**
1195
1232
  * Defines a custom element based on this definition.
1196
1233
  * @param registry - The element registry to define the element in.
@@ -1198,6 +1235,13 @@ export declare class FASTElementDefinition<TType extends Constructable<HTMLEleme
1198
1235
  * This operation is idempotent per registry.
1199
1236
  */
1200
1237
  define(registry?: CustomElementRegistry): this;
1238
+ /**
1239
+ * Creates an instance of FASTElementDefinition.
1240
+ * @param type - The type this definition is being created for.
1241
+ * @param nameOrDef - The name of the element to define or a config object
1242
+ * that describes the element to define.
1243
+ */
1244
+ static compose<TType extends Constructable<HTMLElement> = Constructable<HTMLElement>>(type: TType, nameOrDef?: string | PartialFASTElementDefinition): FASTElementDefinition<TType>;
1201
1245
  /**
1202
1246
  * Gets the element definition associated with the specified type.
1203
1247
  * @param type - The custom element type to retrieve the definition for.
@@ -1228,9 +1272,7 @@ export declare function html<TSource = any, TParent = any>(strings: TemplateStri
1228
1272
  * @public
1229
1273
  */
1230
1274
  export declare class HTMLBindingDirective implements HTMLDirective, ViewBehaviorFactory, Aspected {
1231
- binding: Binding;
1232
- mode: BindingMode;
1233
- options: any;
1275
+ dataBinding: Binding;
1234
1276
  private factory;
1235
1277
  /**
1236
1278
  * The unique id of the factory.
@@ -1254,11 +1296,9 @@ export declare class HTMLBindingDirective implements HTMLDirective, ViewBehavior
1254
1296
  aspectType: Aspect;
1255
1297
  /**
1256
1298
  * Creates an instance of HTMLBindingDirective.
1257
- * @param binding - The binding to apply.
1258
- * @param mode - The binding mode to use when applying the binding.
1259
- * @param options - The options to configure the binding with.
1299
+ * @param dataBinding - The binding configuration to apply.
1260
1300
  */
1261
- constructor(binding: Binding, mode: BindingMode, options: any);
1301
+ constructor(dataBinding: Binding);
1262
1302
  /**
1263
1303
  * Creates HTML to be used within a template.
1264
1304
  * @param add - Can be used to add behavior factories to a template.
@@ -1423,6 +1463,15 @@ export declare interface LengthObserver extends Subscriber {
1423
1463
  */
1424
1464
  export declare function lengthOf<T>(array: readonly T[]): number;
1425
1465
 
1466
+ /**
1467
+ * Creates an event listener binding.
1468
+ * @param binding - The binding to invoke when the event is raised.
1469
+ * @param options - Event listener options.
1470
+ * @returns A binding configuration.
1471
+ * @public
1472
+ */
1473
+ export declare function listener<T = any>(binding: Expression<T>, options?: AddEventListenerOptions): Binding<T>;
1474
+
1426
1475
  /**
1427
1476
  * Common APIs related to markup generation.
1428
1477
  * @public
@@ -1534,6 +1583,14 @@ export declare abstract class NodeObservationDirective<T extends NodeBehaviorOpt
1534
1583
  protected abstract getNodes(target: any): Node[];
1535
1584
  }
1536
1585
 
1586
+ /**
1587
+ * Normalizes the input value into a binding.
1588
+ * @param value - The value to create the default binding for.
1589
+ * @returns A binding configuration for the provided value.
1590
+ * @public
1591
+ */
1592
+ export declare function normalizeBinding<TSource = any, TReturn = any, TParent = any>(value: Expression<TSource, TReturn, TParent> | Binding<TSource, TReturn, TParent> | {}): Binding<TSource, TReturn, TParent>;
1593
+
1537
1594
  /**
1538
1595
  * Provides change notifications for an observed subject.
1539
1596
  * @public
@@ -1620,19 +1677,19 @@ export declare const Observable: Readonly<{
1620
1677
  */
1621
1678
  getAccessors: (target: {}) => Accessor[];
1622
1679
  /**
1623
- * Creates a {@link BindingObserver} that can watch the
1624
- * provided {@link Binding} for changes.
1680
+ * Creates a {@link ExpressionNotifier} that can watch the
1681
+ * provided {@link Expression} for changes.
1625
1682
  * @param binding - The binding to observe.
1626
1683
  * @param initialSubscriber - An initial subscriber to changes in the binding value.
1627
1684
  * @param isVolatileBinding - Indicates whether the binding's dependency list must be re-evaluated on every value evaluation.
1628
1685
  */
1629
- binding<TSource = any, TReturn = any>(binding: Binding<TSource, TReturn, any>, initialSubscriber?: Subscriber, isVolatileBinding?: boolean): BindingObserver<TSource, TReturn, any>;
1686
+ binding<TSource = any, TReturn = any>(binding: Expression<TSource, TReturn, any>, initialSubscriber?: Subscriber, isVolatileBinding?: boolean): ExpressionNotifier<TSource, TReturn, any>;
1630
1687
  /**
1631
1688
  * Determines whether a binding expression is volatile and needs to have its dependency list re-evaluated
1632
1689
  * on every evaluation of the value.
1633
1690
  * @param binding - The binding to inspect.
1634
1691
  */
1635
- isVolatileBinding<TSource_1 = any, TReturn_1 = any>(binding: Binding<TSource_1, TReturn_1, any>): boolean;
1692
+ isVolatileBinding<TSource_1 = any, TReturn_1 = any>(binding: Expression<TSource_1, TReturn_1, any>): boolean;
1636
1693
  }>;
1637
1694
 
1638
1695
  /**
@@ -1659,30 +1716,12 @@ export declare interface ObservationRecord {
1659
1716
  }
1660
1717
 
1661
1718
  /**
1662
- * The default onChange binding configuration.
1719
+ * Creates a one time binding
1720
+ * @param binding - The binding to refresh when signaled.
1721
+ * @returns A binding configuration.
1663
1722
  * @public
1664
1723
  */
1665
- export declare const onChange: BindingConfig<AddEventListenerOptions> & BindingConfigResolver<AddEventListenerOptions>;
1666
-
1667
- /**
1668
- * The default onTime binding configuration.
1669
- * @public
1670
- */
1671
- export declare const oneTime: BindingConfig<AddEventListenerOptions> & BindingConfigResolver<AddEventListenerOptions>;
1672
-
1673
- /**
1674
- * A binding behavior for one-time bindings.
1675
- * @public
1676
- */
1677
- export declare class OneTimeBinding extends UpdateBinding {
1678
- /**
1679
- * Bind this behavior to the source.
1680
- * @param source - The source to bind to.
1681
- * @param context - The execution context that the binding is operating within.
1682
- * @param targets - The targets that behaviors in a view can attach to.
1683
- */
1684
- bind(source: any, context: ExecutionContext, targets: ViewBehaviorTargets): void;
1685
- }
1724
+ export declare function oneTime<T = any>(binding: Expression<T>): Binding<T>;
1686
1725
 
1687
1726
  /**
1688
1727
  * Common APIs related to content parsing.
@@ -1809,23 +1848,21 @@ declare const reflectMode = "reflect";
1809
1848
 
1810
1849
  /**
1811
1850
  * A directive that enables list rendering.
1812
- * @param itemsBinding - The array to render.
1813
- * @param templateOrTemplateBinding - The template or a template binding used obtain a template
1851
+ * @param items - The array to render.
1852
+ * @param template - The template or a template binding used obtain a template
1814
1853
  * to render for each item in the array.
1815
1854
  * @param options - Options used to turn on special repeat features.
1816
1855
  * @public
1817
1856
  */
1818
- export declare function repeat<TSource = any, TArray extends ReadonlyArray<any> = ReadonlyArray<any>>(itemsBinding: Binding<TSource, TArray, ExecutionContext<TSource>>, templateOrTemplateBinding: ViewTemplate | Binding<TSource, ViewTemplate>, options?: RepeatOptions): CaptureType<TSource>;
1857
+ 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>;
1819
1858
 
1820
1859
  /**
1821
1860
  * A behavior that renders a template for each item in an array.
1822
1861
  * @public
1823
1862
  */
1824
1863
  export declare class RepeatBehavior<TSource = any> implements Behavior, Subscriber {
1864
+ private directive;
1825
1865
  private location;
1826
- private itemsBinding;
1827
- private templateBinding;
1828
- private options;
1829
1866
  private source;
1830
1867
  private views;
1831
1868
  private template;
@@ -1839,13 +1876,13 @@ export declare class RepeatBehavior<TSource = any> implements Behavior, Subscrib
1839
1876
  /**
1840
1877
  * Creates an instance of RepeatBehavior.
1841
1878
  * @param location - The location in the DOM to render the repeat.
1842
- * @param itemsBinding - The array to render.
1879
+ * @param dataBinding - The array to render.
1843
1880
  * @param isItemsBindingVolatile - Indicates whether the items binding has volatile dependencies.
1844
1881
  * @param templateBinding - The template to render for each item.
1845
1882
  * @param isTemplateBindingVolatile - Indicates whether the template binding has volatile dependencies.
1846
1883
  * @param options - Options used to turn on special repeat features.
1847
1884
  */
1848
- constructor(location: Node, itemsBinding: Binding<TSource, any[]>, isItemsBindingVolatile: boolean, templateBinding: Binding<TSource, SyntheticViewTemplate>, isTemplateBindingVolatile: boolean, options: RepeatOptions);
1885
+ constructor(directive: RepeatDirective, location: Node);
1849
1886
  /**
1850
1887
  * Bind this behavior to the source.
1851
1888
  * @param source - The source to bind to.
@@ -1862,7 +1899,7 @@ export declare class RepeatBehavior<TSource = any> implements Behavior, Subscrib
1862
1899
  * @param source - The source of the change.
1863
1900
  * @param args - The details about what was changed.
1864
1901
  */
1865
- handleChange(source: any, args: Splice[]): void;
1902
+ handleChange(source: any, args: Splice[] | ExpressionObserver): void;
1866
1903
  private observeItems;
1867
1904
  private updateViews;
1868
1905
  private refreshAllViews;
@@ -1874,11 +1911,9 @@ export declare class RepeatBehavior<TSource = any> implements Behavior, Subscrib
1874
1911
  * @public
1875
1912
  */
1876
1913
  export declare class RepeatDirective<TSource = any> implements HTMLDirective, ViewBehaviorFactory {
1877
- readonly itemsBinding: Binding;
1914
+ readonly dataBinding: Binding<TSource>;
1878
1915
  readonly templateBinding: Binding<TSource, SyntheticViewTemplate>;
1879
1916
  readonly options: RepeatOptions;
1880
- private isItemsBindingVolatile;
1881
- private isTemplateBindingVolatile;
1882
1917
  /**
1883
1918
  * The unique id of the factory.
1884
1919
  */
@@ -1894,11 +1929,11 @@ export declare class RepeatDirective<TSource = any> implements HTMLDirective, Vi
1894
1929
  createHTML(add: AddViewBehaviorFactory): string;
1895
1930
  /**
1896
1931
  * Creates an instance of RepeatDirective.
1897
- * @param itemsBinding - The binding that provides the array to render.
1932
+ * @param dataBinding - The binding that provides the array to render.
1898
1933
  * @param templateBinding - The template binding used to obtain a template to render for each item in the array.
1899
1934
  * @param options - Options used to turn on special repeat features.
1900
1935
  */
1901
- constructor(itemsBinding: Binding, templateBinding: Binding<TSource, SyntheticViewTemplate>, options: RepeatOptions);
1936
+ constructor(dataBinding: Binding<TSource>, templateBinding: Binding<TSource, SyntheticViewTemplate>, options: RepeatOptions);
1902
1937
  /**
1903
1938
  * Creates a behavior for the provided target node.
1904
1939
  * @param target - The node instance to create the behavior for.
@@ -2316,7 +2351,7 @@ export declare interface SyntheticViewTemplate<TSource = any, TParent = any> {
2316
2351
  * Represents the types of values that can be interpolated into a template.
2317
2352
  * @public
2318
2353
  */
2319
- export declare type TemplateValue<TSource, TParent = any> = Binding<TSource, any, TParent> | HTMLDirective | CaptureType<TSource>;
2354
+ export declare type TemplateValue<TSource, TParent = any> = Expression<TSource, any, TParent> | Binding<TSource, any, TParent> | HTMLDirective | CaptureType<TSource>;
2320
2355
 
2321
2356
  /**
2322
2357
  * Enables working with trusted types.
@@ -2347,40 +2382,6 @@ export declare type TrustedTypesPolicy = {
2347
2382
 
2348
2383
  /* Excluded from this release type: TypeRegistry */
2349
2384
 
2350
- /**
2351
- * A base binding behavior for DOM updates.
2352
- * @public
2353
- */
2354
- export declare class UpdateBinding implements ViewBehavior {
2355
- readonly directive: HTMLBindingDirective;
2356
- protected updateTarget: UpdateTarget;
2357
- /**
2358
- * Creates an instance of UpdateBinding.
2359
- * @param directive - The directive that has the configuration for this behavior.
2360
- * @param updateTarget - The function used to update the target with the latest value.
2361
- */
2362
- constructor(directive: HTMLBindingDirective, updateTarget: UpdateTarget);
2363
- /**
2364
- * Bind this behavior to the source.
2365
- * @param source - The source to bind to.
2366
- * @param context - The execution context that the binding is operating within.
2367
- * @param targets - The targets that behaviors in a view can attach to.
2368
- */
2369
- bind(source: any, context: ExecutionContext, targets: ViewBehaviorTargets): void;
2370
- /**
2371
- * Unbinds this behavior from the source.
2372
- * @param source - The source to unbind from.
2373
- * @param context - The execution context that the binding is operating within.
2374
- * @param targets - The targets that behaviors in a view can attach to.
2375
- */
2376
- unbind(source: any, context: ExecutionContext, targets: ViewBehaviorTargets): void;
2377
- /**
2378
- * Creates a behavior.
2379
- * @param targets - The targets available for behaviors to be attached to.
2380
- */
2381
- createBehavior(targets: ViewBehaviorTargets): ViewBehavior;
2382
- }
2383
-
2384
2385
  /**
2385
2386
  * A work queue used to synchronize writes to the DOM.
2386
2387
  * @public
@@ -2585,11 +2586,11 @@ export declare function volatile(target: {}, name: string | Accessor, descriptor
2585
2586
 
2586
2587
  /**
2587
2588
  * A directive that enables basic conditional rendering in a template.
2588
- * @param binding - The condition to test for rendering.
2589
+ * @param condition - The condition to test for rendering.
2589
2590
  * @param templateOrTemplateBinding - The template or a binding that gets
2590
2591
  * the template to render when the condition is true.
2591
2592
  * @public
2592
2593
  */
2593
- export declare function when<TSource = any, TReturn = any>(binding: Binding<TSource, TReturn>, templateOrTemplateBinding: SyntheticViewTemplate | Binding<TSource, SyntheticViewTemplate>): CaptureType<TSource>;
2594
+ export declare function when<TSource = any, TReturn = any>(condition: Expression<TSource, TReturn> | boolean, templateOrTemplateBinding: SyntheticViewTemplate | Expression<TSource, SyntheticViewTemplate>): CaptureType<TSource>;
2594
2595
 
2595
2596
  export { }