@microsoft/fast-element 2.0.0-beta.21 → 2.0.0-beta.22

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 (56) hide show
  1. package/CHANGELOG.json +33 -0
  2. package/CHANGELOG.md +12 -1
  3. package/dist/dts/binding/binding.d.ts +49 -0
  4. package/dist/dts/binding/normalize.d.ts +9 -0
  5. package/dist/dts/binding/one-time.d.ts +11 -0
  6. package/dist/dts/binding/one-way.d.ts +20 -0
  7. package/dist/dts/{templating/binding-signal.d.ts → binding/signal.d.ts} +1 -1
  8. package/dist/dts/{templating/binding-two-way.d.ts → binding/two-way.d.ts} +3 -4
  9. package/dist/dts/components/element-controller.d.ts +20 -5
  10. package/dist/dts/context.d.ts +20 -7
  11. package/dist/dts/index.d.ts +6 -2
  12. package/dist/dts/interfaces.d.ts +4 -4
  13. package/dist/dts/metadata.d.ts +1 -0
  14. package/dist/dts/platform.d.ts +9 -1
  15. package/dist/dts/styles/css-binding-directive.d.ts +60 -0
  16. package/dist/dts/styles/css.d.ts +9 -2
  17. package/dist/dts/styles/host.d.ts +2 -5
  18. package/dist/dts/templating/{binding.d.ts → html-binding-directive.d.ts} +3 -34
  19. package/dist/dts/templating/html-directive.d.ts +3 -35
  20. package/dist/dts/templating/render.d.ts +19 -5
  21. package/dist/dts/templating/repeat.d.ts +3 -2
  22. package/dist/dts/templating/template.d.ts +2 -6
  23. package/dist/dts/templating/view.d.ts +16 -6
  24. package/dist/dts/testing/fakes.d.ts +2 -1
  25. package/dist/esm/binding/binding.js +18 -0
  26. package/dist/esm/binding/normalize.js +17 -0
  27. package/dist/esm/binding/one-time.js +21 -0
  28. package/dist/esm/binding/one-way.js +30 -0
  29. package/dist/esm/{templating/binding-signal.js → binding/signal.js} +5 -8
  30. package/dist/esm/{templating/binding-two-way.js → binding/two-way.js} +11 -15
  31. package/dist/esm/components/element-controller.js +33 -8
  32. package/dist/esm/context.js +22 -1
  33. package/dist/esm/index.js +8 -2
  34. package/dist/esm/interfaces.js +3 -3
  35. package/dist/esm/metadata.js +3 -1
  36. package/dist/esm/observation/observable.js +3 -6
  37. package/dist/esm/platform.js +9 -0
  38. package/dist/esm/styles/css-binding-directive.js +76 -0
  39. package/dist/esm/styles/css.js +14 -2
  40. package/dist/esm/templating/compiler.js +2 -1
  41. package/dist/esm/templating/{binding.js → html-binding-directive.js} +3 -70
  42. package/dist/esm/templating/html-directive.js +2 -25
  43. package/dist/esm/templating/render.js +25 -12
  44. package/dist/esm/templating/repeat.js +3 -3
  45. package/dist/esm/templating/template.js +9 -10
  46. package/dist/esm/templating/view.js +2 -6
  47. package/dist/esm/testing/fakes.js +1 -1
  48. package/dist/fast-element.api.json +1127 -342
  49. package/dist/fast-element.d.ts +125 -41
  50. package/dist/fast-element.debug.js +217 -117
  51. package/dist/fast-element.debug.min.js +1 -1
  52. package/dist/fast-element.js +217 -117
  53. package/dist/fast-element.min.js +1 -1
  54. package/dist/fast-element.untrimmed.d.ts +132 -80
  55. package/docs/api-report.md +52 -51
  56. package/package.json +5 -5
