@microsoft/fast-element 2.0.0-beta.20 → 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 (64) hide show
  1. package/CHANGELOG.json +54 -0
  2. package/CHANGELOG.md +21 -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 +26 -13
  11. package/dist/dts/dom-policy.d.ts +15 -0
  12. package/dist/dts/index.d.ts +6 -2
  13. package/dist/dts/interfaces.d.ts +6 -5
  14. package/dist/dts/metadata.d.ts +6 -5
  15. package/dist/dts/pending-task.d.ts +19 -7
  16. package/dist/dts/platform.d.ts +10 -2
  17. package/dist/dts/styles/css-binding-directive.d.ts +60 -0
  18. package/dist/dts/styles/css.d.ts +9 -2
  19. package/dist/dts/styles/host.d.ts +2 -5
  20. package/dist/dts/templating/{binding.d.ts → html-binding-directive.d.ts} +3 -34
  21. package/dist/dts/templating/html-directive.d.ts +3 -35
  22. package/dist/dts/templating/render.d.ts +19 -5
  23. package/dist/dts/templating/repeat.d.ts +3 -2
  24. package/dist/dts/templating/template.d.ts +2 -6
  25. package/dist/dts/templating/view.d.ts +16 -6
  26. package/dist/dts/testing/fakes.d.ts +2 -1
  27. package/dist/dts/utilities.d.ts +3 -2
  28. package/dist/esm/binding/binding.js +18 -0
  29. package/dist/esm/binding/normalize.js +17 -0
  30. package/dist/esm/binding/one-time.js +21 -0
  31. package/dist/esm/binding/one-way.js +30 -0
  32. package/dist/esm/{templating/binding-signal.js → binding/signal.js} +5 -8
  33. package/dist/esm/{templating/binding-two-way.js → binding/two-way.js} +11 -15
  34. package/dist/esm/components/element-controller.js +33 -9
  35. package/dist/esm/context.js +24 -3
  36. package/dist/esm/debug.js +1 -0
  37. package/dist/esm/di/di.js +5 -5
  38. package/dist/esm/dom-policy.js +9 -1
  39. package/dist/esm/index.js +8 -2
  40. package/dist/esm/interfaces.js +3 -3
  41. package/dist/esm/metadata.js +11 -8
  42. package/dist/esm/observation/observable.js +3 -6
  43. package/dist/esm/pending-task.js +13 -1
  44. package/dist/esm/platform.js +10 -1
  45. package/dist/esm/styles/css-binding-directive.js +76 -0
  46. package/dist/esm/styles/css.js +14 -2
  47. package/dist/esm/templating/compiler.js +2 -1
  48. package/dist/esm/templating/{binding.js → html-binding-directive.js} +3 -70
  49. package/dist/esm/templating/html-directive.js +2 -25
  50. package/dist/esm/templating/render.js +25 -12
  51. package/dist/esm/templating/repeat.js +3 -3
  52. package/dist/esm/templating/template.js +9 -10
  53. package/dist/esm/templating/view.js +2 -6
  54. package/dist/esm/testing/fakes.js +1 -1
  55. package/dist/esm/utilities.js +3 -2
  56. package/dist/fast-element.api.json +1827 -663
  57. package/dist/fast-element.d.ts +167 -43
  58. package/dist/fast-element.debug.js +227 -120
  59. package/dist/fast-element.debug.min.js +1 -1
  60. package/dist/fast-element.js +226 -120
  61. package/dist/fast-element.min.js +1 -1
  62. package/dist/fast-element.untrimmed.d.ts +134 -82
  63. package/docs/api-report.md +54 -57
  64. package/package.json +5 -5
