@microsoft/fast-element 2.0.0-beta.8 → 2.0.0
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.
- package/.eslintrc.json +1 -1
- package/CHANGELOG.json +512 -0
- package/CHANGELOG.md +180 -1
- package/README.md +1 -9
- package/api-extractor.context.json +14 -0
- package/api-extractor.di.json +14 -0
- package/dist/context/context.api.json +1068 -0
- package/dist/di/di.api.json +4929 -0
- package/dist/dts/binding/binding.d.ts +49 -0
- package/dist/dts/binding/normalize.d.ts +9 -0
- package/dist/dts/binding/one-time.d.ts +11 -0
- package/dist/dts/binding/one-way.d.ts +20 -0
- package/dist/dts/{templating/binding-signal.d.ts → binding/signal.d.ts} +19 -4
- package/dist/dts/{templating/binding-two-way.d.ts → binding/two-way.d.ts} +9 -5
- package/dist/dts/components/attributes.d.ts +6 -0
- package/dist/dts/components/element-controller.d.ts +104 -8
- package/dist/dts/components/element-hydration.d.ts +2 -0
- package/dist/dts/components/fast-definitions.d.ts +6 -0
- package/dist/dts/components/hydration.d.ts +56 -0
- package/dist/dts/components/install-hydration.d.ts +1 -0
- package/dist/dts/context.d.ts +29 -15
- package/dist/dts/di/di.d.ts +0 -5
- package/dist/dts/dom-policy.d.ts +83 -0
- package/dist/dts/dom.d.ts +100 -0
- package/dist/dts/hydration/target-builder.d.ts +63 -0
- package/dist/dts/index.d.ts +33 -26
- package/dist/dts/index.rollup.d.ts +0 -1
- package/dist/dts/index.rollup.debug.d.ts +0 -1
- package/dist/dts/interfaces.d.ts +32 -82
- package/dist/dts/metadata.d.ts +6 -5
- package/dist/dts/observation/arrays.d.ts +1 -1
- package/dist/dts/observation/observable.bench.d.ts +18 -0
- package/dist/dts/observation/observable.d.ts +5 -5
- package/dist/dts/pending-task.d.ts +19 -7
- package/dist/dts/platform.d.ts +11 -2
- package/dist/dts/polyfills.d.ts +0 -8
- package/dist/dts/styles/css-binding-directive.d.ts +60 -0
- package/dist/dts/styles/css.d.ts +9 -7
- package/dist/dts/styles/element-styles.d.ts +1 -14
- package/dist/dts/styles/host.d.ts +2 -5
- package/dist/dts/styles/style-strategy.d.ts +42 -0
- package/dist/dts/templating/compiler.d.ts +11 -13
- package/dist/dts/templating/{binding.d.ts → html-binding-directive.d.ts} +22 -42
- package/dist/dts/templating/html-directive.d.ts +44 -140
- package/dist/dts/templating/install-hydratable-view-templates.d.ts +1 -0
- package/dist/dts/templating/node-observation.d.ts +11 -1
- package/dist/dts/templating/ref.d.ts +4 -0
- package/dist/dts/templating/render.bench.d.ts +3 -0
- package/dist/dts/templating/render.d.ts +49 -9
- package/dist/dts/templating/repeat-basic-reverse.bench.d.ts +3 -0
- package/dist/dts/templating/repeat-basic-shift.bench.d.ts +3 -0
- package/dist/dts/templating/repeat.d.ts +31 -9
- package/dist/dts/templating/template.d.ts +97 -12
- package/dist/dts/templating/view.d.ts +149 -26
- package/dist/dts/templating/when-basic.bench.d.ts +3 -0
- package/dist/dts/templating/when-conditional.bench.d.ts +3 -0
- package/dist/dts/templating/when-switch.bench.d.ts +3 -0
- package/dist/dts/templating/when.d.ts +3 -1
- package/dist/dts/testing/fakes.d.ts +12 -1
- package/dist/dts/tsdoc-metadata.json +1 -1
- package/dist/dts/utilities.d.ts +55 -1
- package/dist/esm/binding/binding.js +18 -0
- package/dist/esm/binding/normalize.js +17 -0
- package/dist/esm/binding/one-time.js +21 -0
- package/dist/esm/binding/one-way.js +30 -0
- package/dist/esm/{templating/binding-signal.js → binding/signal.js} +22 -6
- package/dist/esm/{templating/binding-two-way.js → binding/two-way.js} +18 -12
- package/dist/esm/components/attributes.js +16 -1
- package/dist/esm/components/element-controller.js +319 -49
- package/dist/esm/components/element-hydration.js +2 -0
- package/dist/esm/components/fast-definitions.js +12 -4
- package/dist/esm/components/fast-element.js +3 -1
- package/dist/esm/components/hydration.js +104 -0
- package/dist/esm/components/install-hydration.js +3 -0
- package/dist/esm/context.js +26 -4
- package/dist/esm/debug.js +8 -2
- package/dist/esm/di/di.js +9 -12
- package/dist/esm/dom-policy.js +345 -0
- package/dist/esm/dom.js +101 -0
- package/dist/esm/hydration/target-builder.js +175 -0
- package/dist/esm/index.js +34 -25
- package/dist/esm/index.rollup.debug.js +3 -1
- package/dist/esm/index.rollup.js +3 -1
- package/dist/esm/interfaces.js +51 -3
- package/dist/esm/metadata.js +11 -8
- package/dist/esm/observation/arrays.js +1 -1
- package/dist/esm/observation/observable.bench.js +79 -0
- package/dist/esm/observation/observable.js +20 -15
- package/dist/esm/observation/update-queue.js +2 -2
- package/dist/esm/pending-task.js +13 -1
- package/dist/esm/platform.js +12 -2
- package/dist/esm/polyfills.js +3 -61
- package/dist/esm/styles/css-binding-directive.js +76 -0
- package/dist/esm/styles/css.js +14 -7
- package/dist/esm/styles/element-styles.js +0 -33
- package/dist/esm/styles/style-strategy.js +1 -0
- package/dist/esm/templating/children.js +8 -4
- package/dist/esm/templating/compiler.js +37 -44
- package/dist/esm/templating/html-binding-directive.js +218 -0
- package/dist/esm/templating/html-directive.js +25 -152
- package/dist/esm/templating/install-hydratable-view-templates.js +17 -0
- package/dist/esm/templating/node-observation.js +14 -8
- package/dist/esm/templating/ref.js +1 -1
- package/dist/esm/templating/render.bench.js +56 -0
- package/dist/esm/templating/render.js +74 -30
- package/dist/esm/templating/repeat-basic-reverse.bench.js +43 -0
- package/dist/esm/templating/repeat-basic-shift.bench.js +43 -0
- package/dist/esm/templating/repeat.js +116 -17
- package/dist/esm/templating/template.js +135 -60
- package/dist/esm/templating/view.js +259 -32
- package/dist/esm/templating/when-basic.bench.js +36 -0
- package/dist/esm/templating/when-conditional.bench.js +39 -0
- package/dist/esm/templating/when-switch.bench.js +68 -0
- package/dist/esm/templating/when.js +12 -5
- package/dist/esm/testing/fakes.js +32 -1
- package/dist/esm/testing/fixture.js +1 -1
- package/dist/esm/utilities.js +97 -1
- package/dist/fast-element.api.json +9804 -5622
- package/dist/fast-element.d.ts +813 -2386
- package/dist/fast-element.debug.js +2797 -974
- package/dist/fast-element.debug.min.js +3 -1
- package/dist/fast-element.js +2642 -825
- package/dist/fast-element.min.js +3 -1
- package/dist/fast-element.untrimmed.d.ts +669 -315
- package/docs/{api-report.md → api-report.api.md} +243 -158
- package/docs/context/api-report.api.md +69 -0
- package/docs/di/api-report.api.md +315 -0
- package/karma.conf.cjs +2 -1
- package/package.json +59 -47
- package/scripts/run-api-extractor.js +51 -0
- package/scripts/run-benchmarks.js +46 -0
- package/tensile.config.js +12 -0
- package/dist/dts/templating/dom.d.ts +0 -41
- package/dist/esm/templating/binding.js +0 -282
- package/dist/esm/templating/dom.js +0 -49
- package/docs/guide/declaring-templates.md +0 -230
- package/docs/guide/defining-elements.md +0 -214
- package/docs/guide/leveraging-css.md +0 -253
- package/docs/guide/next-steps.md +0 -13
- package/docs/guide/observables-and-state.md +0 -213
- package/docs/guide/using-directives.md +0 -576
- package/docs/guide/working-with-shadow-dom.md +0 -296
package/dist/fast-element.d.ts
CHANGED
|
@@ -1,2692 +1,1119 @@
|
|
|
1
1
|
/**
|
|
2
|
-
*
|
|
2
|
+
* A decorator and DI resolver that will resolve an array of all dependencies
|
|
3
|
+
* registered with the specified key.
|
|
4
|
+
* @param key - The key to resolve all dependencies for.
|
|
5
|
+
* @param searchAncestors - [optional] Indicates whether to search ancestor containers.
|
|
3
6
|
* @public
|
|
4
7
|
*/
|
|
5
|
-
export declare
|
|
8
|
+
export declare const all: (key: any, searchAncestors?: boolean) => ReturnType<typeof DI.inject>;
|
|
9
|
+
|
|
10
|
+
/**
|
|
11
|
+
* A function capable of asynchronously locating a resolver for a key.
|
|
12
|
+
* @public
|
|
13
|
+
*/
|
|
14
|
+
export declare type AsyncRegistrationLocator = (key: Key) => Promise<Registration | null>;
|
|
15
|
+
|
|
16
|
+
/**
|
|
17
|
+
* Represents a type which can be constructed with the new operator.
|
|
18
|
+
*
|
|
19
|
+
* @public
|
|
20
|
+
*/
|
|
21
|
+
declare type Constructable<T = {}> = {
|
|
22
|
+
new (...args: any[]): T;
|
|
23
|
+
};
|
|
24
|
+
|
|
25
|
+
/**
|
|
26
|
+
* Implemented by dependency injection containers.
|
|
27
|
+
* @public
|
|
28
|
+
*/
|
|
29
|
+
export declare interface Container extends ServiceLocator {
|
|
30
|
+
/**
|
|
31
|
+
* Registers dependencies with the container via registration objects.
|
|
32
|
+
* @param params - The registration objects.
|
|
33
|
+
*/
|
|
34
|
+
register(...params: any[]): Container;
|
|
35
|
+
/**
|
|
36
|
+
* Registers a resolver with the container for the specified key.
|
|
37
|
+
* @param key - The key to register the resolver under.
|
|
38
|
+
* @param resolver - The resolver to register.
|
|
39
|
+
*/
|
|
40
|
+
registerResolver<K extends Key, T = K>(key: K, resolver: Resolver<T>): Resolver<T>;
|
|
41
|
+
/**
|
|
42
|
+
* Registers a transformer with the container for the specified key.
|
|
43
|
+
* @param key - The key to resolved to register the transformer with.
|
|
44
|
+
* @param transformer - The transformer to register.
|
|
45
|
+
*/
|
|
46
|
+
registerTransformer<K extends Key, T = K>(key: K, transformer: Transformer_2<T>): boolean;
|
|
47
|
+
/**
|
|
48
|
+
* Gets a resolver for the specified key.
|
|
49
|
+
* @param key - The key to get the resolver for.
|
|
50
|
+
* @param autoRegister - Indicates whether or not to try to auto-register a dependency for
|
|
51
|
+
* the key if one is not explicitly registered.
|
|
52
|
+
*/
|
|
53
|
+
getResolver<K extends Key, T = K>(key: K | Key, autoRegister?: boolean): Resolver<T> | null;
|
|
6
54
|
/**
|
|
7
|
-
*
|
|
55
|
+
* Registers a factory with the container for the specified key.
|
|
56
|
+
* @param key - The key to register the factory under.
|
|
57
|
+
* @param factory - The factory to register.
|
|
8
58
|
*/
|
|
9
|
-
|
|
59
|
+
registerFactory<T extends Constructable>(key: T, factory: Factory<T>): void;
|
|
10
60
|
/**
|
|
11
|
-
* Gets the
|
|
12
|
-
* @param
|
|
61
|
+
* Gets the factory for the specified key.
|
|
62
|
+
* @param key - The key to get the factory for.
|
|
13
63
|
*/
|
|
14
|
-
|
|
64
|
+
getFactory<T extends Constructable>(key: T): Factory<T>;
|
|
15
65
|
/**
|
|
16
|
-
*
|
|
17
|
-
* @param
|
|
18
|
-
* @param value - The value to set the property to.
|
|
66
|
+
* Creates a child dependency injection container parented to this container.
|
|
67
|
+
* @param config - The configuration for the new container.
|
|
19
68
|
*/
|
|
20
|
-
|
|
69
|
+
createChild(config?: Partial<Omit<ContainerConfiguration, "parentLocator">>): Container;
|
|
21
70
|
}
|
|
22
71
|
|
|
23
72
|
/**
|
|
24
|
-
*
|
|
25
|
-
* @public
|
|
26
|
-
*/
|
|
27
|
-
export declare type AddBehavior = (behavior: HostBehavior<HTMLElement>) => void;
|
|
28
|
-
|
|
29
|
-
/**
|
|
30
|
-
* Used to add behavior factories when constructing templates.
|
|
73
|
+
* The key that resolves the dependency injection Container itself.
|
|
31
74
|
* @public
|
|
32
75
|
*/
|
|
33
|
-
export declare
|
|
34
|
-
|
|
35
|
-
/* Excluded from this release type: AdoptedStyleSheetsStrategy */
|
|
76
|
+
export declare const Container: ContextDecorator<Container>;
|
|
36
77
|
|
|
37
78
|
/**
|
|
38
|
-
*
|
|
79
|
+
* Configuration for a dependency injection container.
|
|
39
80
|
* @public
|
|
40
81
|
*/
|
|
41
|
-
export declare interface
|
|
82
|
+
export declare interface ContainerConfiguration {
|
|
42
83
|
/**
|
|
43
|
-
* The
|
|
84
|
+
* The locator function used to find the parent of the container.
|
|
44
85
|
*/
|
|
45
|
-
|
|
86
|
+
parentLocator: ParentLocator;
|
|
46
87
|
/**
|
|
47
|
-
*
|
|
88
|
+
* When an asynchronous get request is made to the container, if no
|
|
89
|
+
* resolver is found for the key, this function is called to provide
|
|
90
|
+
* a registration.
|
|
48
91
|
*/
|
|
49
|
-
|
|
92
|
+
asyncRegistrationLocator: AsyncRegistrationLocator;
|
|
50
93
|
/**
|
|
51
|
-
*
|
|
52
|
-
*
|
|
94
|
+
* Indicates whether this container should resolve dependencies that are directly made
|
|
95
|
+
* by its owner. The default is "false" which results in the parent container being used.
|
|
53
96
|
*/
|
|
54
|
-
|
|
97
|
+
responsibleForOwnerRequests: boolean;
|
|
55
98
|
/**
|
|
56
|
-
*
|
|
57
|
-
* @param
|
|
99
|
+
* Gets the default resolver to use during auto-registration.
|
|
100
|
+
* @param key - The key to register the dependency with.
|
|
101
|
+
* @param handler - The container that is handling the auto-registration request.
|
|
58
102
|
*/
|
|
59
|
-
|
|
60
|
-
/**
|
|
61
|
-
* Flushes the changes to subscribers.
|
|
62
|
-
*/
|
|
63
|
-
flush(): void;
|
|
103
|
+
defaultResolver(key: Key, handler: Container): Resolver;
|
|
64
104
|
}
|
|
65
105
|
|
|
66
106
|
/**
|
|
67
|
-
*
|
|
107
|
+
* Configuration for a dependency injection container.
|
|
68
108
|
* @public
|
|
69
109
|
*/
|
|
70
|
-
export declare const
|
|
110
|
+
export declare const ContainerConfiguration: Readonly<{
|
|
71
111
|
/**
|
|
72
|
-
*
|
|
112
|
+
* The default configuration used when creating a DOM-disconnected container.
|
|
73
113
|
* @remarks
|
|
74
|
-
*
|
|
75
|
-
*
|
|
76
|
-
* not typically necessary.
|
|
114
|
+
* The default creates a root container, with no parent container. It does not handle
|
|
115
|
+
* owner requests and it uses singleton resolution behavior for auto-registration.
|
|
77
116
|
*/
|
|
78
|
-
|
|
117
|
+
default: Readonly<ContainerConfiguration>;
|
|
79
118
|
}>;
|
|
80
119
|
|
|
81
120
|
/**
|
|
82
|
-
*
|
|
121
|
+
* @internal
|
|
122
|
+
*/
|
|
123
|
+
export declare class ContainerImpl implements DOMContainer {
|
|
124
|
+
protected owner: any;
|
|
125
|
+
protected config: ContainerConfiguration;
|
|
126
|
+
private _parent;
|
|
127
|
+
private registerDepth;
|
|
128
|
+
private resolvers;
|
|
129
|
+
private isHandlingContextRequests;
|
|
130
|
+
get parent(): ContainerImpl | null;
|
|
131
|
+
get depth(): number;
|
|
132
|
+
get responsibleForOwnerRequests(): boolean;
|
|
133
|
+
constructor(owner: any, config: ContainerConfiguration);
|
|
134
|
+
handleContextRequests(enable: boolean): void;
|
|
135
|
+
register(...params: any[]): Container;
|
|
136
|
+
registerResolver<K extends Key, T = K>(key: K, resolver: Resolver<T>): Resolver<T>;
|
|
137
|
+
registerTransformer<K extends Key, T = K>(key: K, transformer: Transformer_2<T>): boolean;
|
|
138
|
+
getResolver<K extends Key, T = K>(key: K | Key, autoRegister?: boolean): Resolver<T> | null;
|
|
139
|
+
has<K extends Key>(key: K, searchAncestors?: boolean): boolean;
|
|
140
|
+
getAsync<K extends Key>(key: K): Promise<Resolved<K>>;
|
|
141
|
+
get<K extends Key>(key: K): Resolved<K>;
|
|
142
|
+
getAll<K extends Key>(key: K, searchAncestors?: boolean): readonly Resolved<K>[];
|
|
143
|
+
getFactory<K extends Constructable>(Type: K): Factory<K>;
|
|
144
|
+
registerFactory<K extends Constructable>(key: K, factory: Factory<K>): void;
|
|
145
|
+
createChild(config?: Partial<Omit<ContainerConfiguration, "parentLocator">>): Container;
|
|
146
|
+
private jitRegister;
|
|
147
|
+
}
|
|
148
|
+
|
|
149
|
+
/**
|
|
150
|
+
* A Context object defines an optional initial value for a Context, as well as a name identifier for debugging purposes.
|
|
151
|
+
* @public
|
|
152
|
+
*/
|
|
153
|
+
declare type Context<T> = {
|
|
154
|
+
readonly name: string;
|
|
155
|
+
readonly initialValue?: T;
|
|
156
|
+
};
|
|
157
|
+
|
|
158
|
+
/**
|
|
159
|
+
* Enables using:
|
|
160
|
+
* {@link https://github.com/webcomponents-cg/community-protocols/blob/main/proposals/context.md | W3C Community Context protocol.}
|
|
83
161
|
* @public
|
|
84
162
|
*/
|
|
85
|
-
|
|
163
|
+
declare const Context: Readonly<{
|
|
164
|
+
/**
|
|
165
|
+
* The event type used for W3C Context Protocol requests.
|
|
166
|
+
*/
|
|
167
|
+
eventType: "context-request";
|
|
86
168
|
/**
|
|
87
|
-
*
|
|
169
|
+
* Returns a FASTContext object from the global context registry matching the given name if found.
|
|
170
|
+
* Otherwise, returns a new FASTContext with this name.
|
|
171
|
+
* @param name - The name of the FASTContext to get or create.
|
|
172
|
+
* @returns A FASTContext object.
|
|
88
173
|
*/
|
|
89
|
-
|
|
174
|
+
for<T = unknown>(name: string): FASTContext<T>;
|
|
90
175
|
/**
|
|
91
|
-
*
|
|
176
|
+
* Creates a W3C Community Protocol-based Context object to use in requesting/providing
|
|
177
|
+
* context through the DOM.
|
|
178
|
+
* @param name - The name to use for the connext. Useful in debugging.
|
|
179
|
+
* @param initialValue - An optional initial value to use if a context handler isn't found.
|
|
92
180
|
*/
|
|
93
|
-
|
|
181
|
+
create<T_1 = unknown>(name: string, initialValue?: T_1 | undefined): FASTContext<T_1>;
|
|
94
182
|
/**
|
|
95
|
-
*
|
|
183
|
+
* Sets the strategy used by all FAST-specific context requests made through the
|
|
184
|
+
* Context.request, Context.get, Context.defineProperty, and ContextDecorator APIs.
|
|
185
|
+
* @param strategy - The strategy to use. By default, the strategy is Context.dispatch.
|
|
96
186
|
*/
|
|
97
|
-
|
|
187
|
+
setDefaultRequestStrategy(strategy: FASTContextRequestStrategy): void;
|
|
98
188
|
/**
|
|
99
|
-
*
|
|
189
|
+
* Gets the context value for the target node or returns the initial value if
|
|
190
|
+
* a context handler is not found.
|
|
191
|
+
* @param target - The target to get the context for.
|
|
192
|
+
* @param context - The context to locate.
|
|
193
|
+
* @returns The context value.
|
|
194
|
+
* @remarks
|
|
195
|
+
* Uses the default request strategy to locate the context. If no context is found
|
|
196
|
+
* then the initial value of the context is returned.
|
|
100
197
|
*/
|
|
101
|
-
|
|
198
|
+
get<T_2 extends UnknownContext>(target: EventTarget, context: T_2): ContextType<T_2>;
|
|
102
199
|
/**
|
|
103
|
-
*
|
|
200
|
+
* Requests the context value for the target node.
|
|
201
|
+
* @param target - The target to request the context for.
|
|
202
|
+
* @param context - The context to locate.
|
|
203
|
+
* @param callback - A callback to invoke with the context value.
|
|
204
|
+
* @param multiple - Whether the context requestor expects to handle updates
|
|
205
|
+
* to the context value after the initial request.
|
|
206
|
+
* @remarks
|
|
207
|
+
* Uses the default request strategy to locate the context.
|
|
104
208
|
*/
|
|
105
|
-
|
|
209
|
+
request<T_3 extends UnknownContext>(target: EventTarget, context: T_3, callback: ContextCallback<ContextType<T_3>>, multiple?: boolean): void;
|
|
106
210
|
/**
|
|
107
|
-
*
|
|
211
|
+
*
|
|
212
|
+
* @param target - The target to dispatch the context event on.
|
|
213
|
+
* @param context - The context to locate.
|
|
214
|
+
* @param callback - The callback to invoke with the context value.
|
|
215
|
+
* @param multiple - Whether the context requestor expects to handle updates
|
|
216
|
+
* to the context value after the initial request.
|
|
217
|
+
* @remarks
|
|
218
|
+
* This API does NOT use the default request strategy. It always dispatches
|
|
219
|
+
* an event through the DOM.
|
|
108
220
|
*/
|
|
109
|
-
|
|
221
|
+
dispatch<T_4 extends UnknownContext>(target: EventTarget, context: T_4, callback: ContextCallback<ContextType<T_4>>, multiple?: boolean): void;
|
|
110
222
|
/**
|
|
111
|
-
*
|
|
223
|
+
* Enables an event target to provide a context value.
|
|
224
|
+
* @param target The target to provide the context value for.
|
|
225
|
+
* @param context The context to provide the value for.
|
|
226
|
+
* @param value The value to provide for the context.
|
|
112
227
|
*/
|
|
113
|
-
|
|
228
|
+
provide<T_5 extends UnknownContext>(target: EventTarget, context: T_5, value: ContextType<T_5>): void;
|
|
114
229
|
/**
|
|
115
230
|
*
|
|
116
|
-
* @param
|
|
117
|
-
* @param
|
|
231
|
+
* @param target - The target on which to handle context requests.
|
|
232
|
+
* @param callback - The callback to invoke when a context request is received.
|
|
233
|
+
* @param context - The context to handle requests for.
|
|
234
|
+
* @remarks
|
|
235
|
+
* If a context is not provided then the callback will be invoked for all context
|
|
236
|
+
* requests that are received on the target.
|
|
237
|
+
*/
|
|
238
|
+
handle<T_6 extends UnknownContext>(target: EventTarget, callback: (event: ContextEvent<T_6>) => void, context?: T_6 | undefined): void;
|
|
239
|
+
/**
|
|
240
|
+
* Defines a getter-only property on the target that will return the context
|
|
241
|
+
* value for the target.
|
|
242
|
+
* @param target The target to define the property on.
|
|
243
|
+
* @param propertyName The name of the property to define.
|
|
244
|
+
* @param context The context that will be used to retrieve the property value.
|
|
118
245
|
* @remarks
|
|
119
|
-
*
|
|
246
|
+
* Uses the default request strategy to locate the context and will return the
|
|
247
|
+
* initialValue if the context isn't handled.
|
|
120
248
|
*/
|
|
121
|
-
|
|
249
|
+
defineProperty<T_7 extends UnknownContext>(target: Constructable<EventTarget> | EventTarget, propertyName: string, context: T_7): void;
|
|
122
250
|
}>;
|
|
123
251
|
|
|
124
252
|
/**
|
|
125
|
-
*
|
|
253
|
+
* A callback which is provided by a context requester and is called with the value satisfying the request.
|
|
254
|
+
* This callback can be called multiple times by context providers as the requested value is changed.
|
|
126
255
|
* @public
|
|
127
256
|
*/
|
|
128
|
-
|
|
257
|
+
declare type ContextCallback<ValueType> = (value: ValueType, dispose?: () => void) => void;
|
|
129
258
|
|
|
130
259
|
/**
|
|
131
|
-
*
|
|
260
|
+
* A constant key that can be used to represent a Context dependency.
|
|
261
|
+
* The key can be used for context or DI but also doubles as a decorator for
|
|
262
|
+
* resolving the associated dependency.
|
|
132
263
|
* @public
|
|
133
264
|
*/
|
|
134
|
-
|
|
135
|
-
/**
|
|
136
|
-
* The original source aspect exactly as represented in markup.
|
|
137
|
-
*/
|
|
138
|
-
sourceAspect: string;
|
|
139
|
-
/**
|
|
140
|
-
* The evaluated target aspect, determined after processing the source.
|
|
141
|
-
*/
|
|
142
|
-
targetAspect: string;
|
|
143
|
-
/**
|
|
144
|
-
* The type of aspect to target.
|
|
145
|
-
*/
|
|
146
|
-
aspectType: Aspect;
|
|
147
|
-
/**
|
|
148
|
-
* A binding if one is associated with the aspect.
|
|
149
|
-
*/
|
|
150
|
-
dataBinding?: Binding;
|
|
151
|
-
}
|
|
265
|
+
declare type ContextDecorator<T = any> = Readonly<Context<T>> & PropertyDecorator & ParameterDecorator_2;
|
|
152
266
|
|
|
153
267
|
/**
|
|
154
|
-
*
|
|
155
|
-
*
|
|
268
|
+
* An event fired by a context requester to signal it desires a named context.
|
|
269
|
+
*
|
|
270
|
+
* A provider should inspect the `context` property of the event to determine if it has a value that can
|
|
271
|
+
* satisfy the request, calling the `callback` with the requested value if so.
|
|
272
|
+
*
|
|
273
|
+
* If the requested context event contains a truthy `multiple` value, then a provider can call the callback
|
|
274
|
+
* multiple times if the value is changed, if this is the case the provider should pass a `dispose`
|
|
275
|
+
* method to the callback which requesters can invoke to indicate they no longer wish to receive these updates.
|
|
156
276
|
* @public
|
|
157
277
|
*/
|
|
158
|
-
|
|
278
|
+
declare class ContextEvent<T extends UnknownContext> extends Event {
|
|
279
|
+
readonly context: T;
|
|
280
|
+
readonly callback: ContextCallback<ContextType<T>>;
|
|
281
|
+
readonly multiple?: boolean | undefined;
|
|
282
|
+
constructor(context: T, callback: ContextCallback<ContextType<T>>, multiple?: boolean | undefined);
|
|
283
|
+
}
|
|
159
284
|
|
|
160
285
|
/**
|
|
161
|
-
*
|
|
162
|
-
* @param target - The class to define the attribute on.
|
|
163
|
-
* @param prop - The property name to be associated with the attribute.
|
|
286
|
+
* A helper type which can extract a Context value type from a Context type
|
|
164
287
|
* @public
|
|
165
288
|
*/
|
|
166
|
-
|
|
289
|
+
declare type ContextType<T extends UnknownContext> = T extends Context<infer Y> ? Y : never;
|
|
167
290
|
|
|
168
|
-
|
|
169
|
-
* Metadata used to configure a custom attribute's behavior.
|
|
170
|
-
* @public
|
|
171
|
-
*/
|
|
172
|
-
export declare type AttributeConfiguration = {
|
|
173
|
-
property: string;
|
|
174
|
-
attribute?: string;
|
|
175
|
-
mode?: AttributeMode;
|
|
176
|
-
converter?: ValueConverter;
|
|
177
|
-
};
|
|
291
|
+
declare function createContext<K extends Key>(nameConfigOrCallback?: string | ((builder: ResolverBuilder<K>) => Resolver<K>) | InterfaceConfiguration, configuror?: (builder: ResolverBuilder<K>) => Resolver<K>): ContextDecorator<K>;
|
|
178
292
|
|
|
179
293
|
/**
|
|
180
|
-
*
|
|
294
|
+
* A set of default resolvers useful in configuring a container.
|
|
181
295
|
* @public
|
|
182
296
|
*/
|
|
183
|
-
export declare const
|
|
297
|
+
export declare const DefaultResolver: Readonly<{
|
|
184
298
|
/**
|
|
185
|
-
*
|
|
299
|
+
* Disables auto-registration and throws for all un-registered dependencies.
|
|
300
|
+
* @param key - The key to create the resolver for.
|
|
186
301
|
*/
|
|
187
|
-
|
|
302
|
+
none(key: Key): Resolver;
|
|
303
|
+
/**
|
|
304
|
+
* Provides default singleton resolution behavior during auto-registration.
|
|
305
|
+
* @param key - The key to create the resolver for.
|
|
306
|
+
* @returns The resolver.
|
|
307
|
+
*/
|
|
308
|
+
singleton(key: Key): Resolver;
|
|
309
|
+
/**
|
|
310
|
+
* Provides default transient resolution behavior during auto-registration.
|
|
311
|
+
* @param key - The key to create the resolver for.
|
|
312
|
+
* @returns The resolver.
|
|
313
|
+
*/
|
|
314
|
+
transient(key: Key): Resolver;
|
|
188
315
|
}>;
|
|
189
316
|
|
|
190
317
|
/**
|
|
191
|
-
*
|
|
192
|
-
* change callbacks, attribute reflection, and type conversion for
|
|
193
|
-
* custom elements.
|
|
318
|
+
* The gateway to dependency injection APIs.
|
|
194
319
|
* @public
|
|
195
320
|
*/
|
|
196
|
-
export declare
|
|
197
|
-
private readonly fieldName;
|
|
198
|
-
private readonly callbackName;
|
|
199
|
-
private readonly hasCallback;
|
|
200
|
-
private readonly guards;
|
|
321
|
+
export declare const DI: Readonly<{
|
|
201
322
|
/**
|
|
202
|
-
*
|
|
323
|
+
* Installs dependency injection as the default strategy for handling
|
|
324
|
+
* all calls to Context.request.
|
|
325
|
+
* @param fallback - Creates a container if one cannot be found.
|
|
203
326
|
*/
|
|
204
|
-
|
|
327
|
+
installAsContextRequestStrategy(fallback?: () => DOMContainer): void;
|
|
205
328
|
/**
|
|
206
|
-
*
|
|
329
|
+
* Creates a new dependency injection container.
|
|
330
|
+
* @param config - The configuration for the container.
|
|
331
|
+
* @returns A newly created dependency injection container.
|
|
207
332
|
*/
|
|
208
|
-
|
|
333
|
+
createContainer(config?: Partial<ContainerConfiguration>): Container;
|
|
334
|
+
/**
|
|
335
|
+
* Finds the dependency injection container responsible for providing dependencies
|
|
336
|
+
* to the specified node.
|
|
337
|
+
* @param target - The node to find the responsible container for.
|
|
338
|
+
* @param fallback - Creates a container if one cannot be found.
|
|
339
|
+
* @returns The container responsible for providing dependencies to the node.
|
|
340
|
+
* @remarks
|
|
341
|
+
* This will be the same as the parent container if the specified node
|
|
342
|
+
* does not itself host a container configured with responsibleForOwnerRequests.
|
|
343
|
+
*/
|
|
344
|
+
findResponsibleContainer(target: EventTarget, fallback?: () => DOMContainer): DOMContainer;
|
|
209
345
|
/**
|
|
210
|
-
*
|
|
346
|
+
* Find the dependency injection container up the DOM tree from this node.
|
|
347
|
+
* @param target - The node to find the parent container for.
|
|
348
|
+
* @param fallback - Creates a container if one cannot be found.
|
|
349
|
+
* @returns The parent container of this node.
|
|
350
|
+
* @remarks
|
|
351
|
+
* This will be the same as the responsible container if the specified node
|
|
352
|
+
* does not itself host a container configured with responsibleForOwnerRequests.
|
|
211
353
|
*/
|
|
212
|
-
|
|
354
|
+
findParentContainer(target: EventTarget, fallback?: () => DOMContainer): DOMContainer;
|
|
213
355
|
/**
|
|
214
|
-
*
|
|
356
|
+
* Returns a dependency injection container if one is explicitly owned by the specified
|
|
357
|
+
* node. If one is not owned, then a new container is created and assigned to the node.
|
|
358
|
+
* @param target - The node to find or create the container for.
|
|
359
|
+
* @param config - The configuration for the container if one needs to be created.
|
|
360
|
+
* @returns The located or created container.
|
|
361
|
+
* @remarks
|
|
362
|
+
* This API does not search for a responsible or parent container. It looks only for a container
|
|
363
|
+
* directly defined on the specified node and creates one at that location if one does not
|
|
364
|
+
* already exist.
|
|
365
|
+
*/
|
|
366
|
+
getOrCreateDOMContainer(target?: EventTarget, config?: Partial<Omit<ContainerConfiguration, "parentLocator">>): DOMContainer;
|
|
367
|
+
/**
|
|
368
|
+
* Gets the dependency keys representing what is needed to instantiate the specified type.
|
|
369
|
+
* @param Type - The type to get the dependencies for.
|
|
370
|
+
* @returns An array of dependency keys.
|
|
371
|
+
*/
|
|
372
|
+
getDependencies(Type: Constructable | Injectable): Key[];
|
|
373
|
+
/**
|
|
374
|
+
* Defines a property on a web component class. The value of this property will
|
|
375
|
+
* be resolved from the dependency injection container responsible for the element
|
|
376
|
+
* instance, based on where it is connected in the DOM.
|
|
377
|
+
* @param target - The target to define the property on.
|
|
378
|
+
* @param propertyName - The name of the property to define.
|
|
379
|
+
* @param key - The dependency injection key.
|
|
380
|
+
* @param respectConnection - Indicates whether or not to update the property value if the
|
|
381
|
+
* hosting component is disconnected and then re-connected at a different location in the DOM.
|
|
382
|
+
* @remarks
|
|
383
|
+
* The respectConnection option is only applicable to elements that descend from FASTElement.
|
|
215
384
|
*/
|
|
216
|
-
|
|
385
|
+
defineProperty(target: {}, propertyName: string, key: Key, respectConnection?: boolean): void;
|
|
217
386
|
/**
|
|
218
|
-
*
|
|
219
|
-
*
|
|
387
|
+
* Creates a dependency injection key.
|
|
388
|
+
* @param nameConfigOrCallback - A friendly name for the key or a lambda that configures a
|
|
389
|
+
* default resolution for the dependency.
|
|
390
|
+
* @param configuror - If a friendly name was provided for the first parameter, then an optional
|
|
391
|
+
* lambda that configures a default resolution for the dependency can be provided second.
|
|
392
|
+
* @returns The created key.
|
|
393
|
+
* @remarks
|
|
394
|
+
* The created key can be used as a property decorator or constructor parameter decorator,
|
|
395
|
+
* in addition to its standard use in an inject array or through direct container APIs.
|
|
220
396
|
*/
|
|
221
|
-
|
|
397
|
+
createContext: typeof createContext;
|
|
222
398
|
/**
|
|
223
|
-
*
|
|
224
|
-
* @param
|
|
225
|
-
* @
|
|
226
|
-
* @
|
|
227
|
-
*
|
|
228
|
-
*
|
|
229
|
-
*
|
|
399
|
+
* A decorator that specifies what to inject into its target.
|
|
400
|
+
* @param dependencies - The dependencies to inject.
|
|
401
|
+
* @returns The decorator to be applied to the target class.
|
|
402
|
+
* @remarks
|
|
403
|
+
* The decorator can be used to decorate a class, listing all of the classes dependencies.
|
|
404
|
+
* Or it can be used to decorate a constructor parameter, indicating what to inject for that
|
|
405
|
+
* parameter.
|
|
406
|
+
* Or it can be used for a web component property, indicating what that property should resolve to.
|
|
230
407
|
*/
|
|
231
|
-
|
|
408
|
+
inject(...dependencies: Key[]): (target: any, key?: string | number, descriptor?: PropertyDescriptor | number) => void;
|
|
232
409
|
/**
|
|
233
|
-
*
|
|
234
|
-
*
|
|
235
|
-
*
|
|
410
|
+
* Registers the `target` class as a transient dependency; each time the dependency is resolved
|
|
411
|
+
* a new instance will be created.
|
|
412
|
+
*
|
|
413
|
+
* @param target - The class / constructor function to register as transient.
|
|
414
|
+
* @returns The same class, with a static `register` method that takes a container and returns the appropriate resolver.
|
|
415
|
+
*
|
|
416
|
+
* @example
|
|
417
|
+
* On an existing class
|
|
418
|
+
* ```ts
|
|
419
|
+
* class Foo { }
|
|
420
|
+
* DI.transient(Foo);
|
|
421
|
+
* ```
|
|
422
|
+
*
|
|
423
|
+
* @example
|
|
424
|
+
* Inline declaration
|
|
425
|
+
*
|
|
426
|
+
* ```ts
|
|
427
|
+
* const Foo = DI.transient(class { });
|
|
428
|
+
* // Foo is now strongly typed with register
|
|
429
|
+
* Foo.register(container);
|
|
430
|
+
* ```
|
|
431
|
+
*
|
|
432
|
+
* @public
|
|
236
433
|
*/
|
|
237
|
-
|
|
434
|
+
transient<T extends Constructable<{}>>(target: T & Partial<RegisterSelf<T>>): T & RegisterSelf<T>;
|
|
238
435
|
/**
|
|
239
|
-
*
|
|
240
|
-
*
|
|
436
|
+
* Registers the `target` class as a singleton dependency; the class will only be created once. Each
|
|
437
|
+
* consecutive time the dependency is resolved, the same instance will be returned.
|
|
438
|
+
*
|
|
439
|
+
* @param target - The class / constructor function to register as a singleton.
|
|
440
|
+
* @returns The same class, with a static `register` method that takes a container and returns the appropriate resolver.
|
|
441
|
+
* @example
|
|
442
|
+
* On an existing class
|
|
443
|
+
* ```ts
|
|
444
|
+
* class Foo { }
|
|
445
|
+
* DI.singleton(Foo);
|
|
446
|
+
* ```
|
|
447
|
+
*
|
|
448
|
+
* @example
|
|
449
|
+
* Inline declaration
|
|
450
|
+
* ```ts
|
|
451
|
+
* const Foo = DI.singleton(class { });
|
|
452
|
+
* // Foo is now strongly typed with register
|
|
453
|
+
* Foo.register(container);
|
|
454
|
+
* ```
|
|
455
|
+
*
|
|
456
|
+
* @public
|
|
241
457
|
*/
|
|
242
|
-
|
|
243
|
-
|
|
244
|
-
private tryReflectToAttribute;
|
|
245
|
-
/* Excluded from this release type: collect */
|
|
246
|
-
}
|
|
458
|
+
singleton<T_1 extends Constructable<{}>>(target: T_1 & Partial<RegisterSelf<T_1>>, options?: SingletonOptions): T_1 & RegisterSelf<T_1>;
|
|
459
|
+
}>;
|
|
247
460
|
|
|
248
461
|
/**
|
|
249
|
-
*
|
|
250
|
-
* @remarks
|
|
251
|
-
* By default, attributes run in `reflect` mode, propagating their property
|
|
252
|
-
* values to the DOM and DOM values to the property. The `boolean` mode also
|
|
253
|
-
* reflects values, but uses the HTML standard boolean attribute behavior,
|
|
254
|
-
* interpreting the presence of the attribute as `true` and the absence as
|
|
255
|
-
* `false`. The `fromView` behavior only updates the property value based on
|
|
256
|
-
* changes in the DOM, but does not reflect property changes back.
|
|
462
|
+
* A Container that is associated with a specific Node in the DOM.
|
|
257
463
|
* @public
|
|
258
464
|
*/
|
|
259
|
-
export declare
|
|
465
|
+
export declare interface DOMContainer extends Container {
|
|
466
|
+
/**
|
|
467
|
+
* Instructs this particular Container to handle W3C Community Context requests
|
|
468
|
+
* that propagate to its associated DOM node.
|
|
469
|
+
* @param enable - true to enable context requests handling; false otherwise.
|
|
470
|
+
* @beta
|
|
471
|
+
*/
|
|
472
|
+
handleContextRequests(enable: boolean): void;
|
|
473
|
+
}
|
|
260
474
|
|
|
261
475
|
/**
|
|
262
|
-
*
|
|
263
|
-
* @param binding - The binding to refresh when changed.
|
|
264
|
-
* @param isVolatile - Indicates whether the binding is volatile or not.
|
|
265
|
-
* @returns A binding configuration.
|
|
476
|
+
* The key that resolves a DOMContainer itself.
|
|
266
477
|
* @public
|
|
267
478
|
*/
|
|
268
|
-
export declare
|
|
479
|
+
export declare const DOMContainer: ContextDecorator<DOMContainer>;
|
|
269
480
|
|
|
270
481
|
/**
|
|
271
|
-
*
|
|
272
|
-
*
|
|
482
|
+
* Used by the default Resolver to create instances of objects when needed.
|
|
273
483
|
* @public
|
|
274
484
|
*/
|
|
275
|
-
export declare
|
|
276
|
-
|
|
277
|
-
|
|
485
|
+
export declare interface Factory<T extends Constructable = any> {
|
|
486
|
+
/**
|
|
487
|
+
* The concrete type this factory creates.
|
|
488
|
+
*/
|
|
489
|
+
readonly Type: T;
|
|
278
490
|
/**
|
|
279
|
-
*
|
|
491
|
+
* Registers a transformer function to alter the object after instantiation but before
|
|
492
|
+
* returning the final constructed instance.
|
|
493
|
+
* @param transformer - The transformer function.
|
|
280
494
|
*/
|
|
281
|
-
|
|
495
|
+
registerTransformer(transformer: Transformer_2<T>): void;
|
|
282
496
|
/**
|
|
283
|
-
*
|
|
284
|
-
* @param
|
|
285
|
-
* @param
|
|
497
|
+
* Constructs an instance of the factory's object.
|
|
498
|
+
* @param container - The container the object is being constructor for.
|
|
499
|
+
* @param dynamicDependencies - Dynamic dependencies supplied to the constructor.
|
|
286
500
|
*/
|
|
287
|
-
|
|
501
|
+
construct(container: Container, dynamicDependencies?: Key[]): Resolved<T>;
|
|
288
502
|
/**
|
|
289
|
-
*
|
|
290
|
-
*
|
|
291
|
-
* @param
|
|
503
|
+
* Constructs an instance of the factory's object, allowing for
|
|
504
|
+
* async resolution of dependencies.
|
|
505
|
+
* @param container - The container the object is being constructor for.
|
|
506
|
+
* @param dynamicDependencies - Dynamic dependencies supplied to the constructor.
|
|
292
507
|
*/
|
|
293
|
-
|
|
508
|
+
constructAsync(container: Container, dynamicDependencies?: Key[]): Promise<Resolved<T>>;
|
|
509
|
+
}
|
|
510
|
+
|
|
511
|
+
/** @internal */
|
|
512
|
+
export declare class FactoryImpl<T extends Constructable = any> implements Factory<T> {
|
|
513
|
+
Type: T;
|
|
514
|
+
private readonly dependencies;
|
|
515
|
+
private transformers;
|
|
516
|
+
constructor(Type: T, dependencies: Key[]);
|
|
517
|
+
constructAsync(container: Container, dynamicDependencies?: Key[]): Promise<Resolved<T>>;
|
|
518
|
+
construct(container: Container, dynamicDependencies?: Key[]): Resolved<T>;
|
|
519
|
+
private constructCore;
|
|
520
|
+
registerTransformer(transformer: (instance: any) => any): void;
|
|
294
521
|
}
|
|
295
522
|
|
|
296
523
|
/**
|
|
297
|
-
* A
|
|
298
|
-
*
|
|
299
|
-
* Used automatically when the `boolean` {@link AttributeMode} is selected.
|
|
524
|
+
* A Context object defines an optional initial value for a Context, as well as a name identifier for debugging purposes.
|
|
525
|
+
* The FASTContext can also be used as a decorator to declare context dependencies or as a key for DI.
|
|
300
526
|
* @public
|
|
301
527
|
*/
|
|
302
|
-
|
|
303
|
-
|
|
304
|
-
|
|
528
|
+
declare type FASTContext<T> = ContextDecorator<T> & {
|
|
529
|
+
get(target: EventTarget): T;
|
|
530
|
+
provide(target: EventTarget, value: T): void;
|
|
531
|
+
request(target: EventTarget, callback: ContextCallback<T>, multiple?: boolean): void;
|
|
532
|
+
handle(target: EventTarget, callback: (event: ContextEvent<FASTContext<T>>) => void): void;
|
|
533
|
+
};
|
|
305
534
|
|
|
306
535
|
/**
|
|
307
|
-
*
|
|
536
|
+
* A strategy that controls how all Context.request API calls are handled.
|
|
537
|
+
* @remarks
|
|
538
|
+
* By default this is handled via Context.dispatch, which dispatches a ContextEvent.
|
|
308
539
|
* @public
|
|
309
540
|
*/
|
|
310
|
-
|
|
311
|
-
call(): void;
|
|
312
|
-
};
|
|
541
|
+
declare type FASTContextRequestStrategy = <T extends UnknownContext>(target: EventTarget, context: T, callback: ContextCallback<ContextType<T>>, multiple: any) => void;
|
|
313
542
|
|
|
314
543
|
/**
|
|
315
|
-
* A
|
|
316
|
-
*
|
|
544
|
+
* A decorator that tells the container not to try to inject a dependency.
|
|
545
|
+
*
|
|
317
546
|
* @public
|
|
318
547
|
*/
|
|
319
|
-
export declare
|
|
320
|
-
}
|
|
548
|
+
export declare function ignore(target: Injectable, property?: string | number, descriptor?: PropertyDescriptor | number): void;
|
|
321
549
|
|
|
322
550
|
/**
|
|
323
|
-
*
|
|
551
|
+
* A decorator that specifies what to inject into its target.
|
|
552
|
+
* @param dependencies - The dependencies to inject.
|
|
553
|
+
* @returns The decorator to be applied to the target class.
|
|
554
|
+
* @remarks
|
|
555
|
+
* The decorator can be used to decorate a class, listing all of the classes dependencies.
|
|
556
|
+
* Or it can be used to decorate a constructor paramter, indicating what to inject for that
|
|
557
|
+
* parameter.
|
|
558
|
+
* Or it can be used for a web component property, indicating what that property should resolve to.
|
|
559
|
+
*
|
|
324
560
|
* @public
|
|
325
561
|
*/
|
|
326
|
-
export declare
|
|
327
|
-
}
|
|
562
|
+
export declare const inject: (...dependencies: Key[]) => (target: any, key?: string | number, descriptor?: PropertyDescriptor | number) => void;
|
|
328
563
|
|
|
329
564
|
/**
|
|
330
|
-
* A
|
|
331
|
-
*
|
|
332
|
-
* @param propertyOrOptions - The options used to configure child node observation.
|
|
565
|
+
* A class that declares constructor injected dependencies through
|
|
566
|
+
* a static "inject" field array of keys.
|
|
333
567
|
* @public
|
|
334
568
|
*/
|
|
335
|
-
export declare
|
|
569
|
+
export declare type Injectable<T = {}> = Constructable<T> & {
|
|
570
|
+
inject?: Key[];
|
|
571
|
+
};
|
|
336
572
|
|
|
337
573
|
/**
|
|
338
|
-
*
|
|
574
|
+
* Used to configure a dependency injection interface key.
|
|
339
575
|
* @public
|
|
340
576
|
*/
|
|
341
|
-
export declare
|
|
342
|
-
private observerProperty;
|
|
343
|
-
/**
|
|
344
|
-
* Creates an instance of ChildrenDirective.
|
|
345
|
-
* @param options - The options to use in configuring the child observation behavior.
|
|
346
|
-
*/
|
|
347
|
-
constructor(options: ChildrenDirectiveOptions);
|
|
577
|
+
export declare interface InterfaceConfiguration {
|
|
348
578
|
/**
|
|
349
|
-
*
|
|
350
|
-
* @param target - The target to observe.
|
|
579
|
+
* The friendly name for the interface. Useful for debugging.
|
|
351
580
|
*/
|
|
352
|
-
|
|
581
|
+
friendlyName?: string;
|
|
353
582
|
/**
|
|
354
|
-
*
|
|
355
|
-
*
|
|
583
|
+
* When true, the dependency will be re-resolved when FASTElement connection changes.
|
|
584
|
+
* If the resolved value changes due to connection change, a {@link @microsoft/fast-element#Observable | notification }
|
|
585
|
+
* will be emitted for the property, with the previous and next values provided to any subscriber.
|
|
356
586
|
*/
|
|
357
|
-
|
|
358
|
-
/**
|
|
359
|
-
* Retrieves the raw nodes that should be assigned to the source property.
|
|
360
|
-
* @param target - The target to get the node to.
|
|
361
|
-
*/
|
|
362
|
-
getNodes(target: Element): Node[];
|
|
363
|
-
private handleEvent;
|
|
587
|
+
respectConnection?: boolean;
|
|
364
588
|
}
|
|
365
589
|
|
|
366
590
|
/**
|
|
367
|
-
*
|
|
591
|
+
* A key that is used to register dependencies with a dependency injection container.
|
|
368
592
|
* @public
|
|
369
593
|
*/
|
|
370
|
-
export declare type
|
|
594
|
+
export declare type Key = PropertyKey | object | ContextDecorator | Constructable | Resolver;
|
|
371
595
|
|
|
372
596
|
/**
|
|
373
|
-
* A
|
|
374
|
-
*
|
|
597
|
+
* A decorator that lazily injects a dependency depending on whether the `Key` is present at the time of function call.
|
|
598
|
+
*
|
|
599
|
+
* @example
|
|
600
|
+
* You need to make your argument a function that returns the type, for example
|
|
601
|
+
* ```ts
|
|
602
|
+
* class Foo {
|
|
603
|
+
* constructor( @lazy('random') public random: () => number )
|
|
604
|
+
* }
|
|
605
|
+
* const foo = container.get(Foo); // instanceof Foo
|
|
606
|
+
* foo.random(); // throws
|
|
607
|
+
* ```
|
|
608
|
+
* would throw an exception because you haven't registered `'random'` before calling the method.
|
|
609
|
+
* @example
|
|
610
|
+
* This, would give you a new 'Math.random()' number each time.
|
|
611
|
+
* ```ts
|
|
612
|
+
* class Foo {
|
|
613
|
+
* constructor( @lazy('random') public random: () => random )
|
|
614
|
+
* }
|
|
615
|
+
* container.register(Registration.callback('random', Math.random ));
|
|
616
|
+
* container.get(Foo).random(); // some random number
|
|
617
|
+
* container.get(Foo).random(); // another random number
|
|
618
|
+
* ```
|
|
619
|
+
*
|
|
620
|
+
* `@lazy` does not manage the lifecycle of the underlying key. If you want a singleton, you have to register as a
|
|
621
|
+
* `singleton`, `transient` would also behave as you would expect, providing you a new instance each time.
|
|
622
|
+
*
|
|
623
|
+
* @param key - The key to lazily resolve.
|
|
624
|
+
* see {@link DI.createContext} on interactions with interfaces
|
|
625
|
+
*
|
|
375
626
|
* @public
|
|
376
627
|
*/
|
|
377
|
-
export declare
|
|
378
|
-
/**
|
|
379
|
-
* The preprocessed HTML string or template to compile.
|
|
380
|
-
*/
|
|
381
|
-
html: string | HTMLTemplateElement,
|
|
382
|
-
/**
|
|
383
|
-
* The behavior factories used within the html that is being compiled.
|
|
384
|
-
*/
|
|
385
|
-
factories: Record<string, ViewBehaviorFactory>) => HTMLTemplateCompilationResult;
|
|
628
|
+
export declare const lazy: (key: any) => any;
|
|
386
629
|
|
|
387
630
|
/**
|
|
388
|
-
*
|
|
631
|
+
* A decorator that indicates that a new instance should be injected scoped to the
|
|
632
|
+
* container that requested the instance.
|
|
633
|
+
* @param key - The dependency key for the new instance.
|
|
634
|
+
* @remarks
|
|
635
|
+
* This creates a resolver with an instance strategy pointing to the new instance, effectively
|
|
636
|
+
* making this a singleton, scoped to the container or DOM's subtree.
|
|
637
|
+
*
|
|
389
638
|
* @public
|
|
390
639
|
*/
|
|
391
|
-
export declare const
|
|
392
|
-
/**
|
|
393
|
-
* Sets the HTML trusted types policy used by the compiler.
|
|
394
|
-
* @param policy - The policy to set for HTML.
|
|
395
|
-
* @remarks
|
|
396
|
-
* This API can only be called once, for security reasons. It should be
|
|
397
|
-
* called by the application developer at the start of their program.
|
|
398
|
-
*/
|
|
399
|
-
setHTMLPolicy(policy: TrustedTypesPolicy): void;
|
|
400
|
-
/**
|
|
401
|
-
* Compiles a template and associated directives into a compilation
|
|
402
|
-
* result which can be used to create views.
|
|
403
|
-
* @param html - The html string or template element to compile.
|
|
404
|
-
* @param directives - The directives referenced by the template.
|
|
405
|
-
* @remarks
|
|
406
|
-
* The template that is provided for compilation is altered in-place
|
|
407
|
-
* and cannot be compiled again. If the original template must be preserved,
|
|
408
|
-
* it is recommended that you clone the original and pass the clone to this API.
|
|
409
|
-
* @public
|
|
410
|
-
*/
|
|
411
|
-
compile<TSource = any, TParent = any>(html: string | HTMLTemplateElement, directives: Record<string, ViewBehaviorFactory>): HTMLTemplateCompilationResult<TSource, TParent>;
|
|
412
|
-
/**
|
|
413
|
-
* Sets the default compilation strategy that will be used by the ViewTemplate whenever
|
|
414
|
-
* it needs to compile a view preprocessed with the html template function.
|
|
415
|
-
* @param strategy - The compilation strategy to use when compiling templates.
|
|
416
|
-
*/
|
|
417
|
-
setDefaultStrategy(strategy: CompilationStrategy): void;
|
|
418
|
-
/**
|
|
419
|
-
* Aggregates an array of strings and directives into a single directive.
|
|
420
|
-
* @param parts - A heterogeneous array of static strings interspersed with
|
|
421
|
-
* directives.
|
|
422
|
-
* @returns A single inline directive that aggregates the behavior of all the parts.
|
|
423
|
-
*/
|
|
424
|
-
aggregate(parts: (string | ViewBehaviorFactory)[]): ViewBehaviorFactory;
|
|
425
|
-
};
|
|
640
|
+
export declare const newInstanceForScope: (key: any) => any;
|
|
426
641
|
|
|
427
642
|
/**
|
|
428
|
-
*
|
|
643
|
+
* A decorator that indicates that a new instance should be injected.
|
|
644
|
+
* @param key - The dependency key for the new instance.
|
|
645
|
+
* @remarks
|
|
646
|
+
* The instance is not internally cached with a resolver as newInstanceForScope does.
|
|
647
|
+
*
|
|
429
648
|
* @public
|
|
430
649
|
*/
|
|
431
|
-
export declare
|
|
432
|
-
|
|
433
|
-
declare function compose<TType extends Constructable<HTMLElement> = Constructable<HTMLElement>>(this: TType, nameOrDef: string | PartialFASTElementDefinition): FASTElementDefinition<TType>;
|
|
434
|
-
|
|
435
|
-
declare function compose<TType extends Constructable<HTMLElement> = Constructable<HTMLElement>>(type: TType, nameOrDef?: string | PartialFASTElementDefinition): FASTElementDefinition<TType>;
|
|
650
|
+
export declare const newInstanceOf: (key: any) => any;
|
|
436
651
|
|
|
437
652
|
/**
|
|
438
|
-
*
|
|
653
|
+
* A decorator that allows you to optionally inject a dependency depending on whether the [[`Key`]] is present, for example:
|
|
654
|
+
* @example
|
|
655
|
+
* ```ts
|
|
656
|
+
* class Foo {
|
|
657
|
+
* constructor( @inject('mystring') public str: string = 'somestring' )
|
|
658
|
+
* }
|
|
659
|
+
* container.get(Foo); // throws
|
|
660
|
+
* ```
|
|
661
|
+
* would fail
|
|
662
|
+
*
|
|
663
|
+
* @example
|
|
664
|
+
* ```ts
|
|
665
|
+
* class Foo {
|
|
666
|
+
* constructor( @optional('mystring') public str: string = 'somestring' )
|
|
667
|
+
* }
|
|
668
|
+
* container.get(Foo).str // somestring
|
|
669
|
+
* ```
|
|
670
|
+
* if you use it without a default it will inject `undefined`, so remember to mark your input type as
|
|
671
|
+
* possibly `undefined`!
|
|
672
|
+
*
|
|
673
|
+
* @param key - The key to optionally resolve.
|
|
674
|
+
* see {@link DI.createContext} on interactions with interfaces
|
|
439
675
|
*
|
|
440
676
|
* @public
|
|
441
677
|
*/
|
|
442
|
-
export declare
|
|
443
|
-
new (...args: any[]): T;
|
|
444
|
-
};
|
|
678
|
+
export declare const optional: (key: any) => any;
|
|
445
679
|
|
|
446
680
|
/**
|
|
447
|
-
* A type
|
|
681
|
+
* A temporary type as a workaround for the TS compiler's erroneous built-in ParameterDecorator type.
|
|
448
682
|
* @public
|
|
449
683
|
*/
|
|
450
|
-
|
|
451
|
-
/**
|
|
452
|
-
* Creates an instance of the strategy.
|
|
453
|
-
* @param styles - The styles to initialize the strategy with.
|
|
454
|
-
*/
|
|
455
|
-
new (styles: (string | CSSStyleSheet)[]): StyleStrategy;
|
|
456
|
-
};
|
|
684
|
+
declare type ParameterDecorator_2 = (target: Object, propertyKey: string | undefined, parameterIndex: number) => void;
|
|
457
685
|
|
|
458
686
|
/**
|
|
459
|
-
* A
|
|
687
|
+
* A function capable of locating the parent container based on a container's owner.
|
|
688
|
+
* @remarks
|
|
689
|
+
* A container owner is usually an HTMLElement instance.
|
|
460
690
|
* @public
|
|
461
691
|
*/
|
|
462
|
-
export declare
|
|
463
|
-
/**
|
|
464
|
-
* Creates a simple content view instance.
|
|
465
|
-
*/
|
|
466
|
-
create(): ContentView;
|
|
467
|
-
}
|
|
692
|
+
export declare type ParentLocator = (owner: any) => Container | null;
|
|
468
693
|
|
|
469
694
|
/**
|
|
470
|
-
*
|
|
695
|
+
* Represents an object that can register itself.
|
|
471
696
|
* @public
|
|
472
697
|
*/
|
|
473
|
-
export declare
|
|
474
|
-
readonly context: ExecutionContext;
|
|
475
|
-
/**
|
|
476
|
-
* Binds a view's behaviors to its binding source.
|
|
477
|
-
* @param source - The binding source for the view's binding behaviors.
|
|
478
|
-
* @param context - The execution context to run the view within.
|
|
479
|
-
*/
|
|
480
|
-
bind(source: any): void;
|
|
481
|
-
/**
|
|
482
|
-
* Unbinds a view's behaviors from its binding source and context.
|
|
483
|
-
*/
|
|
484
|
-
unbind(): void;
|
|
698
|
+
export declare type RegisterSelf<T extends Constructable> = {
|
|
485
699
|
/**
|
|
486
|
-
*
|
|
487
|
-
* @param
|
|
700
|
+
* Registers itself with the container.
|
|
701
|
+
* @param container - The container to register with.
|
|
488
702
|
*/
|
|
489
|
-
|
|
703
|
+
register(container: Container): Resolver<InstanceType<T>>;
|
|
490
704
|
/**
|
|
491
|
-
*
|
|
492
|
-
*
|
|
705
|
+
* Indicates whether during auto registration the object should be
|
|
706
|
+
* registered in the requesting container rather than the handling container.
|
|
493
707
|
*/
|
|
494
|
-
|
|
495
|
-
}
|
|
496
|
-
|
|
497
|
-
/* Excluded from this release type: createMetadataLocator */
|
|
498
|
-
|
|
499
|
-
/* Excluded from this release type: createTypeRegistry */
|
|
500
|
-
|
|
501
|
-
/**
|
|
502
|
-
* Transforms a template literal string into styles.
|
|
503
|
-
* @param strings - The string fragments that are interpolated with the values.
|
|
504
|
-
* @param values - The values that are interpolated with the string fragments.
|
|
505
|
-
* @remarks
|
|
506
|
-
* The css helper supports interpolation of strings and ElementStyle instances.
|
|
507
|
-
* @public
|
|
508
|
-
*/
|
|
509
|
-
export declare const css: CSSTemplateTag;
|
|
708
|
+
registerInRequestor: boolean;
|
|
709
|
+
};
|
|
510
710
|
|
|
511
711
|
/**
|
|
512
|
-
*
|
|
513
|
-
*
|
|
712
|
+
* Implemented by objects that wish to register dependencies in the container
|
|
713
|
+
* by creating resolvers.
|
|
514
714
|
* @public
|
|
515
715
|
*/
|
|
516
|
-
export declare interface
|
|
716
|
+
export declare interface Registration<K = any> {
|
|
517
717
|
/**
|
|
518
|
-
* Creates a
|
|
519
|
-
* @
|
|
718
|
+
* Creates a resolver for a desired dependency.
|
|
719
|
+
* @param container - The container to register the dependency within.
|
|
720
|
+
* @param key - The key to register dependency under, if overridden.
|
|
520
721
|
*/
|
|
521
|
-
|
|
722
|
+
register(container: Container): Resolver<K>;
|
|
522
723
|
}
|
|
523
724
|
|
|
524
725
|
/**
|
|
525
|
-
*
|
|
526
|
-
*
|
|
726
|
+
* You can use the resulting Registration of any of the factory methods
|
|
727
|
+
* to register with the container.
|
|
728
|
+
*
|
|
729
|
+
* @example
|
|
730
|
+
* ```
|
|
731
|
+
* class Foo {}
|
|
732
|
+
* const container = DI.createContainer();
|
|
733
|
+
* container.register(Registration.instance(Foo, new Foo()));
|
|
734
|
+
* container.get(Foo);
|
|
735
|
+
* ```
|
|
736
|
+
*
|
|
527
737
|
* @public
|
|
528
738
|
*/
|
|
529
|
-
export declare const
|
|
739
|
+
export declare const Registration: Readonly<{
|
|
740
|
+
/**
|
|
741
|
+
* Allows you to pass an instance.
|
|
742
|
+
* Every time you request this {@link Key} you will get this instance back.
|
|
743
|
+
*
|
|
744
|
+
* @example
|
|
745
|
+
* ```
|
|
746
|
+
* Registration.instance(Foo, new Foo()));
|
|
747
|
+
* ```
|
|
748
|
+
*
|
|
749
|
+
* @param key - The key to register the instance under.
|
|
750
|
+
* @param value - The instance to return when the key is requested.
|
|
751
|
+
*/
|
|
752
|
+
instance<T>(key: Key, value: T): Registration<T>;
|
|
753
|
+
/**
|
|
754
|
+
* Creates an instance from the class.
|
|
755
|
+
* Every time you request this {@link Key} you will get the same one back.
|
|
756
|
+
*
|
|
757
|
+
* @example
|
|
758
|
+
* ```
|
|
759
|
+
* Registration.singleton(Foo, Foo);
|
|
760
|
+
* ```
|
|
761
|
+
*
|
|
762
|
+
* @param key - The key to register the singleton under.
|
|
763
|
+
* @param value - The class to instantiate as a singleton when first requested.
|
|
764
|
+
*/
|
|
765
|
+
singleton<T_1 extends Constructable<{}>>(key: Key, value: T_1): Registration<InstanceType<T_1>>;
|
|
766
|
+
/**
|
|
767
|
+
* Creates an instance from a class.
|
|
768
|
+
* Every time you request this {@link Key} you will get a new instance.
|
|
769
|
+
*
|
|
770
|
+
* @example
|
|
771
|
+
* ```
|
|
772
|
+
* Registration.instance(Foo, Foo);
|
|
773
|
+
* ```
|
|
774
|
+
*
|
|
775
|
+
* @param key - The key to register the instance type under.
|
|
776
|
+
* @param value - The class to instantiate each time the key is requested.
|
|
777
|
+
*/
|
|
778
|
+
transient<T_2 extends Constructable<{}>>(key: Key, value: T_2): Registration<InstanceType<T_2>>;
|
|
530
779
|
/**
|
|
531
|
-
*
|
|
532
|
-
*
|
|
780
|
+
* Delegates to a callback function to provide the dependency.
|
|
781
|
+
* Every time you request this {@link Key} the callback will be invoked to provide
|
|
782
|
+
* the dependency.
|
|
783
|
+
*
|
|
784
|
+
* @example
|
|
785
|
+
* ```
|
|
786
|
+
* Registration.callback(Foo, () => new Foo());
|
|
787
|
+
* Registration.callback(Bar, (c: Container) => new Bar(c.get(Foo)));
|
|
788
|
+
* ```
|
|
789
|
+
*
|
|
790
|
+
* @param key - The key to register the callback for.
|
|
791
|
+
* @param callback - The function that is expected to return the dependency.
|
|
533
792
|
*/
|
|
534
|
-
|
|
793
|
+
callback<T_3>(key: Key, callback: ResolveCallback<T_3>): Registration<Resolved<T_3>>;
|
|
535
794
|
/**
|
|
536
|
-
*
|
|
537
|
-
*
|
|
795
|
+
* Delegates to a callback function to provide the dependency and then caches the
|
|
796
|
+
* dependency for future requests.
|
|
797
|
+
*
|
|
798
|
+
* @example
|
|
799
|
+
* ```
|
|
800
|
+
* Registration.cachedCallback(Foo, () => new Foo());
|
|
801
|
+
* Registration.cachedCallback(Bar, (c: Container) => new Bar(c.get(Foo)));
|
|
802
|
+
* ```
|
|
803
|
+
*
|
|
804
|
+
* @param key - The key to register the callback for.
|
|
805
|
+
* @param callback - The function that is expected to return the dependency.
|
|
806
|
+
* @remarks
|
|
807
|
+
* If you pass the same Registration to another container, the same cached value will be used.
|
|
808
|
+
* Should all references to the resolver returned be removed, the cache will expire.
|
|
538
809
|
*/
|
|
539
|
-
|
|
810
|
+
cachedCallback<T_4>(key: Key, callback: ResolveCallback<T_4>): Registration<Resolved<T_4>>;
|
|
540
811
|
/**
|
|
541
|
-
*
|
|
542
|
-
*
|
|
812
|
+
* Creates an alternate {@link Key} to retrieve an instance by.
|
|
813
|
+
*
|
|
814
|
+
* @example
|
|
815
|
+
* ```
|
|
816
|
+
* Register.singleton(Foo, Foo)
|
|
817
|
+
* Register.aliasTo(Foo, MyFoos);
|
|
818
|
+
*
|
|
819
|
+
* container.getAll(MyFoos) // contains an instance of Foo
|
|
820
|
+
* ```
|
|
821
|
+
*
|
|
822
|
+
* @param originalKey - The original key that has been registered.
|
|
823
|
+
* @param aliasKey - The alias to the original key.
|
|
543
824
|
*/
|
|
544
|
-
|
|
825
|
+
aliasTo<T_5>(originalKey: T_5, aliasKey: Key): Registration<Resolved<T_5>>;
|
|
545
826
|
}>;
|
|
546
827
|
|
|
547
828
|
/**
|
|
548
|
-
*
|
|
549
|
-
* @public
|
|
550
|
-
*/
|
|
551
|
-
export declare function cssDirective(): (type: Constructable<CSSDirective>) => void;
|
|
552
|
-
|
|
553
|
-
/**
|
|
554
|
-
* Defines metadata for a CSSDirective.
|
|
829
|
+
* Implemented by objects that which to register dependencies in a container.
|
|
555
830
|
* @public
|
|
556
831
|
*/
|
|
557
|
-
export declare interface
|
|
832
|
+
export declare interface Registry {
|
|
558
833
|
/**
|
|
559
|
-
*
|
|
834
|
+
* Registers dependencies in the specified container.
|
|
835
|
+
* @param container - The container to register dependencies in.
|
|
836
|
+
* @param params - Parameters that affect the registration process.
|
|
837
|
+
* @remarks
|
|
838
|
+
* If this registry doubles as a Registration, it should return a Resolver
|
|
839
|
+
* for the registered dependency.
|
|
560
840
|
*/
|
|
561
|
-
|
|
841
|
+
register(container: Container, ...params: unknown[]): void | Resolver;
|
|
562
842
|
}
|
|
563
843
|
|
|
564
844
|
/**
|
|
565
|
-
*
|
|
845
|
+
* Represents a custom callback for resolving a request from the container.
|
|
846
|
+
* The handler is the container that is invoking the callback. The requestor
|
|
847
|
+
* is the original container that made the request. The handler and the requestor
|
|
848
|
+
* may not be the same if the request has bubbled up to a parent container in the DI hierarchy.
|
|
849
|
+
* The resolver is the instance of the resolver that stores the callback. This is provided in case
|
|
850
|
+
* the callback needs a place or key against which to store state across resolutions.
|
|
566
851
|
* @public
|
|
567
852
|
*/
|
|
568
|
-
export declare
|
|
853
|
+
export declare type ResolveCallback<T = any> = (handler: Container, requestor: Container, resolver: Resolver<T>) => T;
|
|
569
854
|
|
|
570
855
|
/**
|
|
571
|
-
*
|
|
572
|
-
* @param strings - The string fragments that are interpolated with the values.
|
|
573
|
-
* @param values - The values that are interpolated with the string fragments.
|
|
574
|
-
* @remarks
|
|
575
|
-
* The css helper supports interpolation of strings and ElementStyle instances.
|
|
576
|
-
* Use the .partial method to create partial CSS fragments.
|
|
577
|
-
* @public
|
|
578
|
-
*/
|
|
579
|
-
export declare type CSSTemplateTag = ((strings: TemplateStringsArray, ...values: (ComposableStyles | CSSDirective)[]) => ElementStyles) & {
|
|
580
|
-
/**
|
|
581
|
-
* Transforms a template literal string into partial CSS.
|
|
582
|
-
* @param strings - The string fragments that are interpolated with the values.
|
|
583
|
-
* @param values - The values that are interpolated with the string fragments.
|
|
584
|
-
* @public
|
|
585
|
-
*/
|
|
586
|
-
partial(strings: TemplateStringsArray, ...values: (ComposableStyles | CSSDirective)[]): CSSDirective;
|
|
587
|
-
};
|
|
588
|
-
|
|
589
|
-
/**
|
|
590
|
-
* Decorator: Defines a platform custom element based on `FASTElement`.
|
|
591
|
-
* @param nameOrDef - The name of the element to define or a definition object
|
|
592
|
-
* that describes the element to define.
|
|
856
|
+
* Represents something resolved from a service locator.
|
|
593
857
|
* @public
|
|
594
858
|
*/
|
|
595
|
-
export declare
|
|
859
|
+
export declare type Resolved<K> = K extends ContextDecorator<infer T> ? T : K extends Constructable ? InstanceType<K> : K extends ResolverLike<any, infer T1> ? T1 extends Constructable ? InstanceType<T1> : T1 : K;
|
|
596
860
|
|
|
597
861
|
/**
|
|
598
|
-
*
|
|
862
|
+
* Internally, the DI system maps "keys" to "resolvers". A resolver controls
|
|
863
|
+
* how a dependency is resolved. Resolvers for transient, singleton, etc. are
|
|
864
|
+
* provided out of the box, but you can also implement Resolver yourself and supply
|
|
865
|
+
* custom logic for resolution.
|
|
599
866
|
* @public
|
|
600
867
|
*/
|
|
601
|
-
export declare
|
|
602
|
-
|
|
603
|
-
declare function define<TType extends Constructable<HTMLElement> = Constructable<HTMLElement>>(this: TType, nameOrDef: string | PartialFASTElementDefinition): TType;
|
|
604
|
-
|
|
605
|
-
declare function define<TType extends Constructable<HTMLElement> = Constructable<HTMLElement>>(type: TType, nameOrDef?: string | PartialFASTElementDefinition): TType;
|
|
868
|
+
export declare interface Resolver<K = any> extends ResolverLike<Container, K> {
|
|
869
|
+
}
|
|
606
870
|
|
|
607
871
|
/**
|
|
608
|
-
*
|
|
872
|
+
* A utility class used that constructs and registers resolvers for a dependency
|
|
873
|
+
* injection container. Supports a standard set of object lifetimes.
|
|
609
874
|
* @public
|
|
610
875
|
*/
|
|
611
|
-
export declare
|
|
876
|
+
export declare class ResolverBuilder<K> {
|
|
877
|
+
private container;
|
|
878
|
+
private key;
|
|
612
879
|
/**
|
|
613
|
-
*
|
|
880
|
+
*
|
|
881
|
+
* @param container - The container to create resolvers for.
|
|
882
|
+
* @param key - The key to register resolvers under.
|
|
614
883
|
*/
|
|
615
|
-
|
|
616
|
-
}
|
|
617
|
-
|
|
618
|
-
/**
|
|
619
|
-
* Common DOM APIs.
|
|
620
|
-
* @public
|
|
621
|
-
*/
|
|
622
|
-
export declare const DOM: Readonly<{
|
|
884
|
+
constructor(container: Container, key: Key);
|
|
623
885
|
/**
|
|
624
|
-
*
|
|
625
|
-
*
|
|
886
|
+
* Creates a resolver for an existing object instance.
|
|
887
|
+
* @param value - The instance to resolve.
|
|
888
|
+
* @returns The resolver.
|
|
626
889
|
*/
|
|
627
|
-
|
|
890
|
+
instance(value: K): Resolver<K>;
|
|
628
891
|
/**
|
|
629
|
-
*
|
|
630
|
-
*
|
|
892
|
+
* Creates a resolver that enforces a singleton lifetime.
|
|
893
|
+
* @param value - The type to create and cache the singleton for.
|
|
894
|
+
* @returns The resolver.
|
|
631
895
|
*/
|
|
632
|
-
|
|
896
|
+
singleton(value: Constructable): Resolver<K>;
|
|
633
897
|
/**
|
|
634
|
-
*
|
|
635
|
-
*
|
|
898
|
+
* Creates a resolver that creates a new instance for every dependency request.
|
|
899
|
+
* @param value - The type to create instances of.
|
|
900
|
+
* @returns - The resolver.
|
|
636
901
|
*/
|
|
637
|
-
|
|
902
|
+
transient(value: Constructable): Resolver<K>;
|
|
638
903
|
/**
|
|
639
|
-
*
|
|
640
|
-
*
|
|
641
|
-
* @param
|
|
642
|
-
* @
|
|
643
|
-
* @remarks
|
|
644
|
-
* If the value is `null` or `undefined`, the attribute is removed, otherwise
|
|
645
|
-
* it is set to the provided value using the standard `setAttribute` API.
|
|
904
|
+
* Creates a resolver that invokes a callback function for every dependency resolution
|
|
905
|
+
* request, allowing custom logic to return the dependency.
|
|
906
|
+
* @param value - The callback to call during resolution.
|
|
907
|
+
* @returns The resolver.
|
|
646
908
|
*/
|
|
647
|
-
|
|
909
|
+
callback(value: ResolveCallback<K>): Resolver<K>;
|
|
648
910
|
/**
|
|
649
|
-
*
|
|
650
|
-
*
|
|
651
|
-
*
|
|
652
|
-
* @param value - The
|
|
653
|
-
* @
|
|
654
|
-
* If the value is true, the attribute is added; otherwise it is removed.
|
|
911
|
+
* Creates a resolver that invokes a callback function the first time that a dependency
|
|
912
|
+
* resolution is requested. The returned value is then cached and provided for all
|
|
913
|
+
* subsequent requests.
|
|
914
|
+
* @param value - The callback to call during the first resolution.
|
|
915
|
+
* @returns The resolver.
|
|
655
916
|
*/
|
|
656
|
-
|
|
657
|
-
|
|
917
|
+
cachedCallback(value: ResolveCallback<K>): Resolver<K>;
|
|
918
|
+
/**
|
|
919
|
+
* Aliases the current key to a different key.
|
|
920
|
+
* @param destinationKey - The key to point the alias to.
|
|
921
|
+
* @returns The resolver.
|
|
922
|
+
*/
|
|
923
|
+
aliasTo(destinationKey: Key): Resolver<K>;
|
|
924
|
+
private registerResolver;
|
|
925
|
+
}
|
|
926
|
+
|
|
927
|
+
/** @internal */
|
|
928
|
+
export declare class ResolverImpl implements Resolver, Registration {
|
|
929
|
+
key: Key;
|
|
930
|
+
strategy: ResolverStrategy;
|
|
931
|
+
state: any;
|
|
932
|
+
constructor(key: Key, strategy: ResolverStrategy, state: any);
|
|
933
|
+
get $isResolver(): true;
|
|
934
|
+
private resolving;
|
|
935
|
+
register(container: Container): Resolver;
|
|
936
|
+
resolveAsync(handler: Container, requestor: Container): Promise<any>;
|
|
937
|
+
resolve(handler: Container, requestor: Container): any;
|
|
938
|
+
getFactory(container: Container): Factory | null;
|
|
939
|
+
}
|
|
940
|
+
|
|
941
|
+
declare interface ResolverLike<C, K = any> {
|
|
942
|
+
readonly $isResolver: true;
|
|
943
|
+
resolve(handler: C, requestor: C): Resolved<K>;
|
|
944
|
+
resolveAsync(handler: C, requestor: C): Promise<Resolved<K>>;
|
|
945
|
+
getFactory?(container: C): (K extends Constructable ? Factory<K> : never) | null;
|
|
946
|
+
}
|
|
947
|
+
|
|
948
|
+
/** @internal */
|
|
949
|
+
export declare const enum ResolverStrategy {
|
|
950
|
+
instance = 0,
|
|
951
|
+
singleton = 1,
|
|
952
|
+
transient = 2,
|
|
953
|
+
callback = 3,
|
|
954
|
+
array = 4,
|
|
955
|
+
alias = 5
|
|
956
|
+
}
|
|
658
957
|
|
|
659
958
|
/**
|
|
660
|
-
*
|
|
959
|
+
* Implemented by objects capable of resolving services and other dependencies.
|
|
661
960
|
* @public
|
|
662
961
|
*/
|
|
663
|
-
export declare
|
|
664
|
-
private boundObservables;
|
|
665
|
-
private needsInitialization;
|
|
666
|
-
private hasExistingShadowRoot;
|
|
667
|
-
private _template;
|
|
668
|
-
private _isConnected;
|
|
669
|
-
private behaviors;
|
|
670
|
-
private _mainStyles;
|
|
671
|
-
/**
|
|
672
|
-
* This allows Observable.getNotifier(...) to return the Controller
|
|
673
|
-
* when the notifier for the Controller itself is being requested. The
|
|
674
|
-
* result is that the Observable system does not need to create a separate
|
|
675
|
-
* instance of Notifier for observables on the Controller. The component and
|
|
676
|
-
* the controller will now share the same notifier, removing one-object construct
|
|
677
|
-
* per web component instance.
|
|
678
|
-
*/
|
|
679
|
-
private readonly $fastController;
|
|
962
|
+
export declare interface ServiceLocator {
|
|
680
963
|
/**
|
|
681
|
-
*
|
|
964
|
+
* Determines whether the locator has the ability to provide an implementation
|
|
965
|
+
* for the requested key.
|
|
966
|
+
* @param key - The dependency key to lookup.
|
|
967
|
+
* @param searchAncestors - Indicates whether to search the entire hierarchy of service locators.
|
|
682
968
|
*/
|
|
683
|
-
|
|
969
|
+
has<K extends Key>(key: K | Key, searchAncestors: boolean): boolean;
|
|
684
970
|
/**
|
|
685
|
-
*
|
|
686
|
-
*
|
|
971
|
+
* Gets a dependency by key.
|
|
972
|
+
* @param key - The key to lookup.
|
|
687
973
|
*/
|
|
688
|
-
|
|
974
|
+
get<K extends Key>(key: K): Resolved<K>;
|
|
689
975
|
/**
|
|
690
|
-
*
|
|
691
|
-
* @
|
|
692
|
-
* If `null` then the element is managing its own rendering.
|
|
693
|
-
*/
|
|
694
|
-
readonly view: ElementView<TElement> | null;
|
|
695
|
-
/**
|
|
696
|
-
* Indicates whether or not the custom element has been
|
|
697
|
-
* connected to the document.
|
|
698
|
-
*/
|
|
699
|
-
get isConnected(): boolean;
|
|
700
|
-
private setIsConnected;
|
|
701
|
-
/**
|
|
702
|
-
* Gets/sets the template used to render the component.
|
|
703
|
-
* @remarks
|
|
704
|
-
* This value can only be accurately read after connect but can be set at any time.
|
|
705
|
-
*/
|
|
706
|
-
get template(): ElementViewTemplate<TElement> | null;
|
|
707
|
-
set template(value: ElementViewTemplate<TElement> | null);
|
|
708
|
-
/**
|
|
709
|
-
* The main set of styles used for the component, independent
|
|
710
|
-
* of any dynamically added styles.
|
|
976
|
+
* Gets a dependency by key.
|
|
977
|
+
* @param key - The key to lookup.
|
|
711
978
|
*/
|
|
712
|
-
get
|
|
713
|
-
set mainStyles(value: ElementStyles | null);
|
|
714
|
-
/* Excluded from this release type: __constructor */
|
|
979
|
+
get<K extends Key>(key: Key): Resolved<K>;
|
|
715
980
|
/**
|
|
716
|
-
*
|
|
717
|
-
* @param
|
|
981
|
+
* Gets a dependency by key.
|
|
982
|
+
* @param key - The key to lookup.
|
|
718
983
|
*/
|
|
719
|
-
|
|
984
|
+
get<K extends Key>(key: K | Key): Resolved<K>;
|
|
720
985
|
/**
|
|
721
|
-
*
|
|
722
|
-
*
|
|
723
|
-
* @param
|
|
986
|
+
* Gets a dependency by key, allowing for asynchronously
|
|
987
|
+
* resolved dependencies.
|
|
988
|
+
* @param key - The key to lookup.
|
|
724
989
|
*/
|
|
725
|
-
|
|
990
|
+
getAsync<K extends Key>(key: K): Promise<Resolved<K>>;
|
|
726
991
|
/**
|
|
727
|
-
*
|
|
728
|
-
*
|
|
992
|
+
* Gets a dependency by key, allowing for asynchronously
|
|
993
|
+
* resolved dependencies.
|
|
994
|
+
* @param key - The key to lookup.
|
|
729
995
|
*/
|
|
730
|
-
|
|
996
|
+
getAsync<K extends Key>(key: Key): Promise<Resolved<K>>;
|
|
731
997
|
/**
|
|
732
|
-
*
|
|
733
|
-
*
|
|
998
|
+
* Gets a dependency by key, allowing for asynchronously
|
|
999
|
+
* resolved dependencies.
|
|
1000
|
+
* @param key - The key to lookup.
|
|
734
1001
|
*/
|
|
735
|
-
|
|
1002
|
+
getAsync<K extends Key>(key: K | Key): Promise<Resolved<K>>;
|
|
736
1003
|
/**
|
|
737
|
-
*
|
|
1004
|
+
* Gets an array of all dependencies by key.
|
|
1005
|
+
* @param key - The key to lookup.
|
|
1006
|
+
* @param searchAncestors - Indicates whether to search the entire hierarchy of service locators.
|
|
738
1007
|
*/
|
|
739
|
-
|
|
1008
|
+
getAll<K extends Key>(key: K, searchAncestors?: boolean): readonly Resolved<K>[];
|
|
740
1009
|
/**
|
|
741
|
-
*
|
|
1010
|
+
* Gets an array of all dependencies by key.
|
|
1011
|
+
* @param key - The key to lookup.
|
|
1012
|
+
* @param searchAncestors - Indicates whether to search the entire hierarchy of service locators.
|
|
742
1013
|
*/
|
|
743
|
-
|
|
1014
|
+
getAll<K extends Key>(key: Key, searchAncestors?: boolean): readonly Resolved<K>[];
|
|
744
1015
|
/**
|
|
745
|
-
*
|
|
746
|
-
* @param
|
|
747
|
-
* @param
|
|
748
|
-
* @param newValue - The new value of the attribute.
|
|
1016
|
+
* Gets an array of all dependencies by key.
|
|
1017
|
+
* @param key - The key to lookup.
|
|
1018
|
+
* @param searchAncestors - Indicates whether to search the entire hierarchy of service locators.
|
|
749
1019
|
*/
|
|
750
|
-
|
|
751
|
-
/**
|
|
752
|
-
* Emits a custom HTML event.
|
|
753
|
-
* @param type - The type name of the event.
|
|
754
|
-
* @param detail - The event detail object to send with the event.
|
|
755
|
-
* @param options - The event options. By default bubbles and composed.
|
|
756
|
-
* @remarks
|
|
757
|
-
* Only emits events if connected.
|
|
758
|
-
*/
|
|
759
|
-
emit(type: string, detail?: any, options?: Omit<CustomEventInit, "detail">): void | boolean;
|
|
760
|
-
private finishInitialization;
|
|
761
|
-
private renderTemplate;
|
|
762
|
-
/**
|
|
763
|
-
* Locates or creates a controller for the specified element.
|
|
764
|
-
* @param element - The element to return the controller for.
|
|
765
|
-
* @remarks
|
|
766
|
-
* The specified element must have a {@link FASTElementDefinition}
|
|
767
|
-
* registered either through the use of the {@link customElement}
|
|
768
|
-
* decorator or a call to `FASTElement.define`.
|
|
769
|
-
*/
|
|
770
|
-
static forCustomElement(element: HTMLElement): ElementController;
|
|
1020
|
+
getAll<K extends Key>(key: K | Key, searchAncestors?: boolean): readonly Resolved<K>[];
|
|
771
1021
|
}
|
|
772
1022
|
|
|
773
1023
|
/**
|
|
774
|
-
*
|
|
775
|
-
* @param selector - An optional selector to restrict the filter to.
|
|
1024
|
+
* The key that resolves the ServiceLocator itself.
|
|
776
1025
|
* @public
|
|
777
1026
|
*/
|
|
778
|
-
export declare const
|
|
1027
|
+
export declare const ServiceLocator: ContextDecorator<ServiceLocator>;
|
|
779
1028
|
|
|
780
1029
|
/**
|
|
781
|
-
*
|
|
1030
|
+
* Registers the decorated class as a singleton dependency; the class will only be created once. Each
|
|
1031
|
+
* consecutive time the dependency is resolved, the same instance will be returned.
|
|
1032
|
+
*
|
|
1033
|
+
* @example
|
|
1034
|
+
* ```ts
|
|
1035
|
+
* @singleton()
|
|
1036
|
+
* class Foo { }
|
|
1037
|
+
* ```
|
|
782
1038
|
*
|
|
783
1039
|
* @public
|
|
784
1040
|
*/
|
|
785
|
-
export declare
|
|
1041
|
+
export declare function singleton<T extends Constructable>(): typeof singletonDecorator;
|
|
786
1042
|
|
|
787
1043
|
/**
|
|
788
|
-
* Represents styles that can be applied to a custom element.
|
|
789
1044
|
* @public
|
|
790
1045
|
*/
|
|
791
|
-
export declare
|
|
792
|
-
readonly styles: ReadonlyArray<ComposableStyles>;
|
|
793
|
-
private targets;
|
|
794
|
-
private _strategy;
|
|
795
|
-
/**
|
|
796
|
-
* The behaviors associated with this set of styles.
|
|
797
|
-
*/
|
|
798
|
-
readonly behaviors: ReadonlyArray<HostBehavior<HTMLElement>> | null;
|
|
799
|
-
/**
|
|
800
|
-
* Gets the StyleStrategy associated with these element styles.
|
|
801
|
-
*/
|
|
802
|
-
get strategy(): StyleStrategy;
|
|
803
|
-
/**
|
|
804
|
-
* Creates an instance of ElementStyles.
|
|
805
|
-
* @param styles - The styles that will be associated with elements.
|
|
806
|
-
*/
|
|
807
|
-
constructor(styles: ReadonlyArray<ComposableStyles>);
|
|
808
|
-
/* Excluded from this release type: addStylesTo */
|
|
809
|
-
/* Excluded from this release type: removeStylesFrom */
|
|
810
|
-
/* Excluded from this release type: isAttachedTo */
|
|
811
|
-
/**
|
|
812
|
-
* Associates behaviors with this set of styles.
|
|
813
|
-
* @param behaviors - The behaviors to associate.
|
|
814
|
-
*/
|
|
815
|
-
withBehaviors(...behaviors: HostBehavior<HTMLElement>[]): this;
|
|
816
|
-
/**
|
|
817
|
-
* Sets the strategy that handles adding/removing these styles for an element.
|
|
818
|
-
* @param strategy - The strategy to use.
|
|
819
|
-
*/
|
|
820
|
-
withStrategy(Strategy: ConstructibleStyleStrategy): this;
|
|
821
|
-
/**
|
|
822
|
-
* Sets the default strategy type to use when creating style strategies.
|
|
823
|
-
* @param Strategy - The strategy type to construct.
|
|
824
|
-
*/
|
|
825
|
-
static setDefaultStrategy(Strategy: ConstructibleStyleStrategy): void;
|
|
826
|
-
/**
|
|
827
|
-
* Normalizes a set of composable style options.
|
|
828
|
-
* @param styles - The style options to normalize.
|
|
829
|
-
* @returns A singular ElementStyles instance or undefined.
|
|
830
|
-
*/
|
|
831
|
-
static normalize(styles: ComposableStyles | ComposableStyles[] | undefined): ElementStyles | undefined;
|
|
832
|
-
/**
|
|
833
|
-
* Indicates whether the DOM supports the adoptedStyleSheets feature.
|
|
834
|
-
*/
|
|
835
|
-
static readonly supportsAdoptedStyleSheets: boolean;
|
|
836
|
-
}
|
|
1046
|
+
export declare function singleton<T extends Constructable>(options?: SingletonOptions): typeof singletonDecorator;
|
|
837
1047
|
|
|
838
1048
|
/**
|
|
839
|
-
*
|
|
840
|
-
*
|
|
841
|
-
|
|
842
|
-
|
|
843
|
-
|
|
844
|
-
|
|
845
|
-
|
|
846
|
-
|
|
847
|
-
|
|
848
|
-
|
|
849
|
-
|
|
850
|
-
/**
|
|
851
|
-
* A template capable of creating views specifically for rendering custom elements.
|
|
852
|
-
* @public
|
|
853
|
-
*/
|
|
854
|
-
export declare interface ElementViewTemplate<TSource = any, TParent = any> {
|
|
855
|
-
/**
|
|
856
|
-
* Creates an ElementView instance based on this template definition.
|
|
857
|
-
* @param hostBindingTarget - The element that host behaviors will be bound to.
|
|
858
|
-
*/
|
|
859
|
-
create(hostBindingTarget: Element): ElementView<TSource, TParent>;
|
|
860
|
-
/**
|
|
861
|
-
* Creates an HTMLView from this template, binds it to the source, and then appends it to the host.
|
|
862
|
-
* @param source - The data source to bind the template to.
|
|
863
|
-
* @param host - The Element where the template will be rendered.
|
|
864
|
-
* @param hostBindingTarget - An HTML element to target the host bindings at if different from the
|
|
865
|
-
* host that the template is being attached to.
|
|
866
|
-
*/
|
|
867
|
-
render(source: TSource, host: Node, hostBindingTarget?: Element): ElementView<TSource, TParent>;
|
|
868
|
-
}
|
|
869
|
-
|
|
870
|
-
/**
|
|
871
|
-
* A readonly, empty array.
|
|
872
|
-
* @remarks
|
|
873
|
-
* Typically returned by APIs that return arrays when there are
|
|
874
|
-
* no actual items to return.
|
|
875
|
-
* @public
|
|
876
|
-
*/
|
|
877
|
-
export declare const emptyArray: readonly never[];
|
|
878
|
-
|
|
879
|
-
/**
|
|
880
|
-
* Provides additional contextual information available to behaviors and expressions.
|
|
881
|
-
* @public
|
|
882
|
-
*/
|
|
883
|
-
export declare interface ExecutionContext<TParent = any> {
|
|
884
|
-
/**
|
|
885
|
-
* The index of the current item within a repeat context.
|
|
886
|
-
*/
|
|
887
|
-
index: number;
|
|
888
|
-
/**
|
|
889
|
-
* The length of the current collection within a repeat context.
|
|
890
|
-
*/
|
|
891
|
-
length: number;
|
|
892
|
-
/**
|
|
893
|
-
* The parent data source within a nested context.
|
|
894
|
-
*/
|
|
895
|
-
parent: TParent;
|
|
896
|
-
/**
|
|
897
|
-
* The parent execution context when in nested context scenarios.
|
|
898
|
-
*/
|
|
899
|
-
parentContext: ExecutionContext<TParent>;
|
|
900
|
-
/**
|
|
901
|
-
* The current event within an event handler.
|
|
902
|
-
*/
|
|
903
|
-
readonly event: Event;
|
|
904
|
-
/**
|
|
905
|
-
* Indicates whether the current item within a repeat context
|
|
906
|
-
* has an even index.
|
|
907
|
-
*/
|
|
908
|
-
readonly isEven: boolean;
|
|
909
|
-
/**
|
|
910
|
-
* Indicates whether the current item within a repeat context
|
|
911
|
-
* has an odd index.
|
|
912
|
-
*/
|
|
913
|
-
readonly isOdd: boolean;
|
|
914
|
-
/**
|
|
915
|
-
* Indicates whether the current item within a repeat context
|
|
916
|
-
* is the first item in the collection.
|
|
917
|
-
*/
|
|
918
|
-
readonly isFirst: boolean;
|
|
919
|
-
/**
|
|
920
|
-
* Indicates whether the current item within a repeat context
|
|
921
|
-
* is somewhere in the middle of the collection.
|
|
922
|
-
*/
|
|
923
|
-
readonly isInMiddle: boolean;
|
|
924
|
-
/**
|
|
925
|
-
* Indicates whether the current item within a repeat context
|
|
926
|
-
* is the last item in the collection.
|
|
927
|
-
*/
|
|
928
|
-
readonly isLast: boolean;
|
|
929
|
-
/**
|
|
930
|
-
* Returns the typed event detail of a custom event.
|
|
931
|
-
*/
|
|
932
|
-
eventDetail<TDetail>(): TDetail;
|
|
933
|
-
/**
|
|
934
|
-
* Returns the typed event target of the event.
|
|
935
|
-
*/
|
|
936
|
-
eventTarget<TTarget extends EventTarget>(): TTarget;
|
|
937
|
-
}
|
|
938
|
-
|
|
939
|
-
/**
|
|
940
|
-
* Provides additional contextual information available to behaviors and expressions.
|
|
941
|
-
* @public
|
|
942
|
-
*/
|
|
943
|
-
export declare const ExecutionContext: Readonly<{
|
|
944
|
-
/**
|
|
945
|
-
* A default execution context.
|
|
946
|
-
*/
|
|
947
|
-
default: ExecutionContext<any>;
|
|
948
|
-
/**
|
|
949
|
-
* Gets the current event.
|
|
950
|
-
* @returns An event object.
|
|
951
|
-
*/
|
|
952
|
-
getEvent(): Event | null;
|
|
953
|
-
/**
|
|
954
|
-
* Sets the current event.
|
|
955
|
-
* @param event - An event object.
|
|
956
|
-
*/
|
|
957
|
-
setEvent(event: Event | null): void;
|
|
958
|
-
}>;
|
|
959
|
-
|
|
960
|
-
/**
|
|
961
|
-
* The signature of an arrow function capable of being evaluated
|
|
962
|
-
* against source data and within an execution context.
|
|
963
|
-
* @public
|
|
964
|
-
*/
|
|
965
|
-
export declare type Expression<TSource = any, TReturn = any, TParent = any> = (source: TSource, context: ExecutionContext<TParent>) => TReturn;
|
|
966
|
-
|
|
967
|
-
/**
|
|
968
|
-
* Controls the lifecycle of an expression and provides relevant context.
|
|
969
|
-
* @public
|
|
970
|
-
*/
|
|
971
|
-
export declare interface ExpressionController<TSource = any, TParent = any> {
|
|
972
|
-
/**
|
|
973
|
-
* The source the expression is evaluated against.
|
|
974
|
-
*/
|
|
975
|
-
readonly source: TSource;
|
|
976
|
-
/**
|
|
977
|
-
* Indicates how the source's lifetime relates to the controller's lifetime.
|
|
978
|
-
*/
|
|
979
|
-
readonly sourceLifetime?: SourceLifetime;
|
|
980
|
-
/**
|
|
981
|
-
* The context the expression is evaluated against.
|
|
982
|
-
*/
|
|
983
|
-
readonly context: ExecutionContext<TParent>;
|
|
984
|
-
/**
|
|
985
|
-
* Indicates whether the controller is bound.
|
|
986
|
-
*/
|
|
987
|
-
readonly isBound: boolean;
|
|
988
|
-
/**
|
|
989
|
-
* Registers an unbind handler with the controller.
|
|
990
|
-
* @param behavior - An object to call when the controller unbinds.
|
|
991
|
-
*/
|
|
992
|
-
onUnbind(behavior: {
|
|
993
|
-
unbind(controller: ExpressionController<TSource, TParent>): any;
|
|
994
|
-
}): void;
|
|
995
|
-
}
|
|
996
|
-
|
|
997
|
-
/**
|
|
998
|
-
* Enables evaluation of and subscription to a binding.
|
|
999
|
-
* @public
|
|
1000
|
-
*/
|
|
1001
|
-
export declare interface ExpressionNotifier<TSource = any, TReturn = any, TParent = any> extends Notifier, ExpressionObserver<TSource, TReturn, TParent>, Disposable {
|
|
1002
|
-
/**
|
|
1003
|
-
* Observes the expression.
|
|
1004
|
-
* @param source - The source for the expression.
|
|
1005
|
-
* @param context - The context for the expression.
|
|
1006
|
-
*/
|
|
1007
|
-
observe(source: TSource, context?: ExecutionContext): TReturn;
|
|
1008
|
-
/**
|
|
1009
|
-
* Gets {@link ObservationRecord|ObservationRecords} that the {@link ExpressionNotifier}
|
|
1010
|
-
* is observing.
|
|
1011
|
-
*/
|
|
1012
|
-
records(): IterableIterator<ObservationRecord>;
|
|
1013
|
-
/**
|
|
1014
|
-
* Sets the update mode used by the observer.
|
|
1015
|
-
* @param isAsync - Indicates whether updates should be asynchronous.
|
|
1016
|
-
* @remarks
|
|
1017
|
-
* By default, the update mode is asynchronous, since that provides the best
|
|
1018
|
-
* performance for template rendering scenarios. Passing false to setMode will
|
|
1019
|
-
* instead cause the observer to notify subscribers immediately when changes occur.
|
|
1020
|
-
*/
|
|
1021
|
-
setMode(isAsync: boolean): void;
|
|
1022
|
-
}
|
|
1023
|
-
|
|
1024
|
-
/**
|
|
1025
|
-
* Observes an expression for changes.
|
|
1026
|
-
* @public
|
|
1027
|
-
*/
|
|
1028
|
-
export declare interface ExpressionObserver<TSource = any, TReturn = any, TParent = any> {
|
|
1029
|
-
/**
|
|
1030
|
-
* Binds the expression to the source.
|
|
1031
|
-
* @param controller - The controller that manages the lifecycle and related
|
|
1032
|
-
* context for the expression.
|
|
1033
|
-
*/
|
|
1034
|
-
bind(controller: ExpressionController<TSource, TParent>): TReturn;
|
|
1035
|
-
}
|
|
1036
|
-
|
|
1037
|
-
/* Excluded from this release type: FAST */
|
|
1038
|
-
|
|
1039
|
-
/**
|
|
1040
|
-
* Represents a custom element based on the FASTElement infrastructure.
|
|
1041
|
-
* @public
|
|
1042
|
-
*/
|
|
1043
|
-
export declare interface FASTElement extends HTMLElement {
|
|
1044
|
-
/**
|
|
1045
|
-
* The underlying controller that handles the lifecycle and rendering of
|
|
1046
|
-
* this FASTElement.
|
|
1047
|
-
*/
|
|
1048
|
-
readonly $fastController: ElementController;
|
|
1049
|
-
/**
|
|
1050
|
-
* Emits a custom HTML event.
|
|
1051
|
-
* @param type - The type name of the event.
|
|
1052
|
-
* @param detail - The event detail object to send with the event.
|
|
1053
|
-
* @param options - The event options. By default bubbles and composed.
|
|
1054
|
-
* @remarks
|
|
1055
|
-
* Only emits events if the element is connected.
|
|
1056
|
-
*/
|
|
1057
|
-
$emit(type: string, detail?: any, options?: Omit<CustomEventInit, "detail">): boolean | void;
|
|
1058
|
-
/**
|
|
1059
|
-
* The connected callback for this FASTElement.
|
|
1060
|
-
* @remarks
|
|
1061
|
-
* This method is invoked by the platform whenever this FASTElement
|
|
1062
|
-
* becomes connected to the document.
|
|
1063
|
-
*/
|
|
1064
|
-
connectedCallback(): void;
|
|
1065
|
-
/**
|
|
1066
|
-
* The disconnected callback for this FASTElement.
|
|
1067
|
-
* @remarks
|
|
1068
|
-
* This method is invoked by the platform whenever this FASTElement
|
|
1069
|
-
* becomes disconnected from the document.
|
|
1070
|
-
*/
|
|
1071
|
-
disconnectedCallback(): void;
|
|
1072
|
-
/**
|
|
1073
|
-
* The attribute changed callback for this FASTElement.
|
|
1074
|
-
* @param name - The name of the attribute that changed.
|
|
1075
|
-
* @param oldValue - The previous value of the attribute.
|
|
1076
|
-
* @param newValue - The new value of the attribute.
|
|
1077
|
-
* @remarks
|
|
1078
|
-
* This method is invoked by the platform whenever an observed
|
|
1079
|
-
* attribute of FASTElement has a value change.
|
|
1080
|
-
*/
|
|
1081
|
-
attributeChangedCallback(name: string, oldValue: string | null, newValue: string | null): void;
|
|
1082
|
-
}
|
|
1083
|
-
|
|
1084
|
-
/**
|
|
1085
|
-
* A minimal base class for FASTElements that also provides
|
|
1086
|
-
* static helpers for working with FASTElements.
|
|
1087
|
-
* @public
|
|
1088
|
-
*/
|
|
1089
|
-
export declare const FASTElement: {
|
|
1090
|
-
new (): FASTElement;
|
|
1091
|
-
define: typeof define;
|
|
1092
|
-
compose: typeof compose;
|
|
1093
|
-
from: typeof from;
|
|
1094
|
-
};
|
|
1095
|
-
|
|
1096
|
-
/**
|
|
1097
|
-
* Defines metadata for a FASTElement.
|
|
1098
|
-
* @public
|
|
1099
|
-
*/
|
|
1100
|
-
export declare class FASTElementDefinition<TType extends Constructable<HTMLElement> = Constructable<HTMLElement>> {
|
|
1101
|
-
private platformDefined;
|
|
1102
|
-
/**
|
|
1103
|
-
* The type this element definition describes.
|
|
1104
|
-
*/
|
|
1105
|
-
readonly type: TType;
|
|
1106
|
-
/**
|
|
1107
|
-
* Indicates if this element has been defined in at least one registry.
|
|
1108
|
-
*/
|
|
1109
|
-
get isDefined(): boolean;
|
|
1110
|
-
/**
|
|
1111
|
-
* The name of the custom element.
|
|
1112
|
-
*/
|
|
1113
|
-
readonly name: string;
|
|
1114
|
-
/**
|
|
1115
|
-
* The custom attributes of the custom element.
|
|
1116
|
-
*/
|
|
1117
|
-
readonly attributes: ReadonlyArray<AttributeDefinition>;
|
|
1118
|
-
/**
|
|
1119
|
-
* A map enabling lookup of attribute by associated property name.
|
|
1120
|
-
*/
|
|
1121
|
-
readonly propertyLookup: Record<string, AttributeDefinition>;
|
|
1122
|
-
/**
|
|
1123
|
-
* A map enabling lookup of property by associated attribute name.
|
|
1124
|
-
*/
|
|
1125
|
-
readonly attributeLookup: Record<string, AttributeDefinition>;
|
|
1126
|
-
/**
|
|
1127
|
-
* The template to render for the custom element.
|
|
1128
|
-
*/
|
|
1129
|
-
readonly template?: ElementViewTemplate;
|
|
1130
|
-
/**
|
|
1131
|
-
* The styles to associate with the custom element.
|
|
1132
|
-
*/
|
|
1133
|
-
readonly styles?: ElementStyles;
|
|
1134
|
-
/**
|
|
1135
|
-
* Options controlling the creation of the custom element's shadow DOM.
|
|
1136
|
-
*/
|
|
1137
|
-
readonly shadowOptions?: ShadowRootOptions;
|
|
1138
|
-
/**
|
|
1139
|
-
* Options controlling how the custom element is defined with the platform.
|
|
1140
|
-
*/
|
|
1141
|
-
readonly elementOptions: ElementDefinitionOptions;
|
|
1142
|
-
/**
|
|
1143
|
-
* The registry to register this component in by default.
|
|
1144
|
-
*/
|
|
1145
|
-
readonly registry: CustomElementRegistry;
|
|
1146
|
-
private constructor();
|
|
1147
|
-
/**
|
|
1148
|
-
* Defines a custom element based on this definition.
|
|
1149
|
-
* @param registry - The element registry to define the element in.
|
|
1150
|
-
* @remarks
|
|
1151
|
-
* This operation is idempotent per registry.
|
|
1152
|
-
*/
|
|
1153
|
-
define(registry?: CustomElementRegistry): this;
|
|
1154
|
-
/**
|
|
1155
|
-
* Creates an instance of FASTElementDefinition.
|
|
1156
|
-
* @param type - The type this definition is being created for.
|
|
1157
|
-
* @param nameOrDef - The name of the element to define or a config object
|
|
1158
|
-
* that describes the element to define.
|
|
1159
|
-
*/
|
|
1160
|
-
static compose<TType extends Constructable<HTMLElement> = Constructable<HTMLElement>>(type: TType, nameOrDef?: string | PartialFASTElementDefinition): FASTElementDefinition<TType>;
|
|
1161
|
-
/**
|
|
1162
|
-
* Gets the element definition associated with the specified type.
|
|
1163
|
-
* @param type - The custom element type to retrieve the definition for.
|
|
1164
|
-
*/
|
|
1165
|
-
static readonly getByType: (key: Function) => FASTElementDefinition<Constructable<HTMLElement>> | undefined;
|
|
1166
|
-
/**
|
|
1167
|
-
* Gets the element definition associated with the instance.
|
|
1168
|
-
* @param instance - The custom element instance to retrieve the definition for.
|
|
1169
|
-
*/
|
|
1170
|
-
static readonly getForInstance: (object: any) => FASTElementDefinition<Constructable<HTMLElement>> | undefined;
|
|
1171
|
-
}
|
|
1172
|
-
|
|
1173
|
-
/* Excluded from this release type: FASTGlobal */
|
|
1174
|
-
|
|
1175
|
-
declare function from<TBase extends typeof HTMLElement>(BaseType: TBase): new () => InstanceType<TBase> & FASTElement;
|
|
1176
|
-
|
|
1177
|
-
/**
|
|
1178
|
-
* Represents an object that can contribute behavior to a host.
|
|
1179
|
-
* @public
|
|
1180
|
-
*/
|
|
1181
|
-
export declare interface HostBehavior<TSource = any> {
|
|
1182
|
-
/**
|
|
1183
|
-
* Executed when this behavior is attached to a controller.
|
|
1184
|
-
* @param controller - Controls the behavior lifecycle.
|
|
1185
|
-
*/
|
|
1186
|
-
addedCallback?(controller: HostController<TSource>): void;
|
|
1187
|
-
/**
|
|
1188
|
-
* Executed when this behavior is detached from a controller.
|
|
1189
|
-
* @param controller - Controls the behavior lifecycle.
|
|
1190
|
-
*/
|
|
1191
|
-
removedCallback?(controller: HostController<TSource>): void;
|
|
1192
|
-
/**
|
|
1193
|
-
* Executed when this behavior's host is connected.
|
|
1194
|
-
* @param controller - Controls the behavior lifecycle.
|
|
1195
|
-
*/
|
|
1196
|
-
connectedCallback?(controller: HostController<TSource>): void;
|
|
1197
|
-
/**
|
|
1198
|
-
* Executed when this behavior's host is disconnected.
|
|
1199
|
-
* @param controller - Controls the behavior lifecycle.
|
|
1200
|
-
*/
|
|
1201
|
-
disconnectedCallback?(controller: HostController<TSource>): void;
|
|
1202
|
-
}
|
|
1203
|
-
|
|
1204
|
-
/**
|
|
1205
|
-
* Controls the lifecycle and context of behaviors and styles
|
|
1206
|
-
* associated with a component host.
|
|
1207
|
-
* @public
|
|
1208
|
-
*/
|
|
1209
|
-
export declare interface HostController<TSource = any> {
|
|
1210
|
-
/**
|
|
1211
|
-
* The component source.
|
|
1212
|
-
*/
|
|
1213
|
-
readonly source: TSource;
|
|
1214
|
-
/**
|
|
1215
|
-
* Indicates whether the host is connected or not.
|
|
1216
|
-
*/
|
|
1217
|
-
readonly isConnected: boolean;
|
|
1218
|
-
/**
|
|
1219
|
-
* The main set of styles used for the component, independent
|
|
1220
|
-
* of any behavior-specific styles.
|
|
1221
|
-
*/
|
|
1222
|
-
mainStyles: ElementStyles | null;
|
|
1223
|
-
/**
|
|
1224
|
-
* Adds the behavior to the component.
|
|
1225
|
-
* @param behavior - The behavior to add.
|
|
1226
|
-
*/
|
|
1227
|
-
addBehavior(behavior: HostBehavior<TSource>): void;
|
|
1228
|
-
/**
|
|
1229
|
-
* Removes the behavior from the component.
|
|
1230
|
-
* @param behavior - The behavior to remove.
|
|
1231
|
-
* @param force - Forces removal even if this behavior was added more than once.
|
|
1232
|
-
*/
|
|
1233
|
-
removeBehavior(behavior: HostBehavior<TSource>, force?: boolean): void;
|
|
1234
|
-
/**
|
|
1235
|
-
* Adds styles to this element. Providing an HTMLStyleElement will attach the element instance to the shadowRoot.
|
|
1236
|
-
* @param styles - The styles to add.
|
|
1237
|
-
*/
|
|
1238
|
-
addStyles(styles: ElementStyles | HTMLStyleElement | null | undefined): void;
|
|
1239
|
-
/**
|
|
1240
|
-
* Removes styles from this element. Providing an HTMLStyleElement will detach the element instance from the shadowRoot.
|
|
1241
|
-
* @param styles - the styles to remove.
|
|
1242
|
-
*/
|
|
1243
|
-
removeStyles(styles: ElementStyles | HTMLStyleElement | null | undefined): void;
|
|
1244
|
-
}
|
|
1245
|
-
|
|
1246
|
-
/**
|
|
1247
|
-
* Transforms a template literal string into a ViewTemplate.
|
|
1248
|
-
* @param strings - The string fragments that are interpolated with the values.
|
|
1249
|
-
* @param values - The values that are interpolated with the string fragments.
|
|
1250
|
-
* @remarks
|
|
1251
|
-
* The html helper supports interpolation of strings, numbers, binding expressions,
|
|
1252
|
-
* other template instances, and Directive instances.
|
|
1253
|
-
* @public
|
|
1254
|
-
*/
|
|
1255
|
-
export declare function html<TSource = any, TParent = any>(strings: TemplateStringsArray, ...values: TemplateValue<TSource, TParent>[]): ViewTemplate<TSource, TParent>;
|
|
1256
|
-
|
|
1257
|
-
/**
|
|
1258
|
-
* A directive that applies bindings.
|
|
1259
|
-
* @public
|
|
1260
|
-
*/
|
|
1261
|
-
export declare class HTMLBindingDirective implements HTMLDirective, ViewBehaviorFactory, ViewBehavior, Aspected {
|
|
1262
|
-
dataBinding: Binding;
|
|
1263
|
-
private data;
|
|
1264
|
-
private updateTarget;
|
|
1265
|
-
/**
|
|
1266
|
-
* The unique id of the factory.
|
|
1267
|
-
*/
|
|
1268
|
-
id: string;
|
|
1269
|
-
/**
|
|
1270
|
-
* The structural id of the DOM node to which the created behavior will apply.
|
|
1271
|
-
*/
|
|
1272
|
-
nodeId: string;
|
|
1273
|
-
/**
|
|
1274
|
-
* The original source aspect exactly as represented in markup.
|
|
1275
|
-
*/
|
|
1276
|
-
sourceAspect: string;
|
|
1277
|
-
/**
|
|
1278
|
-
* The evaluated target aspect, determined after processing the source.
|
|
1279
|
-
*/
|
|
1280
|
-
targetAspect: string;
|
|
1281
|
-
/**
|
|
1282
|
-
* The type of aspect to target.
|
|
1283
|
-
*/
|
|
1284
|
-
aspectType: Aspect;
|
|
1285
|
-
/**
|
|
1286
|
-
* Creates an instance of HTMLBindingDirective.
|
|
1287
|
-
* @param dataBinding - The binding configuration to apply.
|
|
1288
|
-
*/
|
|
1289
|
-
constructor(dataBinding: Binding);
|
|
1290
|
-
/**
|
|
1291
|
-
* Creates HTML to be used within a template.
|
|
1292
|
-
* @param add - Can be used to add behavior factories to a template.
|
|
1293
|
-
*/
|
|
1294
|
-
createHTML(add: AddViewBehaviorFactory): string;
|
|
1295
|
-
/**
|
|
1296
|
-
* Creates a behavior.
|
|
1297
|
-
*/
|
|
1298
|
-
createBehavior(): ViewBehavior;
|
|
1299
|
-
/* Excluded from this release type: bindDefault */
|
|
1300
|
-
/* Excluded from this release type: bind */
|
|
1301
|
-
/* Excluded from this release type: bindContent */
|
|
1302
|
-
/* Excluded from this release type: bindEvent */
|
|
1303
|
-
/* Excluded from this release type: unbind */
|
|
1304
|
-
/* Excluded from this release type: handleEvent */
|
|
1305
|
-
/* Excluded from this release type: handleChange */
|
|
1306
|
-
}
|
|
1307
|
-
|
|
1308
|
-
/**
|
|
1309
|
-
* Instructs the template engine to apply behavior to a node.
|
|
1310
|
-
* @public
|
|
1311
|
-
*/
|
|
1312
|
-
export declare interface HTMLDirective {
|
|
1313
|
-
/**
|
|
1314
|
-
* Creates HTML to be used within a template.
|
|
1315
|
-
* @param add - Can be used to add behavior factories to a template.
|
|
1316
|
-
*/
|
|
1317
|
-
createHTML(add: AddViewBehaviorFactory): string;
|
|
1318
|
-
}
|
|
1319
|
-
|
|
1320
|
-
/**
|
|
1321
|
-
* Instructs the template engine to apply behavior to a node.
|
|
1322
|
-
* @public
|
|
1323
|
-
*/
|
|
1324
|
-
export declare const HTMLDirective: Readonly<{
|
|
1325
|
-
/**
|
|
1326
|
-
* Gets the directive definition associated with the instance.
|
|
1327
|
-
* @param instance - The directive instance to retrieve the definition for.
|
|
1328
|
-
*/
|
|
1329
|
-
getForInstance: (object: any) => HTMLDirectiveDefinition<Constructable<HTMLDirective>> | undefined;
|
|
1330
|
-
/**
|
|
1331
|
-
* Gets the directive definition associated with the specified type.
|
|
1332
|
-
* @param type - The directive type to retrieve the definition for.
|
|
1333
|
-
*/
|
|
1334
|
-
getByType: (key: Function) => HTMLDirectiveDefinition<Constructable<HTMLDirective>> | undefined;
|
|
1335
|
-
/**
|
|
1336
|
-
* Defines an HTMLDirective based on the options.
|
|
1337
|
-
* @param type - The type to define as a directive.
|
|
1338
|
-
* @param options - Options that specify the directive's application.
|
|
1339
|
-
*/
|
|
1340
|
-
define<TType extends Constructable<HTMLDirective>>(type: TType, options?: PartialHTMLDirectiveDefinition): TType;
|
|
1341
|
-
}>;
|
|
1342
|
-
|
|
1343
|
-
/**
|
|
1344
|
-
* Decorator: Defines an HTMLDirective.
|
|
1345
|
-
* @param options - Provides options that specify the directive's application.
|
|
1346
|
-
* @public
|
|
1347
|
-
*/
|
|
1348
|
-
export declare function htmlDirective(options?: PartialHTMLDirectiveDefinition): (type: Constructable<HTMLDirective>) => void;
|
|
1349
|
-
|
|
1350
|
-
/**
|
|
1351
|
-
* Defines metadata for an HTMLDirective.
|
|
1352
|
-
* @public
|
|
1353
|
-
*/
|
|
1354
|
-
export declare interface HTMLDirectiveDefinition<TType extends Constructable<HTMLDirective> = Constructable<HTMLDirective>> extends Required<PartialHTMLDirectiveDefinition> {
|
|
1355
|
-
/**
|
|
1356
|
-
* The type that the definition provides metadata for.
|
|
1357
|
-
*/
|
|
1358
|
-
readonly type: TType;
|
|
1359
|
-
}
|
|
1360
|
-
|
|
1361
|
-
/**
|
|
1362
|
-
* The result of a template compilation operation.
|
|
1363
|
-
* @public
|
|
1364
|
-
*/
|
|
1365
|
-
export declare interface HTMLTemplateCompilationResult<TSource = any, TParent = any> {
|
|
1366
|
-
/**
|
|
1367
|
-
* Creates a view instance.
|
|
1368
|
-
* @param hostBindingTarget - The host binding target for the view.
|
|
1369
|
-
*/
|
|
1370
|
-
createView(hostBindingTarget?: Element): HTMLView<TSource, TParent>;
|
|
1371
|
-
}
|
|
1372
|
-
|
|
1373
|
-
/**
|
|
1374
|
-
* The standard View implementation, which also implements ElementView and SyntheticView.
|
|
1375
|
-
* @public
|
|
1376
|
-
*/
|
|
1377
|
-
export declare class HTMLView<TSource = any, TParent = any> implements ElementView<TSource, TParent>, SyntheticView<TSource, TParent>, ExecutionContext<TParent> {
|
|
1378
|
-
private fragment;
|
|
1379
|
-
private factories;
|
|
1380
|
-
readonly targets: ViewBehaviorTargets;
|
|
1381
|
-
private behaviors;
|
|
1382
|
-
private unbindables;
|
|
1383
|
-
/**
|
|
1384
|
-
* The data that the view is bound to.
|
|
1385
|
-
*/
|
|
1386
|
-
source: TSource | null;
|
|
1387
|
-
isBound: boolean;
|
|
1388
|
-
selfContained: boolean;
|
|
1389
|
-
/**
|
|
1390
|
-
* The execution context the view is running within.
|
|
1391
|
-
*/
|
|
1392
|
-
get context(): ExecutionContext<TParent>;
|
|
1393
|
-
/**
|
|
1394
|
-
* The index of the current item within a repeat context.
|
|
1395
|
-
*/
|
|
1396
|
-
index: number;
|
|
1397
|
-
/**
|
|
1398
|
-
* The length of the current collection within a repeat context.
|
|
1399
|
-
*/
|
|
1400
|
-
length: number;
|
|
1401
|
-
/**
|
|
1402
|
-
* The parent data source within a nested context.
|
|
1403
|
-
*/
|
|
1404
|
-
readonly parent: TParent;
|
|
1405
|
-
/**
|
|
1406
|
-
* The parent execution context when in nested context scenarios.
|
|
1407
|
-
*/
|
|
1408
|
-
readonly parentContext: ExecutionContext<TParent>;
|
|
1409
|
-
/**
|
|
1410
|
-
* The current event within an event handler.
|
|
1411
|
-
*/
|
|
1412
|
-
get event(): Event;
|
|
1413
|
-
/**
|
|
1414
|
-
* Indicates whether the current item within a repeat context
|
|
1415
|
-
* has an even index.
|
|
1416
|
-
*/
|
|
1417
|
-
get isEven(): boolean;
|
|
1418
|
-
/**
|
|
1419
|
-
* Indicates whether the current item within a repeat context
|
|
1420
|
-
* has an odd index.
|
|
1421
|
-
*/
|
|
1422
|
-
get isOdd(): boolean;
|
|
1423
|
-
/**
|
|
1424
|
-
* Indicates whether the current item within a repeat context
|
|
1425
|
-
* is the first item in the collection.
|
|
1426
|
-
*/
|
|
1427
|
-
get isFirst(): boolean;
|
|
1428
|
-
/**
|
|
1429
|
-
* Indicates whether the current item within a repeat context
|
|
1430
|
-
* is somewhere in the middle of the collection.
|
|
1431
|
-
*/
|
|
1432
|
-
get isInMiddle(): boolean;
|
|
1433
|
-
/**
|
|
1434
|
-
* Indicates whether the current item within a repeat context
|
|
1435
|
-
* is the last item in the collection.
|
|
1436
|
-
*/
|
|
1437
|
-
get isLast(): boolean;
|
|
1438
|
-
/**
|
|
1439
|
-
* Returns the typed event detail of a custom event.
|
|
1440
|
-
*/
|
|
1441
|
-
eventDetail<TDetail>(): TDetail;
|
|
1442
|
-
/**
|
|
1443
|
-
* Returns the typed event target of the event.
|
|
1444
|
-
*/
|
|
1445
|
-
eventTarget<TTarget extends EventTarget>(): TTarget;
|
|
1446
|
-
/**
|
|
1447
|
-
* The first DOM node in the range of nodes that make up the view.
|
|
1448
|
-
*/
|
|
1449
|
-
firstChild: Node;
|
|
1450
|
-
/**
|
|
1451
|
-
* The last DOM node in the range of nodes that make up the view.
|
|
1452
|
-
*/
|
|
1453
|
-
lastChild: Node;
|
|
1454
|
-
/**
|
|
1455
|
-
* Constructs an instance of HTMLView.
|
|
1456
|
-
* @param fragment - The html fragment that contains the nodes for this view.
|
|
1457
|
-
* @param behaviors - The behaviors to be applied to this view.
|
|
1458
|
-
*/
|
|
1459
|
-
constructor(fragment: DocumentFragment, factories: ReadonlyArray<ViewBehaviorFactory>, targets: ViewBehaviorTargets);
|
|
1460
|
-
/**
|
|
1461
|
-
* Appends the view's DOM nodes to the referenced node.
|
|
1462
|
-
* @param node - The parent node to append the view's DOM nodes to.
|
|
1463
|
-
*/
|
|
1464
|
-
appendTo(node: Node): void;
|
|
1465
|
-
/**
|
|
1466
|
-
* Inserts the view's DOM nodes before the referenced node.
|
|
1467
|
-
* @param node - The node to insert the view's DOM before.
|
|
1468
|
-
*/
|
|
1469
|
-
insertBefore(node: Node): void;
|
|
1470
|
-
/**
|
|
1471
|
-
* Removes the view's DOM nodes.
|
|
1472
|
-
* The nodes are not disposed and the view can later be re-inserted.
|
|
1473
|
-
*/
|
|
1474
|
-
remove(): void;
|
|
1475
|
-
/**
|
|
1476
|
-
* Removes the view and unbinds its behaviors, disposing of DOM nodes afterward.
|
|
1477
|
-
* Once a view has been disposed, it cannot be inserted or bound again.
|
|
1478
|
-
*/
|
|
1479
|
-
dispose(): void;
|
|
1480
|
-
onUnbind(behavior: {
|
|
1481
|
-
unbind(controller: ViewController<TSource, TParent>): any;
|
|
1482
|
-
}): void;
|
|
1483
|
-
/**
|
|
1484
|
-
* Binds a view's behaviors to its binding source.
|
|
1485
|
-
* @param source - The binding source for the view's binding behaviors.
|
|
1486
|
-
* @param context - The execution context to run the behaviors within.
|
|
1487
|
-
*/
|
|
1488
|
-
bind(source: TSource): void;
|
|
1489
|
-
/**
|
|
1490
|
-
* Unbinds a view's behaviors from its binding source.
|
|
1491
|
-
*/
|
|
1492
|
-
unbind(): void;
|
|
1493
|
-
private evaluateUnbindables;
|
|
1494
|
-
/**
|
|
1495
|
-
* Efficiently disposes of a contiguous range of synthetic view instances.
|
|
1496
|
-
* @param views - A contiguous range of views to be disposed.
|
|
1497
|
-
*/
|
|
1498
|
-
static disposeContiguousBatch(views: SyntheticView[]): void;
|
|
1499
|
-
}
|
|
1500
|
-
|
|
1501
|
-
/**
|
|
1502
|
-
* Observes array lengths.
|
|
1503
|
-
* @public
|
|
1504
|
-
*/
|
|
1505
|
-
export declare interface LengthObserver extends Subscriber {
|
|
1506
|
-
/**
|
|
1507
|
-
* The length of the observed array.
|
|
1508
|
-
*/
|
|
1509
|
-
length: number;
|
|
1510
|
-
}
|
|
1511
|
-
|
|
1512
|
-
/**
|
|
1513
|
-
* Enables observing the length of an array.
|
|
1514
|
-
* @param array - The array to observe the length of.
|
|
1515
|
-
* @returns The length of the array.
|
|
1516
|
-
* @public
|
|
1517
|
-
*/
|
|
1518
|
-
export declare function lengthOf<T>(array: readonly T[]): number;
|
|
1519
|
-
|
|
1520
|
-
/**
|
|
1521
|
-
* Creates an event listener binding.
|
|
1522
|
-
* @param binding - The binding to invoke when the event is raised.
|
|
1523
|
-
* @param options - Event listener options.
|
|
1524
|
-
* @returns A binding configuration.
|
|
1525
|
-
* @public
|
|
1526
|
-
*/
|
|
1527
|
-
export declare function listener<T = any>(binding: Expression<T>, options?: AddEventListenerOptions): Binding<T>;
|
|
1528
|
-
|
|
1529
|
-
/**
|
|
1530
|
-
* Common APIs related to markup generation.
|
|
1531
|
-
* @public
|
|
1532
|
-
*/
|
|
1533
|
-
export declare const Markup: Readonly<{
|
|
1534
|
-
/**
|
|
1535
|
-
* Creates a placeholder string suitable for marking out a location *within*
|
|
1536
|
-
* an attribute value or HTML content.
|
|
1537
|
-
* @param index - The directive index to create the placeholder for.
|
|
1538
|
-
* @remarks
|
|
1539
|
-
* Used internally by binding directives.
|
|
1540
|
-
*/
|
|
1541
|
-
interpolation: (id: string) => string;
|
|
1542
|
-
/**
|
|
1543
|
-
* Creates a placeholder that manifests itself as an attribute on an
|
|
1544
|
-
* element.
|
|
1545
|
-
* @param attributeName - The name of the custom attribute.
|
|
1546
|
-
* @param index - The directive index to create the placeholder for.
|
|
1547
|
-
* @remarks
|
|
1548
|
-
* Used internally by attribute directives such as `ref`, `slotted`, and `children`.
|
|
1549
|
-
*/
|
|
1550
|
-
attribute: (id: string) => string;
|
|
1551
|
-
/**
|
|
1552
|
-
* Creates a placeholder that manifests itself as a marker within the DOM structure.
|
|
1553
|
-
* @param index - The directive index to create the placeholder for.
|
|
1554
|
-
* @remarks
|
|
1555
|
-
* Used internally by structural directives such as `repeat`.
|
|
1556
|
-
*/
|
|
1557
|
-
comment: (id: string) => string;
|
|
1558
|
-
}>;
|
|
1559
|
-
|
|
1560
|
-
/* Excluded from this release type: Mutable */
|
|
1561
|
-
|
|
1562
|
-
/**
|
|
1563
|
-
* Options for configuring node observation behavior.
|
|
1564
|
-
* @public
|
|
1565
|
-
*/
|
|
1566
|
-
export declare interface NodeBehaviorOptions<T = any> {
|
|
1567
|
-
/**
|
|
1568
|
-
* The property to assign the observed nodes to.
|
|
1569
|
-
*/
|
|
1570
|
-
property: T;
|
|
1571
|
-
/**
|
|
1572
|
-
* Filters nodes that are synced with the property.
|
|
1573
|
-
* Called one time for each element in the array.
|
|
1574
|
-
* @param value - The Node that is being inspected.
|
|
1575
|
-
* @param index - The index of the node within the array.
|
|
1576
|
-
* @param array - The Node array that is being filtered.
|
|
1577
|
-
*/
|
|
1578
|
-
filter?: ElementsFilter;
|
|
1579
|
-
}
|
|
1580
|
-
|
|
1581
|
-
/**
|
|
1582
|
-
* A base class for node observation.
|
|
1583
|
-
* @public
|
|
1584
|
-
* @remarks
|
|
1585
|
-
* Internally used by the SlottedDirective and the ChildrenDirective.
|
|
1586
|
-
*/
|
|
1587
|
-
export declare abstract class NodeObservationDirective<T extends NodeBehaviorOptions> extends StatelessAttachedAttributeDirective<T> {
|
|
1588
|
-
private sourceProperty;
|
|
1589
|
-
/**
|
|
1590
|
-
* Bind this behavior to the source.
|
|
1591
|
-
* @param source - The source to bind to.
|
|
1592
|
-
* @param context - The execution context that the binding is operating within.
|
|
1593
|
-
* @param targets - The targets that behaviors in a view can attach to.
|
|
1594
|
-
*/
|
|
1595
|
-
bind(controller: ViewController): void;
|
|
1596
|
-
/**
|
|
1597
|
-
* Unbinds this behavior from the source.
|
|
1598
|
-
* @param source - The source to unbind from.
|
|
1599
|
-
* @param context - The execution context that the binding is operating within.
|
|
1600
|
-
* @param targets - The targets that behaviors in a view can attach to.
|
|
1601
|
-
*/
|
|
1602
|
-
unbind(controller: ViewController): void;
|
|
1603
|
-
/**
|
|
1604
|
-
* Gets the data source for the target.
|
|
1605
|
-
* @param target - The target to get the source for.
|
|
1606
|
-
* @returns The source.
|
|
1607
|
-
*/
|
|
1608
|
-
protected getSource(target: Node): any;
|
|
1609
|
-
/**
|
|
1610
|
-
* Updates the source property with the computed nodes.
|
|
1611
|
-
* @param source - The source object to assign the nodes property to.
|
|
1612
|
-
* @param value - The nodes to assign to the source object property.
|
|
1613
|
-
*/
|
|
1614
|
-
protected updateTarget(source: any, value: ReadonlyArray<any>): void;
|
|
1615
|
-
/**
|
|
1616
|
-
* Computes the set of nodes that should be assigned to the source property.
|
|
1617
|
-
* @param target - The target to compute the nodes for.
|
|
1618
|
-
* @returns The computed nodes.
|
|
1619
|
-
* @remarks
|
|
1620
|
-
* Applies filters if provided.
|
|
1621
|
-
*/
|
|
1622
|
-
protected computeNodes(target: any): Node[];
|
|
1623
|
-
/**
|
|
1624
|
-
* Begins observation of the nodes.
|
|
1625
|
-
* @param target - The target to observe.
|
|
1626
|
-
*/
|
|
1627
|
-
protected abstract observe(target: any): void;
|
|
1628
|
-
/**
|
|
1629
|
-
* Disconnects observation of the nodes.
|
|
1630
|
-
* @param target - The target to unobserve.
|
|
1631
|
-
*/
|
|
1632
|
-
protected abstract disconnect(target: any): void;
|
|
1633
|
-
/**
|
|
1634
|
-
* Retrieves the raw nodes that should be assigned to the source property.
|
|
1635
|
-
* @param target - The target to get the node to.
|
|
1636
|
-
*/
|
|
1637
|
-
protected abstract getNodes(target: any): Node[];
|
|
1638
|
-
}
|
|
1639
|
-
|
|
1640
|
-
/**
|
|
1641
|
-
* Normalizes the input value into a binding.
|
|
1642
|
-
* @param value - The value to create the default binding for.
|
|
1643
|
-
* @returns A binding configuration for the provided value.
|
|
1644
|
-
* @public
|
|
1645
|
-
*/
|
|
1646
|
-
export declare function normalizeBinding<TSource = any, TReturn = any, TParent = any>(value: Expression<TSource, TReturn, TParent> | Binding<TSource, TReturn, TParent> | {}): Binding<TSource, TReturn, TParent>;
|
|
1647
|
-
|
|
1648
|
-
/**
|
|
1649
|
-
* Provides change notifications for an observed subject.
|
|
1650
|
-
* @public
|
|
1651
|
-
*/
|
|
1652
|
-
export declare interface Notifier {
|
|
1653
|
-
/**
|
|
1654
|
-
* The object that subscribers will receive notifications for.
|
|
1655
|
-
*/
|
|
1656
|
-
readonly subject: any;
|
|
1657
|
-
/**
|
|
1658
|
-
* Notifies all subscribers, based on the args.
|
|
1659
|
-
* @param args - Data passed along to subscribers during notification.
|
|
1660
|
-
* @remarks
|
|
1661
|
-
* In some implementations, the args may be used to target specific subscribers.
|
|
1662
|
-
* This is usually in the case where a propertyName was passed during subscription.
|
|
1663
|
-
*/
|
|
1664
|
-
notify(args: any): void;
|
|
1665
|
-
/**
|
|
1666
|
-
* Subscribes to notification of changes in an object's state.
|
|
1667
|
-
* @param subscriber - The object that is subscribing for change notification.
|
|
1668
|
-
* @param propertyToWatch - The name of the property that the subscriber is interested in watching for changes.
|
|
1669
|
-
* @remarks
|
|
1670
|
-
* Some implementation may or may not require the propertyToWatch.
|
|
1671
|
-
*/
|
|
1672
|
-
subscribe(subscriber: Subscriber, propertyToWatch?: any): void;
|
|
1673
|
-
/**
|
|
1674
|
-
* Unsubscribes from notification of changes in an object's state.
|
|
1675
|
-
* @param subscriber - The object that is unsubscribing from change notification.
|
|
1676
|
-
* @param propertyToUnwatch - The name of the property that the subscriber is no longer interested in watching.
|
|
1677
|
-
* @remarks
|
|
1678
|
-
* Some implementation may or may not require the propertyToUnwatch.
|
|
1679
|
-
*/
|
|
1680
|
-
unsubscribe(subscriber: Subscriber, propertyToUnwatch?: any): void;
|
|
1681
|
-
}
|
|
1682
|
-
|
|
1683
|
-
/**
|
|
1684
|
-
* A {@link ValueConverter} that converts to and from `number` values.
|
|
1685
|
-
* @remarks
|
|
1686
|
-
* This converter allows for nullable numbers, returning `null` if the
|
|
1687
|
-
* input was `null`, `undefined`, or `NaN`.
|
|
1688
|
-
* @public
|
|
1689
|
-
*/
|
|
1690
|
-
export declare const nullableNumberConverter: ValueConverter;
|
|
1691
|
-
|
|
1692
|
-
/**
|
|
1693
|
-
* Common Observable APIs.
|
|
1694
|
-
* @public
|
|
1695
|
-
*/
|
|
1696
|
-
export declare const Observable: Readonly<{
|
|
1697
|
-
/* Excluded from this release type: setArrayObserverFactory */
|
|
1698
|
-
/**
|
|
1699
|
-
* Gets a notifier for an object or Array.
|
|
1700
|
-
* @param source - The object or Array to get the notifier for.
|
|
1701
|
-
*/
|
|
1702
|
-
getNotifier: <T extends Notifier = Notifier>(source: any) => T;
|
|
1703
|
-
/**
|
|
1704
|
-
* Records a property change for a source object.
|
|
1705
|
-
* @param source - The object to record the change against.
|
|
1706
|
-
* @param propertyName - The property to track as changed.
|
|
1707
|
-
*/
|
|
1708
|
-
track(source: unknown, propertyName: string): void;
|
|
1709
|
-
/**
|
|
1710
|
-
* Notifies watchers that the currently executing property getter or function is volatile
|
|
1711
|
-
* with respect to its observable dependencies.
|
|
1712
|
-
*/
|
|
1713
|
-
trackVolatile(): void;
|
|
1714
|
-
/**
|
|
1715
|
-
* Notifies subscribers of a source object of changes.
|
|
1716
|
-
* @param source - the object to notify of changes.
|
|
1717
|
-
* @param args - The change args to pass to subscribers.
|
|
1718
|
-
*/
|
|
1719
|
-
notify(source: unknown, args: any): void;
|
|
1720
|
-
/**
|
|
1721
|
-
* Defines an observable property on an object or prototype.
|
|
1722
|
-
* @param target - The target object to define the observable on.
|
|
1723
|
-
* @param nameOrAccessor - The name of the property to define as observable;
|
|
1724
|
-
* or a custom accessor that specifies the property name and accessor implementation.
|
|
1725
|
-
*/
|
|
1726
|
-
defineProperty(target: {}, nameOrAccessor: string | Accessor): void;
|
|
1727
|
-
/**
|
|
1728
|
-
* Finds all the observable accessors defined on the target,
|
|
1729
|
-
* including its prototype chain.
|
|
1730
|
-
* @param target - The target object to search for accessor on.
|
|
1731
|
-
*/
|
|
1732
|
-
getAccessors: (target: {}) => Accessor[];
|
|
1733
|
-
/**
|
|
1734
|
-
* Creates a {@link ExpressionNotifier} that can watch the
|
|
1735
|
-
* provided {@link Expression} for changes.
|
|
1736
|
-
* @param binding - The binding to observe.
|
|
1737
|
-
* @param initialSubscriber - An initial subscriber to changes in the binding value.
|
|
1738
|
-
* @param isVolatileBinding - Indicates whether the binding's dependency list must be re-evaluated on every value evaluation.
|
|
1739
|
-
*/
|
|
1740
|
-
binding<TSource = any, TReturn = any>(binding: Expression<TSource, TReturn, any>, initialSubscriber?: Subscriber, isVolatileBinding?: boolean): ExpressionNotifier<TSource, TReturn, any>;
|
|
1741
|
-
/**
|
|
1742
|
-
* Determines whether a binding expression is volatile and needs to have its dependency list re-evaluated
|
|
1743
|
-
* on every evaluation of the value.
|
|
1744
|
-
* @param binding - The binding to inspect.
|
|
1745
|
-
*/
|
|
1746
|
-
isVolatileBinding<TSource_1 = any, TReturn_1 = any>(binding: Expression<TSource_1, TReturn_1, any>): boolean;
|
|
1747
|
-
}>;
|
|
1748
|
-
|
|
1749
|
-
/**
|
|
1750
|
-
* Decorator: Defines an observable property on the target.
|
|
1751
|
-
* @param target - The target to define the observable on.
|
|
1752
|
-
* @param nameOrAccessor - The property name or accessor to define the observable as.
|
|
1753
|
-
* @public
|
|
1754
|
-
*/
|
|
1755
|
-
export declare function observable(target: {}, nameOrAccessor: string | Accessor): void;
|
|
1756
|
-
|
|
1757
|
-
/**
|
|
1758
|
-
* A record of observable property access.
|
|
1759
|
-
* @public
|
|
1760
|
-
*/
|
|
1761
|
-
export declare interface ObservationRecord {
|
|
1762
|
-
/**
|
|
1763
|
-
* The source object with an observable property that was accessed.
|
|
1764
|
-
*/
|
|
1765
|
-
propertySource: any;
|
|
1766
|
-
/**
|
|
1767
|
-
* The name of the observable property on {@link ObservationRecord.propertySource} that was accessed.
|
|
1768
|
-
*/
|
|
1769
|
-
propertyName: string;
|
|
1770
|
-
}
|
|
1771
|
-
|
|
1772
|
-
/**
|
|
1773
|
-
* Creates a one time binding
|
|
1774
|
-
* @param binding - The binding to refresh when signaled.
|
|
1775
|
-
* @returns A binding configuration.
|
|
1776
|
-
* @public
|
|
1777
|
-
*/
|
|
1778
|
-
export declare function oneTime<T = any>(binding: Expression<T>): Binding<T>;
|
|
1779
|
-
|
|
1780
|
-
/**
|
|
1781
|
-
* Common APIs related to content parsing.
|
|
1782
|
-
* @public
|
|
1783
|
-
*/
|
|
1784
|
-
export declare const Parser: Readonly<{
|
|
1785
|
-
/**
|
|
1786
|
-
* Parses text content or HTML attribute content, separating out the static strings
|
|
1787
|
-
* from the directives.
|
|
1788
|
-
* @param value - The content or attribute string to parse.
|
|
1789
|
-
* @param factories - A list of directives to search for in the string.
|
|
1790
|
-
* @returns A heterogeneous array of static strings interspersed with
|
|
1791
|
-
* directives or null if no directives are found in the string.
|
|
1792
|
-
*/
|
|
1793
|
-
parse(value: string, factories: Record<string, ViewBehaviorFactory>): (string | ViewBehaviorFactory)[] | null;
|
|
1794
|
-
}>;
|
|
1795
|
-
|
|
1796
|
-
/**
|
|
1797
|
-
* Represents metadata configuration for a custom element.
|
|
1798
|
-
* @public
|
|
1799
|
-
*/
|
|
1800
|
-
export declare interface PartialFASTElementDefinition {
|
|
1801
|
-
/**
|
|
1802
|
-
* The name of the custom element.
|
|
1803
|
-
*/
|
|
1804
|
-
readonly name: string;
|
|
1805
|
-
/**
|
|
1806
|
-
* The template to render for the custom element.
|
|
1807
|
-
*/
|
|
1808
|
-
readonly template?: ElementViewTemplate;
|
|
1809
|
-
/**
|
|
1810
|
-
* The styles to associate with the custom element.
|
|
1811
|
-
*/
|
|
1812
|
-
readonly styles?: ComposableStyles | ComposableStyles[];
|
|
1813
|
-
/**
|
|
1814
|
-
* The custom attributes of the custom element.
|
|
1815
|
-
*/
|
|
1816
|
-
readonly attributes?: (AttributeConfiguration | string)[];
|
|
1817
|
-
/**
|
|
1818
|
-
* Options controlling the creation of the custom element's shadow DOM.
|
|
1819
|
-
* @remarks
|
|
1820
|
-
* If not provided, defaults to an open shadow root. Provide null
|
|
1821
|
-
* to render to the associated template to the light DOM instead.
|
|
1822
|
-
*/
|
|
1823
|
-
readonly shadowOptions?: Partial<ShadowRootOptions> | null;
|
|
1824
|
-
/**
|
|
1825
|
-
* Options controlling how the custom element is defined with the platform.
|
|
1826
|
-
*/
|
|
1827
|
-
readonly elementOptions?: ElementDefinitionOptions;
|
|
1828
|
-
/**
|
|
1829
|
-
* The registry to register this component in by default.
|
|
1830
|
-
* @remarks
|
|
1831
|
-
* If not provided, defaults to the global registry.
|
|
1832
|
-
*/
|
|
1833
|
-
readonly registry?: CustomElementRegistry;
|
|
1834
|
-
}
|
|
1835
|
-
|
|
1836
|
-
/**
|
|
1837
|
-
* Represents metadata configuration for an HTMLDirective.
|
|
1838
|
-
* @public
|
|
1839
|
-
*/
|
|
1840
|
-
export declare interface PartialHTMLDirectiveDefinition {
|
|
1841
|
-
/**
|
|
1842
|
-
* Indicates whether the directive needs access to template contextual information
|
|
1843
|
-
* such as the sourceAspect, targetAspect, and aspectType.
|
|
1844
|
-
*/
|
|
1845
|
-
aspected?: boolean;
|
|
1846
|
-
}
|
|
1847
|
-
|
|
1848
|
-
/**
|
|
1849
|
-
* An implementation of Notifier that allows subscribers to be notified
|
|
1850
|
-
* of individual property changes on an object.
|
|
1851
|
-
* @public
|
|
1852
|
-
*/
|
|
1853
|
-
export declare class PropertyChangeNotifier implements Notifier {
|
|
1854
|
-
private subscribers;
|
|
1855
|
-
private subjectSubscribers;
|
|
1856
|
-
/**
|
|
1857
|
-
* The subject that property changes are being notified for.
|
|
1858
|
-
*/
|
|
1859
|
-
readonly subject: any;
|
|
1860
|
-
/**
|
|
1861
|
-
* Creates an instance of PropertyChangeNotifier for the specified subject.
|
|
1862
|
-
* @param subject - The object that subscribers will receive notifications for.
|
|
1863
|
-
*/
|
|
1864
|
-
constructor(subject: any);
|
|
1865
|
-
/**
|
|
1866
|
-
* Notifies all subscribers, based on the specified property.
|
|
1867
|
-
* @param propertyName - The property name, passed along to subscribers during notification.
|
|
1868
|
-
*/
|
|
1869
|
-
notify(propertyName: string): void;
|
|
1870
|
-
/**
|
|
1871
|
-
* Subscribes to notification of changes in an object's state.
|
|
1872
|
-
* @param subscriber - The object that is subscribing for change notification.
|
|
1873
|
-
* @param propertyToWatch - The name of the property that the subscriber is interested in watching for changes.
|
|
1874
|
-
*/
|
|
1875
|
-
subscribe(subscriber: Subscriber, propertyToWatch?: string): void;
|
|
1876
|
-
/**
|
|
1877
|
-
* Unsubscribes from notification of changes in an object's state.
|
|
1878
|
-
* @param subscriber - The object that is unsubscribing from change notification.
|
|
1879
|
-
* @param propertyToUnwatch - The name of the property that the subscriber is no longer interested in watching.
|
|
1880
|
-
*/
|
|
1881
|
-
unsubscribe(subscriber: Subscriber, propertyToUnwatch?: string): void;
|
|
1882
|
-
}
|
|
1883
|
-
|
|
1884
|
-
/**
|
|
1885
|
-
* A directive that observes the updates a property with a reference to the element.
|
|
1886
|
-
* @param propertyName - The name of the property to assign the reference to.
|
|
1887
|
-
* @public
|
|
1888
|
-
*/
|
|
1889
|
-
export declare const ref: <TSource = any, TParent = any>(propertyName: keyof TSource & string) => CaptureType<TSource, TParent>;
|
|
1890
|
-
|
|
1891
|
-
/**
|
|
1892
|
-
* The runtime behavior for template references.
|
|
1893
|
-
* @public
|
|
1894
|
-
*/
|
|
1895
|
-
export declare class RefDirective extends StatelessAttachedAttributeDirective<string> {
|
|
1896
|
-
/**
|
|
1897
|
-
* Bind this behavior.
|
|
1898
|
-
* @param controller - The view controller that manages the lifecycle of this behavior.
|
|
1899
|
-
*/
|
|
1900
|
-
bind(controller: ViewController): void;
|
|
1901
|
-
}
|
|
1902
|
-
|
|
1903
|
-
declare const reflectMode = "reflect";
|
|
1904
|
-
|
|
1905
|
-
/**
|
|
1906
|
-
* A directive that enables list rendering.
|
|
1907
|
-
* @param items - The array to render.
|
|
1908
|
-
* @param template - The template or a template binding used obtain a template
|
|
1909
|
-
* to render for each item in the array.
|
|
1910
|
-
* @param options - Options used to turn on special repeat features.
|
|
1911
|
-
* @public
|
|
1912
|
-
*/
|
|
1913
|
-
export declare function repeat<TSource = any, TArray extends ReadonlyArray<any> = ReadonlyArray<any>, TParent = any>(items: Expression<TSource, TArray, TParent> | Binding<TSource, TArray, TParent> | ReadonlyArray<any>, template: Expression<TSource, ViewTemplate<any, TSource>> | Binding<TSource, ViewTemplate<any, TSource>> | ViewTemplate<any, TSource>, options?: RepeatOptions): CaptureType<TSource, TParent>;
|
|
1914
|
-
|
|
1915
|
-
/**
|
|
1916
|
-
* A behavior that renders a template for each item in an array.
|
|
1917
|
-
* @public
|
|
1918
|
-
*/
|
|
1919
|
-
export declare class RepeatBehavior<TSource = any> implements ViewBehavior, Subscriber {
|
|
1920
|
-
private directive;
|
|
1921
|
-
private location;
|
|
1922
|
-
private controller;
|
|
1923
|
-
private views;
|
|
1924
|
-
private template;
|
|
1925
|
-
private templateBindingObserver;
|
|
1926
|
-
private items;
|
|
1927
|
-
private itemsObserver;
|
|
1928
|
-
private itemsBindingObserver;
|
|
1929
|
-
private bindView;
|
|
1930
|
-
/**
|
|
1931
|
-
* Creates an instance of RepeatBehavior.
|
|
1932
|
-
* @param location - The location in the DOM to render the repeat.
|
|
1933
|
-
* @param dataBinding - The array to render.
|
|
1934
|
-
* @param isItemsBindingVolatile - Indicates whether the items binding has volatile dependencies.
|
|
1935
|
-
* @param templateBinding - The template to render for each item.
|
|
1936
|
-
* @param isTemplateBindingVolatile - Indicates whether the template binding has volatile dependencies.
|
|
1937
|
-
* @param options - Options used to turn on special repeat features.
|
|
1938
|
-
*/
|
|
1939
|
-
constructor(directive: RepeatDirective);
|
|
1940
|
-
/**
|
|
1941
|
-
* Bind this behavior.
|
|
1942
|
-
* @param controller - The view controller that manages the lifecycle of this behavior.
|
|
1943
|
-
*/
|
|
1944
|
-
bind(controller: ViewController): void;
|
|
1945
|
-
/**
|
|
1946
|
-
* Unbinds this behavior.
|
|
1947
|
-
*/
|
|
1948
|
-
unbind(): void;
|
|
1949
|
-
/**
|
|
1950
|
-
* Handles changes in the array, its items, and the repeat template.
|
|
1951
|
-
* @param source - The source of the change.
|
|
1952
|
-
* @param args - The details about what was changed.
|
|
1953
|
-
*/
|
|
1954
|
-
handleChange(source: any, args: Splice[] | ExpressionObserver): void;
|
|
1955
|
-
private observeItems;
|
|
1956
|
-
private updateViews;
|
|
1957
|
-
private refreshAllViews;
|
|
1958
|
-
private unbindAllViews;
|
|
1959
|
-
}
|
|
1960
|
-
|
|
1961
|
-
/**
|
|
1962
|
-
* A directive that configures list rendering.
|
|
1963
|
-
* @public
|
|
1964
|
-
*/
|
|
1965
|
-
export declare class RepeatDirective<TSource = any> implements HTMLDirective, ViewBehaviorFactory {
|
|
1966
|
-
readonly dataBinding: Binding<TSource>;
|
|
1967
|
-
readonly templateBinding: Binding<TSource, SyntheticViewTemplate>;
|
|
1968
|
-
readonly options: RepeatOptions;
|
|
1969
|
-
/**
|
|
1970
|
-
* The unique id of the factory.
|
|
1971
|
-
*/
|
|
1972
|
-
id: string;
|
|
1973
|
-
/**
|
|
1974
|
-
* The structural id of the DOM node to which the created behavior will apply.
|
|
1975
|
-
*/
|
|
1976
|
-
nodeId: string;
|
|
1977
|
-
/**
|
|
1978
|
-
* Creates a placeholder string based on the directive's index within the template.
|
|
1979
|
-
* @param index - The index of the directive within the template.
|
|
1980
|
-
*/
|
|
1981
|
-
createHTML(add: AddViewBehaviorFactory): string;
|
|
1982
|
-
/**
|
|
1983
|
-
* Creates an instance of RepeatDirective.
|
|
1984
|
-
* @param dataBinding - The binding that provides the array to render.
|
|
1985
|
-
* @param templateBinding - The template binding used to obtain a template to render for each item in the array.
|
|
1986
|
-
* @param options - Options used to turn on special repeat features.
|
|
1987
|
-
*/
|
|
1988
|
-
constructor(dataBinding: Binding<TSource>, templateBinding: Binding<TSource, SyntheticViewTemplate>, options: RepeatOptions);
|
|
1989
|
-
/**
|
|
1990
|
-
* Creates a behavior for the provided target node.
|
|
1991
|
-
* @param target - The node instance to create the behavior for.
|
|
1992
|
-
*/
|
|
1993
|
-
createBehavior(): RepeatBehavior<TSource>;
|
|
1994
|
-
}
|
|
1995
|
-
|
|
1996
|
-
/**
|
|
1997
|
-
* Options for configuring repeat behavior.
|
|
1998
|
-
* @public
|
|
1999
|
-
*/
|
|
2000
|
-
export declare interface RepeatOptions {
|
|
2001
|
-
/**
|
|
2002
|
-
* Enables index, length, and dependent positioning updates in item templates.
|
|
2003
|
-
*/
|
|
2004
|
-
positioning?: boolean;
|
|
2005
|
-
/**
|
|
2006
|
-
* Enables view recycling
|
|
2007
|
-
*/
|
|
2008
|
-
recycle?: boolean;
|
|
2009
|
-
}
|
|
2010
|
-
|
|
2011
|
-
/**
|
|
2012
|
-
* Shadow root initialization options.
|
|
2013
|
-
* @public
|
|
2014
|
-
*/
|
|
2015
|
-
export declare interface ShadowRootOptions extends ShadowRootInit {
|
|
2016
|
-
/**
|
|
2017
|
-
* A registry that provides the custom elements visible
|
|
2018
|
-
* from within this shadow root.
|
|
2019
|
-
* @beta
|
|
2020
|
-
*/
|
|
2021
|
-
registry?: CustomElementRegistry;
|
|
2022
|
-
}
|
|
2023
|
-
|
|
2024
|
-
/**
|
|
2025
|
-
* A directive that observes the `assignedNodes()` of a slot and updates a property
|
|
2026
|
-
* whenever they change.
|
|
2027
|
-
* @param propertyOrOptions - The options used to configure slotted node observation.
|
|
2028
|
-
* @public
|
|
2029
|
-
*/
|
|
2030
|
-
export declare function slotted<TSource = any, TParent = any>(propertyOrOptions: (keyof TSource & string) | SlottedDirectiveOptions<keyof TSource & string>): CaptureType<TSource, TParent>;
|
|
2031
|
-
|
|
2032
|
-
/**
|
|
2033
|
-
* The runtime behavior for slotted node observation.
|
|
2034
|
-
* @public
|
|
2035
|
-
*/
|
|
2036
|
-
export declare class SlottedDirective extends NodeObservationDirective<SlottedDirectiveOptions> {
|
|
2037
|
-
/**
|
|
2038
|
-
* Begins observation of the nodes.
|
|
2039
|
-
* @param target - The target to observe.
|
|
2040
|
-
*/
|
|
2041
|
-
observe(target: EventSource): void;
|
|
2042
|
-
/**
|
|
2043
|
-
* Disconnects observation of the nodes.
|
|
2044
|
-
* @param target - The target to unobserve.
|
|
2045
|
-
*/
|
|
2046
|
-
disconnect(target: EventSource): void;
|
|
2047
|
-
/**
|
|
2048
|
-
* Retrieves the raw nodes that should be assigned to the source property.
|
|
2049
|
-
* @param target - The target to get the node to.
|
|
2050
|
-
*/
|
|
2051
|
-
getNodes(target: HTMLSlotElement): Node[];
|
|
2052
|
-
/* Excluded from this release type: handleEvent */
|
|
2053
|
-
}
|
|
2054
|
-
|
|
2055
|
-
/**
|
|
2056
|
-
* The options used to configure slotted node observation.
|
|
2057
|
-
* @public
|
|
2058
|
-
*/
|
|
2059
|
-
export declare interface SlottedDirectiveOptions<T = any> extends NodeBehaviorOptions<T>, AssignedNodesOptions {
|
|
2060
|
-
}
|
|
2061
|
-
|
|
2062
|
-
/**
|
|
2063
|
-
* Describes how the source's lifetime relates to its controller's lifetime.
|
|
2064
|
-
* @public
|
|
2065
|
-
*/
|
|
2066
|
-
export declare const SourceLifetime: Readonly<{
|
|
2067
|
-
/**
|
|
2068
|
-
* The source to controller lifetime relationship is unknown.
|
|
2069
|
-
*/
|
|
2070
|
-
readonly unknown: undefined;
|
|
2071
|
-
/**
|
|
2072
|
-
* The source and controller lifetimes are coupled to one another.
|
|
2073
|
-
* They can/will be GC'd together.
|
|
2074
|
-
*/
|
|
2075
|
-
readonly coupled: 1;
|
|
2076
|
-
}>;
|
|
2077
|
-
|
|
2078
|
-
/**
|
|
2079
|
-
* Describes how the source's lifetime relates to its controller's lifetime.
|
|
2080
|
-
* @public
|
|
2081
|
-
*/
|
|
2082
|
-
export declare type SourceLifetime = typeof SourceLifetime[keyof typeof SourceLifetime];
|
|
2083
|
-
|
|
2084
|
-
/**
|
|
2085
|
-
* A splice map is a representation of how a previous array of items
|
|
2086
|
-
* was transformed into a new array of items. Conceptually it is a list of
|
|
2087
|
-
* tuples of
|
|
2088
|
-
*
|
|
2089
|
-
* (index, removed, addedCount)
|
|
2090
|
-
*
|
|
2091
|
-
* which are kept in ascending index order of. The tuple represents that at
|
|
2092
|
-
* the |index|, |removed| sequence of items were removed, and counting forward
|
|
2093
|
-
* from |index|, |addedCount| items were added.
|
|
2094
|
-
* @public
|
|
2095
|
-
*/
|
|
2096
|
-
export declare class Splice {
|
|
2097
|
-
index: number;
|
|
2098
|
-
removed: any[];
|
|
2099
|
-
addedCount: number;
|
|
2100
|
-
/**
|
|
2101
|
-
* Indicates that this splice represents a complete array reset.
|
|
2102
|
-
*/
|
|
2103
|
-
reset?: boolean;
|
|
2104
|
-
/**
|
|
2105
|
-
* Creates a splice.
|
|
2106
|
-
* @param index - The index that the splice occurs at.
|
|
2107
|
-
* @param removed - The items that were removed.
|
|
2108
|
-
* @param addedCount - The number of items that were added.
|
|
2109
|
-
*/
|
|
2110
|
-
constructor(index: number, removed: any[], addedCount: number);
|
|
2111
|
-
/**
|
|
2112
|
-
* Adjusts the splice index based on the provided array.
|
|
2113
|
-
* @param array - The array to adjust to.
|
|
2114
|
-
* @returns The same splice, mutated based on the reference array.
|
|
2115
|
-
*/
|
|
2116
|
-
adjustTo(array: any[]): this;
|
|
2117
|
-
}
|
|
2118
|
-
|
|
2119
|
-
/**
|
|
2120
|
-
* An approach to tracking changes in an array.
|
|
2121
|
-
* @public
|
|
2122
|
-
*/
|
|
2123
|
-
export declare interface SpliceStrategy {
|
|
2124
|
-
/**
|
|
2125
|
-
* The level of feature support the splice strategy provides.
|
|
2126
|
-
*/
|
|
2127
|
-
readonly support: SpliceStrategySupport;
|
|
2128
|
-
/**
|
|
2129
|
-
* Normalizes the splices before delivery to array change subscribers.
|
|
2130
|
-
* @param previous - The previous version of the array if a reset has taken place.
|
|
2131
|
-
* @param current - The current version of the array.
|
|
2132
|
-
* @param changes - The set of changes tracked against the array.
|
|
2133
|
-
*/
|
|
2134
|
-
normalize(previous: unknown[] | undefined, current: unknown[], changes: Splice[] | undefined): readonly Splice[];
|
|
2135
|
-
/**
|
|
2136
|
-
* Performs and tracks a pop operation on an array.
|
|
2137
|
-
* @param array - The array to track the change for.
|
|
2138
|
-
* @param observer - The observer to register the change with.
|
|
2139
|
-
* @param pop - The operation to perform.
|
|
2140
|
-
* @param args - The arguments for the operation.
|
|
2141
|
-
*/
|
|
2142
|
-
pop(array: any[], observer: ArrayObserver, pop: typeof Array.prototype.pop, args: any[]): any;
|
|
2143
|
-
/**
|
|
2144
|
-
* Performs and tracks a push operation on an array.
|
|
2145
|
-
* @param array - The array to track the change for.
|
|
2146
|
-
* @param observer - The observer to register the change with.
|
|
2147
|
-
* @param push - The operation to perform.
|
|
2148
|
-
* @param args - The arguments for the operation.
|
|
2149
|
-
*/
|
|
2150
|
-
push(array: any[], observer: ArrayObserver, push: typeof Array.prototype.push, args: any[]): any;
|
|
2151
|
-
/**
|
|
2152
|
-
* Performs and tracks a reverse operation on an array.
|
|
2153
|
-
* @param array - The array to track the change for.
|
|
2154
|
-
* @param observer - The observer to register the change with.
|
|
2155
|
-
* @param reverse - The operation to perform.
|
|
2156
|
-
* @param args - The arguments for the operation.
|
|
2157
|
-
*/
|
|
2158
|
-
reverse(array: any[], observer: ArrayObserver, reverse: typeof Array.prototype.reverse, args: any[]): any;
|
|
2159
|
-
/**
|
|
2160
|
-
* Performs and tracks a shift operation on an array.
|
|
2161
|
-
* @param array - The array to track the change for.
|
|
2162
|
-
* @param observer - The observer to register the change with.
|
|
2163
|
-
* @param shift - The operation to perform.
|
|
2164
|
-
* @param args - The arguments for the operation.
|
|
2165
|
-
*/
|
|
2166
|
-
shift(array: any[], observer: ArrayObserver, shift: typeof Array.prototype.shift, args: any[]): any;
|
|
2167
|
-
/**
|
|
2168
|
-
* Performs and tracks a sort operation on an array.
|
|
2169
|
-
* @param array - The array to track the change for.
|
|
2170
|
-
* @param observer - The observer to register the change with.
|
|
2171
|
-
* @param sort - The operation to perform.
|
|
2172
|
-
* @param args - The arguments for the operation.
|
|
2173
|
-
*/
|
|
2174
|
-
sort(array: any[], observer: ArrayObserver, sort: typeof Array.prototype.sort, args: any[]): any[];
|
|
2175
|
-
/**
|
|
2176
|
-
* Performs and tracks a splice operation on an array.
|
|
2177
|
-
* @param array - The array to track the change for.
|
|
2178
|
-
* @param observer - The observer to register the change with.
|
|
2179
|
-
* @param splice - The operation to perform.
|
|
2180
|
-
* @param args - The arguments for the operation.
|
|
2181
|
-
*/
|
|
2182
|
-
splice(array: any[], observer: ArrayObserver, splice: typeof Array.prototype.splice, args: any[]): any;
|
|
2183
|
-
/**
|
|
2184
|
-
* Performs and tracks an unshift operation on an array.
|
|
2185
|
-
* @param array - The array to track the change for.
|
|
2186
|
-
* @param observer - The observer to register the change with.
|
|
2187
|
-
* @param unshift - The operation to perform.
|
|
2188
|
-
* @param args - The arguments for the operation.
|
|
2189
|
-
*/
|
|
2190
|
-
unshift(array: any[], observer: ArrayObserver, unshift: typeof Array.prototype.unshift, args: any[]): any[];
|
|
2191
|
-
}
|
|
2192
|
-
|
|
2193
|
-
/**
|
|
2194
|
-
* Functionality related to tracking changes in arrays.
|
|
2195
|
-
* @public
|
|
2196
|
-
*/
|
|
2197
|
-
export declare const SpliceStrategy: Readonly<{
|
|
2198
|
-
/**
|
|
2199
|
-
* A set of changes that represent a full array reset.
|
|
2200
|
-
*/
|
|
2201
|
-
readonly reset: Splice[];
|
|
2202
|
-
/**
|
|
2203
|
-
* Sets the default strategy to use for array observers.
|
|
2204
|
-
* @param strategy - The splice strategy to use.
|
|
2205
|
-
*/
|
|
2206
|
-
readonly setDefaultStrategy: (strategy: SpliceStrategy) => void;
|
|
2207
|
-
}>;
|
|
2208
|
-
|
|
2209
|
-
/**
|
|
2210
|
-
* Indicates what level of feature support the splice
|
|
2211
|
-
* strategy provides.
|
|
2212
|
-
* @public
|
|
2213
|
-
*/
|
|
2214
|
-
export declare const SpliceStrategySupport: Readonly<{
|
|
2215
|
-
/**
|
|
2216
|
-
* Only supports resets.
|
|
2217
|
-
*/
|
|
2218
|
-
readonly reset: 1;
|
|
2219
|
-
/**
|
|
2220
|
-
* Supports tracking splices and resets.
|
|
2221
|
-
*/
|
|
2222
|
-
readonly splice: 2;
|
|
2223
|
-
/**
|
|
2224
|
-
* Supports tracking splices and resets, while applying some form
|
|
2225
|
-
* of optimization, such as merging, to the splices.
|
|
2226
|
-
*/
|
|
2227
|
-
readonly optimized: 3;
|
|
2228
|
-
}>;
|
|
2229
|
-
|
|
2230
|
-
/**
|
|
2231
|
-
* The available values for SpliceStrategySupport.
|
|
2232
|
-
* @public
|
|
2233
|
-
*/
|
|
2234
|
-
export declare type SpliceStrategySupport = typeof SpliceStrategySupport[keyof typeof SpliceStrategySupport];
|
|
2235
|
-
|
|
2236
|
-
/**
|
|
2237
|
-
* A base class used for attribute directives that don't need internal state.
|
|
2238
|
-
* @public
|
|
2239
|
-
*/
|
|
2240
|
-
export declare abstract class StatelessAttachedAttributeDirective<TOptions> implements HTMLDirective, ViewBehaviorFactory, ViewBehavior {
|
|
2241
|
-
protected options: TOptions;
|
|
2242
|
-
/**
|
|
2243
|
-
* The unique id of the factory.
|
|
2244
|
-
*/
|
|
2245
|
-
id: string;
|
|
2246
|
-
/**
|
|
2247
|
-
* The structural id of the DOM node to which the created behavior will apply.
|
|
2248
|
-
*/
|
|
2249
|
-
nodeId: string;
|
|
2250
|
-
/**
|
|
2251
|
-
* Creates an instance of RefDirective.
|
|
2252
|
-
* @param options - The options to use in configuring the directive.
|
|
2253
|
-
*/
|
|
2254
|
-
constructor(options: TOptions);
|
|
2255
|
-
/**
|
|
2256
|
-
* Creates a placeholder string based on the directive's index within the template.
|
|
2257
|
-
* @param index - The index of the directive within the template.
|
|
2258
|
-
* @remarks
|
|
2259
|
-
* Creates a custom attribute placeholder.
|
|
2260
|
-
*/
|
|
2261
|
-
createHTML(add: AddViewBehaviorFactory): string;
|
|
2262
|
-
/**
|
|
2263
|
-
* Creates a behavior.
|
|
2264
|
-
* @param targets - The targets available for behaviors to be attached to.
|
|
2265
|
-
*/
|
|
2266
|
-
createBehavior(): ViewBehavior;
|
|
2267
|
-
/**
|
|
2268
|
-
* Bind this behavior.
|
|
2269
|
-
* @param controller - The view controller that manages the lifecycle of this behavior.
|
|
2270
|
-
*/
|
|
2271
|
-
abstract bind(controller: ViewController): void;
|
|
2272
|
-
}
|
|
2273
|
-
|
|
2274
|
-
/**
|
|
2275
|
-
* Implemented to provide specific behavior when adding/removing styles
|
|
2276
|
-
* for elements.
|
|
2277
|
-
* @public
|
|
2278
|
-
*/
|
|
2279
|
-
export declare interface StyleStrategy {
|
|
2280
|
-
/**
|
|
2281
|
-
* Adds styles to the target.
|
|
2282
|
-
* @param target - The target to add the styles to.
|
|
2283
|
-
*/
|
|
2284
|
-
addStylesTo(target: StyleTarget): void;
|
|
2285
|
-
/**
|
|
2286
|
-
* Removes styles from the target.
|
|
2287
|
-
* @param target - The target to remove the styles from.
|
|
2288
|
-
*/
|
|
2289
|
-
removeStylesFrom(target: StyleTarget): void;
|
|
2290
|
-
}
|
|
2291
|
-
|
|
2292
|
-
/**
|
|
2293
|
-
* A node that can be targeted by styles.
|
|
2294
|
-
* @public
|
|
2295
|
-
*/
|
|
2296
|
-
export declare interface StyleTarget {
|
|
2297
|
-
/**
|
|
2298
|
-
* Stylesheets to be adopted by the node.
|
|
2299
|
-
*/
|
|
2300
|
-
adoptedStyleSheets?: CSSStyleSheet[];
|
|
2301
|
-
/**
|
|
2302
|
-
* Adds styles to the target by appending the styles.
|
|
2303
|
-
* @param styles - The styles element to add.
|
|
2304
|
-
*/
|
|
2305
|
-
append(styles: HTMLStyleElement): void;
|
|
2306
|
-
/**
|
|
2307
|
-
* Removes styles from the target.
|
|
2308
|
-
* @param styles - The styles element to remove.
|
|
2309
|
-
*/
|
|
2310
|
-
removeChild(styles: HTMLStyleElement): void;
|
|
2311
|
-
/**
|
|
2312
|
-
* Returns all element descendants of node that match selectors.
|
|
2313
|
-
* @param selectors - The CSS selector to use for the query.
|
|
2314
|
-
*/
|
|
2315
|
-
querySelectorAll<E extends Element = Element>(selectors: string): NodeListOf<E>;
|
|
2316
|
-
}
|
|
2317
|
-
|
|
2318
|
-
/**
|
|
2319
|
-
* Implemented by objects that are interested in change notifications.
|
|
2320
|
-
* @public
|
|
2321
|
-
*/
|
|
2322
|
-
export declare interface Subscriber {
|
|
2323
|
-
/**
|
|
2324
|
-
* Called when a subject this instance has subscribed to changes.
|
|
2325
|
-
* @param subject - The subject of the change.
|
|
2326
|
-
* @param args - The event args detailing the change that occurred.
|
|
2327
|
-
*/
|
|
2328
|
-
handleChange(subject: any, args: any): void;
|
|
2329
|
-
}
|
|
2330
|
-
|
|
2331
|
-
/**
|
|
2332
|
-
* An implementation of {@link Notifier} that efficiently keeps track of
|
|
2333
|
-
* subscribers interested in a specific change notification on an
|
|
2334
|
-
* observable subject.
|
|
1049
|
+
* Registers the `target` class as a singleton dependency; the class will only be created once. Each
|
|
1050
|
+
* consecutive time the dependency is resolved, the same instance will be returned.
|
|
1051
|
+
*
|
|
1052
|
+
* @param target - The class / constructor function to register as a singleton.
|
|
1053
|
+
*
|
|
1054
|
+
* @example
|
|
1055
|
+
* ```ts
|
|
1056
|
+
* @singleton()
|
|
1057
|
+
* class Foo { }
|
|
1058
|
+
* ```
|
|
2335
1059
|
*
|
|
2336
|
-
* @remarks
|
|
2337
|
-
* This set is optimized for the most common scenario of 1 or 2 subscribers.
|
|
2338
|
-
* With this in mind, it can store a subscriber in an internal field, allowing it to avoid Array#push operations.
|
|
2339
|
-
* If the set ever exceeds two subscribers, it upgrades to an array automatically.
|
|
2340
|
-
* @public
|
|
2341
|
-
*/
|
|
2342
|
-
export declare class SubscriberSet implements Notifier {
|
|
2343
|
-
private sub1;
|
|
2344
|
-
private sub2;
|
|
2345
|
-
private spillover;
|
|
2346
|
-
/**
|
|
2347
|
-
* The object that subscribers will receive notifications for.
|
|
2348
|
-
*/
|
|
2349
|
-
readonly subject: any;
|
|
2350
|
-
/**
|
|
2351
|
-
* Creates an instance of SubscriberSet for the specified subject.
|
|
2352
|
-
* @param subject - The subject that subscribers will receive notifications from.
|
|
2353
|
-
* @param initialSubscriber - An initial subscriber to changes.
|
|
2354
|
-
*/
|
|
2355
|
-
constructor(subject: any, initialSubscriber?: Subscriber);
|
|
2356
|
-
/**
|
|
2357
|
-
* Checks whether the provided subscriber has been added to this set.
|
|
2358
|
-
* @param subscriber - The subscriber to test for inclusion in this set.
|
|
2359
|
-
*/
|
|
2360
|
-
has(subscriber: Subscriber): boolean;
|
|
2361
|
-
/**
|
|
2362
|
-
* Subscribes to notification of changes in an object's state.
|
|
2363
|
-
* @param subscriber - The object that is subscribing for change notification.
|
|
2364
|
-
*/
|
|
2365
|
-
subscribe(subscriber: Subscriber): void;
|
|
2366
|
-
/**
|
|
2367
|
-
* Unsubscribes from notification of changes in an object's state.
|
|
2368
|
-
* @param subscriber - The object that is unsubscribing from change notification.
|
|
2369
|
-
*/
|
|
2370
|
-
unsubscribe(subscriber: Subscriber): void;
|
|
2371
|
-
/**
|
|
2372
|
-
* Notifies all subscribers.
|
|
2373
|
-
* @param args - Data passed along to subscribers during notification.
|
|
2374
|
-
*/
|
|
2375
|
-
notify(args: any): void;
|
|
2376
|
-
}
|
|
2377
|
-
|
|
2378
|
-
/**
|
|
2379
|
-
* The options used to configure subtree observation.
|
|
2380
|
-
* @public
|
|
2381
|
-
*/
|
|
2382
|
-
export declare interface SubtreeDirectiveOptions<T = any> extends NodeBehaviorOptions<T>, Omit<MutationObserverInit, "subtree" | "childList"> {
|
|
2383
|
-
/**
|
|
2384
|
-
* Indicates that child subtrees should be observed for changes.
|
|
2385
|
-
*/
|
|
2386
|
-
subtree: boolean;
|
|
2387
|
-
/**
|
|
2388
|
-
* When subtrees are observed, a query selector is required to indicate
|
|
2389
|
-
* which of potentially many nodes should be assigned to the property.
|
|
2390
|
-
*/
|
|
2391
|
-
selector: string;
|
|
2392
|
-
}
|
|
2393
|
-
|
|
2394
|
-
/**
|
|
2395
|
-
* A view representing a range of DOM nodes which can be added/removed ad hoc.
|
|
2396
|
-
* @public
|
|
2397
|
-
*/
|
|
2398
|
-
export declare interface SyntheticView<TSource = any, TParent = any> extends View<TSource, TParent> {
|
|
2399
|
-
/**
|
|
2400
|
-
* The first DOM node in the range of nodes that make up the view.
|
|
2401
|
-
*/
|
|
2402
|
-
readonly firstChild: Node;
|
|
2403
|
-
/**
|
|
2404
|
-
* The last DOM node in the range of nodes that make up the view.
|
|
2405
|
-
*/
|
|
2406
|
-
readonly lastChild: Node;
|
|
2407
|
-
/**
|
|
2408
|
-
* Inserts the view's DOM nodes before the referenced node.
|
|
2409
|
-
* @param node - The node to insert the view's DOM before.
|
|
2410
|
-
*/
|
|
2411
|
-
insertBefore(node: Node): void;
|
|
2412
|
-
/**
|
|
2413
|
-
* Removes the view's DOM nodes.
|
|
2414
|
-
* The nodes are not disposed and the view can later be re-inserted.
|
|
2415
|
-
*/
|
|
2416
|
-
remove(): void;
|
|
2417
|
-
}
|
|
2418
|
-
|
|
2419
|
-
/**
|
|
2420
|
-
* A template capable of rendering views not specifically connected to custom elements.
|
|
2421
|
-
* @public
|
|
2422
|
-
*/
|
|
2423
|
-
export declare interface SyntheticViewTemplate<TSource = any, TParent = any> {
|
|
2424
|
-
/**
|
|
2425
|
-
* Creates a SyntheticView instance based on this template definition.
|
|
2426
|
-
*/
|
|
2427
|
-
create(): SyntheticView<TSource, TParent>;
|
|
2428
|
-
}
|
|
2429
|
-
|
|
2430
|
-
/**
|
|
2431
|
-
* Represents the types of values that can be interpolated into a template.
|
|
2432
1060
|
* @public
|
|
2433
1061
|
*/
|
|
2434
|
-
export declare
|
|
1062
|
+
export declare function singleton<T extends Constructable>(target: T & Partial<RegisterSelf<T>>): T & RegisterSelf<T>;
|
|
2435
1063
|
|
|
2436
|
-
|
|
2437
|
-
* Enables working with trusted types.
|
|
2438
|
-
* @public
|
|
2439
|
-
*/
|
|
2440
|
-
export declare type TrustedTypes = {
|
|
2441
|
-
/**
|
|
2442
|
-
* Creates a trusted types policy.
|
|
2443
|
-
* @param name - The policy name.
|
|
2444
|
-
* @param rules - The policy rules implementation.
|
|
2445
|
-
*/
|
|
2446
|
-
createPolicy(name: string, rules: TrustedTypesPolicy): TrustedTypesPolicy;
|
|
2447
|
-
};
|
|
1064
|
+
declare function singletonDecorator<T extends Constructable>(target: T & Partial<RegisterSelf<T>>): T & RegisterSelf<T>;
|
|
2448
1065
|
|
|
2449
|
-
|
|
2450
|
-
|
|
2451
|
-
* @public
|
|
2452
|
-
*/
|
|
2453
|
-
export declare type TrustedTypesPolicy = {
|
|
2454
|
-
/**
|
|
2455
|
-
* Creates trusted HTML.
|
|
2456
|
-
* @param html - The HTML to clear as trustworthy.
|
|
2457
|
-
*/
|
|
2458
|
-
createHTML(html: string): string;
|
|
1066
|
+
declare type SingletonOptions = {
|
|
1067
|
+
scoped: boolean;
|
|
2459
1068
|
};
|
|
2460
1069
|
|
|
2461
|
-
/* Excluded from this release type: TypeDefinition */
|
|
2462
|
-
|
|
2463
|
-
/* Excluded from this release type: TypeRegistry */
|
|
2464
|
-
|
|
2465
|
-
/**
|
|
2466
|
-
* A work queue used to synchronize writes to the DOM.
|
|
2467
|
-
* @public
|
|
2468
|
-
*/
|
|
2469
|
-
export declare interface UpdateQueue {
|
|
2470
|
-
/**
|
|
2471
|
-
* Schedules DOM update work in the next batch.
|
|
2472
|
-
* @param callable - The callable function or object to queue.
|
|
2473
|
-
*/
|
|
2474
|
-
enqueue(callable: Callable): void;
|
|
2475
|
-
/**
|
|
2476
|
-
* Resolves with the next DOM update.
|
|
2477
|
-
*/
|
|
2478
|
-
next(): Promise<void>;
|
|
2479
|
-
/**
|
|
2480
|
-
* Immediately processes all work previously scheduled
|
|
2481
|
-
* through enqueue.
|
|
2482
|
-
* @remarks
|
|
2483
|
-
* This also forces next() promises
|
|
2484
|
-
* to resolve.
|
|
2485
|
-
*/
|
|
2486
|
-
process(): void;
|
|
2487
|
-
/**
|
|
2488
|
-
* Sets the update mode used by enqueue.
|
|
2489
|
-
* @param isAsync - Indicates whether DOM updates should be asynchronous.
|
|
2490
|
-
* @remarks
|
|
2491
|
-
* By default, the update mode is asynchronous, since that provides the best
|
|
2492
|
-
* performance in the browser. Passing false to setMode will instead cause
|
|
2493
|
-
* the queue to be immediately processed for each call to enqueue. However,
|
|
2494
|
-
* ordering will still be preserved so that nested tasks do not run until
|
|
2495
|
-
* after parent tasks complete.
|
|
2496
|
-
*/
|
|
2497
|
-
setMode(isAsync: boolean): void;
|
|
2498
|
-
}
|
|
2499
|
-
|
|
2500
|
-
/**
|
|
2501
|
-
* The default UpdateQueue.
|
|
2502
|
-
* @public
|
|
2503
|
-
*/
|
|
2504
|
-
export declare const Updates: UpdateQueue;
|
|
2505
|
-
|
|
2506
|
-
/**
|
|
2507
|
-
* Represents objects that can convert values to and from
|
|
2508
|
-
* view or model representations.
|
|
2509
|
-
* @public
|
|
2510
|
-
*/
|
|
2511
|
-
export declare interface ValueConverter {
|
|
2512
|
-
/**
|
|
2513
|
-
* Converts a value from its representation in the model, to a representation for the view.
|
|
2514
|
-
* @param value - The value to convert to a view representation.
|
|
2515
|
-
*/
|
|
2516
|
-
toView(value: any): any;
|
|
2517
|
-
/**
|
|
2518
|
-
* Converts a value from its representation in the view, to a representation for the model.
|
|
2519
|
-
* @param value - The value to convert to a model representation.
|
|
2520
|
-
*/
|
|
2521
|
-
fromView(value: any): any;
|
|
2522
|
-
}
|
|
2523
|
-
|
|
2524
|
-
/**
|
|
2525
|
-
* Represents a collection of DOM nodes which can be bound to a data source.
|
|
2526
|
-
* @public
|
|
2527
|
-
*/
|
|
2528
|
-
export declare interface View<TSource = any, TParent = any> extends Disposable {
|
|
2529
|
-
/**
|
|
2530
|
-
* The execution context the view is running within.
|
|
2531
|
-
*/
|
|
2532
|
-
readonly context: ExecutionContext<TParent>;
|
|
2533
|
-
/**
|
|
2534
|
-
* The data that the view is bound to.
|
|
2535
|
-
*/
|
|
2536
|
-
readonly source: TSource | null;
|
|
2537
|
-
/**
|
|
2538
|
-
* Binds a view's behaviors to its binding source.
|
|
2539
|
-
* @param source - The binding source for the view's binding behaviors.
|
|
2540
|
-
*/
|
|
2541
|
-
bind(source: TSource): void;
|
|
2542
|
-
/**
|
|
2543
|
-
* Unbinds a view's behaviors from its binding source and context.
|
|
2544
|
-
*/
|
|
2545
|
-
unbind(): void;
|
|
2546
|
-
}
|
|
2547
|
-
|
|
2548
|
-
/**
|
|
2549
|
-
* Represents an object that can contribute behavior to a view.
|
|
2550
|
-
* @public
|
|
2551
|
-
*/
|
|
2552
|
-
export declare interface ViewBehavior<TSource = any, TParent = any> {
|
|
2553
|
-
/**
|
|
2554
|
-
* Bind this behavior.
|
|
2555
|
-
* @param controller - The view controller that manages the lifecycle of this behavior.
|
|
2556
|
-
*/
|
|
2557
|
-
bind(controller: ViewController<TSource, TParent>): void;
|
|
2558
|
-
}
|
|
2559
|
-
|
|
2560
|
-
/**
|
|
2561
|
-
* A factory that can create a {@link ViewBehavior} associated with a particular
|
|
2562
|
-
* location within a DOM fragment.
|
|
2563
|
-
* @public
|
|
2564
|
-
*/
|
|
2565
|
-
export declare interface ViewBehaviorFactory {
|
|
2566
|
-
/**
|
|
2567
|
-
* The unique id of the factory.
|
|
2568
|
-
*/
|
|
2569
|
-
id: string;
|
|
2570
|
-
/**
|
|
2571
|
-
* The structural id of the DOM node to which the created behavior will apply.
|
|
2572
|
-
*/
|
|
2573
|
-
nodeId: string;
|
|
2574
|
-
/**
|
|
2575
|
-
* Creates a behavior.
|
|
2576
|
-
*/
|
|
2577
|
-
createBehavior(): ViewBehavior;
|
|
2578
|
-
}
|
|
2579
|
-
|
|
2580
|
-
/**
|
|
2581
|
-
* Bridges between ViewBehaviors and HostBehaviors, enabling a host to
|
|
2582
|
-
* control ViewBehaviors.
|
|
2583
|
-
* @public
|
|
2584
|
-
*/
|
|
2585
|
-
export declare interface ViewBehaviorOrchestrator<TSource = any, TParent = any> extends ViewController<TSource, TParent>, HostBehavior<TSource> {
|
|
2586
|
-
/**
|
|
2587
|
-
*
|
|
2588
|
-
* @param nodeId - The structural id of the DOM node to which a behavior will apply.
|
|
2589
|
-
* @param target - The DOM node associated with the id.
|
|
2590
|
-
*/
|
|
2591
|
-
addTarget(nodeId: string, target: Node): void;
|
|
2592
|
-
/**
|
|
2593
|
-
* Adds a behavior.
|
|
2594
|
-
* @param behavior - The behavior to add.
|
|
2595
|
-
*/
|
|
2596
|
-
addBehavior(behavior: ViewBehavior): void;
|
|
2597
|
-
/**
|
|
2598
|
-
* Adds a behavior factory.
|
|
2599
|
-
* @param factory - The behavior factory to add.
|
|
2600
|
-
* @param target - The target the factory will create behaviors for.
|
|
2601
|
-
*/
|
|
2602
|
-
addBehaviorFactory(factory: ViewBehaviorFactory, target: Node): void;
|
|
2603
|
-
}
|
|
2604
|
-
|
|
2605
1070
|
/**
|
|
2606
|
-
*
|
|
2607
|
-
*
|
|
1071
|
+
* Transforms an object after it is created but before it is returned
|
|
1072
|
+
* to the requestor.
|
|
2608
1073
|
* @public
|
|
2609
1074
|
*/
|
|
2610
|
-
|
|
2611
|
-
|
|
2612
|
-
* Creates a ViewBehaviorOrchestrator.
|
|
2613
|
-
* @param source - The source to to associate behaviors with.
|
|
2614
|
-
* @returns A ViewBehaviorOrchestrator.
|
|
2615
|
-
*/
|
|
2616
|
-
create<TSource = any, TParent = any>(source: TSource): ViewBehaviorOrchestrator<TSource, TParent>;
|
|
2617
|
-
}>;
|
|
1075
|
+
declare type Transformer_2<K> = (instance: Resolved<K>) => Resolved<K>;
|
|
1076
|
+
export { Transformer_2 as Transformer }
|
|
2618
1077
|
|
|
2619
1078
|
/**
|
|
2620
|
-
*
|
|
1079
|
+
* Registers the decorated class as a transient dependency; each time the dependency is resolved
|
|
1080
|
+
* a new instance will be created.
|
|
1081
|
+
*
|
|
1082
|
+
* @example
|
|
1083
|
+
* ```ts
|
|
1084
|
+
* @transient()
|
|
1085
|
+
* class Foo { }
|
|
1086
|
+
* ```
|
|
1087
|
+
*
|
|
2621
1088
|
* @public
|
|
2622
1089
|
*/
|
|
2623
|
-
export declare
|
|
2624
|
-
[id: string]: Node;
|
|
2625
|
-
};
|
|
1090
|
+
export declare function transient<T extends Constructable>(): typeof transientDecorator;
|
|
2626
1091
|
|
|
2627
1092
|
/**
|
|
2628
|
-
*
|
|
1093
|
+
* Registers the `target` class as a transient dependency; each time the dependency is resolved
|
|
1094
|
+
* a new instance will be created.
|
|
1095
|
+
*
|
|
1096
|
+
* @param target - The class / constructor function to register as transient.
|
|
1097
|
+
*
|
|
1098
|
+
* @example
|
|
1099
|
+
* ```ts
|
|
1100
|
+
* @transient()
|
|
1101
|
+
* class Foo { }
|
|
1102
|
+
* ```
|
|
1103
|
+
*
|
|
2629
1104
|
* @public
|
|
2630
1105
|
*/
|
|
2631
|
-
export declare
|
|
2632
|
-
/**
|
|
2633
|
-
* The parts of the view that are targeted by view behaviors.
|
|
2634
|
-
*/
|
|
2635
|
-
readonly targets: ViewBehaviorTargets;
|
|
2636
|
-
}
|
|
1106
|
+
export declare function transient<T extends Constructable>(target: T & Partial<RegisterSelf<T>>): T & RegisterSelf<T>;
|
|
2637
1107
|
|
|
2638
|
-
|
|
2639
|
-
* A template capable of creating HTMLView instances or rendering directly to DOM.
|
|
2640
|
-
* @public
|
|
2641
|
-
*/
|
|
2642
|
-
export declare class ViewTemplate<TSource = any, TParent = any> implements ElementViewTemplate<TSource, TParent>, SyntheticViewTemplate<TSource, TParent> {
|
|
2643
|
-
private result;
|
|
2644
|
-
/**
|
|
2645
|
-
* The html representing what this template will
|
|
2646
|
-
* instantiate, including placeholders for directives.
|
|
2647
|
-
*/
|
|
2648
|
-
readonly html: string | HTMLTemplateElement;
|
|
2649
|
-
/**
|
|
2650
|
-
* The directives that will be connected to placeholders in the html.
|
|
2651
|
-
*/
|
|
2652
|
-
readonly factories: Record<string, ViewBehaviorFactory>;
|
|
2653
|
-
/**
|
|
2654
|
-
* Creates an instance of ViewTemplate.
|
|
2655
|
-
* @param html - The html representing what this template will instantiate, including placeholders for directives.
|
|
2656
|
-
* @param factories - The directives that will be connected to placeholders in the html.
|
|
2657
|
-
*/
|
|
2658
|
-
constructor(html: string | HTMLTemplateElement, factories: Record<string, ViewBehaviorFactory>);
|
|
2659
|
-
/**
|
|
2660
|
-
* Creates an HTMLView instance based on this template definition.
|
|
2661
|
-
* @param hostBindingTarget - The element that host behaviors will be bound to.
|
|
2662
|
-
*/
|
|
2663
|
-
create(hostBindingTarget?: Element): HTMLView<TSource, TParent>;
|
|
2664
|
-
/**
|
|
2665
|
-
* Creates an HTMLView from this template, binds it to the source, and then appends it to the host.
|
|
2666
|
-
* @param source - The data source to bind the template to.
|
|
2667
|
-
* @param host - The Element where the template will be rendered.
|
|
2668
|
-
* @param hostBindingTarget - An HTML element to target the host bindings at if different from the
|
|
2669
|
-
* host that the template is being attached to.
|
|
2670
|
-
*/
|
|
2671
|
-
render(source: TSource, host: Node, hostBindingTarget?: Element): HTMLView<TSource, TParent>;
|
|
2672
|
-
}
|
|
1108
|
+
declare function transientDecorator<T extends Constructable>(target: T & Partial<RegisterSelf<T>>): T & RegisterSelf<T>;
|
|
2673
1109
|
|
|
2674
1110
|
/**
|
|
2675
|
-
*
|
|
2676
|
-
* @param target - The target that the property is defined on.
|
|
2677
|
-
* @param name - The property name.
|
|
2678
|
-
* @param name - The existing descriptor.
|
|
1111
|
+
* An unknown context type.
|
|
2679
1112
|
* @public
|
|
2680
1113
|
*/
|
|
2681
|
-
|
|
1114
|
+
declare type UnknownContext = Context<unknown>;
|
|
2682
1115
|
|
|
2683
|
-
/**
|
|
2684
|
-
|
|
2685
|
-
* @param condition - The condition to test for rendering.
|
|
2686
|
-
* @param templateOrTemplateBinding - The template or a binding that gets
|
|
2687
|
-
* the template to render when the condition is true.
|
|
2688
|
-
* @public
|
|
2689
|
-
*/
|
|
2690
|
-
export declare function when<TSource = any, TReturn = any, TParent = any>(condition: Expression<TSource, TReturn, TParent> | boolean, templateOrTemplateBinding: SyntheticViewTemplate<TSource, TParent> | Expression<TSource, SyntheticViewTemplate<TSource, TParent>, TParent>): CaptureType<TSource, TParent>;
|
|
1116
|
+
/** @internal */
|
|
1117
|
+
export declare function validateKey(key: any): void;
|
|
2691
1118
|
|
|
2692
1119
|
export { }
|