@microsoft/fast-element 2.0.0-beta.5 → 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 (80) hide show
  1. package/CHANGELOG.json +72 -0
  2. package/CHANGELOG.md +24 -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/interfaces.d.ts +4 -0
  10. package/dist/dts/observation/observable.d.ts +86 -47
  11. package/dist/dts/pending-task.d.ts +20 -0
  12. package/dist/dts/platform.d.ts +6 -0
  13. package/dist/dts/state/exports.d.ts +3 -0
  14. package/dist/dts/state/reactive.d.ts +8 -0
  15. package/dist/dts/state/state.d.ts +141 -0
  16. package/dist/dts/state/visitor.d.ts +6 -0
  17. package/dist/dts/state/watch.d.ts +10 -0
  18. package/dist/dts/styles/css-directive.d.ts +2 -2
  19. package/dist/dts/styles/element-styles.d.ts +3 -3
  20. package/dist/dts/styles/host.d.ts +68 -0
  21. package/dist/dts/templating/binding-signal.d.ts +2 -2
  22. package/dist/dts/templating/binding-two-way.d.ts +11 -3
  23. package/dist/dts/templating/binding.d.ts +21 -119
  24. package/dist/dts/templating/children.d.ts +1 -1
  25. package/dist/dts/templating/html-directive.d.ts +69 -39
  26. package/dist/dts/templating/node-observation.d.ts +4 -5
  27. package/dist/dts/templating/ref.d.ts +5 -13
  28. package/dist/dts/templating/render.d.ts +15 -20
  29. package/dist/dts/templating/repeat.d.ts +11 -16
  30. package/dist/dts/templating/slotted.d.ts +1 -1
  31. package/dist/dts/templating/template.d.ts +4 -4
  32. package/dist/dts/templating/view.d.ts +68 -9
  33. package/dist/dts/templating/when.d.ts +1 -1
  34. package/dist/dts/testing/exports.d.ts +1 -0
  35. package/dist/dts/testing/fakes.d.ts +4 -0
  36. package/dist/dts/testing/fixture.d.ts +0 -6
  37. package/dist/dts/utilities.d.ts +0 -18
  38. package/dist/esm/components/attributes.js +13 -4
  39. package/dist/esm/components/{controller.js → element-controller.js} +95 -105
  40. package/dist/esm/components/fast-definitions.js +3 -1
  41. package/dist/esm/components/fast-element.js +4 -4
  42. package/dist/esm/di/di.js +87 -3
  43. package/dist/esm/index.js +2 -1
  44. package/dist/esm/interfaces.js +4 -0
  45. package/dist/esm/observation/observable.js +59 -126
  46. package/dist/esm/pending-task.js +16 -0
  47. package/dist/esm/platform.js +21 -0
  48. package/dist/esm/state/exports.js +3 -0
  49. package/dist/esm/state/reactive.js +34 -0
  50. package/dist/esm/state/state.js +148 -0
  51. package/dist/esm/state/visitor.js +28 -0
  52. package/dist/esm/state/watch.js +36 -0
  53. package/dist/esm/styles/css.js +4 -4
  54. package/dist/esm/{observation/behavior.js → styles/host.js} +0 -0
  55. package/dist/esm/templating/binding-signal.js +21 -17
  56. package/dist/esm/templating/binding-two-way.js +32 -27
  57. package/dist/esm/templating/binding.js +73 -177
  58. package/dist/esm/templating/html-directive.js +78 -7
  59. package/dist/esm/templating/node-observation.js +9 -8
  60. package/dist/esm/templating/ref.js +4 -12
  61. package/dist/esm/templating/render.js +30 -31
  62. package/dist/esm/templating/repeat.js +37 -38
  63. package/dist/esm/templating/template.js +3 -4
  64. package/dist/esm/templating/view.js +96 -24
  65. package/dist/esm/testing/exports.js +1 -0
  66. package/dist/esm/testing/fakes.js +76 -0
  67. package/dist/esm/testing/fixture.js +1 -3
  68. package/dist/esm/utilities.js +0 -95
  69. package/dist/fast-element.api.json +5720 -5385
  70. package/dist/fast-element.d.ts +510 -399
  71. package/dist/fast-element.debug.js +492 -509
  72. package/dist/fast-element.debug.min.js +1 -1
  73. package/dist/fast-element.js +492 -509
  74. package/dist/fast-element.min.js +1 -1
  75. package/dist/fast-element.untrimmed.d.ts +519 -405
  76. package/docs/api-report.md +197 -129
  77. package/package.json +8 -4
  78. package/dist/dts/hooks.d.ts +0 -20
  79. package/dist/dts/observation/behavior.d.ts +0 -19
  80. package/dist/esm/hooks.js +0 -32
