@microsoft/fast-element 2.0.0-beta.1 → 2.0.0-beta.11

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 (98) hide show
  1. package/CHANGELOG.json +348 -0
  2. package/CHANGELOG.md +114 -1
  3. package/dist/dts/components/attributes.d.ts +10 -0
  4. package/dist/dts/components/{controller.d.ts → element-controller.d.ts} +49 -25
  5. package/dist/dts/components/fast-definitions.d.ts +43 -9
  6. package/dist/dts/components/fast-element.d.ts +15 -21
  7. package/dist/dts/context.d.ts +157 -0
  8. package/dist/dts/di/di.d.ts +899 -0
  9. package/dist/dts/index.d.ts +2 -2
  10. package/dist/dts/interfaces.d.ts +45 -14
  11. package/dist/dts/metadata.d.ts +25 -0
  12. package/dist/dts/observation/arrays.d.ts +1 -1
  13. package/dist/dts/observation/observable.d.ts +101 -75
  14. package/dist/dts/pending-task.d.ts +20 -0
  15. package/dist/dts/platform.d.ts +7 -0
  16. package/dist/dts/polyfills.d.ts +1 -8
  17. package/dist/dts/state/exports.d.ts +3 -0
  18. package/dist/dts/state/reactive.d.ts +8 -0
  19. package/dist/dts/state/state.d.ts +141 -0
  20. package/dist/dts/state/visitor.d.ts +6 -0
  21. package/dist/dts/state/watch.d.ts +10 -0
  22. package/dist/dts/styles/css-directive.d.ts +2 -2
  23. package/dist/dts/styles/element-styles.d.ts +10 -17
  24. package/dist/dts/styles/host.d.ts +68 -0
  25. package/dist/dts/templating/binding-signal.d.ts +21 -0
  26. package/dist/dts/templating/binding-two-way.d.ts +39 -0
  27. package/dist/dts/templating/binding.d.ts +69 -294
  28. package/dist/dts/templating/children.d.ts +1 -1
  29. package/dist/dts/templating/compiler.d.ts +1 -2
  30. package/dist/dts/templating/html-directive.d.ts +93 -35
  31. package/dist/dts/templating/node-observation.d.ts +4 -5
  32. package/dist/dts/templating/ref.d.ts +5 -13
  33. package/dist/dts/templating/render.d.ts +272 -0
  34. package/dist/dts/templating/repeat.d.ts +20 -75
  35. package/dist/dts/templating/slotted.d.ts +1 -1
  36. package/dist/dts/templating/template.d.ts +12 -61
  37. package/dist/dts/templating/view.d.ts +77 -12
  38. package/dist/dts/templating/when.d.ts +3 -3
  39. package/dist/dts/testing/exports.d.ts +3 -0
  40. package/dist/dts/testing/fakes.d.ts +4 -0
  41. package/dist/dts/testing/fixture.d.ts +84 -0
  42. package/dist/dts/testing/timeout.d.ts +7 -0
  43. package/dist/{tsdoc-metadata.json → dts/tsdoc-metadata.json} +0 -0
  44. package/dist/dts/utilities.d.ts +0 -18
  45. package/dist/esm/components/attributes.js +13 -4
  46. package/dist/esm/components/{controller.js → element-controller.js} +188 -109
  47. package/dist/esm/components/fast-definitions.js +38 -28
  48. package/dist/esm/components/fast-element.js +31 -12
  49. package/dist/esm/context.js +163 -0
  50. package/dist/esm/debug.js +36 -4
  51. package/dist/esm/di/di.js +1435 -0
  52. package/dist/esm/index.js +2 -1
  53. package/dist/esm/interfaces.js +4 -0
  54. package/dist/esm/metadata.js +60 -0
  55. package/dist/esm/observation/arrays.js +304 -3
  56. package/dist/esm/observation/observable.js +81 -87
  57. package/dist/esm/pending-task.js +16 -0
  58. package/dist/esm/platform.js +26 -1
  59. package/dist/esm/polyfills.js +1 -55
  60. package/dist/esm/state/exports.js +3 -0
  61. package/dist/esm/state/reactive.js +34 -0
  62. package/dist/esm/state/state.js +148 -0
  63. package/dist/esm/state/visitor.js +28 -0
  64. package/dist/esm/state/watch.js +36 -0
  65. package/dist/esm/styles/css.js +4 -4
  66. package/dist/esm/styles/element-styles.js +14 -33
  67. package/dist/esm/{observation/behavior.js → styles/host.js} +0 -0
  68. package/dist/esm/templating/binding-signal.js +83 -0
  69. package/dist/esm/templating/binding-two-way.js +103 -0
  70. package/dist/esm/templating/binding.js +134 -414
  71. package/dist/esm/templating/compiler.js +30 -7
  72. package/dist/esm/templating/html-directive.js +100 -28
  73. package/dist/esm/templating/node-observation.js +9 -8
  74. package/dist/esm/templating/ref.js +4 -12
  75. package/dist/esm/templating/render.js +391 -0
  76. package/dist/esm/templating/repeat.js +96 -72
  77. package/dist/esm/templating/template.js +11 -29
  78. package/dist/esm/templating/view.js +107 -29
  79. package/dist/esm/templating/when.js +5 -4
  80. package/dist/esm/testing/exports.js +3 -0
  81. package/dist/esm/testing/fakes.js +76 -0
  82. package/dist/esm/testing/fixture.js +86 -0
  83. package/dist/esm/testing/timeout.js +24 -0
  84. package/dist/esm/utilities.js +0 -95
  85. package/dist/fast-element.api.json +9278 -10745
  86. package/dist/fast-element.d.ts +707 -813
  87. package/dist/fast-element.debug.js +1229 -944
  88. package/dist/fast-element.debug.min.js +1 -1
  89. package/dist/fast-element.js +1191 -938
  90. package/dist/fast-element.min.js +1 -1
  91. package/dist/fast-element.untrimmed.d.ts +716 -824
  92. package/docs/api-report.md +265 -319
  93. package/package.json +39 -14
  94. package/dist/dts/hooks.d.ts +0 -20
  95. package/dist/dts/observation/behavior.d.ts +0 -19
  96. package/dist/dts/observation/splice-strategies.d.ts +0 -13
  97. package/dist/esm/hooks.js +0 -32
  98. package/dist/esm/observation/splice-strategies.js +0 -400
@@ -24,7 +24,7 @@ export declare interface Accessor {
24
24
  * Used to add behaviors when constructing styles.
25
25
  * @public
26
26
  */
27
- export declare type AddBehavior = (behavior: Behavior<HTMLElement>) => void;
27
+ export declare type AddBehavior = (behavior: HostBehavior<HTMLElement>) => void;
28
28
 
29
29
  /**
30
30
  * Used to add behavior factories when constructing templates.
@@ -32,20 +32,6 @@ export declare type AddBehavior = (behavior: Behavior<HTMLElement>) => void;
32
32
  */
33
33
  export declare type AddViewBehaviorFactory = (factory: ViewBehaviorFactory) => string;
34
34
 
35
- /**
36
- * https://wicg.github.io/construct-stylesheets/
37
- * https://developers.google.com/web/updates/2019/02/constructable-stylesheets
38
- *
39
- * @internal
40
- */
41
- export declare class AdoptedStyleSheetsStrategy implements StyleStrategy {
42
- /** @internal */
43
- readonly sheets: CSSStyleSheet[];
44
- constructor(styles: (string | CSSStyleSheet)[]);
45
- addStylesTo(target: StyleTarget): void;
46
- removeStylesFrom(target: StyleTarget): void;
47
- }
48
-
49
35
  /**
50
36
  * An observer for arrays.
51
37
  * @public
@@ -127,8 +113,10 @@ export declare const Aspect: Readonly<{
127
113
  *
128
114
  * @param directive - The directive to assign the aspect to.
129
115
  * @param value - The value to base the aspect determination on.
116
+ * @remarks
117
+ * If a falsy value is provided, then the content aspect will be assigned.
130
118
  */
131
- readonly assign: (directive: Aspected, value: string) => void;
119
+ readonly assign: (directive: Aspected, value?: string) => void;
132
120
  }>;
133
121
 
134
122
  /**
@@ -157,7 +145,7 @@ export declare interface Aspected {
157
145
  /**
158
146
  * A binding if one is associated with the aspect.
159
147
  */
160
- binding?: Binding;
148
+ dataBinding?: Binding;
161
149
  }
162
150
 
