@microsoft/fast-element 2.0.0-beta.2 → 2.0.0-beta.21
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/CHANGELOG.json +509 -0
- package/CHANGELOG.md +189 -1
- package/dist/dts/components/attributes.d.ts +15 -0
- package/dist/dts/components/{controller.d.ts → element-controller.d.ts} +74 -28
- package/dist/dts/components/fast-definitions.d.ts +41 -9
- package/dist/dts/components/fast-element.d.ts +14 -26
- package/dist/dts/components/hydration.d.ts +14 -0
- package/dist/{esm/observation/behavior.js → dts/components/install-hydration.d.ts} +0 -0
- package/dist/dts/context.d.ts +7 -7
- package/dist/dts/di/di.d.ts +894 -0
- package/dist/dts/dom-policy.d.ts +83 -0
- package/dist/dts/dom.d.ts +100 -0
- package/dist/dts/index.d.ts +5 -4
- package/dist/dts/index.rollup.d.ts +0 -1
- package/dist/dts/index.rollup.debug.d.ts +0 -1
- package/dist/dts/interfaces.d.ts +62 -80
- package/dist/dts/metadata.d.ts +5 -5
- package/dist/dts/observation/observable.d.ts +99 -54
- package/dist/dts/pending-task.d.ts +32 -0
- package/dist/dts/platform.d.ts +8 -1
- package/dist/dts/polyfills.d.ts +0 -8
- package/dist/dts/state/exports.d.ts +3 -0
- package/dist/dts/state/reactive.d.ts +8 -0
- package/dist/dts/state/state.d.ts +141 -0
- package/dist/dts/state/visitor.d.ts +6 -0
- package/dist/dts/state/watch.d.ts +10 -0
- package/dist/dts/styles/css-directive.d.ts +2 -2
- package/dist/dts/styles/css.d.ts +0 -5
- package/dist/dts/styles/element-styles.d.ts +10 -17
- package/dist/dts/styles/host.d.ts +68 -0
- package/dist/dts/styles/style-strategy.d.ts +42 -0
- package/dist/dts/templating/binding-signal.d.ts +12 -27
- package/dist/dts/templating/binding-two-way.d.ts +22 -37
- package/dist/dts/templating/binding.d.ts +76 -208
- package/dist/dts/templating/children.d.ts +1 -1
- package/dist/dts/templating/compiler.d.ts +11 -13
- package/dist/dts/templating/html-directive.d.ts +91 -97
- package/dist/dts/templating/node-observation.d.ts +15 -6
- package/dist/dts/templating/ref.d.ts +7 -11
- package/dist/dts/templating/render.d.ts +296 -0
- package/dist/dts/templating/repeat.d.ts +23 -34
- package/dist/dts/templating/slotted.d.ts +1 -1
- package/dist/dts/templating/template.d.ts +92 -14
- package/dist/dts/templating/view.d.ts +81 -11
- package/dist/dts/templating/when.d.ts +3 -3
- package/dist/dts/testing/exports.d.ts +3 -0
- package/dist/dts/testing/fakes.d.ts +14 -0
- package/dist/dts/testing/fixture.d.ts +84 -0
- package/dist/dts/testing/timeout.d.ts +7 -0
- package/dist/dts/utilities.d.ts +55 -19
- package/dist/esm/components/attributes.js +28 -5
- package/dist/esm/components/{controller.js → element-controller.js} +238 -137
- package/dist/esm/components/fast-definitions.js +38 -30
- package/dist/esm/components/fast-element.js +27 -16
- package/dist/esm/components/hydration.js +35 -0
- package/dist/esm/components/install-hydration.js +2 -0
- package/dist/esm/context.js +7 -3
- package/dist/esm/debug.js +41 -5
- package/dist/esm/di/di.js +1430 -0
- package/dist/esm/dom-policy.js +345 -0
- package/dist/esm/dom.js +101 -0
- package/dist/esm/index.js +4 -2
- package/dist/esm/index.rollup.debug.js +3 -1
- package/dist/esm/index.rollup.js +3 -1
- package/dist/esm/interfaces.js +52 -0
- package/dist/esm/metadata.js +9 -8
- package/dist/esm/observation/arrays.js +303 -2
- package/dist/esm/observation/observable.js +88 -142
- package/dist/esm/observation/update-queue.js +2 -2
- package/dist/esm/pending-task.js +28 -0
- package/dist/esm/platform.js +28 -3
- package/dist/esm/polyfills.js +3 -61
- package/dist/esm/state/exports.js +3 -0
- package/dist/esm/state/reactive.js +34 -0
- package/dist/esm/state/state.js +148 -0
- package/dist/esm/state/visitor.js +28 -0
- package/dist/esm/state/watch.js +36 -0
- package/dist/esm/styles/css.js +4 -9
- package/dist/esm/styles/element-styles.js +14 -33
- package/dist/esm/styles/host.js +1 -0
- package/dist/esm/styles/style-strategy.js +1 -0
- package/dist/esm/templating/binding-signal.js +67 -62
- package/dist/esm/templating/binding-two-way.js +72 -39
- package/dist/esm/templating/binding.js +142 -286
- package/dist/esm/templating/children.js +8 -4
- package/dist/esm/templating/compiler.js +59 -43
- package/dist/esm/templating/html-directive.js +56 -75
- package/dist/esm/templating/node-observation.js +20 -13
- package/dist/esm/templating/ref.js +4 -12
- package/dist/esm/templating/render.js +402 -0
- package/dist/esm/templating/repeat.js +88 -75
- package/dist/esm/templating/template.js +132 -60
- package/dist/esm/templating/view.js +113 -29
- package/dist/esm/templating/when.js +5 -4
- package/dist/esm/testing/exports.js +3 -0
- package/dist/esm/testing/fakes.js +107 -0
- package/dist/esm/testing/fixture.js +86 -0
- package/dist/esm/testing/timeout.js +24 -0
- package/dist/esm/utilities.js +97 -96
- package/dist/fast-element.api.json +9741 -8201
- package/dist/fast-element.d.ts +889 -646
- package/dist/fast-element.debug.js +2001 -1167
- package/dist/fast-element.debug.min.js +1 -1
- package/dist/fast-element.js +1907 -1109
- package/dist/fast-element.min.js +1 -1
- package/dist/fast-element.untrimmed.d.ts +913 -703
- package/docs/api-report.md +331 -258
- package/package.json +38 -16
- package/dist/dts/hooks.d.ts +0 -20
- package/dist/dts/observation/behavior.d.ts +0 -19
- package/dist/dts/observation/splice-strategies.d.ts +0 -13
- package/dist/dts/templating/dom.d.ts +0 -41
- package/dist/esm/hooks.js +0 -32
- package/dist/esm/observation/splice-strategies.js +0 -400
- package/dist/esm/templating/dom.js +0 -49
package/dist/fast-element.d.ts
CHANGED
|
@@ -24,7 +24,7 @@ export declare interface Accessor {
|
|
|
24
24
|
* Used to add behaviors when constructing styles.
|
|
25
25
|
* @public
|
|
26
26
|
*/
|
|
27
|
-
export declare type AddBehavior = (behavior:
|
|
27
|
+
export declare type AddBehavior = (behavior: HostBehavior<HTMLElement>) => void;
|
|
28
28
|
|
|
29
29
|
/**
|
|
30
30
|
* Used to add behavior factories when constructing templates.
|
|
@@ -32,8 +32,6 @@ export declare type AddBehavior = (behavior: Behavior<HTMLElement>) => void;
|
|
|
32
32
|
*/
|
|
33
33
|
export declare type AddViewBehaviorFactory = (factory: ViewBehaviorFactory) => string;
|
|
34
34
|
|
|
35
|
-
/* Excluded from this release type: AdoptedStyleSheetsStrategy */
|
|
36
|
-
|
|
37
35
|
/**
|
|
38
36
|
* An observer for arrays.
|
|
39
37
|
* @public
|
|
@@ -78,53 +76,6 @@ export declare const ArrayObserver: Readonly<{
|
|
|
78
76
|
readonly enable: () => void;
|
|
79
77
|
}>;
|
|
80
78
|
|
|
81
|
-
/**
|
|
82
|
-
* The type of HTML aspect to target.
|
|
83
|
-
* @public
|
|
84
|
-
*/
|
|
85
|
-
export declare const Aspect: Readonly<{
|
|
86
|
-
/**
|
|
87
|
-
* Not aspected.
|
|
88
|
-
*/
|
|
89
|
-
readonly none: 0;
|
|
90
|
-
/**
|
|
91
|
-
* An attribute.
|
|
92
|
-
*/
|
|
93
|
-
readonly attribute: 1;
|
|
94
|
-
/**
|
|
95
|
-
* A boolean attribute.
|
|
96
|
-
*/
|
|
97
|
-
readonly booleanAttribute: 2;
|
|
98
|
-
/**
|
|
99
|
-
* A property.
|
|
100
|
-
*/
|
|
101
|
-
readonly property: 3;
|
|
102
|
-
/**
|
|
103
|
-
* Content
|
|
104
|
-
*/
|
|
105
|
-
readonly content: 4;
|
|
106
|
-
/**
|
|
107
|
-
* A token list.
|
|
108
|
-
*/
|
|
109
|
-
readonly tokenList: 5;
|
|
110
|
-
/**
|
|
111
|
-
* An event.
|
|
112
|
-
*/
|
|
113
|
-
readonly event: 6;
|
|
114
|
-
/**
|
|
115
|
-
*
|
|
116
|
-
* @param directive - The directive to assign the aspect to.
|
|
117
|
-
* @param value - The value to base the aspect determination on.
|
|
118
|
-
*/
|
|
119
|
-
readonly assign: (directive: Aspected, value: string) => void;
|
|
120
|
-
}>;
|
|
121
|
-
|
|
122
|
-
/**
|
|
123
|
-
* The type of HTML aspect to target.
|
|
124
|
-
* @public
|
|
125
|
-
*/
|
|
126
|
-
export declare type Aspect = typeof Aspect[Exclude<keyof typeof Aspect, "assign" | "none">];
|
|
127
|
-
|
|
128
79
|
/**
|
|
129
80
|
* Represents something that applies to a specific aspect of the DOM.
|
|
130
81
|
* @public
|
|
@@ -141,11 +92,11 @@ export declare interface Aspected {
|
|
|
141
92
|
/**
|
|
142
93
|
* The type of aspect to target.
|
|
143
94
|
*/
|
|
144
|
-
aspectType:
|
|
95
|
+
aspectType: DOMAspect;
|
|
145
96
|
/**
|
|
146
97
|
* A binding if one is associated with the aspect.
|
|
147
98
|
*/
|
|
148
|
-
|
|
99
|
+
dataBinding?: Binding;
|
|
149
100
|
}
|
|
150
101
|
|
|
151
102
|
/**
|
|
@@ -174,6 +125,17 @@ export declare type AttributeConfiguration = {
|
|
|
174
125
|
converter?: ValueConverter;
|
|
175
126
|
};
|
|
176
127
|
|
|
128
|
+
/**
|
|
129
|
+
* Metadata used to configure a custom attribute's behavior.
|
|
130
|
+
* @public
|
|
131
|
+
*/
|
|
132
|
+
export declare const AttributeConfiguration: Readonly<{
|
|
133
|
+
/**
|
|
134
|
+
* Locates all attribute configurations associated with a type.
|
|
135
|
+
*/
|
|
136
|
+
locate: (target: {}) => AttributeConfiguration[];
|
|
137
|
+
}>;
|
|
138
|
+
|
|
177
139
|
/**
|
|
178
140
|
* An implementation of {@link Accessor} that supports reactivity,
|
|
179
141
|
* change callbacks, attribute reflection, and type conversion for
|
|
@@ -246,121 +208,41 @@ export declare class AttributeDefinition implements Accessor {
|
|
|
246
208
|
export declare type AttributeMode = typeof reflectMode | typeof booleanMode | "fromView";
|
|
247
209
|
|
|
248
210
|
/**
|
|
249
|
-
*
|
|
250
|
-
*
|
|
251
|
-
* @
|
|
252
|
-
|
|
253
|
-
|
|
254
|
-
/**
|
|
255
|
-
* Bind this behavior to the source.
|
|
256
|
-
* @param source - The source to bind to.
|
|
257
|
-
* @param context - The execution context that the binding is operating within.
|
|
258
|
-
*/
|
|
259
|
-
bind(source: TSource, context: ExecutionContext<TParent>): void;
|
|
260
|
-
/**
|
|
261
|
-
* Unbinds this behavior from the source.
|
|
262
|
-
* @param source - The source to unbind from.
|
|
263
|
-
*/
|
|
264
|
-
unbind(source: TSource, context: ExecutionContext<TParent>): void;
|
|
265
|
-
}
|
|
266
|
-
|
|
267
|
-
/**
|
|
268
|
-
* Creates a binding directive with the specified configuration.
|
|
269
|
-
* @param binding - The binding expression.
|
|
270
|
-
* @param config - The binding configuration.
|
|
271
|
-
* @returns A binding directive.
|
|
272
|
-
* @public
|
|
273
|
-
*/
|
|
274
|
-
export declare function bind<T = any>(binding: Binding<T>, config?: BindingConfig | DefaultBindingOptions): CaptureType<T>;
|
|
275
|
-
|
|
276
|
-
/**
|
|
277
|
-
* The signature of an arrow function capable of being evaluated
|
|
278
|
-
* as part of a template binding update.
|
|
279
|
-
* @public
|
|
280
|
-
*/
|
|
281
|
-
export declare type Binding<TSource = any, TReturn = any, TParent = any> = (source: TSource, context: ExecutionContext<TParent>) => TReturn;
|
|
282
|
-
|
|
283
|
-
/**
|
|
284
|
-
* Describes the configuration for a binding expression.
|
|
285
|
-
* @public
|
|
286
|
-
*/
|
|
287
|
-
export declare interface BindingConfig<T = any> {
|
|
288
|
-
/**
|
|
289
|
-
* The binding mode to configure the binding with.
|
|
290
|
-
*/
|
|
291
|
-
mode: BindingMode;
|
|
292
|
-
/**
|
|
293
|
-
* Options to be supplied to the binding behaviors.
|
|
294
|
-
*/
|
|
295
|
-
options: T;
|
|
296
|
-
}
|
|
297
|
-
|
|
298
|
-
/**
|
|
299
|
-
* Describes the configuration for a binding expression.
|
|
300
|
-
* @public
|
|
301
|
-
*/
|
|
302
|
-
export declare const BindingConfig: Readonly<{
|
|
303
|
-
/**
|
|
304
|
-
* Creates a binding configuration based on the provided mode and options.
|
|
305
|
-
* @param mode - The mode to use for the configuration.
|
|
306
|
-
* @param defaultOptions - The default options to use for the configuration.
|
|
307
|
-
* @returns A new binding configuration.
|
|
308
|
-
*/
|
|
309
|
-
define<T>(mode: BindingMode, defaultOptions: T): BindingConfig<T> & BindingConfigResolver<T>;
|
|
310
|
-
}>;
|
|
311
|
-
|
|
312
|
-
/**
|
|
313
|
-
* Creates a new binding configuration based on the supplied options.
|
|
314
|
-
* @public
|
|
315
|
-
*/
|
|
316
|
-
export declare type BindingConfigResolver<T> = (options: T) => BindingConfig<T>;
|
|
317
|
-
|
|
318
|
-
/**
|
|
319
|
-
* Describes how aspects of an HTML element will be affected by bindings.
|
|
211
|
+
* Creates an standard binding.
|
|
212
|
+
* @param expression - The binding to refresh when changed.
|
|
213
|
+
* @param policy - The security policy to associate with th binding.
|
|
214
|
+
* @param isVolatile - Indicates whether the binding is volatile or not.
|
|
215
|
+
* @returns A binding configuration.
|
|
320
216
|
* @public
|
|
321
217
|
*/
|
|
322
|
-
export declare
|
|
218
|
+
export declare function bind<T = any>(expression: Expression<T>, policy?: DOMPolicy, isVolatile?: boolean): Binding<T>;
|
|
323
219
|
|
|
324
220
|
/**
|
|
325
|
-
*
|
|
326
|
-
*
|
|
327
|
-
*/
|
|
328
|
-
export declare const BindingMode: Readonly<{
|
|
329
|
-
/**
|
|
330
|
-
* Creates a binding mode based on the supplied behavior types.
|
|
331
|
-
* @param UpdateType - The base behavior type used to update aspects.
|
|
332
|
-
* @param EventType - The base behavior type used to respond to events.
|
|
333
|
-
* @returns A new binding mode.
|
|
334
|
-
*/
|
|
335
|
-
define(UpdateType: typeof UpdateBinding, EventType?: typeof EventBinding): BindingMode;
|
|
336
|
-
}>;
|
|
337
|
-
|
|
338
|
-
/**
|
|
339
|
-
* Enables evaluation of and subscription to a binding.
|
|
221
|
+
* Captures a binding expression along with related information and capabilities.
|
|
222
|
+
*
|
|
340
223
|
* @public
|
|
341
224
|
*/
|
|
342
|
-
export declare
|
|
225
|
+
export declare abstract class Binding<TSource = any, TReturn = any, TParent = any> {
|
|
226
|
+
evaluate: Expression<TSource, TReturn, TParent>;
|
|
227
|
+
policy?: DOMPolicy | undefined;
|
|
228
|
+
isVolatile: boolean;
|
|
343
229
|
/**
|
|
344
|
-
*
|
|
345
|
-
* @param source - The source that the binding is based on.
|
|
346
|
-
* @param context - The execution context to execute the binding within.
|
|
347
|
-
* @returns The value of the binding.
|
|
230
|
+
* Options associated with the binding.
|
|
348
231
|
*/
|
|
349
|
-
|
|
232
|
+
options?: any;
|
|
350
233
|
/**
|
|
351
|
-
*
|
|
352
|
-
*
|
|
234
|
+
* Creates a binding.
|
|
235
|
+
* @param evaluate - Evaluates the binding.
|
|
236
|
+
* @param policy - The security policy to associate with this binding.
|
|
237
|
+
* @param isVolatile - Indicates whether the binding is volatile.
|
|
353
238
|
*/
|
|
354
|
-
|
|
239
|
+
constructor(evaluate: Expression<TSource, TReturn, TParent>, policy?: DOMPolicy | undefined, isVolatile?: boolean);
|
|
355
240
|
/**
|
|
356
|
-
*
|
|
357
|
-
* @param
|
|
358
|
-
* @
|
|
359
|
-
* By default, the update mode is asynchronous, since that provides the best
|
|
360
|
-
* performance for template rendering scenarios. Passing false to setMode will
|
|
361
|
-
* instead cause the observer to notify subscribers immediately when changes occur.
|
|
241
|
+
* Creates an observer capable of notifying a subscriber when the output of a binding changes.
|
|
242
|
+
* @param directive - The HTML Directive to create the observer for.
|
|
243
|
+
* @param subscriber - The subscriber to changes in the binding.
|
|
362
244
|
*/
|
|
363
|
-
|
|
245
|
+
abstract createObserver(directive: HTMLDirective, subscriber: Subscriber): ExpressionObserver<TSource, TReturn, TParent>;
|
|
364
246
|
}
|
|
365
247
|
|
|
366
248
|
/**
|
|
@@ -386,43 +268,7 @@ export declare type Callable = typeof Function.prototype.call | {
|
|
|
386
268
|
* into templates.
|
|
387
269
|
* @public
|
|
388
270
|
*/
|
|
389
|
-
export declare interface CaptureType<TSource> {
|
|
390
|
-
}
|
|
391
|
-
|
|
392
|
-
/**
|
|
393
|
-
* A binding behavior for bindings that change.
|
|
394
|
-
* @public
|
|
395
|
-
*/
|
|
396
|
-
export declare class ChangeBinding extends UpdateBinding {
|
|
397
|
-
private isBindingVolatile;
|
|
398
|
-
private observerProperty;
|
|
399
|
-
/**
|
|
400
|
-
* Creates an instance of ChangeBinding.
|
|
401
|
-
* @param directive - The directive that has the configuration for this behavior.
|
|
402
|
-
* @param updateTarget - The function used to update the target with the latest value.
|
|
403
|
-
*/
|
|
404
|
-
constructor(directive: HTMLBindingDirective, updateTarget: UpdateTarget);
|
|
405
|
-
/**
|
|
406
|
-
* Returns the binding observer used to update the node.
|
|
407
|
-
* @param target - The target node.
|
|
408
|
-
* @returns A BindingObserver.
|
|
409
|
-
*/
|
|
410
|
-
protected getObserver(target: Node): BindingObserver;
|
|
411
|
-
/**
|
|
412
|
-
* Bind this behavior to the source.
|
|
413
|
-
* @param source - The source to bind to.
|
|
414
|
-
* @param context - The execution context that the binding is operating within.
|
|
415
|
-
* @param targets - The targets that behaviors in a view can attach to.
|
|
416
|
-
*/
|
|
417
|
-
bind(source: any, context: ExecutionContext, targets: ViewBehaviorTargets): void;
|
|
418
|
-
/**
|
|
419
|
-
* Unbinds this behavior from the source.
|
|
420
|
-
* @param source - The source to unbind from.
|
|
421
|
-
* @param context - The execution context that the binding is operating within.
|
|
422
|
-
* @param targets - The targets that behaviors in a view can attach to.
|
|
423
|
-
*/
|
|
424
|
-
unbind(source: any, context: ExecutionContext, targets: ViewBehaviorTargets): void;
|
|
425
|
-
/* Excluded from this release type: handleChange */
|
|
271
|
+
export declare interface CaptureType<TSource, TParent> {
|
|
426
272
|
}
|
|
427
273
|
|
|
428
274
|
/**
|
|
@@ -438,7 +284,7 @@ export declare interface ChildListDirectiveOptions<T = any> extends NodeBehavior
|
|
|
438
284
|
* @param propertyOrOptions - The options used to configure child node observation.
|
|
439
285
|
* @public
|
|
440
286
|
*/
|
|
441
|
-
export declare function children<
|
|
287
|
+
export declare function children<TSource = any, TParent = any>(propertyOrOptions: (keyof TSource & string) | ChildrenDirectiveOptions<keyof TSource & string>): CaptureType<TSource, TParent>;
|
|
442
288
|
|
|
443
289
|
/**
|
|
444
290
|
* The runtime behavior for child node observation.
|
|
@@ -475,6 +321,17 @@ export declare class ChildrenDirective extends NodeObservationDirective<Children
|
|
|
475
321
|
*/
|
|
476
322
|
export declare type ChildrenDirectiveOptions<T = any> = ChildListDirectiveOptions<T> | SubtreeDirectiveOptions<T>;
|
|
477
323
|
|
|
324
|
+
/**
|
|
325
|
+
* Represents a constructable class with a prototype.
|
|
326
|
+
* @public
|
|
327
|
+
*/
|
|
328
|
+
export declare type Class<T, C = {}> = C & Constructable<T> & {
|
|
329
|
+
/**
|
|
330
|
+
* The class's prototype;
|
|
331
|
+
*/
|
|
332
|
+
readonly prototype: T;
|
|
333
|
+
};
|
|
334
|
+
|
|
478
335
|
/**
|
|
479
336
|
* A function capable of compiling a template from the preprocessed form produced
|
|
480
337
|
* by the html template function into a result that can instantiate views.
|
|
@@ -488,33 +345,36 @@ html: string | HTMLTemplateElement,
|
|
|
488
345
|
/**
|
|
489
346
|
* The behavior factories used within the html that is being compiled.
|
|
490
347
|
*/
|
|
491
|
-
factories: Record<string, ViewBehaviorFactory
|
|
348
|
+
factories: Record<string, ViewBehaviorFactory>,
|
|
349
|
+
/**
|
|
350
|
+
* The security policy to compile the html with.
|
|
351
|
+
*/
|
|
352
|
+
policy: DOMPolicy) => HTMLTemplateCompilationResult;
|
|
353
|
+
|
|
354
|
+
/**
|
|
355
|
+
* Represents a ViewBehaviorFactory after the compilation process has completed.
|
|
356
|
+
* @public
|
|
357
|
+
*/
|
|
358
|
+
export declare type CompiledViewBehaviorFactory = Required<ViewBehaviorFactory>;
|
|
492
359
|
|
|
493
360
|
/**
|
|
494
361
|
* Common APIs related to compilation.
|
|
495
362
|
* @public
|
|
496
363
|
*/
|
|
497
364
|
export declare const Compiler: {
|
|
498
|
-
/**
|
|
499
|
-
* Sets the HTML trusted types policy used by the compiler.
|
|
500
|
-
* @param policy - The policy to set for HTML.
|
|
501
|
-
* @remarks
|
|
502
|
-
* This API can only be called once, for security reasons. It should be
|
|
503
|
-
* called by the application developer at the start of their program.
|
|
504
|
-
*/
|
|
505
|
-
setHTMLPolicy(policy: TrustedTypesPolicy): void;
|
|
506
365
|
/**
|
|
507
366
|
* Compiles a template and associated directives into a compilation
|
|
508
367
|
* result which can be used to create views.
|
|
509
368
|
* @param html - The html string or template element to compile.
|
|
510
|
-
* @param
|
|
369
|
+
* @param factories - The behavior factories referenced by the template.
|
|
370
|
+
* @param policy - The security policy to compile the html with.
|
|
511
371
|
* @remarks
|
|
512
372
|
* The template that is provided for compilation is altered in-place
|
|
513
373
|
* and cannot be compiled again. If the original template must be preserved,
|
|
514
374
|
* it is recommended that you clone the original and pass the clone to this API.
|
|
515
375
|
* @public
|
|
516
376
|
*/
|
|
517
|
-
compile<TSource = any, TParent = any>(html: string | HTMLTemplateElement,
|
|
377
|
+
compile<TSource = any, TParent = any>(html: string | HTMLTemplateElement, factories: Record<string, ViewBehaviorFactory>, policy?: DOMPolicy): HTMLTemplateCompilationResult<TSource, TParent>;
|
|
518
378
|
/**
|
|
519
379
|
* Sets the default compilation strategy that will be used by the ViewTemplate whenever
|
|
520
380
|
* it needs to compile a view preprocessed with the html template function.
|
|
@@ -525,9 +385,10 @@ export declare const Compiler: {
|
|
|
525
385
|
* Aggregates an array of strings and directives into a single directive.
|
|
526
386
|
* @param parts - A heterogeneous array of static strings interspersed with
|
|
527
387
|
* directives.
|
|
388
|
+
* @param policy - The security policy to use with the aggregated bindings.
|
|
528
389
|
* @returns A single inline directive that aggregates the behavior of all the parts.
|
|
529
390
|
*/
|
|
530
|
-
aggregate(parts: (string | ViewBehaviorFactory)[]): ViewBehaviorFactory;
|
|
391
|
+
aggregate(parts: (string | ViewBehaviorFactory)[], policy?: DOMPolicy): ViewBehaviorFactory;
|
|
531
392
|
};
|
|
532
393
|
|
|
533
394
|
/**
|
|
@@ -536,8 +397,12 @@ export declare const Compiler: {
|
|
|
536
397
|
*/
|
|
537
398
|
export declare type ComposableStyles = string | ElementStyles | CSSStyleSheet;
|
|
538
399
|
|
|
400
|
+
declare function compose<TType extends Constructable<HTMLElement> = Constructable<HTMLElement>>(this: TType, nameOrDef: string | PartialFASTElementDefinition): FASTElementDefinition<TType>;
|
|
401
|
+
|
|
402
|
+
declare function compose<TType extends Constructable<HTMLElement> = Constructable<HTMLElement>>(type: TType, nameOrDef?: string | PartialFASTElementDefinition): FASTElementDefinition<TType>;
|
|
403
|
+
|
|
539
404
|
/**
|
|
540
|
-
*
|
|
405
|
+
* Represents a type which can be constructed with the new operator.
|
|
541
406
|
*
|
|
542
407
|
* @public
|
|
543
408
|
*/
|
|
@@ -558,120 +423,46 @@ export declare type ConstructibleStyleStrategy = {
|
|
|
558
423
|
};
|
|
559
424
|
|
|
560
425
|
/**
|
|
561
|
-
*
|
|
426
|
+
* A simple template that can create ContentView instances.
|
|
562
427
|
* @public
|
|
563
428
|
*/
|
|
564
|
-
export declare
|
|
565
|
-
private boundObservables;
|
|
566
|
-
private behaviors;
|
|
567
|
-
private needsInitialization;
|
|
568
|
-
private hasExistingShadowRoot;
|
|
569
|
-
private _template;
|
|
570
|
-
private _styles;
|
|
571
|
-
private _isConnected;
|
|
572
|
-
/**
|
|
573
|
-
* This allows Observable.getNotifier(...) to return the Controller
|
|
574
|
-
* when the notifier for the Controller itself is being requested. The
|
|
575
|
-
* result is that the Observable system does not need to create a separate
|
|
576
|
-
* instance of Notifier for observables on the Controller. The component and
|
|
577
|
-
* the controller will now share the same notifier, removing one-object construct
|
|
578
|
-
* per web component instance.
|
|
579
|
-
*/
|
|
580
|
-
private readonly $fastController;
|
|
581
|
-
/**
|
|
582
|
-
* The element being controlled by this controller.
|
|
583
|
-
*/
|
|
584
|
-
readonly element: TElement;
|
|
585
|
-
/**
|
|
586
|
-
* The element definition that instructs this controller
|
|
587
|
-
* in how to handle rendering and other platform integrations.
|
|
588
|
-
*/
|
|
589
|
-
readonly definition: FASTElementDefinition;
|
|
590
|
-
/**
|
|
591
|
-
* The view associated with the custom element.
|
|
592
|
-
* @remarks
|
|
593
|
-
* If `null` then the element is managing its own rendering.
|
|
594
|
-
*/
|
|
595
|
-
readonly view: ElementView<TElement> | null;
|
|
596
|
-
/**
|
|
597
|
-
* Indicates whether or not the custom element has been
|
|
598
|
-
* connected to the document.
|
|
599
|
-
*/
|
|
600
|
-
get isConnected(): boolean;
|
|
601
|
-
private setIsConnected;
|
|
602
|
-
/**
|
|
603
|
-
* Gets/sets the template used to render the component.
|
|
604
|
-
* @remarks
|
|
605
|
-
* This value can only be accurately read after connect but can be set at any time.
|
|
606
|
-
*/
|
|
607
|
-
get template(): ElementViewTemplate<TElement> | null;
|
|
608
|
-
set template(value: ElementViewTemplate<TElement> | null);
|
|
609
|
-
/**
|
|
610
|
-
* Gets/sets the primary styles used for the component.
|
|
611
|
-
* @remarks
|
|
612
|
-
* This value can only be accurately read after connect but can be set at any time.
|
|
613
|
-
*/
|
|
614
|
-
get styles(): ElementStyles | null;
|
|
615
|
-
set styles(value: ElementStyles | null);
|
|
616
|
-
/* Excluded from this release type: __constructor */
|
|
617
|
-
/**
|
|
618
|
-
* Adds styles to this element. Providing an HTMLStyleElement will attach the element instance to the shadowRoot.
|
|
619
|
-
* @param styles - The styles to add.
|
|
620
|
-
*/
|
|
621
|
-
addStyles(styles: ElementStyles | HTMLStyleElement | null | undefined): void;
|
|
429
|
+
export declare interface ContentTemplate {
|
|
622
430
|
/**
|
|
623
|
-
*
|
|
624
|
-
* @param styles - the styles to remove.
|
|
625
|
-
*/
|
|
626
|
-
removeStyles(styles: ElementStyles | HTMLStyleElement | null | undefined): void;
|
|
627
|
-
/**
|
|
628
|
-
* Adds behaviors to this element.
|
|
629
|
-
* @param behaviors - The behaviors to add.
|
|
630
|
-
*/
|
|
631
|
-
addBehaviors(behaviors: ReadonlyArray<Behavior<TElement>>): void;
|
|
632
|
-
/**
|
|
633
|
-
* Removes behaviors from this element.
|
|
634
|
-
* @param behaviors - The behaviors to remove.
|
|
635
|
-
* @param force - Forces unbinding of behaviors.
|
|
636
|
-
*/
|
|
637
|
-
removeBehaviors(behaviors: ReadonlyArray<Behavior<TElement>>, force?: boolean): void;
|
|
638
|
-
/**
|
|
639
|
-
* Runs connected lifecycle behavior on the associated element.
|
|
431
|
+
* Creates a simple content view instance.
|
|
640
432
|
*/
|
|
641
|
-
|
|
433
|
+
create(): ContentView;
|
|
434
|
+
}
|
|
435
|
+
|
|
436
|
+
/**
|
|
437
|
+
* A simple View that can be interpolated into HTML content.
|
|
438
|
+
* @public
|
|
439
|
+
*/
|
|
440
|
+
export declare interface ContentView {
|
|
441
|
+
readonly context: ExecutionContext;
|
|
642
442
|
/**
|
|
643
|
-
*
|
|
443
|
+
* Binds a view's behaviors to its binding source.
|
|
444
|
+
* @param source - The binding source for the view's binding behaviors.
|
|
445
|
+
* @param context - The execution context to run the view within.
|
|
644
446
|
*/
|
|
645
|
-
|
|
447
|
+
bind(source: any, context?: ExecutionContext): void;
|
|
646
448
|
/**
|
|
647
|
-
*
|
|
648
|
-
* @param name - The name of the attribute that changed.
|
|
649
|
-
* @param oldValue - The previous value of the attribute.
|
|
650
|
-
* @param newValue - The new value of the attribute.
|
|
449
|
+
* Unbinds a view's behaviors from its binding source and context.
|
|
651
450
|
*/
|
|
652
|
-
|
|
451
|
+
unbind(): void;
|
|
653
452
|
/**
|
|
654
|
-
*
|
|
655
|
-
* @param
|
|
656
|
-
* @param detail - The event detail object to send with the event.
|
|
657
|
-
* @param options - The event options. By default bubbles and composed.
|
|
658
|
-
* @remarks
|
|
659
|
-
* Only emits events if connected.
|
|
453
|
+
* Inserts the view's DOM nodes before the referenced node.
|
|
454
|
+
* @param node - The node to insert the view's DOM before.
|
|
660
455
|
*/
|
|
661
|
-
|
|
662
|
-
private finishInitialization;
|
|
663
|
-
private renderTemplate;
|
|
456
|
+
insertBefore(node: Node): void;
|
|
664
457
|
/**
|
|
665
|
-
*
|
|
666
|
-
*
|
|
667
|
-
* @remarks
|
|
668
|
-
* The specified element must have a {@link FASTElementDefinition}
|
|
669
|
-
* registered either through the use of the {@link customElement}
|
|
670
|
-
* decorator or a call to `FASTElement.define`.
|
|
458
|
+
* Removes the view's DOM nodes.
|
|
459
|
+
* The nodes are not disposed and the view can later be re-inserted.
|
|
671
460
|
*/
|
|
672
|
-
|
|
461
|
+
remove(): void;
|
|
673
462
|
}
|
|
674
463
|
|
|
464
|
+
/* Excluded from this release type: createMetadataLocator */
|
|
465
|
+
|
|
675
466
|
/* Excluded from this release type: createTypeRegistry */
|
|
676
467
|
|
|
677
468
|
/**
|
|
@@ -737,12 +528,6 @@ export declare interface CSSDirectiveDefinition<TType extends Constructable<CSSD
|
|
|
737
528
|
readonly type: TType;
|
|
738
529
|
}
|
|
739
530
|
|
|
740
|
-
/**
|
|
741
|
-
* @deprecated Use css.partial instead.
|
|
742
|
-
* @public
|
|
743
|
-
*/
|
|
744
|
-
export declare const cssPartial: (strings: TemplateStringsArray, ...values: (ComposableStyles | CSSDirective)[]) => CSSDirective;
|
|
745
|
-
|
|
746
531
|
/**
|
|
747
532
|
* Transforms a template literal string into styles.
|
|
748
533
|
* @param strings - The string fragments that are interpolated with the values.
|
|
@@ -776,11 +561,9 @@ export declare function customElement(nameOrDef: string | PartialFASTElementDefi
|
|
|
776
561
|
*/
|
|
777
562
|
export declare type DecoratorAttributeConfiguration = Omit<AttributeConfiguration, "property">;
|
|
778
563
|
|
|
779
|
-
|
|
780
|
-
|
|
781
|
-
|
|
782
|
-
*/
|
|
783
|
-
export declare type DefaultBindingOptions = AddEventListenerOptions;
|
|
564
|
+
declare function define<TType extends Constructable<HTMLElement> = Constructable<HTMLElement>>(this: TType, nameOrDef: string | PartialFASTElementDefinition): TType;
|
|
565
|
+
|
|
566
|
+
declare function define<TType extends Constructable<HTMLElement> = Constructable<HTMLElement>>(type: TType, nameOrDef?: string | PartialFASTElementDefinition): TType;
|
|
784
567
|
|
|
785
568
|
/**
|
|
786
569
|
* Provides a mechanism for releasing resources.
|
|
@@ -799,20 +582,17 @@ export declare interface Disposable {
|
|
|
799
582
|
*/
|
|
800
583
|
export declare const DOM: Readonly<{
|
|
801
584
|
/**
|
|
802
|
-
*
|
|
803
|
-
* Use Updates.enqueue().
|
|
804
|
-
*/
|
|
805
|
-
queueUpdate: (callable: Callable) => void;
|
|
806
|
-
/**
|
|
807
|
-
* @deprecated
|
|
808
|
-
* Use Updates.next()
|
|
585
|
+
* Gets the dom policy used by the templating system.
|
|
809
586
|
*/
|
|
810
|
-
|
|
587
|
+
readonly policy: DOMPolicy;
|
|
811
588
|
/**
|
|
812
|
-
*
|
|
813
|
-
*
|
|
589
|
+
* Sets the dom policy used by the templating system.
|
|
590
|
+
* @param policy - The policy to set.
|
|
591
|
+
* @remarks
|
|
592
|
+
* This API can only be called once, for security reasons. It should be
|
|
593
|
+
* called by the application developer at the start of their program.
|
|
814
594
|
*/
|
|
815
|
-
|
|
595
|
+
setPolicy(value: DOMPolicy): void;
|
|
816
596
|
/**
|
|
817
597
|
* Sets an attribute value on an element.
|
|
818
598
|
* @param element - The element to set the attribute value on.
|
|
@@ -834,6 +614,206 @@ export declare const DOM: Readonly<{
|
|
|
834
614
|
setBooleanAttribute(element: HTMLElement, attributeName: string, value: boolean): void;
|
|
835
615
|
}>;
|
|
836
616
|
|
|
617
|
+
/**
|
|
618
|
+
* The type of HTML aspect to target.
|
|
619
|
+
* @public
|
|
620
|
+
*/
|
|
621
|
+
export declare const DOMAspect: Readonly<{
|
|
622
|
+
/**
|
|
623
|
+
* Not aspected.
|
|
624
|
+
*/
|
|
625
|
+
readonly none: 0;
|
|
626
|
+
/**
|
|
627
|
+
* An attribute.
|
|
628
|
+
*/
|
|
629
|
+
readonly attribute: 1;
|
|
630
|
+
/**
|
|
631
|
+
* A boolean attribute.
|
|
632
|
+
*/
|
|
633
|
+
readonly booleanAttribute: 2;
|
|
634
|
+
/**
|
|
635
|
+
* A property.
|
|
636
|
+
*/
|
|
637
|
+
readonly property: 3;
|
|
638
|
+
/**
|
|
639
|
+
* Content
|
|
640
|
+
*/
|
|
641
|
+
readonly content: 4;
|
|
642
|
+
/**
|
|
643
|
+
* A token list.
|
|
644
|
+
*/
|
|
645
|
+
readonly tokenList: 5;
|
|
646
|
+
/**
|
|
647
|
+
* An event.
|
|
648
|
+
*/
|
|
649
|
+
readonly event: 6;
|
|
650
|
+
}>;
|
|
651
|
+
|
|
652
|
+
/**
|
|
653
|
+
* The type of HTML aspect to target.
|
|
654
|
+
* @public
|
|
655
|
+
*/
|
|
656
|
+
export declare type DOMAspect = typeof DOMAspect[Exclude<keyof typeof DOMAspect, "none">];
|
|
657
|
+
|
|
658
|
+
/**
|
|
659
|
+
* A security policy that FAST can use to interact with the DOM.
|
|
660
|
+
* @public
|
|
661
|
+
*/
|
|
662
|
+
export declare interface DOMPolicy {
|
|
663
|
+
/**
|
|
664
|
+
* Creates safe HTML from the provided value.
|
|
665
|
+
* @param value - The source to convert to safe HTML.
|
|
666
|
+
*/
|
|
667
|
+
createHTML(value: string): string;
|
|
668
|
+
/**
|
|
669
|
+
* Protects a DOM sink that intends to write to the DOM.
|
|
670
|
+
* @param tagName - The tag name for the element to write to.
|
|
671
|
+
* @param aspect - The aspect of the DOM to write to.
|
|
672
|
+
* @param aspectName - The name of the aspect to write to.
|
|
673
|
+
* @param sink - The sink that is used to write to the DOM.
|
|
674
|
+
*/
|
|
675
|
+
protect(tagName: string | null, aspect: DOMAspect, aspectName: string, sink: DOMSink): DOMSink;
|
|
676
|
+
}
|
|
677
|
+
|
|
678
|
+
/**
|
|
679
|
+
* A function used to send values to a DOM sink.
|
|
680
|
+
* @public
|
|
681
|
+
*/
|
|
682
|
+
export declare type DOMSink = (target: Node, aspectName: string, value: any, ...args: any[]) => void;
|
|
683
|
+
|
|
684
|
+
/**
|
|
685
|
+
* Controls the lifecycle and rendering of a `FASTElement`.
|
|
686
|
+
* @public
|
|
687
|
+
*/
|
|
688
|
+
export declare class ElementController<TElement extends HTMLElement = HTMLElement> extends PropertyChangeNotifier implements HostController<TElement> {
|
|
689
|
+
private boundObservables;
|
|
690
|
+
private needsInitialization;
|
|
691
|
+
private hasExistingShadowRoot;
|
|
692
|
+
private _template;
|
|
693
|
+
private stage;
|
|
694
|
+
/**
|
|
695
|
+
* A guard against connecting behaviors multiple times
|
|
696
|
+
* during connect in scenarios where a behavior adds
|
|
697
|
+
* another behavior during it's connectedCallback
|
|
698
|
+
*/
|
|
699
|
+
private guardBehaviorConnection;
|
|
700
|
+
private behaviors;
|
|
701
|
+
private _mainStyles;
|
|
702
|
+
/**
|
|
703
|
+
* This allows Observable.getNotifier(...) to return the Controller
|
|
704
|
+
* when the notifier for the Controller itself is being requested. The
|
|
705
|
+
* result is that the Observable system does not need to create a separate
|
|
706
|
+
* instance of Notifier for observables on the Controller. The component and
|
|
707
|
+
* the controller will now share the same notifier, removing one-object construct
|
|
708
|
+
* per web component instance.
|
|
709
|
+
*/
|
|
710
|
+
private readonly $fastController;
|
|
711
|
+
/**
|
|
712
|
+
* The element being controlled by this controller.
|
|
713
|
+
*/
|
|
714
|
+
readonly source: TElement;
|
|
715
|
+
/**
|
|
716
|
+
* The element definition that instructs this controller
|
|
717
|
+
* in how to handle rendering and other platform integrations.
|
|
718
|
+
*/
|
|
719
|
+
readonly definition: FASTElementDefinition;
|
|
720
|
+
/**
|
|
721
|
+
* The view associated with the custom element.
|
|
722
|
+
* @remarks
|
|
723
|
+
* If `null` then the element is managing its own rendering.
|
|
724
|
+
*/
|
|
725
|
+
readonly view: ElementView<TElement> | null;
|
|
726
|
+
/**
|
|
727
|
+
* Indicates whether or not the custom element has been
|
|
728
|
+
* connected to the document.
|
|
729
|
+
*/
|
|
730
|
+
get isConnected(): boolean;
|
|
731
|
+
/**
|
|
732
|
+
* Gets/sets the template used to render the component.
|
|
733
|
+
* @remarks
|
|
734
|
+
* This value can only be accurately read after connect but can be set at any time.
|
|
735
|
+
*/
|
|
736
|
+
get template(): ElementViewTemplate<TElement> | null;
|
|
737
|
+
set template(value: ElementViewTemplate<TElement> | null);
|
|
738
|
+
/**
|
|
739
|
+
* The main set of styles used for the component, independent
|
|
740
|
+
* of any dynamically added styles.
|
|
741
|
+
*/
|
|
742
|
+
get mainStyles(): ElementStyles | null;
|
|
743
|
+
set mainStyles(value: ElementStyles | null);
|
|
744
|
+
/* Excluded from this release type: __constructor */
|
|
745
|
+
/**
|
|
746
|
+
* Adds the behavior to the component.
|
|
747
|
+
* @param behavior - The behavior to add.
|
|
748
|
+
*/
|
|
749
|
+
addBehavior(behavior: HostBehavior<TElement>): void;
|
|
750
|
+
/**
|
|
751
|
+
* Removes the behavior from the component.
|
|
752
|
+
* @param behavior - The behavior to remove.
|
|
753
|
+
* @param force - Forces removal even if this behavior was added more than once.
|
|
754
|
+
*/
|
|
755
|
+
removeBehavior(behavior: HostBehavior<TElement>, force?: boolean): void;
|
|
756
|
+
/**
|
|
757
|
+
* Adds styles to this element. Providing an HTMLStyleElement will attach the element instance to the shadowRoot.
|
|
758
|
+
* @param styles - The styles to add.
|
|
759
|
+
*/
|
|
760
|
+
addStyles(styles: ElementStyles | HTMLStyleElement | null | undefined): void;
|
|
761
|
+
/**
|
|
762
|
+
* Removes styles from this element. Providing an HTMLStyleElement will detach the element instance from the shadowRoot.
|
|
763
|
+
* @param styles - the styles to remove.
|
|
764
|
+
*/
|
|
765
|
+
removeStyles(styles: ElementStyles | HTMLStyleElement | null | undefined): void;
|
|
766
|
+
/**
|
|
767
|
+
* Runs connected lifecycle behavior on the associated element.
|
|
768
|
+
*/
|
|
769
|
+
connect(): void;
|
|
770
|
+
/**
|
|
771
|
+
* Runs disconnected lifecycle behavior on the associated element.
|
|
772
|
+
*/
|
|
773
|
+
disconnect(): void;
|
|
774
|
+
/**
|
|
775
|
+
* Runs the attribute changed callback for the associated element.
|
|
776
|
+
* @param name - The name of the attribute that changed.
|
|
777
|
+
* @param oldValue - The previous value of the attribute.
|
|
778
|
+
* @param newValue - The new value of the attribute.
|
|
779
|
+
*/
|
|
780
|
+
onAttributeChangedCallback(name: string, oldValue: string | null, newValue: string | null): void;
|
|
781
|
+
/**
|
|
782
|
+
* Emits a custom HTML event.
|
|
783
|
+
* @param type - The type name of the event.
|
|
784
|
+
* @param detail - The event detail object to send with the event.
|
|
785
|
+
* @param options - The event options. By default bubbles and composed.
|
|
786
|
+
* @remarks
|
|
787
|
+
* Only emits events if connected.
|
|
788
|
+
*/
|
|
789
|
+
emit(type: string, detail?: any, options?: Omit<CustomEventInit, "detail">): void | boolean;
|
|
790
|
+
/* Excluded from this release type: toJSON */
|
|
791
|
+
private renderTemplate;
|
|
792
|
+
/**
|
|
793
|
+
* Locates or creates a controller for the specified element.
|
|
794
|
+
* @param element - The element to return the controller for.
|
|
795
|
+
* @remarks
|
|
796
|
+
* The specified element must have a {@link FASTElementDefinition}
|
|
797
|
+
* registered either through the use of the {@link customElement}
|
|
798
|
+
* decorator or a call to `FASTElement.define`.
|
|
799
|
+
*/
|
|
800
|
+
static forCustomElement(element: HTMLElement): ElementController;
|
|
801
|
+
/**
|
|
802
|
+
* Sets the strategy that ElementController.forCustomElement uses to construct
|
|
803
|
+
* ElementController instances for an element.
|
|
804
|
+
* @param strategy - The strategy to use.
|
|
805
|
+
*/
|
|
806
|
+
static setStrategy(strategy: ElementControllerStrategy): void;
|
|
807
|
+
}
|
|
808
|
+
|
|
809
|
+
/**
|
|
810
|
+
* A type that instantiates an ElementController
|
|
811
|
+
* @public
|
|
812
|
+
*/
|
|
813
|
+
export declare interface ElementControllerStrategy {
|
|
814
|
+
new (element: HTMLElement, definition: FASTElementDefinition): ElementController;
|
|
815
|
+
}
|
|
816
|
+
|
|
837
817
|
/**
|
|
838
818
|
* Creates a function that can be used to filter a Node array, selecting only elements.
|
|
839
819
|
* @param selector - An optional selector to restrict the filter to.
|
|
@@ -846,7 +826,7 @@ export declare const elements: (selector?: string) => ElementsFilter;
|
|
|
846
826
|
*
|
|
847
827
|
* @public
|
|
848
828
|
*/
|
|
849
|
-
export declare type ElementsFilter = (value: Node, index
|
|
829
|
+
export declare type ElementsFilter = (value: Node, index?: number, array?: Node[]) => boolean;
|
|
850
830
|
|
|
851
831
|
/**
|
|
852
832
|
* Represents styles that can be applied to a custom element.
|
|
@@ -859,7 +839,7 @@ export declare class ElementStyles {
|
|
|
859
839
|
/**
|
|
860
840
|
* The behaviors associated with this set of styles.
|
|
861
841
|
*/
|
|
862
|
-
readonly behaviors: ReadonlyArray<
|
|
842
|
+
readonly behaviors: ReadonlyArray<HostBehavior<HTMLElement>> | null;
|
|
863
843
|
/**
|
|
864
844
|
* Gets the StyleStrategy associated with these element styles.
|
|
865
845
|
*/
|
|
@@ -876,7 +856,7 @@ export declare class ElementStyles {
|
|
|
876
856
|
* Associates behaviors with this set of styles.
|
|
877
857
|
* @param behaviors - The behaviors to associate.
|
|
878
858
|
*/
|
|
879
|
-
withBehaviors(...behaviors:
|
|
859
|
+
withBehaviors(...behaviors: HostBehavior<HTMLElement>[]): this;
|
|
880
860
|
/**
|
|
881
861
|
* Sets the strategy that handles adding/removing these styles for an element.
|
|
882
862
|
* @param strategy - The strategy to use.
|
|
@@ -887,6 +867,12 @@ export declare class ElementStyles {
|
|
|
887
867
|
* @param Strategy - The strategy type to construct.
|
|
888
868
|
*/
|
|
889
869
|
static setDefaultStrategy(Strategy: ConstructibleStyleStrategy): void;
|
|
870
|
+
/**
|
|
871
|
+
* Normalizes a set of composable style options.
|
|
872
|
+
* @param styles - The style options to normalize.
|
|
873
|
+
* @returns A singular ElementStyles instance or undefined.
|
|
874
|
+
*/
|
|
875
|
+
static normalize(styles: ComposableStyles | ComposableStyles[] | undefined): ElementStyles | undefined;
|
|
890
876
|
/**
|
|
891
877
|
* Indicates whether the DOM supports the adoptedStyleSheets feature.
|
|
892
878
|
*/
|
|
@@ -934,50 +920,11 @@ export declare interface ElementViewTemplate<TSource = any, TParent = any> {
|
|
|
934
920
|
*/
|
|
935
921
|
export declare const emptyArray: readonly never[];
|
|
936
922
|
|
|
937
|
-
/**
|
|
938
|
-
* A binding behavior for handling events.
|
|
939
|
-
* @public
|
|
940
|
-
*/
|
|
941
|
-
export declare class EventBinding {
|
|
942
|
-
readonly directive: HTMLBindingDirective;
|
|
943
|
-
private contextProperty;
|
|
944
|
-
private sourceProperty;
|
|
945
|
-
/**
|
|
946
|
-
* Creates an instance of EventBinding.
|
|
947
|
-
* @param directive - The directive that has the configuration for this behavior.
|
|
948
|
-
*/
|
|
949
|
-
constructor(directive: HTMLBindingDirective);
|
|
950
|
-
/**
|
|
951
|
-
* Bind this behavior to the source.
|
|
952
|
-
* @param source - The source to bind to.
|
|
953
|
-
* @param context - The execution context that the binding is operating within.
|
|
954
|
-
* @param targets - The targets that behaviors in a view can attach to.
|
|
955
|
-
*/
|
|
956
|
-
bind(source: any, context: ExecutionContext, targets: ViewBehaviorTargets): void;
|
|
957
|
-
/**
|
|
958
|
-
* Unbinds this behavior from the source.
|
|
959
|
-
* @param source - The source to unbind from.
|
|
960
|
-
* @param context - The execution context that the binding is operating within.
|
|
961
|
-
* @param targets - The targets that behaviors in a view can attach to.
|
|
962
|
-
*/
|
|
963
|
-
unbind(source: any, context: ExecutionContext, targets: ViewBehaviorTargets): void;
|
|
964
|
-
/**
|
|
965
|
-
* Creates a behavior.
|
|
966
|
-
* @param targets - The targets available for behaviors to be attached to.
|
|
967
|
-
*/
|
|
968
|
-
createBehavior(targets: ViewBehaviorTargets): ViewBehavior;
|
|
969
|
-
/* Excluded from this release type: handleEvent */
|
|
970
|
-
}
|
|
971
|
-
|
|
972
923
|
/**
|
|
973
924
|
* Provides additional contextual information available to behaviors and expressions.
|
|
974
925
|
* @public
|
|
975
926
|
*/
|
|
976
|
-
export declare
|
|
977
|
-
/**
|
|
978
|
-
* The default execution context.
|
|
979
|
-
*/
|
|
980
|
-
static readonly default: ExecutionContext<any>;
|
|
927
|
+
export declare interface ExecutionContext<TParent = any> {
|
|
981
928
|
/**
|
|
982
929
|
* The index of the current item within a repeat context.
|
|
983
930
|
*/
|
|
@@ -989,41 +936,40 @@ export declare class ExecutionContext<TParentSource = any> {
|
|
|
989
936
|
/**
|
|
990
937
|
* The parent data source within a nested context.
|
|
991
938
|
*/
|
|
992
|
-
|
|
939
|
+
parent: TParent;
|
|
993
940
|
/**
|
|
994
941
|
* The parent execution context when in nested context scenarios.
|
|
995
942
|
*/
|
|
996
|
-
|
|
997
|
-
private constructor();
|
|
943
|
+
parentContext: ExecutionContext<TParent>;
|
|
998
944
|
/**
|
|
999
945
|
* The current event within an event handler.
|
|
1000
946
|
*/
|
|
1001
|
-
|
|
947
|
+
readonly event: Event;
|
|
1002
948
|
/**
|
|
1003
949
|
* Indicates whether the current item within a repeat context
|
|
1004
950
|
* has an even index.
|
|
1005
951
|
*/
|
|
1006
|
-
|
|
952
|
+
readonly isEven: boolean;
|
|
1007
953
|
/**
|
|
1008
954
|
* Indicates whether the current item within a repeat context
|
|
1009
955
|
* has an odd index.
|
|
1010
956
|
*/
|
|
1011
|
-
|
|
957
|
+
readonly isOdd: boolean;
|
|
1012
958
|
/**
|
|
1013
959
|
* Indicates whether the current item within a repeat context
|
|
1014
960
|
* is the first item in the collection.
|
|
1015
961
|
*/
|
|
1016
|
-
|
|
962
|
+
readonly isFirst: boolean;
|
|
1017
963
|
/**
|
|
1018
964
|
* Indicates whether the current item within a repeat context
|
|
1019
965
|
* is somewhere in the middle of the collection.
|
|
1020
966
|
*/
|
|
1021
|
-
|
|
967
|
+
readonly isInMiddle: boolean;
|
|
1022
968
|
/**
|
|
1023
969
|
* Indicates whether the current item within a repeat context
|
|
1024
970
|
* is the last item in the collection.
|
|
1025
971
|
*/
|
|
1026
|
-
|
|
972
|
+
readonly isLast: boolean;
|
|
1027
973
|
/**
|
|
1028
974
|
* Returns the typed event detail of a custom event.
|
|
1029
975
|
*/
|
|
@@ -1032,34 +978,111 @@ export declare class ExecutionContext<TParentSource = any> {
|
|
|
1032
978
|
* Returns the typed event target of the event.
|
|
1033
979
|
*/
|
|
1034
980
|
eventTarget<TTarget extends EventTarget>(): TTarget;
|
|
981
|
+
}
|
|
982
|
+
|
|
983
|
+
/**
|
|
984
|
+
* Provides additional contextual information available to behaviors and expressions.
|
|
985
|
+
* @public
|
|
986
|
+
*/
|
|
987
|
+
export declare const ExecutionContext: Readonly<{
|
|
988
|
+
/**
|
|
989
|
+
* A default execution context.
|
|
990
|
+
*/
|
|
991
|
+
default: ExecutionContext<any>;
|
|
992
|
+
/**
|
|
993
|
+
* Gets the current event.
|
|
994
|
+
* @returns An event object.
|
|
995
|
+
*/
|
|
996
|
+
getEvent(): Event | null;
|
|
997
|
+
/**
|
|
998
|
+
* Sets the current event.
|
|
999
|
+
* @param event - An event object.
|
|
1000
|
+
*/
|
|
1001
|
+
setEvent(event: Event | null): void;
|
|
1002
|
+
}>;
|
|
1003
|
+
|
|
1004
|
+
/**
|
|
1005
|
+
* The signature of an arrow function capable of being evaluated
|
|
1006
|
+
* against source data and within an execution context.
|
|
1007
|
+
* @public
|
|
1008
|
+
*/
|
|
1009
|
+
export declare type Expression<TSource = any, TReturn = any, TParent = any> = (source: TSource, context: ExecutionContext<TParent>) => TReturn;
|
|
1010
|
+
|
|
1011
|
+
/**
|
|
1012
|
+
* Controls the lifecycle of an expression and provides relevant context.
|
|
1013
|
+
* @public
|
|
1014
|
+
*/
|
|
1015
|
+
export declare interface ExpressionController<TSource = any, TParent = any> {
|
|
1016
|
+
/**
|
|
1017
|
+
* The source the expression is evaluated against.
|
|
1018
|
+
*/
|
|
1019
|
+
readonly source: TSource;
|
|
1035
1020
|
/**
|
|
1036
|
-
*
|
|
1037
|
-
* @param index - The new index of the item.
|
|
1038
|
-
* @param length - The new length of the list.
|
|
1021
|
+
* Indicates how the source's lifetime relates to the controller's lifetime.
|
|
1039
1022
|
*/
|
|
1040
|
-
|
|
1023
|
+
readonly sourceLifetime?: SourceLifetime;
|
|
1041
1024
|
/**
|
|
1042
|
-
*
|
|
1043
|
-
* @param source - The source for the context if different than the parent.
|
|
1044
|
-
* @returns A child execution context.
|
|
1025
|
+
* The context the expression is evaluated against.
|
|
1045
1026
|
*/
|
|
1046
|
-
|
|
1027
|
+
readonly context: ExecutionContext<TParent>;
|
|
1047
1028
|
/**
|
|
1048
|
-
*
|
|
1049
|
-
* @param item - The list item to serve as the source.
|
|
1050
|
-
* @param index - The index of the item in the list.
|
|
1051
|
-
* @param length - The length of the list.
|
|
1029
|
+
* Indicates whether the controller is bound.
|
|
1052
1030
|
*/
|
|
1053
|
-
|
|
1054
|
-
/* Excluded from this release type: setEvent */
|
|
1031
|
+
readonly isBound: boolean;
|
|
1055
1032
|
/**
|
|
1056
|
-
*
|
|
1057
|
-
* @
|
|
1033
|
+
* Registers an unbind handler with the controller.
|
|
1034
|
+
* @param behavior - An object to call when the controller unbinds.
|
|
1058
1035
|
*/
|
|
1059
|
-
|
|
1036
|
+
onUnbind(behavior: {
|
|
1037
|
+
unbind(controller: ExpressionController<TSource, TParent>): any;
|
|
1038
|
+
}): void;
|
|
1060
1039
|
}
|
|
1061
1040
|
|
|
1062
|
-
|
|
1041
|
+
/**
|
|
1042
|
+
* Enables evaluation of and subscription to a binding.
|
|
1043
|
+
* @public
|
|
1044
|
+
*/
|
|
1045
|
+
export declare interface ExpressionNotifier<TSource = any, TReturn = any, TParent = any> extends Notifier, ExpressionObserver<TSource, TReturn, TParent>, Disposable {
|
|
1046
|
+
/**
|
|
1047
|
+
* Observes the expression.
|
|
1048
|
+
* @param source - The source for the expression.
|
|
1049
|
+
* @param context - The context for the expression.
|
|
1050
|
+
*/
|
|
1051
|
+
observe(source: TSource, context?: ExecutionContext): TReturn;
|
|
1052
|
+
/**
|
|
1053
|
+
* Gets {@link ObservationRecord|ObservationRecords} that the {@link ExpressionNotifier}
|
|
1054
|
+
* is observing.
|
|
1055
|
+
*/
|
|
1056
|
+
records(): IterableIterator<ObservationRecord>;
|
|
1057
|
+
/**
|
|
1058
|
+
* Sets the update mode used by the observer.
|
|
1059
|
+
* @param isAsync - Indicates whether updates should be asynchronous.
|
|
1060
|
+
* @remarks
|
|
1061
|
+
* By default, the update mode is asynchronous, since that provides the best
|
|
1062
|
+
* performance for template rendering scenarios. Passing false to setMode will
|
|
1063
|
+
* instead cause the observer to notify subscribers immediately when changes occur.
|
|
1064
|
+
*/
|
|
1065
|
+
setMode(isAsync: boolean): void;
|
|
1066
|
+
}
|
|
1067
|
+
|
|
1068
|
+
/**
|
|
1069
|
+
* Observes an expression for changes.
|
|
1070
|
+
* @public
|
|
1071
|
+
*/
|
|
1072
|
+
export declare interface ExpressionObserver<TSource = any, TReturn = any, TParent = any> {
|
|
1073
|
+
/**
|
|
1074
|
+
* Binds the expression to the source.
|
|
1075
|
+
* @param controller - The controller that manages the lifecycle and related
|
|
1076
|
+
* context for the expression.
|
|
1077
|
+
*/
|
|
1078
|
+
bind(controller: ExpressionController<TSource, TParent>): TReturn;
|
|
1079
|
+
}
|
|
1080
|
+
|
|
1081
|
+
/**
|
|
1082
|
+
* The FAST global.
|
|
1083
|
+
* @public
|
|
1084
|
+
*/
|
|
1085
|
+
export declare const FAST: FASTGlobal;
|
|
1063
1086
|
|
|
1064
1087
|
/**
|
|
1065
1088
|
* Represents a custom element based on the FASTElement infrastructure.
|
|
@@ -1070,7 +1093,7 @@ export declare interface FASTElement extends HTMLElement {
|
|
|
1070
1093
|
* The underlying controller that handles the lifecycle and rendering of
|
|
1071
1094
|
* this FASTElement.
|
|
1072
1095
|
*/
|
|
1073
|
-
readonly $fastController:
|
|
1096
|
+
readonly $fastController: ElementController;
|
|
1074
1097
|
/**
|
|
1075
1098
|
* Emits a custom HTML event.
|
|
1076
1099
|
* @param type - The type name of the event.
|
|
@@ -1111,29 +1134,11 @@ export declare interface FASTElement extends HTMLElement {
|
|
|
1111
1134
|
* static helpers for working with FASTElements.
|
|
1112
1135
|
* @public
|
|
1113
1136
|
*/
|
|
1114
|
-
export declare const FASTElement:
|
|
1115
|
-
|
|
1116
|
-
|
|
1117
|
-
|
|
1118
|
-
|
|
1119
|
-
*/
|
|
1120
|
-
from<TBase extends {
|
|
1121
|
-
new (): HTMLElement;
|
|
1122
|
-
prototype: HTMLElement;
|
|
1123
|
-
}>(BaseType: TBase): new () => InstanceType<TBase> & FASTElement;
|
|
1124
|
-
/**
|
|
1125
|
-
* Defines a platform custom element based on the provided type and definition.
|
|
1126
|
-
* @param type - The custom element type to define.
|
|
1127
|
-
* @param nameOrDef - The name of the element to define or a definition object
|
|
1128
|
-
* that describes the element to define.
|
|
1129
|
-
*/
|
|
1130
|
-
define<TType extends Constructable<HTMLElement>>(type: TType, nameOrDef?: string | PartialFASTElementDefinition): TType;
|
|
1131
|
-
/**
|
|
1132
|
-
* Defines metadata for a FASTElement which can be used to later define the element.
|
|
1133
|
-
* IMPORTANT: This API will be renamed to "compose" in a future beta.
|
|
1134
|
-
* @public
|
|
1135
|
-
*/
|
|
1136
|
-
metadata<TType_1 extends Constructable<HTMLElement> = Constructable<HTMLElement>>(type: TType_1, nameOrDef?: string | PartialFASTElementDefinition): FASTElementDefinition<TType_1>;
|
|
1137
|
+
export declare const FASTElement: {
|
|
1138
|
+
new (): FASTElement;
|
|
1139
|
+
define: typeof define;
|
|
1140
|
+
compose: typeof compose;
|
|
1141
|
+
from: typeof from;
|
|
1137
1142
|
};
|
|
1138
1143
|
|
|
1139
1144
|
/**
|
|
@@ -1141,7 +1146,7 @@ export declare const FASTElement: (new () => HTMLElement & FASTElement) & {
|
|
|
1141
1146
|
* @public
|
|
1142
1147
|
*/
|
|
1143
1148
|
export declare class FASTElementDefinition<TType extends Constructable<HTMLElement> = Constructable<HTMLElement>> {
|
|
1144
|
-
private
|
|
1149
|
+
private platformDefined;
|
|
1145
1150
|
/**
|
|
1146
1151
|
* The type this element definition describes.
|
|
1147
1152
|
*/
|
|
@@ -1177,18 +1182,16 @@ export declare class FASTElementDefinition<TType extends Constructable<HTMLEleme
|
|
|
1177
1182
|
/**
|
|
1178
1183
|
* Options controlling the creation of the custom element's shadow DOM.
|
|
1179
1184
|
*/
|
|
1180
|
-
readonly shadowOptions?:
|
|
1185
|
+
readonly shadowOptions?: ShadowRootOptions;
|
|
1181
1186
|
/**
|
|
1182
1187
|
* Options controlling how the custom element is defined with the platform.
|
|
1183
1188
|
*/
|
|
1184
|
-
readonly elementOptions
|
|
1189
|
+
readonly elementOptions: ElementDefinitionOptions;
|
|
1185
1190
|
/**
|
|
1186
|
-
*
|
|
1187
|
-
* @param type - The type this definition is being created for.
|
|
1188
|
-
* @param nameOrConfig - The name of the element to define or a config object
|
|
1189
|
-
* that describes the element to define.
|
|
1191
|
+
* The registry to register this component in by default.
|
|
1190
1192
|
*/
|
|
1191
|
-
|
|
1193
|
+
readonly registry: CustomElementRegistry;
|
|
1194
|
+
private constructor();
|
|
1192
1195
|
/**
|
|
1193
1196
|
* Defines a custom element based on this definition.
|
|
1194
1197
|
* @param registry - The element registry to define the element in.
|
|
@@ -1196,6 +1199,14 @@ export declare class FASTElementDefinition<TType extends Constructable<HTMLEleme
|
|
|
1196
1199
|
* This operation is idempotent per registry.
|
|
1197
1200
|
*/
|
|
1198
1201
|
define(registry?: CustomElementRegistry): this;
|
|
1202
|
+
/**
|
|
1203
|
+
* Creates an instance of FASTElementDefinition.
|
|
1204
|
+
* @param type - The type this definition is being created for.
|
|
1205
|
+
* @param nameOrDef - The name of the element to define or a config object
|
|
1206
|
+
* that describes the element to define.
|
|
1207
|
+
*/
|
|
1208
|
+
static compose<TType extends Constructable<HTMLElement> = Constructable<HTMLElement>>(type: TType, nameOrDef?: string | PartialFASTElementDefinition): FASTElementDefinition<TType>;
|
|
1209
|
+
/* Excluded from this release type: registerBaseType */
|
|
1199
1210
|
/**
|
|
1200
1211
|
* Gets the element definition associated with the specified type.
|
|
1201
1212
|
* @param type - The custom element type to retrieve the definition for.
|
|
@@ -1208,7 +1219,114 @@ export declare class FASTElementDefinition<TType extends Constructable<HTMLEleme
|
|
|
1208
1219
|
static readonly getForInstance: (object: any) => FASTElementDefinition<Constructable<HTMLElement>> | undefined;
|
|
1209
1220
|
}
|
|
1210
1221
|
|
|
1211
|
-
|
|
1222
|
+
/**
|
|
1223
|
+
* The FAST global.
|
|
1224
|
+
* @public
|
|
1225
|
+
*/
|
|
1226
|
+
export declare interface FASTGlobal {
|
|
1227
|
+
/**
|
|
1228
|
+
* The list of loaded versions.
|
|
1229
|
+
*/
|
|
1230
|
+
readonly versions: string[];
|
|
1231
|
+
/**
|
|
1232
|
+
* Gets a kernel value.
|
|
1233
|
+
* @param id - The id to get the value for.
|
|
1234
|
+
* @param initialize - Creates the initial value for the id if not already existing.
|
|
1235
|
+
*/
|
|
1236
|
+
getById<T>(id: string | number): T | null;
|
|
1237
|
+
getById<T>(id: string | number, initialize: () => T): T;
|
|
1238
|
+
/**
|
|
1239
|
+
* Sends a warning to the developer.
|
|
1240
|
+
* @param code - The warning code to send.
|
|
1241
|
+
* @param values - Values relevant for the warning message.
|
|
1242
|
+
*/
|
|
1243
|
+
warn(code: number, values?: Record<string, any>): void;
|
|
1244
|
+
/**
|
|
1245
|
+
* Creates an error.
|
|
1246
|
+
* @param code - The error code to send.
|
|
1247
|
+
* @param values - Values relevant for the error message.
|
|
1248
|
+
*/
|
|
1249
|
+
error(code: number, values?: Record<string, any>): Error;
|
|
1250
|
+
/**
|
|
1251
|
+
* Adds debug messages for errors and warnings.
|
|
1252
|
+
* @param messages - The message dictionary to add.
|
|
1253
|
+
* @remarks
|
|
1254
|
+
* Message can include placeholders like $\{name\} which can be
|
|
1255
|
+
* replaced by values passed at runtime.
|
|
1256
|
+
*/
|
|
1257
|
+
addMessages(messages: Record<number, string>): void;
|
|
1258
|
+
}
|
|
1259
|
+
|
|
1260
|
+
declare function from<TBase extends typeof HTMLElement>(BaseType: TBase): new () => InstanceType<TBase> & FASTElement;
|
|
1261
|
+
|
|
1262
|
+
/**
|
|
1263
|
+
* Represents an object that can contribute behavior to a host.
|
|
1264
|
+
* @public
|
|
1265
|
+
*/
|
|
1266
|
+
export declare interface HostBehavior<TSource = any> {
|
|
1267
|
+
/**
|
|
1268
|
+
* Executed when this behavior is attached to a controller.
|
|
1269
|
+
* @param controller - Controls the behavior lifecycle.
|
|
1270
|
+
*/
|
|
1271
|
+
addedCallback?(controller: HostController<TSource>): void;
|
|
1272
|
+
/**
|
|
1273
|
+
* Executed when this behavior is detached from a controller.
|
|
1274
|
+
* @param controller - Controls the behavior lifecycle.
|
|
1275
|
+
*/
|
|
1276
|
+
removedCallback?(controller: HostController<TSource>): void;
|
|
1277
|
+
/**
|
|
1278
|
+
* Executed when this behavior's host is connected.
|
|
1279
|
+
* @param controller - Controls the behavior lifecycle.
|
|
1280
|
+
*/
|
|
1281
|
+
connectedCallback?(controller: HostController<TSource>): void;
|
|
1282
|
+
/**
|
|
1283
|
+
* Executed when this behavior's host is disconnected.
|
|
1284
|
+
* @param controller - Controls the behavior lifecycle.
|
|
1285
|
+
*/
|
|
1286
|
+
disconnectedCallback?(controller: HostController<TSource>): void;
|
|
1287
|
+
}
|
|
1288
|
+
|
|
1289
|
+
/**
|
|
1290
|
+
* Controls the lifecycle and context of behaviors and styles
|
|
1291
|
+
* associated with a component host.
|
|
1292
|
+
* @public
|
|
1293
|
+
*/
|
|
1294
|
+
export declare interface HostController<TSource = any> {
|
|
1295
|
+
/**
|
|
1296
|
+
* The component source.
|
|
1297
|
+
*/
|
|
1298
|
+
readonly source: TSource;
|
|
1299
|
+
/**
|
|
1300
|
+
* Indicates whether the host is connected or not.
|
|
1301
|
+
*/
|
|
1302
|
+
readonly isConnected: boolean;
|
|
1303
|
+
/**
|
|
1304
|
+
* The main set of styles used for the component, independent
|
|
1305
|
+
* of any behavior-specific styles.
|
|
1306
|
+
*/
|
|
1307
|
+
mainStyles: ElementStyles | null;
|
|
1308
|
+
/**
|
|
1309
|
+
* Adds the behavior to the component.
|
|
1310
|
+
* @param behavior - The behavior to add.
|
|
1311
|
+
*/
|
|
1312
|
+
addBehavior(behavior: HostBehavior<TSource>): void;
|
|
1313
|
+
/**
|
|
1314
|
+
* Removes the behavior from the component.
|
|
1315
|
+
* @param behavior - The behavior to remove.
|
|
1316
|
+
* @param force - Forces removal even if this behavior was added more than once.
|
|
1317
|
+
*/
|
|
1318
|
+
removeBehavior(behavior: HostBehavior<TSource>, force?: boolean): void;
|
|
1319
|
+
/**
|
|
1320
|
+
* Adds styles to this element. Providing an HTMLStyleElement will attach the element instance to the shadowRoot.
|
|
1321
|
+
* @param styles - The styles to add.
|
|
1322
|
+
*/
|
|
1323
|
+
addStyles(styles: ElementStyles | HTMLStyleElement | null | undefined): void;
|
|
1324
|
+
/**
|
|
1325
|
+
* Removes styles from this element. Providing an HTMLStyleElement will detach the element instance from the shadowRoot.
|
|
1326
|
+
* @param styles - the styles to remove.
|
|
1327
|
+
*/
|
|
1328
|
+
removeStyles(styles: ElementStyles | HTMLStyleElement | null | undefined): void;
|
|
1329
|
+
}
|
|
1212
1330
|
|
|
1213
1331
|
/**
|
|
1214
1332
|
* Transforms a template literal string into a ViewTemplate.
|
|
@@ -1219,17 +1337,16 @@ export declare class FASTElementDefinition<TType extends Constructable<HTMLEleme
|
|
|
1219
1337
|
* other template instances, and Directive instances.
|
|
1220
1338
|
* @public
|
|
1221
1339
|
*/
|
|
1222
|
-
export declare
|
|
1340
|
+
export declare const html: HTMLTemplateTag;
|
|
1223
1341
|
|
|
1224
1342
|
/**
|
|
1225
1343
|
* A directive that applies bindings.
|
|
1226
1344
|
* @public
|
|
1227
1345
|
*/
|
|
1228
|
-
export declare class HTMLBindingDirective implements HTMLDirective, ViewBehaviorFactory, Aspected {
|
|
1229
|
-
|
|
1230
|
-
|
|
1231
|
-
|
|
1232
|
-
private factory;
|
|
1346
|
+
export declare class HTMLBindingDirective implements HTMLDirective, ViewBehaviorFactory, ViewBehavior, Aspected {
|
|
1347
|
+
dataBinding: Binding;
|
|
1348
|
+
private data;
|
|
1349
|
+
private updateTarget;
|
|
1233
1350
|
/**
|
|
1234
1351
|
* The unique id of the factory.
|
|
1235
1352
|
*/
|
|
@@ -1237,7 +1354,15 @@ export declare class HTMLBindingDirective implements HTMLDirective, ViewBehavior
|
|
|
1237
1354
|
/**
|
|
1238
1355
|
* The structural id of the DOM node to which the created behavior will apply.
|
|
1239
1356
|
*/
|
|
1240
|
-
|
|
1357
|
+
targetNodeId: string;
|
|
1358
|
+
/**
|
|
1359
|
+
* The tagname associated with the target node.
|
|
1360
|
+
*/
|
|
1361
|
+
targetTagName: string | null;
|
|
1362
|
+
/**
|
|
1363
|
+
* The policy that the created behavior must run under.
|
|
1364
|
+
*/
|
|
1365
|
+
policy: DOMPolicy;
|
|
1241
1366
|
/**
|
|
1242
1367
|
* The original source aspect exactly as represented in markup.
|
|
1243
1368
|
*/
|
|
@@ -1249,14 +1374,12 @@ export declare class HTMLBindingDirective implements HTMLDirective, ViewBehavior
|
|
|
1249
1374
|
/**
|
|
1250
1375
|
* The type of aspect to target.
|
|
1251
1376
|
*/
|
|
1252
|
-
aspectType:
|
|
1377
|
+
aspectType: DOMAspect;
|
|
1253
1378
|
/**
|
|
1254
1379
|
* Creates an instance of HTMLBindingDirective.
|
|
1255
|
-
* @param
|
|
1256
|
-
* @param mode - The binding mode to use when applying the binding.
|
|
1257
|
-
* @param options - The options to configure the binding with.
|
|
1380
|
+
* @param dataBinding - The binding configuration to apply.
|
|
1258
1381
|
*/
|
|
1259
|
-
constructor(
|
|
1382
|
+
constructor(dataBinding: Binding);
|
|
1260
1383
|
/**
|
|
1261
1384
|
* Creates HTML to be used within a template.
|
|
1262
1385
|
* @param add - Can be used to add behavior factories to a template.
|
|
@@ -1264,9 +1387,12 @@ export declare class HTMLBindingDirective implements HTMLDirective, ViewBehavior
|
|
|
1264
1387
|
createHTML(add: AddViewBehaviorFactory): string;
|
|
1265
1388
|
/**
|
|
1266
1389
|
* Creates a behavior.
|
|
1267
|
-
* @param targets - The targets available for behaviors to be attached to.
|
|
1268
1390
|
*/
|
|
1269
|
-
createBehavior(
|
|
1391
|
+
createBehavior(): ViewBehavior;
|
|
1392
|
+
/* Excluded from this release type: bind */
|
|
1393
|
+
/* Excluded from this release type: unbind */
|
|
1394
|
+
/* Excluded from this release type: handleEvent */
|
|
1395
|
+
/* Excluded from this release type: handleChange */
|
|
1270
1396
|
}
|
|
1271
1397
|
|
|
1272
1398
|
/**
|
|
@@ -1301,7 +1427,15 @@ export declare const HTMLDirective: Readonly<{
|
|
|
1301
1427
|
* @param type - The type to define as a directive.
|
|
1302
1428
|
* @param options - Options that specify the directive's application.
|
|
1303
1429
|
*/
|
|
1304
|
-
define<TType extends Constructable<HTMLDirective>>(type: TType, options?: PartialHTMLDirectiveDefinition): TType;
|
|
1430
|
+
define<TType extends Constructable<HTMLDirective>>(type: TType, options?: PartialHTMLDirectiveDefinition): TType;
|
|
1431
|
+
/**
|
|
1432
|
+
*
|
|
1433
|
+
* @param directive - The directive to assign the aspect to.
|
|
1434
|
+
* @param value - The value to base the aspect determination on.
|
|
1435
|
+
* @remarks
|
|
1436
|
+
* If a falsy value is provided, then the content aspect will be assigned.
|
|
1437
|
+
*/
|
|
1438
|
+
assignAspect(directive: Aspected, value?: string): void;
|
|
1305
1439
|
}>;
|
|
1306
1440
|
|
|
1307
1441
|
/**
|
|
@@ -1334,23 +1468,103 @@ export declare interface HTMLTemplateCompilationResult<TSource = any, TParent =
|
|
|
1334
1468
|
createView(hostBindingTarget?: Element): HTMLView<TSource, TParent>;
|
|
1335
1469
|
}
|
|
1336
1470
|
|
|
1471
|
+
/**
|
|
1472
|
+
* Transforms a template literal string into a ViewTemplate.
|
|
1473
|
+
* @param strings - The string fragments that are interpolated with the values.
|
|
1474
|
+
* @param values - The values that are interpolated with the string fragments.
|
|
1475
|
+
* @remarks
|
|
1476
|
+
* The html helper supports interpolation of strings, numbers, binding expressions,
|
|
1477
|
+
* other template instances, and Directive instances.
|
|
1478
|
+
* @public
|
|
1479
|
+
*/
|
|
1480
|
+
export declare type HTMLTemplateTag = (<TSource = any, TParent = any>(strings: TemplateStringsArray, ...values: TemplateValue<TSource, TParent>[]) => ViewTemplate<TSource, TParent>) & {
|
|
1481
|
+
/**
|
|
1482
|
+
* Transforms a template literal string into partial HTML.
|
|
1483
|
+
* @param html - The HTML string fragment to interpolate.
|
|
1484
|
+
* @public
|
|
1485
|
+
*/
|
|
1486
|
+
partial(html: string): InlineTemplateDirective;
|
|
1487
|
+
};
|
|
1488
|
+
|
|
1337
1489
|
/**
|
|
1338
1490
|
* The standard View implementation, which also implements ElementView and SyntheticView.
|
|
1339
1491
|
* @public
|
|
1340
1492
|
*/
|
|
1341
|
-
export declare class HTMLView<TSource = any, TParent = any> implements ElementView<TSource, TParent>, SyntheticView<TSource, TParent> {
|
|
1493
|
+
export declare class HTMLView<TSource = any, TParent = any> implements ElementView<TSource, TParent>, SyntheticView<TSource, TParent>, ExecutionContext<TParent> {
|
|
1342
1494
|
private fragment;
|
|
1343
1495
|
private factories;
|
|
1344
|
-
|
|
1496
|
+
readonly targets: ViewBehaviorTargets;
|
|
1345
1497
|
private behaviors;
|
|
1498
|
+
private unbindables;
|
|
1346
1499
|
/**
|
|
1347
1500
|
* The data that the view is bound to.
|
|
1348
1501
|
*/
|
|
1349
1502
|
source: TSource | null;
|
|
1503
|
+
/**
|
|
1504
|
+
* Indicates whether the controller is bound.
|
|
1505
|
+
*/
|
|
1506
|
+
isBound: boolean;
|
|
1507
|
+
/**
|
|
1508
|
+
* Indicates how the source's lifetime relates to the controller's lifetime.
|
|
1509
|
+
*/
|
|
1510
|
+
readonly sourceLifetime: SourceLifetime;
|
|
1350
1511
|
/**
|
|
1351
1512
|
* The execution context the view is running within.
|
|
1352
1513
|
*/
|
|
1353
|
-
context: ExecutionContext<TParent
|
|
1514
|
+
context: ExecutionContext<TParent>;
|
|
1515
|
+
/**
|
|
1516
|
+
* The index of the current item within a repeat context.
|
|
1517
|
+
*/
|
|
1518
|
+
index: number;
|
|
1519
|
+
/**
|
|
1520
|
+
* The length of the current collection within a repeat context.
|
|
1521
|
+
*/
|
|
1522
|
+
length: number;
|
|
1523
|
+
/**
|
|
1524
|
+
* The parent data source within a nested context.
|
|
1525
|
+
*/
|
|
1526
|
+
readonly parent: TParent;
|
|
1527
|
+
/**
|
|
1528
|
+
* The parent execution context when in nested context scenarios.
|
|
1529
|
+
*/
|
|
1530
|
+
readonly parentContext: ExecutionContext<TParent>;
|
|
1531
|
+
/**
|
|
1532
|
+
* The current event within an event handler.
|
|
1533
|
+
*/
|
|
1534
|
+
get event(): Event;
|
|
1535
|
+
/**
|
|
1536
|
+
* Indicates whether the current item within a repeat context
|
|
1537
|
+
* has an even index.
|
|
1538
|
+
*/
|
|
1539
|
+
get isEven(): boolean;
|
|
1540
|
+
/**
|
|
1541
|
+
* Indicates whether the current item within a repeat context
|
|
1542
|
+
* has an odd index.
|
|
1543
|
+
*/
|
|
1544
|
+
get isOdd(): boolean;
|
|
1545
|
+
/**
|
|
1546
|
+
* Indicates whether the current item within a repeat context
|
|
1547
|
+
* is the first item in the collection.
|
|
1548
|
+
*/
|
|
1549
|
+
get isFirst(): boolean;
|
|
1550
|
+
/**
|
|
1551
|
+
* Indicates whether the current item within a repeat context
|
|
1552
|
+
* is somewhere in the middle of the collection.
|
|
1553
|
+
*/
|
|
1554
|
+
get isInMiddle(): boolean;
|
|
1555
|
+
/**
|
|
1556
|
+
* Indicates whether the current item within a repeat context
|
|
1557
|
+
* is the last item in the collection.
|
|
1558
|
+
*/
|
|
1559
|
+
get isLast(): boolean;
|
|
1560
|
+
/**
|
|
1561
|
+
* Returns the typed event detail of a custom event.
|
|
1562
|
+
*/
|
|
1563
|
+
eventDetail<TDetail>(): TDetail;
|
|
1564
|
+
/**
|
|
1565
|
+
* Returns the typed event target of the event.
|
|
1566
|
+
*/
|
|
1567
|
+
eventTarget<TTarget extends EventTarget>(): TTarget;
|
|
1354
1568
|
/**
|
|
1355
1569
|
* The first DOM node in the range of nodes that make up the view.
|
|
1356
1570
|
*/
|
|
@@ -1364,7 +1578,7 @@ export declare class HTMLView<TSource = any, TParent = any> implements ElementVi
|
|
|
1364
1578
|
* @param fragment - The html fragment that contains the nodes for this view.
|
|
1365
1579
|
* @param behaviors - The behaviors to be applied to this view.
|
|
1366
1580
|
*/
|
|
1367
|
-
constructor(fragment: DocumentFragment, factories: ReadonlyArray<
|
|
1581
|
+
constructor(fragment: DocumentFragment, factories: ReadonlyArray<CompiledViewBehaviorFactory>, targets: ViewBehaviorTargets);
|
|
1368
1582
|
/**
|
|
1369
1583
|
* Appends the view's DOM nodes to the referenced node.
|
|
1370
1584
|
* @param node - The parent node to append the view's DOM nodes to.
|
|
@@ -1385,16 +1599,21 @@ export declare class HTMLView<TSource = any, TParent = any> implements ElementVi
|
|
|
1385
1599
|
* Once a view has been disposed, it cannot be inserted or bound again.
|
|
1386
1600
|
*/
|
|
1387
1601
|
dispose(): void;
|
|
1602
|
+
onUnbind(behavior: {
|
|
1603
|
+
unbind(controller: ViewController<TSource, TParent>): any;
|
|
1604
|
+
}): void;
|
|
1388
1605
|
/**
|
|
1389
1606
|
* Binds a view's behaviors to its binding source.
|
|
1390
1607
|
* @param source - The binding source for the view's binding behaviors.
|
|
1391
1608
|
* @param context - The execution context to run the behaviors within.
|
|
1392
1609
|
*/
|
|
1393
|
-
bind(source: TSource, context
|
|
1610
|
+
bind(source: TSource, context?: ExecutionContext<TParent>): void;
|
|
1394
1611
|
/**
|
|
1395
1612
|
* Unbinds a view's behaviors from its binding source.
|
|
1396
1613
|
*/
|
|
1397
1614
|
unbind(): void;
|
|
1615
|
+
/* Excluded from this release type: toJSON */
|
|
1616
|
+
private evaluateUnbindables;
|
|
1398
1617
|
/**
|
|
1399
1618
|
* Efficiently disposes of a contiguous range of synthetic view instances.
|
|
1400
1619
|
* @param views - A contiguous range of views to be disposed.
|
|
@@ -1402,6 +1621,29 @@ export declare class HTMLView<TSource = any, TParent = any> implements ElementVi
|
|
|
1402
1621
|
static disposeContiguousBatch(views: SyntheticView[]): void;
|
|
1403
1622
|
}
|
|
1404
1623
|
|
|
1624
|
+
/**
|
|
1625
|
+
* Inlines a template into another template.
|
|
1626
|
+
* @public
|
|
1627
|
+
*/
|
|
1628
|
+
export declare class InlineTemplateDirective implements HTMLDirective {
|
|
1629
|
+
private html;
|
|
1630
|
+
private factories;
|
|
1631
|
+
/**
|
|
1632
|
+
* An empty template partial.
|
|
1633
|
+
*/
|
|
1634
|
+
static readonly empty: InlineTemplateDirective;
|
|
1635
|
+
/**
|
|
1636
|
+
* Creates an instance of InlineTemplateDirective.
|
|
1637
|
+
* @param template - The template to inline.
|
|
1638
|
+
*/
|
|
1639
|
+
constructor(html: string, factories?: Record<string, ViewBehaviorFactory>);
|
|
1640
|
+
/**
|
|
1641
|
+
* Creates HTML to be used within a template.
|
|
1642
|
+
* @param add - Can be used to add behavior factories to a template.
|
|
1643
|
+
*/
|
|
1644
|
+
createHTML(add: AddViewBehaviorFactory): string;
|
|
1645
|
+
}
|
|
1646
|
+
|
|
1405
1647
|
/**
|
|
1406
1648
|
* Observes array lengths.
|
|
1407
1649
|
* @public
|
|
@@ -1421,6 +1663,15 @@ export declare interface LengthObserver extends Subscriber {
|
|
|
1421
1663
|
*/
|
|
1422
1664
|
export declare function lengthOf<T>(array: readonly T[]): number;
|
|
1423
1665
|
|
|
1666
|
+
/**
|
|
1667
|
+
* Creates an event listener binding.
|
|
1668
|
+
* @param expression - The binding to invoke when the event is raised.
|
|
1669
|
+
* @param options - Event listener options.
|
|
1670
|
+
* @returns A binding configuration.
|
|
1671
|
+
* @public
|
|
1672
|
+
*/
|
|
1673
|
+
export declare function listener<T = any>(expression: Expression<T>, options?: AddEventListenerOptions): Binding<T>;
|
|
1674
|
+
|
|
1424
1675
|
/**
|
|
1425
1676
|
* Common APIs related to markup generation.
|
|
1426
1677
|
* @public
|
|
@@ -1452,8 +1703,6 @@ export declare const Markup: Readonly<{
|
|
|
1452
1703
|
comment: (id: string) => string;
|
|
1453
1704
|
}>;
|
|
1454
1705
|
|
|
1455
|
-
/* Excluded from this release type: Mutable */
|
|
1456
|
-
|
|
1457
1706
|
/**
|
|
1458
1707
|
* Options for configuring node observation behavior.
|
|
1459
1708
|
* @public
|
|
@@ -1480,21 +1729,31 @@ export declare interface NodeBehaviorOptions<T = any> {
|
|
|
1480
1729
|
* Internally used by the SlottedDirective and the ChildrenDirective.
|
|
1481
1730
|
*/
|
|
1482
1731
|
export declare abstract class NodeObservationDirective<T extends NodeBehaviorOptions> extends StatelessAttachedAttributeDirective<T> {
|
|
1483
|
-
private
|
|
1732
|
+
private _id;
|
|
1733
|
+
private _controllerProperty;
|
|
1734
|
+
/**
|
|
1735
|
+
* The unique id of the factory.
|
|
1736
|
+
*/
|
|
1737
|
+
get id(): string;
|
|
1738
|
+
set id(value: string);
|
|
1739
|
+
/**
|
|
1740
|
+
* The structural id of the DOM node to which the created behavior will apply.
|
|
1741
|
+
*/
|
|
1742
|
+
targetNodeId: string;
|
|
1484
1743
|
/**
|
|
1485
1744
|
* Bind this behavior to the source.
|
|
1486
1745
|
* @param source - The source to bind to.
|
|
1487
1746
|
* @param context - The execution context that the binding is operating within.
|
|
1488
1747
|
* @param targets - The targets that behaviors in a view can attach to.
|
|
1489
1748
|
*/
|
|
1490
|
-
bind(
|
|
1749
|
+
bind(controller: ViewController): void;
|
|
1491
1750
|
/**
|
|
1492
1751
|
* Unbinds this behavior from the source.
|
|
1493
1752
|
* @param source - The source to unbind from.
|
|
1494
1753
|
* @param context - The execution context that the binding is operating within.
|
|
1495
1754
|
* @param targets - The targets that behaviors in a view can attach to.
|
|
1496
1755
|
*/
|
|
1497
|
-
unbind(
|
|
1756
|
+
unbind(controller: ViewController): void;
|
|
1498
1757
|
/**
|
|
1499
1758
|
* Gets the data source for the target.
|
|
1500
1759
|
* @param target - The target to get the source for.
|
|
@@ -1532,6 +1791,14 @@ export declare abstract class NodeObservationDirective<T extends NodeBehaviorOpt
|
|
|
1532
1791
|
protected abstract getNodes(target: any): Node[];
|
|
1533
1792
|
}
|
|
1534
1793
|
|
|
1794
|
+
/**
|
|
1795
|
+
* Normalizes the input value into a binding.
|
|
1796
|
+
* @param value - The value to create the default binding for.
|
|
1797
|
+
* @returns A binding configuration for the provided value.
|
|
1798
|
+
* @public
|
|
1799
|
+
*/
|
|
1800
|
+
export declare function normalizeBinding<TSource = any, TReturn = any, TParent = any>(value: Expression<TSource, TReturn, TParent> | Binding<TSource, TReturn, TParent> | {}): Binding<TSource, TReturn, TParent>;
|
|
1801
|
+
|
|
1535
1802
|
/**
|
|
1536
1803
|
* Provides change notifications for an observed subject.
|
|
1537
1804
|
* @public
|
|
@@ -1567,6 +1834,12 @@ export declare interface Notifier {
|
|
|
1567
1834
|
unsubscribe(subscriber: Subscriber, propertyToUnwatch?: any): void;
|
|
1568
1835
|
}
|
|
1569
1836
|
|
|
1837
|
+
/**
|
|
1838
|
+
* A {@link ValueConverter} that converts to and from `boolean` values. `null`, `undefined`, `""`, and `void` values are converted to `null`.
|
|
1839
|
+
* @public
|
|
1840
|
+
*/
|
|
1841
|
+
export declare const nullableBooleanConverter: ValueConverter;
|
|
1842
|
+
|
|
1570
1843
|
/**
|
|
1571
1844
|
* A {@link ValueConverter} that converts to and from `number` values.
|
|
1572
1845
|
* @remarks
|
|
@@ -1618,19 +1891,19 @@ export declare const Observable: Readonly<{
|
|
|
1618
1891
|
*/
|
|
1619
1892
|
getAccessors: (target: {}) => Accessor[];
|
|
1620
1893
|
/**
|
|
1621
|
-
* Creates a {@link
|
|
1622
|
-
* provided {@link
|
|
1623
|
-
* @param
|
|
1894
|
+
* Creates a {@link ExpressionNotifier} that can watch the
|
|
1895
|
+
* provided {@link Expression} for changes.
|
|
1896
|
+
* @param expression - The binding to observe.
|
|
1624
1897
|
* @param initialSubscriber - An initial subscriber to changes in the binding value.
|
|
1625
1898
|
* @param isVolatileBinding - Indicates whether the binding's dependency list must be re-evaluated on every value evaluation.
|
|
1626
1899
|
*/
|
|
1627
|
-
binding<TSource = any, TReturn = any>(
|
|
1900
|
+
binding<TSource = any, TReturn = any>(expression: Expression<TSource, TReturn, any>, initialSubscriber?: Subscriber, isVolatileBinding?: boolean): ExpressionNotifier<TSource, TReturn, any>;
|
|
1628
1901
|
/**
|
|
1629
1902
|
* Determines whether a binding expression is volatile and needs to have its dependency list re-evaluated
|
|
1630
1903
|
* on every evaluation of the value.
|
|
1631
|
-
* @param
|
|
1904
|
+
* @param expression - The binding to inspect.
|
|
1632
1905
|
*/
|
|
1633
|
-
isVolatileBinding<TSource_1 = any, TReturn_1 = any>(
|
|
1906
|
+
isVolatileBinding<TSource_1 = any, TReturn_1 = any>(expression: Expression<TSource_1, TReturn_1, any>): boolean;
|
|
1634
1907
|
}>;
|
|
1635
1908
|
|
|
1636
1909
|
/**
|
|
@@ -1657,30 +1930,13 @@ export declare interface ObservationRecord {
|
|
|
1657
1930
|
}
|
|
1658
1931
|
|
|
1659
1932
|
/**
|
|
1660
|
-
*
|
|
1661
|
-
* @
|
|
1662
|
-
|
|
1663
|
-
|
|
1664
|
-
|
|
1665
|
-
/**
|
|
1666
|
-
* The default onTime binding configuration.
|
|
1667
|
-
* @public
|
|
1668
|
-
*/
|
|
1669
|
-
export declare const oneTime: BindingConfig<AddEventListenerOptions> & BindingConfigResolver<AddEventListenerOptions>;
|
|
1670
|
-
|
|
1671
|
-
/**
|
|
1672
|
-
* A binding behavior for one-time bindings.
|
|
1933
|
+
* Creates a one time binding
|
|
1934
|
+
* @param expression - The binding to refresh when signaled.
|
|
1935
|
+
* @param policy - The security policy to associate with th binding.
|
|
1936
|
+
* @returns A binding configuration.
|
|
1673
1937
|
* @public
|
|
1674
1938
|
*/
|
|
1675
|
-
export declare
|
|
1676
|
-
/**
|
|
1677
|
-
* Bind this behavior to the source.
|
|
1678
|
-
* @param source - The source to bind to.
|
|
1679
|
-
* @param context - The execution context that the binding is operating within.
|
|
1680
|
-
* @param targets - The targets that behaviors in a view can attach to.
|
|
1681
|
-
*/
|
|
1682
|
-
bind(source: any, context: ExecutionContext, targets: ViewBehaviorTargets): void;
|
|
1683
|
-
}
|
|
1939
|
+
export declare function oneTime<T = any>(expression: Expression<T>, policy?: DOMPolicy): Binding<T>;
|
|
1684
1940
|
|
|
1685
1941
|
/**
|
|
1686
1942
|
* Common APIs related to content parsing.
|
|
@@ -1721,12 +1977,21 @@ export declare interface PartialFASTElementDefinition {
|
|
|
1721
1977
|
readonly attributes?: (AttributeConfiguration | string)[];
|
|
1722
1978
|
/**
|
|
1723
1979
|
* Options controlling the creation of the custom element's shadow DOM.
|
|
1980
|
+
* @remarks
|
|
1981
|
+
* If not provided, defaults to an open shadow root. Provide null
|
|
1982
|
+
* to render to the associated template to the light DOM instead.
|
|
1724
1983
|
*/
|
|
1725
|
-
readonly shadowOptions?: Partial<
|
|
1984
|
+
readonly shadowOptions?: Partial<ShadowRootOptions> | null;
|
|
1726
1985
|
/**
|
|
1727
1986
|
* Options controlling how the custom element is defined with the platform.
|
|
1728
1987
|
*/
|
|
1729
1988
|
readonly elementOptions?: ElementDefinitionOptions;
|
|
1989
|
+
/**
|
|
1990
|
+
* The registry to register this component in by default.
|
|
1991
|
+
* @remarks
|
|
1992
|
+
* If not provided, defaults to the global registry.
|
|
1993
|
+
*/
|
|
1994
|
+
readonly registry?: CustomElementRegistry;
|
|
1730
1995
|
}
|
|
1731
1996
|
|
|
1732
1997
|
/**
|
|
@@ -1782,7 +2047,7 @@ export declare class PropertyChangeNotifier implements Notifier {
|
|
|
1782
2047
|
* @param propertyName - The name of the property to assign the reference to.
|
|
1783
2048
|
* @public
|
|
1784
2049
|
*/
|
|
1785
|
-
export declare const ref: <
|
|
2050
|
+
export declare const ref: <TSource = any, TParent = any>(propertyName: keyof TSource & string) => CaptureType<TSource, TParent>;
|
|
1786
2051
|
|
|
1787
2052
|
/**
|
|
1788
2053
|
* The runtime behavior for template references.
|
|
@@ -1790,69 +2055,60 @@ export declare const ref: <T = any>(propertyName: keyof T & string) => CaptureTy
|
|
|
1790
2055
|
*/
|
|
1791
2056
|
export declare class RefDirective extends StatelessAttachedAttributeDirective<string> {
|
|
1792
2057
|
/**
|
|
1793
|
-
*
|
|
1794
|
-
* @param source - The source to bind to.
|
|
1795
|
-
* @param context - The execution context that the binding is operating within.
|
|
1796
|
-
* @param targets - The targets that behaviors in a view can attach to.
|
|
2058
|
+
* The structural id of the DOM node to which the created behavior will apply.
|
|
1797
2059
|
*/
|
|
1798
|
-
|
|
2060
|
+
targetNodeId: string;
|
|
1799
2061
|
/**
|
|
1800
|
-
*
|
|
1801
|
-
* @param
|
|
2062
|
+
* Bind this behavior.
|
|
2063
|
+
* @param controller - The view controller that manages the lifecycle of this behavior.
|
|
1802
2064
|
*/
|
|
1803
|
-
|
|
2065
|
+
bind(controller: ViewController): void;
|
|
1804
2066
|
}
|
|
1805
2067
|
|
|
1806
2068
|
declare const reflectMode = "reflect";
|
|
1807
2069
|
|
|
1808
2070
|
/**
|
|
1809
2071
|
* A directive that enables list rendering.
|
|
1810
|
-
* @param
|
|
1811
|
-
* @param
|
|
2072
|
+
* @param items - The array to render.
|
|
2073
|
+
* @param template - The template or a template binding used obtain a template
|
|
1812
2074
|
* to render for each item in the array.
|
|
1813
2075
|
* @param options - Options used to turn on special repeat features.
|
|
1814
2076
|
* @public
|
|
1815
2077
|
*/
|
|
1816
|
-
export declare function repeat<TSource = any, TArray extends ReadonlyArray<any> = ReadonlyArray<any
|
|
2078
|
+
export declare function repeat<TSource = any, TArray extends ReadonlyArray<any> = ReadonlyArray<any>, TParent = any>(items: Expression<TSource, TArray, TParent> | Binding<TSource, TArray, TParent> | ReadonlyArray<any>, template: Expression<TSource, ViewTemplate<any, TSource>> | Binding<TSource, ViewTemplate<any, TSource>> | ViewTemplate<any, TSource>, options?: RepeatOptions): CaptureType<TSource, TParent>;
|
|
1817
2079
|
|
|
1818
2080
|
/**
|
|
1819
2081
|
* A behavior that renders a template for each item in an array.
|
|
1820
2082
|
* @public
|
|
1821
2083
|
*/
|
|
1822
|
-
export declare class RepeatBehavior<TSource = any> implements
|
|
2084
|
+
export declare class RepeatBehavior<TSource = any> implements ViewBehavior, Subscriber {
|
|
2085
|
+
private directive;
|
|
1823
2086
|
private location;
|
|
1824
|
-
private
|
|
1825
|
-
private templateBinding;
|
|
1826
|
-
private options;
|
|
1827
|
-
private source;
|
|
1828
|
-
private views;
|
|
2087
|
+
private controller;
|
|
1829
2088
|
private template;
|
|
1830
2089
|
private templateBindingObserver;
|
|
1831
2090
|
private items;
|
|
1832
2091
|
private itemsObserver;
|
|
1833
2092
|
private itemsBindingObserver;
|
|
1834
|
-
private context;
|
|
1835
|
-
private childContext;
|
|
1836
2093
|
private bindView;
|
|
2094
|
+
/* Excluded from this release type: views */
|
|
1837
2095
|
/**
|
|
1838
2096
|
* Creates an instance of RepeatBehavior.
|
|
1839
2097
|
* @param location - The location in the DOM to render the repeat.
|
|
1840
|
-
* @param
|
|
2098
|
+
* @param dataBinding - The array to render.
|
|
1841
2099
|
* @param isItemsBindingVolatile - Indicates whether the items binding has volatile dependencies.
|
|
1842
2100
|
* @param templateBinding - The template to render for each item.
|
|
1843
2101
|
* @param isTemplateBindingVolatile - Indicates whether the template binding has volatile dependencies.
|
|
1844
2102
|
* @param options - Options used to turn on special repeat features.
|
|
1845
2103
|
*/
|
|
1846
|
-
constructor(
|
|
2104
|
+
constructor(directive: RepeatDirective);
|
|
1847
2105
|
/**
|
|
1848
|
-
* Bind this behavior
|
|
1849
|
-
* @param
|
|
1850
|
-
* @param context - The execution context that the binding is operating within.
|
|
2106
|
+
* Bind this behavior.
|
|
2107
|
+
* @param controller - The view controller that manages the lifecycle of this behavior.
|
|
1851
2108
|
*/
|
|
1852
|
-
bind(
|
|
2109
|
+
bind(controller: ViewController): void;
|
|
1853
2110
|
/**
|
|
1854
|
-
* Unbinds this behavior
|
|
1855
|
-
* @param source - The source to unbind from.
|
|
2111
|
+
* Unbinds this behavior.
|
|
1856
2112
|
*/
|
|
1857
2113
|
unbind(): void;
|
|
1858
2114
|
/**
|
|
@@ -1860,7 +2116,7 @@ export declare class RepeatBehavior<TSource = any> implements Behavior, Subscrib
|
|
|
1860
2116
|
* @param source - The source of the change.
|
|
1861
2117
|
* @param args - The details about what was changed.
|
|
1862
2118
|
*/
|
|
1863
|
-
handleChange(source: any, args: Splice[]): void;
|
|
2119
|
+
handleChange(source: any, args: Splice[] | ExpressionObserver): void;
|
|
1864
2120
|
private observeItems;
|
|
1865
2121
|
private updateViews;
|
|
1866
2122
|
private refreshAllViews;
|
|
@@ -1872,19 +2128,13 @@ export declare class RepeatBehavior<TSource = any> implements Behavior, Subscrib
|
|
|
1872
2128
|
* @public
|
|
1873
2129
|
*/
|
|
1874
2130
|
export declare class RepeatDirective<TSource = any> implements HTMLDirective, ViewBehaviorFactory {
|
|
1875
|
-
readonly
|
|
2131
|
+
readonly dataBinding: Binding<TSource>;
|
|
1876
2132
|
readonly templateBinding: Binding<TSource, SyntheticViewTemplate>;
|
|
1877
2133
|
readonly options: RepeatOptions;
|
|
1878
|
-
private isItemsBindingVolatile;
|
|
1879
|
-
private isTemplateBindingVolatile;
|
|
1880
|
-
/**
|
|
1881
|
-
* The unique id of the factory.
|
|
1882
|
-
*/
|
|
1883
|
-
id: string;
|
|
1884
2134
|
/**
|
|
1885
2135
|
* The structural id of the DOM node to which the created behavior will apply.
|
|
1886
2136
|
*/
|
|
1887
|
-
|
|
2137
|
+
targetNodeId: string;
|
|
1888
2138
|
/**
|
|
1889
2139
|
* Creates a placeholder string based on the directive's index within the template.
|
|
1890
2140
|
* @param index - The index of the directive within the template.
|
|
@@ -1892,16 +2142,16 @@ export declare class RepeatDirective<TSource = any> implements HTMLDirective, Vi
|
|
|
1892
2142
|
createHTML(add: AddViewBehaviorFactory): string;
|
|
1893
2143
|
/**
|
|
1894
2144
|
* Creates an instance of RepeatDirective.
|
|
1895
|
-
* @param
|
|
2145
|
+
* @param dataBinding - The binding that provides the array to render.
|
|
1896
2146
|
* @param templateBinding - The template binding used to obtain a template to render for each item in the array.
|
|
1897
2147
|
* @param options - Options used to turn on special repeat features.
|
|
1898
2148
|
*/
|
|
1899
|
-
constructor(
|
|
2149
|
+
constructor(dataBinding: Binding<TSource>, templateBinding: Binding<TSource, SyntheticViewTemplate>, options: RepeatOptions);
|
|
1900
2150
|
/**
|
|
1901
2151
|
* Creates a behavior for the provided target node.
|
|
1902
2152
|
* @param target - The node instance to create the behavior for.
|
|
1903
2153
|
*/
|
|
1904
|
-
createBehavior(
|
|
2154
|
+
createBehavior(): RepeatBehavior<TSource>;
|
|
1905
2155
|
}
|
|
1906
2156
|
|
|
1907
2157
|
/**
|
|
@@ -1919,13 +2169,26 @@ export declare interface RepeatOptions {
|
|
|
1919
2169
|
recycle?: boolean;
|
|
1920
2170
|
}
|
|
1921
2171
|
|
|
2172
|
+
/**
|
|
2173
|
+
* Shadow root initialization options.
|
|
2174
|
+
* @public
|
|
2175
|
+
*/
|
|
2176
|
+
export declare interface ShadowRootOptions extends ShadowRootInit {
|
|
2177
|
+
/**
|
|
2178
|
+
* A registry that provides the custom elements visible
|
|
2179
|
+
* from within this shadow root.
|
|
2180
|
+
* @beta
|
|
2181
|
+
*/
|
|
2182
|
+
registry?: CustomElementRegistry;
|
|
2183
|
+
}
|
|
2184
|
+
|
|
1922
2185
|
/**
|
|
1923
2186
|
* A directive that observes the `assignedNodes()` of a slot and updates a property
|
|
1924
2187
|
* whenever they change.
|
|
1925
2188
|
* @param propertyOrOptions - The options used to configure slotted node observation.
|
|
1926
2189
|
* @public
|
|
1927
2190
|
*/
|
|
1928
|
-
export declare function slotted<
|
|
2191
|
+
export declare function slotted<TSource = any, TParent = any>(propertyOrOptions: (keyof TSource & string) | SlottedDirectiveOptions<keyof TSource & string>): CaptureType<TSource, TParent>;
|
|
1929
2192
|
|
|
1930
2193
|
/**
|
|
1931
2194
|
* The runtime behavior for slotted node observation.
|
|
@@ -1957,6 +2220,28 @@ export declare class SlottedDirective extends NodeObservationDirective<SlottedDi
|
|
|
1957
2220
|
export declare interface SlottedDirectiveOptions<T = any> extends NodeBehaviorOptions<T>, AssignedNodesOptions {
|
|
1958
2221
|
}
|
|
1959
2222
|
|
|
2223
|
+
/**
|
|
2224
|
+
* Describes how the source's lifetime relates to its controller's lifetime.
|
|
2225
|
+
* @public
|
|
2226
|
+
*/
|
|
2227
|
+
export declare const SourceLifetime: Readonly<{
|
|
2228
|
+
/**
|
|
2229
|
+
* The source to controller lifetime relationship is unknown.
|
|
2230
|
+
*/
|
|
2231
|
+
readonly unknown: undefined;
|
|
2232
|
+
/**
|
|
2233
|
+
* The source and controller lifetimes are coupled to one another.
|
|
2234
|
+
* They can/will be GC'd together.
|
|
2235
|
+
*/
|
|
2236
|
+
readonly coupled: 1;
|
|
2237
|
+
}>;
|
|
2238
|
+
|
|
2239
|
+
/**
|
|
2240
|
+
* Describes how the source's lifetime relates to its controller's lifetime.
|
|
2241
|
+
* @public
|
|
2242
|
+
*/
|
|
2243
|
+
export declare type SourceLifetime = typeof SourceLifetime[keyof typeof SourceLifetime];
|
|
2244
|
+
|
|
1960
2245
|
/**
|
|
1961
2246
|
* A splice map is a representation of how a previous array of items
|
|
1962
2247
|
* was transformed into a new array of items. Conceptually it is a list of
|
|
@@ -2113,26 +2398,14 @@ export declare type SpliceStrategySupport = typeof SpliceStrategySupport[keyof t
|
|
|
2113
2398
|
* A base class used for attribute directives that don't need internal state.
|
|
2114
2399
|
* @public
|
|
2115
2400
|
*/
|
|
2116
|
-
export declare abstract class StatelessAttachedAttributeDirective<
|
|
2117
|
-
protected options:
|
|
2118
|
-
|
|
2119
|
-
* The unique id of the factory.
|
|
2120
|
-
*/
|
|
2121
|
-
id: string;
|
|
2122
|
-
/**
|
|
2123
|
-
* The structural id of the DOM node to which the created behavior will apply.
|
|
2124
|
-
*/
|
|
2125
|
-
nodeId: string;
|
|
2401
|
+
export declare abstract class StatelessAttachedAttributeDirective<TOptions> implements HTMLDirective, ViewBehaviorFactory, ViewBehavior {
|
|
2402
|
+
protected options: TOptions;
|
|
2403
|
+
/* Excluded from this release type: toJSON */
|
|
2126
2404
|
/**
|
|
2127
2405
|
* Creates an instance of RefDirective.
|
|
2128
2406
|
* @param options - The options to use in configuring the directive.
|
|
2129
2407
|
*/
|
|
2130
|
-
constructor(options:
|
|
2131
|
-
/**
|
|
2132
|
-
* Creates a behavior.
|
|
2133
|
-
* @param targets - The targets available for behaviors to be attached to.
|
|
2134
|
-
*/
|
|
2135
|
-
createBehavior(targets: ViewBehaviorTargets): ViewBehavior;
|
|
2408
|
+
constructor(options: TOptions);
|
|
2136
2409
|
/**
|
|
2137
2410
|
* Creates a placeholder string based on the directive's index within the template.
|
|
2138
2411
|
* @param index - The index of the directive within the template.
|
|
@@ -2141,17 +2414,15 @@ export declare abstract class StatelessAttachedAttributeDirective<T> implements
|
|
|
2141
2414
|
*/
|
|
2142
2415
|
createHTML(add: AddViewBehaviorFactory): string;
|
|
2143
2416
|
/**
|
|
2144
|
-
*
|
|
2145
|
-
* @param
|
|
2146
|
-
* @param context - The execution context that the binding is operating within.
|
|
2147
|
-
* @param targets - The targets that behaviors in a view can attach to.
|
|
2417
|
+
* Creates a behavior.
|
|
2418
|
+
* @param targets - The targets available for behaviors to be attached to.
|
|
2148
2419
|
*/
|
|
2149
|
-
|
|
2420
|
+
createBehavior(): ViewBehavior;
|
|
2150
2421
|
/**
|
|
2151
|
-
*
|
|
2152
|
-
* @param
|
|
2422
|
+
* Bind this behavior.
|
|
2423
|
+
* @param controller - The view controller that manages the lifecycle of this behavior.
|
|
2153
2424
|
*/
|
|
2154
|
-
abstract
|
|
2425
|
+
abstract bind(controller: ViewController): void;
|
|
2155
2426
|
}
|
|
2156
2427
|
|
|
2157
2428
|
/**
|
|
@@ -2176,7 +2447,7 @@ export declare interface StyleStrategy {
|
|
|
2176
2447
|
* A node that can be targeted by styles.
|
|
2177
2448
|
* @public
|
|
2178
2449
|
*/
|
|
2179
|
-
export declare interface StyleTarget {
|
|
2450
|
+
export declare interface StyleTarget extends Pick<Node, "getRootNode"> {
|
|
2180
2451
|
/**
|
|
2181
2452
|
* Stylesheets to be adopted by the node.
|
|
2182
2453
|
*/
|
|
@@ -2308,26 +2579,17 @@ export declare interface SyntheticViewTemplate<TSource = any, TParent = any> {
|
|
|
2308
2579
|
* Creates a SyntheticView instance based on this template definition.
|
|
2309
2580
|
*/
|
|
2310
2581
|
create(): SyntheticView<TSource, TParent>;
|
|
2582
|
+
/**
|
|
2583
|
+
* Returns a directive that can inline the template.
|
|
2584
|
+
*/
|
|
2585
|
+
inline(): CaptureType<TSource, TParent>;
|
|
2311
2586
|
}
|
|
2312
2587
|
|
|
2313
2588
|
/**
|
|
2314
2589
|
* Represents the types of values that can be interpolated into a template.
|
|
2315
2590
|
* @public
|
|
2316
2591
|
*/
|
|
2317
|
-
export declare type TemplateValue<TSource, TParent = any> = Binding<TSource, any, TParent> | HTMLDirective | CaptureType<TSource>;
|
|
2318
|
-
|
|
2319
|
-
/**
|
|
2320
|
-
* Enables working with trusted types.
|
|
2321
|
-
* @public
|
|
2322
|
-
*/
|
|
2323
|
-
export declare type TrustedTypes = {
|
|
2324
|
-
/**
|
|
2325
|
-
* Creates a trusted types policy.
|
|
2326
|
-
* @param name - The policy name.
|
|
2327
|
-
* @param rules - The policy rules implementation.
|
|
2328
|
-
*/
|
|
2329
|
-
createPolicy(name: string, rules: TrustedTypesPolicy): TrustedTypesPolicy;
|
|
2330
|
-
};
|
|
2592
|
+
export declare type TemplateValue<TSource, TParent = any> = Expression<TSource, any, TParent> | Binding<TSource, any, TParent> | HTMLDirective | CaptureType<TSource, TParent>;
|
|
2331
2593
|
|
|
2332
2594
|
/**
|
|
2333
2595
|
* A policy for use with the standard trustedTypes platform API.
|
|
@@ -2345,40 +2607,6 @@ export declare type TrustedTypesPolicy = {
|
|
|
2345
2607
|
|
|
2346
2608
|
/* Excluded from this release type: TypeRegistry */
|
|
2347
2609
|
|
|
2348
|
-
/**
|
|
2349
|
-
* A base binding behavior for DOM updates.
|
|
2350
|
-
* @public
|
|
2351
|
-
*/
|
|
2352
|
-
export declare class UpdateBinding implements ViewBehavior {
|
|
2353
|
-
readonly directive: HTMLBindingDirective;
|
|
2354
|
-
protected updateTarget: UpdateTarget;
|
|
2355
|
-
/**
|
|
2356
|
-
* Creates an instance of UpdateBinding.
|
|
2357
|
-
* @param directive - The directive that has the configuration for this behavior.
|
|
2358
|
-
* @param updateTarget - The function used to update the target with the latest value.
|
|
2359
|
-
*/
|
|
2360
|
-
constructor(directive: HTMLBindingDirective, updateTarget: UpdateTarget);
|
|
2361
|
-
/**
|
|
2362
|
-
* Bind this behavior to the source.
|
|
2363
|
-
* @param source - The source to bind to.
|
|
2364
|
-
* @param context - The execution context that the binding is operating within.
|
|
2365
|
-
* @param targets - The targets that behaviors in a view can attach to.
|
|
2366
|
-
*/
|
|
2367
|
-
bind(source: any, context: ExecutionContext, targets: ViewBehaviorTargets): void;
|
|
2368
|
-
/**
|
|
2369
|
-
* Unbinds this behavior from the source.
|
|
2370
|
-
* @param source - The source to unbind from.
|
|
2371
|
-
* @param context - The execution context that the binding is operating within.
|
|
2372
|
-
* @param targets - The targets that behaviors in a view can attach to.
|
|
2373
|
-
*/
|
|
2374
|
-
unbind(source: any, context: ExecutionContext, targets: ViewBehaviorTargets): void;
|
|
2375
|
-
/**
|
|
2376
|
-
* Creates a behavior.
|
|
2377
|
-
* @param targets - The targets available for behaviors to be attached to.
|
|
2378
|
-
*/
|
|
2379
|
-
createBehavior(targets: ViewBehaviorTargets): ViewBehavior;
|
|
2380
|
-
}
|
|
2381
|
-
|
|
2382
2610
|
/**
|
|
2383
2611
|
* A work queue used to synchronize writes to the DOM.
|
|
2384
2612
|
* @public
|
|
@@ -2420,29 +2648,6 @@ export declare interface UpdateQueue {
|
|
|
2420
2648
|
*/
|
|
2421
2649
|
export declare const Updates: UpdateQueue;
|
|
2422
2650
|
|
|
2423
|
-
/**
|
|
2424
|
-
* A target update function.
|
|
2425
|
-
* @param this - The "this" context for the update.
|
|
2426
|
-
* @param target - The node that is targeted by the update.
|
|
2427
|
-
* @param aspect - The aspect of the node that is being targeted.
|
|
2428
|
-
* @param value - The value to assign to the aspect.
|
|
2429
|
-
* @param source - The source object that the value was derived from.
|
|
2430
|
-
* @param context - The execution context that the binding is being run under.
|
|
2431
|
-
* @public
|
|
2432
|
-
*/
|
|
2433
|
-
export declare type UpdateTarget = (this: UpdateTargetThis, target: Node, aspect: string, value: any, source: any, context: ExecutionContext) => void;
|
|
2434
|
-
|
|
2435
|
-
/**
|
|
2436
|
-
* The "this" context for an update target function.
|
|
2437
|
-
* @public
|
|
2438
|
-
*/
|
|
2439
|
-
export declare interface UpdateTargetThis {
|
|
2440
|
-
/**
|
|
2441
|
-
* The directive configuration for the update.
|
|
2442
|
-
*/
|
|
2443
|
-
directive: HTMLBindingDirective;
|
|
2444
|
-
}
|
|
2445
|
-
|
|
2446
2651
|
/**
|
|
2447
2652
|
* Represents objects that can convert values to and from
|
|
2448
2653
|
* view or model representations.
|
|
@@ -2469,7 +2674,7 @@ export declare interface View<TSource = any, TParent = any> extends Disposable {
|
|
|
2469
2674
|
/**
|
|
2470
2675
|
* The execution context the view is running within.
|
|
2471
2676
|
*/
|
|
2472
|
-
readonly context: ExecutionContext<TParent
|
|
2677
|
+
readonly context: ExecutionContext<TParent>;
|
|
2473
2678
|
/**
|
|
2474
2679
|
* The data that the view is bound to.
|
|
2475
2680
|
*/
|
|
@@ -2477,9 +2682,8 @@ export declare interface View<TSource = any, TParent = any> extends Disposable {
|
|
|
2477
2682
|
/**
|
|
2478
2683
|
* Binds a view's behaviors to its binding source.
|
|
2479
2684
|
* @param source - The binding source for the view's binding behaviors.
|
|
2480
|
-
* @param context - The execution context to run the view within.
|
|
2481
2685
|
*/
|
|
2482
|
-
bind(source: TSource, context
|
|
2686
|
+
bind(source: TSource, context?: ExecutionContext<TParent>): void;
|
|
2483
2687
|
/**
|
|
2484
2688
|
* Unbinds a view's behaviors from its binding source and context.
|
|
2485
2689
|
*/
|
|
@@ -2492,23 +2696,14 @@ export declare interface View<TSource = any, TParent = any> extends Disposable {
|
|
|
2492
2696
|
*/
|
|
2493
2697
|
export declare interface ViewBehavior<TSource = any, TParent = any> {
|
|
2494
2698
|
/**
|
|
2495
|
-
* Bind this behavior
|
|
2496
|
-
* @param
|
|
2497
|
-
* @param context - The execution context that the binding is operating within.
|
|
2498
|
-
* @param targets - The targets that behaviors in a view can attach to.
|
|
2499
|
-
*/
|
|
2500
|
-
bind(source: TSource, context: ExecutionContext<TParent>, targets: ViewBehaviorTargets): void;
|
|
2501
|
-
/**
|
|
2502
|
-
* Unbinds this behavior from the source.
|
|
2503
|
-
* @param source - The source to unbind from.
|
|
2504
|
-
* @param context - The execution context that the binding is operating within.
|
|
2505
|
-
* @param targets - The targets that behaviors in a view can attach to.
|
|
2699
|
+
* Bind this behavior.
|
|
2700
|
+
* @param controller - The view controller that manages the lifecycle of this behavior.
|
|
2506
2701
|
*/
|
|
2507
|
-
|
|
2702
|
+
bind(controller: ViewController<TSource, TParent>): void;
|
|
2508
2703
|
}
|
|
2509
2704
|
|
|
2510
2705
|
/**
|
|
2511
|
-
* A factory that can create a {@link
|
|
2706
|
+
* A factory that can create a {@link ViewBehavior} associated with a particular
|
|
2512
2707
|
* location within a DOM fragment.
|
|
2513
2708
|
* @public
|
|
2514
2709
|
*/
|
|
@@ -2516,16 +2711,23 @@ export declare interface ViewBehaviorFactory {
|
|
|
2516
2711
|
/**
|
|
2517
2712
|
* The unique id of the factory.
|
|
2518
2713
|
*/
|
|
2519
|
-
id
|
|
2714
|
+
id?: string;
|
|
2520
2715
|
/**
|
|
2521
2716
|
* The structural id of the DOM node to which the created behavior will apply.
|
|
2522
2717
|
*/
|
|
2523
|
-
|
|
2718
|
+
targetNodeId?: string;
|
|
2719
|
+
/**
|
|
2720
|
+
* The tag name of the DOM node to which the created behavior will apply.
|
|
2721
|
+
*/
|
|
2722
|
+
targetTagName?: string | null;
|
|
2723
|
+
/**
|
|
2724
|
+
* The policy that the created behavior must run under.
|
|
2725
|
+
*/
|
|
2726
|
+
policy?: DOMPolicy;
|
|
2524
2727
|
/**
|
|
2525
2728
|
* Creates a behavior.
|
|
2526
|
-
* @param targets - The targets available for behaviors to be attached to.
|
|
2527
2729
|
*/
|
|
2528
|
-
createBehavior(
|
|
2730
|
+
createBehavior(): ViewBehavior;
|
|
2529
2731
|
}
|
|
2530
2732
|
|
|
2531
2733
|
/**
|
|
@@ -2536,11 +2738,23 @@ export declare type ViewBehaviorTargets = {
|
|
|
2536
2738
|
[id: string]: Node;
|
|
2537
2739
|
};
|
|
2538
2740
|
|
|
2741
|
+
/**
|
|
2742
|
+
* Controls the lifecycle of a view and provides relevant context.
|
|
2743
|
+
* @public
|
|
2744
|
+
*/
|
|
2745
|
+
export declare interface ViewController<TSource = any, TParent = any> extends ExpressionController<TSource, TParent> {
|
|
2746
|
+
/**
|
|
2747
|
+
* The parts of the view that are targeted by view behaviors.
|
|
2748
|
+
*/
|
|
2749
|
+
readonly targets: ViewBehaviorTargets;
|
|
2750
|
+
}
|
|
2751
|
+
|
|
2539
2752
|
/**
|
|
2540
2753
|
* A template capable of creating HTMLView instances or rendering directly to DOM.
|
|
2541
2754
|
* @public
|
|
2542
2755
|
*/
|
|
2543
2756
|
export declare class ViewTemplate<TSource = any, TParent = any> implements ElementViewTemplate<TSource, TParent>, SyntheticViewTemplate<TSource, TParent> {
|
|
2757
|
+
private policy?;
|
|
2544
2758
|
private result;
|
|
2545
2759
|
/**
|
|
2546
2760
|
* The html representing what this template will
|
|
@@ -2555,13 +2769,27 @@ export declare class ViewTemplate<TSource = any, TParent = any> implements Eleme
|
|
|
2555
2769
|
* Creates an instance of ViewTemplate.
|
|
2556
2770
|
* @param html - The html representing what this template will instantiate, including placeholders for directives.
|
|
2557
2771
|
* @param factories - The directives that will be connected to placeholders in the html.
|
|
2772
|
+
* @param policy - The security policy to use when compiling this template.
|
|
2558
2773
|
*/
|
|
2559
|
-
constructor(html: string | HTMLTemplateElement, factories
|
|
2774
|
+
constructor(html: string | HTMLTemplateElement, factories?: Record<string, ViewBehaviorFactory>, policy?: DOMPolicy | undefined);
|
|
2560
2775
|
/**
|
|
2561
2776
|
* Creates an HTMLView instance based on this template definition.
|
|
2562
2777
|
* @param hostBindingTarget - The element that host behaviors will be bound to.
|
|
2563
2778
|
*/
|
|
2564
2779
|
create(hostBindingTarget?: Element): HTMLView<TSource, TParent>;
|
|
2780
|
+
/**
|
|
2781
|
+
* Returns a directive that can inline the template.
|
|
2782
|
+
*/
|
|
2783
|
+
inline(): CaptureType<TSource, TParent>;
|
|
2784
|
+
/**
|
|
2785
|
+
* Sets the DOMPolicy for this template.
|
|
2786
|
+
* @param policy - The policy to associated with this template.
|
|
2787
|
+
* @returns The modified template instance.
|
|
2788
|
+
* @remarks
|
|
2789
|
+
* The DOMPolicy can only be set once for a template and cannot be
|
|
2790
|
+
* set after the template is compiled.
|
|
2791
|
+
*/
|
|
2792
|
+
withPolicy(policy: DOMPolicy): this;
|
|
2565
2793
|
/**
|
|
2566
2794
|
* Creates an HTMLView from this template, binds it to the source, and then appends it to the host.
|
|
2567
2795
|
* @param source - The data source to bind the template to.
|
|
@@ -2569,7 +2797,22 @@ export declare class ViewTemplate<TSource = any, TParent = any> implements Eleme
|
|
|
2569
2797
|
* @param hostBindingTarget - An HTML element to target the host bindings at if different from the
|
|
2570
2798
|
* host that the template is being attached to.
|
|
2571
2799
|
*/
|
|
2572
|
-
render(source: TSource, host: Node, hostBindingTarget?: Element
|
|
2800
|
+
render(source: TSource, host: Node, hostBindingTarget?: Element): HTMLView<TSource, TParent>;
|
|
2801
|
+
/* Excluded from this release type: toJSON */
|
|
2802
|
+
/**
|
|
2803
|
+
* Creates a template based on a set of static strings and dynamic values.
|
|
2804
|
+
* @param strings - The static strings to create the template with.
|
|
2805
|
+
* @param values - The dynamic values to create the template with.
|
|
2806
|
+
* @param policy - The DOMPolicy to associated with the template.
|
|
2807
|
+
* @returns A ViewTemplate.
|
|
2808
|
+
* @remarks
|
|
2809
|
+
* This API should not be used directly under normal circumstances because constructing
|
|
2810
|
+
* a template in this way, if not done properly, can open up the application to XSS
|
|
2811
|
+
* attacks. When using this API, provide a strong DOMPolicy that can properly sanitize
|
|
2812
|
+
* and also be sure to manually sanitize all static strings particularly if they can
|
|
2813
|
+
* come from user input.
|
|
2814
|
+
*/
|
|
2815
|
+
static create<TSource = any, TParent = any>(strings: string[], values: TemplateValue<TSource, TParent>[], policy?: DOMPolicy): ViewTemplate<TSource, TParent>;
|
|
2573
2816
|
}
|
|
2574
2817
|
|
|
2575
2818
|
/**
|
|
@@ -2583,11 +2826,11 @@ export declare function volatile(target: {}, name: string | Accessor, descriptor
|
|
|
2583
2826
|
|
|
2584
2827
|
/**
|
|
2585
2828
|
* A directive that enables basic conditional rendering in a template.
|
|
2586
|
-
* @param
|
|
2829
|
+
* @param condition - The condition to test for rendering.
|
|
2587
2830
|
* @param templateOrTemplateBinding - The template or a binding that gets
|
|
2588
2831
|
* the template to render when the condition is true.
|
|
2589
2832
|
* @public
|
|
2590
2833
|
*/
|
|
2591
|
-
export declare function when<TSource = any, TReturn = any>(
|
|
2834
|
+
export declare function when<TSource = any, TReturn = any, TParent = any>(condition: Expression<TSource, TReturn, TParent> | boolean, templateOrTemplateBinding: SyntheticViewTemplate<TSource, TParent> | Expression<TSource, SyntheticViewTemplate<TSource, TParent>, TParent>): CaptureType<TSource, TParent>;
|
|
2592
2835
|
|
|
2593
2836
|
export { }
|