@@ -1,5 +1,4 @@
1
- import type { ExecutionContext } from "../observation/observable.js";
2
- import { StatelessAttachedAttributeDirective, ViewBehaviorTargets } from "./html-directive.js";
1
+ import { StatelessAttachedAttributeDirective, ViewController } from "./html-directive.js";
3
2
  /**
4
3
  * Options for configuring node observation behavior.
5
4
  * @public
@@ -23,7 +22,7 @@ export interface NodeBehaviorOptions<T = any> {
23
22
  *
24
23
  * @public
25
24
  */
26
- export declare type ElementsFilter = (value: Node, index: number, array: Node[]) => boolean;
25
+ export declare type ElementsFilter = (value: Node, index?: number, array?: Node[]) => boolean;
27
26
  /**
28
27
  * Creates a function that can be used to filter a Node array, selecting only elements.
29
28
  * @param selector - An optional selector to restrict the filter to.
@@ -44,14 +43,14 @@ export declare abstract class NodeObservationDirective<T extends NodeBehaviorOpt
44
43
  * @param context - The execution context that the binding is operating within.
45
44
  * @param targets - The targets that behaviors in a view can attach to.
46
45
  */
47
- bind(source: any, context: ExecutionContext, targets: ViewBehaviorTargets): void;
46
+ bind(controller: ViewController): void;
48
47
  /**
49
48
  * Unbinds this behavior from the source.
50
49
  * @param source - The source to unbind from.
51
50
  * @param context - The execution context that the binding is operating within.
52
51
  * @param targets - The targets that behaviors in a view can attach to.
53
52
  */
54
- unbind(source: any, context: ExecutionContext, targets: ViewBehaviorTargets): void;
53
+ unbind(controller: ViewController): void;
55
54
  /**
56
55
  * Gets the data source for the target.
57
56
  * @param target - The target to get the source for.
@@ -1,5 +1,4 @@
1
- import type { ExecutionContext } from "../observation/observable.js";
2
- import { StatelessAttachedAttributeDirective, ViewBehaviorTargets } from "./html-directive.js";
1
+ import { StatelessAttachedAttributeDirective, ViewController } from "./html-directive.js";
3
2
  import type { CaptureType } from "./template.js";
4
3
  /**
5
4
  * The runtime behavior for template references.
@@ -7,21 +6,14 @@ import type { CaptureType } from "./template.js";
7
6
  */
8
7
  export declare class RefDirective extends StatelessAttachedAttributeDirective<string> {
9
8
  /**
10
- * Bind this behavior to the source.
11
- * @param source - The source to bind to.
12
- * @param context - The execution context that the binding is operating within.
13
- * @param targets - The targets that behaviors in a view can attach to.
9
+ * Bind this behavior.
10
+ * @param controller - The view controller that manages the lifecycle of this behavior.
14
11
  */
15
- bind(source: any, context: ExecutionContext, targets: ViewBehaviorTargets): void;
16
- /**
17
- * Unbinds this behavior from the source.
18
- * @param source - The source to unbind from.
19
- */
20
- unbind(): void;
12
+ bind(controller: ViewController): void;
21
13
  }
22
14
  /**
23
15
  * A directive that observes the updates a property with a reference to the element.
24
16
  * @param propertyName - The name of the property to assign the reference to.
25
17
  * @public
26
18
  */
27
- export declare const ref: <T = any>(propertyName: keyof T & string) => CaptureType<T>;
19
+ export declare const ref: <TSource = any, TParent = any>(propertyName: keyof TSource & string) => CaptureType<TSource, TParent>;
@@ -1,44 +1,38 @@
1
1
  import type { FASTElement } from "../components/fast-element.js";
