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