@microsoft/fast-element 2.0.0-beta.2 → 2.0.0-beta.20
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 +488 -0
- package/CHANGELOG.md +180 -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 +1 -1
- package/dist/dts/di/di.d.ts +894 -0
- package/dist/dts/dom-policy.d.ts +68 -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 +60 -79
- package/dist/dts/observation/observable.d.ts +99 -54
- package/dist/dts/pending-task.d.ts +20 -0
- package/dist/dts/platform.d.ts +7 -0
- 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 +53 -18
- package/dist/esm/components/attributes.js +28 -5
- package/dist/esm/components/{controller.js → element-controller.js} +239 -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 +5 -1
- package/dist/esm/debug.js +40 -5
- package/dist/esm/di/di.js +1430 -0
- package/dist/esm/dom-policy.js +337 -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/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 +16 -0
- package/dist/esm/platform.js +27 -2
- 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 +95 -95
- package/dist/fast-element.api.json +9487 -8326
- package/dist/fast-element.d.ts +847 -644
- package/dist/fast-element.debug.js +1993 -1166
- package/dist/fast-element.debug.min.js +1 -1
- package/dist/fast-element.js +1903 -1111
- package/dist/fast-element.min.js +1 -1
- package/dist/fast-element.untrimmed.d.ts +911 -701
- package/docs/api-report.md +329 -252
- 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,31 +978,104 @@ 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;
|
|
1020
|
+
/**
|
|
1021
|
+
* Indicates how the source's lifetime relates to the controller's lifetime.
|
|
1022
|
+
*/
|
|
1023
|
+
readonly sourceLifetime?: SourceLifetime;
|
|
1024
|
+
/**
|
|
1025
|
+
* The context the expression is evaluated against.
|
|
1026
|
+
*/
|
|
1027
|
+
readonly context: ExecutionContext<TParent>;
|
|
1028
|
+
/**
|
|
1029
|
+
* Indicates whether the controller is bound.
|
|
1030
|
+
*/
|
|
1031
|
+
readonly isBound: boolean;
|
|
1032
|
+
/**
|
|
1033
|
+
* Registers an unbind handler with the controller.
|
|
1034
|
+
* @param behavior - An object to call when the controller unbinds.
|
|
1035
|
+
*/
|
|
1036
|
+
onUnbind(behavior: {
|
|
1037
|
+
unbind(controller: ExpressionController<TSource, TParent>): any;
|
|
1038
|
+
}): void;
|
|
1039
|
+
}
|
|
1040
|
+
|
|
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 {
|
|
1035
1046
|
/**
|
|
1036
|
-
*
|
|
1037
|
-
* @param
|
|
1038
|
-
* @param
|
|
1047
|
+
* Observes the expression.
|
|
1048
|
+
* @param source - The source for the expression.
|
|
1049
|
+
* @param context - The context for the expression.
|
|
1039
1050
|
*/
|
|
1040
|
-
|
|
1051
|
+
observe(source: TSource, context?: ExecutionContext): TReturn;
|
|
1041
1052
|
/**
|
|
1042
|
-
*
|
|
1043
|
-
*
|
|
1044
|
-
* @returns A child execution context.
|
|
1053
|
+
* Gets {@link ObservationRecord|ObservationRecords} that the {@link ExpressionNotifier}
|
|
1054
|
+
* is observing.
|
|
1045
1055
|
*/
|
|
1046
|
-
|
|
1056
|
+
records(): IterableIterator<ObservationRecord>;
|
|
1047
1057
|
/**
|
|
1048
|
-
*
|
|
1049
|
-
* @param
|
|
1050
|
-
* @
|
|
1051
|
-
*
|
|
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.
|
|
1052
1064
|
*/
|
|
1053
|
-
|
|
1054
|
-
|
|
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> {
|
|
1055
1073
|
/**
|
|
1056
|
-
*
|
|
1057
|
-
* @
|
|
1074
|
+
* Binds the expression to the source.
|
|
1075
|
+
* @param controller - The controller that manages the lifecycle and related
|
|
1076
|
+
* context for the expression.
|
|
1058
1077
|
*/
|
|
1059
|
-
|
|
1078
|
+
bind(controller: ExpressionController<TSource, TParent>): TReturn;
|
|
1060
1079
|
}
|
|
1061
1080
|
|
|
1062
1081
|
/* Excluded from this release type: FAST */
|
|
@@ -1070,7 +1089,7 @@ export declare interface FASTElement extends HTMLElement {
|
|
|
1070
1089
|
* The underlying controller that handles the lifecycle and rendering of
|
|
1071
1090
|
* this FASTElement.
|
|
1072
1091
|
*/
|
|
1073
|
-
readonly $fastController:
|
|
1092
|
+
readonly $fastController: ElementController;
|
|
1074
1093
|
/**
|
|
1075
1094
|
* Emits a custom HTML event.
|
|
1076
1095
|
* @param type - The type name of the event.
|
|
@@ -1111,29 +1130,11 @@ export declare interface FASTElement extends HTMLElement {
|
|
|
1111
1130
|
* static helpers for working with FASTElements.
|
|
1112
1131
|
* @public
|
|
1113
1132
|
*/
|
|
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>;
|
|
1133
|
+
export declare const FASTElement: {
|
|
1134
|
+
new (): FASTElement;
|
|
1135
|
+
define: typeof define;
|
|
1136
|
+
compose: typeof compose;
|
|
1137
|
+
from: typeof from;
|
|
1137
1138
|
};
|
|
1138
1139
|
|
|
1139
1140
|
/**
|
|
@@ -1141,7 +1142,7 @@ export declare const FASTElement: (new () => HTMLElement & FASTElement) & {
|
|
|
1141
1142
|
* @public
|
|
1142
1143
|
*/
|
|
1143
1144
|
export declare class FASTElementDefinition<TType extends Constructable<HTMLElement> = Constructable<HTMLElement>> {
|
|
1144
|
-
private
|
|
1145
|
+
private platformDefined;
|
|
1145
1146
|
/**
|
|
1146
1147
|
* The type this element definition describes.
|
|
1147
1148
|
*/
|
|
@@ -1177,18 +1178,16 @@ export declare class FASTElementDefinition<TType extends Constructable<HTMLEleme
|
|
|
1177
1178
|
/**
|
|
1178
1179
|
* Options controlling the creation of the custom element's shadow DOM.
|
|
1179
1180
|
*/
|
|
1180
|
-
readonly shadowOptions?:
|
|
1181
|
+
readonly shadowOptions?: ShadowRootOptions;
|
|
1181
1182
|
/**
|
|
1182
1183
|
* Options controlling how the custom element is defined with the platform.
|
|
1183
1184
|
*/
|
|
1184
|
-
readonly elementOptions
|
|
1185
|
+
readonly elementOptions: ElementDefinitionOptions;
|
|
1185
1186
|
/**
|
|
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.
|
|
1187
|
+
* The registry to register this component in by default.
|
|
1190
1188
|
*/
|
|
1191
|
-
|
|
1189
|
+
readonly registry: CustomElementRegistry;
|
|
1190
|
+
private constructor();
|
|
1192
1191
|
/**
|
|
1193
1192
|
* Defines a custom element based on this definition.
|
|
1194
1193
|
* @param registry - The element registry to define the element in.
|
|
@@ -1196,6 +1195,14 @@ export declare class FASTElementDefinition<TType extends Constructable<HTMLEleme
|
|
|
1196
1195
|
* This operation is idempotent per registry.
|
|
1197
1196
|
*/
|
|
1198
1197
|
define(registry?: CustomElementRegistry): this;
|
|
1198
|
+
/**
|
|
1199
|
+
* Creates an instance of FASTElementDefinition.
|
|
1200
|
+
* @param type - The type this definition is being created for.
|
|
1201
|
+
* @param nameOrDef - The name of the element to define or a config object
|
|
1202
|
+
* that describes the element to define.
|
|
1203
|
+
*/
|
|
1204
|
+
static compose<TType extends Constructable<HTMLElement> = Constructable<HTMLElement>>(type: TType, nameOrDef?: string | PartialFASTElementDefinition): FASTElementDefinition<TType>;
|
|
1205
|
+
/* Excluded from this release type: registerBaseType */
|
|
1199
1206
|
/**
|
|
1200
1207
|
* Gets the element definition associated with the specified type.
|
|
1201
1208
|
* @param type - The custom element type to retrieve the definition for.
|
|
@@ -1210,6 +1217,77 @@ export declare class FASTElementDefinition<TType extends Constructable<HTMLEleme
|
|
|
1210
1217
|
|
|
1211
1218
|
/* Excluded from this release type: FASTGlobal */
|
|
1212
1219
|
|
|
1220
|
+
declare function from<TBase extends typeof HTMLElement>(BaseType: TBase): new () => InstanceType<TBase> & FASTElement;
|
|
1221
|
+
|
|
1222
|
+
/**
|
|
1223
|
+
* Represents an object that can contribute behavior to a host.
|
|
1224
|
+
* @public
|
|
1225
|
+
*/
|
|
1226
|
+
export declare interface HostBehavior<TSource = any> {
|
|
1227
|
+
/**
|
|
1228
|
+
* Executed when this behavior is attached to a controller.
|
|
1229
|
+
* @param controller - Controls the behavior lifecycle.
|
|
1230
|
+
*/
|
|
1231
|
+
addedCallback?(controller: HostController<TSource>): void;
|
|
1232
|
+
/**
|
|
1233
|
+
* Executed when this behavior is detached from a controller.
|
|
1234
|
+
* @param controller - Controls the behavior lifecycle.
|
|
1235
|
+
*/
|
|
1236
|
+
removedCallback?(controller: HostController<TSource>): void;
|
|
1237
|
+
/**
|
|
1238
|
+
* Executed when this behavior's host is connected.
|
|
1239
|
+
* @param controller - Controls the behavior lifecycle.
|
|
1240
|
+
*/
|
|
1241
|
+
connectedCallback?(controller: HostController<TSource>): void;
|
|
1242
|
+
/**
|
|
1243
|
+
* Executed when this behavior's host is disconnected.
|
|
1244
|
+
* @param controller - Controls the behavior lifecycle.
|
|
1245
|
+
*/
|
|
1246
|
+
disconnectedCallback?(controller: HostController<TSource>): void;
|
|
1247
|
+
}
|
|
1248
|
+
|
|
1249
|
+
/**
|
|
1250
|
+
* Controls the lifecycle and context of behaviors and styles
|
|
1251
|
+
* associated with a component host.
|
|
1252
|
+
* @public
|
|
1253
|
+
*/
|
|
1254
|
+
export declare interface HostController<TSource = any> {
|
|
1255
|
+
/**
|
|
1256
|
+
* The component source.
|
|
1257
|
+
*/
|
|
1258
|
+
readonly source: TSource;
|
|
1259
|
+
/**
|
|
1260
|
+
* Indicates whether the host is connected or not.
|
|
1261
|
+
*/
|
|
1262
|
+
readonly isConnected: boolean;
|
|
1263
|
+
/**
|
|
1264
|
+
* The main set of styles used for the component, independent
|
|
1265
|
+
* of any behavior-specific styles.
|
|
1266
|
+
*/
|
|
1267
|
+
mainStyles: ElementStyles | null;
|
|
1268
|
+
/**
|
|
1269
|
+
* Adds the behavior to the component.
|
|
1270
|
+
* @param behavior - The behavior to add.
|
|
1271
|
+
*/
|
|
1272
|
+
addBehavior(behavior: HostBehavior<TSource>): void;
|
|
1273
|
+
/**
|
|
1274
|
+
* Removes the behavior from the component.
|
|
1275
|
+
* @param behavior - The behavior to remove.
|
|
1276
|
+
* @param force - Forces removal even if this behavior was added more than once.
|
|
1277
|
+
*/
|
|
1278
|
+
removeBehavior(behavior: HostBehavior<TSource>, force?: boolean): void;
|
|
1279
|
+
/**
|
|
1280
|
+
* Adds styles to this element. Providing an HTMLStyleElement will attach the element instance to the shadowRoot.
|
|
1281
|
+
* @param styles - The styles to add.
|
|
1282
|
+
*/
|
|
1283
|
+
addStyles(styles: ElementStyles | HTMLStyleElement | null | undefined): void;
|
|
1284
|
+
/**
|
|
1285
|
+
* Removes styles from this element. Providing an HTMLStyleElement will detach the element instance from the shadowRoot.
|
|
1286
|
+
* @param styles - the styles to remove.
|
|
1287
|
+
*/
|
|
1288
|
+
removeStyles(styles: ElementStyles | HTMLStyleElement | null | undefined): void;
|
|
1289
|
+
}
|
|
1290
|
+
|
|
1213
1291
|
/**
|
|
1214
1292
|
* Transforms a template literal string into a ViewTemplate.
|
|
1215
1293
|
* @param strings - The string fragments that are interpolated with the values.
|
|
@@ -1219,17 +1297,16 @@ export declare class FASTElementDefinition<TType extends Constructable<HTMLEleme
|
|
|
1219
1297
|
* other template instances, and Directive instances.
|
|
1220
1298
|
* @public
|
|
1221
1299
|
*/
|
|
1222
|
-
export declare
|
|
1300
|
+
export declare const html: HTMLTemplateTag;
|
|
1223
1301
|
|
|
1224
1302
|
/**
|
|
1225
1303
|
* A directive that applies bindings.
|
|
1226
1304
|
* @public
|
|
1227
1305
|
*/
|
|
1228
|
-
export declare class HTMLBindingDirective implements HTMLDirective, ViewBehaviorFactory, Aspected {
|
|
1229
|
-
|
|
1230
|
-
|
|
1231
|
-
|
|
1232
|
-
private factory;
|
|
1306
|
+
export declare class HTMLBindingDirective implements HTMLDirective, ViewBehaviorFactory, ViewBehavior, Aspected {
|
|
1307
|
+
dataBinding: Binding;
|
|
1308
|
+
private data;
|
|
1309
|
+
private updateTarget;
|
|
1233
1310
|
/**
|
|
1234
1311
|
* The unique id of the factory.
|
|
1235
1312
|
*/
|
|
@@ -1237,7 +1314,15 @@ export declare class HTMLBindingDirective implements HTMLDirective, ViewBehavior
|
|
|
1237
1314
|
/**
|
|
1238
1315
|
* The structural id of the DOM node to which the created behavior will apply.
|
|
1239
1316
|
*/
|
|
1240
|
-
|
|
1317
|
+
targetNodeId: string;
|
|
1318
|
+
/**
|
|
1319
|
+
* The tagname associated with the target node.
|
|
1320
|
+
*/
|
|
1321
|
+
targetTagName: string | null;
|
|
1322
|
+
/**
|
|
1323
|
+
* The policy that the created behavior must run under.
|
|
1324
|
+
*/
|
|
1325
|
+
policy: DOMPolicy;
|
|
1241
1326
|
/**
|
|
1242
1327
|
* The original source aspect exactly as represented in markup.
|
|
1243
1328
|
*/
|
|
@@ -1249,14 +1334,12 @@ export declare class HTMLBindingDirective implements HTMLDirective, ViewBehavior
|
|
|
1249
1334
|
/**
|
|
1250
1335
|
* The type of aspect to target.
|
|
1251
1336
|
*/
|
|
1252
|
-
aspectType:
|
|
1337
|
+
aspectType: DOMAspect;
|
|
1253
1338
|
/**
|
|
1254
1339
|
* 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.
|
|
1340
|
+
* @param dataBinding - The binding configuration to apply.
|
|
1258
1341
|
*/
|
|
1259
|
-
constructor(
|
|
1342
|
+
constructor(dataBinding: Binding);
|
|
1260
1343
|
/**
|
|
1261
1344
|
* Creates HTML to be used within a template.
|
|
1262
1345
|
* @param add - Can be used to add behavior factories to a template.
|
|
@@ -1264,9 +1347,12 @@ export declare class HTMLBindingDirective implements HTMLDirective, ViewBehavior
|
|
|
1264
1347
|
createHTML(add: AddViewBehaviorFactory): string;
|
|
1265
1348
|
/**
|
|
1266
1349
|
* Creates a behavior.
|
|
1267
|
-
* @param targets - The targets available for behaviors to be attached to.
|
|
1268
1350
|
*/
|
|
1269
|
-
createBehavior(
|
|
1351
|
+
createBehavior(): ViewBehavior;
|
|
1352
|
+
/* Excluded from this release type: bind */
|
|
1353
|
+
/* Excluded from this release type: unbind */
|
|
1354
|
+
/* Excluded from this release type: handleEvent */
|
|
1355
|
+
/* Excluded from this release type: handleChange */
|
|
1270
1356
|
}
|
|
1271
1357
|
|
|
1272
1358
|
/**
|
|
@@ -1301,7 +1387,15 @@ export declare const HTMLDirective: Readonly<{
|
|
|
1301
1387
|
* @param type - The type to define as a directive.
|
|
1302
1388
|
* @param options - Options that specify the directive's application.
|
|
1303
1389
|
*/
|
|
1304
|
-
define<TType extends Constructable<HTMLDirective>>(type: TType, options?: PartialHTMLDirectiveDefinition): TType;
|
|
1390
|
+
define<TType extends Constructable<HTMLDirective>>(type: TType, options?: PartialHTMLDirectiveDefinition): TType;
|
|
1391
|
+
/**
|
|
1392
|
+
*
|
|
1393
|
+
* @param directive - The directive to assign the aspect to.
|
|
1394
|
+
* @param value - The value to base the aspect determination on.
|
|
1395
|
+
* @remarks
|
|
1396
|
+
* If a falsy value is provided, then the content aspect will be assigned.
|
|
1397
|
+
*/
|
|
1398
|
+
assignAspect(directive: Aspected, value?: string): void;
|
|
1305
1399
|
}>;
|
|
1306
1400
|
|
|
1307
1401
|
/**
|
|
@@ -1334,23 +1428,103 @@ export declare interface HTMLTemplateCompilationResult<TSource = any, TParent =
|
|
|
1334
1428
|
createView(hostBindingTarget?: Element): HTMLView<TSource, TParent>;
|
|
1335
1429
|
}
|
|
1336
1430
|
|
|
1431
|
+
/**
|
|
1432
|
+
* Transforms a template literal string into a ViewTemplate.
|
|
1433
|
+
* @param strings - The string fragments that are interpolated with the values.
|
|
1434
|
+
* @param values - The values that are interpolated with the string fragments.
|
|
1435
|
+
* @remarks
|
|
1436
|
+
* The html helper supports interpolation of strings, numbers, binding expressions,
|
|
1437
|
+
* other template instances, and Directive instances.
|
|
1438
|
+
* @public
|
|
1439
|
+
*/
|
|
1440
|
+
export declare type HTMLTemplateTag = (<TSource = any, TParent = any>(strings: TemplateStringsArray, ...values: TemplateValue<TSource, TParent>[]) => ViewTemplate<TSource, TParent>) & {
|
|
1441
|
+
/**
|
|
1442
|
+
* Transforms a template literal string into partial HTML.
|
|
1443
|
+
* @param html - The HTML string fragment to interpolate.
|
|
1444
|
+
* @public
|
|
1445
|
+
*/
|
|
1446
|
+
partial(html: string): InlineTemplateDirective;
|
|
1447
|
+
};
|
|
1448
|
+
|
|
1337
1449
|
/**
|
|
1338
1450
|
* The standard View implementation, which also implements ElementView and SyntheticView.
|
|
1339
1451
|
* @public
|
|
1340
1452
|
*/
|
|
1341
|
-
export declare class HTMLView<TSource = any, TParent = any> implements ElementView<TSource, TParent>, SyntheticView<TSource, TParent> {
|
|
1453
|
+
export declare class HTMLView<TSource = any, TParent = any> implements ElementView<TSource, TParent>, SyntheticView<TSource, TParent>, ExecutionContext<TParent> {
|
|
1342
1454
|
private fragment;
|
|
1343
1455
|
private factories;
|
|
1344
|
-
|
|
1456
|
+
readonly targets: ViewBehaviorTargets;
|
|
1345
1457
|
private behaviors;
|
|
1458
|
+
private unbindables;
|
|
1346
1459
|
/**
|
|
1347
1460
|
* The data that the view is bound to.
|
|
1348
1461
|
*/
|
|
1349
1462
|
source: TSource | null;
|
|
1463
|
+
/**
|
|
1464
|
+
* Indicates whether the controller is bound.
|
|
1465
|
+
*/
|
|
1466
|
+
isBound: boolean;
|
|
1467
|
+
/**
|
|
1468
|
+
* Indicates how the source's lifetime relates to the controller's lifetime.
|
|
1469
|
+
*/
|
|
1470
|
+
readonly sourceLifetime: SourceLifetime;
|
|
1350
1471
|
/**
|
|
1351
1472
|
* The execution context the view is running within.
|
|
1352
1473
|
*/
|
|
1353
|
-
context: ExecutionContext<TParent
|
|
1474
|
+
context: ExecutionContext<TParent>;
|
|
1475
|
+
/**
|
|
1476
|
+
* The index of the current item within a repeat context.
|
|
1477
|
+
*/
|
|
1478
|
+
index: number;
|
|
1479
|
+
/**
|
|
1480
|
+
* The length of the current collection within a repeat context.
|
|
1481
|
+
*/
|
|
1482
|
+
length: number;
|
|
1483
|
+
/**
|
|
1484
|
+
* The parent data source within a nested context.
|
|
1485
|
+
*/
|
|
1486
|
+
readonly parent: TParent;
|
|
1487
|
+
/**
|
|
1488
|
+
* The parent execution context when in nested context scenarios.
|
|
1489
|
+
*/
|
|
1490
|
+
readonly parentContext: ExecutionContext<TParent>;
|
|
1491
|
+
/**
|
|
1492
|
+
* The current event within an event handler.
|
|
1493
|
+
*/
|
|
1494
|
+
get event(): Event;
|
|
1495
|
+
/**
|
|
1496
|
+
* Indicates whether the current item within a repeat context
|
|
1497
|
+
* has an even index.
|
|
1498
|
+
*/
|
|
1499
|
+
get isEven(): boolean;
|
|
1500
|
+
/**
|
|
1501
|
+
* Indicates whether the current item within a repeat context
|
|
1502
|
+
* has an odd index.
|
|
1503
|
+
*/
|
|
1504
|
+
get isOdd(): boolean;
|
|
1505
|
+
/**
|
|
1506
|
+
* Indicates whether the current item within a repeat context
|
|
1507
|
+
* is the first item in the collection.
|
|
1508
|
+
*/
|
|
1509
|
+
get isFirst(): boolean;
|
|
1510
|
+
/**
|
|
1511
|
+
* Indicates whether the current item within a repeat context
|
|
1512
|
+
* is somewhere in the middle of the collection.
|
|
1513
|
+
*/
|
|
1514
|
+
get isInMiddle(): boolean;
|
|
1515
|
+
/**
|
|
1516
|
+
* Indicates whether the current item within a repeat context
|
|
1517
|
+
* is the last item in the collection.
|
|
1518
|
+
*/
|
|
1519
|
+
get isLast(): boolean;
|
|
1520
|
+
/**
|
|
1521
|
+
* Returns the typed event detail of a custom event.
|
|
1522
|
+
*/
|
|
1523
|
+
eventDetail<TDetail>(): TDetail;
|
|
1524
|
+
/**
|
|
1525
|
+
* Returns the typed event target of the event.
|
|
1526
|
+
*/
|
|
1527
|
+
eventTarget<TTarget extends EventTarget>(): TTarget;
|
|
1354
1528
|
/**
|
|
1355
1529
|
* The first DOM node in the range of nodes that make up the view.
|
|
1356
1530
|
*/
|
|
@@ -1364,7 +1538,7 @@ export declare class HTMLView<TSource = any, TParent = any> implements ElementVi
|
|
|
1364
1538
|
* @param fragment - The html fragment that contains the nodes for this view.
|
|
1365
1539
|
* @param behaviors - The behaviors to be applied to this view.
|
|
1366
1540
|
*/
|
|
1367
|
-
constructor(fragment: DocumentFragment, factories: ReadonlyArray<
|
|
1541
|
+
constructor(fragment: DocumentFragment, factories: ReadonlyArray<CompiledViewBehaviorFactory>, targets: ViewBehaviorTargets);
|
|
1368
1542
|
/**
|
|
1369
1543
|
* Appends the view's DOM nodes to the referenced node.
|
|
1370
1544
|
* @param node - The parent node to append the view's DOM nodes to.
|
|
@@ -1385,16 +1559,21 @@ export declare class HTMLView<TSource = any, TParent = any> implements ElementVi
|
|
|
1385
1559
|
* Once a view has been disposed, it cannot be inserted or bound again.
|
|
1386
1560
|
*/
|
|
1387
1561
|
dispose(): void;
|
|
1562
|
+
onUnbind(behavior: {
|
|
1563
|
+
unbind(controller: ViewController<TSource, TParent>): any;
|
|
1564
|
+
}): void;
|
|
1388
1565
|
/**
|
|
1389
1566
|
* Binds a view's behaviors to its binding source.
|
|
1390
1567
|
* @param source - The binding source for the view's binding behaviors.
|
|
1391
1568
|
* @param context - The execution context to run the behaviors within.
|
|
1392
1569
|
*/
|
|
1393
|
-
bind(source: TSource, context
|
|
1570
|
+
bind(source: TSource, context?: ExecutionContext<TParent>): void;
|
|
1394
1571
|
/**
|
|
1395
1572
|
* Unbinds a view's behaviors from its binding source.
|
|
1396
1573
|
*/
|
|
1397
1574
|
unbind(): void;
|
|
1575
|
+
/* Excluded from this release type: toJSON */
|
|
1576
|
+
private evaluateUnbindables;
|
|
1398
1577
|
/**
|
|
1399
1578
|
* Efficiently disposes of a contiguous range of synthetic view instances.
|
|
1400
1579
|
* @param views - A contiguous range of views to be disposed.
|
|
@@ -1402,6 +1581,29 @@ export declare class HTMLView<TSource = any, TParent = any> implements ElementVi
|
|
|
1402
1581
|
static disposeContiguousBatch(views: SyntheticView[]): void;
|
|
1403
1582
|
}
|
|
1404
1583
|
|
|
1584
|
+
/**
|
|
1585
|
+
* Inlines a template into another template.
|
|
1586
|
+
* @public
|
|
1587
|
+
*/
|
|
1588
|
+
export declare class InlineTemplateDirective implements HTMLDirective {
|
|
1589
|
+
private html;
|
|
1590
|
+
private factories;
|
|
1591
|
+
/**
|
|
1592
|
+
* An empty template partial.
|
|
1593
|
+
*/
|
|
1594
|
+
static readonly empty: InlineTemplateDirective;
|
|
1595
|
+
/**
|
|
1596
|
+
* Creates an instance of InlineTemplateDirective.
|
|
1597
|
+
* @param template - The template to inline.
|
|
1598
|
+
*/
|
|
1599
|
+
constructor(html: string, factories?: Record<string, ViewBehaviorFactory>);
|
|
1600
|
+
/**
|
|
1601
|
+
* Creates HTML to be used within a template.
|
|
1602
|
+
* @param add - Can be used to add behavior factories to a template.
|
|
1603
|
+
*/
|
|
1604
|
+
createHTML(add: AddViewBehaviorFactory): string;
|
|
1605
|
+
}
|
|
1606
|
+
|
|
1405
1607
|
/**
|
|
1406
1608
|
* Observes array lengths.
|
|
1407
1609
|
* @public
|
|
@@ -1421,6 +1623,15 @@ export declare interface LengthObserver extends Subscriber {
|
|
|
1421
1623
|
*/
|
|
1422
1624
|
export declare function lengthOf<T>(array: readonly T[]): number;
|
|
1423
1625
|
|
|
1626
|
+
/**
|
|
1627
|
+
* Creates an event listener binding.
|
|
1628
|
+
* @param expression - The binding to invoke when the event is raised.
|
|
1629
|
+
* @param options - Event listener options.
|
|
1630
|
+
* @returns A binding configuration.
|
|
1631
|
+
* @public
|
|
1632
|
+
*/
|
|
1633
|
+
export declare function listener<T = any>(expression: Expression<T>, options?: AddEventListenerOptions): Binding<T>;
|
|
1634
|
+
|
|
1424
1635
|
/**
|
|
1425
1636
|
* Common APIs related to markup generation.
|
|
1426
1637
|
* @public
|
|
@@ -1452,8 +1663,6 @@ export declare const Markup: Readonly<{
|
|
|
1452
1663
|
comment: (id: string) => string;
|
|
1453
1664
|
}>;
|
|
1454
1665
|
|
|
1455
|
-
/* Excluded from this release type: Mutable */
|
|
1456
|
-
|
|
1457
1666
|
/**
|
|
1458
1667
|
* Options for configuring node observation behavior.
|
|
1459
1668
|
* @public
|
|
@@ -1480,21 +1689,31 @@ export declare interface NodeBehaviorOptions<T = any> {
|
|
|
1480
1689
|
* Internally used by the SlottedDirective and the ChildrenDirective.
|
|
1481
1690
|
*/
|
|
1482
1691
|
export declare abstract class NodeObservationDirective<T extends NodeBehaviorOptions> extends StatelessAttachedAttributeDirective<T> {
|
|
1483
|
-
private
|
|
1692
|
+
private _id;
|
|
1693
|
+
private _controllerProperty;
|
|
1694
|
+
/**
|
|
1695
|
+
* The unique id of the factory.
|
|
1696
|
+
*/
|
|
1697
|
+
get id(): string;
|
|
1698
|
+
set id(value: string);
|
|
1699
|
+
/**
|
|
1700
|
+
* The structural id of the DOM node to which the created behavior will apply.
|
|
1701
|
+
*/
|
|
1702
|
+
targetNodeId: string;
|
|
1484
1703
|
/**
|
|
1485
1704
|
* Bind this behavior to the source.
|
|
1486
1705
|
* @param source - The source to bind to.
|
|
1487
1706
|
* @param context - The execution context that the binding is operating within.
|
|
1488
1707
|
* @param targets - The targets that behaviors in a view can attach to.
|
|
1489
1708
|
*/
|
|
1490
|
-
bind(
|
|
1709
|
+
bind(controller: ViewController): void;
|
|
1491
1710
|
/**
|
|
1492
1711
|
* Unbinds this behavior from the source.
|
|
1493
1712
|
* @param source - The source to unbind from.
|
|
1494
1713
|
* @param context - The execution context that the binding is operating within.
|
|
1495
1714
|
* @param targets - The targets that behaviors in a view can attach to.
|
|
1496
1715
|
*/
|
|
1497
|
-
unbind(
|
|
1716
|
+
unbind(controller: ViewController): void;
|
|
1498
1717
|
/**
|
|
1499
1718
|
* Gets the data source for the target.
|
|
1500
1719
|
* @param target - The target to get the source for.
|
|
@@ -1532,6 +1751,14 @@ export declare abstract class NodeObservationDirective<T extends NodeBehaviorOpt
|
|
|
1532
1751
|
protected abstract getNodes(target: any): Node[];
|
|
1533
1752
|
}
|
|
1534
1753
|
|
|
1754
|
+
/**
|
|
1755
|
+
* Normalizes the input value into a binding.
|
|
1756
|
+
* @param value - The value to create the default binding for.
|
|
1757
|
+
* @returns A binding configuration for the provided value.
|
|
1758
|
+
* @public
|
|
1759
|
+
*/
|
|
1760
|
+
export declare function normalizeBinding<TSource = any, TReturn = any, TParent = any>(value: Expression<TSource, TReturn, TParent> | Binding<TSource, TReturn, TParent> | {}): Binding<TSource, TReturn, TParent>;
|
|
1761
|
+
|
|
1535
1762
|
/**
|
|
1536
1763
|
* Provides change notifications for an observed subject.
|
|
1537
1764
|
* @public
|
|
@@ -1567,6 +1794,12 @@ export declare interface Notifier {
|
|
|
1567
1794
|
unsubscribe(subscriber: Subscriber, propertyToUnwatch?: any): void;
|
|
1568
1795
|
}
|
|
1569
1796
|
|
|
1797
|
+
/**
|
|
1798
|
+
* A {@link ValueConverter} that converts to and from `boolean` values. `null`, `undefined`, `""`, and `void` values are converted to `null`.
|
|
1799
|
+
* @public
|
|
1800
|
+
*/
|
|
1801
|
+
export declare const nullableBooleanConverter: ValueConverter;
|
|
1802
|
+
|
|
1570
1803
|
/**
|
|
1571
1804
|
* A {@link ValueConverter} that converts to and from `number` values.
|
|
1572
1805
|
* @remarks
|
|
@@ -1618,19 +1851,19 @@ export declare const Observable: Readonly<{
|
|
|
1618
1851
|
*/
|
|
1619
1852
|
getAccessors: (target: {}) => Accessor[];
|
|
1620
1853
|
/**
|
|
1621
|
-
* Creates a {@link
|
|
1622
|
-
* provided {@link
|
|
1623
|
-
* @param
|
|
1854
|
+
* Creates a {@link ExpressionNotifier} that can watch the
|
|
1855
|
+
* provided {@link Expression} for changes.
|
|
1856
|
+
* @param expression - The binding to observe.
|
|
1624
1857
|
* @param initialSubscriber - An initial subscriber to changes in the binding value.
|
|
1625
1858
|
* @param isVolatileBinding - Indicates whether the binding's dependency list must be re-evaluated on every value evaluation.
|
|
1626
1859
|
*/
|
|
1627
|
-
binding<TSource = any, TReturn = any>(
|
|
1860
|
+
binding<TSource = any, TReturn = any>(expression: Expression<TSource, TReturn, any>, initialSubscriber?: Subscriber, isVolatileBinding?: boolean): ExpressionNotifier<TSource, TReturn, any>;
|
|
1628
1861
|
/**
|
|
1629
1862
|
* Determines whether a binding expression is volatile and needs to have its dependency list re-evaluated
|
|
1630
1863
|
* on every evaluation of the value.
|
|
1631
|
-
* @param
|
|
1864
|
+
* @param expression - The binding to inspect.
|
|
1632
1865
|
*/
|
|
1633
|
-
isVolatileBinding<TSource_1 = any, TReturn_1 = any>(
|
|
1866
|
+
isVolatileBinding<TSource_1 = any, TReturn_1 = any>(expression: Expression<TSource_1, TReturn_1, any>): boolean;
|
|
1634
1867
|
}>;
|
|
1635
1868
|
|
|
1636
1869
|
/**
|
|
@@ -1657,30 +1890,13 @@ export declare interface ObservationRecord {
|
|
|
1657
1890
|
}
|
|
1658
1891
|
|
|
1659
1892
|
/**
|
|
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.
|
|
1893
|
+
* Creates a one time binding
|
|
1894
|
+
* @param expression - The binding to refresh when signaled.
|
|
1895
|
+
* @param policy - The security policy to associate with th binding.
|
|
1896
|
+
* @returns A binding configuration.
|
|
1673
1897
|
* @public
|
|
1674
1898
|
*/
|
|
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
|
-
}
|
|
1899
|
+
export declare function oneTime<T = any>(expression: Expression<T>, policy?: DOMPolicy): Binding<T>;
|
|
1684
1900
|
|
|
1685
1901
|
/**
|
|
1686
1902
|
* Common APIs related to content parsing.
|
|
@@ -1721,12 +1937,21 @@ export declare interface PartialFASTElementDefinition {
|
|
|
1721
1937
|
readonly attributes?: (AttributeConfiguration | string)[];
|
|
1722
1938
|
/**
|
|
1723
1939
|
* Options controlling the creation of the custom element's shadow DOM.
|
|
1940
|
+
* @remarks
|
|
1941
|
+
* If not provided, defaults to an open shadow root. Provide null
|
|
1942
|
+
* to render to the associated template to the light DOM instead.
|
|
1724
1943
|
*/
|
|
1725
|
-
readonly shadowOptions?: Partial<
|
|
1944
|
+
readonly shadowOptions?: Partial<ShadowRootOptions> | null;
|
|
1726
1945
|
/**
|
|
1727
1946
|
* Options controlling how the custom element is defined with the platform.
|
|
1728
1947
|
*/
|
|
1729
1948
|
readonly elementOptions?: ElementDefinitionOptions;
|
|
1949
|
+
/**
|
|
1950
|
+
* The registry to register this component in by default.
|
|
1951
|
+
* @remarks
|
|
1952
|
+
* If not provided, defaults to the global registry.
|
|
1953
|
+
*/
|
|
1954
|
+
readonly registry?: CustomElementRegistry;
|
|
1730
1955
|
}
|
|
1731
1956
|
|
|
1732
1957
|
/**
|
|
@@ -1782,7 +2007,7 @@ export declare class PropertyChangeNotifier implements Notifier {
|
|
|
1782
2007
|
* @param propertyName - The name of the property to assign the reference to.
|
|
1783
2008
|
* @public
|
|
1784
2009
|
*/
|
|
1785
|
-
export declare const ref: <
|
|
2010
|
+
export declare const ref: <TSource = any, TParent = any>(propertyName: keyof TSource & string) => CaptureType<TSource, TParent>;
|
|
1786
2011
|
|
|
1787
2012
|
/**
|
|
1788
2013
|
* The runtime behavior for template references.
|
|
@@ -1790,69 +2015,60 @@ export declare const ref: <T = any>(propertyName: keyof T & string) => CaptureTy
|
|
|
1790
2015
|
*/
|
|
1791
2016
|
export declare class RefDirective extends StatelessAttachedAttributeDirective<string> {
|
|
1792
2017
|
/**
|
|
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.
|
|
2018
|
+
* The structural id of the DOM node to which the created behavior will apply.
|
|
1797
2019
|
*/
|
|
1798
|
-
|
|
2020
|
+
targetNodeId: string;
|
|
1799
2021
|
/**
|
|
1800
|
-
*
|
|
1801
|
-
* @param
|
|
2022
|
+
* Bind this behavior.
|
|
2023
|
+
* @param controller - The view controller that manages the lifecycle of this behavior.
|
|
1802
2024
|
*/
|
|
1803
|
-
|
|
2025
|
+
bind(controller: ViewController): void;
|
|
1804
2026
|
}
|
|
1805
2027
|
|
|
1806
2028
|
declare const reflectMode = "reflect";
|
|
1807
2029
|
|
|
1808
2030
|
/**
|
|
1809
2031
|
* A directive that enables list rendering.
|
|
1810
|
-
* @param
|
|
1811
|
-
* @param
|
|
2032
|
+
* @param items - The array to render.
|
|
2033
|
+
* @param template - The template or a template binding used obtain a template
|
|
1812
2034
|
* to render for each item in the array.
|
|
1813
2035
|
* @param options - Options used to turn on special repeat features.
|
|
1814
2036
|
* @public
|
|
1815
2037
|
*/
|
|
1816
|
-
export declare function repeat<TSource = any, TArray extends ReadonlyArray<any> = ReadonlyArray<any
|
|
2038
|
+
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
2039
|
|
|
1818
2040
|
/**
|
|
1819
2041
|
* A behavior that renders a template for each item in an array.
|
|
1820
2042
|
* @public
|
|
1821
2043
|
*/
|
|
1822
|
-
export declare class RepeatBehavior<TSource = any> implements
|
|
2044
|
+
export declare class RepeatBehavior<TSource = any> implements ViewBehavior, Subscriber {
|
|
2045
|
+
private directive;
|
|
1823
2046
|
private location;
|
|
1824
|
-
private
|
|
1825
|
-
private templateBinding;
|
|
1826
|
-
private options;
|
|
1827
|
-
private source;
|
|
1828
|
-
private views;
|
|
2047
|
+
private controller;
|
|
1829
2048
|
private template;
|
|
1830
2049
|
private templateBindingObserver;
|
|
1831
2050
|
private items;
|
|
1832
2051
|
private itemsObserver;
|
|
1833
2052
|
private itemsBindingObserver;
|
|
1834
|
-
private context;
|
|
1835
|
-
private childContext;
|
|
1836
2053
|
private bindView;
|
|
2054
|
+
/* Excluded from this release type: views */
|
|
1837
2055
|
/**
|
|
1838
2056
|
* Creates an instance of RepeatBehavior.
|
|
1839
2057
|
* @param location - The location in the DOM to render the repeat.
|
|
1840
|
-
* @param
|
|
2058
|
+
* @param dataBinding - The array to render.
|
|
1841
2059
|
* @param isItemsBindingVolatile - Indicates whether the items binding has volatile dependencies.
|
|
1842
2060
|
* @param templateBinding - The template to render for each item.
|
|
1843
2061
|
* @param isTemplateBindingVolatile - Indicates whether the template binding has volatile dependencies.
|
|
1844
2062
|
* @param options - Options used to turn on special repeat features.
|
|
1845
2063
|
*/
|
|
1846
|
-
constructor(
|
|
2064
|
+
constructor(directive: RepeatDirective);
|
|
1847
2065
|
/**
|
|
1848
|
-
* Bind this behavior
|
|
1849
|
-
* @param
|
|
1850
|
-
* @param context - The execution context that the binding is operating within.
|
|
2066
|
+
* Bind this behavior.
|
|
2067
|
+
* @param controller - The view controller that manages the lifecycle of this behavior.
|
|
1851
2068
|
*/
|
|
1852
|
-
bind(
|
|
2069
|
+
bind(controller: ViewController): void;
|
|
1853
2070
|
/**
|
|
1854
|
-
* Unbinds this behavior
|
|
1855
|
-
* @param source - The source to unbind from.
|
|
2071
|
+
* Unbinds this behavior.
|
|
1856
2072
|
*/
|
|
1857
2073
|
unbind(): void;
|
|
1858
2074
|
/**
|
|
@@ -1860,7 +2076,7 @@ export declare class RepeatBehavior<TSource = any> implements Behavior, Subscrib
|
|
|
1860
2076
|
* @param source - The source of the change.
|
|
1861
2077
|
* @param args - The details about what was changed.
|
|
1862
2078
|
*/
|
|
1863
|
-
handleChange(source: any, args: Splice[]): void;
|
|
2079
|
+
handleChange(source: any, args: Splice[] | ExpressionObserver): void;
|
|
1864
2080
|
private observeItems;
|
|
1865
2081
|
private updateViews;
|
|
1866
2082
|
private refreshAllViews;
|
|
@@ -1872,19 +2088,13 @@ export declare class RepeatBehavior<TSource = any> implements Behavior, Subscrib
|
|
|
1872
2088
|
* @public
|
|
1873
2089
|
*/
|
|
1874
2090
|
export declare class RepeatDirective<TSource = any> implements HTMLDirective, ViewBehaviorFactory {
|
|
1875
|
-
readonly
|
|
2091
|
+
readonly dataBinding: Binding<TSource>;
|
|
1876
2092
|
readonly templateBinding: Binding<TSource, SyntheticViewTemplate>;
|
|
1877
2093
|
readonly options: RepeatOptions;
|
|
1878
|
-
private isItemsBindingVolatile;
|
|
1879
|
-
private isTemplateBindingVolatile;
|
|
1880
|
-
/**
|
|
1881
|
-
* The unique id of the factory.
|
|
1882
|
-
*/
|
|
1883
|
-
id: string;
|
|
1884
2094
|
/**
|
|
1885
2095
|
* The structural id of the DOM node to which the created behavior will apply.
|
|
1886
2096
|
*/
|
|
1887
|
-
|
|
2097
|
+
targetNodeId: string;
|
|
1888
2098
|
/**
|
|
1889
2099
|
* Creates a placeholder string based on the directive's index within the template.
|
|
1890
2100
|
* @param index - The index of the directive within the template.
|
|
@@ -1892,16 +2102,16 @@ export declare class RepeatDirective<TSource = any> implements HTMLDirective, Vi
|
|
|
1892
2102
|
createHTML(add: AddViewBehaviorFactory): string;
|
|
1893
2103
|
/**
|
|
1894
2104
|
* Creates an instance of RepeatDirective.
|
|
1895
|
-
* @param
|
|
2105
|
+
* @param dataBinding - The binding that provides the array to render.
|
|
1896
2106
|
* @param templateBinding - The template binding used to obtain a template to render for each item in the array.
|
|
1897
2107
|
* @param options - Options used to turn on special repeat features.
|
|
1898
2108
|
*/
|
|
1899
|
-
constructor(
|
|
2109
|
+
constructor(dataBinding: Binding<TSource>, templateBinding: Binding<TSource, SyntheticViewTemplate>, options: RepeatOptions);
|
|
1900
2110
|
/**
|
|
1901
2111
|
* Creates a behavior for the provided target node.
|
|
1902
2112
|
* @param target - The node instance to create the behavior for.
|
|
1903
2113
|
*/
|
|
1904
|
-
createBehavior(
|
|
2114
|
+
createBehavior(): RepeatBehavior<TSource>;
|
|
1905
2115
|
}
|
|
1906
2116
|
|
|
1907
2117
|
/**
|
|
@@ -1919,13 +2129,26 @@ export declare interface RepeatOptions {
|
|
|
1919
2129
|
recycle?: boolean;
|
|
1920
2130
|
}
|
|
1921
2131
|
|
|
2132
|
+
/**
|
|
2133
|
+
* Shadow root initialization options.
|
|
2134
|
+
* @public
|
|
2135
|
+
*/
|
|
2136
|
+
export declare interface ShadowRootOptions extends ShadowRootInit {
|
|
2137
|
+
/**
|
|
2138
|
+
* A registry that provides the custom elements visible
|
|
2139
|
+
* from within this shadow root.
|
|
2140
|
+
* @beta
|
|
2141
|
+
*/
|
|
2142
|
+
registry?: CustomElementRegistry;
|
|
2143
|
+
}
|
|
2144
|
+
|
|
1922
2145
|
/**
|
|
1923
2146
|
* A directive that observes the `assignedNodes()` of a slot and updates a property
|
|
1924
2147
|
* whenever they change.
|
|
1925
2148
|
* @param propertyOrOptions - The options used to configure slotted node observation.
|
|
1926
2149
|
* @public
|
|
1927
2150
|
*/
|
|
1928
|
-
export declare function slotted<
|
|
2151
|
+
export declare function slotted<TSource = any, TParent = any>(propertyOrOptions: (keyof TSource & string) | SlottedDirectiveOptions<keyof TSource & string>): CaptureType<TSource, TParent>;
|
|
1929
2152
|
|
|
1930
2153
|
/**
|
|
1931
2154
|
* The runtime behavior for slotted node observation.
|
|
@@ -1957,6 +2180,28 @@ export declare class SlottedDirective extends NodeObservationDirective<SlottedDi
|
|
|
1957
2180
|
export declare interface SlottedDirectiveOptions<T = any> extends NodeBehaviorOptions<T>, AssignedNodesOptions {
|
|
1958
2181
|
}
|
|
1959
2182
|
|
|
2183
|
+
/**
|
|
2184
|
+
* Describes how the source's lifetime relates to its controller's lifetime.
|
|
2185
|
+
* @public
|
|
2186
|
+
*/
|
|
2187
|
+
export declare const SourceLifetime: Readonly<{
|
|
2188
|
+
/**
|
|
2189
|
+
* The source to controller lifetime relationship is unknown.
|
|
2190
|
+
*/
|
|
2191
|
+
readonly unknown: undefined;
|
|
2192
|
+
/**
|
|
2193
|
+
* The source and controller lifetimes are coupled to one another.
|
|
2194
|
+
* They can/will be GC'd together.
|
|
2195
|
+
*/
|
|
2196
|
+
readonly coupled: 1;
|
|
2197
|
+
}>;
|
|
2198
|
+
|
|
2199
|
+
/**
|
|
2200
|
+
* Describes how the source's lifetime relates to its controller's lifetime.
|
|
2201
|
+
* @public
|
|
2202
|
+
*/
|
|
2203
|
+
export declare type SourceLifetime = typeof SourceLifetime[keyof typeof SourceLifetime];
|
|
2204
|
+
|
|
1960
2205
|
/**
|
|
1961
2206
|
* A splice map is a representation of how a previous array of items
|
|
1962
2207
|
* was transformed into a new array of items. Conceptually it is a list of
|
|
@@ -2113,26 +2358,14 @@ export declare type SpliceStrategySupport = typeof SpliceStrategySupport[keyof t
|
|
|
2113
2358
|
* A base class used for attribute directives that don't need internal state.
|
|
2114
2359
|
* @public
|
|
2115
2360
|
*/
|
|
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;
|
|
2361
|
+
export declare abstract class StatelessAttachedAttributeDirective<TOptions> implements HTMLDirective, ViewBehaviorFactory, ViewBehavior {
|
|
2362
|
+
protected options: TOptions;
|
|
2363
|
+
/* Excluded from this release type: toJSON */
|
|
2126
2364
|
/**
|
|
2127
2365
|
* Creates an instance of RefDirective.
|
|
2128
2366
|
* @param options - The options to use in configuring the directive.
|
|
2129
2367
|
*/
|
|
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;
|
|
2368
|
+
constructor(options: TOptions);
|
|
2136
2369
|
/**
|
|
2137
2370
|
* Creates a placeholder string based on the directive's index within the template.
|
|
2138
2371
|
* @param index - The index of the directive within the template.
|
|
@@ -2141,17 +2374,15 @@ export declare abstract class StatelessAttachedAttributeDirective<T> implements
|
|
|
2141
2374
|
*/
|
|
2142
2375
|
createHTML(add: AddViewBehaviorFactory): string;
|
|
2143
2376
|
/**
|
|
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.
|
|
2377
|
+
* Creates a behavior.
|
|
2378
|
+
* @param targets - The targets available for behaviors to be attached to.
|
|
2148
2379
|
*/
|
|
2149
|
-
|
|
2380
|
+
createBehavior(): ViewBehavior;
|
|
2150
2381
|
/**
|
|
2151
|
-
*
|
|
2152
|
-
* @param
|
|
2382
|
+
* Bind this behavior.
|
|
2383
|
+
* @param controller - The view controller that manages the lifecycle of this behavior.
|
|
2153
2384
|
*/
|
|
2154
|
-
abstract
|
|
2385
|
+
abstract bind(controller: ViewController): void;
|
|
2155
2386
|
}
|
|
2156
2387
|
|
|
2157
2388
|
/**
|
|
@@ -2176,7 +2407,7 @@ export declare interface StyleStrategy {
|
|
|
2176
2407
|
* A node that can be targeted by styles.
|
|
2177
2408
|
* @public
|
|
2178
2409
|
*/
|
|
2179
|
-
export declare interface StyleTarget {
|
|
2410
|
+
export declare interface StyleTarget extends Pick<Node, "getRootNode"> {
|
|
2180
2411
|
/**
|
|
2181
2412
|
* Stylesheets to be adopted by the node.
|
|
2182
2413
|
*/
|
|
@@ -2308,26 +2539,17 @@ export declare interface SyntheticViewTemplate<TSource = any, TParent = any> {
|
|
|
2308
2539
|
* Creates a SyntheticView instance based on this template definition.
|
|
2309
2540
|
*/
|
|
2310
2541
|
create(): SyntheticView<TSource, TParent>;
|
|
2542
|
+
/**
|
|
2543
|
+
* Returns a directive that can inline the template.
|
|
2544
|
+
*/
|
|
2545
|
+
inline(): CaptureType<TSource, TParent>;
|
|
2311
2546
|
}
|
|
2312
2547
|
|
|
2313
2548
|
/**
|
|
2314
2549
|
* Represents the types of values that can be interpolated into a template.
|
|
2315
2550
|
* @public
|
|
2316
2551
|
*/
|
|
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
|
-
};
|
|
2552
|
+
export declare type TemplateValue<TSource, TParent = any> = Expression<TSource, any, TParent> | Binding<TSource, any, TParent> | HTMLDirective | CaptureType<TSource, TParent>;
|
|
2331
2553
|
|
|
2332
2554
|
/**
|
|
2333
2555
|
* A policy for use with the standard trustedTypes platform API.
|
|
@@ -2345,40 +2567,6 @@ export declare type TrustedTypesPolicy = {
|
|
|
2345
2567
|
|
|
2346
2568
|
/* Excluded from this release type: TypeRegistry */
|
|
2347
2569
|
|
|
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
2570
|
/**
|
|
2383
2571
|
* A work queue used to synchronize writes to the DOM.
|
|
2384
2572
|
* @public
|
|
@@ -2420,29 +2608,6 @@ export declare interface UpdateQueue {
|
|
|
2420
2608
|
*/
|
|
2421
2609
|
export declare const Updates: UpdateQueue;
|
|
2422
2610
|
|
|
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
2611
|
/**
|
|
2447
2612
|
* Represents objects that can convert values to and from
|
|
2448
2613
|
* view or model representations.
|
|
@@ -2469,7 +2634,7 @@ export declare interface View<TSource = any, TParent = any> extends Disposable {
|
|
|
2469
2634
|
/**
|
|
2470
2635
|
* The execution context the view is running within.
|
|
2471
2636
|
*/
|
|
2472
|
-
readonly context: ExecutionContext<TParent
|
|
2637
|
+
readonly context: ExecutionContext<TParent>;
|
|
2473
2638
|
/**
|
|
2474
2639
|
* The data that the view is bound to.
|
|
2475
2640
|
*/
|
|
@@ -2477,9 +2642,8 @@ export declare interface View<TSource = any, TParent = any> extends Disposable {
|
|
|
2477
2642
|
/**
|
|
2478
2643
|
* Binds a view's behaviors to its binding source.
|
|
2479
2644
|
* @param source - The binding source for the view's binding behaviors.
|
|
2480
|
-
* @param context - The execution context to run the view within.
|
|
2481
2645
|
*/
|
|
2482
|
-
bind(source: TSource, context
|
|
2646
|
+
bind(source: TSource, context?: ExecutionContext<TParent>): void;
|
|
2483
2647
|
/**
|
|
2484
2648
|
* Unbinds a view's behaviors from its binding source and context.
|
|
2485
2649
|
*/
|
|
@@ -2492,23 +2656,14 @@ export declare interface View<TSource = any, TParent = any> extends Disposable {
|
|
|
2492
2656
|
*/
|
|
2493
2657
|
export declare interface ViewBehavior<TSource = any, TParent = any> {
|
|
2494
2658
|
/**
|
|
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.
|
|
2659
|
+
* Bind this behavior.
|
|
2660
|
+
* @param controller - The view controller that manages the lifecycle of this behavior.
|
|
2506
2661
|
*/
|
|
2507
|
-
|
|
2662
|
+
bind(controller: ViewController<TSource, TParent>): void;
|
|
2508
2663
|
}
|
|
2509
2664
|
|
|
2510
2665
|
/**
|
|
2511
|
-
* A factory that can create a {@link
|
|
2666
|
+
* A factory that can create a {@link ViewBehavior} associated with a particular
|
|
2512
2667
|
* location within a DOM fragment.
|
|
2513
2668
|
* @public
|
|
2514
2669
|
*/
|
|
@@ -2516,16 +2671,23 @@ export declare interface ViewBehaviorFactory {
|
|
|
2516
2671
|
/**
|
|
2517
2672
|
* The unique id of the factory.
|
|
2518
2673
|
*/
|
|
2519
|
-
id
|
|
2674
|
+
id?: string;
|
|
2520
2675
|
/**
|
|
2521
2676
|
* The structural id of the DOM node to which the created behavior will apply.
|
|
2522
2677
|
*/
|
|
2523
|
-
|
|
2678
|
+
targetNodeId?: string;
|
|
2679
|
+
/**
|
|
2680
|
+
* The tag name of the DOM node to which the created behavior will apply.
|
|
2681
|
+
*/
|
|
2682
|
+
targetTagName?: string | null;
|
|
2683
|
+
/**
|
|
2684
|
+
* The policy that the created behavior must run under.
|
|
2685
|
+
*/
|
|
2686
|
+
policy?: DOMPolicy;
|
|
2524
2687
|
/**
|
|
2525
2688
|
* Creates a behavior.
|
|
2526
|
-
* @param targets - The targets available for behaviors to be attached to.
|
|
2527
2689
|
*/
|
|
2528
|
-
createBehavior(
|
|
2690
|
+
createBehavior(): ViewBehavior;
|
|
2529
2691
|
}
|
|
2530
2692
|
|
|
2531
2693
|
/**
|
|
@@ -2536,11 +2698,23 @@ export declare type ViewBehaviorTargets = {
|
|
|
2536
2698
|
[id: string]: Node;
|
|
2537
2699
|
};
|
|
2538
2700
|
|
|
2701
|
+
/**
|
|
2702
|
+
* Controls the lifecycle of a view and provides relevant context.
|
|
2703
|
+
* @public
|
|
2704
|
+
*/
|
|
2705
|
+
export declare interface ViewController<TSource = any, TParent = any> extends ExpressionController<TSource, TParent> {
|
|
2706
|
+
/**
|
|
2707
|
+
* The parts of the view that are targeted by view behaviors.
|
|
2708
|
+
*/
|
|
2709
|
+
readonly targets: ViewBehaviorTargets;
|
|
2710
|
+
}
|
|
2711
|
+
|
|
2539
2712
|
/**
|
|
2540
2713
|
* A template capable of creating HTMLView instances or rendering directly to DOM.
|
|
2541
2714
|
* @public
|
|
2542
2715
|
*/
|
|
2543
2716
|
export declare class ViewTemplate<TSource = any, TParent = any> implements ElementViewTemplate<TSource, TParent>, SyntheticViewTemplate<TSource, TParent> {
|
|
2717
|
+
private policy?;
|
|
2544
2718
|
private result;
|
|
2545
2719
|
/**
|
|
2546
2720
|
* The html representing what this template will
|
|
@@ -2555,13 +2729,27 @@ export declare class ViewTemplate<TSource = any, TParent = any> implements Eleme
|
|
|
2555
2729
|
* Creates an instance of ViewTemplate.
|
|
2556
2730
|
* @param html - The html representing what this template will instantiate, including placeholders for directives.
|
|
2557
2731
|
* @param factories - The directives that will be connected to placeholders in the html.
|
|
2732
|
+
* @param policy - The security policy to use when compiling this template.
|
|
2558
2733
|
*/
|
|
2559
|
-
constructor(html: string | HTMLTemplateElement, factories
|
|
2734
|
+
constructor(html: string | HTMLTemplateElement, factories?: Record<string, ViewBehaviorFactory>, policy?: DOMPolicy | undefined);
|
|
2560
2735
|
/**
|
|
2561
2736
|
* Creates an HTMLView instance based on this template definition.
|
|
2562
2737
|
* @param hostBindingTarget - The element that host behaviors will be bound to.
|
|
2563
2738
|
*/
|
|
2564
2739
|
create(hostBindingTarget?: Element): HTMLView<TSource, TParent>;
|
|
2740
|
+
/**
|
|
2741
|
+
* Returns a directive that can inline the template.
|
|
2742
|
+
*/
|
|
2743
|
+
inline(): CaptureType<TSource, TParent>;
|
|
2744
|
+
/**
|
|
2745
|
+
* Sets the DOMPolicy for this template.
|
|
2746
|
+
* @param policy - The policy to associated with this template.
|
|
2747
|
+
* @returns The modified template instance.
|
|
2748
|
+
* @remarks
|
|
2749
|
+
* The DOMPolicy can only be set once for a template and cannot be
|
|
2750
|
+
* set after the template is compiled.
|
|
2751
|
+
*/
|
|
2752
|
+
withPolicy(policy: DOMPolicy): this;
|
|
2565
2753
|
/**
|
|
2566
2754
|
* Creates an HTMLView from this template, binds it to the source, and then appends it to the host.
|
|
2567
2755
|
* @param source - The data source to bind the template to.
|
|
@@ -2569,7 +2757,22 @@ export declare class ViewTemplate<TSource = any, TParent = any> implements Eleme
|
|
|
2569
2757
|
* @param hostBindingTarget - An HTML element to target the host bindings at if different from the
|
|
2570
2758
|
* host that the template is being attached to.
|
|
2571
2759
|
*/
|
|
2572
|
-
render(source: TSource, host: Node, hostBindingTarget?: Element
|
|
2760
|
+
render(source: TSource, host: Node, hostBindingTarget?: Element): HTMLView<TSource, TParent>;
|
|
2761
|
+
/* Excluded from this release type: toJSON */
|
|
2762
|
+
/**
|
|
2763
|
+
* Creates a template based on a set of static strings and dynamic values.
|
|
2764
|
+
* @param strings - The static strings to create the template with.
|
|
2765
|
+
* @param values - The dynamic values to create the template with.
|
|
2766
|
+
* @param policy - The DOMPolicy to associated with the template.
|
|
2767
|
+
* @returns A ViewTemplate.
|
|
2768
|
+
* @remarks
|
|
2769
|
+
* This API should not be used directly under normal circumstances because constructing
|
|
2770
|
+
* a template in this way, if not done properly, can open up the application to XSS
|
|
2771
|
+
* attacks. When using this API, provide a strong DOMPolicy that can properly sanitize
|
|
2772
|
+
* and also be sure to manually sanitize all static strings particularly if they can
|
|
2773
|
+
* come from user input.
|
|
2774
|
+
*/
|
|
2775
|
+
static create<TSource = any, TParent = any>(strings: string[], values: TemplateValue<TSource, TParent>[], policy?: DOMPolicy): ViewTemplate<TSource, TParent>;
|
|
2573
2776
|
}
|
|
2574
2777
|
|
|
2575
2778
|
/**
|
|
@@ -2583,11 +2786,11 @@ export declare function volatile(target: {}, name: string | Accessor, descriptor
|
|
|
2583
2786
|
|
|
2584
2787
|
/**
|
|
2585
2788
|
* A directive that enables basic conditional rendering in a template.
|
|
2586
|
-
* @param
|
|
2789
|
+
* @param condition - The condition to test for rendering.
|
|
2587
2790
|
* @param templateOrTemplateBinding - The template or a binding that gets
|
|
2588
2791
|
* the template to render when the condition is true.
|
|
2589
2792
|
* @public
|
|
2590
2793
|
*/
|
|
2591
|
-
export declare function when<TSource = any, TReturn = any>(
|
|
2794
|
+
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
2795
|
|
|
2593
2796
|
export { }
|