2
2
  import { Constructable } from "../interfaces.js";
3
- import type { Behavior } from "../observation/behavior.js";
4
3
  import type { Subscriber } from "../observation/notifier.js";
5
4
  import type { ExecutionContext, Expression, ExpressionObserver } from "../observation/observable.js";
6
5
  import { ContentTemplate, ContentView } from "./binding.js";
7
- import { AddViewBehaviorFactory, Binding, HTMLDirective, ViewBehaviorFactory, ViewBehaviorTargets } from "./html-directive.js";
6
+ import { AddViewBehaviorFactory, Binding, HTMLDirective, ViewBehavior, ViewBehaviorFactory, ViewController } from "./html-directive.js";
8
7
  import { CaptureType, SyntheticViewTemplate, TemplateValue, ViewTemplate } from "./template.js";
9
8
  /**
10
9
  * A Behavior that enables advanced rendering.
11
10
  * @public
12
11
  */
13
- export declare class RenderBehavior<TSource = any, TParent = any> implements Behavior, Subscriber {
12
+ export declare class RenderBehavior<TSource = any> implements ViewBehavior, Subscriber {
14
13
  private directive;
15
14
  private location;
16
- private source;
15
+ private controller;
17
16
  private view;
18
17
  private template;
19
18
  private templateBindingObserver;
20
19
  private data;
21
20
  private dataBindingObserver;
22
- private originalContext;
23
- private childContext;
24
21
  /**
25
22
  * Creates an instance of RenderBehavior.
26
- * @param location - A Node representing the location where this behavior will render.
27
- * @param dataBinding - A binding expression that returns the data to render.
28
- * @param templateBinding - A binding expression that returns the template to use with the data.
23
+ * @param directive - The render directive that created this behavior.
29
24
  */
30
- constructor(directive: RenderDirective, location: Node);
25
+ constructor(directive: RenderDirective);
31
26
  /**
32
- * Bind this behavior to the source.
33
- * @param source - The source to bind to.
34
- * @param context - The execution context that the binding is operating within.
27
+ * Bind this behavior.
28
+ * @param controller - The view controller that manages the lifecycle of this behavior.
35
29
  */
36
- bind(source: TSource, context: ExecutionContext): void;
30
+ bind(controller: ViewController): void;
37
31
  /**
38
- * Unbinds this behavior from the source.
39
- * @param source - The source to unbind from.
32
+ * Unbinds this behavior.
33
+ * @param controller - The view controller that manages the lifecycle of this behavior.
40
34
  */
41
- unbind(source: TSource, context: ExecutionContext<TParent>): void;
35
+ unbind(controller: ViewController): void;
42
36
  /** @internal */
43
37
  handleChange(source: any, observer: ExpressionObserver): void;
44
38
  private refreshView;
@@ -74,7 +68,7 @@ export declare class RenderDirective<TSource = any> implements HTMLDirective, Vi
74
68
  * Creates a behavior.
75
69
  * @param targets - The targets available for behaviors to be attached to.
76
70
  */
77
- createBehavior(targets: ViewBehaviorTargets): RenderBehavior<TSource>;
71
+ createBehavior(): RenderBehavior<TSource>;
78
72
  }
79
73
  /**
80
74
  * Provides instructions for how to render a type.
@@ -251,7 +245,8 @@ export declare function renderWith(template: ContentTemplate, name?: string): Cl
251
245
  export declare class NodeTemplate implements ContentTemplate, ContentView {
252
246
  readonly node: Node;
253
247
  constructor(node: Node);
254
- bind(source: any, context: ExecutionContext<any>): void;
248
+ get context(): ExecutionContext<any>;
249
+ bind(source: any): void;
255
250
  unbind(): void;
256
251
  insertBefore(refNode: Node): void;
257
252
  remove(): void;
@@ -273,5 +268,5 @@ export declare class NodeTemplate implements ContentTemplate, ContentView {
273
268
  * RenderInstruction to determine the view.
274
269
  * @public
275
270
  */
276
- export declare function render<TSource = any, TItem = any>(value?: Expression<TSource, TItem> | Binding<TSource, TItem> | {}, template?: ContentTemplate | string | Expression<TSource, ContentTemplate | string | Node> | Binding<TSource, ContentTemplate | string | Node>): CaptureType<TSource>;
271
+ export declare function render<TSource = any, TItem = any, TParent = any>(value?: Expression<TSource, TItem> | Binding<TSource, TItem> | {}, template?: ContentTemplate | string | Expression<TSource, ContentTemplate | string | Node, TParent> | Binding<TSource, ContentTemplate | string | Node, TParent>): CaptureType<TSource, TParent>;
277
272
  export {};
@@ -1,8 +1,7 @@
1
- import type { Behavior } from "../observation/behavior.js";
2
1
  import type { Subscriber } from "../observation/notifier.js";
3
- import { ExecutionContext, Expression, ExpressionObserver } from "../observation/observable.js";
2
+ import { Expression, ExpressionObserver } from "../observation/observable.js";
4
3
  import { Splice } from "../observation/arrays.js";
5
- import { AddViewBehaviorFactory, Binding, HTMLDirective, ViewBehaviorFactory, ViewBehaviorTargets } from "./html-directive.js";
4
+ import { AddViewBehaviorFactory, Binding, HTMLDirective, ViewBehavior, ViewBehaviorFactory, ViewController } from "./html-directive.js";
6
5
  import type { CaptureType, SyntheticViewTemplate, ViewTemplate } from "./template.js";
7
6
  /**
8
7
  * Options for configuring repeat behavior.
@@ -22,18 +21,16 @@ export interface RepeatOptions {
22
21
  * A behavior that renders a template for each item in an array.
23
22
  * @public
24
23
  */
25
- export declare class RepeatBehavior<TSource = any> implements Behavior, Subscriber {
24
+ export declare class RepeatBehavior<TSource = any> implements ViewBehavior, Subscriber {
26
25
  private directive;
27
26
  private location;
28
- private source;
27
+ private controller;
29
28
  private views;
30
29
  private template;
31
30
  private templateBindingObserver;
32
31
  private items;
33
32
  private itemsObserver;
34
33
  private itemsBindingObserver;
35
- private context;
36
- private childContext;
37
34
  private bindView;
38
35
  /**
39
36
  * Creates an instance of RepeatBehavior.
@@ -44,16 +41,14 @@ export declare class RepeatBehavior<TSource = any> implements Behavior, Subscrib
44
41
  * @param isTemplateBindingVolatile - Indicates whether the template binding has volatile dependencies.
45
42
  * @param options - Options used to turn on special repeat features.
46
43
  */
47
- constructor(directive: RepeatDirective, location: Node);
44
+ constructor(directive: RepeatDirective);
48
45
  /**
49
- * Bind this behavior to the source.
50
- * @param source - The source to bind to.
51
- * @param context - The execution context that the binding is operating within.
46
+ * Bind this behavior.
47
+ * @param controller - The view controller that manages the lifecycle of this behavior.
52
48
  */
53
- bind(source: TSource, context: ExecutionContext): void;
49
+ bind(controller: ViewController): void;
54
50
  /**
55
- * Unbinds this behavior from the source.
56
- * @param source - The source to unbind from.
51
+ * Unbinds this behavior.
57
52
  */
58
53
  unbind(): void;
59
54
  /**
@@ -99,7 +94,7 @@ export declare class RepeatDirective<TSource = any> implements HTMLDirective, Vi
99
94
  * Creates a behavior for the provided target node.
100
95
  * @param target - The node instance to create the behavior for.
101
96
  */
102
- createBehavior(targets: ViewBehaviorTargets): RepeatBehavior<TSource>;
97
+ createBehavior(): RepeatBehavior<TSource>;
103
98
  }
104
99
  /**
105
100
  * A directive that enables list rendering.
@@ -109,4 +104,4 @@ export declare class RepeatDirective<TSource = any> implements HTMLDirective, Vi
109
104
  * @param options - Options used to turn on special repeat features.
110
105
  * @public
111
106
  */
112
- 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>;
107
+ 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>;
@@ -35,4 +35,4 @@ export declare class SlottedDirective extends NodeObservationDirective<SlottedDi
35
35
  * @param propertyOrOptions - The options used to configure slotted node observation.
36
36
  * @public
37
37
  */
38
- export declare function slotted<T = any>(propertyOrOptions: (keyof T & string) | SlottedDirectiveOptions<keyof T & string>): CaptureType<T>;
38
+ export declare function slotted<TSource = any, TParent = any>(propertyOrOptions: (keyof TSource & string) | SlottedDirectiveOptions<keyof TSource & string>): CaptureType<TSource, TParent>;
@@ -1,4 +1,4 @@
1
- import { ExecutionContext, Expression } from "../observation/observable.js";
1
+ import type { Expression } from "../observation/observable.js";
2
2
  import { Binding, HTMLDirective, ViewBehaviorFactory } from "./html-directive.js";
3
3
  import type { ElementView, HTMLView, SyntheticView } from "./view.js";
4
4
  /**
@@ -74,20 +74,20 @@ export declare class ViewTemplate<TSource = any, TParent = any> implements Eleme
74
74
  * @param hostBindingTarget - An HTML element to target the host bindings at if different from the
75
75
  * host that the template is being attached to.
76
76
  */
77
- render(source: TSource, host: Node, hostBindingTarget?: Element, context?: ExecutionContext): HTMLView<TSource, TParent>;
77
+ render(source: TSource, host: Node, hostBindingTarget?: Element): HTMLView<TSource, TParent>;
78
78
  }
79
79
  /**
80
80
  * A marker interface used to capture types when interpolating Directive helpers
81
81
  * into templates.
82
82
  * @public
83
83
  */
84
- export interface CaptureType<TSource> {
84
+ export interface CaptureType<TSource, TParent> {
85
85
  }
86
86
  /**
87
87
  * Represents the types of values that can be interpolated into a template.
88
88
  * @public
89
89
  */
90
- export declare type TemplateValue<TSource, TParent = any> = Expression<TSource, any, TParent> | Binding<TSource, any, TParent> | HTMLDirective | CaptureType<TSource>;
90
+ export declare type TemplateValue<TSource, TParent = any> = Expression<TSource, any, TParent> | Binding<TSource, any, TParent> | HTMLDirective | CaptureType<TSource, TParent>;
91
91
  /**
92
92
  * Transforms a template literal string into a ViewTemplate.
93
93
  * @param strings - The string fragments that are interpolated with the values.
@@ -1,6 +1,6 @@
1
1
  import type { Disposable } from "../interfaces.js";
2
- import type { ExecutionContext } from "../observation/observable.js";
3
- import type { ViewBehaviorFactory, ViewBehaviorTargets } from "./html-directive.js";
2
+ import { ExecutionContext } from "../observation/observable.js";
3
+ import type { ViewBehaviorFactory, ViewBehaviorTargets, ViewController } from "./html-directive.js";
4
4
  /**
5
5
  * Represents a collection of DOM nodes which can be bound to a data source.
6
6
  * @public
@@ -9,7 +9,7 @@ export interface View<TSource = any, TParent = any> extends Disposable {
9
9
  /**
10
10
  * The execution context the view is running within.
11
11
  */
12
- readonly context: ExecutionContext<TParent> | null;
12
+ readonly context: ExecutionContext<TParent>;
13
13
  /**
14
14
  * The data that the view is bound to.
15
15
  */
@@ -17,9 +17,8 @@ export interface View<TSource = any, TParent = any> extends Disposable {
17
17
  /**
18
18
  * Binds a view's behaviors to its binding source.
19
19
  * @param source - The binding source for the view's binding behaviors.
20
- * @param context - The execution context to run the view within.
21
20
  */
22
- bind(source: TSource, context: ExecutionContext<TParent>): void;
21
+ bind(source: TSource): void;
23
22
  /**
24
23
  * Unbinds a view's behaviors from its binding source and context.
25
24
  */
@@ -64,19 +63,75 @@ export interface SyntheticView<TSource = any, TParent = any> extends View<TSourc
64
63
  * The standard View implementation, which also implements ElementView and SyntheticView.
65
64
  * @public
66
65
  */
67
- export declare class HTMLView<TSource = any, TParent = any> implements ElementView<TSource, TParent>, SyntheticView<TSource, TParent> {
66
+ export declare class HTMLView<TSource = any, TParent = any> implements ElementView<TSource, TParent>, SyntheticView<TSource, TParent>, ExecutionContext<TParent> {
68
67
  private fragment;
69
68
  private factories;
70
- private targets;
69
+ readonly targets: ViewBehaviorTargets;
71
70
  private behaviors;
71
+ private unbindables;
72
72
  /**
73
73
  * The data that the view is bound to.
74
74
  */
75
75
  source: TSource | null;
76
+ isBound: boolean;
77
+ selfContained: boolean;
76
78
  /**
77
79
  * The execution context the view is running within.
78
80
  */
79
- context: ExecutionContext<TParent> | null;
81
+ get context(): ExecutionContext<TParent>;
82
+ /**
83
+ * The index of the current item within a repeat context.
84
+ */
85
+ index: number;
86
+ /**
87
+ * The length of the current collection within a repeat context.
88
+ */
89
+ length: number;
90
+ /**
91
+ * The parent data source within a nested context.
92
+ */
93
+ readonly parent: TParent;
94
+ /**
95
+ * The parent execution context when in nested context scenarios.
96
+ */
97
+ readonly parentContext: ExecutionContext<TParent>;
98
+ /**
99
+ * The current event within an event handler.
100
+ */
101
+ get event(): Event;
102
+ /**
103
+ * Indicates whether the current item within a repeat context
104
+ * has an even index.
105
+ */
106
+ get isEven(): boolean;
107
+ /**
108
+ * Indicates whether the current item within a repeat context
109
+ * has an odd index.
110
+ */
111
+ get isOdd(): boolean;
112
+ /**
113
+ * Indicates whether the current item within a repeat context
114
+ * is the first item in the collection.
115
+ */
116
+ get isFirst(): boolean;
117
+ /**
118
+ * Indicates whether the current item within a repeat context
119
+ * is somewhere in the middle of the collection.
120
+ */
121
+ get isInMiddle(): boolean;
122
+ /**
123
+ * Indicates whether the current item within a repeat context
124
+ * is the last item in the collection.
125
+ */
126
+ get isLast(): boolean;
127
+ /**
128
+ * Returns the typed event detail of a custom event.
129
+ */
130
+ eventDetail<TDetail>(): TDetail;
131
+ /**
132
+ * Returns the typed event target of the event.
133
+ */
134
+ eventTarget<TTarget extends EventTarget>(): TTarget;
80
135
  /**
81
136
  * The first DOM node in the range of nodes that make up the view.
82
137
  */
@@ -111,16 +166,20 @@ export declare class HTMLView<TSource = any, TParent = any> implements ElementVi
111
166
  * Once a view has been disposed, it cannot be inserted or bound again.
112
167
  */
113
168
  dispose(): void;
169
+ onUnbind(behavior: {
170
+ unbind(controller: ViewController<TSource, TParent>): any;
171
+ }): void;
114
172
  /**
115
173
  * Binds a view's behaviors to its binding source.
116
174
  * @param source - The binding source for the view's binding behaviors.
117
175
  * @param context - The execution context to run the behaviors within.
118
176
  */
119
- bind(source: TSource, context: ExecutionContext<TParent>): void;
177
+ bind(source: TSource): void;
120
178
  /**
121
179
  * Unbinds a view's behaviors from its binding source.
122
180
  */
123
181
  unbind(): void;
182
+ private evaluateUnbindables;
124
183
  /**
125
184
  * Efficiently disposes of a contiguous range of synthetic view instances.
126
185
  * @param views - A contiguous range of views to be disposed.
@@ -7,4 +7,4 @@ import type { CaptureType, SyntheticViewTemplate } from "./template.js";
7
7
  * the template to render when the condition is true.
8
8
  * @public
9
9
  */
10
- export declare function when<TSource = any, TReturn = any>(condition: Expression<TSource, TReturn> | boolean, templateOrTemplateBinding: SyntheticViewTemplate | Expression<TSource, SyntheticViewTemplate>): CaptureType<TSource>;
10
+ 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>;
@@ -1,2 +1,3 @@
1
1
  export { timeout } from "./timeout.js";
2
2
  export * from "./fixture.js";
3
+ export * from "./fakes.js";
@@ -0,0 +1,4 @@
1
+ import { ExecutionContext } from "../index.js";
2
+ export declare const Fake: Readonly<{
3
+ executionContext<TParent = any>(parent?: TParent | undefined, parentContext?: ExecutionContext<TParent> | undefined): ExecutionContext<TParent>;
4
+ }>;
@@ -1,5 +1,4 @@
1
1
  import type { Constructable } from "../interfaces.js";
2
- import { ExecutionContext } from "../observation/observable.js";
3
2
  import { ViewTemplate } from "../templating/template.js";
4
3
  import type { HTMLView } from "../templating/view.js";
5
4
  /**
@@ -22,11 +21,6 @@ export interface FixtureOptions {
22
21
  * @defaultValue An empty object.
23
22
  */
24
23
  source?: any;
25
- /**
26
- * The execution context to use during binding.
27
- * @defaultValue {@link @microsoft/fast-element#ExecutionContext}
28
- */
29
- context?: ExecutionContext;
30
24
  }
31
25
  /**
32
26
  * A test fixture.
@@ -1,21 +1,3 @@
1
- import { Disposable } from "./interfaces.js";
2
- import type { Subscriber } from "./observation/notifier.js";
3
- /**
4
- * Converts a plain object to an observable object.
5
- * @param object - The object to make observable.
6
- * @param deep - Indicates whether or not to deeply convert the oject.
7
- * @returns The converted object.
8
- * @beta
9
- */
10
- export declare function makeObservable<T>(object: T, deep?: boolean): T;
11
- /**
12
- * Deeply subscribes to changes in existing observable objects.
13
- * @param object - The observable object to watch.
14
- * @param subscriber - The handler to call when changes are made to the object.
15
- * @returns A disposable that can be used to unsubscribe from change updates.
16
- * @beta
17
- */
18
- export declare function watch(object: any, subscriber: Subscriber | ((subject: any, args: any) => void)): Disposable;
19
1
  /**
20
2
  * Retrieves the "composed parent" element of a node, ignoring DOM tree boundaries.
21
3
  * When the parent of a node is a shadow-root, it will return the host
@@ -2,8 +2,19 @@ import { Observable } from "../observation/observable.js";
2
2
  import { isString } from "../interfaces.js";
3
3
  import { Updates } from "../observation/update-queue.js";
4
4
  import { DOM } from "../templating/dom.js";
5
+ import { createMetadataLocator } from "../platform.js";
5
6
  const booleanMode = "boolean";
6
7
  const reflectMode = "reflect";
8
+ /**
9
+ * Metadata used to configure a custom attribute's behavior.
10
+ * @public
11
+ */
12
+ export const AttributeConfiguration = Object.freeze({
13
+ /**
14
+ * Locates all attribute configurations associated with a type.
15
+ */
16
+ locate: createMetadataLocator(),
17
+ });
7
18
  /**
8
19
  * A {@link ValueConverter} that converts to and from `boolean` values.
9
20
  * @remarks
@@ -141,7 +152,7 @@ export class AttributeDefinition {
141
152
  */
142
153
  static collect(Owner, ...attributeLists) {
143
154
  const attributes = [];
144
- attributeLists.push(Owner.attributes);
155
+ attributeLists.push(AttributeConfiguration.locate(Owner));
145
156
  for (let i = 0, ii = attributeLists.length; i < ii; ++i) {
146
157
  const list = attributeLists[i];
147
158
  if (list === void 0) {
@@ -171,9 +182,7 @@ export function attr(configOrTarget, prop) {
171
182
  // - @attr({...opts})
172
183
  config.property = $prop;
173
184
  }
174
- const attributes = $target.constructor.attributes ||
175
- ($target.constructor.attributes = []);
176
- attributes.push(config);
185
+ AttributeConfiguration.locate($target.constructor).push(config);
177
186
  }
178
187
  if (arguments.length > 1) {
179
188
  // Non invocation: