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

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 (58) hide show
  1. package/CHANGELOG.json +147 -0
  2. package/CHANGELOG.md +42 -1
  3. package/dist/dts/components/fast-definitions.d.ts +11 -8
  4. package/dist/dts/components/fast-element.d.ts +13 -3
  5. package/dist/dts/context.d.ts +157 -0
  6. package/dist/dts/di/di.d.ts +854 -0
  7. package/dist/dts/hooks.d.ts +2 -2
  8. package/dist/dts/interfaces.d.ts +39 -7
  9. package/dist/dts/metadata.d.ts +25 -0
  10. package/dist/dts/observation/arrays.d.ts +1 -1
  11. package/dist/dts/observation/behavior.d.ts +4 -4
  12. package/dist/dts/observation/observable.d.ts +59 -72
  13. package/dist/dts/styles/element-styles.d.ts +6 -0
  14. package/dist/dts/templating/binding-signal.d.ts +21 -0
  15. package/dist/dts/templating/binding-two-way.d.ts +31 -0
  16. package/dist/dts/templating/binding.d.ts +74 -201
  17. package/dist/dts/templating/compiler.d.ts +1 -2
  18. package/dist/dts/templating/html-directive.d.ts +31 -3
  19. package/dist/dts/templating/render.d.ts +277 -0
  20. package/dist/dts/templating/repeat.d.ts +13 -63
  21. package/dist/dts/templating/template.d.ts +11 -60
  22. package/dist/dts/templating/view.d.ts +9 -9
  23. package/dist/dts/templating/when.d.ts +3 -3
  24. package/dist/dts/testing/exports.d.ts +2 -0
  25. package/dist/dts/testing/fixture.d.ts +90 -0
  26. package/dist/dts/testing/timeout.d.ts +7 -0
  27. package/dist/{tsdoc-metadata.json → dts/tsdoc-metadata.json} +0 -0
  28. package/dist/esm/components/fast-definitions.js +27 -27
  29. package/dist/esm/components/fast-element.js +20 -4
  30. package/dist/esm/context.js +163 -0
  31. package/dist/esm/debug.js +35 -4
  32. package/dist/esm/di/di.js +1349 -0
  33. package/dist/esm/metadata.js +60 -0
  34. package/dist/esm/observation/arrays.js +1 -1
  35. package/dist/esm/observation/observable.js +73 -21
  36. package/dist/esm/platform.js +1 -1
  37. package/dist/esm/styles/element-styles.js +14 -0
  38. package/dist/esm/templating/binding-signal.js +79 -0
  39. package/dist/esm/templating/binding-two-way.js +98 -0
  40. package/dist/esm/templating/binding.js +137 -313
  41. package/dist/esm/templating/compiler.js +30 -7
  42. package/dist/esm/templating/html-directive.js +16 -2
  43. package/dist/esm/templating/render.js +392 -0
  44. package/dist/esm/templating/repeat.js +60 -38
  45. package/dist/esm/templating/template.js +9 -26
  46. package/dist/esm/templating/when.js +5 -4
  47. package/dist/esm/testing/exports.js +2 -0
  48. package/dist/esm/testing/fixture.js +88 -0
  49. package/dist/esm/testing/timeout.js +24 -0
  50. package/dist/fast-element.api.json +8509 -10358
  51. package/dist/fast-element.d.ts +315 -522
  52. package/dist/fast-element.debug.js +417 -438
  53. package/dist/fast-element.debug.min.js +1 -1
  54. package/dist/fast-element.js +382 -434
  55. package/dist/fast-element.min.js +1 -1
  56. package/dist/fast-element.untrimmed.d.ts +324 -529
  57. package/docs/api-report.md +124 -232
  58. package/package.json +32 -4
