@microsoft/fast-element 2.0.0-beta.1 → 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 (58) hide show
  1. package/CHANGELOG.json +147 -0
  2. package/CHANGELOG.md +42 -1
  3. package/dist/dts/components/fast-definitions.d.ts +11 -8
  4. package/dist/dts/components/fast-element.d.ts +13 -3
  5. package/dist/dts/context.d.ts +157 -0
  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 +39 -7
  9. package/dist/dts/metadata.d.ts +25 -0
  10. package/dist/dts/observation/arrays.d.ts +1 -1
  11. package/dist/dts/observation/behavior.d.ts +4 -4
  12. package/dist/dts/observation/observable.d.ts +59 -72
  13. package/dist/dts/styles/element-styles.d.ts +6 -0
  14. package/dist/dts/templating/binding-signal.d.ts +21 -0
  15. package/dist/dts/templating/binding-two-way.d.ts +31 -0
  16. package/dist/dts/templating/binding.d.ts +74 -201
  17. package/dist/dts/templating/compiler.d.ts +1 -2
  18. package/dist/dts/templating/html-directive.d.ts +31 -3
  19. package/dist/dts/templating/render.d.ts +277 -0
  20. package/dist/dts/templating/repeat.d.ts +13 -63
  21. package/dist/dts/templating/template.d.ts +11 -60
  22. package/dist/dts/templating/view.d.ts +9 -9
  23. package/dist/dts/templating/when.d.ts +3 -3
  24. package/dist/dts/testing/exports.d.ts +2 -0
  25. package/dist/dts/testing/fixture.d.ts +90 -0
  26. package/dist/dts/testing/timeout.d.ts +7 -0
  27. package/dist/{tsdoc-metadata.json → dts/tsdoc-metadata.json} +0 -0
  28. package/dist/esm/components/fast-definitions.js +27 -27
  29. package/dist/esm/components/fast-element.js +20 -4
  30. package/dist/esm/context.js +163 -0
  31. package/dist/esm/debug.js +35 -4
  32. package/dist/esm/di/di.js +1349 -0
  33. package/dist/esm/metadata.js +60 -0
  34. package/dist/esm/observation/arrays.js +1 -1
  35. package/dist/esm/observation/observable.js +73 -21
  36. package/dist/esm/platform.js +1 -1
  37. package/dist/esm/styles/element-styles.js +14 -0
  38. package/dist/esm/templating/binding-signal.js +79 -0
  39. package/dist/esm/templating/binding-two-way.js +98 -0
  40. package/dist/esm/templating/binding.js +137 -313
  41. package/dist/esm/templating/compiler.js +30 -7
  42. package/dist/esm/templating/html-directive.js +16 -2
  43. package/dist/esm/templating/render.js +392 -0
  44. package/dist/esm/templating/repeat.js +60 -38
  45. package/dist/esm/templating/template.js +9 -26
  46. package/dist/esm/templating/when.js +5 -4
  47. package/dist/esm/testing/exports.js +2 -0
  48. package/dist/esm/testing/fixture.js +88 -0
  49. package/dist/esm/testing/timeout.js +24 -0
  50. package/dist/fast-element.api.json +8509 -10358
  51. package/dist/fast-element.d.ts +315 -522
  52. package/dist/fast-element.debug.js +417 -438
  53. package/dist/fast-element.debug.min.js +1 -1
  54. package/dist/fast-element.js +382 -434
  55. package/dist/fast-element.min.js +1 -1
  56. package/dist/fast-element.untrimmed.d.ts +324 -529
  57. package/docs/api-report.md +124 -232
  58. package/package.json +32 -4
@@ -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
  /**
@@ -269,151 +271,62 @@ export declare type AttributeMode = typeof reflectMode | typeof booleanMode | "f
269
271
  * element's bind/unbind operations.
270
272
  * @public
271
273
  */
272
- export declare interface Behavior<TSource = any, TParent = any, TContext extends ExecutionContext<TParent> = RootContext> {
274
+ export declare interface Behavior<TSource = any, TParent = any> {
273
275
  /**
274
276
  * Bind this behavior to the source.
275
277
  * @param source - The source to bind to.
276
278
  * @param context - The execution context that the binding is operating within.
277
279
  */
278
- bind(source: TSource, context: TContext): void;
280
+ bind(source: TSource, context: ExecutionContext<TParent>): void;
279
281
  /**
280
282
  * Unbinds this behavior from the source.
281
283
  * @param source - The source to unbind from.
282
284
  */
283
- unbind(source: TSource, context: TContext): void;
285
+ unbind(source: TSource, context: ExecutionContext<TParent>): void;
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.
291
- * @public
292
- */
293
- export declare function bind<T = any>(binding: Binding<T>, config?: BindingConfig | DefaultBindingOptions): CaptureType<T>;
294
-
295
- /**
296
- * The signature of an arrow function capable of being evaluated
297
- * as part of a template binding update.
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.
298
293
  * @public
299
294
  */
300
- export declare type Binding<TSource = any, TReturn = any, TContext extends ExecutionContext = ExecutionContext> = (source: TSource, context: TContext) => TReturn;
295
+ export declare function bind<T = any>(binding: Expression<T>, isVolatile?: boolean): Binding<T>;
301
296
 
302
297
  /**
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> {
307
303
  /**
308
- * The binding mode to configure the binding with.
304
+ * Options associated with the binding.
309
305
  */
310
- mode: BindingMode;
306
+ options?: any;
311
307
  /**
312
- * Options to be supplied to the binding behaviors.
308
+ * Whether or not the binding is volatile.
313
309
  */
314
- options: T;
315
- }
316
-
317
- /**
318
- * Describes the configuration for a binding expression.
319
- * @public
320
- */
321
- export declare const BindingConfig: Readonly<{
310
+ isVolatile?: boolean;
322
311
  /**
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.
312
+ * Evaluates the binding expression.
327
313
  */
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<{
314
+ evaluate: Expression<TSource, TReturn, TParent>;
348
315
  /**
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.
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.
353
319
  */
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 {
362
- /**
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.
367
- */
368
- observe(source: TSource, context?: ExecutionContext<TParent>): TReturn;
369
- /**
370
- * Gets {@link ObservationRecord|ObservationRecords} that the {@link BindingObserver}
371
- * is observing.
372
- */
373
- records(): IterableIterator<ObservationRecord>;
374
- /**
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.
381
- */
382
- setMode(isAsync: boolean): void;
383
- }
384
-
385
- /**
386
- * A {@link ValueConverter} that converts to and from `boolean` values.
387
- * @remarks
388
- * Used automatically when the `boolean` {@link AttributeMode} is selected.
389
- * @public
390
- */
391
- export declare const booleanConverter: ValueConverter;
392
-
393
- declare const booleanMode = "boolean";
394
-
395
- /**
396
- * Represents a callable type such as a function or an object with a "call" method.
397
- * @public
398
- */
399
- export declare type Callable = typeof Function.prototype.call | {
400
- call(): void;
401
- };
402
-
403
- /**
404
- * A marker interface used to capture types when interpolating Directive helpers
405
- * into templates.
406
- * @public
407
- */
408
- export declare interface CaptureType<TSource> {
320
+ abstract createObserver(directive: HTMLDirective, subscriber: Subscriber): ExpressionObserver<TSource, TReturn, TParent>;
409
321
  }
410
322
 
411
323
  /**
412
324
  * A binding behavior for bindings that change.
413
325
  * @public
414
326
  */
415
- export declare class ChangeBinding extends UpdateBinding {
416
- private isBindingVolatile;
327
+ export declare class BindingBehavior implements ViewBehavior {
328
+ readonly directive: HTMLBindingDirective;
329
+ protected updateTarget: UpdateTarget;
417
330
  private observerProperty;
418
331
  /**
419
332
  * Creates an instance of ChangeBinding.
@@ -421,12 +334,6 @@ export declare class ChangeBinding extends UpdateBinding {
421
334
  * @param updateTarget - The function used to update the target with the latest value.
422
335
  */
423
336
  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
337
  /**
431
338
  * Bind this behavior to the source.
432
339
  * @param source - The source to bind to.
@@ -442,40 +349,44 @@ export declare class ChangeBinding extends UpdateBinding {
442
349
  */
443
350
  unbind(source: any, context: ExecutionContext, targets: ViewBehaviorTargets): void;
444
351
  /** @internal */
445
- handleChange(binding: Binding, observer: BindingObserver): void;
352
+ handleChange(binding: Expression, observer: ExpressionObserver): void;
353
+ /**
354
+ * Returns the binding observer used to update the node.
355
+ * @param target - The target node.
356
+ * @returns A BindingObserver.
357
+ */
358
+ protected getObserver(target: Node): ExpressionObserver;
359
+ /**
360
+ * Creates a behavior.
361
+ * @param targets - The targets available for behaviors to be attached to.
362
+ */
363
+ createBehavior(targets: ViewBehaviorTargets): ViewBehavior;
446
364
  }
447
365
 
448
366
  /**
449
- * Transforms a template literal string into a ChildViewTemplate.
450
- * @param strings - The string fragments that are interpolated with the values.
451
- * @param values - The values that are interpolated with the string fragments.
367
+ * A {@link ValueConverter} that converts to and from `boolean` values.
452
368
  * @remarks
453
- * The html helper supports interpolation of strings, numbers, binding expressions,
454
- * other template instances, and Directive instances.
369
+ * Used automatically when the `boolean` {@link AttributeMode} is selected.
455
370
  * @public
456
371
  */
457
- export declare const child: <TChild = any, TParent = any>(strings: TemplateStringsArray, ...values: TemplateValue<TChild, TParent, ChildContext<TParent>>[]) => ChildViewTemplate<TChild, TParent>;
372
+ export declare const booleanConverter: ValueConverter;
373
+
374
+ declare const booleanMode = "boolean";
458
375
 
459
376
  /**
460
- * Provides additional contextual information when inside a child template.
377
+ * Represents a callable type such as a function or an object with a "call" method.
461
378
  * @public
462
379
  */
463
- export declare interface ChildContext<TParentSource = any> extends RootContext {
464
- /**
465
- * The parent data source within a nested context.
466
- */
467
- readonly parent: TParentSource;
468
- /**
469
- * The parent execution context when in nested context scenarios.
470
- */
471
- readonly parentContext: ChildContext<TParentSource>;
472
- /**
473
- * Creates a new execution context descent suitable for use in list rendering.
474
- * @param item - The list item to serve as the source.
475
- * @param index - The index of the item in the list.
476
- * @param length - The length of the list.
477
- */
478
- createItemContext(index: number, length: number): ItemContext<TParentSource>;
380
+ export declare type Callable = typeof Function.prototype.call | {
381
+ call(): void;
382
+ };
383
+
384
+ /**
385
+ * A marker interface used to capture types when interpolating Directive helpers
386
+ * into templates.
387
+ * @public
388
+ */
389
+ export declare interface CaptureType<TSource> {
479
390
  }
480
391
 
481
392
  /**
@@ -528,18 +439,6 @@ export declare class ChildrenDirective extends NodeObservationDirective<Children
528
439
  */
529
440
  export declare type ChildrenDirectiveOptions<T = any> = ChildListDirectiveOptions<T> | SubtreeDirectiveOptions<T>;
530
441
 
531
- /**
532
- * A template capable of rendering child views not specifically connected to custom elements.
533
- * @public
534
- */
535
- export declare interface ChildViewTemplate<TSource = any, TParent = any> {
536
- type: "child";
537
- /**
538
- * Creates a SyntheticView instance based on this template definition.
539
- */
540
- create(): SyntheticView<TSource, TParent, ChildContext<TParent>>;
541
- }
542
-
543
442
  /**
544
443
  * A function capable of compiling a template from the preprocessed form produced
545
444
  * by the html template function into a result that can instantiate views.
@@ -579,7 +478,7 @@ export declare const Compiler: {
579
478
  * it is recommended that you clone the original and pass the clone to this API.
580
479
  * @public
581
480
  */
582
- compile<TSource = any, TParent = any, TContext extends ExecutionContext<TParent> = ExecutionContext<TParent>>(html: string | HTMLTemplateElement, directives: Record<string, ViewBehaviorFactory>): HTMLTemplateCompilationResult<TSource, TParent, TContext>;
481
+ compile<TSource = any, TParent = any>(html: string | HTMLTemplateElement, directives: Record<string, ViewBehaviorFactory>): HTMLTemplateCompilationResult<TSource, TParent>;
583
482
  /**
584
483
  * Sets the default compilation strategy that will be used by the ViewTemplate whenever
585
484
  * it needs to compile a view preprocessed with the html template function.
@@ -601,6 +500,10 @@ export declare const Compiler: {
601
500
  */
602
501
  export declare type ComposableStyles = string | ElementStyles | CSSStyleSheet;
603
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
+
604
507
  /**
605
508
  * Allows for the creation of Constructable mixin classes.
606
509
  *
@@ -622,6 +525,58 @@ export declare type ConstructibleStyleStrategy = {
622
525
  new (styles: (string | CSSStyleSheet)[]): StyleStrategy;
623
526
  };
624
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
+
625
580
  /**
626
581
  * Controls the lifecycle and rendering of a `FASTElement`.
627
582
  * @public
@@ -852,20 +807,9 @@ export declare function customElement(nameOrDef: string | PartialFASTElementDefi
852
807
  */
853
808
  export declare type DecoratorAttributeConfiguration = Omit<AttributeConfiguration, "property">;
854
809
 
855
- /**
856
- * The default binding options.
857
- * @public
858
- */
859
- export declare type DefaultBindingOptions = AddEventListenerOptions;
810
+ declare function define<TType extends Constructable<HTMLElement> = Constructable<HTMLElement>>(this: TType, nameOrDef: string | PartialFASTElementDefinition): TType;
860
811
 
861
- /**
862
- * The default twoWay binding options.
863
- * @public
864
- */
865
- export declare type DefaultTwoWayBindingOptions = DefaultBindingOptions & {
866
- changeEvent?: string;
867
- fromView?: (value: any) => any;
868
- };
812
+ declare function define<TType extends Constructable<HTMLElement> = Constructable<HTMLElement>>(type: TType, nameOrDef?: string | PartialFASTElementDefinition): TType;
869
813
 
870
814
  /**
871
815
  * Provides a mechanism for releasing resources.
@@ -975,6 +919,12 @@ export declare class ElementStyles {
975
919
  * @param Strategy - The strategy type to construct.
976
920
  */
977
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;
978
928
  /**
979
929
  * Indicates whether the DOM supports the adoptedStyleSheets feature.
980
930
  */
@@ -985,7 +935,7 @@ export declare class ElementStyles {
985
935
  * A View representing DOM nodes specifically for rendering the view of a custom element.
986
936
  * @public
987
937
  */
988
- export declare interface ElementView<TSource = any, TParent = any> extends View<TSource, TParent, RootContext> {
938
+ export declare interface ElementView<TSource = any, TParent = any> extends View<TSource, TParent> {
989
939
  /**
990
940
  * Appends the view's DOM nodes to the referenced node.
991
941
  * @param node - The parent node to append the view's DOM nodes to.
@@ -998,7 +948,6 @@ export declare interface ElementView<TSource = any, TParent = any> extends View<
998
948
  * @public
999
949
  */
1000
950
  export declare interface ElementViewTemplate<TSource = any, TParent = any> {
1001
- type: "element";
1002
951
  /**
1003
952
  * Creates an ElementView instance based on this template definition.
1004
953
  * @param hostBindingTarget - The element that host behaviors will be bound to.
@@ -1027,7 +976,7 @@ export declare const emptyArray: readonly never[];
1027
976
  * A binding behavior for handling events.
1028
977
  * @public
1029
978
  */
1030
- export declare class EventBinding {
979
+ export declare class EventBehavior {
1031
980
  readonly directive: HTMLBindingDirective;
1032
981
  private contextProperty;
1033
982
  private sourceProperty;
@@ -1062,29 +1011,141 @@ export declare class EventBinding {
1062
1011
  }
1063
1012
 
1064
1013
  /**
1065
- * The common execution context APIs.
1014
+ * Provides additional contextual information available to behaviors and expressions.
1066
1015
  * @public
1067
1016
  */
1068
- export declare const ExecutionContext: Readonly<{
1069
- default: RootContext;
1017
+ export declare class ExecutionContext<TParentSource = any> {
1018
+ /**
1019
+ * The default execution context.
1020
+ */
1021
+ static readonly default: ExecutionContext<any>;
1022
+ /**
1023
+ * The index of the current item within a repeat context.
1024
+ */
1025
+ index: number;
1026
+ /**
1027
+ * The length of the current collection within a repeat context.
1028
+ */
1029
+ length: number;
1030
+ /**
1031
+ * The parent data source within a nested context.
1032
+ */
1033
+ readonly parent: TParentSource;
1034
+ /**
1035
+ * The parent execution context when in nested context scenarios.
1036
+ */
1037
+ readonly parentContext: ExecutionContext<TParentSource>;
1038
+ private constructor();
1039
+ /**
1040
+ * The current event within an event handler.
1041
+ */
1042
+ get event(): Event;
1043
+ /**
1044
+ * Indicates whether the current item within a repeat context
1045
+ * has an even index.
1046
+ */
1047
+ get isEven(): boolean;
1048
+ /**
1049
+ * Indicates whether the current item within a repeat context
1050
+ * has an odd index.
1051
+ */
1052
+ get isOdd(): boolean;
1053
+ /**
1054
+ * Indicates whether the current item within a repeat context
1055
+ * is the first item in the collection.
1056
+ */
1057
+ get isFirst(): boolean;
1058
+ /**
1059
+ * Indicates whether the current item within a repeat context
1060
+ * is somewhere in the middle of the collection.
1061
+ */
1062
+ get isInMiddle(): boolean;
1063
+ /**
1064
+ * Indicates whether the current item within a repeat context
1065
+ * is the last item in the collection.
1066
+ */
1067
+ get isLast(): boolean;
1068
+ /**
1069
+ * Returns the typed event detail of a custom event.
1070
+ */
1071
+ eventDetail<TDetail>(): TDetail;
1072
+ /**
1073
+ * Returns the typed event target of the event.
1074
+ */
1075
+ eventTarget<TTarget extends EventTarget>(): TTarget;
1076
+ /**
1077
+ * Updates the position/size on a context associated with a list item.
1078
+ * @param index - The new index of the item.
1079
+ * @param length - The new length of the list.
1080
+ */
1081
+ updatePosition(index: number, length: number): void;
1082
+ /**
1083
+ * Creates a new execution context descendent from the current context.
1084
+ * @param source - The source for the context if different than the parent.
1085
+ * @returns A child execution context.
1086
+ */
1087
+ createChildContext<TParentSource>(parentSource: TParentSource): ExecutionContext<TParentSource>;
1088
+ /**
1089
+ * Creates a new execution context descent suitable for use in list rendering.
1090
+ * @param item - The list item to serve as the source.
1091
+ * @param index - The index of the item in the list.
1092
+ * @param length - The length of the list.
1093
+ */
1094
+ createItemContext(index: number, length: number): ExecutionContext<TParentSource>;
1070
1095
  /**
1071
1096
  * Sets the event for the current execution context.
1072
1097
  * @param event - The event to set.
1073
1098
  * @internal
1074
1099
  */
1075
- setEvent(event: Event | null): void;
1100
+ static setEvent(event: Event | null): void;
1076
1101
  /**
1077
1102
  * Creates a new root execution context.
1078
1103
  * @returns A new execution context.
1079
1104
  */
1080
- create(): RootContext;
1081
- }>;
1105
+ static create(): ExecutionContext;
1106
+ }
1082
1107
 
1083
1108
  /**
1084
- * Represents some sort of execution context.
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
+ *
1085
1139
  * @public
1086
1140
  */
1087
- export declare type ExecutionContext<TParentSource = any> = RootContext | ChildContext<TParentSource> | ItemContext<TParentSource>;
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
+ }
1088
1149
 
1089
1150
  /**
1090
1151
  * The FAST global.
@@ -1158,7 +1219,12 @@ export declare const FASTElement: (new () => HTMLElement & FASTElement) & {
1158
1219
  * @param nameOrDef - The name of the element to define or a definition object
1159
1220
  * that describes the element to define.
1160
1221
  */
1161
- define<TType extends Constructable<HTMLElement>>(type: TType, nameOrDef?: string | PartialFASTElementDefinition): TType;
1222
+ define: typeof define;
1223
+ /**
1224
+ * Defines metadata for a FASTElement which can be used to later define the element.
1225
+ * @public
1226
+ */
1227
+ compose: typeof compose;
1162
1228
  };
1163
1229
 
1164
1230
  /**
@@ -1166,7 +1232,7 @@ export declare const FASTElement: (new () => HTMLElement & FASTElement) & {
1166
1232
  * @public
1167
1233
  */
1168
1234
  export declare class FASTElementDefinition<TType extends Constructable<HTMLElement> = Constructable<HTMLElement>> {
1169
- private observedAttributes;
1235
+ private platformDefined;
1170
1236
  /**
1171
1237
  * The type this element definition describes.
1172
1238
  */
@@ -1207,18 +1273,21 @@ export declare class FASTElementDefinition<TType extends Constructable<HTMLEleme
1207
1273
  * Options controlling how the custom element is defined with the platform.
1208
1274
  */
1209
1275
  readonly elementOptions?: ElementDefinitionOptions;
1210
- /**
1211
- * Creates an instance of FASTElementDefinition.
1212
- * @param type - The type this definition is being created for.
1213
- * @param nameOrConfig - The name of the element to define or a config object
1214
- * that describes the element to define.
1215
- */
1216
- constructor(type: TType, nameOrConfig?: PartialFASTElementDefinition | string);
1276
+ private constructor();
1217
1277
  /**
1218
1278
  * Defines a custom element based on this definition.
1219
1279
  * @param registry - The element registry to define the element in.
1280
+ * @remarks
1281
+ * This operation is idempotent per registry.
1220
1282
  */
1221
1283
  define(registry?: CustomElementRegistry): this;
1284
+ /**
1285
+ * Creates an instance of FASTElementDefinition.
1286
+ * @param type - The type this definition is being created for.
1287
+ * @param nameOrDef - The name of the element to define or a config object
1288
+ * that describes the element to define.
1289
+ */
1290
+ static compose<TType extends Constructable<HTMLElement> = Constructable<HTMLElement>>(type: TType, nameOrDef?: string | PartialFASTElementDefinition): FASTElementDefinition<TType>;
1222
1291
  /**
1223
1292
  * Gets the element definition associated with the specified type.
1224
1293
  * @param type - The custom element type to retrieve the definition for.
@@ -1250,18 +1319,21 @@ export declare interface FASTGlobal {
1250
1319
  /**
1251
1320
  * Sends a warning to the developer.
1252
1321
  * @param code - The warning code to send.
1253
- * @param args - Args relevant for the warning.
1322
+ * @param values - Values relevant for the warning message.
1254
1323
  */
1255
- warn(code: number, ...args: any[]): void;
1324
+ warn(code: number, values?: Record<string, any>): void;
1256
1325
  /**
1257
1326
  * Creates an error.
1258
1327
  * @param code - The error code to send.
1259
- * @param args - Args relevant for the error.
1328
+ * @param values - Values relevant for the error message.
1260
1329
  */
1261
- error(code: number, ...args: any[]): Error;
1330
+ error(code: number, values?: Record<string, any>): Error;
1262
1331
  /**
1263
1332
  * Adds debug messages for errors and warnings.
1264
1333
  * @param messages - The message dictionary to add.
1334
+ * @remarks
1335
+ * Message can include placeholders like $\{name\} which can be
1336
+ * replaced by values passed at runtime.
1265
1337
  */
1266
1338
  addMessages(messages: Record<number, string>): void;
1267
1339
  }
@@ -1275,16 +1347,14 @@ export declare interface FASTGlobal {
1275
1347
  * other template instances, and Directive instances.
1276
1348
  * @public
1277
1349
  */
1278
- export declare function html<TSource = any, TParent = any, TContext extends ExecutionContext<TParent> = ExecutionContext<TParent>>(strings: TemplateStringsArray, ...values: TemplateValue<TSource, TParent, TContext>[]): ViewTemplate<TSource, TParent>;
1350
+ export declare function html<TSource = any, TParent = any>(strings: TemplateStringsArray, ...values: TemplateValue<TSource, TParent>[]): ViewTemplate<TSource, TParent>;
1279
1351
 
1280
1352
  /**
1281
1353
  * A directive that applies bindings.
1282
1354
  * @public
1283
1355
  */
1284
1356
  export declare class HTMLBindingDirective implements HTMLDirective, ViewBehaviorFactory, Aspected {
1285
- binding: Binding;
1286
- mode: BindingMode;
1287
- options: any;
1357
+ dataBinding: Binding;
1288
1358
  private factory;
1289
1359
  /**
1290
1360
  * The unique id of the factory.
@@ -1308,11 +1378,9 @@ export declare class HTMLBindingDirective implements HTMLDirective, ViewBehavior
1308
1378
  aspectType: Aspect;
1309
1379
  /**
1310
1380
  * Creates an instance of HTMLBindingDirective.
1311
- * @param binding - The binding to apply.
1312
- * @param mode - The binding mode to use when applying the binding.
1313
- * @param options - The options to configure the binding with.
1381
+ * @param dataBinding - The binding configuration to apply.
1314
1382
  */
1315
- constructor(binding: Binding, mode: BindingMode, options: any);
1383
+ constructor(dataBinding: Binding);
1316
1384
  /**
1317
1385
  * Creates HTML to be used within a template.
1318
1386
  * @param add - Can be used to add behavior factories to a template.
@@ -1382,19 +1450,19 @@ export declare interface HTMLDirectiveDefinition<TType extends Constructable<HTM
1382
1450
  * The result of a template compilation operation.
1383
1451
  * @public
1384
1452
  */
1385
- export declare interface HTMLTemplateCompilationResult<TSource = any, TParent = any, TContext extends ExecutionContext<TParent> = ExecutionContext<TParent>> {
1453
+ export declare interface HTMLTemplateCompilationResult<TSource = any, TParent = any> {
1386
1454
  /**
1387
1455
  * Creates a view instance.
1388
1456
  * @param hostBindingTarget - The host binding target for the view.
1389
1457
  */
1390
- createView(hostBindingTarget?: Element): HTMLView<TSource, TParent, TContext>;
1458
+ createView(hostBindingTarget?: Element): HTMLView<TSource, TParent>;
1391
1459
  }
1392
1460
 
1393
1461
  /**
1394
1462
  * The standard View implementation, which also implements ElementView and SyntheticView.
1395
1463
  * @public
1396
1464
  */
1397
- export declare class HTMLView<TSource = any, TParent = any, TContext extends ExecutionContext<TParent> = ExecutionContext<TParent>> implements ElementView<TSource, TParent>, SyntheticView<TSource, TParent, TContext> {
1465
+ export declare class HTMLView<TSource = any, TParent = any> implements ElementView<TSource, TParent>, SyntheticView<TSource, TParent> {
1398
1466
  private fragment;
1399
1467
  private factories;
1400
1468
  private targets;
@@ -1406,7 +1474,7 @@ export declare class HTMLView<TSource = any, TParent = any, TContext extends Exe
1406
1474
  /**
1407
1475
  * The execution context the view is running within.
1408
1476
  */
1409
- context: TContext | null;
1477
+ context: ExecutionContext<TParent> | null;
1410
1478
  /**
1411
1479
  * The first DOM node in the range of nodes that make up the view.
1412
1480
  */
@@ -1446,7 +1514,7 @@ export declare class HTMLView<TSource = any, TParent = any, TContext extends Exe
1446
1514
  * @param source - The binding source for the view's binding behaviors.
1447
1515
  * @param context - The execution context to run the behaviors within.
1448
1516
  */
1449
- bind(source: TSource, context: TContext): void;
1517
+ bind(source: TSource, context: ExecutionContext<TParent>): void;
1450
1518
  /**
1451
1519
  * Unbinds a view's behaviors from its binding source.
1452
1520
  */
@@ -1459,72 +1527,14 @@ export declare class HTMLView<TSource = any, TParent = any, TContext extends Exe
1459
1527
  }
1460
1528
 
1461
1529
  /**
1462
- * Transforms a template literal string into an ItemViewTemplate.
1463
- * @param strings - The string fragments that are interpolated with the values.
1464
- * @param values - The values that are interpolated with the string fragments.
1465
- * @remarks
1466
- * The html helper supports interpolation of strings, numbers, binding expressions,
1467
- * other template instances, and Directive instances.
1468
- * @public
1469
- */
1470
- export declare const item: <TItem = any, TParent = any>(strings: TemplateStringsArray, ...values: TemplateValue<TItem, TParent, ItemContext<TParent>>[]) => ItemViewTemplate<TItem, TParent>;
1471
-
1472
- /**
1473
- * Provides additional contextual information when inside a repeat item template.s
1474
- * @public
1475
- */
1476
- export declare interface ItemContext<TParentSource = any> extends ChildContext<TParentSource> {
1477
- /**
1478
- * The index of the current item within a repeat context.
1479
- */
1480
- readonly index: number;
1481
- /**
1482
- * The length of the current collection within a repeat context.
1483
- */
1484
- readonly length: number;
1485
- /**
1486
- * Indicates whether the current item within a repeat context
1487
- * has an even index.
1488
- */
1489
- readonly isEven: boolean;
1490
- /**
1491
- * Indicates whether the current item within a repeat context
1492
- * has an odd index.
1493
- */
1494
- readonly isOdd: boolean;
1495
- /**
1496
- * Indicates whether the current item within a repeat context
1497
- * is the first item in the collection.
1498
- */
1499
- readonly isFirst: boolean;
1500
- /**
1501
- * Indicates whether the current item within a repeat context
1502
- * is somewhere in the middle of the collection.
1503
- */
1504
- readonly isInMiddle: boolean;
1505
- /**
1506
- * Indicates whether the current item within a repeat context
1507
- * is the last item in the collection.
1508
- */
1509
- readonly isLast: boolean;
1510
- /**
1511
- * Updates the position/size on a context associated with a list item.
1512
- * @param index - The new index of the item.
1513
- * @param length - The new length of the list.
1514
- */
1515
- updatePosition(index: number, length: number): void;
1516
- }
1517
-
1518
- /**
1519
- * A template capable of rendering item views not specifically connected to custom elements.
1530
+ * Observes array lengths.
1520
1531
  * @public
1521
1532
  */
1522
- export declare interface ItemViewTemplate<TSource = any, TParent = any> {
1523
- type: "item";
1533
+ export declare interface LengthObserver extends Subscriber {
1524
1534
  /**
1525
- * Creates a SyntheticView instance based on this template definition.
1535
+ * The length of the observed array.
1526
1536
  */
1527
- create(): SyntheticView<TSource, TParent, ItemContext<TParent>>;
1537
+ length: number;
1528
1538
  }
1529
1539
 
1530
1540
  /**
@@ -1533,19 +1543,16 @@ export declare interface ItemViewTemplate<TSource = any, TParent = any> {
1533
1543
  * @returns The length of the array.
1534
1544
  * @public
1535
1545
  */
1536
- declare function length_2<T>(array: readonly T[]): number;
1537
- export { length_2 as length }
1546
+ export declare function lengthOf<T>(array: readonly T[]): number;
1538
1547
 
1539
1548
  /**
1540
- * Observes array lengths.
1549
+ * Creates an event listener binding.
1550
+ * @param binding - The binding to invoke when the event is raised.
1551
+ * @param options - Event listener options.
1552
+ * @returns A binding configuration.
1541
1553
  * @public
1542
1554
  */
1543
- export declare interface LengthObserver extends Subscriber {
1544
- /**
1545
- * The length of the observed array.
1546
- */
1547
- length: number;
1548
- }
1555
+ export declare function listener<T = any>(binding: Expression<T>, options?: AddEventListenerOptions): Binding<T>;
1549
1556
 
1550
1557
  /**
1551
1558
  * Common APIs related to markup generation.
@@ -1664,6 +1671,14 @@ export declare abstract class NodeObservationDirective<T extends NodeBehaviorOpt
1664
1671
  protected abstract getNodes(target: any): Node[];
1665
1672
  }
1666
1673
 
1674
+ /**
1675
+ * Normalizes the input value into a binding.
1676
+ * @param value - The value to create the default binding for.
1677
+ * @returns A binding configuration for the provided value.
1678
+ * @public
1679
+ */
1680
+ export declare function normalizeBinding<TSource = any, TReturn = any, TParent = any>(value: Expression<TSource, TReturn, TParent> | Binding<TSource, TReturn, TParent> | {}): Binding<TSource, TReturn, TParent>;
1681
+
1667
1682
  /**
1668
1683
  * Provides change notifications for an observed subject.
1669
1684
  * @public
@@ -1754,19 +1769,19 @@ export declare const Observable: Readonly<{
1754
1769
  */
1755
1770
  getAccessors: (target: {}) => Accessor[];
1756
1771
  /**
1757
- * Creates a {@link BindingObserver} that can watch the
1758
- * provided {@link Binding} for changes.
1772
+ * Creates a {@link ExpressionNotifier} that can watch the
1773
+ * provided {@link Expression} for changes.
1759
1774
  * @param binding - The binding to observe.
1760
1775
  * @param initialSubscriber - An initial subscriber to changes in the binding value.
1761
1776
  * @param isVolatileBinding - Indicates whether the binding's dependency list must be re-evaluated on every value evaluation.
1762
1777
  */
1763
- binding<TSource = any, TReturn = any>(binding: Binding<TSource, TReturn, ExecutionContext<any>>, initialSubscriber?: Subscriber, isVolatileBinding?: boolean): BindingObserver<TSource, TReturn, any>;
1778
+ binding<TSource = any, TReturn = any>(binding: Expression<TSource, TReturn, any>, initialSubscriber?: Subscriber, isVolatileBinding?: boolean): ExpressionNotifier<TSource, TReturn, any>;
1764
1779
  /**
1765
1780
  * Determines whether a binding expression is volatile and needs to have its dependency list re-evaluated
1766
1781
  * on every evaluation of the value.
1767
1782
  * @param binding - The binding to inspect.
1768
1783
  */
1769
- isVolatileBinding<TSource_1 = any, TReturn_1 = any>(binding: Binding<TSource_1, TReturn_1, ExecutionContext<any>>): boolean;
1784
+ isVolatileBinding<TSource_1 = any, TReturn_1 = any>(binding: Expression<TSource_1, TReturn_1, any>): boolean;
1770
1785
  }>;
1771
1786
 
1772
1787
  /**
@@ -1793,30 +1808,12 @@ export declare interface ObservationRecord {
1793
1808
  }
1794
1809
 
1795
1810
  /**
1796
- * The default onChange binding configuration.
1797
- * @public
1798
- */
1799
- export declare const onChange: BindingConfig<AddEventListenerOptions> & BindingConfigResolver<AddEventListenerOptions>;
1800
-
1801
- /**
1802
- * The default onTime binding configuration.
1811
+ * Creates a one time binding
1812
+ * @param binding - The binding to refresh when signaled.
1813
+ * @returns A binding configuration.
1803
1814
  * @public
1804
1815
  */
1805
- export declare const oneTime: BindingConfig<AddEventListenerOptions> & BindingConfigResolver<AddEventListenerOptions>;
1806
-
1807
- /**
1808
- * A binding behavior for one-time bindings.
1809
- * @public
1810
- */
1811
- export declare class OneTimeBinding extends UpdateBinding {
1812
- /**
1813
- * Bind this behavior to the source.
1814
- * @param source - The source to bind to.
1815
- * @param context - The execution context that the binding is operating within.
1816
- * @param targets - The targets that behaviors in a view can attach to.
1817
- */
1818
- bind(source: any, context: ExecutionContext, targets: ViewBehaviorTargets): void;
1819
- }
1816
+ export declare function oneTime<T = any>(binding: Expression<T>): Binding<T>;
1820
1817
 
1821
1818
  /**
1822
1819
  * Common APIs related to content parsing.
@@ -1943,71 +1940,21 @@ declare const reflectMode = "reflect";
1943
1940
 
1944
1941
  /**
1945
1942
  * A directive that enables list rendering.
1946
- * @param itemsBinding - The array to render.
1947
- * @param templateOrTemplateBinding - The template or a template binding used obtain a template
1948
- * to render for each item in the array.
1949
- * @param options - Options used to turn on special repeat features.
1950
- * @public
1951
- */
1952
- export declare function repeat<TSource = any, TArray extends ReadonlyArray<any> = ReadonlyArray<any>>(itemsBinding: Binding<TSource, TArray, ExecutionContext<TSource>>, templateOrTemplateBinding: ViewTemplate | Binding<TSource, ViewTemplate, RootContext>, options?: {
1953
- positioning: false;
1954
- } | {
1955
- recycle: true;
1956
- } | {
1957
- positioning: false;
1958
- recycle: false;
1959
- } | {
1960
- positioning: false;
1961
- recycle: true;
1962
- }): CaptureType<TSource>;
1963
-
1964
- /**
1965
- * A directive that enables list rendering.
1966
- * @param itemsBinding - The array to render.
1967
- * @param templateOrTemplateBinding - The template or a template binding used obtain a template
1968
- * to render for each item in the array.
1969
- * @param options - Options used to turn on special repeat features.
1970
- * @public
1971
- */
1972
- export declare function repeat<TSource = any, TArray extends ReadonlyArray<any> = ReadonlyArray<any>>(itemsBinding: Binding<TSource, TArray, ExecutionContext<TSource>>, templateOrTemplateBinding: ChildViewTemplate | Binding<TSource, ChildViewTemplate, ChildContext>, options?: {
1973
- positioning: false;
1974
- } | {
1975
- recycle: true;
1976
- } | {
1977
- positioning: false;
1978
- recycle: false;
1979
- } | {
1980
- positioning: false;
1981
- recycle: true;
1982
- }): CaptureType<TSource>;
1983
-
1984
- /**
1985
- * A directive that enables list rendering.
1986
- * @param itemsBinding - The array to render.
1987
- * @param templateOrTemplateBinding - The template or a template binding used obtain a template
1943
+ * @param items - The array to render.
1944
+ * @param template - The template or a template binding used obtain a template
1988
1945
  * to render for each item in the array.
1989
1946
  * @param options - Options used to turn on special repeat features.
1990
1947
  * @public
1991
1948
  */
1992
- export declare function repeat<TSource = any, TArray extends ReadonlyArray<any> = ReadonlyArray<any>>(itemsBinding: Binding<TSource, TArray, ExecutionContext<TSource>>, templateOrTemplateBinding: ItemViewTemplate | Binding<TSource, ItemViewTemplate, ItemContext>, options: {
1993
- positioning: true;
1994
- } | {
1995
- positioning: true;
1996
- recycle: true;
1997
- } | {
1998
- positioning: true;
1999
- recycle: false;
2000
- }): CaptureType<TSource>;
1949
+ 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>;
2001
1950
 
2002
1951
  /**
2003
1952
  * A behavior that renders a template for each item in an array.
2004
1953
  * @public
2005
1954
  */
2006
1955
  export declare class RepeatBehavior<TSource = any> implements Behavior, Subscriber {
1956
+ private directive;
2007
1957
  private location;
2008
- private itemsBinding;
2009
- private templateBinding;
2010
- private options;
2011
1958
  private source;
2012
1959
  private views;
2013
1960
  private template;
@@ -2021,13 +1968,13 @@ export declare class RepeatBehavior<TSource = any> implements Behavior, Subscrib
2021
1968
  /**
2022
1969
  * Creates an instance of RepeatBehavior.
2023
1970
  * @param location - The location in the DOM to render the repeat.
2024
- * @param itemsBinding - The array to render.
1971
+ * @param dataBinding - The array to render.
2025
1972
  * @param isItemsBindingVolatile - Indicates whether the items binding has volatile dependencies.
2026
1973
  * @param templateBinding - The template to render for each item.
2027
1974
  * @param isTemplateBindingVolatile - Indicates whether the template binding has volatile dependencies.
2028
1975
  * @param options - Options used to turn on special repeat features.
2029
1976
  */
2030
- constructor(location: Node, itemsBinding: Binding<TSource, any[]>, isItemsBindingVolatile: boolean, templateBinding: Binding<TSource, SyntheticViewTemplate>, isTemplateBindingVolatile: boolean, options: RepeatOptions);
1977
+ constructor(directive: RepeatDirective, location: Node);
2031
1978
  /**
2032
1979
  * Bind this behavior to the source.
2033
1980
  * @param source - The source to bind to.
@@ -2044,7 +1991,7 @@ export declare class RepeatBehavior<TSource = any> implements Behavior, Subscrib
2044
1991
  * @param source - The source of the change.
2045
1992
  * @param args - The details about what was changed.
2046
1993
  */
2047
- handleChange(source: any, args: Splice[]): void;
1994
+ handleChange(source: any, args: Splice[] | ExpressionObserver): void;
2048
1995
  private observeItems;
2049
1996
  private updateViews;
2050
1997
  private refreshAllViews;
@@ -2056,11 +2003,9 @@ export declare class RepeatBehavior<TSource = any> implements Behavior, Subscrib
2056
2003
  * @public
2057
2004
  */
2058
2005
  export declare class RepeatDirective<TSource = any> implements HTMLDirective, ViewBehaviorFactory {
2059
- readonly itemsBinding: Binding;
2006
+ readonly dataBinding: Binding<TSource>;
2060
2007
  readonly templateBinding: Binding<TSource, SyntheticViewTemplate>;
2061
2008
  readonly options: RepeatOptions;
2062
- private isItemsBindingVolatile;
2063
- private isTemplateBindingVolatile;
2064
2009
  /**
2065
2010
  * The unique id of the factory.
2066
2011
  */
@@ -2076,11 +2021,11 @@ export declare class RepeatDirective<TSource = any> implements HTMLDirective, Vi
2076
2021
  createHTML(add: AddViewBehaviorFactory): string;
2077
2022
  /**
2078
2023
  * Creates an instance of RepeatDirective.
2079
- * @param itemsBinding - The binding that provides the array to render.
2024
+ * @param dataBinding - The binding that provides the array to render.
2080
2025
  * @param templateBinding - The template binding used to obtain a template to render for each item in the array.
2081
2026
  * @param options - Options used to turn on special repeat features.
2082
2027
  */
2083
- constructor(itemsBinding: Binding, templateBinding: Binding<TSource, SyntheticViewTemplate>, options: RepeatOptions);
2028
+ constructor(dataBinding: Binding<TSource>, templateBinding: Binding<TSource, SyntheticViewTemplate>, options: RepeatOptions);
2084
2029
  /**
2085
2030
  * Creates a behavior for the provided target node.
2086
2031
  * @param target - The node instance to create the behavior for.
@@ -2103,68 +2048,6 @@ export declare interface RepeatOptions {
2103
2048
  recycle?: boolean;
2104
2049
  }
2105
2050
 
2106
- /**
2107
- * Provides additional contextual information available to behaviors and expressions.
2108
- * @public
2109
- */
2110
- export declare interface RootContext {
2111
- /**
2112
- * The current event within an event handler.
2113
- */
2114
- readonly event: Event;
2115
- /**
2116
- * Returns the typed event detail of a custom event.
2117
- */
2118
- eventDetail<TDetail = any>(): TDetail;
2119
- /**
2120
- * Returns the typed event target of the event.
2121
- */
2122
- eventTarget<TTarget extends EventTarget = EventTarget>(): TTarget;
2123
- /**
2124
- * Creates a new execution context descendent from the current context.
2125
- * @param source - The source for the context if different than the parent.
2126
- * @returns A child execution context.
2127
- */
2128
- createChildContext<TParentSource>(source: TParentSource): ChildContext<TParentSource>;
2129
- }
2130
-
2131
- /**
2132
- * Creates a signal binding configuration with the supplied options.
2133
- * @param options - The signal name or a binding to use to retrieve the signal name.
2134
- * @returns A binding configuration.
2135
- * @public
2136
- */
2137
- export declare const signal: <T = any>(options: string | Binding<T, any, ExecutionContext<any>>) => BindingConfig<string | Binding<T, any, ExecutionContext<any>>>;
2138
-
2139
- /**
2140
- * A binding behavior for signal bindings.
2141
- * @public
2142
- */
2143
- export declare class SignalBinding extends UpdateBinding {
2144
- private handlerProperty;
2145
- /**
2146
- * Bind this behavior to the source.
2147
- * @param source - The source to bind to.
2148
- * @param context - The execution context that the binding is operating within.
2149
- * @param targets - The targets that behaviors in a view can attach to.
2150
- */
2151
- bind(source: any, context: ExecutionContext, targets: ViewBehaviorTargets): void;
2152
- /**
2153
- * Unbinds this behavior from the source.
2154
- * @param source - The source to unbind from.
2155
- * @param context - The execution context that the binding is operating within.
2156
- * @param targets - The targets that behaviors in a view can attach to.
2157
- */
2158
- unbind(source: any, context: ExecutionContext, targets: ViewBehaviorTargets): void;
2159
- private getSignal;
2160
- /**
2161
- * Sends the specified signal to signaled bindings.
2162
- * @param signal - The signal to send.
2163
- * @public
2164
- */
2165
- static send(signal: string): void;
2166
- }
2167
-
2168
2051
  /**
2169
2052
  * A directive that observes the `assignedNodes()` of a slot and updates a property
2170
2053
  * whenever they change.
@@ -2525,7 +2408,7 @@ export declare interface SubtreeDirectiveOptions<T = any> extends NodeBehaviorOp
2525
2408
  * A view representing a range of DOM nodes which can be added/removed ad hoc.
2526
2409
  * @public
2527
2410
  */
2528
- export declare interface SyntheticView<TSource = any, TParent = any, TContext extends ExecutionContext<TParent> = ExecutionContext<TParent>> extends View<TSource, TParent, TContext> {
2411
+ export declare interface SyntheticView<TSource = any, TParent = any> extends View<TSource, TParent> {
2529
2412
  /**
2530
2413
  * The first DOM node in the range of nodes that make up the view.
2531
2414
  */
@@ -2550,19 +2433,18 @@ export declare interface SyntheticView<TSource = any, TParent = any, TContext ex
2550
2433
  * A template capable of rendering views not specifically connected to custom elements.
2551
2434
  * @public
2552
2435
  */
2553
- export declare interface SyntheticViewTemplate<TSource = any, TParent = any, TContext extends ExecutionContext<TParent> = ExecutionContext<TParent>> {
2554
- type: "synthetic";
2436
+ export declare interface SyntheticViewTemplate<TSource = any, TParent = any> {
2555
2437
  /**
2556
2438
  * Creates a SyntheticView instance based on this template definition.
2557
2439
  */
2558
- create(): SyntheticView<TSource, TParent, TContext>;
2440
+ create(): SyntheticView<TSource, TParent>;
2559
2441
  }
2560
2442
 
2561
2443
  /**
2562
2444
  * Represents the types of values that can be interpolated into a template.
2563
2445
  * @public
2564
2446
  */
2565
- export declare type TemplateValue<TSource, TParent = any, TContext extends ExecutionContext<TParent> = ExecutionContext<TParent>> = Binding<TSource, any, TContext> | HTMLDirective | CaptureType<TSource>;
2447
+ export declare type TemplateValue<TSource, TParent = any> = Expression<TSource, any, TParent> | Binding<TSource, any, TParent> | HTMLDirective | CaptureType<TSource>;
2566
2448
 
2567
2449
  /**
2568
2450
  * Enables working with trusted types.
@@ -2589,54 +2471,6 @@ export declare type TrustedTypesPolicy = {
2589
2471
  createHTML(html: string): string;
2590
2472
  };
2591
2473
 
2592
- /**
2593
- * The default twoWay binding configuration.
2594
- * @public
2595
- */
2596
- export declare const twoWay: BindingConfig<DefaultTwoWayBindingOptions> & BindingConfigResolver<DefaultTwoWayBindingOptions>;
2597
-
2598
- /**
2599
- * A binding behavior for bindings that update in two directions.
2600
- * @public
2601
- */
2602
- export declare class TwoWayBinding extends ChangeBinding {
2603
- private changeEvent;
2604
- /**
2605
- * Bind this behavior to the source.
2606
- * @param source - The source to bind to.
2607
- * @param context - The execution context that the binding is operating within.
2608
- * @param targets - The targets that behaviors in a view can attach to.
2609
- */
2610
- bind(source: any, context: ExecutionContext, targets: ViewBehaviorTargets): void;
2611
- /**
2612
- * Unbinds this behavior from the source.
2613
- * @param source - The source to unbind from.
2614
- * @param context - The execution context that the binding is operating within.
2615
- * @param targets - The targets that behaviors in a view can attach to.
2616
- */
2617
- unbind(source: any, context: ExecutionContext, targets: ViewBehaviorTargets): void;
2618
- /** @internal */
2619
- handleEvent(event: Event): void;
2620
- /**
2621
- * Configures two-way binding.
2622
- * @param settings - The settings to use for the two-way binding system.
2623
- */
2624
- static configure(settings: TwoWaySettings): void;
2625
- }
2626
-
2627
- /**
2628
- * The settings required to enable two-way binding.
2629
- * @public
2630
- */
2631
- export declare interface TwoWaySettings {
2632
- /**
2633
- * Determines which event to listen to, to detect changes in the view.
2634
- * @param directive - The directive to determine the change event for.
2635
- * @param target - The target element to determine the change event for.
2636
- */
2637
- determineChangeEvent(directive: HTMLBindingDirective, target: HTMLElement): string;
2638
- }
2639
-
2640
2474
  /**
2641
2475
  * Do not change. Part of shared kernel contract.
2642
2476
  * @internal
@@ -2655,40 +2489,6 @@ export declare interface TypeRegistry<TDefinition extends TypeDefinition> {
2655
2489
  getForInstance(object: any): TDefinition | undefined;
2656
2490
  }
2657
2491
 
2658
- /**
2659
- * A base binding behavior for DOM updates.
2660
- * @public
2661
- */
2662
- export declare class UpdateBinding implements ViewBehavior {
2663
- readonly directive: HTMLBindingDirective;
2664
- protected updateTarget: UpdateTarget;
2665
- /**
2666
- * Creates an instance of UpdateBinding.
2667
- * @param directive - The directive that has the configuration for this behavior.
2668
- * @param updateTarget - The function used to update the target with the latest value.
2669
- */
2670
- constructor(directive: HTMLBindingDirective, updateTarget: UpdateTarget);
2671
- /**
2672
- * Bind this behavior to the source.
2673
- * @param source - The source to bind to.
2674
- * @param context - The execution context that the binding is operating within.
2675
- * @param targets - The targets that behaviors in a view can attach to.
2676
- */
2677
- bind(source: any, context: ExecutionContext, targets: ViewBehaviorTargets): void;
2678
- /**
2679
- * Unbinds this behavior from the source.
2680
- * @param source - The source to unbind from.
2681
- * @param context - The execution context that the binding is operating within.
2682
- * @param targets - The targets that behaviors in a view can attach to.
2683
- */
2684
- unbind(source: any, context: ExecutionContext, targets: ViewBehaviorTargets): void;
2685
- /**
2686
- * Creates a behavior.
2687
- * @param targets - The targets available for behaviors to be attached to.
2688
- */
2689
- createBehavior(targets: ViewBehaviorTargets): ViewBehavior;
2690
- }
2691
-
2692
2492
  /**
2693
2493
  * A work queue used to synchronize writes to the DOM.
2694
2494
  * @public
@@ -2775,11 +2575,11 @@ export declare interface ValueConverter {
2775
2575
  * Represents a collection of DOM nodes which can be bound to a data source.
2776
2576
  * @public
2777
2577
  */
2778
- export declare interface View<TSource = any, TParent = any, TContext extends ExecutionContext<TParent> = ExecutionContext<TParent>> extends Disposable {
2578
+ export declare interface View<TSource = any, TParent = any> extends Disposable {
2779
2579
  /**
2780
2580
  * The execution context the view is running within.
2781
2581
  */
2782
- readonly context: TContext | null;
2582
+ readonly context: ExecutionContext<TParent> | null;
2783
2583
  /**
2784
2584
  * The data that the view is bound to.
2785
2585
  */
@@ -2789,7 +2589,7 @@ export declare interface View<TSource = any, TParent = any, TContext extends Exe
2789
2589
  * @param source - The binding source for the view's binding behaviors.
2790
2590
  * @param context - The execution context to run the view within.
2791
2591
  */
2792
- bind(source: TSource, context: TContext): void;
2592
+ bind(source: TSource, context: ExecutionContext<TParent>): void;
2793
2593
  /**
2794
2594
  * Unbinds a view's behaviors from its binding source and context.
2795
2595
  */
@@ -2850,13 +2650,8 @@ export declare type ViewBehaviorTargets = {
2850
2650
  * A template capable of creating HTMLView instances or rendering directly to DOM.
2851
2651
  * @public
2852
2652
  */
2853
- export declare class ViewTemplate<TSource = any, TParent = any, TContext extends ExecutionContext<TParent> = ExecutionContext> implements ElementViewTemplate<TSource, TParent>, SyntheticViewTemplate<TSource, TParent, TContext> {
2653
+ export declare class ViewTemplate<TSource = any, TParent = any> implements ElementViewTemplate<TSource, TParent>, SyntheticViewTemplate<TSource, TParent> {
2854
2654
  private result;
2855
- /**
2856
- * Used for TypeScript purposes only.
2857
- * Do not use.
2858
- */
2859
- type: any;
2860
2655
  /**
2861
2656
  * The html representing what this template will
2862
2657
  * instantiate, including placeholders for directives.
@@ -2876,7 +2671,7 @@ export declare class ViewTemplate<TSource = any, TParent = any, TContext extends
2876
2671
  * Creates an HTMLView instance based on this template definition.
2877
2672
  * @param hostBindingTarget - The element that host behaviors will be bound to.
2878
2673
  */
2879
- create(hostBindingTarget?: Element): HTMLView<TSource, TParent, TContext>;
2674
+ create(hostBindingTarget?: Element): HTMLView<TSource, TParent>;
2880
2675
  /**
2881
2676
  * Creates an HTMLView from this template, binds it to the source, and then appends it to the host.
2882
2677
  * @param source - The data source to bind the template to.
@@ -2884,7 +2679,7 @@ export declare class ViewTemplate<TSource = any, TParent = any, TContext extends
2884
2679
  * @param hostBindingTarget - An HTML element to target the host bindings at if different from the
2885
2680
  * host that the template is being attached to.
2886
2681
  */
2887
- render(source: TSource, host: Node, hostBindingTarget?: Element, context?: TContext): HTMLView<TSource, TParent, TContext>;
2682
+ render(source: TSource, host: Node, hostBindingTarget?: Element, context?: ExecutionContext): HTMLView<TSource, TParent>;
2888
2683
  }
2889
2684
 
2890
2685
  /**
@@ -2898,11 +2693,11 @@ export declare function volatile(target: {}, name: string | Accessor, descriptor
2898
2693
 
2899
2694
  /**
2900
2695
  * A directive that enables basic conditional rendering in a template.
2901
- * @param binding - The condition to test for rendering.
2696
+ * @param condition - The condition to test for rendering.
2902
2697
  * @param templateOrTemplateBinding - The template or a binding that gets
2903
2698
  * the template to render when the condition is true.
2904
2699
  * @public
2905
2700
  */
2906
- export declare function when<TSource = any, TReturn = any>(binding: Binding<TSource, TReturn>, templateOrTemplateBinding: SyntheticViewTemplate | Binding<TSource, SyntheticViewTemplate>): CaptureType<TSource>;
2701
+ export declare function when<TSource = any, TReturn = any>(condition: Expression<TSource, TReturn> | boolean, templateOrTemplateBinding: SyntheticViewTemplate | Expression<TSource, SyntheticViewTemplate>): CaptureType<TSource>;
2907
2702
 
2908
2703
  export { }