@microsoft/fast-element 2.0.0-beta.6 → 2.0.0-beta.7

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 (64) hide show
  1. package/CHANGELOG.json +57 -0
  2. package/CHANGELOG.md +16 -1
  3. package/dist/dts/components/attributes.d.ts +10 -0
  4. package/dist/dts/components/{controller.d.ts → element-controller.d.ts} +24 -25
  5. package/dist/dts/components/fast-definitions.d.ts +28 -3
  6. package/dist/dts/components/fast-element.d.ts +2 -2
  7. package/dist/dts/di/di.d.ts +41 -0
  8. package/dist/dts/index.d.ts +2 -2
  9. package/dist/dts/observation/observable.d.ts +86 -47
  10. package/dist/dts/pending-task.d.ts +20 -0
  11. package/dist/dts/platform.d.ts +6 -0
  12. package/dist/dts/styles/css-directive.d.ts +2 -2
  13. package/dist/dts/styles/element-styles.d.ts +3 -3
  14. package/dist/dts/styles/host.d.ts +68 -0
  15. package/dist/dts/templating/binding-signal.d.ts +2 -2
  16. package/dist/dts/templating/binding-two-way.d.ts +11 -3
  17. package/dist/dts/templating/binding.d.ts +21 -119
  18. package/dist/dts/templating/children.d.ts +1 -1
  19. package/dist/dts/templating/html-directive.d.ts +69 -39
  20. package/dist/dts/templating/node-observation.d.ts +4 -5
  21. package/dist/dts/templating/ref.d.ts +5 -13
  22. package/dist/dts/templating/render.d.ts +15 -20
  23. package/dist/dts/templating/repeat.d.ts +11 -16
  24. package/dist/dts/templating/slotted.d.ts +1 -1
  25. package/dist/dts/templating/template.d.ts +4 -4
  26. package/dist/dts/templating/view.d.ts +68 -9
  27. package/dist/dts/templating/when.d.ts +1 -1
  28. package/dist/dts/testing/exports.d.ts +1 -0
  29. package/dist/dts/testing/fakes.d.ts +4 -0
  30. package/dist/dts/testing/fixture.d.ts +0 -6
  31. package/dist/esm/components/attributes.js +13 -4
  32. package/dist/esm/components/{controller.js → element-controller.js} +95 -105
  33. package/dist/esm/components/fast-definitions.js +3 -1
  34. package/dist/esm/components/fast-element.js +4 -4
  35. package/dist/esm/di/di.js +87 -3
  36. package/dist/esm/index.js +2 -1
  37. package/dist/esm/observation/observable.js +59 -126
  38. package/dist/esm/pending-task.js +16 -0
  39. package/dist/esm/platform.js +21 -0
  40. package/dist/esm/styles/css.js +4 -4
  41. package/dist/esm/{observation/behavior.js → styles/host.js} +0 -0
  42. package/dist/esm/templating/binding-signal.js +21 -17
  43. package/dist/esm/templating/binding-two-way.js +32 -27
  44. package/dist/esm/templating/binding.js +73 -177
  45. package/dist/esm/templating/html-directive.js +78 -7
  46. package/dist/esm/templating/node-observation.js +9 -8
  47. package/dist/esm/templating/ref.js +4 -12
  48. package/dist/esm/templating/render.js +30 -31
  49. package/dist/esm/templating/repeat.js +37 -38
  50. package/dist/esm/templating/template.js +3 -4
  51. package/dist/esm/templating/view.js +96 -24
  52. package/dist/esm/testing/exports.js +1 -0
  53. package/dist/esm/testing/fakes.js +76 -0
  54. package/dist/esm/testing/fixture.js +1 -3
  55. package/dist/fast-element.api.json +5720 -5385
  56. package/dist/fast-element.d.ts +510 -399
  57. package/dist/fast-element.debug.js +492 -509
  58. package/dist/fast-element.debug.min.js +1 -1
  59. package/dist/fast-element.js +492 -509
  60. package/dist/fast-element.min.js +1 -1
  61. package/dist/fast-element.untrimmed.d.ts +519 -405
  62. package/docs/api-report.md +197 -129
  63. package/package.json +5 -1
  64. package/dist/dts/observation/behavior.d.ts +0 -19
@@ -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.
@@ -176,6 +176,17 @@ export declare type AttributeConfiguration = {
176
176
  converter?: ValueConverter;
177
177
  };
178
178
 
179
+ /**
180
+ * Metadata used to configure a custom attribute's behavior.
181
+ * @public
182
+ */
183
+ export declare const AttributeConfiguration: Readonly<{
184
+ /**
185
+ * Locates all attribute configurations associated with a type.
186
+ */
187
+ locate: (target: {}) => AttributeConfiguration[];
188
+ }>;
189
+
179
190
  /**
180
191
  * An implementation of {@link Accessor} that supports reactivity,
181
192
  * change callbacks, attribute reflection, and type conversion for
@@ -247,25 +258,6 @@ export declare class AttributeDefinition implements Accessor {
247
258
  */
248
259
  export declare type AttributeMode = typeof reflectMode | typeof booleanMode | "fromView";
249
260
 
250
- /**
251
- * Represents an object that can contribute behavior to a view or
252
- * element's bind/unbind operations.
253
- * @public
254
- */
255
- export declare interface Behavior<TSource = any, TParent = any> {
256
- /**
257
- * Bind this behavior to the source.
258
- * @param source - The source to bind to.
259
- * @param context - The execution context that the binding is operating within.
260
- */
261
- bind(source: TSource, context: ExecutionContext<TParent>): void;
262
- /**
263
- * Unbinds this behavior from the source.
264
- * @param source - The source to unbind from.
265
- */
266
- unbind(source: TSource, context: ExecutionContext<TParent>): void;
267
- }
268
-
269
261
  /**
270
262
  * Creates an standard binding.
271
263
  * @param binding - The binding to refresh when changed.
@@ -281,18 +273,18 @@ export declare function bind<T = any>(binding: Expression<T>, isVolatile?: boole
281
273
  * @public
282
274
  */