package/CHANGELOG.json CHANGED
@@ -1,6 +1,153 @@
1
1
  {
2
2
  "name": "@microsoft/fast-element",
3
3
  "entries": [
4
+ {
5
+ "date": "Mon, 18 Jul 2022 21:10:01 GMT",
6
+ "tag": "@microsoft/fast-element_v2.0.0-beta.4",
7
+ "version": "2.0.0-beta.4",
8
+ "comments": {
9
+ "prerelease": [
10
+ {
11
+ "author": "roeisenb@microsoft.com",
12
+ "package": "@microsoft/fast-element",
13
+ "commit": "f9fb9c88902bd81233fb927a7357d4bca7634f29",
14
+ "comment": "feat: extract all error messages from context and DI"
15
+ },
16
+ {
17
+ "author": "roeisenb@microsoft.com",
18
+ "package": "@microsoft/fast-element",
19
+ "commit": "27dc848327b25328e428f67505684d2171b58711",
20
+ "comment": "feat: introduce new binding API"
21
+ },
22
+ {
23
+ "author": "roeisenb@microsoft.com",
24
+ "package": "@microsoft/fast-element",
25
+ "commit": "7f4d6b5587f6eff52e5b7f414e27543bb4d7772d",
26
+ "comment": "Enabled DOM Container fallback functions when a container cannot be located."
27
+ },
28
+ {
29
+ "author": "roeisenb@microsoft.com",
30
+ "package": "@microsoft/fast-element",
31
+ "commit": "0f57d55822bbf97ab69f90efc0a0d100b27e10eb",
32
+ "comment": "feat: add render directive, renderWith decorator, and RenderInstruction"
33
+ },
34
+ {
35
+ "author": "prudepixie@users.noreply.github.com",
36
+ "package": "@microsoft/fast-element",
37
+ "commit": "94e6b0a0e7e1fd1167bd6453c3f7b27efdc91804",
38
+ "comment": "only store removed views if it can't be reused right away"
39
+ },
40
+ {
41
+ "author": "32497422+KingOfTac@users.noreply.github.com",
42
+ "package": "@microsoft/fast-element",
43
+ "commit": "11d5b4075118456b2e7c2a4f32a415eeea94ed7f",
44
+ "comment": "fix: enable createElementTemplate to have undefined attributes"
45
+ },
46
+ {
47
+ "author": "prudepixie@users.noreply.github.com",
48
+ "package": "@microsoft/fast-element",
49
+ "commit": "31296ea2be3981d25f5feb773b2895dbedfaf2c2",
50
+ "comment": "use index to track reusable views"
51
+ },
52
+ {
53
+ "author": "roeisenb@microsoft.com",
54
+ "package": "@microsoft/fast-element",
55
+ "commit": "4567188a47598b3d2589b05f039bea695f2b8875",
56
+ "comment": "feat: enable render, repeat, and when template helpers to handle static data in addition to the already supported dynamic bindings"
57
+ },
58
+ {
59
+ "author": "roeisenb@microsoft.com",
60
+ "package": "@microsoft/fast-element",
61
+ "commit": "f164aa75e62ed71c9386902051c021f1fdfba364",
62
+ "comment": "fix: FASTElementDefinition#isDefined should be true only after define"
63
+ },
64
+ {
65
+ "author": "roeisenb@microsoft.com",
66
+ "package": "@microsoft/fast-element",
67
+ "commit": "aacfde6d1f52a20af5511c5e792f730bd091d452",
68
+ "comment": "feat: move testing and dependency injection to fast-element"
69
+ },
70
+ {
71
+ "author": "roeisenb@microsoft.com",
72
+ "package": "@microsoft/fast-element",
73
+ "commit": "04c51a17dde6d03dc2e2a4de3666cbbec950d900",
74
+ "comment": "fix: warn when host bindings are accidentally applied on non CE views"
75
+ },
76
+ {
77
+ "author": "roeisenb@microsoft.com",
78
+ "package": "@microsoft/fast-element",
79
+ "commit": "b32eb1004960da95b74dba7f111ee859b6655896",
80
+ "comment": "feat: perf and safety improvements to fast element definition"
81
+ }
82
+ ]
83
+ }
84
+ },
85
+ {
86
+ "date": "Wed, 22 Jun 2022 20:17:50 GMT",
87
+ "tag": "@microsoft/fast-element_v2.0.0-beta.3",
88
+ "version": "2.0.0-beta.3",
89
+ "comments": {
90
+ "prerelease": [
91
+ {
92
+ "comment": "fix: correct aspect type for content that looks like an attribute",
93
+ "author": "nicholasrice@users.noreply.github.com",
94
+ "commit": "f28cdb9fdba9cb27904acfad7444de82d447f39e",
95
+ "package": "@microsoft/fast-element"
96
+ }
97
+ ]
98
+ }
99
+ },
100
+ {
101
+ "date": "Wed, 15 Jun 2022 17:41:10 GMT",
102
+ "tag": "@microsoft/fast-element_v2.0.0-beta.2",
103
+ "version": "2.0.0-beta.2",
104
+ "comments": {
105
+ "prerelease": [
106
+ {
107
+ "comment": "doc: add note to FASTElement.metadata API",
108
+ "author": "roeisenb@microsoft.com",
109
+ "commit": "359467f9ae67c46a33dfc28ce86dfd908072695d",
110
+ "package": "@microsoft/fast-element"
111
+ },
112
+ {
113
+ "comment": "when recycle is set to false while itemBinding stays the same, views should be recreated",
114
+ "author": "wendy.hsu@microsoft.com",
115
+ "commit": "9c92b9bb5bc9bf221b439c0a776b3621fdd9d9aa",
116
+ "package": "@microsoft/fast-element"
117
+ },
118
+ {
119
+ "comment": "feat: simplify execution context to align closer with v1",
120
+ "author": "roeisenb@microsoft.com",
121
+ "commit": "488d051999c43b93a0beef4db30a2bddd6bbdc64",
122
+ "package": "@microsoft/fast-element"
123
+ },
124
+ {
125
+ "comment": "feat: ergo improvements to context, array length, and metadata",
126
+ "author": "roeisenb@microsoft.com",
127
+ "commit": "12f5671e215ebd2b95c9cc83f856e233e01e9c4a",
128
+ "package": "@microsoft/fast-element"
129
+ },
130
+ {
131
+ "comment": "feat: move optional bindings out of rollup and list as exports",
132
+ "author": "roeisenb@microsoft.com",
133
+ "commit": "e86a638b9e84cbf36d950025889742944e68e512",
134
+ "package": "@microsoft/fast-element"
135
+ },
136
+ {
137
+ "comment": "fix: make SyntheticViewTemplate type a string so it is generally usable",
138
+ "author": "roeisenb@microsoft.com",
139
+ "commit": "de7f234ef871204fcac2b5df59433d919809341d",
140
+ "package": "@microsoft/fast-element"
141
+ },
142
+ {
143
+ "comment": "feat: implement W3C WC community context protocol and integrate with DI",
144
+ "author": "roeisenb@microsoft.com",
145
+ "commit": "c45297c0ca48b7e5f4343ba48e5183f2bccdb946",
146
+ "package": "@microsoft/fast-element"
147
+ }
148
+ ]
149
+ }
150
+ },
4
151
  {
5
152
  "date": "Wed, 01 Jun 2022 17:53:14 GMT",
6
153
  "tag": "@microsoft/fast-element_v2.0.0-beta.1",
package/CHANGELOG.md CHANGED
@@ -1,9 +1,50 @@
1
1
  # Change Log - @microsoft/fast-element
2
2
 
3
- This log was last generated on Wed, 01 Jun 2022 17:53:14 GMT and should not be manually modified.
3
+ This log was last generated on Mon, 18 Jul 2022 21:10:01 GMT and should not be manually modified.
4
4
 
5
5
  <!-- Start content -->
6
6
 
7
+ ## 2.0.0-beta.4
8
+
9
+ Mon, 18 Jul 2022 21:10:01 GMT
10
+
11
+ ### Changes
12
+
13
+ - feat: extract all error messages from context and DI (roeisenb@microsoft.com)
14
+ - feat: introduce new binding API (roeisenb@microsoft.com)
15
+ - Enabled DOM Container fallback functions when a container cannot be located. (roeisenb@microsoft.com)
16
+ - feat: add render directive, renderWith decorator, and RenderInstruction (roeisenb@microsoft.com)
17
+ - only store removed views if it can't be reused right away (prudepixie@users.noreply.github.com)
18
+ - fix: enable createElementTemplate to have undefined attributes (32497422+KingOfTac@users.noreply.github.com)
19
+ - use index to track reusable views (prudepixie@users.noreply.github.com)
20
+ - feat: enable render, repeat, and when template helpers to handle static data in addition to the already supported dynamic bindings (roeisenb@microsoft.com)
21
+ - fix: FASTElementDefinition#isDefined should be true only after define (roeisenb@microsoft.com)
22
+ - feat: move testing and dependency injection to fast-element (roeisenb@microsoft.com)
23
+ - fix: warn when host bindings are accidentally applied on non CE views (roeisenb@microsoft.com)
24
+ - feat: perf and safety improvements to fast element definition (roeisenb@microsoft.com)
25
+
26
+ ## 2.0.0-beta.3
27
+
28
+ Wed, 22 Jun 2022 20:17:50 GMT
29
+
30
+ ### Changes
31
+
32
+ - fix: correct aspect type for content that looks like an attribute (nicholasrice@users.noreply.github.com)
33
+
34
+ ## 2.0.0-beta.2
35
+
36
+ Wed, 15 Jun 2022 17:41:10 GMT
37
+
38
+ ### Changes
39
+
40
+ - doc: add note to FASTElement.metadata API (roeisenb@microsoft.com)
41
+ - when recycle is set to false while itemBinding stays the same, views should be recreated (wendy.hsu@microsoft.com)
42
+ - feat: simplify execution context to align closer with v1 (roeisenb@microsoft.com)
43
+ - feat: ergo improvements to context, array length, and metadata (roeisenb@microsoft.com)
44
+ - feat: move optional bindings out of rollup and list as exports (roeisenb@microsoft.com)
45
+ - fix: make SyntheticViewTemplate type a string so it is generally usable (roeisenb@microsoft.com)
46
+ - feat: implement W3C WC community context protocol and integrate with DI (roeisenb@microsoft.com)
47
+
7
48
  ## 2.0.0-beta.1
8
49
 
9
50
  Wed, 01 Jun 2022 17:53:14 GMT
@@ -37,7 +37,7 @@ export interface PartialFASTElementDefinition {
37
37
  * @public
38
38
  */
39
39
  export declare class FASTElementDefinition<TType extends Constructable<HTMLElement> = Constructable<HTMLElement>> {
40
- private observedAttributes;
40
+ private platformDefined;
41
41
  /**
42
42
  * The type this element definition describes.
43
43
  */
@@ -78,18 +78,21 @@ export declare class FASTElementDefinition<TType extends Constructable<HTMLEleme
78
78
  * Options controlling how the custom element is defined with the platform.
79
79
  */
80
80
  readonly elementOptions?: ElementDefinitionOptions;
81
- /**
82
- * Creates an instance of FASTElementDefinition.
83
- * @param type - The type this definition is being created for.
84
- * @param nameOrConfig - The name of the element to define or a config object
85
- * that describes the element to define.
86
- */
87
- constructor(type: TType, nameOrConfig?: PartialFASTElementDefinition | string);
81
+ private constructor();
88
82
  /**
89
83
  * Defines a custom element based on this definition.
90
84
  * @param registry - The element registry to define the element in.
85
+ * @remarks
86
+ * This operation is idempotent per registry.
91
87
  */
92
88
  define(registry?: CustomElementRegistry): this;
89
+ /**
90
+ * Creates an instance of FASTElementDefinition.
91
+ * @param type - The type this definition is being created for.
92
+ * @param nameOrDef - The name of the element to define or a config object
93
+ * that describes the element to define.
94
+ */
95
+ static compose<TType extends Constructable<HTMLElement> = Constructable<HTMLElement>>(type: TType, nameOrDef?: string | PartialFASTElementDefinition): FASTElementDefinition<TType>;
93
96
  /**
94
97
  * Gets the element definition associated with the specified type.
95
98
  * @param type - The custom element type to retrieve the definition for.
@@ -1,6 +1,6 @@
1
- import type { Constructable } from "../interfaces.js";
1
+ import { Constructable } from "../interfaces.js";
2
2
  import { Controller } from "./controller.js";
3
- import { PartialFASTElementDefinition } from "./fast-definitions.js";
3
+ import { FASTElementDefinition, PartialFASTElementDefinition } from "./fast-definitions.js";
4
4
  /**
5
5
  * Represents a custom element based on the FASTElement infrastructure.
6
6
  * @public
@@ -45,6 +45,10 @@ export interface FASTElement extends HTMLElement {
45
45
  */
46
46
  attributeChangedCallback(name: string, oldValue: string | null, newValue: string | null): void;
47
47
  }
48
+ declare function compose<TType extends Constructable<HTMLElement> = Constructable<HTMLElement>>(this: TType, nameOrDef: string | PartialFASTElementDefinition): FASTElementDefinition<TType>;
49
+ declare function compose<TType extends Constructable<HTMLElement> = Constructable<HTMLElement>>(type: TType, nameOrDef?: string | PartialFASTElementDefinition): FASTElementDefinition<TType>;
50
+ declare function define<TType extends Constructable<HTMLElement> = Constructable<HTMLElement>>(this: TType, nameOrDef: string | PartialFASTElementDefinition): TType;
51
+ declare function define<TType extends Constructable<HTMLElement> = Constructable<HTMLElement>>(type: TType, nameOrDef?: string | PartialFASTElementDefinition): TType;
48
52
  /**
49
53
  * A minimal base class for FASTElements that also provides
50
54
  * static helpers for working with FASTElements.
@@ -66,7 +70,12 @@ export declare const FASTElement: (new () => HTMLElement & FASTElement) & {
66
70
  * @param nameOrDef - The name of the element to define or a definition object
67
71
  * that describes the element to define.
68
72
  */
69
- define<TType extends Constructable<HTMLElement>>(type: TType, nameOrDef?: string | PartialFASTElementDefinition): TType;
73
+ define: typeof define;
74
+ /**
75
+ * Defines metadata for a FASTElement which can be used to later define the element.
76
+ * @public
77
+ */
78
+ compose: typeof compose;
70
79
  };
71
80
  /**
72
81
  * Decorator: Defines a platform custom element based on `FASTElement`.
@@ -75,3 +84,4 @@ export declare const FASTElement: (new () => HTMLElement & FASTElement) & {
75
84
  * @public
76
85
  */
77
86
  export declare function customElement(nameOrDef: string | PartialFASTElementDefinition): (type: Constructable<HTMLElement>) => void;
87
+ export {};
@@ -0,0 +1,157 @@
1
+ import { Constructable } from "./interfaces.js";
2
+ /**
3
+ * A Context object defines an optional initial value for a Context, as well as a name identifier for debugging purposes.
4
+ * @public
5
+ */
6
+ export declare type Context<T> = {
7
+ readonly name: string;
8
+ readonly initialValue?: T;
9
+ };
10
+ /**
11
+ * A constant key that can be used to represent a Context dependency.
12
+ * The key can be used for context or DI but also doubles as a decorator for
13
+ * resolving the associated dependency.
14
+ * @beta
15
+ */
16
+ export declare type ContextDecorator<T = any> = Readonly<Context<T>> & PropertyDecorator & ParameterDecorator;
17
+ /**
18
+ * A Context object defines an optional initial value for a Context, as well as a name identifier for debugging purposes.
19
+ * The FASTContext can also be used as a decorator to declare context dependencies or as a key for DI.
20
+ * @beta
21
+ */
22
+ export declare type FASTContext<T> = ContextDecorator<T> & {
23
+ get(target: EventTarget): T;
24
+ provide(target: EventTarget, value: T): void;
25
+ request(target: EventTarget, callback: ContextCallback<T>, multiple?: boolean): void;
26
+ handle(target: EventTarget, callback: (event: ContextEvent<FASTContext<T>>) => void): any;
27
+ };
28
+ /**
29
+ * A strategy that controls how all Context.request API calls are handled.
30
+ * @remarks
31
+ * By default this is handled via Context.dispatch, which dispatched a ContextEvent.
32
+ * @beta
33
+ */
34
+ export declare type FASTContextRequestStrategy = <T extends UnknownContext>(target: EventTarget, context: T, callback: ContextCallback<ContextType<T>>, multiple: any) => void;
35
+ declare const contextEventType = "context-request";
36
+ /**
37
+ * Enables using the {@link https://github.com/webcomponents-cg/community-protocols/blob/main/proposals/context.md | W3C Community Context protocol.}
38
+ * @beta
39
+ */
40
+ export declare const Context: Readonly<{
41
+ /**
42
+ * The event type used for W3C Context Protocol requests.
43
+ */
44
+ eventType: "context-request";
45
+ /**
46
+ * Creates a W3C Community Protocol-based Context object to use in requesting/providing
47
+ * context through the DOM.
48
+ * @param name - The name to use for the connext. Useful in debugging.
49
+ * @param initialValue - An optional initial value to use if a context handler isn't found.
50
+ */
51
+ create<T = unknown>(name: string, initialValue?: T | undefined): FASTContext<T>;
52
+ /**
53
+ * Sets the strategy used by all FAST-specific context requests made through the
54
+ * Context.request, Context.get, Context.defineProperty, and ContextDecorator APIs.
55
+ * @param strategy - The strategy to use. By default, the strategy is Context.dispatch.
56
+ */
57
+ setDefaultRequestStrategy(strategy: FASTContextRequestStrategy): void;
58
+ /**
59
+ * Gets the context value for the target node or returns the initial value if
60
+ * a context handler is not found.
61
+ * @param target - The target to get the context for.
62
+ * @param context - The context to locate.
63
+ * @returns The context value.
64
+ * @remarks
65
+ * Uses the default request strategy to locate the context. If no context is found
66
+ * then the initial value of the context is returned.
67
+ */
68
+ get<T_1 extends UnknownContext>(target: EventTarget, context: T_1): ContextType<T_1>;
69
+ /**
70
+ * Requests the context value for the target node.
71
+ * @param target - The target to request the context for.
72
+ * @param context - The context to locate.
73
+ * @param callback - A callback to invoke with the context value.
74
+ * @param multiple - Whether the context requestor expects to handle updates
75
+ * to the context value after the initial request.
76
+ * @remarks
77
+ * Uses the default request strategy to locate the context.
78
+ */
79
+ request<T_2 extends UnknownContext>(target: EventTarget, context: T_2, callback: ContextCallback<ContextType<T_2>>, multiple?: boolean): void;
80
+ /**
81
+ *
82
+ * @param target - The target to dispatch the context event on.
83
+ * @param context - The context to locate.
84
+ * @param callback - The callback to invoke with the context value.
85
+ * @param multiple - Whether the context requestor expects to handle updates
86
+ * to the context value after the initial request.
87
+ * @remarks
88
+ * This API does NOT use the default request strategy. It always dispatches
89
+ * an event through the DOM.
90
+ */
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;
93
+ /**
94
+ *
95
+ * @param target - The target on which to handle context requests.
96
+ * @param callback - The callback to invoke when a context request is received.
97
+ * @param context - The context to handle requests for.
98
+ * @remarks
99
+ * If a context is not provided then the callback will be invoked for all context
100
+ * requests that are received on the target.
101
+ */
102
+ handle<T_5 extends UnknownContext>(target: EventTarget, callback: (event: ContextEvent<T_5>) => void, context?: T_5 | undefined): void;
103
+ /**
104
+ * Defines a getter-only property on the target that will return the context
105
+ * value for the target.
106
+ * @param target The target to define the property on.
107
+ * @param propertyName The name of the property to define.
108
+ * @param context The context that will be used to retrieve the property value.
109
+ * @remarks
110
+ * Uses the default request strategy to locate the context and will return the
111
+ * initialValue if the context isn't handled.
112
+ */
113
+ defineProperty<T_6 extends UnknownContext>(target: Constructable<EventTarget> | EventTarget, propertyName: string, context: T_6): void;
114
+ }>;
115
+ /**
116
+ * An unknown context type.
117
+ * @public
118
+ */
119
+ export declare type UnknownContext = Context<unknown>;
120
+ /**
121
+ * A helper type which can extract a Context value type from a Context type
122
+ * @public
123
+ */
124
+ export declare type ContextType<T extends UnknownContext> = T extends Context<infer Y> ? Y : never;
125
+ /**
126
+ * A callback which is provided by a context requester and is called with the value satisfying the request.
127
+ * This callback can be called multiple times by context providers as the requested value is changed.
128
+ * @public
129
+ */
130
+ export declare type ContextCallback<ValueType> = (value: ValueType, dispose?: () => void) => void;
131
+ /**
132
+ * An event fired by a context requester to signal it desires a named context.
133
+ *
134
+ * A provider should inspect the `context` property of the event to determine if it has a value that can
135
+ * satisfy the request, calling the `callback` with the requested value if so.
136
+ *
137
+ * If the requested context event contains a truthy `multiple` value, then a provider can call the callback
138
+ * multiple times if the value is changed, if this is the case the provider should pass a `dispose`
139
+ * method to the callback which requesters can invoke to indicate they no longer wish to receive these updates.
140
+ * @public
141
+ */
142
+ export declare class ContextEvent<T extends UnknownContext> extends Event {
143
+ readonly context: T;
144
+ readonly callback: ContextCallback<ContextType<T>>;
145
+ readonly multiple?: boolean | undefined;
146
+ constructor(context: T, callback: ContextCallback<ContextType<T>>, multiple?: boolean | undefined);
147
+ }
148
+ declare global {
149
+ interface HTMLElementEventMap {
150
+ /**
151
+ * A 'context-request' event can be emitted by any element which desires
152
+ * a context value to be injected by an external provider.
153
+ */
154
+ [contextEventType]: ContextEvent<UnknownContext>;
155
+ }
156
+ }
157
+ export {};