@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
@@ -127,8 +127,10 @@ export declare const Aspect: Readonly<{
127
127
  *
128
128
  * @param directive - The directive to assign the aspect to.
129
129
  * @param value - The value to base the aspect determination on.
130
+ * @remarks
131
+ * If a falsy value is provided, then the content aspect will be assigned.
130
132
  */
131
- readonly assign: (directive: Aspected, value: string) => void;
133
+ readonly assign: (directive: Aspected, value?: string) => void;
132
134
  }>;
133
135
 
134
136
  /**
@@ -157,7 +159,7 @@ export declare interface Aspected {
157
159
  /**
158
160
  * A binding if one is associated with the aspect.
159
161
  */
160
- binding?: Binding;
162
+ dataBinding?: Binding;
161
163
  }
162
164
 
163
165
  /**
@@ -284,102 +286,81 @@ export declare interface Behavior<TSource = any, TParent = any> {
284
286
  }
285
287
 
286
288
  /**
287
- * Creates a binding directive with the specified configuration.
288
- * @param binding - The binding expression.
289
- * @param config - The binding configuration.
290
- * @returns A binding directive.
289
+ * Creates an standard binding.
290
+ * @param binding - The binding to refresh when changed.
291
+ * @param isVolatile - Indicates whether the binding is volatile or not.
292
+ * @returns A binding configuration.
291
293
  * @public
292
294
  */
293
- export declare function bind<T = any>(binding: Binding<T>, config?: BindingConfig | DefaultBindingOptions): CaptureType<T>;
295
+ export declare function bind<T = any>(binding: Expression<T>, isVolatile?: boolean): Binding<T>;
294
296
 
295
297
  /**
296
- * The signature of an arrow function capable of being evaluated
297
- * as part of a template binding update.
298
- * @public
299
- */
300
- export declare type Binding<TSource = any, TReturn = any, TParent = any> = (source: TSource, context: ExecutionContext<TParent>) => TReturn;
301
-
302
- /**
303
- * Describes the configuration for a binding expression.
298
+ * Captures a binding expression along with related information and capabilities.
299
+ *
304
300
  * @public
305
301
  */
306
- export declare interface BindingConfig<T = any> {
302
+ export declare abstract class Binding<TSource = any, TReturn = any, TParent = any> {
303
+ /**
304
+ * Options associated with the binding.
305
+ */
306
+ options?: any;
307
307
  /**
308
- * The binding mode to configure the binding with.
308
+ * Whether or not the binding is volatile.
309
309
  */
310
- mode: BindingMode;
310
+ isVolatile?: boolean;
311
311
  /**
312
- * Options to be supplied to the binding behaviors.
312
+ * Evaluates the binding expression.
313
313
  */
314
- options: T;
314
+ evaluate: Expression<TSource, TReturn, TParent>;
315
+ /**
316
+ * Creates an observer capable of notifying a subscriber when the output of a binding changes.
317
+ * @param directive - The HTML Directive to create the observer for.
318
+ * @param subscriber - The subscriber to changes in the binding.
319
+ */
320
+ abstract createObserver(directive: HTMLDirective, subscriber: Subscriber): ExpressionObserver<TSource, TReturn, TParent>;
315
321
  }
316
322
 
317
323
  /**
318
- * Describes the configuration for a binding expression.
324
+ * A binding behavior for bindings that change.
319
325
  * @public
320
326
  */
321
- export declare const BindingConfig: Readonly<{
327
+ export declare class BindingBehavior implements ViewBehavior {
328
+ readonly directive: HTMLBindingDirective;
329
+ protected updateTarget: UpdateTarget;
330
+ private observerProperty;
322
331
  /**
323
- * Creates a binding configuration based on the provided mode and options.
324
- * @param mode - The mode to use for the configuration.
325
- * @param defaultOptions - The default options to use for the configuration.
326
- * @returns A new binding configuration.
332
+ * Creates an instance of ChangeBinding.
333
+ * @param directive - The directive that has the configuration for this behavior.
334
+ * @param updateTarget - The function used to update the target with the latest value.
327
335
  */
328
- define<T>(mode: BindingMode, defaultOptions: T): BindingConfig<T> & BindingConfigResolver<T>;
329
- }>;
330
-
331
- /**
332
- * Creates a new binding configuration based on the supplied options.
333
- * @public
334
- */
335
- export declare type BindingConfigResolver<T> = (options: T) => BindingConfig<T>;
336
-
337
- /**
338
- * Describes how aspects of an HTML element will be affected by bindings.
339
- * @public
340
- */
341
- export declare type BindingMode = Record<Aspect, (directive: HTMLBindingDirective) => Pick<ViewBehaviorFactory, "createBehavior">>;
342
-
343
- /**
344
- * Describes how aspects of an HTML element will be affected by bindings.
345
- * @public
346
- */
347
- export declare const BindingMode: Readonly<{
336
+ constructor(directive: HTMLBindingDirective, updateTarget: UpdateTarget);
348
337
  /**
349
- * Creates a binding mode based on the supplied behavior types.
350
- * @param UpdateType - The base behavior type used to update aspects.
351
- * @param EventType - The base behavior type used to respond to events.
352
- * @returns A new binding mode.
338
+ * Bind this behavior to the source.
339
+ * @param source - The source to bind to.
340
+ * @param context - The execution context that the binding is operating within.
341
+ * @param targets - The targets that behaviors in a view can attach to.
353
342
  */
354
- define(UpdateType: typeof UpdateBinding, EventType?: typeof EventBinding): BindingMode;
355
- }>;
356
-
357
- /**
358
- * Enables evaluation of and subscription to a binding.
359
- * @public
360
- */
361
- export declare interface BindingObserver<TSource = any, TReturn = any, TParent = any> extends Notifier, Disposable {
343
+ bind(source: any, context: ExecutionContext, targets: ViewBehaviorTargets): void;
362
344
  /**
363
- * Begins observing the binding for the source and returns the current value.
364
- * @param source - The source that the binding is based on.
365
- * @param context - The execution context to execute the binding within.
366
- * @returns The value of the binding.
345
+ * Unbinds this behavior from the source.
346
+ * @param source - The source to unbind from.
347
+ * @param context - The execution context that the binding is operating within.
348
+ * @param targets - The targets that behaviors in a view can attach to.
367
349
  */
368
- observe(source: TSource, context?: ExecutionContext<TParent>): TReturn;
350
+ unbind(source: any, context: ExecutionContext, targets: ViewBehaviorTargets): void;
351
+ /** @internal */
352
+ handleChange(binding: Expression, observer: ExpressionObserver): void;
369
353
  /**
370
- * Gets {@link ObservationRecord|ObservationRecords} that the {@link BindingObserver}
371
- * is observing.
354
+ * Returns the binding observer used to update the node.
355
+ * @param target - The target node.
356
+ * @returns A BindingObserver.
372
357
  */
373
- records(): IterableIterator<ObservationRecord>;
358
+ protected getObserver(target: Node): ExpressionObserver;
374
359
  /**
375
- * Sets the update mode used by the observer.
376
- * @param isAsync - Indicates whether updates should be asynchronous.
377
- * @remarks
378
- * By default, the update mode is asynchronous, since that provides the best
379
- * performance for template rendering scenarios. Passing false to setMode will
380
- * instead cause the observer to notify subscribers immediately when changes occur.
360
+ * Creates a behavior.
361
+ * @param targets - The targets available for behaviors to be attached to.
381
362
  */
382
- setMode(isAsync: boolean): void;
363
+ createBehavior(targets: ViewBehaviorTargets): ViewBehavior;
383
364
  }
384
365
 
385
366
  /**
@@ -408,43 +389,6 @@ export declare type Callable = typeof Function.prototype.call | {
408
389
  export declare interface CaptureType<TSource> {
409
390
  }
410
391
 
411
- /**
412
- * A binding behavior for bindings that change.
413
- * @public
414
- */
415
- export declare class ChangeBinding extends UpdateBinding {
416
- private isBindingVolatile;
417
- private observerProperty;
418
- /**
419
- * Creates an instance of ChangeBinding.
420
- * @param directive - The directive that has the configuration for this behavior.
421
- * @param updateTarget - The function used to update the target with the latest value.
422
- */
423
- constructor(directive: HTMLBindingDirective, updateTarget: UpdateTarget);
424
- /**
425
- * Returns the binding observer used to update the node.
426
- * @param target - The target node.
427
- * @returns A BindingObserver.
428
- */
429
- protected getObserver(target: Node): BindingObserver;
430
- /**
431
- * Bind this behavior to the source.
432
- * @param source - The source to bind to.
433
- * @param context - The execution context that the binding is operating within.
434
- * @param targets - The targets that behaviors in a view can attach to.
435
- */
436
- bind(source: any, context: ExecutionContext, targets: ViewBehaviorTargets): void;
437
- /**
438
- * Unbinds this behavior from the source.
439
- * @param source - The source to unbind from.
440
- * @param context - The execution context that the binding is operating within.
441
- * @param targets - The targets that behaviors in a view can attach to.
442
- */
443
- unbind(source: any, context: ExecutionContext, targets: ViewBehaviorTargets): void;
444
- /** @internal */
445
- handleChange(binding: Binding, observer: BindingObserver): void;
446
- }
447
-
448
392
  /**
449
393
  * The options used to configure child list observation.
450
394
  * @public
@@ -556,6 +500,10 @@ export declare const Compiler: {
556
500
  */
557
501
  export declare type ComposableStyles = string | ElementStyles | CSSStyleSheet;
558
502
 
503
+ declare function compose<TType extends Constructable<HTMLElement> = Constructable<HTMLElement>>(this: TType, nameOrDef: string | PartialFASTElementDefinition): FASTElementDefinition<TType>;
504
+
505
+ declare function compose<TType extends Constructable<HTMLElement> = Constructable<HTMLElement>>(type: TType, nameOrDef?: string | PartialFASTElementDefinition): FASTElementDefinition<TType>;
506
+
559
507
  /**
560
508
  * Allows for the creation of Constructable mixin classes.
561
509
  *
@@ -577,6 +525,58 @@ export declare type ConstructibleStyleStrategy = {
577
525
  new (styles: (string | CSSStyleSheet)[]): StyleStrategy;
578
526
  };
579
527
 
528
+ /**
529
+ * A special binding behavior that can bind node content.
530
+ * @public
531
+ */
532
+ export declare class ContentBehavior extends BindingBehavior {
533
+ /**
534
+ * Unbinds this behavior from the source.
535
+ * @param source - The source to unbind from.
536
+ * @param context - The execution context that the binding is operating within.
537
+ * @param targets - The targets that behaviors in a view can attach to.
538
+ */
539
+ unbind(source: any, context: ExecutionContext, targets: ViewBehaviorTargets): void;
540
+ }
541
+
542
+ /**
543
+ * A simple template that can create ContentView instances.
544
+ * @public
545
+ */
546
+ export declare interface ContentTemplate {
547
+ /**
548
+ * Creates a simple content view instance.
549
+ */
550
+ create(): ContentView;
551
+ }
552
+
553
+ /**
554
+ * A simple View that can be interpolated into HTML content.
555
+ * @public
556
+ */
557
+ export declare interface ContentView {
558
+ /**
559
+ * Binds a view's behaviors to its binding source.
560
+ * @param source - The binding source for the view's binding behaviors.
561
+ * @param context - The execution context to run the view within.
562
+ */
563
+ bind(source: any, context: ExecutionContext): void;
564
+ /**
565
+ * Unbinds a view's behaviors from its binding source and context.
566
+ */
567
+ unbind(): void;
568
+ /**
569
+ * Inserts the view's DOM nodes before the referenced node.
570
+ * @param node - The node to insert the view's DOM before.
571
+ */
572
+ insertBefore(node: Node): void;
573
+ /**
574
+ * Removes the view's DOM nodes.
575
+ * The nodes are not disposed and the view can later be re-inserted.
576
+ */
577
+ remove(): void;
578
+ }
579
+
580
580
  /**
581
581
  * Controls the lifecycle and rendering of a `FASTElement`.
582
582
  * @public
@@ -807,11 +807,9 @@ export declare function customElement(nameOrDef: string | PartialFASTElementDefi
807
807
  */
808
808
  export declare type DecoratorAttributeConfiguration = Omit<AttributeConfiguration, "property">;
809
809
 
810
- /**
811
- * The default binding options.
812
- * @public
813
- */
814
- export declare type DefaultBindingOptions = AddEventListenerOptions;
810
+ declare function define<TType extends Constructable<HTMLElement> = Constructable<HTMLElement>>(this: TType, nameOrDef: string | PartialFASTElementDefinition): TType;
811
+
812
+ declare function define<TType extends Constructable<HTMLElement> = Constructable<HTMLElement>>(type: TType, nameOrDef?: string | PartialFASTElementDefinition): TType;
815
813
 
816
814
  /**
817
815
  * Provides a mechanism for releasing resources.
@@ -921,6 +919,12 @@ export declare class ElementStyles {
921
919
  * @param Strategy - The strategy type to construct.
922
920
  */
923
921
  static setDefaultStrategy(Strategy: ConstructibleStyleStrategy): void;
922
+ /**
923
+ * Normalizes a set of composable style options.
924
+ * @param styles - The style options to normalize.
925
+ * @returns A singular ElementStyles instance or undefined.
926
+ */
927
+ static normalize(styles: ComposableStyles | ComposableStyles[] | undefined): ElementStyles | undefined;
924
928
  /**
925
929
  * Indicates whether the DOM supports the adoptedStyleSheets feature.
926
930
  */
@@ -972,7 +976,7 @@ export declare const emptyArray: readonly never[];
972
976
  * A binding behavior for handling events.
973
977
  * @public
974
978
  */
975
- export declare class EventBinding {
979
+ export declare class EventBehavior {
976
980
  readonly directive: HTMLBindingDirective;
977
981
  private contextProperty;
978
982
  private sourceProperty;
@@ -1101,6 +1105,48 @@ export declare class ExecutionContext<TParentSource = any> {
1101
1105
  static create(): ExecutionContext;
1102
1106
  }
1103
1107
 
1108
+ /**
1109
+ * The signature of an arrow function capable of being evaluated
1110
+ * against source data and within an execution context.
1111
+ * @public
1112
+ */
1113
+ export declare type Expression<TSource = any, TReturn = any, TParent = any> = (source: TSource, context: ExecutionContext<TParent>) => TReturn;
1114
+
1115
+ /**
1116
+ * Enables evaluation of and subscription to a binding.
1117
+ * @public
1118
+ */
1119
+ export declare interface ExpressionNotifier<TSource = any, TReturn = any, TParent = any> extends Notifier, ExpressionObserver<TSource, TReturn, TParent> {
1120
+ /**
1121
+ * Gets {@link ObservationRecord|ObservationRecords} that the {@link ExpressionNotifier}
1122
+ * is observing.
1123
+ */
1124
+ records(): IterableIterator<ObservationRecord>;
1125
+ /**
1126
+ * Sets the update mode used by the observer.
1127
+ * @param isAsync - Indicates whether updates should be asynchronous.
1128
+ * @remarks
1129
+ * By default, the update mode is asynchronous, since that provides the best
1130
+ * performance for template rendering scenarios. Passing false to setMode will
1131
+ * instead cause the observer to notify subscribers immediately when changes occur.
1132
+ */
1133
+ setMode(isAsync: boolean): void;
1134
+ }
1135
+
1136
+ /**
1137
+ * Observes a binding for changes.
1138
+ *
1139
+ * @public
1140
+ */
1141
+ export declare interface ExpressionObserver<TSource = any, TReturn = any, TParent = any> extends Disposable {
1142
+ /**
1143
+ * Begins observing the binding.
1144
+ * @param source - The source to pass to the binding.
1145
+ * @param context - The context to pass to the binding.
1146
+ */
1147
+ observe(source: TSource, context?: ExecutionContext<TParent>): TReturn;
1148
+ }
1149
+
1104
1150
  /**
1105
1151
  * The FAST global.
1106
1152
  * @internal
@@ -1157,29 +1203,11 @@ export declare interface FASTElement extends HTMLElement {
1157
1203
  * static helpers for working with FASTElements.
1158
1204
  * @public
1159
1205
  */
1160
- export declare const FASTElement: (new () => HTMLElement & FASTElement) & {
1161
- /**
1162
- * Creates a new FASTElement base class inherited from the
1163
- * provided base type.
1164
- * @param BaseType - The base element type to inherit from.
1165
- */
1166
- from<TBase extends {
1167
- new (): HTMLElement;
1168
- prototype: HTMLElement;
1169
- }>(BaseType: TBase): new () => InstanceType<TBase> & FASTElement;
1170
- /**
1171
- * Defines a platform custom element based on the provided type and definition.
1172
- * @param type - The custom element type to define.
1173
- * @param nameOrDef - The name of the element to define or a definition object
1174
- * that describes the element to define.
1175
- */
1176
- define<TType extends Constructable<HTMLElement>>(type: TType, nameOrDef?: string | PartialFASTElementDefinition): TType;
1177
- /**
1178
- * Defines metadata for a FASTElement which can be used to later define the element.
1179
- * IMPORTANT: This API will be renamed to "compose" in a future beta.
1180
- * @public
1181
- */
1182
- metadata<TType_1 extends Constructable<HTMLElement> = Constructable<HTMLElement>>(type: TType_1, nameOrDef?: string | PartialFASTElementDefinition): FASTElementDefinition<TType_1>;
1206
+ export declare const FASTElement: {
1207
+ new (): FASTElement;
1208
+ define: typeof define;
1209
+ compose: typeof compose;
1210
+ from: typeof from;
1183
1211
  };
1184
1212
 
1185
1213
  /**
@@ -1187,7 +1215,7 @@ export declare const FASTElement: (new () => HTMLElement & FASTElement) & {
1187
1215
  * @public
1188
1216
  */
1189
1217
  export declare class FASTElementDefinition<TType extends Constructable<HTMLElement> = Constructable<HTMLElement>> {
1190
- private observedAttributes;
1218
+ private platformDefined;
1191
1219
  /**
1192
1220
  * The type this element definition describes.
1193
1221
  */
@@ -1228,13 +1256,7 @@ export declare class FASTElementDefinition<TType extends Constructable<HTMLEleme
1228
1256
  * Options controlling how the custom element is defined with the platform.
1229
1257
  */
1230
1258
  readonly elementOptions?: ElementDefinitionOptions;
1231
- /**
1232
- * Creates an instance of FASTElementDefinition.
1233
- * @param type - The type this definition is being created for.
1234
- * @param nameOrConfig - The name of the element to define or a config object
1235
- * that describes the element to define.
1236
- */
1237
- constructor(type: TType, nameOrConfig?: PartialFASTElementDefinition | string);
1259
+ private constructor();
1238
1260
  /**
1239
1261
  * Defines a custom element based on this definition.
1240
1262
  * @param registry - The element registry to define the element in.
@@ -1242,6 +1264,13 @@ export declare class FASTElementDefinition<TType extends Constructable<HTMLEleme
1242
1264
  * This operation is idempotent per registry.
1243
1265
  */
1244
1266
  define(registry?: CustomElementRegistry): this;
1267
+ /**
1268
+ * Creates an instance of FASTElementDefinition.
1269
+ * @param type - The type this definition is being created for.
1270
+ * @param nameOrDef - The name of the element to define or a config object
1271
+ * that describes the element to define.
1272
+ */
1273
+ static compose<TType extends Constructable<HTMLElement> = Constructable<HTMLElement>>(type: TType, nameOrDef?: string | PartialFASTElementDefinition): FASTElementDefinition<TType>;
1245
1274
  /**
1246
1275
  * Gets the element definition associated with the specified type.
1247
1276
  * @param type - The custom element type to retrieve the definition for.
@@ -1273,22 +1302,27 @@ export declare interface FASTGlobal {
1273
1302
  /**
1274
1303
  * Sends a warning to the developer.
1275
1304
  * @param code - The warning code to send.
1276
- * @param args - Args relevant for the warning.
1305
+ * @param values - Values relevant for the warning message.
1277
1306
  */
1278
- warn(code: number, ...args: any[]): void;
1307
+ warn(code: number, values?: Record<string, any>): void;
1279
1308
  /**
1280
1309
  * Creates an error.
1281
1310
  * @param code - The error code to send.
1282
- * @param args - Args relevant for the error.
1311
+ * @param values - Values relevant for the error message.
1283
1312
  */
1284
- error(code: number, ...args: any[]): Error;
1313
+ error(code: number, values?: Record<string, any>): Error;
1285
1314
  /**
1286
1315
  * Adds debug messages for errors and warnings.
1287
1316
  * @param messages - The message dictionary to add.
1317
+ * @remarks
1318
+ * Message can include placeholders like $\{name\} which can be
1319
+ * replaced by values passed at runtime.
1288
1320
  */
1289
1321
  addMessages(messages: Record<number, string>): void;
1290
1322
  }
1291
1323
 
1324
+ declare function from<TBase extends typeof HTMLElement>(BaseType: TBase): new () => InstanceType<TBase> & FASTElement;
1325
+
1292
1326
  /**
1293
1327
  * Transforms a template literal string into a ViewTemplate.
1294
1328
  * @param strings - The string fragments that are interpolated with the values.
@@ -1305,9 +1339,7 @@ export declare function html<TSource = any, TParent = any>(strings: TemplateStri
1305
1339
  * @public
1306
1340
  */
1307
1341
  export declare class HTMLBindingDirective implements HTMLDirective, ViewBehaviorFactory, Aspected {
1308
- binding: Binding;
1309
- mode: BindingMode;
1310
- options: any;
1342
+ dataBinding: Binding;
1311
1343
  private factory;
1312
1344
  /**
1313
1345
  * The unique id of the factory.
@@ -1331,11 +1363,9 @@ export declare class HTMLBindingDirective implements HTMLDirective, ViewBehavior
1331
1363
  aspectType: Aspect;
1332
1364
  /**
1333
1365
  * Creates an instance of HTMLBindingDirective.
1334
- * @param binding - The binding to apply.
1335
- * @param mode - The binding mode to use when applying the binding.
1336
- * @param options - The options to configure the binding with.
1366
+ * @param dataBinding - The binding configuration to apply.
1337
1367
  */
1338
- constructor(binding: Binding, mode: BindingMode, options: any);
1368
+ constructor(dataBinding: Binding);
1339
1369
  /**
1340
1370
  * Creates HTML to be used within a template.
1341
1371
  * @param add - Can be used to add behavior factories to a template.
@@ -1500,6 +1530,15 @@ export declare interface LengthObserver extends Subscriber {
1500
1530
  */
1501
1531
  export declare function lengthOf<T>(array: readonly T[]): number;
1502
1532
 
1533
+ /**
1534
+ * Creates an event listener binding.
1535
+ * @param binding - The binding to invoke when the event is raised.
1536
+ * @param options - Event listener options.
1537
+ * @returns A binding configuration.
1538
+ * @public
1539
+ */
1540
+ export declare function listener<T = any>(binding: Expression<T>, options?: AddEventListenerOptions): Binding<T>;
1541
+
1503
1542
  /**
1504
1543
  * Common APIs related to markup generation.
1505
1544
  * @public
@@ -1617,6 +1656,14 @@ export declare abstract class NodeObservationDirective<T extends NodeBehaviorOpt
1617
1656
  protected abstract getNodes(target: any): Node[];
1618
1657
  }
1619
1658
 
1659
+ /**
1660
+ * Normalizes the input value into a binding.
1661
+ * @param value - The value to create the default binding for.
1662
+ * @returns A binding configuration for the provided value.
1663
+ * @public
1664
+ */
1665
+ export declare function normalizeBinding<TSource = any, TReturn = any, TParent = any>(value: Expression<TSource, TReturn, TParent> | Binding<TSource, TReturn, TParent> | {}): Binding<TSource, TReturn, TParent>;
1666
+
1620
1667
  /**
1621
1668
  * Provides change notifications for an observed subject.
1622
1669
  * @public
@@ -1707,19 +1754,19 @@ export declare const Observable: Readonly<{
1707
1754
  */
1708
1755
  getAccessors: (target: {}) => Accessor[];
1709
1756
  /**
1710
- * Creates a {@link BindingObserver} that can watch the
1711
- * provided {@link Binding} for changes.
1757
+ * Creates a {@link ExpressionNotifier} that can watch the
1758
+ * provided {@link Expression} for changes.
1712
1759
  * @param binding - The binding to observe.
1713
1760
  * @param initialSubscriber - An initial subscriber to changes in the binding value.
1714
1761
  * @param isVolatileBinding - Indicates whether the binding's dependency list must be re-evaluated on every value evaluation.
1715
1762
  */
1716
- binding<TSource = any, TReturn = any>(binding: Binding<TSource, TReturn, any>, initialSubscriber?: Subscriber, isVolatileBinding?: boolean): BindingObserver<TSource, TReturn, any>;
1763
+ binding<TSource = any, TReturn = any>(binding: Expression<TSource, TReturn, any>, initialSubscriber?: Subscriber, isVolatileBinding?: boolean): ExpressionNotifier<TSource, TReturn, any>;
1717
1764
  /**
1718
1765
  * Determines whether a binding expression is volatile and needs to have its dependency list re-evaluated
1719
1766
  * on every evaluation of the value.
1720
1767
  * @param binding - The binding to inspect.
1721
1768
  */
1722
- isVolatileBinding<TSource_1 = any, TReturn_1 = any>(binding: Binding<TSource_1, TReturn_1, any>): boolean;
1769
+ isVolatileBinding<TSource_1 = any, TReturn_1 = any>(binding: Expression<TSource_1, TReturn_1, any>): boolean;
1723
1770
  }>;
1724
1771
 
1725
1772
  /**
@@ -1746,30 +1793,12 @@ export declare interface ObservationRecord {
1746
1793
  }
1747
1794
 
1748
1795
  /**
1749
- * The default onChange binding configuration.
1750
- * @public
1751
- */
1752
- export declare const onChange: BindingConfig<AddEventListenerOptions> & BindingConfigResolver<AddEventListenerOptions>;
1753
-
1754
- /**
1755
- * The default onTime binding configuration.
1756
- * @public
1757
- */
1758
- export declare const oneTime: BindingConfig<AddEventListenerOptions> & BindingConfigResolver<AddEventListenerOptions>;
1759
-
1760
- /**
1761
- * A binding behavior for one-time bindings.
1796
+ * Creates a one time binding
1797
+ * @param binding - The binding to refresh when signaled.
1798
+ * @returns A binding configuration.
1762
1799
  * @public
1763
1800
  */
1764
- export declare class OneTimeBinding extends UpdateBinding {
1765
- /**
1766
- * Bind this behavior to the source.
1767
- * @param source - The source to bind to.
1768
- * @param context - The execution context that the binding is operating within.
1769
- * @param targets - The targets that behaviors in a view can attach to.
1770
- */
1771
- bind(source: any, context: ExecutionContext, targets: ViewBehaviorTargets): void;
1772
- }
1801
+ export declare function oneTime<T = any>(binding: Expression<T>): Binding<T>;
1773
1802
 
1774
1803
  /**
1775
1804
  * Common APIs related to content parsing.
@@ -1896,23 +1925,21 @@ declare const reflectMode = "reflect";
1896
1925
 
1897
1926
  /**
1898
1927
  * A directive that enables list rendering.
1899
- * @param itemsBinding - The array to render.
1900
- * @param templateOrTemplateBinding - The template or a template binding used obtain a template
1928
+ * @param items - The array to render.
1929
+ * @param template - The template or a template binding used obtain a template
1901
1930
  * to render for each item in the array.
1902
1931
  * @param options - Options used to turn on special repeat features.
1903
1932
  * @public
1904
1933
  */
1905
- 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>;
1934
+ 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>;
1906
1935
 
1907
1936
  /**
1908
1937
  * A behavior that renders a template for each item in an array.
1909
1938
  * @public
1910
1939
  */
1911
1940
  export declare class RepeatBehavior<TSource = any> implements Behavior, Subscriber {
1941
+ private directive;
1912
1942
  private location;
1913
- private itemsBinding;
1914
- private templateBinding;
1915
- private options;
1916
1943
  private source;
1917
1944
  private views;
1918
1945
  private template;
@@ -1926,13 +1953,13 @@ export declare class RepeatBehavior<TSource = any> implements Behavior, Subscrib
1926
1953
  /**
1927
1954
  * Creates an instance of RepeatBehavior.
1928
1955
  * @param location - The location in the DOM to render the repeat.
1929
- * @param itemsBinding - The array to render.
1956
+ * @param dataBinding - The array to render.
1930
1957
  * @param isItemsBindingVolatile - Indicates whether the items binding has volatile dependencies.
1931
1958
  * @param templateBinding - The template to render for each item.
1932
1959
  * @param isTemplateBindingVolatile - Indicates whether the template binding has volatile dependencies.
1933
1960
  * @param options - Options used to turn on special repeat features.
1934
1961
  */
1935
- constructor(location: Node, itemsBinding: Binding<TSource, any[]>, isItemsBindingVolatile: boolean, templateBinding: Binding<TSource, SyntheticViewTemplate>, isTemplateBindingVolatile: boolean, options: RepeatOptions);
1962
+ constructor(directive: RepeatDirective, location: Node);
1936
1963
  /**
1937
1964
  * Bind this behavior to the source.
1938
1965
  * @param source - The source to bind to.
@@ -1949,7 +1976,7 @@ export declare class RepeatBehavior<TSource = any> implements Behavior, Subscrib
1949
1976
  * @param source - The source of the change.
1950
1977
  * @param args - The details about what was changed.
1951
1978
  */
1952
- handleChange(source: any, args: Splice[]): void;
1979
+ handleChange(source: any, args: Splice[] | ExpressionObserver): void;
1953
1980
  private observeItems;
1954
1981
  private updateViews;
1955
1982
  private refreshAllViews;
@@ -1961,11 +1988,9 @@ export declare class RepeatBehavior<TSource = any> implements Behavior, Subscrib
1961
1988
  * @public
1962
1989
  */
1963
1990
  export declare class RepeatDirective<TSource = any> implements HTMLDirective, ViewBehaviorFactory {
1964
- readonly itemsBinding: Binding;
1991
+ readonly dataBinding: Binding<TSource>;
1965
1992
  readonly templateBinding: Binding<TSource, SyntheticViewTemplate>;
1966
1993
  readonly options: RepeatOptions;
1967
- private isItemsBindingVolatile;
1968
- private isTemplateBindingVolatile;
1969
1994
  /**
1970
1995
  * The unique id of the factory.
1971
1996
  */
@@ -1981,11 +2006,11 @@ export declare class RepeatDirective<TSource = any> implements HTMLDirective, Vi
1981
2006
  createHTML(add: AddViewBehaviorFactory): string;
1982
2007
  /**
1983
2008
  * Creates an instance of RepeatDirective.
1984
- * @param itemsBinding - The binding that provides the array to render.
2009
+ * @param dataBinding - The binding that provides the array to render.
1985
2010
  * @param templateBinding - The template binding used to obtain a template to render for each item in the array.
1986
2011
  * @param options - Options used to turn on special repeat features.
1987
2012
  */
1988
- constructor(itemsBinding: Binding, templateBinding: Binding<TSource, SyntheticViewTemplate>, options: RepeatOptions);
2013
+ constructor(dataBinding: Binding<TSource>, templateBinding: Binding<TSource, SyntheticViewTemplate>, options: RepeatOptions);
1989
2014
  /**
1990
2015
  * Creates a behavior for the provided target node.
1991
2016
  * @param target - The node instance to create the behavior for.
@@ -2404,7 +2429,7 @@ export declare interface SyntheticViewTemplate<TSource = any, TParent = any> {
2404
2429
  * Represents the types of values that can be interpolated into a template.
2405
2430
  * @public
2406
2431
  */
2407
- export declare type TemplateValue<TSource, TParent = any> = Binding<TSource, any, TParent> | HTMLDirective | CaptureType<TSource>;
2432
+ export declare type TemplateValue<TSource, TParent = any> = Expression<TSource, any, TParent> | Binding<TSource, any, TParent> | HTMLDirective | CaptureType<TSource>;
2408
2433
 
2409
2434
  /**
2410
2435
  * Enables working with trusted types.
@@ -2449,40 +2474,6 @@ export declare interface TypeRegistry<TDefinition extends TypeDefinition> {
2449
2474
  getForInstance(object: any): TDefinition | undefined;
2450
2475
  }
2451
2476
 
2452
- /**
2453
- * A base binding behavior for DOM updates.
2454
- * @public
2455
- */
2456
- export declare class UpdateBinding implements ViewBehavior {
2457
- readonly directive: HTMLBindingDirective;
2458
- protected updateTarget: UpdateTarget;
2459
- /**
2460
- * Creates an instance of UpdateBinding.
2461
- * @param directive - The directive that has the configuration for this behavior.
2462
- * @param updateTarget - The function used to update the target with the latest value.
2463
- */
2464
- constructor(directive: HTMLBindingDirective, updateTarget: UpdateTarget);
2465
- /**
2466
- * Bind this behavior to the source.
2467
- * @param source - The source to bind to.
2468
- * @param context - The execution context that the binding is operating within.
2469
- * @param targets - The targets that behaviors in a view can attach to.
2470
- */
2471
- bind(source: any, context: ExecutionContext, targets: ViewBehaviorTargets): void;
2472
- /**
2473
- * Unbinds this behavior from the source.
2474
- * @param source - The source to unbind from.
2475
- * @param context - The execution context that the binding is operating within.
2476
- * @param targets - The targets that behaviors in a view can attach to.
2477
- */
2478
- unbind(source: any, context: ExecutionContext, targets: ViewBehaviorTargets): void;
2479
- /**
2480
- * Creates a behavior.
2481
- * @param targets - The targets available for behaviors to be attached to.
2482
- */
2483
- createBehavior(targets: ViewBehaviorTargets): ViewBehavior;
2484
- }
2485
-
2486
2477
  /**
2487
2478
  * A work queue used to synchronize writes to the DOM.
2488
2479
  * @public
@@ -2687,11 +2678,11 @@ export declare function volatile(target: {}, name: string | Accessor, descriptor
2687
2678
 
2688
2679
  /**
2689
2680
  * A directive that enables basic conditional rendering in a template.
2690
- * @param binding - The condition to test for rendering.
2681
+ * @param condition - The condition to test for rendering.
2691
2682
  * @param templateOrTemplateBinding - The template or a binding that gets
2692
2683
  * the template to render when the condition is true.
2693
2684
  * @public
2694
2685
  */
2695
- export declare function when<TSource = any, TReturn = any>(binding: Binding<TSource, TReturn>, templateOrTemplateBinding: SyntheticViewTemplate | Binding<TSource, SyntheticViewTemplate>): CaptureType<TSource>;
2686
+ export declare function when<TSource = any, TReturn = any>(condition: Expression<TSource, TReturn> | boolean, templateOrTemplateBinding: SyntheticViewTemplate | Expression<TSource, SyntheticViewTemplate>): CaptureType<TSource>;
2696
2687
 
2697
2688
  export { }