283
275
  export declare abstract class Binding<TSource = any, TReturn = any, TParent = any> {
276
+ evaluate: Expression<TSource, TReturn, TParent>;
277
+ isVolatile: boolean;
284
278
  /**
285
279
  * Options associated with the binding.
286
280
  */
287
281
  options?: any;
288
282
  /**
289
- * Whether or not the binding is volatile.
290
- */
291
- isVolatile?: boolean;
292
- /**
293
- * Evaluates the binding expression.
283
+ * Creates a binding.
284
+ * @param evaluate - Evaluates the binding.
285
+ * @param isVolatile - Indicates whether the binding is volatile.
294
286
  */
295
- evaluate: Expression<TSource, TReturn, TParent>;
287
+ constructor(evaluate: Expression<TSource, TReturn, TParent>, isVolatile?: boolean);
296
288
  /**
297
289
  * Creates an observer capable of notifying a subscriber when the output of a binding changes.
298
290
  * @param directive - The HTML Directive to create the observer for.
@@ -301,48 +293,6 @@ export declare abstract class Binding<TSource = any, TReturn = any, TParent = an
301
293
  abstract createObserver(directive: HTMLDirective, subscriber: Subscriber): ExpressionObserver<TSource, TReturn, TParent>;
302
294
  }
303
295
 
304
- /**
305
- * A binding behavior for bindings that change.
306
- * @public
307
- */
308
- export declare class BindingBehavior implements ViewBehavior {
309
- readonly directive: HTMLBindingDirective;
310
- protected updateTarget: UpdateTarget;
311
- private observerProperty;
312
- /**
313
- * Creates an instance of ChangeBinding.
314
- * @param directive - The directive that has the configuration for this behavior.
315
- * @param updateTarget - The function used to update the target with the latest value.
316
- */
317
- constructor(directive: HTMLBindingDirective, updateTarget: UpdateTarget);
318
- /**
319
- * Bind this behavior to the source.
320
- * @param source - The source to bind to.
321
- * @param context - The execution context that the binding is operating within.
322
- * @param targets - The targets that behaviors in a view can attach to.
323
- */
324
- bind(source: any, context: ExecutionContext, targets: ViewBehaviorTargets): void;
325
- /**
326
- * Unbinds this behavior from the source.
327
- * @param source - The source to unbind from.
328
- * @param context - The execution context that the binding is operating within.
329
- * @param targets - The targets that behaviors in a view can attach to.
330
- */
331
- unbind(source: any, context: ExecutionContext, targets: ViewBehaviorTargets): void;
332
- /* Excluded from this release type: handleChange */
333
- /**
334
- * Returns the binding observer used to update the node.
335
- * @param target - The target node.
336
- * @returns A BindingObserver.
337
- */
338
- protected getObserver(target: Node): ExpressionObserver;
339
- /**
340
- * Creates a behavior.
341
- * @param targets - The targets available for behaviors to be attached to.
342
- */
343
- createBehavior(targets: ViewBehaviorTargets): ViewBehavior;
344
- }
345
-
346
296
  /**
347
297
  * A {@link ValueConverter} that converts to and from `boolean` values.
348
298
  * @remarks
@@ -366,7 +316,7 @@ export declare type Callable = typeof Function.prototype.call | {
366
316
  * into templates.
367
317
  * @public
368
318
  */
369
- export declare interface CaptureType<TSource> {
319
+ export declare interface CaptureType<TSource, TParent> {
370
320
  }
371
321
 
372
322
  /**
@@ -382,7 +332,7 @@ export declare interface ChildListDirectiveOptions<T = any> extends NodeBehavior
382
332
  * @param propertyOrOptions - The options used to configure child node observation.
383
333
  * @public
384
334
  */
385
- export declare function children<T = any>(propertyOrOptions: (keyof T & string) | ChildrenDirectiveOptions<keyof T & string>): CaptureType<T>;
335
+ export declare function children<TSource = any, TParent = any>(propertyOrOptions: (keyof TSource & string) | ChildrenDirectiveOptions<keyof TSource & string>): CaptureType<TSource, TParent>;
386
336
 
387
337
  /**
388
338
  * The runtime behavior for child node observation.
@@ -505,20 +455,6 @@ export declare type ConstructibleStyleStrategy = {
505
455
  new (styles: (string | CSSStyleSheet)[]): StyleStrategy;
506
456
  };
507
457
 
508
- /**
509
- * A special binding behavior that can bind node content.
510
- * @public
511
- */
512
- export declare class ContentBehavior extends BindingBehavior {
513
- /**
514
- * Unbinds this behavior from the source.
515
- * @param source - The source to unbind from.
516
- * @param context - The execution context that the binding is operating within.
517
- * @param targets - The targets that behaviors in a view can attach to.
518
- */
519
- unbind(source: any, context: ExecutionContext, targets: ViewBehaviorTargets): void;
520
- }
521
-
522
458
  /**
523
459
  * A simple template that can create ContentView instances.
524
460
  * @public
@@ -535,12 +471,13 @@ export declare interface ContentTemplate {
535
471
  * @public
536
472
  */
537
473
  export declare interface ContentView {
474
+ readonly context: ExecutionContext;
538
475
  /**
539
476
  * Binds a view's behaviors to its binding source.
540
477
  * @param source - The binding source for the view's binding behaviors.
541
478
  * @param context - The execution context to run the view within.
542
479
  */
543
- bind(source: any, context: ExecutionContext): void;
480
+ bind(source: any): void;
544
481
  /**
545
482
  * Unbinds a view's behaviors from its binding source and context.
546
483
  */
@@ -557,120 +494,7 @@ export declare interface ContentView {
557
494
  remove(): void;
558
495
  }
559
496
 
560
- /**
561
- * Controls the lifecycle and rendering of a `FASTElement`.
562
- * @public
563
- */
564
- export declare class Controller<TElement extends HTMLElement = HTMLElement> extends PropertyChangeNotifier {
565
- private boundObservables;
566
- private behaviors;
567
- private needsInitialization;
568
- private hasExistingShadowRoot;
569
- private _template;
570
- private _styles;
571
- private _isConnected;
572
- /**
573
- * This allows Observable.getNotifier(...) to return the Controller
574
- * when the notifier for the Controller itself is being requested. The
575
- * result is that the Observable system does not need to create a separate
576
- * instance of Notifier for observables on the Controller. The component and
577
- * the controller will now share the same notifier, removing one-object construct
578
- * per web component instance.
579
- */
580
- private readonly $fastController;
581
- /**
582
- * The element being controlled by this controller.
583
- */
584
- readonly element: TElement;
585
- /**
586
- * The element definition that instructs this controller
587
- * in how to handle rendering and other platform integrations.
588
- */
589
- readonly definition: FASTElementDefinition;
590
- /**
591
- * The view associated with the custom element.
592
- * @remarks
593
- * If `null` then the element is managing its own rendering.
594
- */
595
- readonly view: ElementView<TElement> | null;
596
- /**
597
- * Indicates whether or not the custom element has been
598
- * connected to the document.
599
- */
600
- get isConnected(): boolean;
601
- private setIsConnected;
602
- /**
603
- * Gets/sets the template used to render the component.
604
- * @remarks
605
- * This value can only be accurately read after connect but can be set at any time.
606
- */
607
- get template(): ElementViewTemplate<TElement> | null;
608
- set template(value: ElementViewTemplate<TElement> | null);
609
- /**
610
- * Gets/sets the primary styles used for the component.
611
- * @remarks
612
- * This value can only be accurately read after connect but can be set at any time.
613
- */
614
- get styles(): ElementStyles | null;
615
- set styles(value: ElementStyles | null);
616
- /* Excluded from this release type: __constructor */
617
- /**
618
- * Adds styles to this element. Providing an HTMLStyleElement will attach the element instance to the shadowRoot.
619
- * @param styles - The styles to add.
620
- */
621
- addStyles(styles: ElementStyles | HTMLStyleElement | null | undefined): void;
622
- /**
623
- * Removes styles from this element. Providing an HTMLStyleElement will detach the element instance from the shadowRoot.
624
- * @param styles - the styles to remove.
625
- */
626
- removeStyles(styles: ElementStyles | HTMLStyleElement | null | undefined): void;
627
- /**
628
- * Adds behaviors to this element.
629
- * @param behaviors - The behaviors to add.
630
- */
631
- addBehaviors(behaviors: ReadonlyArray<Behavior<TElement>>): void;
632
- /**
633
- * Removes behaviors from this element.
634
- * @param behaviors - The behaviors to remove.
635
- * @param force - Forces unbinding of behaviors.
636
- */
637
- removeBehaviors(behaviors: ReadonlyArray<Behavior<TElement>>, force?: boolean): void;
638
- /**
639
- * Runs connected lifecycle behavior on the associated element.
640
- */
641
- onConnectedCallback(): void;
642
- /**
643
- * Runs disconnected lifecycle behavior on the associated element.
644
- */
645
- onDisconnectedCallback(): void;
646
- /**
647
- * Runs the attribute changed callback for the associated element.
648
- * @param name - The name of the attribute that changed.
649
- * @param oldValue - The previous value of the attribute.
650
- * @param newValue - The new value of the attribute.
651
- */
652
- onAttributeChangedCallback(name: string, oldValue: string | null, newValue: string | null): void;
653
- /**
654
- * Emits a custom HTML event.
655
- * @param type - The type name of the event.
656
- * @param detail - The event detail object to send with the event.
657
- * @param options - The event options. By default bubbles and composed.
658
- * @remarks
659
- * Only emits events if connected.
660
- */
661
- emit(type: string, detail?: any, options?: Omit<CustomEventInit, "detail">): void | boolean;
662
- private finishInitialization;
663
- private renderTemplate;
664
- /**
665
- * Locates or creates a controller for the specified element.
666
- * @param element - The element to return the controller for.
667
- * @remarks
668
- * The specified element must have a {@link FASTElementDefinition}
669
- * registered either through the use of the {@link customElement}
670
- * decorator or a call to `FASTElement.define`.
671
- */
672
- static forCustomElement(element: HTMLElement): Controller;
673
- }
497
+ /* Excluded from this release type: createMetadataLocator */
674
498
 
675
499
  /* Excluded from this release type: createTypeRegistry */
676
500
 
@@ -832,6 +656,120 @@ export declare const DOM: Readonly<{
832
656
  setBooleanAttribute(element: HTMLElement, attributeName: string, value: boolean): void;
833
657
  }>;
834
658
 
659
+ /**
660
+ * Controls the lifecycle and rendering of a `FASTElement`.
661
+ * @public
662
+ */
663
+ export declare class ElementController<TElement extends HTMLElement = HTMLElement> extends PropertyChangeNotifier implements HostController<TElement> {
664
+ private boundObservables;
665
+ private needsInitialization;
666
+ private hasExistingShadowRoot;
667
+ private _template;
668
+ private _isConnected;
669
+ private behaviors;
670
+ private _mainStyles;
671
+ /**
672
+ * This allows Observable.getNotifier(...) to return the Controller
673
+ * when the notifier for the Controller itself is being requested. The
674
+ * result is that the Observable system does not need to create a separate
675
+ * instance of Notifier for observables on the Controller. The component and
676
+ * the controller will now share the same notifier, removing one-object construct
677
+ * per web component instance.
678
+ */
679
+ private readonly $fastController;
680
+ /**
681
+ * The element being controlled by this controller.
682
+ */
683
+ readonly source: TElement;
684
+ /**
685
+ * The element definition that instructs this controller
686
+ * in how to handle rendering and other platform integrations.
687
+ */
688
+ readonly definition: FASTElementDefinition;
689
+ /**
690
+ * The view associated with the custom element.
691
+ * @remarks
692
+ * If `null` then the element is managing its own rendering.
693
+ */
694
+ readonly view: ElementView<TElement> | null;
695
+ /**
696
+ * Indicates whether or not the custom element has been
697
+ * connected to the document.
698
+ */
699
+ get isConnected(): boolean;
700
+ private setIsConnected;
701
+ /**
702
+ * Gets/sets the template used to render the component.
703
+ * @remarks
704
+ * This value can only be accurately read after connect but can be set at any time.
705
+ */
706
+ get template(): ElementViewTemplate<TElement> | null;
707
+ set template(value: ElementViewTemplate<TElement> | null);
708
+ /**
709
+ * The main set of styles used for the component, independent
710
+ * of any dynamically added styles.
711
+ */
712
+ get mainStyles(): ElementStyles | null;
713
+ set mainStyles(value: ElementStyles | null);
714
+ /* Excluded from this release type: __constructor */
715
+ /**
716
+ * Adds the behavior to the component.
717
+ * @param behavior - The behavior to add.
718
+ */
719
+ addBehavior(behavior: HostBehavior<TElement>): void;
720
+ /**
721
+ * Removes the behavior from the component.
722
+ * @param behavior - The behavior to remove.
723
+ * @param force - Forces removal even if this behavior was added more than once.
724
+ */
725
+ removeBehavior(behavior: HostBehavior<TElement>, force?: boolean): void;
726
+ /**
727
+ * Adds styles to this element. Providing an HTMLStyleElement will attach the element instance to the shadowRoot.
728
+ * @param styles - The styles to add.
729
+ */
730
+ addStyles(styles: ElementStyles | HTMLStyleElement | null | undefined): void;
731
+ /**
732
+ * Removes styles from this element. Providing an HTMLStyleElement will detach the element instance from the shadowRoot.
733
+ * @param styles - the styles to remove.
734
+ */
735
+ removeStyles(styles: ElementStyles | HTMLStyleElement | null | undefined): void;
736
+ /**
737
+ * Runs connected lifecycle behavior on the associated element.
738
+ */
739
+ connect(): void;
740
+ /**
741
+ * Runs disconnected lifecycle behavior on the associated element.
742
+ */
743
+ disconnect(): void;
744
+ /**
745
+ * Runs the attribute changed callback for the associated element.
746
+ * @param name - The name of the attribute that changed.
747
+ * @param oldValue - The previous value of the attribute.
748
+ * @param newValue - The new value of the attribute.
749
+ */
750
+ onAttributeChangedCallback(name: string, oldValue: string | null, newValue: string | null): void;
751
+ /**
752
+ * Emits a custom HTML event.
753
+ * @param type - The type name of the event.
754
+ * @param detail - The event detail object to send with the event.
755
+ * @param options - The event options. By default bubbles and composed.
756
+ * @remarks
757
+ * Only emits events if connected.
758
+ */
759
+ emit(type: string, detail?: any, options?: Omit<CustomEventInit, "detail">): void | boolean;
760
+ private finishInitialization;
761
+ private renderTemplate;
762
+ /**
763
+ * Locates or creates a controller for the specified element.
764
+ * @param element - The element to return the controller for.
765
+ * @remarks
766
+ * The specified element must have a {@link FASTElementDefinition}
767
+ * registered either through the use of the {@link customElement}
768
+ * decorator or a call to `FASTElement.define`.
769
+ */
770
+ static forCustomElement(element: HTMLElement): ElementController;
771
+ }
772
+
835
773
  /**
836
774
  * Creates a function that can be used to filter a Node array, selecting only elements.
837
775
  * @param selector - An optional selector to restrict the filter to.
@@ -844,7 +782,7 @@ export declare const elements: (selector?: string) => ElementsFilter;
844
782
  *
845
783
  * @public
846
784
  */
847
- export declare type ElementsFilter = (value: Node, index: number, array: Node[]) => boolean;
785
+ export declare type ElementsFilter = (value: Node, index?: number, array?: Node[]) => boolean;
848
786
 
849
787
  /**
850
788
  * Represents styles that can be applied to a custom element.
@@ -857,7 +795,7 @@ export declare class ElementStyles {
857
795
  /**
858
796
  * The behaviors associated with this set of styles.
859
797
  */
860
- readonly behaviors: ReadonlyArray<Behavior<HTMLElement>> | null;
798
+ readonly behaviors: ReadonlyArray<HostBehavior<HTMLElement>> | null;
861
799
  /**
862
800
  * Gets the StyleStrategy associated with these element styles.
863
801
  */
@@ -874,7 +812,7 @@ export declare class ElementStyles {
874
812
  * Associates behaviors with this set of styles.
875
813
  * @param behaviors - The behaviors to associate.
876
814
  */
877
- withBehaviors(...behaviors: Behavior<HTMLElement>[]): this;
815
+ withBehaviors(...behaviors: HostBehavior<HTMLElement>[]): this;
878
816
  /**
879
817
  * Sets the strategy that handles adding/removing these styles for an element.
880
818
  * @param strategy - The strategy to use.
@@ -912,76 +850,37 @@ export declare interface ElementView<TSource = any, TParent = any> extends View<
912
850
  /**
913
851
  * A template capable of creating views specifically for rendering custom elements.
914
852
  * @public
915
- */
916
- export declare interface ElementViewTemplate<TSource = any, TParent = any> {
917
- /**
918
- * Creates an ElementView instance based on this template definition.
919
- * @param hostBindingTarget - The element that host behaviors will be bound to.
920
- */
921
- create(hostBindingTarget: Element): ElementView<TSource, TParent>;
922
- /**
923
- * Creates an HTMLView from this template, binds it to the source, and then appends it to the host.
924
- * @param source - The data source to bind the template to.
925
- * @param host - The Element where the template will be rendered.
926
- * @param hostBindingTarget - An HTML element to target the host bindings at if different from the
927
- * host that the template is being attached to.
928
- */
929
- render(source: TSource, host: Node, hostBindingTarget?: Element): ElementView<TSource, TParent>;
930
- }
931
-
932
- /**
933
- * A readonly, empty array.
934
- * @remarks
935
- * Typically returned by APIs that return arrays when there are
936
- * no actual items to return.
937
- * @public
938
- */
939
- export declare const emptyArray: readonly never[];
940
-
941
- /**
942
- * A binding behavior for handling events.
943
- * @public
944
- */
945
- export declare class EventBehavior {
946
- readonly directive: HTMLBindingDirective;
947
- private contextProperty;
948
- private sourceProperty;
949
- /**
950
- * Creates an instance of EventBinding.
951
- * @param directive - The directive that has the configuration for this behavior.
952
- */
953
- constructor(directive: HTMLBindingDirective);
954
- /**
955
- * Bind this behavior to the source.
956
- * @param source - The source to bind to.
957
- * @param context - The execution context that the binding is operating within.
958
- * @param targets - The targets that behaviors in a view can attach to.
959
- */
960
- bind(source: any, context: ExecutionContext, targets: ViewBehaviorTargets): void;
961
- /**
962
- * Unbinds this behavior from the source.
963
- * @param source - The source to unbind from.
964
- * @param context - The execution context that the binding is operating within.
965
- * @param targets - The targets that behaviors in a view can attach to.
853
+ */
854
+ export declare interface ElementViewTemplate<TSource = any, TParent = any> {
855
+ /**
856
+ * Creates an ElementView instance based on this template definition.
857
+ * @param hostBindingTarget - The element that host behaviors will be bound to.
966
858
  */
967
- unbind(source: any, context: ExecutionContext, targets: ViewBehaviorTargets): void;
859
+ create(hostBindingTarget: Element): ElementView<TSource, TParent>;
968
860
  /**
969
- * Creates a behavior.
970
- * @param targets - The targets available for behaviors to be attached to.
861
+ * Creates an HTMLView from this template, binds it to the source, and then appends it to the host.
862
+ * @param source - The data source to bind the template to.
863
+ * @param host - The Element where the template will be rendered.
864
+ * @param hostBindingTarget - An HTML element to target the host bindings at if different from the
865
+ * host that the template is being attached to.
971
866
  */
972
- createBehavior(targets: ViewBehaviorTargets): ViewBehavior;
973
- /* Excluded from this release type: handleEvent */
867
+ render(source: TSource, host: Node, hostBindingTarget?: Element): ElementView<TSource, TParent>;
974
868
  }
975
869
 
870
+ /**
871
+ * A readonly, empty array.
872
+ * @remarks
873
+ * Typically returned by APIs that return arrays when there are
874
+ * no actual items to return.
875
+ * @public
876
+ */
877
+ export declare const emptyArray: readonly never[];
878
+
976
879
  /**
977
880
  * Provides additional contextual information available to behaviors and expressions.
978
881
  * @public
979
882
  */
980
- export declare class ExecutionContext<TParentSource = any> {
981
- /**
982
- * The default execution context.
983
- */
984
- static readonly default: ExecutionContext<any>;
883
+ export declare interface ExecutionContext<TParent = any> {
985
884
  /**
986
885
  * The index of the current item within a repeat context.
987
886
  */
@@ -993,41 +892,40 @@ export declare class ExecutionContext<TParentSource = any> {
993
892
  /**
994
893
  * The parent data source within a nested context.
995
894
  */
996
- readonly parent: TParentSource;
895
+ parent: TParent;
997
896
  /**
998
897
  * The parent execution context when in nested context scenarios.
999
898
  */
1000
- readonly parentContext: ExecutionContext<TParentSource>;
1001
- private constructor();
899
+ parentContext: ExecutionContext<TParent>;
1002
900
  /**
1003
901
  * The current event within an event handler.
1004
902
  */
1005
- get event(): Event;
903
+ readonly event: Event;
1006
904
  /**
1007
905
  * Indicates whether the current item within a repeat context
1008
906
  * has an even index.
1009
907
  */
1010
- get isEven(): boolean;
908
+ readonly isEven: boolean;
1011
909
  /**
1012
910
  * Indicates whether the current item within a repeat context
1013
911
  * has an odd index.
1014
912
  */
1015
- get isOdd(): boolean;
913
+ readonly isOdd: boolean;
1016
914
  /**
1017
915
  * Indicates whether the current item within a repeat context
1018
916
  * is the first item in the collection.
1019
917
  */
1020
- get isFirst(): boolean;
918
+ readonly isFirst: boolean;
1021
919
  /**
1022
920
  * Indicates whether the current item within a repeat context
1023
921
  * is somewhere in the middle of the collection.
1024
922
  */
1025
- get isInMiddle(): boolean;
923
+ readonly isInMiddle: boolean;
1026
924
  /**
1027
925
  * Indicates whether the current item within a repeat context
1028
926
  * is the last item in the collection.
1029
927
  */
1030
- get isLast(): boolean;
928
+ readonly isLast: boolean;
1031
929
  /**
1032
930
  * Returns the typed event detail of a custom event.
1033
931
  */
@@ -1036,32 +934,28 @@ export declare class ExecutionContext<TParentSource = any> {
1036
934
  * Returns the typed event target of the event.
1037
935
  */
1038
936
  eventTarget<TTarget extends EventTarget>(): TTarget;
937
+ }
938
+
939
+ /**
940
+ * Provides additional contextual information available to behaviors and expressions.
941
+ * @public
942
+ */
943
+ export declare const ExecutionContext: Readonly<{
1039
944
  /**
1040
- * Updates the position/size on a context associated with a list item.
1041
- * @param index - The new index of the item.
1042
- * @param length - The new length of the list.
1043
- */
1044
- updatePosition(index: number, length: number): void;
1045
- /**
1046
- * Creates a new execution context descendent from the current context.
1047
- * @param source - The source for the context if different than the parent.
1048
- * @returns A child execution context.
945
+ * A default execution context.
1049
946
  */
1050
- createChildContext<TParentSource>(parentSource: TParentSource): ExecutionContext<TParentSource>;
947
+ default: ExecutionContext<any>;
1051
948
  /**
1052
- * Creates a new execution context descent suitable for use in list rendering.
1053
- * @param item - The list item to serve as the source.
1054
- * @param index - The index of the item in the list.
1055
- * @param length - The length of the list.
949
+ * Gets the current event.
950
+ * @returns An event object.
1056
951
  */
1057
- createItemContext(index: number, length: number): ExecutionContext<TParentSource>;
1058
- /* Excluded from this release type: setEvent */
952
+ getEvent(): Event | null;
1059
953
  /**
1060
- * Creates a new root execution context.
1061
- * @returns A new execution context.
954
+ * Sets the current event.
955
+ * @param event - An event object.
1062
956
  */
1063
- static create(): ExecutionContext;
1064
- }
957
+ setEvent(event: Event | null): void;
958
+ }>;
1065
959
 
1066
960
  /**
1067
961
  * The signature of an arrow function capable of being evaluated
@@ -1070,11 +964,47 @@ export declare class ExecutionContext<TParentSource = any> {
1070
964
  */
1071
965
  export declare type Expression<TSource = any, TReturn = any, TParent = any> = (source: TSource, context: ExecutionContext<TParent>) => TReturn;
1072
966
 
967
+ /**
968
+ * Controls the lifecycle of an expression and provides relevant context.
969
+ * @public
970
+ */
971
+ export declare interface ExpressionController<TSource = any, TParent = any> {
972
+ /**
973
+ * The source the expression is evaluated against.
974
+ */
975
+ readonly source: TSource;
976
+ /**
977
+ * Indicates how the source's lifetime relates to the controller's lifetime.
978
+ */
979
+ readonly sourceLifetime?: SourceLifetime;
980
+ /**
981
+ * The context the expression is evaluated against.
982
+ */
983
+ readonly context: ExecutionContext<TParent>;
984
+ /**
985
+ * Indicates whether the controller is bound.
986
+ */
987
+ readonly isBound: boolean;
988
+ /**
989
+ * Registers an unbind handler with the controller.
990
+ * @param behavior - An object to call when the controller unbinds.
991
+ */
992
+ onUnbind(behavior: {
993
+ unbind(controller: ExpressionController<TSource, TParent>): any;
994
+ }): void;
995
+ }
996
+
1073
997
  /**
1074
998
  * Enables evaluation of and subscription to a binding.
1075
999
  * @public
1076
1000
  */
1077
- export declare interface ExpressionNotifier<TSource = any, TReturn = any, TParent = any> extends Notifier, ExpressionObserver<TSource, TReturn, TParent> {
1001
+ export declare interface ExpressionNotifier<TSource = any, TReturn = any, TParent = any> extends Notifier, ExpressionObserver<TSource, TReturn, TParent>, Disposable {
1002
+ /**
1003
+ * Observes the expression.
1004
+ * @param source - The source for the expression.
1005
+ * @param context - The context for the expression.
1006
+ */
1007
+ observe(source: TSource, context?: ExecutionContext): TReturn;
1078
1008
  /**
1079
1009
  * Gets {@link ObservationRecord|ObservationRecords} that the {@link ExpressionNotifier}
1080
1010
  * is observing.
@@ -1092,17 +1022,16 @@ export declare interface ExpressionNotifier<TSource = any, TReturn = any, TParen
1092
1022
  }
1093
1023
 
1094
1024
  /**
1095
- * Observes a binding for changes.
1096
- *
1025
+ * Observes an expression for changes.
1097
1026
  * @public
1098
1027
  */
1099
- export declare interface ExpressionObserver<TSource = any, TReturn = any, TParent = any> extends Disposable {
1028
+ export declare interface ExpressionObserver<TSource = any, TReturn = any, TParent = any> {
1100
1029
  /**
1101
- * Begins observing the binding.
1102
- * @param source - The source to pass to the binding.
1103
- * @param context - The context to pass to the binding.
1030
+ * Binds the expression to the source.
1031
+ * @param controller - The controller that manages the lifecycle and related
1032
+ * context for the expression.
1104
1033
  */
1105
- observe(source: TSource, context?: ExecutionContext<TParent>): TReturn;
1034
+ bind(controller: ExpressionController<TSource, TParent>): TReturn;
1106
1035
  }
1107
1036
 
1108
1037
  /* Excluded from this release type: FAST */
@@ -1116,7 +1045,7 @@ export declare interface FASTElement extends HTMLElement {
1116
1045
  * The underlying controller that handles the lifecycle and rendering of
1117
1046
  * this FASTElement.
1118
1047
  */
1119
- readonly $fastController: Controller;
1048
+ readonly $fastController: ElementController;
1120
1049
  /**
1121
1050
  * Emits a custom HTML event.
1122
1051
  * @param type - The type name of the event.
@@ -1205,11 +1134,15 @@ export declare class FASTElementDefinition<TType extends Constructable<HTMLEleme
1205
1134
  /**
1206
1135
  * Options controlling the creation of the custom element's shadow DOM.
1207
1136
  */
1208
- readonly shadowOptions?: ShadowRootInit;
1137
+ readonly shadowOptions?: ShadowRootOptions;
1209
1138
  /**
1210
1139
  * Options controlling how the custom element is defined with the platform.
1211
1140
  */
1212
- readonly elementOptions?: ElementDefinitionOptions;
1141
+ readonly elementOptions: ElementDefinitionOptions;
1142
+ /**
1143
+ * The registry to register this component in by default.
1144
+ */
1145
+ readonly registry: CustomElementRegistry;
1213
1146
  private constructor();
1214
1147
  /**
1215
1148
  * Defines a custom element based on this definition.
@@ -1241,6 +1174,75 @@ export declare class FASTElementDefinition<TType extends Constructable<HTMLEleme
1241
1174
 
1242
1175
  declare function from<TBase extends typeof HTMLElement>(BaseType: TBase): new () => InstanceType<TBase> & FASTElement;
1243
1176
 
1177
+ /**
1178
+ * Represents an object that can contribute behavior to a host.
1179
+ * @public
1180
+ */
1181
+ export declare interface HostBehavior<TSource = any> {
1182
+ /**
1183
+ * Executed when this behavior is attached to a controller.
1184
+ * @param controller - Controls the behavior lifecycle.
1185
+ */
1186
+ addedCallback?(controller: HostController<TSource>): void;
1187
+ /**
1188
+ * Executed when this behavior is detached from a controller.
1189
+ * @param controller - Controls the behavior lifecycle.
1190
+ */
1191
+ removedCallback?(controller: HostController<TSource>): void;
1192
+ /**
1193
+ * Executed when this behavior's host is connected.
1194
+ * @param controller - Controls the behavior lifecycle.
1195
+ */
1196
+ connectedCallback?(controller: HostController<TSource>): void;
1197
+ /**
1198
+ * Executed when this behavior's host is disconnected.
1199
+ * @param controller - Controls the behavior lifecycle.
1200
+ */
1201
+ disconnectedCallback?(controller: HostController<TSource>): void;
1202
+ }
1203
+
1204
+ /**
1205
+ * Controls the lifecycle and context of behaviors and styles
1206
+ * associated with a component host.
1207
+ * @public
1208
+ */
1209
+ export declare interface HostController<TSource = any> {
1210
+ /**
1211
+ * The component source.
1212
+ */
1213
+ readonly source: TSource;
1214
+ /**
1215
+ * Indicates whether the host is connected or not.
1216
+ */
1217
+ readonly isConnected: boolean;
1218
+ /**
1219
+ * The main set of styles used for the component, independent
1220
+ * of any behavior-specific styles.
1221
+ */
1222
+ mainStyles: ElementStyles | null;
1223
+ /**
1224
+ * Adds the behavior to the component.
1225
+ * @param behavior - The behavior to add.
1226
+ */
1227
+ addBehavior(behavior: HostBehavior<TSource>): void;
1228
+ /**
1229
+ * Removes the behavior from the component.
1230
+ * @param behavior - The behavior to remove.
1231
+ * @param force - Forces removal even if this behavior was added more than once.
1232
+ */
1233
+ removeBehavior(behavior: HostBehavior<TSource>, force?: boolean): void;
1234
+ /**
1235
+ * Adds styles to this element. Providing an HTMLStyleElement will attach the element instance to the shadowRoot.
1236
+ * @param styles - The styles to add.
1237
+ */
1238
+ addStyles(styles: ElementStyles | HTMLStyleElement | null | undefined): void;
1239
+ /**
1240
+ * Removes styles from this element. Providing an HTMLStyleElement will detach the element instance from the shadowRoot.
1241
+ * @param styles - the styles to remove.
1242
+ */
1243
+ removeStyles(styles: ElementStyles | HTMLStyleElement | null | undefined): void;
1244
+ }
1245
+
1244
1246
  /**
1245
1247
  * Transforms a template literal string into a ViewTemplate.
1246
1248
  * @param strings - The string fragments that are interpolated with the values.
@@ -1256,9 +1258,10 @@ export declare function html<TSource = any, TParent = any>(strings: TemplateStri
1256
1258
  * A directive that applies bindings.
1257
1259
  * @public
1258
1260
  */
1259
- export declare class HTMLBindingDirective implements HTMLDirective, ViewBehaviorFactory, Aspected {
1261
+ export declare class HTMLBindingDirective implements HTMLDirective, ViewBehaviorFactory, ViewBehavior, Aspected {
1260
1262
  dataBinding: Binding;
1261
- private factory;
1263
+ private data;
1264
+ private updateTarget;
1262
1265
  /**
1263
1266
  * The unique id of the factory.
1264
1267
  */
@@ -1291,9 +1294,15 @@ export declare class HTMLBindingDirective implements HTMLDirective, ViewBehavior
1291
1294
  createHTML(add: AddViewBehaviorFactory): string;
1292
1295
  /**
1293
1296
  * Creates a behavior.
1294
- * @param targets - The targets available for behaviors to be attached to.
1295
1297
  */
1296
- createBehavior(targets: ViewBehaviorTargets): ViewBehavior;
1298
+ createBehavior(): ViewBehavior;
1299
+ /* Excluded from this release type: bindDefault */
1300
+ /* Excluded from this release type: bind */
1301
+ /* Excluded from this release type: bindContent */
1302
+ /* Excluded from this release type: bindEvent */
1303
+ /* Excluded from this release type: unbind */
1304
+ /* Excluded from this release type: handleEvent */
1305
+ /* Excluded from this release type: handleChange */
1297
1306
  }
1298
1307
 
1299
1308
  /**
@@ -1365,19 +1374,75 @@ export declare interface HTMLTemplateCompilationResult<TSource = any, TParent =
1365
1374
  * The standard View implementation, which also implements ElementView and SyntheticView.
1366
1375
  * @public
1367
1376
  */
1368
- export declare class HTMLView<TSource = any, TParent = any> implements ElementView<TSource, TParent>, SyntheticView<TSource, TParent> {
1377
+ export declare class HTMLView<TSource = any, TParent = any> implements ElementView<TSource, TParent>, SyntheticView<TSource, TParent>, ExecutionContext<TParent> {
1369
1378
  private fragment;
1370
1379
  private factories;
1371
- private targets;
1380
+ readonly targets: ViewBehaviorTargets;
1372
1381
  private behaviors;
1382
+ private unbindables;
1373
1383
  /**
1374
1384
  * The data that the view is bound to.
1375
1385
  */
1376
1386
  source: TSource | null;
1387
+ isBound: boolean;
1388
+ selfContained: boolean;
1377
1389
  /**
1378
1390
  * The execution context the view is running within.
1379
1391
  */
1380
- context: ExecutionContext<TParent> | null;
1392
+ get context(): ExecutionContext<TParent>;
1393
+ /**
1394
+ * The index of the current item within a repeat context.
1395
+ */
1396
+ index: number;
1397
+ /**
1398
+ * The length of the current collection within a repeat context.
1399
+ */
1400
+ length: number;
1401
+ /**
1402
+ * The parent data source within a nested context.
1403
+ */
1404
+ readonly parent: TParent;
1405
+ /**
1406
+ * The parent execution context when in nested context scenarios.
1407
+ */
1408
+ readonly parentContext: ExecutionContext<TParent>;
1409
+ /**
1410
+ * The current event within an event handler.
1411
+ */
1412
+ get event(): Event;
1413
+ /**
1414
+ * Indicates whether the current item within a repeat context
1415
+ * has an even index.
1416
+ */
1417
+ get isEven(): boolean;
1418
+ /**
1419
+ * Indicates whether the current item within a repeat context
1420
+ * has an odd index.
1421
+ */
1422
+ get isOdd(): boolean;
1423
+ /**
1424
+ * Indicates whether the current item within a repeat context
1425
+ * is the first item in the collection.
1426
+ */
1427
+ get isFirst(): boolean;
1428
+ /**
1429
+ * Indicates whether the current item within a repeat context
1430
+ * is somewhere in the middle of the collection.
1431
+ */
1432
+ get isInMiddle(): boolean;
1433
+ /**
1434
+ * Indicates whether the current item within a repeat context
1435
+ * is the last item in the collection.
1436
+ */
1437
+ get isLast(): boolean;
1438
+ /**
1439
+ * Returns the typed event detail of a custom event.
1440
+ */
1441
+ eventDetail<TDetail>(): TDetail;
1442
+ /**
1443
+ * Returns the typed event target of the event.
1444
+ */
1445
+ eventTarget<TTarget extends EventTarget>(): TTarget;
1381
1446
  /**
1382
1447
  * The first DOM node in the range of nodes that make up the view.
1383
1448
  */
@@ -1412,16 +1477,20 @@ export declare class HTMLView<TSource = any, TParent = any> implements ElementVi
1412
1477
  * Once a view has been disposed, it cannot be inserted or bound again.
1413
1478
  */
1414
1479
  dispose(): void;
1480
+ onUnbind(behavior: {
1481
+ unbind(controller: ViewController<TSource, TParent>): any;
1482
+ }): void;
1415
1483
  /**
1416
1484
  * Binds a view's behaviors to its binding source.
1417
1485
  * @param source - The binding source for the view's binding behaviors.
1418
1486
  * @param context - The execution context to run the behaviors within.
1419
1487
  */
1420
- bind(source: TSource, context: ExecutionContext<TParent>): void;
1488
+ bind(source: TSource): void;
1421
1489
  /**
1422
1490
  * Unbinds a view's behaviors from its binding source.
1423
1491
  */
1424
1492
  unbind(): void;
1493
+ private evaluateUnbindables;
1425
1494
  /**
1426
1495
  * Efficiently disposes of a contiguous range of synthetic view instances.
1427
1496
  * @param views - A contiguous range of views to be disposed.
@@ -1523,14 +1592,14 @@ export declare abstract class NodeObservationDirective<T extends NodeBehaviorOpt
1523
1592
  * @param context - The execution context that the binding is operating within.
1524
1593
  * @param targets - The targets that behaviors in a view can attach to.
1525
1594
  */
1526
- bind(source: any, context: ExecutionContext, targets: ViewBehaviorTargets): void;
1595
+ bind(controller: ViewController): void;
1527
1596
  /**
1528
1597
  * Unbinds this behavior from the source.
1529
1598
  * @param source - The source to unbind from.
1530
1599
  * @param context - The execution context that the binding is operating within.
1531
1600
  * @param targets - The targets that behaviors in a view can attach to.
1532
1601
  */
1533
- unbind(source: any, context: ExecutionContext, targets: ViewBehaviorTargets): void;
1602
+ unbind(controller: ViewController): void;
1534
1603
  /**
1535
1604
  * Gets the data source for the target.
1536
1605
  * @param target - The target to get the source for.
@@ -1747,12 +1816,21 @@ export declare interface PartialFASTElementDefinition {
1747
1816
  readonly attributes?: (AttributeConfiguration | string)[];
1748
1817
  /**
1749
1818
  * Options controlling the creation of the custom element's shadow DOM.
1819
+ * @remarks
1820
+ * If not provided, defaults to an open shadow root. Provide null
1821
+ * to render to the associated template to the light DOM instead.
1750
1822
  */
1751
- readonly shadowOptions?: Partial<ShadowRootInit> | null;
1823
+ readonly shadowOptions?: Partial<ShadowRootOptions> | null;
1752
1824
  /**
1753
1825
  * Options controlling how the custom element is defined with the platform.
1754
1826
  */
1755
1827
  readonly elementOptions?: ElementDefinitionOptions;
1828
+ /**
1829
+ * The registry to register this component in by default.
1830
+ * @remarks
1831
+ * If not provided, defaults to the global registry.
1832
+ */
1833
+ readonly registry?: CustomElementRegistry;
1756
1834
  }
1757
1835
 
1758
1836
  /**
@@ -1808,7 +1886,7 @@ export declare class PropertyChangeNotifier implements Notifier {
1808
1886
  * @param propertyName - The name of the property to assign the reference to.
1809
1887
  * @public
1810
1888
  */
1811
- export declare const ref: <T = any>(propertyName: keyof T & string) => CaptureType<T>;
1889
+ export declare const ref: <TSource = any, TParent = any>(propertyName: keyof TSource & string) => CaptureType<TSource, TParent>;
1812
1890
 
1813
1891
  /**
1814
1892
  * The runtime behavior for template references.
@@ -1816,17 +1894,10 @@ export declare const ref: <T = any>(propertyName: keyof T & string) => CaptureTy
1816
1894
  */
1817
1895
  export declare class RefDirective extends StatelessAttachedAttributeDirective<string> {
1818
1896
  /**
1819
- * Bind this behavior to the source.
1820
- * @param source - The source to bind to.
1821
- * @param context - The execution context that the binding is operating within.
1822
- * @param targets - The targets that behaviors in a view can attach to.
1823
- */
1824
- bind(source: any, context: ExecutionContext, targets: ViewBehaviorTargets): void;
1825
- /**
1826
- * Unbinds this behavior from the source.
1827
- * @param source - The source to unbind from.
1897
+ * Bind this behavior.
1898
+ * @param controller - The view controller that manages the lifecycle of this behavior.
1828
1899
  */
1829
- unbind(): void;
1900
+ bind(controller: ViewController): void;
1830
1901
  }
1831
1902
 
1832
1903
  declare const reflectMode = "reflect";
@@ -1839,24 +1910,22 @@ declare const reflectMode = "reflect";
1839
1910
  * @param options - Options used to turn on special repeat features.
1840
1911
  * @public
1841
1912
  */
1842
- export declare function repeat<TSource = any, TArray extends ReadonlyArray<any> = ReadonlyArray<any>>(items: Expression<TSource, TArray, ExecutionContext<TSource>> | Binding<TSource, TArray> | ReadonlyArray<any>, template: Expression<TSource, ViewTemplate> | Binding<TSource, ViewTemplate> | ViewTemplate, options?: RepeatOptions): CaptureType<TSource>;
1913
+ 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>;
1843
1914
 
1844
1915
  /**
1845
1916
  * A behavior that renders a template for each item in an array.
1846
1917
  * @public
1847
1918
  */
1848
- export declare class RepeatBehavior<TSource = any> implements Behavior, Subscriber {
1919
+ export declare class RepeatBehavior<TSource = any> implements ViewBehavior, Subscriber {
1849
1920
  private directive;
1850
1921
  private location;
1851
- private source;
1922
+ private controller;
1852
1923
  private views;
1853
1924
  private template;
1854
1925
  private templateBindingObserver;
1855
1926
  private items;
1856
1927
  private itemsObserver;
1857
1928
  private itemsBindingObserver;
1858
- private context;
1859
- private childContext;
1860
1929
  private bindView;
1861
1930
  /**
1862
1931
  * Creates an instance of RepeatBehavior.
@@ -1867,16 +1936,14 @@ export declare class RepeatBehavior<TSource = any> implements Behavior, Subscrib
1867
1936
  * @param isTemplateBindingVolatile - Indicates whether the template binding has volatile dependencies.
1868
1937
  * @param options - Options used to turn on special repeat features.
1869
1938
  */
1870
- constructor(directive: RepeatDirective, location: Node);
1939
+ constructor(directive: RepeatDirective);
1871
1940
  /**
1872
- * Bind this behavior to the source.
1873
- * @param source - The source to bind to.
1874
- * @param context - The execution context that the binding is operating within.
1941
+ * Bind this behavior.
1942
+ * @param controller - The view controller that manages the lifecycle of this behavior.
1875
1943
  */
1876
- bind(source: TSource, context: ExecutionContext): void;
1944
+ bind(controller: ViewController): void;
1877
1945
  /**
1878
- * Unbinds this behavior from the source.
1879
- * @param source - The source to unbind from.
1946
+ * Unbinds this behavior.
1880
1947
  */
1881
1948
  unbind(): void;
1882
1949
  /**
@@ -1923,7 +1990,7 @@ export declare class RepeatDirective<TSource = any> implements HTMLDirective, Vi
1923
1990
  * Creates a behavior for the provided target node.
1924
1991
  * @param target - The node instance to create the behavior for.
1925
1992
  */
1926
- createBehavior(targets: ViewBehaviorTargets): RepeatBehavior<TSource>;
1993
+ createBehavior(): RepeatBehavior<TSource>;
1927
1994
  }
1928
1995
 
1929
1996
  /**
@@ -1941,13 +2008,26 @@ export declare interface RepeatOptions {
1941
2008
  recycle?: boolean;
1942
2009
  }
1943
2010
 
2011
+ /**
2012
+ * Shadow root initialization options.
2013
+ * @public
2014
+ */
2015
+ export declare interface ShadowRootOptions extends ShadowRootInit {
2016
+ /**
2017
+ * A registry that provides the custom elements visible
2018
+ * from within this shadow root.
2019
+ * @beta
2020
+ */
2021
+ registry?: CustomElementRegistry;
2022
+ }
2023
+
1944
2024
  /**
1945
2025
  * A directive that observes the `assignedNodes()` of a slot and updates a property
1946
2026
  * whenever they change.
1947
2027
  * @param propertyOrOptions - The options used to configure slotted node observation.
1948
2028
  * @public
1949
2029
  */
1950
- export declare function slotted<T = any>(propertyOrOptions: (keyof T & string) | SlottedDirectiveOptions<keyof T & string>): CaptureType<T>;
2030
+ export declare function slotted<TSource = any, TParent = any>(propertyOrOptions: (keyof TSource & string) | SlottedDirectiveOptions<keyof TSource & string>): CaptureType<TSource, TParent>;
1951
2031
 
1952
2032
  /**
1953
2033
  * The runtime behavior for slotted node observation.
@@ -1979,6 +2059,28 @@ export declare class SlottedDirective extends NodeObservationDirective<SlottedDi
1979
2059
  export declare interface SlottedDirectiveOptions<T = any> extends NodeBehaviorOptions<T>, AssignedNodesOptions {
1980
2060
  }
1981
2061
 
2062
+ /**
2063
+ * Describes how the source's lifetime relates to its controller's lifetime.
2064
+ * @public
2065
+ */
2066
+ export declare const SourceLifetime: Readonly<{
2067
+ /**
2068
+ * The source to controller lifetime relationship is unknown.
2069
+ */
2070
+ readonly unknown: undefined;
2071
+ /**
2072
+ * The source and controller lifetimes are coupled to one another.
2073
+ * They can/will be GC'd together.
2074
+ */
2075
+ readonly coupled: 1;
2076
+ }>;
2077
+
2078
+ /**
2079
+ * Describes how the source's lifetime relates to its controller's lifetime.
2080
+ * @public
2081
+ */
2082
+ export declare type SourceLifetime = typeof SourceLifetime[keyof typeof SourceLifetime];
2083
+
1982
2084
  /**
1983
2085
  * A splice map is a representation of how a previous array of items
1984
2086
  * was transformed into a new array of items. Conceptually it is a list of
@@ -2135,8 +2237,8 @@ export declare type SpliceStrategySupport = typeof SpliceStrategySupport[keyof t
2135
2237
  * A base class used for attribute directives that don't need internal state.
2136
2238
  * @public
2137
2239
  */
2138
- export declare abstract class StatelessAttachedAttributeDirective<T> implements HTMLDirective, ViewBehaviorFactory, ViewBehavior {
2139
- protected options: T;
2240
+ export declare abstract class StatelessAttachedAttributeDirective<TOptions> implements HTMLDirective, ViewBehaviorFactory, ViewBehavior {
2241
+ protected options: TOptions;
2140
2242
  /**
2141
2243
  * The unique id of the factory.
2142
2244
  */
@@ -2149,12 +2251,7 @@ export declare abstract class StatelessAttachedAttributeDirective<T> implements
2149
2251
  * Creates an instance of RefDirective.
2150
2252
  * @param options - The options to use in configuring the directive.
2151
2253
  */
2152
- constructor(options: T);
2153
- /**
2154
- * Creates a behavior.
2155
- * @param targets - The targets available for behaviors to be attached to.
2156
- */
2157
- createBehavior(targets: ViewBehaviorTargets): ViewBehavior;
2254
+ constructor(options: TOptions);
2158
2255
  /**
2159
2256
  * Creates a placeholder string based on the directive's index within the template.
2160
2257
  * @param index - The index of the directive within the template.
@@ -2163,17 +2260,15 @@ export declare abstract class StatelessAttachedAttributeDirective<T> implements
2163
2260
  */
2164
2261
  createHTML(add: AddViewBehaviorFactory): string;
2165
2262
  /**
2166
- * Bind this behavior to the source.
2167
- * @param source - The source to bind to.
2168
- * @param context - The execution context that the binding is operating within.
2169
- * @param targets - The targets that behaviors in a view can attach to.
2263
+ * Creates a behavior.
2264
+ * @param targets - The targets available for behaviors to be attached to.
2170
2265
  */
2171
- abstract bind(source: any, context: ExecutionContext, targets: ViewBehaviorTargets): void;
2266
+ createBehavior(): ViewBehavior;
2172
2267
  /**
2173
- * Unbinds this behavior from the source.
2174
- * @param source - The source to unbind from.
2268
+ * Bind this behavior.
2269
+ * @param controller - The view controller that manages the lifecycle of this behavior.
2175
2270
  */
2176
- abstract unbind(source: any, context: ExecutionContext, targets: ViewBehaviorTargets): void;
2271
+ abstract bind(controller: ViewController): void;
2177
2272
  }
2178
2273
 
2179
2274
  /**
@@ -2336,7 +2431,7 @@ export declare interface SyntheticViewTemplate<TSource = any, TParent = any> {
2336
2431
  * Represents the types of values that can be interpolated into a template.
2337
2432
  * @public
2338
2433
  */
2339
- export declare type TemplateValue<TSource, TParent = any> = Expression<TSource, any, TParent> | Binding<TSource, any, TParent> | HTMLDirective | CaptureType<TSource>;
2434
+ export declare type TemplateValue<TSource, TParent = any> = Expression<TSource, any, TParent> | Binding<TSource, any, TParent> | HTMLDirective | CaptureType<TSource, TParent>;
2340
2435
 
2341
2436
  /**
2342
2437
  * Enables working with trusted types.
@@ -2408,29 +2503,6 @@ export declare interface UpdateQueue {
2408
2503
  */
2409
2504
  export declare const Updates: UpdateQueue;
2410
2505
 
2411
- /**
2412
- * A target update function.
2413
- * @param this - The "this" context for the update.
2414
- * @param target - The node that is targeted by the update.
2415
- * @param aspect - The aspect of the node that is being targeted.
2416
- * @param value - The value to assign to the aspect.
2417
- * @param source - The source object that the value was derived from.
2418
- * @param context - The execution context that the binding is being run under.
2419
- * @public
2420
- */
2421
- export declare type UpdateTarget = (this: UpdateTargetThis, target: Node, aspect: string, value: any, source: any, context: ExecutionContext) => void;
2422
-
2423
- /**
2424
- * The "this" context for an update target function.
2425
- * @public
2426
- */
2427
- export declare interface UpdateTargetThis {
2428
- /**
2429
- * The directive configuration for the update.
2430
- */
2431
- directive: HTMLBindingDirective;
2432
- }
2433
-
2434
2506
  /**
2435
2507
  * Represents objects that can convert values to and from
2436
2508
  * view or model representations.
@@ -2457,7 +2529,7 @@ export declare interface View<TSource = any, TParent = any> extends Disposable {
2457
2529
  /**
2458
2530
  * The execution context the view is running within.
2459
2531
  */
2460
- readonly context: ExecutionContext<TParent> | null;
2532
+ readonly context: ExecutionContext<TParent>;
2461
2533
  /**
2462
2534
  * The data that the view is bound to.
2463
2535
  */
@@ -2465,9 +2537,8 @@ export declare interface View<TSource = any, TParent = any> extends Disposable {
2465
2537
  /**
2466
2538
  * Binds a view's behaviors to its binding source.
2467
2539
  * @param source - The binding source for the view's binding behaviors.
2468
- * @param context - The execution context to run the view within.
2469
2540
  */
2470
- bind(source: TSource, context: ExecutionContext<TParent>): void;
2541
+ bind(source: TSource): void;
2471
2542
  /**
2472
2543
  * Unbinds a view's behaviors from its binding source and context.
2473
2544
  */
@@ -2480,23 +2551,14 @@ export declare interface View<TSource = any, TParent = any> extends Disposable {
2480
2551
  */
2481
2552
  export declare interface ViewBehavior<TSource = any, TParent = any> {
2482
2553
  /**
2483
- * Bind this behavior to the source.
2484
- * @param source - The source to bind to.
2485
- * @param context - The execution context that the binding is operating within.
2486
- * @param targets - The targets that behaviors in a view can attach to.
2487
- */
2488
- bind(source: TSource, context: ExecutionContext<TParent>, targets: ViewBehaviorTargets): void;
2489
- /**
2490
- * Unbinds this behavior from the source.
2491
- * @param source - The source to unbind from.
2492
- * @param context - The execution context that the binding is operating within.
2493
- * @param targets - The targets that behaviors in a view can attach to.
2554
+ * Bind this behavior.
2555
+ * @param controller - The view controller that manages the lifecycle of this behavior.
2494
2556
  */
2495
- unbind(source: TSource, context: ExecutionContext<TParent>, targets: ViewBehaviorTargets): void;
2557
+ bind(controller: ViewController<TSource, TParent>): void;
2496
2558
  }
2497
2559
 
2498
2560
  /**
2499
- * A factory that can create a {@link Behavior} associated with a particular
2561
+ * A factory that can create a {@link ViewBehavior} associated with a particular
2500
2562
  * location within a DOM fragment.
2501
2563
  * @public
2502
2564
  */
@@ -2511,11 +2573,49 @@ export declare interface ViewBehaviorFactory {
2511
2573
  nodeId: string;
2512
2574
  /**
2513
2575
  * Creates a behavior.
2514
- * @param targets - The targets available for behaviors to be attached to.
2515
2576
  */
2516
- createBehavior(targets: ViewBehaviorTargets): Behavior | ViewBehavior;
2577
+ createBehavior(): ViewBehavior;
2578
+ }
2579
+
2580
+ /**
2581
+ * Bridges between ViewBehaviors and HostBehaviors, enabling a host to
2582
+ * control ViewBehaviors.
2583
+ * @public
2584
+ */
2585
+ export declare interface ViewBehaviorOrchestrator<TSource = any, TParent = any> extends ViewController<TSource, TParent>, HostBehavior<TSource> {
2586
+ /**
2587
+ *
2588
+ * @param nodeId - The structural id of the DOM node to which a behavior will apply.
2589
+ * @param target - The DOM node associated with the id.
2590
+ */
2591
+ addTarget(nodeId: string, target: Node): void;
2592
+ /**
2593
+ * Adds a behavior.
2594
+ * @param behavior - The behavior to add.
2595
+ */
2596
+ addBehavior(behavior: ViewBehavior): void;
2597
+ /**
2598
+ * Adds a behavior factory.
2599
+ * @param factory - The behavior factory to add.
2600
+ * @param target - The target the factory will create behaviors for.
2601
+ */
2602
+ addBehaviorFactory(factory: ViewBehaviorFactory, target: Node): void;
2517
2603
  }
2518
2604
 
2605
+ /**
2606
+ * Bridges between ViewBehaviors and HostBehaviors, enabling a host to
2607
+ * control ViewBehaviors.
2608
+ * @public
2609
+ */
2610
+ export declare const ViewBehaviorOrchestrator: Readonly<{
2611
+ /**
2612
+ * Creates a ViewBehaviorOrchestrator.
2613
+ * @param source - The source to to associate behaviors with.
2614
+ * @returns A ViewBehaviorOrchestrator.
2615
+ */
2616
+ create<TSource = any, TParent = any>(source: TSource): ViewBehaviorOrchestrator<TSource, TParent>;
2617
+ }>;
2618
+
2519
2619
  /**
2520
2620
  * The target nodes available to a behavior.
2521
2621
  * @public
@@ -2524,6 +2624,17 @@ export declare type ViewBehaviorTargets = {
2524
2624
  [id: string]: Node;
2525
2625
  };
2526
2626
 
2627
+ /**
2628
+ * Controls the lifecycle of a view and provides relevant context.
2629
+ * @public
2630
+ */
2631
+ export declare interface ViewController<TSource = any, TParent = any> extends ExpressionController<TSource, TParent> {
2632
+ /**
2633
+ * The parts of the view that are targeted by view behaviors.
2634
+ */
2635
+ readonly targets: ViewBehaviorTargets;
2636
+ }
2637
+
2527
2638
  /**
2528
2639
  * A template capable of creating HTMLView instances or rendering directly to DOM.
2529
2640
  * @public
@@ -2557,7 +2668,7 @@ export declare class ViewTemplate<TSource = any, TParent = any> implements Eleme
2557
2668
  * @param hostBindingTarget - An HTML element to target the host bindings at if different from the
2558
2669
  * host that the template is being attached to.
2559
2670
  */
2560
- render(source: TSource, host: Node, hostBindingTarget?: Element, context?: ExecutionContext): HTMLView<TSource, TParent>;
2671
+ render(source: TSource, host: Node, hostBindingTarget?: Element): HTMLView<TSource, TParent>;
2561
2672
  }
2562
2673
 
2563
2674
  /**
@@ -2576,6 +2687,6 @@ export declare function volatile(target: {}, name: string | Accessor, descriptor
2576
2687
  * the template to render when the condition is true.
2577
2688
  * @public
2578
2689
  */
2579
- export declare function when<TSource = any, TReturn = any>(condition: Expression<TSource, TReturn> | boolean, templateOrTemplateBinding: SyntheticViewTemplate | Expression<TSource, SyntheticViewTemplate>): CaptureType<TSource>;
2690
+ 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>;
2580
2691
 
2581
2692
  export { }