package/CHANGELOG.json CHANGED
@@ -1,6 +1,39 @@
1
1
  {
2
2
  "name": "@microsoft/fast-element",
3
3
  "entries": [
4
+ {
5
+ "date": "Sat, 11 Mar 2023 00:09:48 GMT",
6
+ "tag": "@microsoft/fast-element_v2.0.0-beta.22",
7
+ "version": "2.0.0-beta.22",
8
+ "comments": {
9
+ "prerelease": [
10
+ {
11
+ "author": "rob@bluespire.com",
12
+ "package": "@microsoft/fast-element",
13
+ "commit": "1c81922fbc9a7596330d53251975fb3f47357361",
14
+ "comment": "feat: add Context.for"
15
+ },
16
+ {
17
+ "author": "rob@bluespire.com",
18
+ "package": "@microsoft/fast-element",
19
+ "commit": "70eb15bc13d9f4d849bc5b1fe4d591a23e57c935",
20
+ "comment": "feat: enable data binding in CSS"
21
+ },
22
+ {
23
+ "author": "32497422+KingOfTac@users.noreply.github.com",
24
+ "package": "@microsoft/fast-element",
25
+ "commit": "d0ef0d6b1540ed90730187b45bdaf47aa9dcb183",
26
+ "comment": "add directives support for createElementTemplate"
27
+ },
28
+ {
29
+ "author": "rob@bluespire.com",
30
+ "package": "@microsoft/fast-element",
31
+ "commit": "24ec7cb05e955c5b916f611e96c47da665556604",
32
+ "comment": "fix: clean up toJSON noop on core fast-element types"
33
+ }
34
+ ]
35
+ }
36
+ },
4
37
  {
5
38
  "date": "Tue, 14 Feb 2023 04:02:35 GMT",
6
39
  "tag": "@microsoft/fast-element_v2.0.0-beta.21",
package/CHANGELOG.md CHANGED
@@ -1,9 +1,20 @@
1
1
  # Change Log - @microsoft/fast-element
2
2
 
3
- This log was last generated on Tue, 14 Feb 2023 04:02:35 GMT and should not be manually modified.
3
+ This log was last generated on Sat, 11 Mar 2023 00:09:48 GMT and should not be manually modified.
4
4
 
5
5
  <!-- Start content -->
6
6
 
7
+ ## 2.0.0-beta.22
8
+
9
+ Sat, 11 Mar 2023 00:09:48 GMT
10
+
11
+ ### Changes
12
+
13
+ - feat: add Context.for (rob@bluespire.com)
14
+ - feat: enable data binding in CSS (rob@bluespire.com)
15
+ - add directives support for createElementTemplate (32497422+KingOfTac@users.noreply.github.com)
16
+ - fix: clean up toJSON noop on core fast-element types (rob@bluespire.com)
17
+
7
18
  ## 2.0.0-beta.21
8
19
 
9
20
  Tue, 14 Feb 2023 04:02:35 GMT
@@ -0,0 +1,49 @@
1
+ import type { DOMAspect, DOMPolicy } from "../dom.js";
2
+ import type { Subscriber } from "../observation/notifier.js";
3
+ import type { Expression, ExpressionObserver } from "../observation/observable.js";
4
+ /**
5
+ * The directive from which a binding originates.
6
+ *
7
+ * @public
8
+ */
9
+ export interface BindingDirective {
10
+ /**
11
+ * The binding.
12
+ */
13
+ readonly dataBinding: Binding;
14
+ /**
15
+ * The evaluated target aspect.
16
+ */
17
+ readonly targetAspect?: string;
18
+ /**
19
+ * The type of aspect to target.
20
+ */
21
+ readonly aspectType?: DOMAspect;
22
+ }
23
+ /**
24
+ * Captures a binding expression along with related information and capabilities.
25
+ *
26
+ * @public
27
+ */
28
+ export declare abstract class Binding<TSource = any, TReturn = any, TParent = any> {
29
+ evaluate: Expression<TSource, TReturn, TParent>;
30
+ policy?: DOMPolicy | undefined;
31
+ isVolatile: boolean;
32
+ /**
33
+ * Options associated with the binding.
34
+ */
35
+ options?: any;
36
+ /**
37
+ * Creates a binding.
38
+ * @param evaluate - Evaluates the binding.
39
+ * @param policy - The security policy to associate with this binding.
40
+ * @param isVolatile - Indicates whether the binding is volatile.
41
+ */
42
+ constructor(evaluate: Expression<TSource, TReturn, TParent>, policy?: DOMPolicy | undefined, isVolatile?: boolean);
43
+ /**
44
+ * Creates an observer capable of notifying a subscriber when the output of a binding changes.
45
+ * @param subscriber - The subscriber to changes in the binding.
46
+ * @param directive - The Binding directive to create the observer for.
47
+ */
48
+ abstract createObserver(subscriber: Subscriber, directive: BindingDirective): ExpressionObserver<TSource, TReturn, TParent>;
49
+ }
@@ -0,0 +1,9 @@
1
+ import type { Expression } from "../observation/observable.js";
2
+ import { Binding } from "./binding.js";
3
+ /**
4
+ * Normalizes the input value into a binding.
5
+ * @param value - The value to create the default binding for.
6
+ * @returns A binding configuration for the provided value.
7
+ * @public
8
+ */
9
+ export declare function normalizeBinding<TSource = any, TReturn = any, TParent = any>(value: Expression<TSource, TReturn, TParent> | Binding<TSource, TReturn, TParent> | {}): Binding<TSource, TReturn, TParent>;
@@ -0,0 +1,11 @@
1
+ import type { DOMPolicy } from "../dom.js";
2
+ import type { Expression } from "../observation/observable.js";
3
+ import { Binding } from "./binding.js";
4
+ /**
5
+ * Creates a one time binding
6
+ * @param expression - The binding to refresh when signaled.
7
+ * @param policy - The security policy to associate with th binding.
8
+ * @returns A binding configuration.
9
+ * @public
10
+ */
11
+ export declare function oneTime<T = any>(expression: Expression<T>, policy?: DOMPolicy): Binding<T>;
@@ -0,0 +1,20 @@
1
+ import type { DOMPolicy } from "../dom.js";
2
+ import { Expression } from "../observation/observable.js";
3
+ import { Binding } from "./binding.js";
4
+ /**
5
+ * Creates an standard binding.
6
+ * @param expression - The binding to refresh when changed.
7
+ * @param policy - The security policy to associate with th binding.
8
+ * @param isVolatile - Indicates whether the binding is volatile or not.
9
+ * @returns A binding configuration.
10
+ * @public
11
+ */
12
+ export declare function oneWay<T = any>(expression: Expression<T>, policy?: DOMPolicy, isVolatile?: boolean): Binding<T>;
13
+ /**
14
+ * Creates an event listener binding.
15
+ * @param expression - The binding to invoke when the event is raised.
16
+ * @param options - Event listener options.
17
+ * @returns A binding configuration.
18
+ * @public
19
+ */
20
+ export declare function listener<T = any>(expression: Expression<T>, options?: AddEventListenerOptions): Binding<T>;
@@ -1,7 +1,7 @@
1
1
  import type { Expression } from "../observation/observable.js";
2
2
  import type { Subscriber } from "../observation/notifier.js";
3
3
  import type { DOMPolicy } from "../dom.js";
4
- import { Binding } from "./html-directive.js";
4
+ import { Binding } from "./binding.js";
5
5
  export declare const Signal: Readonly<{
6
6
  subscribe(signal: string, subscriber: Subscriber): void;
7
7
  unsubscribe(signal: string, subscriber: Subscriber): void;
@@ -1,7 +1,6 @@
1
1
  import type { DOMPolicy } from "../dom.js";
2
2
  import { Expression } from "../observation/observable.js";
3
- import type { HTMLBindingDirective } from "./binding.js";
4
- import { Binding } from "./html-directive.js";
3
+ import { Binding, BindingDirective } from "./binding.js";
5
4
  /**
6
5
  * The twoWay binding options.
7
6
  * @public
@@ -17,10 +16,10 @@ export declare type TwoWayBindingOptions = {
17
16
  export interface TwoWaySettings {
18
17
  /**
19
18
  * Determines which event to listen to, to detect changes in the view.
20
- * @param directive - The directive to determine the change event for.
19
+ * @param bindingSource - The directive to determine the change event for.
21
20
  * @param target - The target element to determine the change event for.
22
21
  */
23
- determineChangeEvent(directive: HTMLBindingDirective, target: HTMLElement): string;
22
+ determineChangeEvent(bindingSource: BindingDirective, target: HTMLElement): string;
24
23
  }
25
24
  export declare const TwoWaySettings: Readonly<{
26
25
  /**
@@ -1,4 +1,5 @@
1
1
  import { PropertyChangeNotifier } from "../observation/notifier.js";
2
+ import { ExecutionContext, ExpressionController, SourceLifetime } from "../observation/observable.js";
2
3
  import { ElementStyles } from "../styles/element-styles.js";
3
4
  import type { HostBehavior, HostController } from "../styles/host.js";
4
5
  import type { StyleStrategy, StyleTarget } from "../styles/style-strategy.js";
@@ -59,6 +60,18 @@ export declare class ElementController<TElement extends HTMLElement = HTMLElemen
59
60
  * connected to the document.
60
61
  */
61
62
  get isConnected(): boolean;
63
+ /**
64
+ * The context the expression is evaluated against.
65
+ */
66
+ get context(): ExecutionContext;
67
+ /**
68
+ * Indicates whether the controller is bound.
69
+ */
70
+ get isBound(): boolean;
71
+ /**
72
+ * Indicates how the source's lifetime relates to the controller's lifetime.
73
+ */
74
+ get sourceLifetime(): SourceLifetime | undefined;
62
75
  /**
63
76
  * Gets/sets the template used to render the component.
64
77
  * @remarks
@@ -80,6 +93,13 @@ export declare class ElementController<TElement extends HTMLElement = HTMLElemen
80
93
  * @internal
81
94
  */
82
95
  constructor(element: TElement, definition: FASTElementDefinition);
96
+ /**
97
+ * Registers an unbind handler with the controller.
98
+ * @param behavior - An object to call when the controller unbinds.
99
+ */
100
+ onUnbind(behavior: {
101
+ unbind(controller: ExpressionController<TElement>): any;
102
+ }): void;
83
103
  /**
84
104
  * Adds the behavior to the component.
85
105
  * @param behavior - The behavior to add.
@@ -125,11 +145,6 @@ export declare class ElementController<TElement extends HTMLElement = HTMLElemen
125
145
  * Only emits events if connected.
126
146
  */
127
147
  emit(type: string, detail?: any, options?: Omit<CustomEventInit, "detail">): void | boolean;
128
- /**
129
- * Opts out of JSON stringification.
130
- * @internal
131
- */
132
- toJSON: () => undefined;
133
148
  private renderTemplate;
134
149
  /**
135
150
  * Locates or creates a controller for the specified element.
@@ -42,13 +42,20 @@ export declare const Context: Readonly<{
42
42
  * The event type used for W3C Context Protocol requests.
43
43
  */
44
44
  eventType: "context-request";
45
+ /**
46
+ * Returns a FASTContext object from the global context registry matching the given name if found.
47
+ * Otherwise, returns a new FASTContext with this name.
48
+ * @param name - The name of the FASTContext to get or create.
49
+ * @returns A FASTContext object.
50
+ */
51
+ for<T = unknown>(name: string): FASTContext<T>;
45
52
  /**
46
53
  * Creates a W3C Community Protocol-based Context object to use in requesting/providing
47
54
  * context through the DOM.
48
55
  * @param name - The name to use for the connext. Useful in debugging.
49
56
  * @param initialValue - An optional initial value to use if a context handler isn't found.
50
57
  */
51
- create<T = unknown>(name: string, initialValue?: T | undefined): FASTContext<T>;
58
+ create<T_1 = unknown>(name: string, initialValue?: T_1 | undefined): FASTContext<T_1>;
52
59
  /**
53
60
  * Sets the strategy used by all FAST-specific context requests made through the
54
61
  * Context.request, Context.get, Context.defineProperty, and ContextDecorator APIs.
@@ -65,7 +72,7 @@ export declare const Context: Readonly<{
65
72
  * Uses the default request strategy to locate the context. If no context is found
66
73
  * then the initial value of the context is returned.
67
74
  */
68
- get<T_1 extends UnknownContext>(target: EventTarget, context: T_1): ContextType<T_1>;
75
+ get<T_2 extends UnknownContext>(target: EventTarget, context: T_2): ContextType<T_2>;
69
76
  /**
70
77
  * Requests the context value for the target node.
71
78
  * @param target - The target to request the context for.
@@ -76,7 +83,7 @@ export declare const Context: Readonly<{
76
83
  * @remarks
77
84
  * Uses the default request strategy to locate the context.
78
85
  */
79
- request<T_2 extends UnknownContext>(target: EventTarget, context: T_2, callback: ContextCallback<ContextType<T_2>>, multiple?: boolean): void;
86
+ request<T_3 extends UnknownContext>(target: EventTarget, context: T_3, callback: ContextCallback<ContextType<T_3>>, multiple?: boolean): void;
80
87
  /**
81
88
  *
82
89
  * @param target - The target to dispatch the context event on.
@@ -88,8 +95,14 @@ export declare const Context: Readonly<{
88
95
  * This API does NOT use the default request strategy. It always dispatches
89
96
  * an event through the DOM.
90
97
  */
91
- dispatch<T_3 extends UnknownContext>(target: EventTarget, context: T_3, callback: ContextCallback<ContextType<T_3>>, multiple?: boolean): void;
92
- provide<T_4 extends UnknownContext>(target: EventTarget, context: T_4, value: ContextType<T_4>): void;
98
+ dispatch<T_4 extends UnknownContext>(target: EventTarget, context: T_4, callback: ContextCallback<ContextType<T_4>>, multiple?: boolean): void;
99
+ /**
100
+ * Enables an event target to provide a context value.
101
+ * @param target The target to provide the context value for.
102
+ * @param context The context to provide the value for.
103
+ * @param value The value to provide for the context.
104
+ */
105
+ provide<T_5 extends UnknownContext>(target: EventTarget, context: T_5, value: ContextType<T_5>): void;
93
106
  /**
94
107
  *
95
108
  * @param target - The target on which to handle context requests.
@@ -99,7 +112,7 @@ export declare const Context: Readonly<{
99
112
  * If a context is not provided then the callback will be invoked for all context
100
113
  * requests that are received on the target.
101
114
  */
102
- handle<T_5 extends UnknownContext>(target: EventTarget, callback: (event: ContextEvent<T_5>) => void, context?: T_5 | undefined): void;
115
+ handle<T_6 extends UnknownContext>(target: EventTarget, callback: (event: ContextEvent<T_6>) => void, context?: T_6 | undefined): void;
103
116
  /**
104
117
  * Defines a getter-only property on the target that will return the context
105
118
  * value for the target.
@@ -110,7 +123,7 @@ export declare const Context: Readonly<{
110
123
  * Uses the default request strategy to locate the context and will return the
111
124
  * initialValue if the context isn't handled.
112
125
  */
113
- defineProperty<T_6 extends UnknownContext>(target: Constructable<EventTarget> | EventTarget, propertyName: string, context: T_6): void;
126
+ defineProperty<T_7 extends UnknownContext>(target: Constructable<EventTarget> | EventTarget, propertyName: string, context: T_7): void;
114
127
  }>;
115
128
  /**
116
129
  * An unknown context type.
@@ -1,19 +1,23 @@
1
1
  export type { Callable, Constructable, Class, Disposable, FASTGlobal, TrustedTypesPolicy, } from "./interfaces.js";
2
- export * from "./platform.js";
2
+ export { FAST, emptyArray } from "./platform.js";
3
3
  export * from "./dom.js";
4
4
  export * from "./observation/observable.js";
5
5
  export * from "./observation/notifier.js";
6
6
  export * from "./observation/arrays.js";
7
7
  export * from "./observation/update-queue.js";
8
+ export * from "./binding/binding.js";
9
+ export * from "./binding/one-way.js";
10
+ export * from "./binding/one-time.js";
8
11
  export * from "./styles/element-styles.js";
9
12
  export * from "./styles/css.js";
10
13
  export * from "./styles/css-directive.js";
11
14
  export * from "./styles/host.js";
12
15
  export * from "./styles/style-strategy.js";
16
+ export * from "./styles/css-binding-directive.js";
13
17
  export * from "./templating/template.js";
14
18
  export * from "./templating/compiler.js";
15
19
  export { Markup, Parser } from "./templating/markup.js";
16
- export * from "./templating/binding.js";
20
+ export * from "./templating/html-binding-directive.js";
17
21
  export * from "./templating/html-directive.js";
18
22
  export * from "./templating/ref.js";
19
23
  export * from "./templating/when.js";
@@ -46,7 +46,7 @@ export declare type TrustedTypesPolicy = {
46
46
  };
47
47
  /**
48
48
  * Reverses all readonly members, making them mutable.
49
- * @internal
49
+ * @public
50
50
  */
51
51
  export declare type Mutable<T> = {
52
52
  -readonly [P in keyof T]: T[P];
@@ -133,16 +133,16 @@ export declare const enum Message {
133
133
  }
134
134
  /**
135
135
  * Determines whether or not an object is a function.
136
- * @internal
136
+ * @public
137
137
  */
138
138
  export declare const isFunction: (object: any) => object is Function;
139
139
  /**
140
140
  * Determines whether or not an object is a string.
141
- * @internal
141
+ * @public
142
142
  */
143
143
  export declare const isString: (object: any) => object is string;
144
144
  /**
145
145
  * A function which does nothing.
146
- * @internal
146
+ * @public
147
147
  */
148
148
  export declare const noop: () => undefined;
@@ -1,6 +1,7 @@
1
1
  import type { Constructable } from "./interfaces.js";
2
2
  /**
3
3
  * Provides basic metadata capabilities used by Context and Dependency Injection.
4
+ * @public
4
5
  */
5
6
  export declare const Metadata: Readonly<{
6
7
  /**
@@ -1,4 +1,4 @@
1
- import type { FASTGlobal } from "./interfaces.js";
1
+ import { FASTGlobal } from "./interfaces.js";
2
2
  import "./polyfills.js";
3
3
  /**
4
4
  * The FAST global.
@@ -40,3 +40,11 @@ export declare function createTypeRegistry<TDefinition extends TypeDefinition>()
40
40
  * @internal
41
41
  */
42
42
  export declare function createMetadataLocator<TMetadata>(): (target: {}) => TMetadata[];
43
+ /**
44
+ * Makes a type noop for JSON serialization.
45
+ * @param type - The type to make noop for JSON serialization.
46
+ * @internal
47
+ */
48
+ export declare function makeSerializationNoop(type: {
49
+ readonly prototype: any;
50
+ }): void;
@@ -0,0 +1,60 @@
1
+ import type { Binding, BindingDirective } from "../binding/binding.js";
2
+ import type { Subscriber } from "../observation/notifier.js";
3
+ import type { ExpressionObserver } from "../observation/observable.js";
4
+ import { AddBehavior, CSSDirective } from "./css-directive.js";
5
+ import type { ComposableStyles } from "./element-styles.js";
6
+ import type { HostBehavior, HostController } from "./host.js";
7
+ declare type CSSBindingEntry = {
8
+ observer: ExpressionObserver;
9
+ controller: HostController;
10
+ };
11
+ /**
12
+ * Enables bindings in CSS.
13
+ *
14
+ * @public
15
+ */
16
+ export declare class CSSBindingDirective implements HostBehavior, Subscriber, CSSDirective, BindingDirective {
17
+ readonly dataBinding: Binding;
18
+ readonly targetAspect: string;
19
+ /**
20
+ * Creates an instance of CSSBindingDirective.
21
+ * @param dataBinding - The binding to use in CSS.
22
+ * @param targetAspect - The CSS property to target.
23
+ */
24
+ constructor(dataBinding: Binding, targetAspect: string);
25
+ /**
26
+ * Creates a CSS fragment to interpolate into the CSS document.
27
+ * @returns - the string to interpolate into CSS
28
+ */
29
+ createCSS(add: AddBehavior): ComposableStyles;
30
+ /**
31
+ * Executed when this behavior is attached to a controller.
32
+ * @param controller - Controls the behavior lifecycle.
33
+ */
34
+ addedCallback(controller: HostController<HTMLElement & {
35
+ $cssBindings: Map<CSSBindingDirective, CSSBindingEntry>;
36
+ }>): void;
37
+ /**
38
+ * Executed when this behavior's host is connected.
39
+ * @param controller - Controls the behavior lifecycle.
40
+ */
41
+ connectedCallback(controller: HostController<HTMLElement & {
42
+ $cssBindings: Map<CSSBindingDirective, CSSBindingEntry>;
43
+ }>): void;
44
+ /**
45
+ * Executed when this behavior is detached from a controller.
46
+ * @param controller - Controls the behavior lifecycle.
47
+ */
48
+ removedCallback(controller: HostController<HTMLElement & {
49
+ $cssBindings: Map<CSSBindingDirective, CSSBindingEntry>;
50
+ }>): void;
51
+ /**
52
+ * Called when a subject this instance has subscribed to changes.
53
+ * @param subject - The subject of the change.
54
+ * @param args - The event args detailing the change that occurred.
55
+ *
56
+ * @internal
57
+ */
58
+ handleChange(_: any, observer: ExpressionObserver): void;
59
+ }
60
+ export {};
@@ -1,5 +1,12 @@
1
+ import type { Expression } from "../observation/observable.js";
2
+ import { Binding } from "../binding/binding.js";
1
3
  import { CSSDirective } from "./css-directive.js";
2
4
  import { ComposableStyles, ElementStyles } from "./element-styles.js";
5
+ /**
6
+ * Represents the types of values that can be interpolated into a template.
7
+ * @public
8
+ */
9
+ export declare type CSSValue<TSource, TParent = any> = Expression<TSource, any, TParent> | Binding<TSource, any, TParent> | ComposableStyles | CSSDirective;
3
10
  /**
4
11
  * Transforms a template literal string into styles.
5
12
  * @param strings - The string fragments that are interpolated with the values.
@@ -9,14 +16,14 @@ import { ComposableStyles, ElementStyles } from "./element-styles.js";
9
16
  * Use the .partial method to create partial CSS fragments.
10
17
  * @public
11
18
  */
12
- export declare type CSSTemplateTag = ((strings: TemplateStringsArray, ...values: (ComposableStyles | CSSDirective)[]) => ElementStyles) & {
19
+ export declare type CSSTemplateTag = (<TSource = any, TParent = any>(strings: TemplateStringsArray, ...values: CSSValue<TSource, TParent>[]) => ElementStyles) & {
13
20
  /**
14
21
  * Transforms a template literal string into partial CSS.
15
22
  * @param strings - The string fragments that are interpolated with the values.
16
23
  * @param values - The values that are interpolated with the string fragments.
17
24
  * @public
18
25
  */
19
- partial(strings: TemplateStringsArray, ...values: (ComposableStyles | CSSDirective)[]): CSSDirective;
26
+ partial<TSource = any, TParent = any>(strings: TemplateStringsArray, ...values: CSSValue<TSource, TParent>[]): CSSDirective;
20
27
  };
21
28
  /**
22
29
  * Transforms a template literal string into styles.
@@ -1,14 +1,11 @@
1
+ import type { ExpressionController } from "../observation/observable.js";
1
2
  import type { ElementStyles } from "./element-styles.js";
2
3
  /**
3
4
  * Controls the lifecycle and context of behaviors and styles
4
5
  * associated with a component host.
5
6
  * @public
6
7
  */
7
- export interface HostController<TSource = any> {
8
- /**
9
- * The component source.
10
- */
11
- readonly source: TSource;
8
+ export interface HostController<TSource = any> extends ExpressionController<TSource> {
12
9
  /**
13
10
  * Indicates whether the host is connected or not.
14
11
  */
@@ -1,6 +1,7 @@
1
1
  import { ExecutionContext, Expression, ExpressionObserver } from "../observation/observable.js";
2
2
  import { DOMAspect, DOMPolicy } from "../dom.js";
3
- import { AddViewBehaviorFactory, Aspected, Binding, HTMLDirective, ViewBehavior, ViewBehaviorFactory, ViewController } from "./html-directive.js";
3
+ import type { Binding, BindingDirective } from "../binding/binding.js";
4
+ import { AddViewBehaviorFactory, Aspected, HTMLDirective, ViewBehavior, ViewBehaviorFactory, ViewController } from "./html-directive.js";
4
5
  /**
5
6
  * A simple View that can be interpolated into HTML content.
6
7
  * @public
@@ -42,7 +43,7 @@ export interface ContentTemplate {
42
43
  * A directive that applies bindings.
43
44
  * @public
44
45
  */
45
- export declare class HTMLBindingDirective implements HTMLDirective, ViewBehaviorFactory, ViewBehavior, Aspected {
46
+ export declare class HTMLBindingDirective implements HTMLDirective, ViewBehaviorFactory, ViewBehavior, Aspected, BindingDirective {
46
47
  dataBinding: Binding;
47
48
  private data;
48
49
  private updateTarget;
@@ -97,35 +98,3 @@ export declare class HTMLBindingDirective implements HTMLDirective, ViewBehavior
97
98
  /** @internal */
98
99
  handleChange(binding: Expression, observer: ExpressionObserver): void;
99
100
  }
100
- /**
101
- * Creates an standard binding.
102
- * @param expression - The binding to refresh when changed.
103
- * @param policy - The security policy to associate with th binding.
104
- * @param isVolatile - Indicates whether the binding is volatile or not.
105
- * @returns A binding configuration.
106
- * @public
107
- */
108
- export declare function bind<T = any>(expression: Expression<T>, policy?: DOMPolicy, isVolatile?: boolean): Binding<T>;
109
- /**
110
- * Creates a one time binding
111
- * @param expression - The binding to refresh when signaled.
112
- * @param policy - The security policy to associate with th binding.
113
- * @returns A binding configuration.
114
- * @public
115
- */
116
- export declare function oneTime<T = any>(expression: Expression<T>, policy?: DOMPolicy): Binding<T>;
117
- /**
118
- * Creates an event listener binding.
119
- * @param expression - The binding to invoke when the event is raised.
120
- * @param options - Event listener options.
121
- * @returns A binding configuration.
122
- * @public
123
- */
124
- export declare function listener<T = any>(expression: Expression<T>, options?: AddEventListenerOptions): Binding<T>;
125
- /**
126
- * Normalizes the input value into a binding.
127
- * @param value - The value to create the default binding for.
128
- * @returns A binding configuration for the provided value.
129
- * @public
130
- */
131
- export declare function normalizeBinding<TSource = any, TReturn = any, TParent = any>(value: Expression<TSource, TReturn, TParent> | Binding<TSource, TReturn, TParent> | {}): Binding<TSource, TReturn, TParent>;
@@ -1,7 +1,7 @@
1
1
  import { DOMAspect, DOMPolicy } from "../dom.js";
2
- import { Constructable } from "../interfaces.js";
3
- import type { Subscriber } from "../observation/notifier.js";
4
- import type { Expression, ExpressionController, ExpressionObserver } from "../observation/observable.js";
2
+ import type { Constructable } from "../interfaces.js";
3
+ import type { Binding } from "../binding/binding.js";
4
+ import type { ExpressionController } from "../observation/observable.js";
5
5
  /**
6
6
  * The target nodes available to a behavior.
7
7
  * @public
@@ -157,44 +157,12 @@ export declare const HTMLDirective: Readonly<{
157
157
  * @public
158
158
  */
159
159
  export declare function htmlDirective(options?: PartialHTMLDirectiveDefinition): (type: Constructable<HTMLDirective>) => void;
160
- /**
161
- * Captures a binding expression along with related information and capabilities.
162
- *
163
- * @public
164
- */
165
- export declare abstract class Binding<TSource = any, TReturn = any, TParent = any> {
166
- evaluate: Expression<TSource, TReturn, TParent>;
167
- policy?: DOMPolicy | undefined;
168
- isVolatile: boolean;
169
- /**
170
- * Options associated with the binding.
171
- */
172
- options?: any;
173
- /**
174
- * Creates a binding.
175
- * @param evaluate - Evaluates the binding.
176
- * @param policy - The security policy to associate with this binding.
177
- * @param isVolatile - Indicates whether the binding is volatile.
178
- */
179
- constructor(evaluate: Expression<TSource, TReturn, TParent>, policy?: DOMPolicy | undefined, isVolatile?: boolean);
180
- /**
181
- * Creates an observer capable of notifying a subscriber when the output of a binding changes.
182
- * @param directive - The HTML Directive to create the observer for.
183
- * @param subscriber - The subscriber to changes in the binding.
184
- */
185
- abstract createObserver(directive: HTMLDirective, subscriber: Subscriber): ExpressionObserver<TSource, TReturn, TParent>;
186
- }
187
160
  /**
188
161
  * A base class used for attribute directives that don't need internal state.
189
162
  * @public
190
163
  */
191
164
  export declare abstract class StatelessAttachedAttributeDirective<TOptions> implements HTMLDirective, ViewBehaviorFactory, ViewBehavior {
192
165
  protected options: TOptions;
193
- /**
194
- * Opts out of JSON stringification.
195
- * @internal
196
- */
197
- toJSON: () => undefined;
198
166
  /**
199
167
  * Creates an instance of RefDirective.
200
168
  * @param options - The options to use in configuring the directive.