package/CHANGELOG.json CHANGED
@@ -1,6 +1,60 @@
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
+ },
37
+ {
38
+ "date": "Tue, 14 Feb 2023 04:02:35 GMT",
39
+ "tag": "@microsoft/fast-element_v2.0.0-beta.21",
40
+ "version": "2.0.0-beta.21",
41
+ "comments": {
42
+ "prerelease": [
43
+ {
44
+ "author": "rob@bluespire.com",
45
+ "package": "@microsoft/fast-element",
46
+ "commit": "d38d31d2dd7496b5eb1e7c65b57de9a5e05e8546",
47
+ "comment": "fix: cleanup types, docs, etc. in root source files of fast-element in preparation for release"
48
+ },
49
+ {
50
+ "author": "nicholasrice@users.noreply.github.com",
51
+ "package": "@microsoft/fast-element",
52
+ "commit": "09d57ca18700331d054515c3b3f6fae07528cca0",
53
+ "comment": "Remove un-necessary expression from StyleElementStrategy"
54
+ }
55
+ ]
56
+ }
57
+ },
4
58
  {
5
59
  "date": "Wed, 11 Jan 2023 22:07:47 GMT",
6
60
  "tag": "@microsoft/fast-element_v2.0.0-beta.20",
package/CHANGELOG.md CHANGED
@@ -1,9 +1,29 @@
1
1
  # Change Log - @microsoft/fast-element
2
2
 
3
- This log was last generated on Wed, 11 Jan 2023 22:07:47 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
+
18
+ ## 2.0.0-beta.21
19
+
20
+ Tue, 14 Feb 2023 04:02:35 GMT
21
+
22
+ ### Changes
23
+
24
+ - fix: cleanup types, docs, etc. in root source files of fast-element in preparation for release (rob@bluespire.com)
25
+ - Remove un-necessary expression from StyleElementStrategy (nicholasrice@users.noreply.github.com)
26
+
7
27
  ## 2.0.0-beta.20
8
28
 
9
29
  Wed, 11 Jan 2023 22:07:47 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.
@@ -11,44 +11,51 @@ export declare type Context<T> = {
11
11
  * A constant key that can be used to represent a Context dependency.
12
12
  * The key can be used for context or DI but also doubles as a decorator for
13
13
  * resolving the associated dependency.
14
- * @beta
14
+ * @public
15
15
  */
16
16
  export declare type ContextDecorator<T = any> = Readonly<Context<T>> & PropertyDecorator & ParameterDecorator;
17
17
  /**
18
18
  * A Context object defines an optional initial value for a Context, as well as a name identifier for debugging purposes.
19
19
  * The FASTContext can also be used as a decorator to declare context dependencies or as a key for DI.
20
- * @beta
20
+ * @public
21
21
  */
22
22
  export declare type FASTContext<T> = ContextDecorator<T> & {
23
23
  get(target: EventTarget): T;
24
24
  provide(target: EventTarget, value: T): void;
25
25
  request(target: EventTarget, callback: ContextCallback<T>, multiple?: boolean): void;
26
- handle(target: EventTarget, callback: (event: ContextEvent<FASTContext<T>>) => void): any;
26
+ handle(target: EventTarget, callback: (event: ContextEvent<FASTContext<T>>) => void): void;
27
27
  };
28
28
  /**
29
29
  * A strategy that controls how all Context.request API calls are handled.
30
30
  * @remarks
31
- * By default this is handled via Context.dispatch, which dispatched a ContextEvent.
32
- * @beta
31
+ * By default this is handled via Context.dispatch, which dispatches a ContextEvent.
32
+ * @public
33
33
  */
34
34
  export declare type FASTContextRequestStrategy = <T extends UnknownContext>(target: EventTarget, context: T, callback: ContextCallback<ContextType<T>>, multiple: any) => void;
35
35
  declare const contextEventType = "context-request";
36
36
  /**
37
37
  * Enables using the {@link https://github.com/webcomponents-cg/community-protocols/blob/main/proposals/context.md | W3C Community Context protocol.}
38
- * @beta
38
+ * @public
39
39
  */
40
40
  export declare const Context: Readonly<{
41
41
  /**
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.
@@ -2,10 +2,12 @@ import { DOMAspect, DOMPolicy, DOMSink } from "./dom.js";
2
2
  import { TrustedTypesPolicy } from "./interfaces.js";
3
3
  /**
4
4
  * A specific DOM sink guard for a node aspect.
5
+ * @public
5
6
  */
6
7
  export declare type DOMSinkGuards = Record<string, (tagName: string | null, aspect: DOMAspect, aspectName: string, sink: DOMSink) => DOMSink>;
7
8
  /**
8
9
  * Aspect-specific guards for a DOM Policy.
10
+ * @public
9
11
  */
10
12
  export declare type DOMAspectGuards = {
11
13
  /**
@@ -35,17 +37,26 @@ export declare type DOMAspectGuards = {
35
37
  };
36
38
  /**
37
39
  * Element-specific guards for a DOM Policy.
40
+ * @public
38
41
  */
39
42
  export declare type DOMElementGuards = Record<string, DOMAspectGuards>;
40
43
  /**
41
44
  * Guard configuration for a DOM Policy.
45
+ * @public
42
46
  */
43
47
  export declare type DOMGuards = {
48
+ /**
49
+ * Guards for specific elements.
50
+ */
44
51
  elements: DOMElementGuards;
52
+ /**
53
+ * General aspect guards independent of the element type.
54
+ */
45
55
  aspects: DOMAspectGuards;
46
56
  };
47
57
  /**
48
58
  * Options for creating a DOM Policy.
59
+ * @public
49
60
  */
50
61
  export declare type DOMPolicyOptions = {
51
62
  /**
@@ -57,6 +68,10 @@ export declare type DOMPolicyOptions = {
57
68
  */
58
69
  guards?: Partial<DOMGuards>;
59
70
  };
71
+ /**
72
+ * A helper for creating DOM policies.
73
+ * @public
74
+ */
60
75
  declare const DOMPolicy: Readonly<{
61
76
  /**
62
77
  * Creates a new DOM Policy object.
@@ -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,14 +46,14 @@ 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];
53
53
  };
54
54
  /**
55
55
  * The FAST global.
56
- * @internal
56
+ * @public
57
57
  */
58
58
  export interface FASTGlobal {
59
59
  /**
@@ -114,6 +114,7 @@ export declare const enum Message {
114
114
  directCallToHTMLTagNotAllowed = 1206,
115
115
  onlySetTemplatePolicyOnce = 1207,
116
116
  cannotSetTemplatePolicyAfterCompilation = 1208,
117
+ blockedByDOMPolicy = 1209,
117
118
  missingElementDefinition = 1401,
118
119
  noRegistrationForContext = 1501,
119
120
  noFactoryForResolver = 1502,
@@ -132,16 +133,16 @@ export declare const enum Message {
132
133
  }
133
134
  /**
134
135
  * Determines whether or not an object is a function.
135
- * @internal
136
+ * @public
136
137
  */
137
138
  export declare const isFunction: (object: any) => object is Function;
138
139
  /**
139
140
  * Determines whether or not an object is a string.
140
- * @internal
141
+ * @public
141
142
  */
142
143
  export declare const isString: (object: any) => object is string;
143
144
  /**
144
145
  * A function which does nothing.
145
- * @internal
146
+ * @public
146
147
  */
147
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
  /**
@@ -8,18 +9,18 @@ export declare const Metadata: Readonly<{
8
9
  * @param Type - The type to get the metadata for.
9
10
  * @returns The metadata array or a frozen empty array if no metadata is found.
10
11
  */
11
- getDesignParamTypes: (Type: any) => any;
12
+ getDesignParamTypes: (Type: Constructable) => readonly any[];
12
13
  /**
13
14
  * Gets the "annotation:paramtypes" metadata for the specified type.
14
15
  * @param Type - The type to get the metadata for.
15
16
  * @returns The metadata array or a frozen empty array if no metadata is found.
16
17
  */
17
- getAnnotationParamTypes: (Type: any) => any;
18
+ getAnnotationParamTypes: (Type: Constructable) => readonly any[];
18
19
  /**
19
- *
20
- * @param Type - Gets the "annotation:paramtypes" metadata for the specified type. If none is found,
20
+ * Gets the "annotation:paramtypes" metadata for the specified type. If none is found,
21
21
  * an empty, mutable metadata array is created and added.
22
- * @returns The metadata array.
22
+ * @param Type - The type to get or create the metadata for.
23
+ * @returns A mutable metadata array.
23
24
  */
24
25
  getOrCreateAnnotationParamTypes(Type: Constructable): any[];
25
26
  }>;
@@ -1,20 +1,32 @@
1
- /**
2
- * This module provides
3
- */
4
1
  /**
5
2
  * An implementation of the https://github.com/webcomponents-cg/community-protocols/blob/main/proposals/pending-task.md proposal.
6
- * @beta
3
+ * @public
7
4
  */
8
5
  export interface PendingTask extends Event {
9
- complete: Promise<void>;
6
+ /**
7
+ * A promise that resolves when the pending task is complete.
8
+ */
9
+ readonly complete: Promise<void>;
10
10
  }
11
11
  /**
12
12
  * A concrete implementation of {@link PendingTask}
13
- * @beta
13
+ * @public
14
14
  */
15
15
  export declare class PendingTaskEvent extends Event implements PendingTask {
16
- complete: Promise<void>;
16
+ readonly complete: Promise<void>;
17
+ /**
18
+ * The type of the pending task event.
19
+ */
17
20
  static readonly type = "pending-task";
21
+ /**
22
+ * Creates an instance of PendingTaskEvent.
23
+ * @param complete - A promise that resolves when the pending task is complete.
24
+ */
18
25
  constructor(complete: Promise<void>);
26
+ /**
27
+ * Determines whether a value is a PendingTaskEvent.
28
+ * @param value - The value to check.
29
+ * @returns True if the value is a PendingTaskEvent; false otherwise.
30
+ */
19
31
  static isPendingTask<T extends Event>(value: T | PendingTask): value is PendingTask;
20
32
  }
@@ -1,8 +1,8 @@
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.
5
- * @internal
5
+ * @public
6
6
  */
7
7
  export declare const FAST: FASTGlobal;
8
8
  /**
@@ -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 {};