163
151
  /**
@@ -186,6 +174,17 @@ export declare type AttributeConfiguration = {
186
174
  converter?: ValueConverter;
187
175
  };
188
176
 
177
+ /**
178
+ * Metadata used to configure a custom attribute's behavior.
179
+ * @public
180
+ */
181
+ export declare const AttributeConfiguration: Readonly<{
182
+ /**
183
+ * Locates all attribute configurations associated with a type.
184
+ */
185
+ locate: (target: {}) => AttributeConfiguration[];
186
+ }>;
187
+
189
188
  /**
190
189
  * An implementation of {@link Accessor} that supports reactivity,
191
190
  * change callbacks, attribute reflection, and type conversion for
@@ -265,121 +264,38 @@ export declare class AttributeDefinition implements Accessor {
265
264
  export declare type AttributeMode = typeof reflectMode | typeof booleanMode | "fromView";
266
265
 
267
266
  /**
268
- * Represents an object that can contribute behavior to a view or
269
- * element's bind/unbind operations.
270
- * @public
271
- */
272
- export declare interface Behavior<TSource = any, TParent = any, TContext extends ExecutionContext<TParent> = RootContext> {
273
- /**
274
- * Bind this behavior to the source.
275
- * @param source - The source to bind to.
276
- * @param context - The execution context that the binding is operating within.
277
- */
278
- bind(source: TSource, context: TContext): void;
279
- /**
280
- * Unbinds this behavior from the source.
281
- * @param source - The source to unbind from.
282
- */
283
- unbind(source: TSource, context: TContext): void;
284
- }
285
-
286
- /**
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.
298
- * @public
299
- */
300
- export declare type Binding<TSource = any, TReturn = any, TContext extends ExecutionContext = ExecutionContext> = (source: TSource, context: TContext) => TReturn;
301
-
302
- /**
303
- * Describes the configuration for a binding expression.
304
- * @public
305
- */
306
- export declare interface BindingConfig<T = any> {
307
- /**
308
- * The binding mode to configure the binding with.
309
- */
310
- mode: BindingMode;
311
- /**
312
- * Options to be supplied to the binding behaviors.
313
- */
314
- options: T;
315
- }
316
-
317
- /**
318
- * Describes the configuration for a binding expression.
319
- * @public
320
- */
321
- export declare const BindingConfig: Readonly<{
322
- /**
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.
327
- */
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.
267
+ * Creates an standard binding.
268
+ * @param binding - The binding to refresh when changed.
269
+ * @param isVolatile - Indicates whether the binding is volatile or not.
270
+ * @returns A binding configuration.
345
271
  * @public
346
272
  */
347
- export declare const BindingMode: Readonly<{
348
- /**
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.
353
- */
354
- define(UpdateType: typeof UpdateBinding, EventType?: typeof EventBinding): BindingMode;
355
- }>;
273
+ export declare function bind<T = any>(binding: Expression<T>, isVolatile?: boolean): Binding<T>;
356
274
 
357
275
  /**
358
- * Enables evaluation of and subscription to a binding.
276
+ * Captures a binding expression along with related information and capabilities.
277
+ *
359
278
  * @public
360
279
  */
361
- export declare interface BindingObserver<TSource = any, TReturn = any, TParent = any> extends Notifier, Disposable {
280
+ export declare abstract class Binding<TSource = any, TReturn = any, TParent = any> {
281
+ evaluate: Expression<TSource, TReturn, TParent>;
282
+ isVolatile: boolean;
362
283
  /**
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.
284
+ * Options associated with the binding.
367
285
  */
368
- observe(source: TSource, context?: ExecutionContext<TParent>): TReturn;
286
+ options?: any;
369
287
  /**
370
- * Gets {@link ObservationRecord|ObservationRecords} that the {@link BindingObserver}
371
- * is observing.
288
+ * Creates a binding.
289
+ * @param evaluate - Evaluates the binding.
290
+ * @param isVolatile - Indicates whether the binding is volatile.
372
291
  */
373
- records(): IterableIterator<ObservationRecord>;
292
+ constructor(evaluate: Expression<TSource, TReturn, TParent>, isVolatile?: boolean);
374
293
  /**
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.
294
+ * Creates an observer capable of notifying a subscriber when the output of a binding changes.
295
+ * @param directive - The HTML Directive to create the observer for.
296
+ * @param subscriber - The subscriber to changes in the binding.
381
297
  */
382
- setMode(isAsync: boolean): void;
298
+ abstract createObserver(directive: HTMLDirective, subscriber: Subscriber): ExpressionObserver<TSource, TReturn, TParent>;
383
299
  }
384
300
 
385
301
  /**
@@ -405,77 +321,7 @@ export declare type Callable = typeof Function.prototype.call | {
405
321
  * into templates.
406
322
  * @public
407
323
  */
408
- export declare interface CaptureType<TSource> {
409
- }
410
-
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
- /**
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.
452
- * @remarks
453
- * The html helper supports interpolation of strings, numbers, binding expressions,
454
- * other template instances, and Directive instances.
455
- * @public
456
- */
457
- export declare const child: <TChild = any, TParent = any>(strings: TemplateStringsArray, ...values: TemplateValue<TChild, TParent, ChildContext<TParent>>[]) => ChildViewTemplate<TChild, TParent>;
458
-
459
- /**
460
- * Provides additional contextual information when inside a child template.
461
- * @public
462
- */
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>;
324
+ export declare interface CaptureType<TSource, TParent> {
479
325
  }
480
326
 
481
327
  /**
@@ -491,7 +337,7 @@ export declare interface ChildListDirectiveOptions<T = any> extends NodeBehavior
491
337
  * @param propertyOrOptions - The options used to configure child node observation.
492
338
  * @public
493
339
  */
494
- export declare function children<T = any>(propertyOrOptions: (keyof T & string) | ChildrenDirectiveOptions<keyof T & string>): CaptureType<T>;
340
+ export declare function children<TSource = any, TParent = any>(propertyOrOptions: (keyof TSource & string) | ChildrenDirectiveOptions<keyof TSource & string>): CaptureType<TSource, TParent>;
495
341
 
496
342
  /**
497
343
  * The runtime behavior for child node observation.
@@ -528,18 +374,6 @@ export declare class ChildrenDirective extends NodeObservationDirective<Children
528
374
  */
529
375
  export declare type ChildrenDirectiveOptions<T = any> = ChildListDirectiveOptions<T> | SubtreeDirectiveOptions<T>;
530
376
 
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
377
  /**
544
378
  * A function capable of compiling a template from the preprocessed form produced
545
379
  * by the html template function into a result that can instantiate views.
@@ -579,7 +413,7 @@ export declare const Compiler: {
579
413
  * it is recommended that you clone the original and pass the clone to this API.
580
414
  * @public
581
415
  */
582
- compile<TSource = any, TParent = any, TContext extends ExecutionContext<TParent> = ExecutionContext<TParent>>(html: string | HTMLTemplateElement, directives: Record<string, ViewBehaviorFactory>): HTMLTemplateCompilationResult<TSource, TParent, TContext>;
416
+ compile<TSource = any, TParent = any>(html: string | HTMLTemplateElement, directives: Record<string, ViewBehaviorFactory>): HTMLTemplateCompilationResult<TSource, TParent>;
583
417
  /**
584
418
  * Sets the default compilation strategy that will be used by the ViewTemplate whenever
585
419
  * it needs to compile a view preprocessed with the html template function.
@@ -601,6 +435,10 @@ export declare const Compiler: {
601
435
  */
602
436
  export declare type ComposableStyles = string | ElementStyles | CSSStyleSheet;
603
437
 
438
+ declare function compose<TType extends Constructable<HTMLElement> = Constructable<HTMLElement>>(this: TType, nameOrDef: string | PartialFASTElementDefinition): FASTElementDefinition<TType>;
439
+
440
+ declare function compose<TType extends Constructable<HTMLElement> = Constructable<HTMLElement>>(type: TType, nameOrDef?: string | PartialFASTElementDefinition): FASTElementDefinition<TType>;
441
+
604
442
  /**
605
443
  * Allows for the creation of Constructable mixin classes.
606
444
  *
@@ -623,127 +461,51 @@ export declare type ConstructibleStyleStrategy = {
623
461
  };
624
462
 
625
463
  /**
626
- * Controls the lifecycle and rendering of a `FASTElement`.
464
+ * A simple template that can create ContentView instances.
627
465
  * @public
628
466
  */
629
- export declare class Controller<TElement extends HTMLElement = HTMLElement> extends PropertyChangeNotifier {
630
- private boundObservables;
631
- private behaviors;
632
- private needsInitialization;
633
- private hasExistingShadowRoot;
634
- private _template;
635
- private _styles;
636
- private _isConnected;
637
- /**
638
- * This allows Observable.getNotifier(...) to return the Controller
639
- * when the notifier for the Controller itself is being requested. The
640
- * result is that the Observable system does not need to create a separate
641
- * instance of Notifier for observables on the Controller. The component and
642
- * the controller will now share the same notifier, removing one-object construct
643
- * per web component instance.
644
- */
645
- private readonly $fastController;
646
- /**
647
- * The element being controlled by this controller.
648
- */
649
- readonly element: TElement;
650
- /**
651
- * The element definition that instructs this controller
652
- * in how to handle rendering and other platform integrations.
653
- */
654
- readonly definition: FASTElementDefinition;
655
- /**
656
- * The view associated with the custom element.
657
- * @remarks
658
- * If `null` then the element is managing its own rendering.
659
- */
660
- readonly view: ElementView<TElement> | null;
661
- /**
662
- * Indicates whether or not the custom element has been
663
- * connected to the document.
664
- */
665
- get isConnected(): boolean;
666
- private setIsConnected;
667
- /**
668
- * Gets/sets the template used to render the component.
669
- * @remarks
670
- * This value can only be accurately read after connect but can be set at any time.
671
- */
672
- get template(): ElementViewTemplate<TElement> | null;
673
- set template(value: ElementViewTemplate<TElement> | null);
674
- /**
675
- * Gets/sets the primary styles used for the component.
676
- * @remarks
677
- * This value can only be accurately read after connect but can be set at any time.
678
- */
679
- get styles(): ElementStyles | null;
680
- set styles(value: ElementStyles | null);
681
- /**
682
- * Creates a Controller to control the specified element.
683
- * @param element - The element to be controlled by this controller.
684
- * @param definition - The element definition metadata that instructs this
685
- * controller in how to handle rendering and other platform integrations.
686
- * @internal
687
- */
688
- constructor(element: TElement, definition: FASTElementDefinition);
689
- /**
690
- * Adds styles to this element. Providing an HTMLStyleElement will attach the element instance to the shadowRoot.
691
- * @param styles - The styles to add.
692
- */
693
- addStyles(styles: ElementStyles | HTMLStyleElement | null | undefined): void;
694
- /**
695
- * Removes styles from this element. Providing an HTMLStyleElement will detach the element instance from the shadowRoot.
696
- * @param styles - the styles to remove.
697
- */
698
- removeStyles(styles: ElementStyles | HTMLStyleElement | null | undefined): void;
467
+ export declare interface ContentTemplate {
699
468
  /**
700
- * Adds behaviors to this element.
701
- * @param behaviors - The behaviors to add.
469
+ * Creates a simple content view instance.
702
470
  */
703
- addBehaviors(behaviors: ReadonlyArray<Behavior<TElement>>): void;
704
- /**
705
- * Removes behaviors from this element.
706
- * @param behaviors - The behaviors to remove.
707
- * @param force - Forces unbinding of behaviors.
708
- */
709
- removeBehaviors(behaviors: ReadonlyArray<Behavior<TElement>>, force?: boolean): void;
710
- /**
711
- * Runs connected lifecycle behavior on the associated element.
712
- */
713
- onConnectedCallback(): void;
471
+ create(): ContentView;
472
+ }
473
+
474
+ /**
475
+ * A simple View that can be interpolated into HTML content.
476
+ * @public
477
+ */
478
+ export declare interface ContentView {
479
+ readonly context: ExecutionContext;
714
480
  /**
715
- * Runs disconnected lifecycle behavior on the associated element.
481
+ * Binds a view's behaviors to its binding source.
482
+ * @param source - The binding source for the view's binding behaviors.
483
+ * @param context - The execution context to run the view within.
716
484
  */
717
- onDisconnectedCallback(): void;
485
+ bind(source: any, context?: ExecutionContext): void;
718
486
  /**
719
- * Runs the attribute changed callback for the associated element.
720
- * @param name - The name of the attribute that changed.
721
- * @param oldValue - The previous value of the attribute.
722
- * @param newValue - The new value of the attribute.
487
+ * Unbinds a view's behaviors from its binding source and context.
723
488
  */
724
- onAttributeChangedCallback(name: string, oldValue: string | null, newValue: string | null): void;
489
+ unbind(): void;
725
490
  /**
726
- * Emits a custom HTML event.
727
- * @param type - The type name of the event.
728
- * @param detail - The event detail object to send with the event.
729
- * @param options - The event options. By default bubbles and composed.
730
- * @remarks
731
- * Only emits events if connected.
491
+ * Inserts the view's DOM nodes before the referenced node.
492
+ * @param node - The node to insert the view's DOM before.
732
493
  */
733
- emit(type: string, detail?: any, options?: Omit<CustomEventInit, "detail">): void | boolean;
734
- private finishInitialization;
735
- private renderTemplate;
494
+ insertBefore(node: Node): void;
736
495
  /**
737
- * Locates or creates a controller for the specified element.
738
- * @param element - The element to return the controller for.
739
- * @remarks
740
- * The specified element must have a {@link FASTElementDefinition}
741
- * registered either through the use of the {@link customElement}
742
- * decorator or a call to `FASTElement.define`.
496
+ * Removes the view's DOM nodes.
497
+ * The nodes are not disposed and the view can later be re-inserted.
743
498
  */
744
- static forCustomElement(element: HTMLElement): Controller;
499
+ remove(): void;
745
500
  }
746
501
 
502
+ /**
503
+ * Creates a function capable of locating metadata associated with a type.
504
+ * @returns A metadata locator function.
505
+ * @internal
506
+ */
507
+ export declare function createMetadataLocator<TMetadata>(): (target: {}) => TMetadata[];
508
+
747
509
  /**
748
510
  * Do not change. Part of shared kernel contract.
749
511
  * @internal
@@ -852,20 +614,9 @@ export declare function customElement(nameOrDef: string | PartialFASTElementDefi
852
614
  */
853
615
  export declare type DecoratorAttributeConfiguration = Omit<AttributeConfiguration, "property">;
854
616
 
855
- /**
856
- * The default binding options.
857
- * @public
858
- */
859
- export declare type DefaultBindingOptions = AddEventListenerOptions;
617
+ declare function define<TType extends Constructable<HTMLElement> = Constructable<HTMLElement>>(this: TType, nameOrDef: string | PartialFASTElementDefinition): TType;
860
618
 
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
- };
619
+ declare function define<TType extends Constructable<HTMLElement> = Constructable<HTMLElement>>(type: TType, nameOrDef?: string | PartialFASTElementDefinition): TType;
869
620
 
870
621
  /**
871
622
  * Provides a mechanism for releasing resources.
@@ -920,8 +671,129 @@ export declare const DOM: Readonly<{
920
671
  }>;
921
672
 
922
673
  /**
923
- * Creates a function that can be used to filter a Node array, selecting only elements.
924
- * @param selector - An optional selector to restrict the filter to.
674
+ * Controls the lifecycle and rendering of a `FASTElement`.
675
+ * @public
676
+ */
677
+ export declare class ElementController<TElement extends HTMLElement = HTMLElement> extends PropertyChangeNotifier implements HostController<TElement> {
678
+ private boundObservables;
679
+ private needsInitialization;
680
+ private hasExistingShadowRoot;
681
+ private _template;
682
+ private _isConnected;
683
+ private behaviors;
684
+ private _mainStyles;
685
+ /**
686
+ * This allows Observable.getNotifier(...) to return the Controller
687
+ * when the notifier for the Controller itself is being requested. The
688
+ * result is that the Observable system does not need to create a separate
689
+ * instance of Notifier for observables on the Controller. The component and
690
+ * the controller will now share the same notifier, removing one-object construct
691
+ * per web component instance.
692
+ */
693
+ private readonly $fastController;
694
+ /**
695
+ * The element being controlled by this controller.
696
+ */
697
+ readonly source: TElement;
698
+ /**
699
+ * The element definition that instructs this controller
700
+ * in how to handle rendering and other platform integrations.
701
+ */
702
+ readonly definition: FASTElementDefinition;
703
+ /**
704
+ * The view associated with the custom element.
705
+ * @remarks
706
+ * If `null` then the element is managing its own rendering.
707
+ */
708
+ readonly view: ElementView<TElement> | null;
709
+ /**
710
+ * Indicates whether or not the custom element has been
711
+ * connected to the document.
712
+ */
713
+ get isConnected(): boolean;
714
+ private setIsConnected;
715
+ /**
716
+ * Gets/sets the template used to render the component.
717
+ * @remarks
718
+ * This value can only be accurately read after connect but can be set at any time.
719
+ */
720
+ get template(): ElementViewTemplate<TElement> | null;
721
+ set template(value: ElementViewTemplate<TElement> | null);
722
+ /**
723
+ * The main set of styles used for the component, independent
724
+ * of any dynamically added styles.
725
+ */
726
+ get mainStyles(): ElementStyles | null;
727
+ set mainStyles(value: ElementStyles | null);
728
+ /**
729
+ * Creates a Controller to control the specified element.
730
+ * @param element - The element to be controlled by this controller.
731
+ * @param definition - The element definition metadata that instructs this
732
+ * controller in how to handle rendering and other platform integrations.
733
+ * @internal
734
+ */
735
+ constructor(element: TElement, definition: FASTElementDefinition);
736
+ /**
737
+ * Adds the behavior to the component.
738
+ * @param behavior - The behavior to add.
739
+ */
740
+ addBehavior(behavior: HostBehavior<TElement>): void;
741
+ /**
742
+ * Removes the behavior from the component.
743
+ * @param behavior - The behavior to remove.
744
+ * @param force - Forces removal even if this behavior was added more than once.
745
+ */
746
+ removeBehavior(behavior: HostBehavior<TElement>, force?: boolean): void;
747
+ /**
748
+ * Adds styles to this element. Providing an HTMLStyleElement will attach the element instance to the shadowRoot.
749
+ * @param styles - The styles to add.
750
+ */
751
+ addStyles(styles: ElementStyles | HTMLStyleElement | null | undefined): void;
752
+ /**
753
+ * Removes styles from this element. Providing an HTMLStyleElement will detach the element instance from the shadowRoot.
754
+ * @param styles - the styles to remove.
755
+ */
756
+ removeStyles(styles: ElementStyles | HTMLStyleElement | null | undefined): void;
757
+ /**
758
+ * Runs connected lifecycle behavior on the associated element.
759
+ */
760
+ connect(): void;
761
+ /**
762
+ * Runs disconnected lifecycle behavior on the associated element.
763
+ */
764
+ disconnect(): void;
765
+ /**
766
+ * Runs the attribute changed callback for the associated element.
767
+ * @param name - The name of the attribute that changed.
768
+ * @param oldValue - The previous value of the attribute.
769
+ * @param newValue - The new value of the attribute.
770
+ */
771
+ onAttributeChangedCallback(name: string, oldValue: string | null, newValue: string | null): void;
772
+ /**
773
+ * Emits a custom HTML event.
774
+ * @param type - The type name of the event.
775
+ * @param detail - The event detail object to send with the event.
776
+ * @param options - The event options. By default bubbles and composed.
777
+ * @remarks
778
+ * Only emits events if connected.
779
+ */
780
+ emit(type: string, detail?: any, options?: Omit<CustomEventInit, "detail">): void | boolean;
781
+ private finishInitialization;
782
+ private renderTemplate;
783
+ /**
784
+ * Locates or creates a controller for the specified element.
785
+ * @param element - The element to return the controller for.
786
+ * @remarks
787
+ * The specified element must have a {@link FASTElementDefinition}
788
+ * registered either through the use of the {@link customElement}
789
+ * decorator or a call to `FASTElement.define`.
790
+ */
791
+ static forCustomElement(element: HTMLElement): ElementController;
792
+ }
793
+
794
+ /**
795
+ * Creates a function that can be used to filter a Node array, selecting only elements.
796
+ * @param selector - An optional selector to restrict the filter to.
925
797
  * @public
926
798
  */
927
799
  export declare const elements: (selector?: string) => ElementsFilter;
@@ -931,7 +803,7 @@ export declare const elements: (selector?: string) => ElementsFilter;
931
803
  *
932
804
  * @public
933
805
  */
934
- export declare type ElementsFilter = (value: Node, index: number, array: Node[]) => boolean;
806
+ export declare type ElementsFilter = (value: Node, index?: number, array?: Node[]) => boolean;
935
807
 
936
808
  /**
937
809
  * Represents styles that can be applied to a custom element.
@@ -944,7 +816,7 @@ export declare class ElementStyles {
944
816
  /**
945
817
  * The behaviors associated with this set of styles.
946
818
  */
947
- readonly behaviors: ReadonlyArray<Behavior<HTMLElement>> | null;
819
+ readonly behaviors: ReadonlyArray<HostBehavior<HTMLElement>> | null;
948
820
  /**
949
821
  * Gets the StyleStrategy associated with these element styles.
950
822
  */
@@ -964,7 +836,7 @@ export declare class ElementStyles {
964
836
  * Associates behaviors with this set of styles.
965
837
  * @param behaviors - The behaviors to associate.
966
838
  */
967
- withBehaviors(...behaviors: Behavior<HTMLElement>[]): this;
839
+ withBehaviors(...behaviors: HostBehavior<HTMLElement>[]): this;
968
840
  /**
969
841
  * Sets the strategy that handles adding/removing these styles for an element.
970
842
  * @param strategy - The strategy to use.
@@ -975,6 +847,12 @@ export declare class ElementStyles {
975
847
  * @param Strategy - The strategy type to construct.
976
848
  */
977
849
  static setDefaultStrategy(Strategy: ConstructibleStyleStrategy): void;
850
+ /**
851
+ * Normalizes a set of composable style options.
852
+ * @param styles - The style options to normalize.
853
+ * @returns A singular ElementStyles instance or undefined.
854
+ */
855
+ static normalize(styles: ComposableStyles | ComposableStyles[] | undefined): ElementStyles | undefined;
978
856
  /**
979
857
  * Indicates whether the DOM supports the adoptedStyleSheets feature.
980
858
  */
@@ -985,7 +863,7 @@ export declare class ElementStyles {
985
863
  * A View representing DOM nodes specifically for rendering the view of a custom element.
986
864
  * @public
987
865
  */
988
- export declare interface ElementView<TSource = any, TParent = any> extends View<TSource, TParent, RootContext> {
866
+ export declare interface ElementView<TSource = any, TParent = any> extends View<TSource, TParent> {
989
867
  /**
990
868
  * Appends the view's DOM nodes to the referenced node.
991
869
  * @param node - The parent node to append the view's DOM nodes to.
@@ -998,7 +876,6 @@ export declare interface ElementView<TSource = any, TParent = any> extends View<
998
876
  * @public
999
877
  */
1000
878
  export declare interface ElementViewTemplate<TSource = any, TParent = any> {
1001
- type: "element";
1002
879
  /**
1003
880
  * Creates an ElementView instance based on this template definition.
1004
881
  * @param hostBindingTarget - The element that host behaviors will be bound to.
@@ -1024,67 +901,162 @@ export declare interface ElementViewTemplate<TSource = any, TParent = any> {
1024
901
  export declare const emptyArray: readonly never[];
1025
902
 
1026
903
  /**
1027
- * A binding behavior for handling events.
904
+ * Provides additional contextual information available to behaviors and expressions.
1028
905
  * @public
1029
906
  */
1030
- export declare class EventBinding {
1031
- readonly directive: HTMLBindingDirective;
1032
- private contextProperty;
1033
- private sourceProperty;
907
+ export declare interface ExecutionContext<TParent = any> {
1034
908
  /**
1035
- * Creates an instance of EventBinding.
1036
- * @param directive - The directive that has the configuration for this behavior.
909
+ * The index of the current item within a repeat context.
1037
910
  */
1038
- constructor(directive: HTMLBindingDirective);
911
+ index: number;
1039
912
  /**
1040
- * Bind this behavior to the source.
1041
- * @param source - The source to bind to.
1042
- * @param context - The execution context that the binding is operating within.
1043
- * @param targets - The targets that behaviors in a view can attach to.
913
+ * The length of the current collection within a repeat context.
1044
914
  */
1045
- bind(source: any, context: ExecutionContext, targets: ViewBehaviorTargets): void;
915
+ length: number;
1046
916
  /**
1047
- * Unbinds this behavior from the source.
1048
- * @param source - The source to unbind from.
1049
- * @param context - The execution context that the binding is operating within.
1050
- * @param targets - The targets that behaviors in a view can attach to.
917
+ * The parent data source within a nested context.
1051
918
  */
1052
- unbind(source: any, context: ExecutionContext, targets: ViewBehaviorTargets): void;
919
+ parent: TParent;
1053
920
  /**
1054
- * Creates a behavior.
1055
- * @param targets - The targets available for behaviors to be attached to.
921
+ * The parent execution context when in nested context scenarios.
1056
922
  */
1057
- createBehavior(targets: ViewBehaviorTargets): ViewBehavior;
923
+ parentContext: ExecutionContext<TParent>;
1058
924
  /**
1059
- * @internal
925
+ * The current event within an event handler.
1060
926
  */
1061
- handleEvent(event: Event): void;
927
+ readonly event: Event;
928
+ /**
929
+ * Indicates whether the current item within a repeat context
930
+ * has an even index.
931
+ */
932
+ readonly isEven: boolean;
933
+ /**
934
+ * Indicates whether the current item within a repeat context
935
+ * has an odd index.
936
+ */
937
+ readonly isOdd: boolean;
938
+ /**
939
+ * Indicates whether the current item within a repeat context
940
+ * is the first item in the collection.
941
+ */
942
+ readonly isFirst: boolean;
943
+ /**
944
+ * Indicates whether the current item within a repeat context
945
+ * is somewhere in the middle of the collection.
946
+ */
947
+ readonly isInMiddle: boolean;
948
+ /**
949
+ * Indicates whether the current item within a repeat context
950
+ * is the last item in the collection.
951
+ */
952
+ readonly isLast: boolean;
953
+ /**
954
+ * Returns the typed event detail of a custom event.
955
+ */
956
+ eventDetail<TDetail>(): TDetail;
957
+ /**
958
+ * Returns the typed event target of the event.
959
+ */
960
+ eventTarget<TTarget extends EventTarget>(): TTarget;
1062
961
  }
1063
962
 
1064
963
  /**
1065
- * The common execution context APIs.
964
+ * Provides additional contextual information available to behaviors and expressions.
1066
965
  * @public
1067
966
  */
1068
967
  export declare const ExecutionContext: Readonly<{
1069
- default: RootContext;
1070
968
  /**
1071
- * Sets the event for the current execution context.
1072
- * @param event - The event to set.
1073
- * @internal
969
+ * A default execution context.
1074
970
  */
1075
- setEvent(event: Event | null): void;
971
+ default: ExecutionContext<any>;
1076
972
  /**
1077
- * Creates a new root execution context.
1078
- * @returns A new execution context.
973
+ * Gets the current event.
974
+ * @returns An event object.
1079
975
  */
1080
- create(): RootContext;
976
+ getEvent(): Event | null;
977
+ /**
978
+ * Sets the current event.
979
+ * @param event - An event object.
980
+ */
981
+ setEvent(event: Event | null): void;
1081
982
  }>;
1082
983
 
1083
984
  /**
1084
- * Represents some sort of execution context.
985
+ * The signature of an arrow function capable of being evaluated
986
+ * against source data and within an execution context.
987
+ * @public
988
+ */
989
+ export declare type Expression<TSource = any, TReturn = any, TParent = any> = (source: TSource, context: ExecutionContext<TParent>) => TReturn;
990
+
991
+ /**
992
+ * Controls the lifecycle of an expression and provides relevant context.
993
+ * @public
994
+ */
995
+ export declare interface ExpressionController<TSource = any, TParent = any> {
996
+ /**
997
+ * The source the expression is evaluated against.
998
+ */
999
+ readonly source: TSource;
1000
+ /**
1001
+ * Indicates how the source's lifetime relates to the controller's lifetime.
1002
+ */
1003
+ readonly sourceLifetime?: SourceLifetime;
1004
+ /**
1005
+ * The context the expression is evaluated against.
1006
+ */
1007
+ readonly context: ExecutionContext<TParent>;
1008
+ /**
1009
+ * Indicates whether the controller is bound.
1010
+ */
1011
+ readonly isBound: boolean;
1012
+ /**
1013
+ * Registers an unbind handler with the controller.
1014
+ * @param behavior - An object to call when the controller unbinds.
1015
+ */
1016
+ onUnbind(behavior: {
1017
+ unbind(controller: ExpressionController<TSource, TParent>): any;
1018
+ }): void;
1019
+ }
1020
+
1021
+ /**
1022
+ * Enables evaluation of and subscription to a binding.
1023
+ * @public
1024
+ */
1025
+ export declare interface ExpressionNotifier<TSource = any, TReturn = any, TParent = any> extends Notifier, ExpressionObserver<TSource, TReturn, TParent>, Disposable {
1026
+ /**
1027
+ * Observes the expression.
1028
+ * @param source - The source for the expression.
1029
+ * @param context - The context for the expression.
1030
+ */
1031
+ observe(source: TSource, context?: ExecutionContext): TReturn;
1032
+ /**
1033
+ * Gets {@link ObservationRecord|ObservationRecords} that the {@link ExpressionNotifier}
1034
+ * is observing.
1035
+ */
1036
+ records(): IterableIterator<ObservationRecord>;
1037
+ /**
1038
+ * Sets the update mode used by the observer.
1039
+ * @param isAsync - Indicates whether updates should be asynchronous.
1040
+ * @remarks
1041
+ * By default, the update mode is asynchronous, since that provides the best
1042
+ * performance for template rendering scenarios. Passing false to setMode will
1043
+ * instead cause the observer to notify subscribers immediately when changes occur.
1044
+ */
1045
+ setMode(isAsync: boolean): void;
1046
+ }
1047
+
1048
+ /**
1049
+ * Observes an expression for changes.
1085
1050
  * @public
1086
1051
  */
1087
- export declare type ExecutionContext<TParentSource = any> = RootContext | ChildContext<TParentSource> | ItemContext<TParentSource>;
1052
+ export declare interface ExpressionObserver<TSource = any, TReturn = any, TParent = any> {
1053
+ /**
1054
+ * Binds the expression to the source.
1055
+ * @param controller - The controller that manages the lifecycle and related
1056
+ * context for the expression.
1057
+ */
1058
+ bind(controller: ExpressionController<TSource, TParent>): TReturn;
1059
+ }
1088
1060
 
1089
1061
  /**
1090
1062
  * The FAST global.
@@ -1101,7 +1073,7 @@ export declare interface FASTElement extends HTMLElement {
1101
1073
  * The underlying controller that handles the lifecycle and rendering of
1102
1074
  * this FASTElement.
1103
1075
  */
1104
- readonly $fastController: Controller;
1076
+ readonly $fastController: ElementController;
1105
1077
  /**
1106
1078
  * Emits a custom HTML event.
1107
1079
  * @param type - The type name of the event.
@@ -1142,23 +1114,11 @@ export declare interface FASTElement extends HTMLElement {
1142
1114
  * static helpers for working with FASTElements.
1143
1115
  * @public
1144
1116
  */
1145
- export declare const FASTElement: (new () => HTMLElement & FASTElement) & {
1146
- /**
1147
- * Creates a new FASTElement base class inherited from the
1148
- * provided base type.
1149
- * @param BaseType - The base element type to inherit from.
1150
- */
1151
- from<TBase extends {
1152
- new (): HTMLElement;
1153
- prototype: HTMLElement;
1154
- }>(BaseType: TBase): new () => InstanceType<TBase> & FASTElement;
1155
- /**
1156
- * Defines a platform custom element based on the provided type and definition.
1157
- * @param type - The custom element type to define.
1158
- * @param nameOrDef - The name of the element to define or a definition object
1159
- * that describes the element to define.
1160
- */
1161
- define<TType extends Constructable<HTMLElement>>(type: TType, nameOrDef?: string | PartialFASTElementDefinition): TType;
1117
+ export declare const FASTElement: {
1118
+ new (): FASTElement;
1119
+ define: typeof define;
1120
+ compose: typeof compose;
1121
+ from: typeof from;
1162
1122
  };
1163
1123
 
1164
1124
  /**
@@ -1166,7 +1126,7 @@ export declare const FASTElement: (new () => HTMLElement & FASTElement) & {
1166
1126
  * @public
1167
1127
  */
1168
1128
  export declare class FASTElementDefinition<TType extends Constructable<HTMLElement> = Constructable<HTMLElement>> {
1169
- private observedAttributes;
1129
+ private platformDefined;
1170
1130
  /**
1171
1131
  * The type this element definition describes.
1172
1132
  */
@@ -1202,23 +1162,36 @@ export declare class FASTElementDefinition<TType extends Constructable<HTMLEleme
1202
1162
  /**
1203
1163
  * Options controlling the creation of the custom element's shadow DOM.
1204
1164
  */
1205
- readonly shadowOptions?: ShadowRootInit;
1165
+ readonly shadowOptions?: ShadowRootOptions;
1206
1166
  /**
1207
1167
  * Options controlling how the custom element is defined with the platform.
1208
1168
  */
1209
- readonly elementOptions?: ElementDefinitionOptions;
1169
+ readonly elementOptions: ElementDefinitionOptions;
1210
1170
  /**
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.
1171
+ * The registry to register this component in by default.
1215
1172
  */
1216
- constructor(type: TType, nameOrConfig?: PartialFASTElementDefinition | string);
1173
+ readonly registry: CustomElementRegistry;
1174
+ private constructor();
1217
1175
  /**
1218
1176
  * Defines a custom element based on this definition.
1219
1177
  * @param registry - The element registry to define the element in.
1178
+ * @remarks
1179
+ * This operation is idempotent per registry.
1220
1180
  */
1221
1181
  define(registry?: CustomElementRegistry): this;
1182
+ /**
1183
+ * Creates an instance of FASTElementDefinition.
1184
+ * @param type - The type this definition is being created for.
1185
+ * @param nameOrDef - The name of the element to define or a config object
1186
+ * that describes the element to define.
1187
+ */
1188
+ static compose<TType extends Constructable<HTMLElement> = Constructable<HTMLElement>>(type: TType, nameOrDef?: string | PartialFASTElementDefinition): FASTElementDefinition<TType>;
1189
+ /**
1190
+ * Registers a FASTElement base type.
1191
+ * @param type - The type to register as a base type.
1192
+ * @internal
1193
+ */
1194
+ static registerBaseType(type: Function): void;
1222
1195
  /**
1223
1196
  * Gets the element definition associated with the specified type.
1224
1197
  * @param type - The custom element type to retrieve the definition for.
@@ -1250,22 +1223,96 @@ export declare interface FASTGlobal {
1250
1223
  /**
1251
1224
  * Sends a warning to the developer.
1252
1225
  * @param code - The warning code to send.
1253
- * @param args - Args relevant for the warning.
1226
+ * @param values - Values relevant for the warning message.
1254
1227
  */
1255
- warn(code: number, ...args: any[]): void;
1228
+ warn(code: number, values?: Record<string, any>): void;
1256
1229
  /**
1257
1230
  * Creates an error.
1258
1231
  * @param code - The error code to send.
1259
- * @param args - Args relevant for the error.
1232
+ * @param values - Values relevant for the error message.
1260
1233
  */
1261
- error(code: number, ...args: any[]): Error;
1234
+ error(code: number, values?: Record<string, any>): Error;
1262
1235
  /**
1263
1236
  * Adds debug messages for errors and warnings.
1264
1237
  * @param messages - The message dictionary to add.
1238
+ * @remarks
1239
+ * Message can include placeholders like $\{name\} which can be
1240
+ * replaced by values passed at runtime.
1265
1241
  */
1266
1242
  addMessages(messages: Record<number, string>): void;
1267
1243
  }
1268
1244
 
1245
+ declare function from<TBase extends typeof HTMLElement>(BaseType: TBase): new () => InstanceType<TBase> & FASTElement;
1246
+
1247
+ /**
1248
+ * Represents an object that can contribute behavior to a host.
1249
+ * @public
1250
+ */
1251
+ export declare interface HostBehavior<TSource = any> {
1252
+ /**
1253
+ * Executed when this behavior is attached to a controller.
1254
+ * @param controller - Controls the behavior lifecycle.
1255
+ */
1256
+ addedCallback?(controller: HostController<TSource>): void;
1257
+ /**
1258
+ * Executed when this behavior is detached from a controller.
1259
+ * @param controller - Controls the behavior lifecycle.
1260
+ */
1261
+ removedCallback?(controller: HostController<TSource>): void;
1262
+ /**
1263
+ * Executed when this behavior's host is connected.
1264
+ * @param controller - Controls the behavior lifecycle.
1265
+ */
1266
+ connectedCallback?(controller: HostController<TSource>): void;
1267
+ /**
1268
+ * Executed when this behavior's host is disconnected.
1269
+ * @param controller - Controls the behavior lifecycle.
1270
+ */
1271
+ disconnectedCallback?(controller: HostController<TSource>): void;
1272
+ }
1273
+
1274
+ /**
1275
+ * Controls the lifecycle and context of behaviors and styles
1276
+ * associated with a component host.
1277
+ * @public
1278
+ */
1279
+ export declare interface HostController<TSource = any> {
1280
+ /**
1281
+ * The component source.
1282
+ */
1283
+ readonly source: TSource;
1284
+ /**
1285
+ * Indicates whether the host is connected or not.
1286
+ */
1287
+ readonly isConnected: boolean;
1288
+ /**
1289
+ * The main set of styles used for the component, independent
1290
+ * of any behavior-specific styles.
1291
+ */
1292
+ mainStyles: ElementStyles | null;
1293
+ /**
1294
+ * Adds the behavior to the component.
1295
+ * @param behavior - The behavior to add.
1296
+ */
1297
+ addBehavior(behavior: HostBehavior<TSource>): void;
1298
+ /**
1299
+ * Removes the behavior from the component.
1300
+ * @param behavior - The behavior to remove.
1301
+ * @param force - Forces removal even if this behavior was added more than once.
1302
+ */
1303
+ removeBehavior(behavior: HostBehavior<TSource>, force?: boolean): void;
1304
+ /**
1305
+ * Adds styles to this element. Providing an HTMLStyleElement will attach the element instance to the shadowRoot.
1306
+ * @param styles - The styles to add.
1307
+ */
1308
+ addStyles(styles: ElementStyles | HTMLStyleElement | null | undefined): void;
1309
+ /**
1310
+ * Removes styles from this element. Providing an HTMLStyleElement will detach the element instance from the shadowRoot.
1311
+ * @param styles - the styles to remove.
1312
+ */
1313
+ removeStyles(styles: ElementStyles | HTMLStyleElement | null | undefined): void;
1314
+ }
1315
+
1269
1316
  /**
1270
1317
  * Transforms a template literal string into a ViewTemplate.
1271
1318
  * @param strings - The string fragments that are interpolated with the values.
@@ -1275,17 +1322,16 @@ export declare interface FASTGlobal {
1275
1322
  * other template instances, and Directive instances.
1276
1323
  * @public
1277
1324
  */
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>;
1325
+ export declare function html<TSource = any, TParent = any>(strings: TemplateStringsArray, ...values: TemplateValue<TSource, TParent>[]): ViewTemplate<TSource, TParent>;
1279
1326
 
1280
1327
  /**
1281
1328
  * A directive that applies bindings.
1282
1329
  * @public
1283
1330
  */
1284
- export declare class HTMLBindingDirective implements HTMLDirective, ViewBehaviorFactory, Aspected {
1285
- binding: Binding;
1286
- mode: BindingMode;
1287
- options: any;
1288
- private factory;
1331
+ export declare class HTMLBindingDirective implements HTMLDirective, ViewBehaviorFactory, ViewBehavior, Aspected {
1332
+ dataBinding: Binding;
1333
+ private data;
1334
+ private updateTarget;
1289
1335
  /**
1290
1336
  * The unique id of the factory.
1291
1337
  */
@@ -1308,11 +1354,9 @@ export declare class HTMLBindingDirective implements HTMLDirective, ViewBehavior
1308
1354
  aspectType: Aspect;
1309
1355
  /**
1310
1356
  * 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.
1357
+ * @param dataBinding - The binding configuration to apply.
1314
1358
  */
1315
- constructor(binding: Binding, mode: BindingMode, options: any);
1359
+ constructor(dataBinding: Binding);
1316
1360
  /**
1317
1361
  * Creates HTML to be used within a template.
1318
1362
  * @param add - Can be used to add behavior factories to a template.
@@ -1320,9 +1364,22 @@ export declare class HTMLBindingDirective implements HTMLDirective, ViewBehavior
1320
1364
  createHTML(add: AddViewBehaviorFactory): string;
1321
1365
  /**
1322
1366
  * Creates a behavior.
1323
- * @param targets - The targets available for behaviors to be attached to.
1324
1367
  */
1325
- createBehavior(targets: ViewBehaviorTargets): ViewBehavior;
1368
+ createBehavior(): ViewBehavior;
1369
+ /** @internal */
1370
+ bindDefault(controller: ViewController): void;
1371
+ /** @internal */
1372
+ bind: (controller: ViewController) => void;
1373
+ /** @internal */
1374
+ bindContent(controller: ViewController): void;
1375
+ /** @internal */
1376
+ bindEvent(controller: ViewController): void;
1377
+ /** @internal */
1378
+ unbind(controller: ViewController): void;
1379
+ /** @internal */
1380
+ handleEvent(event: Event): void;
1381
+ /** @internal */
1382
+ handleChange(binding: Expression, observer: ExpressionObserver): void;
1326
1383
  }
1327
1384
 
1328
1385
  /**
@@ -1382,149 +1439,157 @@ export declare interface HTMLDirectiveDefinition<TType extends Constructable<HTM
1382
1439
  * The result of a template compilation operation.
1383
1440
  * @public
1384
1441
  */
1385
- export declare interface HTMLTemplateCompilationResult<TSource = any, TParent = any, TContext extends ExecutionContext<TParent> = ExecutionContext<TParent>> {
1442
+ export declare interface HTMLTemplateCompilationResult<TSource = any, TParent = any> {
1386
1443
  /**
1387
1444
  * Creates a view instance.
1388
1445
  * @param hostBindingTarget - The host binding target for the view.
1389
1446
  */
1390
- createView(hostBindingTarget?: Element): HTMLView<TSource, TParent, TContext>;
1447
+ createView(hostBindingTarget?: Element): HTMLView<TSource, TParent>;
1391
1448
  }
1392
1449
 
1393
1450
  /**
1394
1451
  * The standard View implementation, which also implements ElementView and SyntheticView.
1395
1452
  * @public
1396
1453
  */
1397
- export declare class HTMLView<TSource = any, TParent = any, TContext extends ExecutionContext<TParent> = ExecutionContext<TParent>> implements ElementView<TSource, TParent>, SyntheticView<TSource, TParent, TContext> {
1454
+ export declare class HTMLView<TSource = any, TParent = any> implements ElementView<TSource, TParent>, SyntheticView<TSource, TParent>, ExecutionContext<TParent> {
1398
1455
  private fragment;
1399
1456
  private factories;
1400
- private targets;
1457
+ readonly targets: ViewBehaviorTargets;
1401
1458
  private behaviors;
1459
+ private unbindables;
1402
1460
  /**
1403
1461
  * The data that the view is bound to.
1404
1462
  */
1405
1463
  source: TSource | null;
1464
+ /**
1465
+ * Indicates whether the controller is bound.
1466
+ */
1467
+ isBound: boolean;
1468
+ /**
1469
+ * Indicates how the source's lifetime relates to the controller's lifetime.
1470
+ */
1471
+ readonly sourceLifetime: SourceLifetime;
1406
1472
  /**
1407
1473
  * The execution context the view is running within.
1408
1474
  */
1409
- context: TContext | null;
1475
+ context: ExecutionContext<TParent>;
1410
1476
  /**
1411
- * The first DOM node in the range of nodes that make up the view.
1477
+ * The index of the current item within a repeat context.
1412
1478
  */
1413
- firstChild: Node;
1479
+ index: number;
1414
1480
  /**
1415
- * The last DOM node in the range of nodes that make up the view.
1481
+ * The length of the current collection within a repeat context.
1416
1482
  */
1417
- lastChild: Node;
1483
+ length: number;
1418
1484
  /**
1419
- * Constructs an instance of HTMLView.
1420
- * @param fragment - The html fragment that contains the nodes for this view.
1421
- * @param behaviors - The behaviors to be applied to this view.
1485
+ * The parent data source within a nested context.
1422
1486
  */
1423
- constructor(fragment: DocumentFragment, factories: ReadonlyArray<ViewBehaviorFactory>, targets: ViewBehaviorTargets);
1487
+ readonly parent: TParent;
1424
1488
  /**
1425
- * Appends the view's DOM nodes to the referenced node.
1426
- * @param node - The parent node to append the view's DOM nodes to.
1489
+ * The parent execution context when in nested context scenarios.
1427
1490
  */
1428
- appendTo(node: Node): void;
1491
+ readonly parentContext: ExecutionContext<TParent>;
1429
1492
  /**
1430
- * Inserts the view's DOM nodes before the referenced node.
1431
- * @param node - The node to insert the view's DOM before.
1493
+ * The current event within an event handler.
1432
1494
  */
1433
- insertBefore(node: Node): void;
1495
+ get event(): Event;
1434
1496
  /**
1435
- * Removes the view's DOM nodes.
1436
- * The nodes are not disposed and the view can later be re-inserted.
1497
+ * Indicates whether the current item within a repeat context
1498
+ * has an even index.
1437
1499
  */
1438
- remove(): void;
1500
+ get isEven(): boolean;
1439
1501
  /**
1440
- * Removes the view and unbinds its behaviors, disposing of DOM nodes afterward.
1441
- * Once a view has been disposed, it cannot be inserted or bound again.
1502
+ * Indicates whether the current item within a repeat context
1503
+ * has an odd index.
1442
1504
  */
1443
- dispose(): void;
1505
+ get isOdd(): boolean;
1444
1506
  /**
1445
- * Binds a view's behaviors to its binding source.
1446
- * @param source - The binding source for the view's binding behaviors.
1447
- * @param context - The execution context to run the behaviors within.
1507
+ * Indicates whether the current item within a repeat context
1508
+ * is the first item in the collection.
1448
1509
  */
1449
- bind(source: TSource, context: TContext): void;
1510
+ get isFirst(): boolean;
1450
1511
  /**
1451
- * Unbinds a view's behaviors from its binding source.
1512
+ * Indicates whether the current item within a repeat context
1513
+ * is somewhere in the middle of the collection.
1452
1514
  */
1453
- unbind(): void;
1515
+ get isInMiddle(): boolean;
1454
1516
  /**
1455
- * Efficiently disposes of a contiguous range of synthetic view instances.
1456
- * @param views - A contiguous range of views to be disposed.
1517
+ * Indicates whether the current item within a repeat context
1518
+ * is the last item in the collection.
1457
1519
  */
1458
- static disposeContiguousBatch(views: SyntheticView[]): void;
1459
- }
1460
-
1461
- /**
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> {
1520
+ get isLast(): boolean;
1477
1521
  /**
1478
- * The index of the current item within a repeat context.
1522
+ * Returns the typed event detail of a custom event.
1479
1523
  */
1480
- readonly index: number;
1524
+ eventDetail<TDetail>(): TDetail;
1481
1525
  /**
1482
- * The length of the current collection within a repeat context.
1526
+ * Returns the typed event target of the event.
1483
1527
  */
1484
- readonly length: number;
1528
+ eventTarget<TTarget extends EventTarget>(): TTarget;
1485
1529
  /**
1486
- * Indicates whether the current item within a repeat context
1487
- * has an even index.
1530
+ * The first DOM node in the range of nodes that make up the view.
1488
1531
  */
1489
- readonly isEven: boolean;
1532
+ firstChild: Node;
1490
1533
  /**
1491
- * Indicates whether the current item within a repeat context
1492
- * has an odd index.
1534
+ * The last DOM node in the range of nodes that make up the view.
1535
+ */
1536
+ lastChild: Node;
1537
+ /**
1538
+ * Constructs an instance of HTMLView.
1539
+ * @param fragment - The html fragment that contains the nodes for this view.
1540
+ * @param behaviors - The behaviors to be applied to this view.
1541
+ */
1542
+ constructor(fragment: DocumentFragment, factories: ReadonlyArray<ViewBehaviorFactory>, targets: ViewBehaviorTargets);
1543
+ /**
1544
+ * Appends the view's DOM nodes to the referenced node.
1545
+ * @param node - The parent node to append the view's DOM nodes to.
1546
+ */
1547
+ appendTo(node: Node): void;
1548
+ /**
1549
+ * Inserts the view's DOM nodes before the referenced node.
1550
+ * @param node - The node to insert the view's DOM before.
1551
+ */
1552
+ insertBefore(node: Node): void;
1553
+ /**
1554
+ * Removes the view's DOM nodes.
1555
+ * The nodes are not disposed and the view can later be re-inserted.
1493
1556
  */
1494
- readonly isOdd: boolean;
1557
+ remove(): void;
1495
1558
  /**
1496
- * Indicates whether the current item within a repeat context
1497
- * is the first item in the collection.
1559
+ * Removes the view and unbinds its behaviors, disposing of DOM nodes afterward.
1560
+ * Once a view has been disposed, it cannot be inserted or bound again.
1498
1561
  */
1499
- readonly isFirst: boolean;
1562
+ dispose(): void;
1563
+ onUnbind(behavior: {
1564
+ unbind(controller: ViewController<TSource, TParent>): any;
1565
+ }): void;
1500
1566
  /**
1501
- * Indicates whether the current item within a repeat context
1502
- * is somewhere in the middle of the collection.
1567
+ * Binds a view's behaviors to its binding source.
1568
+ * @param source - The binding source for the view's binding behaviors.
1569
+ * @param context - The execution context to run the behaviors within.
1503
1570
  */
1504
- readonly isInMiddle: boolean;
1571
+ bind(source: TSource, context?: ExecutionContext<TParent>): void;
1505
1572
  /**
1506
- * Indicates whether the current item within a repeat context
1507
- * is the last item in the collection.
1573
+ * Unbinds a view's behaviors from its binding source.
1508
1574
  */
1509
- readonly isLast: boolean;
1575
+ unbind(): void;
1576
+ private evaluateUnbindables;
1510
1577
  /**
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.
1578
+ * Efficiently disposes of a contiguous range of synthetic view instances.
1579
+ * @param views - A contiguous range of views to be disposed.
1514
1580
  */
1515
- updatePosition(index: number, length: number): void;
1581
+ static disposeContiguousBatch(views: SyntheticView[]): void;
1516
1582
  }
1517
1583
 
1518
1584
  /**
1519
- * A template capable of rendering item views not specifically connected to custom elements.
1585
+ * Observes array lengths.
1520
1586
  * @public
1521
1587
  */
1522
- export declare interface ItemViewTemplate<TSource = any, TParent = any> {
1523
- type: "item";
1588
+ export declare interface LengthObserver extends Subscriber {
1524
1589
  /**
1525
- * Creates a SyntheticView instance based on this template definition.
1590
+ * The length of the observed array.
1526
1591
  */
1527
- create(): SyntheticView<TSource, TParent, ItemContext<TParent>>;
1592
+ length: number;
1528
1593
  }
1529
1594
 
1530
1595
  /**
@@ -1533,19 +1598,16 @@ export declare interface ItemViewTemplate<TSource = any, TParent = any> {
1533
1598
  * @returns The length of the array.
1534
1599
  * @public
1535
1600
  */
1536
- declare function length_2<T>(array: readonly T[]): number;
1537
- export { length_2 as length }
1601
+ export declare function lengthOf<T>(array: readonly T[]): number;
1538
1602
 
1539
1603
  /**
1540
- * Observes array lengths.
1604
+ * Creates an event listener binding.
1605
+ * @param binding - The binding to invoke when the event is raised.
1606
+ * @param options - Event listener options.
1607
+ * @returns A binding configuration.
1541
1608
  * @public
1542
1609
  */
1543
- export declare interface LengthObserver extends Subscriber {
1544
- /**
1545
- * The length of the observed array.
1546
- */
1547
- length: number;
1548
- }
1610
+ export declare function listener<T = any>(binding: Expression<T>, options?: AddEventListenerOptions): Binding<T>;
1549
1611
 
1550
1612
  /**
1551
1613
  * Common APIs related to markup generation.
@@ -1619,14 +1681,14 @@ export declare abstract class NodeObservationDirective<T extends NodeBehaviorOpt
1619
1681
  * @param context - The execution context that the binding is operating within.
1620
1682
  * @param targets - The targets that behaviors in a view can attach to.
1621
1683
  */
1622
- bind(source: any, context: ExecutionContext, targets: ViewBehaviorTargets): void;
1684
+ bind(controller: ViewController): void;
1623
1685
  /**
1624
1686
  * Unbinds this behavior from the source.
1625
1687
  * @param source - The source to unbind from.
1626
1688
  * @param context - The execution context that the binding is operating within.
1627
1689
  * @param targets - The targets that behaviors in a view can attach to.
1628
1690
  */
1629
- unbind(source: any, context: ExecutionContext, targets: ViewBehaviorTargets): void;
1691
+ unbind(controller: ViewController): void;
1630
1692
  /**
1631
1693
  * Gets the data source for the target.
1632
1694
  * @param target - The target to get the source for.
@@ -1664,6 +1726,14 @@ export declare abstract class NodeObservationDirective<T extends NodeBehaviorOpt
1664
1726
  protected abstract getNodes(target: any): Node[];
1665
1727
  }
1666
1728
 
1729
+ /**
1730
+ * Normalizes the input value into a binding.
1731
+ * @param value - The value to create the default binding for.
1732
+ * @returns A binding configuration for the provided value.
1733
+ * @public
1734
+ */
1735
+ export declare function normalizeBinding<TSource = any, TReturn = any, TParent = any>(value: Expression<TSource, TReturn, TParent> | Binding<TSource, TReturn, TParent> | {}): Binding<TSource, TReturn, TParent>;
1736
+
1667
1737
  /**
1668
1738
  * Provides change notifications for an observed subject.
1669
1739
  * @public
@@ -1754,19 +1824,19 @@ export declare const Observable: Readonly<{
1754
1824
  */
1755
1825
  getAccessors: (target: {}) => Accessor[];
1756
1826
  /**
1757
- * Creates a {@link BindingObserver} that can watch the
1758
- * provided {@link Binding} for changes.
1759
- * @param binding - The binding to observe.
1827
+ * Creates a {@link ExpressionNotifier} that can watch the
1828
+ * provided {@link Expression} for changes.
1829
+ * @param expression - The binding to observe.
1760
1830
  * @param initialSubscriber - An initial subscriber to changes in the binding value.
1761
1831
  * @param isVolatileBinding - Indicates whether the binding's dependency list must be re-evaluated on every value evaluation.
1762
1832
  */
1763
- binding<TSource = any, TReturn = any>(binding: Binding<TSource, TReturn, ExecutionContext<any>>, initialSubscriber?: Subscriber, isVolatileBinding?: boolean): BindingObserver<TSource, TReturn, any>;
1833
+ binding<TSource = any, TReturn = any>(expression: Expression<TSource, TReturn, any>, initialSubscriber?: Subscriber, isVolatileBinding?: boolean): ExpressionNotifier<TSource, TReturn, any>;
1764
1834
  /**
1765
1835
  * Determines whether a binding expression is volatile and needs to have its dependency list re-evaluated
1766
1836
  * on every evaluation of the value.
1767
- * @param binding - The binding to inspect.
1837
+ * @param expression - The binding to inspect.
1768
1838
  */
1769
- isVolatileBinding<TSource_1 = any, TReturn_1 = any>(binding: Binding<TSource_1, TReturn_1, ExecutionContext<any>>): boolean;
1839
+ isVolatileBinding<TSource_1 = any, TReturn_1 = any>(expression: Expression<TSource_1, TReturn_1, any>): boolean;
1770
1840
  }>;
1771
1841
 
1772
1842
  /**
@@ -1793,30 +1863,12 @@ export declare interface ObservationRecord {
1793
1863
  }
1794
1864
 
1795
1865
  /**
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.
1803
- * @public
1804
- */
1805
- export declare const oneTime: BindingConfig<AddEventListenerOptions> & BindingConfigResolver<AddEventListenerOptions>;
1806
-
1807
- /**
1808
- * A binding behavior for one-time bindings.
1866
+ * Creates a one time binding
1867
+ * @param binding - The binding to refresh when signaled.
1868
+ * @returns A binding configuration.
1809
1869
  * @public
1810
1870
  */
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
- }
1871
+ export declare function oneTime<T = any>(binding: Expression<T>): Binding<T>;
1820
1872
 
1821
1873
  /**
1822
1874
  * Common APIs related to content parsing.
@@ -1857,12 +1909,21 @@ export declare interface PartialFASTElementDefinition {
1857
1909
  readonly attributes?: (AttributeConfiguration | string)[];
1858
1910
  /**
1859
1911
  * Options controlling the creation of the custom element's shadow DOM.
1912
+ * @remarks
1913
+ * If not provided, defaults to an open shadow root. Provide null
1914
+ * to render to the associated template to the light DOM instead.
1860
1915
  */
1861
- readonly shadowOptions?: Partial<ShadowRootInit> | null;
1916
+ readonly shadowOptions?: Partial<ShadowRootOptions> | null;
1862
1917
  /**
1863
1918
  * Options controlling how the custom element is defined with the platform.
1864
1919
  */
1865
1920
  readonly elementOptions?: ElementDefinitionOptions;
1921
+ /**
1922
+ * The registry to register this component in by default.
1923
+ * @remarks
1924
+ * If not provided, defaults to the global registry.
1925
+ */
1926
+ readonly registry?: CustomElementRegistry;
1866
1927
  }
1867
1928
 
1868
1929
  /**
@@ -1918,7 +1979,7 @@ export declare class PropertyChangeNotifier implements Notifier {
1918
1979
  * @param propertyName - The name of the property to assign the reference to.
1919
1980
  * @public
1920
1981
  */
1921
- export declare const ref: <T = any>(propertyName: keyof T & string) => CaptureType<T>;
1982
+ export declare const ref: <TSource = any, TParent = any>(propertyName: keyof TSource & string) => CaptureType<TSource, TParent>;
1922
1983
 
1923
1984
  /**
1924
1985
  * The runtime behavior for template references.
@@ -1926,117 +1987,56 @@ export declare const ref: <T = any>(propertyName: keyof T & string) => CaptureTy
1926
1987
  */
1927
1988
  export declare class RefDirective extends StatelessAttachedAttributeDirective<string> {
1928
1989
  /**
1929
- * Bind this behavior to the source.
1930
- * @param source - The source to bind to.
1931
- * @param context - The execution context that the binding is operating within.
1932
- * @param targets - The targets that behaviors in a view can attach to.
1933
- */
1934
- bind(source: any, context: ExecutionContext, targets: ViewBehaviorTargets): void;
1935
- /**
1936
- * Unbinds this behavior from the source.
1937
- * @param source - The source to unbind from.
1990
+ * Bind this behavior.
1991
+ * @param controller - The view controller that manages the lifecycle of this behavior.
1938
1992
  */
1939
- unbind(): void;
1993
+ bind(controller: ViewController): void;
1940
1994
  }
1941
1995
 
1942
1996
  declare const reflectMode = "reflect";
1943
1997
 
1944
1998
  /**
1945
1999
  * 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
2000
+ * @param items - The array to render.
2001
+ * @param template - The template or a template binding used obtain a template
1988
2002
  * to render for each item in the array.
1989
2003
  * @param options - Options used to turn on special repeat features.
1990
2004
  * @public
1991
2005
  */
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>;
2006
+ export declare function repeat<TSource = any, TArray extends ReadonlyArray<any> = ReadonlyArray<any>, TParent = any>(items: Expression<TSource, TArray, TParent> | Binding<TSource, TArray, TParent> | ReadonlyArray<any>, template: Expression<TSource, ViewTemplate<any, TSource>> | Binding<TSource, ViewTemplate<any, TSource>> | ViewTemplate<any, TSource>, options?: RepeatOptions): CaptureType<TSource, TParent>;
2001
2007
 
2002
2008
  /**
2003
2009
  * A behavior that renders a template for each item in an array.
2004
2010
  * @public
2005
2011
  */
2006
- export declare class RepeatBehavior<TSource = any> implements Behavior, Subscriber {
2012
+ export declare class RepeatBehavior<TSource = any> implements ViewBehavior, Subscriber {
2013
+ private directive;
2007
2014
  private location;
2008
- private itemsBinding;
2009
- private templateBinding;
2010
- private options;
2011
- private source;
2015
+ private controller;
2012
2016
  private views;
2013
2017
  private template;
2014
2018
  private templateBindingObserver;
2015
2019
  private items;
2016
2020
  private itemsObserver;
2017
2021
  private itemsBindingObserver;
2018
- private context;
2019
- private childContext;
2020
2022
  private bindView;
2021
2023
  /**
2022
2024
  * Creates an instance of RepeatBehavior.
2023
2025
  * @param location - The location in the DOM to render the repeat.
2024
- * @param itemsBinding - The array to render.
2026
+ * @param dataBinding - The array to render.
2025
2027
  * @param isItemsBindingVolatile - Indicates whether the items binding has volatile dependencies.
2026
2028
  * @param templateBinding - The template to render for each item.
2027
2029
  * @param isTemplateBindingVolatile - Indicates whether the template binding has volatile dependencies.
2028
2030
  * @param options - Options used to turn on special repeat features.
2029
2031
  */
2030
- constructor(location: Node, itemsBinding: Binding<TSource, any[]>, isItemsBindingVolatile: boolean, templateBinding: Binding<TSource, SyntheticViewTemplate>, isTemplateBindingVolatile: boolean, options: RepeatOptions);
2032
+ constructor(directive: RepeatDirective);
2031
2033
  /**
2032
- * Bind this behavior to the source.
2033
- * @param source - The source to bind to.
2034
- * @param context - The execution context that the binding is operating within.
2034
+ * Bind this behavior.
2035
+ * @param controller - The view controller that manages the lifecycle of this behavior.
2035
2036
  */
2036
- bind(source: TSource, context: ExecutionContext): void;
2037
+ bind(controller: ViewController): void;
2037
2038
  /**
2038
- * Unbinds this behavior from the source.
2039
- * @param source - The source to unbind from.
2039
+ * Unbinds this behavior.
2040
2040
  */
2041
2041
  unbind(): void;
2042
2042
  /**
@@ -2044,7 +2044,7 @@ export declare class RepeatBehavior<TSource = any> implements Behavior, Subscrib
2044
2044
  * @param source - The source of the change.
2045
2045
  * @param args - The details about what was changed.
2046
2046
  */
2047
- handleChange(source: any, args: Splice[]): void;
2047
+ handleChange(source: any, args: Splice[] | ExpressionObserver): void;
2048
2048
  private observeItems;
2049
2049
  private updateViews;
2050
2050
  private refreshAllViews;
@@ -2056,11 +2056,9 @@ export declare class RepeatBehavior<TSource = any> implements Behavior, Subscrib
2056
2056
  * @public
2057
2057
  */
2058
2058
  export declare class RepeatDirective<TSource = any> implements HTMLDirective, ViewBehaviorFactory {
2059
- readonly itemsBinding: Binding;
2059
+ readonly dataBinding: Binding<TSource>;
2060
2060
  readonly templateBinding: Binding<TSource, SyntheticViewTemplate>;
2061
2061
  readonly options: RepeatOptions;
2062
- private isItemsBindingVolatile;
2063
- private isTemplateBindingVolatile;
2064
2062
  /**
2065
2063
  * The unique id of the factory.
2066
2064
  */
@@ -2076,16 +2074,16 @@ export declare class RepeatDirective<TSource = any> implements HTMLDirective, Vi
2076
2074
  createHTML(add: AddViewBehaviorFactory): string;
2077
2075
  /**
2078
2076
  * Creates an instance of RepeatDirective.
2079
- * @param itemsBinding - The binding that provides the array to render.
2077
+ * @param dataBinding - The binding that provides the array to render.
2080
2078
  * @param templateBinding - The template binding used to obtain a template to render for each item in the array.
2081
2079
  * @param options - Options used to turn on special repeat features.
2082
2080
  */
2083
- constructor(itemsBinding: Binding, templateBinding: Binding<TSource, SyntheticViewTemplate>, options: RepeatOptions);
2081
+ constructor(dataBinding: Binding<TSource>, templateBinding: Binding<TSource, SyntheticViewTemplate>, options: RepeatOptions);
2084
2082
  /**
2085
2083
  * Creates a behavior for the provided target node.
2086
2084
  * @param target - The node instance to create the behavior for.
2087
2085
  */
2088
- createBehavior(targets: ViewBehaviorTargets): RepeatBehavior<TSource>;
2086
+ createBehavior(): RepeatBehavior<TSource>;
2089
2087
  }
2090
2088
 
2091
2089
  /**
@@ -2104,65 +2102,16 @@ export declare interface RepeatOptions {
2104
2102
  }
2105
2103
 
2106
2104
  /**
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.
2105
+ * Shadow root initialization options.
2141
2106
  * @public
2142
2107
  */
2143
- export declare class SignalBinding extends UpdateBinding {
2144
- private handlerProperty;
2108
+ export declare interface ShadowRootOptions extends ShadowRootInit {
2145
2109
  /**
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
2110
+ * A registry that provides the custom elements visible
2111
+ * from within this shadow root.
2112
+ * @beta
2164
2113
  */
2165
- static send(signal: string): void;
2114
+ registry?: CustomElementRegistry;
2166
2115
  }
2167
2116
 
2168
2117
  /**
@@ -2171,7 +2120,7 @@ export declare class SignalBinding extends UpdateBinding {
2171
2120
  * @param propertyOrOptions - The options used to configure slotted node observation.
2172
2121
  * @public
2173
2122
  */
2174
- export declare function slotted<T = any>(propertyOrOptions: (keyof T & string) | SlottedDirectiveOptions<keyof T & string>): CaptureType<T>;
2123
+ export declare function slotted<TSource = any, TParent = any>(propertyOrOptions: (keyof TSource & string) | SlottedDirectiveOptions<keyof TSource & string>): CaptureType<TSource, TParent>;
2175
2124
 
2176
2125
  /**
2177
2126
  * The runtime behavior for slotted node observation.
@@ -2204,6 +2153,28 @@ export declare class SlottedDirective extends NodeObservationDirective<SlottedDi
2204
2153
  export declare interface SlottedDirectiveOptions<T = any> extends NodeBehaviorOptions<T>, AssignedNodesOptions {
2205
2154
  }
2206
2155
 
2156
+ /**
2157
+ * Describes how the source's lifetime relates to its controller's lifetime.
2158
+ * @public
2159
+ */
2160
+ export declare const SourceLifetime: Readonly<{
2161
+ /**
2162
+ * The source to controller lifetime relationship is unknown.
2163
+ */
2164
+ readonly unknown: undefined;
2165
+ /**
2166
+ * The source and controller lifetimes are coupled to one another.
2167
+ * They can/will be GC'd together.
2168
+ */
2169
+ readonly coupled: 1;
2170
+ }>;
2171
+
2172
+ /**
2173
+ * Describes how the source's lifetime relates to its controller's lifetime.
2174
+ * @public
2175
+ */
2176
+ export declare type SourceLifetime = typeof SourceLifetime[keyof typeof SourceLifetime];
2177
+
2207
2178
  /**
2208
2179
  * A splice map is a representation of how a previous array of items
2209
2180
  * was transformed into a new array of items. Conceptually it is a list of
@@ -2360,8 +2331,8 @@ export declare type SpliceStrategySupport = typeof SpliceStrategySupport[keyof t
2360
2331
  * A base class used for attribute directives that don't need internal state.
2361
2332
  * @public
2362
2333
  */
2363
- export declare abstract class StatelessAttachedAttributeDirective<T> implements HTMLDirective, ViewBehaviorFactory, ViewBehavior {
2364
- protected options: T;
2334
+ export declare abstract class StatelessAttachedAttributeDirective<TOptions> implements HTMLDirective, ViewBehaviorFactory, ViewBehavior {
2335
+ protected options: TOptions;
2365
2336
  /**
2366
2337
  * The unique id of the factory.
2367
2338
  */
@@ -2374,12 +2345,7 @@ export declare abstract class StatelessAttachedAttributeDirective<T> implements
2374
2345
  * Creates an instance of RefDirective.
2375
2346
  * @param options - The options to use in configuring the directive.
2376
2347
  */
2377
- constructor(options: T);
2378
- /**
2379
- * Creates a behavior.
2380
- * @param targets - The targets available for behaviors to be attached to.
2381
- */
2382
- createBehavior(targets: ViewBehaviorTargets): ViewBehavior;
2348
+ constructor(options: TOptions);
2383
2349
  /**
2384
2350
  * Creates a placeholder string based on the directive's index within the template.
2385
2351
  * @param index - The index of the directive within the template.
@@ -2388,17 +2354,15 @@ export declare abstract class StatelessAttachedAttributeDirective<T> implements
2388
2354
  */
2389
2355
  createHTML(add: AddViewBehaviorFactory): string;
2390
2356
  /**
2391
- * Bind this behavior to the source.
2392
- * @param source - The source to bind to.
2393
- * @param context - The execution context that the binding is operating within.
2394
- * @param targets - The targets that behaviors in a view can attach to.
2357
+ * Creates a behavior.
2358
+ * @param targets - The targets available for behaviors to be attached to.
2395
2359
  */
2396
- abstract bind(source: any, context: ExecutionContext, targets: ViewBehaviorTargets): void;
2360
+ createBehavior(): ViewBehavior;
2397
2361
  /**
2398
- * Unbinds this behavior from the source.
2399
- * @param source - The source to unbind from.
2362
+ * Bind this behavior.
2363
+ * @param controller - The view controller that manages the lifecycle of this behavior.
2400
2364
  */
2401
- abstract unbind(source: any, context: ExecutionContext, targets: ViewBehaviorTargets): void;
2365
+ abstract bind(controller: ViewController): void;
2402
2366
  }
2403
2367
 
2404
2368
  /**
@@ -2423,7 +2387,7 @@ export declare interface StyleStrategy {
2423
2387
  * A node that can be targeted by styles.
2424
2388
  * @public
2425
2389
  */
2426
- export declare interface StyleTarget {
2390
+ export declare interface StyleTarget extends Pick<Node, "getRootNode"> {
2427
2391
  /**
2428
2392
  * Stylesheets to be adopted by the node.
2429
2393
  */
@@ -2525,7 +2489,7 @@ export declare interface SubtreeDirectiveOptions<T = any> extends NodeBehaviorOp
2525
2489
  * A view representing a range of DOM nodes which can be added/removed ad hoc.
2526
2490
  * @public
2527
2491
  */
2528
- export declare interface SyntheticView<TSource = any, TParent = any, TContext extends ExecutionContext<TParent> = ExecutionContext<TParent>> extends View<TSource, TParent, TContext> {
2492
+ export declare interface SyntheticView<TSource = any, TParent = any> extends View<TSource, TParent> {
2529
2493
  /**
2530
2494
  * The first DOM node in the range of nodes that make up the view.
2531
2495
  */
@@ -2550,19 +2514,18 @@ export declare interface SyntheticView<TSource = any, TParent = any, TContext ex
2550
2514
  * A template capable of rendering views not specifically connected to custom elements.
2551
2515
  * @public
2552
2516
  */
2553
- export declare interface SyntheticViewTemplate<TSource = any, TParent = any, TContext extends ExecutionContext<TParent> = ExecutionContext<TParent>> {
2554
- type: "synthetic";
2517
+ export declare interface SyntheticViewTemplate<TSource = any, TParent = any> {
2555
2518
  /**
2556
2519
  * Creates a SyntheticView instance based on this template definition.
2557
2520
  */
2558
- create(): SyntheticView<TSource, TParent, TContext>;
2521
+ create(): SyntheticView<TSource, TParent>;
2559
2522
  }
2560
2523
 
2561
2524
  /**
2562
2525
  * Represents the types of values that can be interpolated into a template.
2563
2526
  * @public
2564
2527
  */
2565
- export declare type TemplateValue<TSource, TParent = any, TContext extends ExecutionContext<TParent> = ExecutionContext<TParent>> = Binding<TSource, any, TContext> | HTMLDirective | CaptureType<TSource>;
2528
+ export declare type TemplateValue<TSource, TParent = any> = Expression<TSource, any, TParent> | Binding<TSource, any, TParent> | HTMLDirective | CaptureType<TSource, TParent>;
2566
2529
 
2567
2530
  /**
2568
2531
  * Enables working with trusted types.
@@ -2589,54 +2552,6 @@ export declare type TrustedTypesPolicy = {
2589
2552
  createHTML(html: string): string;
2590
2553
  };
2591
2554
 
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
2555
  /**
2641
2556
  * Do not change. Part of shared kernel contract.
2642
2557
  * @internal
@@ -2655,40 +2570,6 @@ export declare interface TypeRegistry<TDefinition extends TypeDefinition> {
2655
2570
  getForInstance(object: any): TDefinition | undefined;
2656
2571
  }
2657
2572
 
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
2573
  /**
2693
2574
  * A work queue used to synchronize writes to the DOM.
2694
2575
  * @public
@@ -2730,29 +2611,6 @@ export declare interface UpdateQueue {
2730
2611
  */
2731
2612
  export declare const Updates: UpdateQueue;
2732
2613
 
2733
- /**
2734
- * A target update function.
2735
- * @param this - The "this" context for the update.
2736
- * @param target - The node that is targeted by the update.
2737
- * @param aspect - The aspect of the node that is being targeted.
2738
- * @param value - The value to assign to the aspect.
2739
- * @param source - The source object that the value was derived from.
2740
- * @param context - The execution context that the binding is being run under.
2741
- * @public
2742
- */
2743
- export declare type UpdateTarget = (this: UpdateTargetThis, target: Node, aspect: string, value: any, source: any, context: ExecutionContext) => void;
2744
-
2745
- /**
2746
- * The "this" context for an update target function.
2747
- * @public
2748
- */
2749
- export declare interface UpdateTargetThis {
2750
- /**
2751
- * The directive configuration for the update.
2752
- */
2753
- directive: HTMLBindingDirective;
2754
- }
2755
-
2756
2614
  /**
2757
2615
  * Represents objects that can convert values to and from
2758
2616
  * view or model representations.
@@ -2775,11 +2633,11 @@ export declare interface ValueConverter {
2775
2633
  * Represents a collection of DOM nodes which can be bound to a data source.
2776
2634
  * @public
2777
2635
  */
2778
- export declare interface View<TSource = any, TParent = any, TContext extends ExecutionContext<TParent> = ExecutionContext<TParent>> extends Disposable {
2636
+ export declare interface View<TSource = any, TParent = any> extends Disposable {
2779
2637
  /**
2780
2638
  * The execution context the view is running within.
2781
2639
  */
2782
- readonly context: TContext | null;
2640
+ readonly context: ExecutionContext<TParent>;
2783
2641
  /**
2784
2642
  * The data that the view is bound to.
2785
2643
  */
@@ -2787,9 +2645,8 @@ export declare interface View<TSource = any, TParent = any, TContext extends Exe
2787
2645
  /**
2788
2646
  * Binds a view's behaviors to its binding source.
2789
2647
  * @param source - The binding source for the view's binding behaviors.
2790
- * @param context - The execution context to run the view within.
2791
2648
  */
2792
- bind(source: TSource, context: TContext): void;
2649
+ bind(source: TSource, context?: ExecutionContext<TParent>): void;
2793
2650
  /**
2794
2651
  * Unbinds a view's behaviors from its binding source and context.
2795
2652
  */
@@ -2802,23 +2659,14 @@ export declare interface View<TSource = any, TParent = any, TContext extends Exe
2802
2659
  */
2803
2660
  export declare interface ViewBehavior<TSource = any, TParent = any> {
2804
2661
  /**
2805
- * Bind this behavior to the source.
2806
- * @param source - The source to bind to.
2807
- * @param context - The execution context that the binding is operating within.
2808
- * @param targets - The targets that behaviors in a view can attach to.
2809
- */
2810
- bind(source: TSource, context: ExecutionContext<TParent>, targets: ViewBehaviorTargets): void;
2811
- /**
2812
- * Unbinds this behavior from the source.
2813
- * @param source - The source to unbind from.
2814
- * @param context - The execution context that the binding is operating within.
2815
- * @param targets - The targets that behaviors in a view can attach to.
2662
+ * Bind this behavior.
2663
+ * @param controller - The view controller that manages the lifecycle of this behavior.
2816
2664
  */
2817
- unbind(source: TSource, context: ExecutionContext<TParent>, targets: ViewBehaviorTargets): void;
2665
+ bind(controller: ViewController<TSource, TParent>): void;
2818
2666
  }
2819
2667
 
2820
2668
  /**
2821
- * A factory that can create a {@link Behavior} associated with a particular
2669
+ * A factory that can create a {@link ViewBehavior} associated with a particular
2822
2670
  * location within a DOM fragment.
2823
2671
  * @public
2824
2672
  */
@@ -2833,11 +2681,49 @@ export declare interface ViewBehaviorFactory {
2833
2681
  nodeId: string;
2834
2682
  /**
2835
2683
  * Creates a behavior.
2836
- * @param targets - The targets available for behaviors to be attached to.
2837
2684
  */
2838
- createBehavior(targets: ViewBehaviorTargets): Behavior | ViewBehavior;
2685
+ createBehavior(): ViewBehavior;
2686
+ }
2687
+
2688
+ /**
2689
+ * Bridges between ViewBehaviors and HostBehaviors, enabling a host to
2690
+ * control ViewBehaviors.
2691
+ * @public
2692
+ */
2693
+ export declare interface ViewBehaviorOrchestrator<TSource = any, TParent = any> extends ViewController<TSource, TParent>, HostBehavior<TSource> {
2694
+ /**
2695
+ *
2696
+ * @param nodeId - The structural id of the DOM node to which a behavior will apply.
2697
+ * @param target - The DOM node associated with the id.
2698
+ */
2699
+ addTarget(nodeId: string, target: Node): void;
2700
+ /**
2701
+ * Adds a behavior.
2702
+ * @param behavior - The behavior to add.
2703
+ */
2704
+ addBehavior(behavior: ViewBehavior): void;
2705
+ /**
2706
+ * Adds a behavior factory.
2707
+ * @param factory - The behavior factory to add.
2708
+ * @param target - The target the factory will create behaviors for.
2709
+ */
2710
+ addBehaviorFactory(factory: ViewBehaviorFactory, target: Node): void;
2839
2711
  }
2840
2712
 
2713
+ /**
2714
+ * Bridges between ViewBehaviors and HostBehaviors, enabling a host to
2715
+ * control ViewBehaviors.
2716
+ * @public
2717
+ */
2718
+ export declare const ViewBehaviorOrchestrator: Readonly<{
2719
+ /**
2720
+ * Creates a ViewBehaviorOrchestrator.
2721
+ * @param source - The source to to associate behaviors with.
2722
+ * @returns A ViewBehaviorOrchestrator.
2723
+ */
2724
+ create<TSource = any, TParent = any>(source: TSource): ViewBehaviorOrchestrator<TSource, TParent>;
2725
+ }>;
2726
+
2841
2727
  /**
2842
2728
  * The target nodes available to a behavior.
2843
2729
  * @public
@@ -2847,16 +2733,22 @@ export declare type ViewBehaviorTargets = {
2847
2733
  };
2848
2734
 
2849
2735
  /**
2850
- * A template capable of creating HTMLView instances or rendering directly to DOM.
2736
+ * Controls the lifecycle of a view and provides relevant context.
2851
2737
  * @public
2852
2738
  */
2853
- export declare class ViewTemplate<TSource = any, TParent = any, TContext extends ExecutionContext<TParent> = ExecutionContext> implements ElementViewTemplate<TSource, TParent>, SyntheticViewTemplate<TSource, TParent, TContext> {
2854
- private result;
2739
+ export declare interface ViewController<TSource = any, TParent = any> extends ExpressionController<TSource, TParent> {
2855
2740
  /**
2856
- * Used for TypeScript purposes only.
2857
- * Do not use.
2741
+ * The parts of the view that are targeted by view behaviors.
2858
2742
  */
2859
- type: any;
2743
+ readonly targets: ViewBehaviorTargets;
2744
+ }
2745
+
2746
+ /**
2747
+ * A template capable of creating HTMLView instances or rendering directly to DOM.
2748
+ * @public
2749
+ */
2750
+ export declare class ViewTemplate<TSource = any, TParent = any> implements ElementViewTemplate<TSource, TParent>, SyntheticViewTemplate<TSource, TParent> {
2751
+ private result;
2860
2752
  /**
2861
2753
  * The html representing what this template will
2862
2754
  * instantiate, including placeholders for directives.
@@ -2876,7 +2768,7 @@ export declare class ViewTemplate<TSource = any, TParent = any, TContext extends
2876
2768
  * Creates an HTMLView instance based on this template definition.
2877
2769
  * @param hostBindingTarget - The element that host behaviors will be bound to.
2878
2770
  */
2879
- create(hostBindingTarget?: Element): HTMLView<TSource, TParent, TContext>;
2771
+ create(hostBindingTarget?: Element): HTMLView<TSource, TParent>;
2880
2772
  /**
2881
2773
  * Creates an HTMLView from this template, binds it to the source, and then appends it to the host.
2882
2774
  * @param source - The data source to bind the template to.
@@ -2884,7 +2776,7 @@ export declare class ViewTemplate<TSource = any, TParent = any, TContext extends
2884
2776
  * @param hostBindingTarget - An HTML element to target the host bindings at if different from the
2885
2777
  * host that the template is being attached to.
2886
2778
  */
2887
- render(source: TSource, host: Node, hostBindingTarget?: Element, context?: TContext): HTMLView<TSource, TParent, TContext>;
2779
+ render(source: TSource, host: Node, hostBindingTarget?: Element): HTMLView<TSource, TParent>;
2888
2780
  }
2889
2781
 
2890
2782
  /**
@@ -2898,11 +2790,11 @@ export declare function volatile(target: {}, name: string | Accessor, descriptor
2898
2790
 
2899
2791
  /**
2900
2792
  * A directive that enables basic conditional rendering in a template.
2901
- * @param binding - The condition to test for rendering.
2793
+ * @param condition - The condition to test for rendering.
2902
2794
  * @param templateOrTemplateBinding - The template or a binding that gets
2903
2795
  * the template to render when the condition is true.
2904
2796
  * @public
2905
2797
  */
2906
- export declare function when<TSource = any, TReturn = any>(binding: Binding<TSource, TReturn>, templateOrTemplateBinding: SyntheticViewTemplate | Binding<TSource, SyntheticViewTemplate>): CaptureType<TSource>;
2798
+ export declare function when<TSource = any, TReturn = any, TParent = any>(condition: Expression<TSource, TReturn, TParent> | boolean, templateOrTemplateBinding: SyntheticViewTemplate<TSource, TParent> | Expression<TSource, SyntheticViewTemplate<TSource, TParent>, TParent>): CaptureType<TSource, TParent>;
2907
2799
 
2908
2800
  export { }