@microsoft/fast-element 2.0.0-beta.1 → 2.0.0-beta.10
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 +333 -0
- package/CHANGELOG.md +106 -1
- package/dist/dts/components/attributes.d.ts +10 -0
- package/dist/dts/components/{controller.d.ts → element-controller.d.ts} +24 -25
- package/dist/dts/components/fast-definitions.d.ts +43 -9
- package/dist/dts/components/fast-element.d.ts +15 -21
- package/dist/dts/context.d.ts +157 -0
- package/dist/dts/di/di.d.ts +899 -0
- package/dist/dts/index.d.ts +2 -2
- package/dist/dts/interfaces.d.ts +44 -12
- package/dist/dts/metadata.d.ts +25 -0
- package/dist/dts/observation/arrays.d.ts +1 -1
- package/dist/dts/observation/observable.d.ts +101 -75
- package/dist/dts/pending-task.d.ts +20 -0
- package/dist/dts/platform.d.ts +6 -0
- 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/element-styles.d.ts +9 -3
- package/dist/dts/styles/host.d.ts +68 -0
- package/dist/dts/templating/binding-signal.d.ts +21 -0
- package/dist/dts/templating/binding-two-way.d.ts +39 -0
- package/dist/dts/templating/binding.d.ts +69 -294
- package/dist/dts/templating/children.d.ts +1 -1
- package/dist/dts/templating/compiler.d.ts +1 -2
- package/dist/dts/templating/html-directive.d.ts +93 -35
- package/dist/dts/templating/node-observation.d.ts +4 -5
- package/dist/dts/templating/ref.d.ts +5 -13
- package/dist/dts/templating/render.d.ts +272 -0
- package/dist/dts/templating/repeat.d.ts +20 -75
- package/dist/dts/templating/slotted.d.ts +1 -1
- package/dist/dts/templating/template.d.ts +12 -61
- package/dist/dts/templating/view.d.ts +77 -12
- 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 +4 -0
- package/dist/dts/testing/fixture.d.ts +84 -0
- package/dist/dts/testing/timeout.d.ts +7 -0
- package/dist/{tsdoc-metadata.json → dts/tsdoc-metadata.json} +0 -0
- package/dist/dts/utilities.d.ts +0 -18
- package/dist/esm/components/attributes.js +13 -4
- package/dist/esm/components/{controller.js → element-controller.js} +95 -105
- package/dist/esm/components/fast-definitions.js +38 -28
- package/dist/esm/components/fast-element.js +31 -12
- package/dist/esm/context.js +163 -0
- package/dist/esm/debug.js +36 -4
- package/dist/esm/di/di.js +1435 -0
- package/dist/esm/index.js +2 -1
- package/dist/esm/interfaces.js +4 -0
- package/dist/esm/metadata.js +60 -0
- package/dist/esm/observation/arrays.js +304 -3
- package/dist/esm/observation/observable.js +81 -87
- package/dist/esm/pending-task.js +16 -0
- package/dist/esm/platform.js +25 -1
- 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 -4
- package/dist/esm/styles/element-styles.js +14 -0
- package/dist/esm/{observation/behavior.js → styles/host.js} +0 -0
- package/dist/esm/templating/binding-signal.js +83 -0
- package/dist/esm/templating/binding-two-way.js +103 -0
- package/dist/esm/templating/binding.js +134 -414
- package/dist/esm/templating/compiler.js +30 -7
- package/dist/esm/templating/html-directive.js +100 -28
- package/dist/esm/templating/node-observation.js +9 -8
- package/dist/esm/templating/ref.js +4 -12
- package/dist/esm/templating/render.js +391 -0
- package/dist/esm/templating/repeat.js +96 -72
- package/dist/esm/templating/template.js +11 -29
- package/dist/esm/templating/view.js +107 -29
- package/dist/esm/templating/when.js +5 -4
- package/dist/esm/testing/exports.js +3 -0
- package/dist/esm/testing/fakes.js +76 -0
- package/dist/esm/testing/fixture.js +86 -0
- package/dist/esm/testing/timeout.js +24 -0
- package/dist/esm/utilities.js +0 -95
- package/dist/fast-element.api.json +9034 -10524
- package/dist/fast-element.d.ts +707 -811
- package/dist/fast-element.debug.js +1133 -850
- package/dist/fast-element.debug.min.js +1 -1
- package/dist/fast-element.js +1097 -846
- package/dist/fast-element.min.js +1 -1
- package/dist/fast-element.untrimmed.d.ts +724 -818
- package/docs/api-report.md +264 -305
- package/package.json +39 -10
- 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/esm/hooks.js +0 -32
- package/dist/esm/observation/splice-strategies.js +0 -400
|
@@ -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.
|
|
@@ -127,8 +127,10 @@ export declare const Aspect: Readonly<{
|
|
|
127
127
|
*
|
|
128
128
|
* @param directive - The directive to assign the aspect to.
|
|
129
129
|
* @param value - The value to base the aspect determination on.
|
|
130
|
+
* @remarks
|
|
131
|
+
* If a falsy value is provided, then the content aspect will be assigned.
|
|
130
132
|
*/
|
|
131
|
-
readonly assign: (directive: Aspected, value
|
|
133
|
+
readonly assign: (directive: Aspected, value?: string) => void;
|
|
132
134
|
}>;
|
|
133
135
|
|
|
134
136
|
/**
|
|
@@ -157,7 +159,7 @@ export declare interface Aspected {
|
|
|
157
159
|
/**
|
|
158
160
|
* A binding if one is associated with the aspect.
|
|
159
161
|
*/
|
|
160
|
-
|
|
162
|
+
dataBinding?: Binding;
|
|
161
163
|
}
|
|
162
164
|
|
|
163
165
|
/**
|
|
@@ -186,6 +188,17 @@ export declare type AttributeConfiguration = {
|
|
|
186
188
|
converter?: ValueConverter;
|
|
187
189
|
};
|
|
188
190
|
|
|
191
|
+
/**
|
|
192
|
+
* Metadata used to configure a custom attribute's behavior.
|
|
193
|
+
* @public
|
|
194
|
+
*/
|
|
195
|
+
export declare const AttributeConfiguration: Readonly<{
|
|
196
|
+
/**
|
|
197
|
+
* Locates all attribute configurations associated with a type.
|
|
198
|
+
*/
|
|
199
|
+
locate: (target: {}) => AttributeConfiguration[];
|
|
200
|
+
}>;
|
|
201
|
+
|
|
189
202
|
/**
|
|
190
203
|
* An implementation of {@link Accessor} that supports reactivity,
|
|
191
204
|
* change callbacks, attribute reflection, and type conversion for
|
|
@@ -265,121 +278,38 @@ export declare class AttributeDefinition implements Accessor {
|
|
|
265
278
|
export declare type AttributeMode = typeof reflectMode | typeof booleanMode | "fromView";
|
|
266
279
|
|
|
267
280
|
/**
|
|
268
|
-
*
|
|
269
|
-
*
|
|
270
|
-
* @
|
|
271
|
-
|
|
272
|
-
export declare interface Behavior<TSource = any, TParent = any, TContext extends ExecutionContext<TParent> = RootContext> {
|
|
273
|
-
/**
|
|
274
|
-
* Bind this behavior to the source.
|
|
275
|
-
* @param source - The source to bind to.
|
|
276
|
-
* @param context - The execution context that the binding is operating within.
|
|
277
|
-
*/
|
|
278
|
-
bind(source: TSource, context: TContext): void;
|
|
279
|
-
/**
|
|
280
|
-
* Unbinds this behavior from the source.
|
|
281
|
-
* @param source - The source to unbind from.
|
|
282
|
-
*/
|
|
283
|
-
unbind(source: TSource, context: TContext): void;
|
|
284
|
-
}
|
|
285
|
-
|
|
286
|
-
/**
|
|
287
|
-
* Creates a binding directive with the specified configuration.
|
|
288
|
-
* @param binding - The binding expression.
|
|
289
|
-
* @param config - The binding configuration.
|
|
290
|
-
* @returns A binding directive.
|
|
291
|
-
* @public
|
|
292
|
-
*/
|
|
293
|
-
export declare function bind<T = any>(binding: Binding<T>, config?: BindingConfig | DefaultBindingOptions): CaptureType<T>;
|
|
294
|
-
|
|
295
|
-
/**
|
|
296
|
-
* The signature of an arrow function capable of being evaluated
|
|
297
|
-
* as part of a template binding update.
|
|
298
|
-
* @public
|
|
299
|
-
*/
|
|
300
|
-
export declare type Binding<TSource = any, TReturn = any, TContext extends ExecutionContext = ExecutionContext> = (source: TSource, context: TContext) => TReturn;
|
|
301
|
-
|
|
302
|
-
/**
|
|
303
|
-
* Describes the configuration for a binding expression.
|
|
304
|
-
* @public
|
|
305
|
-
*/
|
|
306
|
-
export declare interface BindingConfig<T = any> {
|
|
307
|
-
/**
|
|
308
|
-
* The binding mode to configure the binding with.
|
|
309
|
-
*/
|
|
310
|
-
mode: BindingMode;
|
|
311
|
-
/**
|
|
312
|
-
* Options to be supplied to the binding behaviors.
|
|
313
|
-
*/
|
|
314
|
-
options: T;
|
|
315
|
-
}
|
|
316
|
-
|
|
317
|
-
/**
|
|
318
|
-
* Describes the configuration for a binding expression.
|
|
319
|
-
* @public
|
|
320
|
-
*/
|
|
321
|
-
export declare const BindingConfig: Readonly<{
|
|
322
|
-
/**
|
|
323
|
-
* Creates a binding configuration based on the provided mode and options.
|
|
324
|
-
* @param mode - The mode to use for the configuration.
|
|
325
|
-
* @param defaultOptions - The default options to use for the configuration.
|
|
326
|
-
* @returns A new binding configuration.
|
|
327
|
-
*/
|
|
328
|
-
define<T>(mode: BindingMode, defaultOptions: T): BindingConfig<T> & BindingConfigResolver<T>;
|
|
329
|
-
}>;
|
|
330
|
-
|
|
331
|
-
/**
|
|
332
|
-
* Creates a new binding configuration based on the supplied options.
|
|
333
|
-
* @public
|
|
334
|
-
*/
|
|
335
|
-
export declare type BindingConfigResolver<T> = (options: T) => BindingConfig<T>;
|
|
336
|
-
|
|
337
|
-
/**
|
|
338
|
-
* Describes how aspects of an HTML element will be affected by bindings.
|
|
339
|
-
* @public
|
|
340
|
-
*/
|
|
341
|
-
export declare type BindingMode = Record<Aspect, (directive: HTMLBindingDirective) => Pick<ViewBehaviorFactory, "createBehavior">>;
|
|
342
|
-
|
|
343
|
-
/**
|
|
344
|
-
* Describes how aspects of an HTML element will be affected by bindings.
|
|
281
|
+
* Creates an standard binding.
|
|
282
|
+
* @param binding - The binding to refresh when changed.
|
|
283
|
+
* @param isVolatile - Indicates whether the binding is volatile or not.
|
|
284
|
+
* @returns A binding configuration.
|
|
345
285
|
* @public
|
|
346
286
|
*/
|
|
347
|
-
export declare
|
|
348
|
-
/**
|
|
349
|
-
* Creates a binding mode based on the supplied behavior types.
|
|
350
|
-
* @param UpdateType - The base behavior type used to update aspects.
|
|
351
|
-
* @param EventType - The base behavior type used to respond to events.
|
|
352
|
-
* @returns A new binding mode.
|
|
353
|
-
*/
|
|
354
|
-
define(UpdateType: typeof UpdateBinding, EventType?: typeof EventBinding): BindingMode;
|
|
355
|
-
}>;
|
|
287
|
+
export declare function bind<T = any>(binding: Expression<T>, isVolatile?: boolean): Binding<T>;
|
|
356
288
|
|
|
357
289
|
/**
|
|
358
|
-
*
|
|
290
|
+
* Captures a binding expression along with related information and capabilities.
|
|
291
|
+
*
|
|
359
292
|
* @public
|
|
360
293
|
*/
|
|
361
|
-
export declare
|
|
294
|
+
export declare abstract class Binding<TSource = any, TReturn = any, TParent = any> {
|
|
295
|
+
evaluate: Expression<TSource, TReturn, TParent>;
|
|
296
|
+
isVolatile: boolean;
|
|
362
297
|
/**
|
|
363
|
-
*
|
|
364
|
-
* @param source - The source that the binding is based on.
|
|
365
|
-
* @param context - The execution context to execute the binding within.
|
|
366
|
-
* @returns The value of the binding.
|
|
298
|
+
* Options associated with the binding.
|
|
367
299
|
*/
|
|
368
|
-
|
|
300
|
+
options?: any;
|
|
369
301
|
/**
|
|
370
|
-
*
|
|
371
|
-
*
|
|
302
|
+
* Creates a binding.
|
|
303
|
+
* @param evaluate - Evaluates the binding.
|
|
304
|
+
* @param isVolatile - Indicates whether the binding is volatile.
|
|
372
305
|
*/
|
|
373
|
-
|
|
306
|
+
constructor(evaluate: Expression<TSource, TReturn, TParent>, isVolatile?: boolean);
|
|
374
307
|
/**
|
|
375
|
-
*
|
|
376
|
-
* @param
|
|
377
|
-
* @
|
|
378
|
-
* By default, the update mode is asynchronous, since that provides the best
|
|
379
|
-
* performance for template rendering scenarios. Passing false to setMode will
|
|
380
|
-
* instead cause the observer to notify subscribers immediately when changes occur.
|
|
308
|
+
* Creates an observer capable of notifying a subscriber when the output of a binding changes.
|
|
309
|
+
* @param directive - The HTML Directive to create the observer for.
|
|
310
|
+
* @param subscriber - The subscriber to changes in the binding.
|
|
381
311
|
*/
|
|
382
|
-
|
|
312
|
+
abstract createObserver(directive: HTMLDirective, subscriber: Subscriber): ExpressionObserver<TSource, TReturn, TParent>;
|
|
383
313
|
}
|
|
384
314
|
|
|
385
315
|
/**
|
|
@@ -405,77 +335,7 @@ export declare type Callable = typeof Function.prototype.call | {
|
|
|
405
335
|
* into templates.
|
|
406
336
|
* @public
|
|
407
337
|
*/
|
|
408
|
-
export declare interface CaptureType<TSource> {
|
|
409
|
-
}
|
|
410
|
-
|
|
411
|
-
/**
|
|
412
|
-
* A binding behavior for bindings that change.
|
|
413
|
-
* @public
|
|
414
|
-
*/
|
|
415
|
-
export declare class ChangeBinding extends UpdateBinding {
|
|
416
|
-
private isBindingVolatile;
|
|
417
|
-
private observerProperty;
|
|
418
|
-
/**
|
|
419
|
-
* Creates an instance of ChangeBinding.
|
|
420
|
-
* @param directive - The directive that has the configuration for this behavior.
|
|
421
|
-
* @param updateTarget - The function used to update the target with the latest value.
|
|
422
|
-
*/
|
|
423
|
-
constructor(directive: HTMLBindingDirective, updateTarget: UpdateTarget);
|
|
424
|
-
/**
|
|
425
|
-
* Returns the binding observer used to update the node.
|
|
426
|
-
* @param target - The target node.
|
|
427
|
-
* @returns A BindingObserver.
|
|
428
|
-
*/
|
|
429
|
-
protected getObserver(target: Node): BindingObserver;
|
|
430
|
-
/**
|
|
431
|
-
* Bind this behavior to the source.
|
|
432
|
-
* @param source - The source to bind to.
|
|
433
|
-
* @param context - The execution context that the binding is operating within.
|
|
434
|
-
* @param targets - The targets that behaviors in a view can attach to.
|
|
435
|
-
*/
|
|
436
|
-
bind(source: any, context: ExecutionContext, targets: ViewBehaviorTargets): void;
|
|
437
|
-
/**
|
|
438
|
-
* Unbinds this behavior from the source.
|
|
439
|
-
* @param source - The source to unbind from.
|
|
440
|
-
* @param context - The execution context that the binding is operating within.
|
|
441
|
-
* @param targets - The targets that behaviors in a view can attach to.
|
|
442
|
-
*/
|
|
443
|
-
unbind(source: any, context: ExecutionContext, targets: ViewBehaviorTargets): void;
|
|
444
|
-
/** @internal */
|
|
445
|
-
handleChange(binding: Binding, observer: BindingObserver): void;
|
|
446
|
-
}
|
|
447
|
-
|
|
448
|
-
/**
|
|
449
|
-
* Transforms a template literal string into a ChildViewTemplate.
|
|
450
|
-
* @param strings - The string fragments that are interpolated with the values.
|
|
451
|
-
* @param values - The values that are interpolated with the string fragments.
|
|
452
|
-
* @remarks
|
|
453
|
-
* The html helper supports interpolation of strings, numbers, binding expressions,
|
|
454
|
-
* other template instances, and Directive instances.
|
|
455
|
-
* @public
|
|
456
|
-
*/
|
|
457
|
-
export declare const child: <TChild = any, TParent = any>(strings: TemplateStringsArray, ...values: TemplateValue<TChild, TParent, ChildContext<TParent>>[]) => ChildViewTemplate<TChild, TParent>;
|
|
458
|
-
|
|
459
|
-
/**
|
|
460
|
-
* Provides additional contextual information when inside a child template.
|
|
461
|
-
* @public
|
|
462
|
-
*/
|
|
463
|
-
export declare interface ChildContext<TParentSource = any> extends RootContext {
|
|
464
|
-
/**
|
|
465
|
-
* The parent data source within a nested context.
|
|
466
|
-
*/
|
|
467
|
-
readonly parent: TParentSource;
|
|
468
|
-
/**
|
|
469
|
-
* The parent execution context when in nested context scenarios.
|
|
470
|
-
*/
|
|
471
|
-
readonly parentContext: ChildContext<TParentSource>;
|
|
472
|
-
/**
|
|
473
|
-
* Creates a new execution context descent suitable for use in list rendering.
|
|
474
|
-
* @param item - The list item to serve as the source.
|
|
475
|
-
* @param index - The index of the item in the list.
|
|
476
|
-
* @param length - The length of the list.
|
|
477
|
-
*/
|
|
478
|
-
createItemContext(index: number, length: number): ItemContext<TParentSource>;
|
|
338
|
+
export declare interface CaptureType<TSource, TParent> {
|
|
479
339
|
}
|
|
480
340
|
|
|
481
341
|
/**
|
|
@@ -491,7 +351,7 @@ export declare interface ChildListDirectiveOptions<T = any> extends NodeBehavior
|
|
|
491
351
|
* @param propertyOrOptions - The options used to configure child node observation.
|
|
492
352
|
* @public
|
|
493
353
|
*/
|
|
494
|
-
export declare function children<
|
|
354
|
+
export declare function children<TSource = any, TParent = any>(propertyOrOptions: (keyof TSource & string) | ChildrenDirectiveOptions<keyof TSource & string>): CaptureType<TSource, TParent>;
|
|
495
355
|
|
|
496
356
|
/**
|
|
497
357
|
* The runtime behavior for child node observation.
|
|
@@ -528,18 +388,6 @@ export declare class ChildrenDirective extends NodeObservationDirective<Children
|
|
|
528
388
|
*/
|
|
529
389
|
export declare type ChildrenDirectiveOptions<T = any> = ChildListDirectiveOptions<T> | SubtreeDirectiveOptions<T>;
|
|
530
390
|
|
|
531
|
-
/**
|
|
532
|
-
* A template capable of rendering child views not specifically connected to custom elements.
|
|
533
|
-
* @public
|
|
534
|
-
*/
|
|
535
|
-
export declare interface ChildViewTemplate<TSource = any, TParent = any> {
|
|
536
|
-
type: "child";
|
|
537
|
-
/**
|
|
538
|
-
* Creates a SyntheticView instance based on this template definition.
|
|
539
|
-
*/
|
|
540
|
-
create(): SyntheticView<TSource, TParent, ChildContext<TParent>>;
|
|
541
|
-
}
|
|
542
|
-
|
|
543
391
|
/**
|
|
544
392
|
* A function capable of compiling a template from the preprocessed form produced
|
|
545
393
|
* by the html template function into a result that can instantiate views.
|
|
@@ -579,7 +427,7 @@ export declare const Compiler: {
|
|
|
579
427
|
* it is recommended that you clone the original and pass the clone to this API.
|
|
580
428
|
* @public
|
|
581
429
|
*/
|
|
582
|
-
compile<TSource = any, TParent = any
|
|
430
|
+
compile<TSource = any, TParent = any>(html: string | HTMLTemplateElement, directives: Record<string, ViewBehaviorFactory>): HTMLTemplateCompilationResult<TSource, TParent>;
|
|
583
431
|
/**
|
|
584
432
|
* Sets the default compilation strategy that will be used by the ViewTemplate whenever
|
|
585
433
|
* it needs to compile a view preprocessed with the html template function.
|
|
@@ -601,6 +449,10 @@ export declare const Compiler: {
|
|
|
601
449
|
*/
|
|
602
450
|
export declare type ComposableStyles = string | ElementStyles | CSSStyleSheet;
|
|
603
451
|
|
|
452
|
+
declare function compose<TType extends Constructable<HTMLElement> = Constructable<HTMLElement>>(this: TType, nameOrDef: string | PartialFASTElementDefinition): FASTElementDefinition<TType>;
|
|
453
|
+
|
|
454
|
+
declare function compose<TType extends Constructable<HTMLElement> = Constructable<HTMLElement>>(type: TType, nameOrDef?: string | PartialFASTElementDefinition): FASTElementDefinition<TType>;
|
|
455
|
+
|
|
604
456
|
/**
|
|
605
457
|
* Allows for the creation of Constructable mixin classes.
|
|
606
458
|
*
|
|
@@ -623,127 +475,51 @@ export declare type ConstructibleStyleStrategy = {
|
|
|
623
475
|
};
|
|
624
476
|
|
|
625
477
|
/**
|
|
626
|
-
*
|
|
478
|
+
* A simple template that can create ContentView instances.
|
|
627
479
|
* @public
|
|
628
480
|
*/
|
|
629
|
-
export declare
|
|
630
|
-
private boundObservables;
|
|
631
|
-
private behaviors;
|
|
632
|
-
private needsInitialization;
|
|
633
|
-
private hasExistingShadowRoot;
|
|
634
|
-
private _template;
|
|
635
|
-
private _styles;
|
|
636
|
-
private _isConnected;
|
|
637
|
-
/**
|
|
638
|
-
* This allows Observable.getNotifier(...) to return the Controller
|
|
639
|
-
* when the notifier for the Controller itself is being requested. The
|
|
640
|
-
* result is that the Observable system does not need to create a separate
|
|
641
|
-
* instance of Notifier for observables on the Controller. The component and
|
|
642
|
-
* the controller will now share the same notifier, removing one-object construct
|
|
643
|
-
* per web component instance.
|
|
644
|
-
*/
|
|
645
|
-
private readonly $fastController;
|
|
646
|
-
/**
|
|
647
|
-
* The element being controlled by this controller.
|
|
648
|
-
*/
|
|
649
|
-
readonly element: TElement;
|
|
650
|
-
/**
|
|
651
|
-
* The element definition that instructs this controller
|
|
652
|
-
* in how to handle rendering and other platform integrations.
|
|
653
|
-
*/
|
|
654
|
-
readonly definition: FASTElementDefinition;
|
|
655
|
-
/**
|
|
656
|
-
* The view associated with the custom element.
|
|
657
|
-
* @remarks
|
|
658
|
-
* If `null` then the element is managing its own rendering.
|
|
659
|
-
*/
|
|
660
|
-
readonly view: ElementView<TElement> | null;
|
|
661
|
-
/**
|
|
662
|
-
* Indicates whether or not the custom element has been
|
|
663
|
-
* connected to the document.
|
|
664
|
-
*/
|
|
665
|
-
get isConnected(): boolean;
|
|
666
|
-
private setIsConnected;
|
|
667
|
-
/**
|
|
668
|
-
* Gets/sets the template used to render the component.
|
|
669
|
-
* @remarks
|
|
670
|
-
* This value can only be accurately read after connect but can be set at any time.
|
|
671
|
-
*/
|
|
672
|
-
get template(): ElementViewTemplate<TElement> | null;
|
|
673
|
-
set template(value: ElementViewTemplate<TElement> | null);
|
|
674
|
-
/**
|
|
675
|
-
* Gets/sets the primary styles used for the component.
|
|
676
|
-
* @remarks
|
|
677
|
-
* This value can only be accurately read after connect but can be set at any time.
|
|
678
|
-
*/
|
|
679
|
-
get styles(): ElementStyles | null;
|
|
680
|
-
set styles(value: ElementStyles | null);
|
|
681
|
-
/**
|
|
682
|
-
* Creates a Controller to control the specified element.
|
|
683
|
-
* @param element - The element to be controlled by this controller.
|
|
684
|
-
* @param definition - The element definition metadata that instructs this
|
|
685
|
-
* controller in how to handle rendering and other platform integrations.
|
|
686
|
-
* @internal
|
|
687
|
-
*/
|
|
688
|
-
constructor(element: TElement, definition: FASTElementDefinition);
|
|
689
|
-
/**
|
|
690
|
-
* Adds styles to this element. Providing an HTMLStyleElement will attach the element instance to the shadowRoot.
|
|
691
|
-
* @param styles - The styles to add.
|
|
692
|
-
*/
|
|
693
|
-
addStyles(styles: ElementStyles | HTMLStyleElement | null | undefined): void;
|
|
694
|
-
/**
|
|
695
|
-
* Removes styles from this element. Providing an HTMLStyleElement will detach the element instance from the shadowRoot.
|
|
696
|
-
* @param styles - the styles to remove.
|
|
697
|
-
*/
|
|
698
|
-
removeStyles(styles: ElementStyles | HTMLStyleElement | null | undefined): void;
|
|
699
|
-
/**
|
|
700
|
-
* Adds behaviors to this element.
|
|
701
|
-
* @param behaviors - The behaviors to add.
|
|
702
|
-
*/
|
|
703
|
-
addBehaviors(behaviors: ReadonlyArray<Behavior<TElement>>): void;
|
|
704
|
-
/**
|
|
705
|
-
* Removes behaviors from this element.
|
|
706
|
-
* @param behaviors - The behaviors to remove.
|
|
707
|
-
* @param force - Forces unbinding of behaviors.
|
|
708
|
-
*/
|
|
709
|
-
removeBehaviors(behaviors: ReadonlyArray<Behavior<TElement>>, force?: boolean): void;
|
|
481
|
+
export declare interface ContentTemplate {
|
|
710
482
|
/**
|
|
711
|
-
*
|
|
483
|
+
* Creates a simple content view instance.
|
|
712
484
|
*/
|
|
713
|
-
|
|
485
|
+
create(): ContentView;
|
|
486
|
+
}
|
|
487
|
+
|
|
488
|
+
/**
|
|
489
|
+
* A simple View that can be interpolated into HTML content.
|
|
490
|
+
* @public
|
|
491
|
+
*/
|
|
492
|
+
export declare interface ContentView {
|
|
493
|
+
readonly context: ExecutionContext;
|
|
714
494
|
/**
|
|
715
|
-
*
|
|
495
|
+
* Binds a view's behaviors to its binding source.
|
|
496
|
+
* @param source - The binding source for the view's binding behaviors.
|
|
497
|
+
* @param context - The execution context to run the view within.
|
|
716
498
|
*/
|
|
717
|
-
|
|
499
|
+
bind(source: any, context?: ExecutionContext): void;
|
|
718
500
|
/**
|
|
719
|
-
*
|
|
720
|
-
* @param name - The name of the attribute that changed.
|
|
721
|
-
* @param oldValue - The previous value of the attribute.
|
|
722
|
-
* @param newValue - The new value of the attribute.
|
|
501
|
+
* Unbinds a view's behaviors from its binding source and context.
|
|
723
502
|
*/
|
|
724
|
-
|
|
503
|
+
unbind(): void;
|
|
725
504
|
/**
|
|
726
|
-
*
|
|
727
|
-
* @param
|
|
728
|
-
* @param detail - The event detail object to send with the event.
|
|
729
|
-
* @param options - The event options. By default bubbles and composed.
|
|
730
|
-
* @remarks
|
|
731
|
-
* Only emits events if connected.
|
|
505
|
+
* Inserts the view's DOM nodes before the referenced node.
|
|
506
|
+
* @param node - The node to insert the view's DOM before.
|
|
732
507
|
*/
|
|
733
|
-
|
|
734
|
-
private finishInitialization;
|
|
735
|
-
private renderTemplate;
|
|
508
|
+
insertBefore(node: Node): void;
|
|
736
509
|
/**
|
|
737
|
-
*
|
|
738
|
-
*
|
|
739
|
-
* @remarks
|
|
740
|
-
* The specified element must have a {@link FASTElementDefinition}
|
|
741
|
-
* registered either through the use of the {@link customElement}
|
|
742
|
-
* decorator or a call to `FASTElement.define`.
|
|
510
|
+
* Removes the view's DOM nodes.
|
|
511
|
+
* The nodes are not disposed and the view can later be re-inserted.
|
|
743
512
|
*/
|
|
744
|
-
|
|
513
|
+
remove(): void;
|
|
745
514
|
}
|
|
746
515
|
|
|
516
|
+
/**
|
|
517
|
+
* Creates a function capable of locating metadata associated with a type.
|
|
518
|
+
* @returns A metadata locator function.
|
|
519
|
+
* @internal
|
|
520
|
+
*/
|
|
521
|
+
export declare function createMetadataLocator<TMetadata>(): (target: {}) => TMetadata[];
|
|
522
|
+
|
|
747
523
|
/**
|
|
748
524
|
* Do not change. Part of shared kernel contract.
|
|
749
525
|
* @internal
|
|
@@ -852,20 +628,9 @@ export declare function customElement(nameOrDef: string | PartialFASTElementDefi
|
|
|
852
628
|
*/
|
|
853
629
|
export declare type DecoratorAttributeConfiguration = Omit<AttributeConfiguration, "property">;
|
|
854
630
|
|
|
855
|
-
|
|
856
|
-
* The default binding options.
|
|
857
|
-
* @public
|
|
858
|
-
*/
|
|
859
|
-
export declare type DefaultBindingOptions = AddEventListenerOptions;
|
|
631
|
+
declare function define<TType extends Constructable<HTMLElement> = Constructable<HTMLElement>>(this: TType, nameOrDef: string | PartialFASTElementDefinition): TType;
|
|
860
632
|
|
|
861
|
-
|
|
862
|
-
* The default twoWay binding options.
|
|
863
|
-
* @public
|
|
864
|
-
*/
|
|
865
|
-
export declare type DefaultTwoWayBindingOptions = DefaultBindingOptions & {
|
|
866
|
-
changeEvent?: string;
|
|
867
|
-
fromView?: (value: any) => any;
|
|
868
|
-
};
|
|
633
|
+
declare function define<TType extends Constructable<HTMLElement> = Constructable<HTMLElement>>(type: TType, nameOrDef?: string | PartialFASTElementDefinition): TType;
|
|
869
634
|
|
|
870
635
|
/**
|
|
871
636
|
* Provides a mechanism for releasing resources.
|
|
@@ -920,20 +685,141 @@ export declare const DOM: Readonly<{
|
|
|
920
685
|
}>;
|
|
921
686
|
|
|
922
687
|
/**
|
|
923
|
-
*
|
|
924
|
-
* @param selector - An optional selector to restrict the filter to.
|
|
925
|
-
* @public
|
|
926
|
-
*/
|
|
927
|
-
export declare const elements: (selector?: string) => ElementsFilter;
|
|
928
|
-
|
|
929
|
-
/**
|
|
930
|
-
* Elements filter function type.
|
|
931
|
-
*
|
|
688
|
+
* Controls the lifecycle and rendering of a `FASTElement`.
|
|
932
689
|
* @public
|
|
933
690
|
*/
|
|
934
|
-
export declare
|
|
935
|
-
|
|
936
|
-
|
|
691
|
+
export declare class ElementController<TElement extends HTMLElement = HTMLElement> extends PropertyChangeNotifier implements HostController<TElement> {
|
|
692
|
+
private boundObservables;
|
|
693
|
+
private needsInitialization;
|
|
694
|
+
private hasExistingShadowRoot;
|
|
695
|
+
private _template;
|
|
696
|
+
private _isConnected;
|
|
697
|
+
private behaviors;
|
|
698
|
+
private _mainStyles;
|
|
699
|
+
/**
|
|
700
|
+
* This allows Observable.getNotifier(...) to return the Controller
|
|
701
|
+
* when the notifier for the Controller itself is being requested. The
|
|
702
|
+
* result is that the Observable system does not need to create a separate
|
|
703
|
+
* instance of Notifier for observables on the Controller. The component and
|
|
704
|
+
* the controller will now share the same notifier, removing one-object construct
|
|
705
|
+
* per web component instance.
|
|
706
|
+
*/
|
|
707
|
+
private readonly $fastController;
|
|
708
|
+
/**
|
|
709
|
+
* The element being controlled by this controller.
|
|
710
|
+
*/
|
|
711
|
+
readonly source: TElement;
|
|
712
|
+
/**
|
|
713
|
+
* The element definition that instructs this controller
|
|
714
|
+
* in how to handle rendering and other platform integrations.
|
|
715
|
+
*/
|
|
716
|
+
readonly definition: FASTElementDefinition;
|
|
717
|
+
/**
|
|
718
|
+
* The view associated with the custom element.
|
|
719
|
+
* @remarks
|
|
720
|
+
* If `null` then the element is managing its own rendering.
|
|
721
|
+
*/
|
|
722
|
+
readonly view: ElementView<TElement> | null;
|
|
723
|
+
/**
|
|
724
|
+
* Indicates whether or not the custom element has been
|
|
725
|
+
* connected to the document.
|
|
726
|
+
*/
|
|
727
|
+
get isConnected(): boolean;
|
|
728
|
+
private setIsConnected;
|
|
729
|
+
/**
|
|
730
|
+
* Gets/sets the template used to render the component.
|
|
731
|
+
* @remarks
|
|
732
|
+
* This value can only be accurately read after connect but can be set at any time.
|
|
733
|
+
*/
|
|
734
|
+
get template(): ElementViewTemplate<TElement> | null;
|
|
735
|
+
set template(value: ElementViewTemplate<TElement> | null);
|
|
736
|
+
/**
|
|
737
|
+
* The main set of styles used for the component, independent
|
|
738
|
+
* of any dynamically added styles.
|
|
739
|
+
*/
|
|
740
|
+
get mainStyles(): ElementStyles | null;
|
|
741
|
+
set mainStyles(value: ElementStyles | null);
|
|
742
|
+
/**
|
|
743
|
+
* Creates a Controller to control the specified element.
|
|
744
|
+
* @param element - The element to be controlled by this controller.
|
|
745
|
+
* @param definition - The element definition metadata that instructs this
|
|
746
|
+
* controller in how to handle rendering and other platform integrations.
|
|
747
|
+
* @internal
|
|
748
|
+
*/
|
|
749
|
+
constructor(element: TElement, definition: FASTElementDefinition);
|
|
750
|
+
/**
|
|
751
|
+
* Adds the behavior to the component.
|
|
752
|
+
* @param behavior - The behavior to add.
|
|
753
|
+
*/
|
|
754
|
+
addBehavior(behavior: HostBehavior<TElement>): void;
|
|
755
|
+
/**
|
|
756
|
+
* Removes the behavior from the component.
|
|
757
|
+
* @param behavior - The behavior to remove.
|
|
758
|
+
* @param force - Forces removal even if this behavior was added more than once.
|
|
759
|
+
*/
|
|
760
|
+
removeBehavior(behavior: HostBehavior<TElement>, force?: boolean): void;
|
|
761
|
+
/**
|
|
762
|
+
* Adds styles to this element. Providing an HTMLStyleElement will attach the element instance to the shadowRoot.
|
|
763
|
+
* @param styles - The styles to add.
|
|
764
|
+
*/
|
|
765
|
+
addStyles(styles: ElementStyles | HTMLStyleElement | null | undefined): void;
|
|
766
|
+
/**
|
|
767
|
+
* Removes styles from this element. Providing an HTMLStyleElement will detach the element instance from the shadowRoot.
|
|
768
|
+
* @param styles - the styles to remove.
|
|
769
|
+
*/
|
|
770
|
+
removeStyles(styles: ElementStyles | HTMLStyleElement | null | undefined): void;
|
|
771
|
+
/**
|
|
772
|
+
* Runs connected lifecycle behavior on the associated element.
|
|
773
|
+
*/
|
|
774
|
+
connect(): void;
|
|
775
|
+
/**
|
|
776
|
+
* Runs disconnected lifecycle behavior on the associated element.
|
|
777
|
+
*/
|
|
778
|
+
disconnect(): void;
|
|
779
|
+
/**
|
|
780
|
+
* Runs the attribute changed callback for the associated element.
|
|
781
|
+
* @param name - The name of the attribute that changed.
|
|
782
|
+
* @param oldValue - The previous value of the attribute.
|
|
783
|
+
* @param newValue - The new value of the attribute.
|
|
784
|
+
*/
|
|
785
|
+
onAttributeChangedCallback(name: string, oldValue: string | null, newValue: string | null): void;
|
|
786
|
+
/**
|
|
787
|
+
* Emits a custom HTML event.
|
|
788
|
+
* @param type - The type name of the event.
|
|
789
|
+
* @param detail - The event detail object to send with the event.
|
|
790
|
+
* @param options - The event options. By default bubbles and composed.
|
|
791
|
+
* @remarks
|
|
792
|
+
* Only emits events if connected.
|
|
793
|
+
*/
|
|
794
|
+
emit(type: string, detail?: any, options?: Omit<CustomEventInit, "detail">): void | boolean;
|
|
795
|
+
private finishInitialization;
|
|
796
|
+
private renderTemplate;
|
|
797
|
+
/**
|
|
798
|
+
* Locates or creates a controller for the specified element.
|
|
799
|
+
* @param element - The element to return the controller for.
|
|
800
|
+
* @remarks
|
|
801
|
+
* The specified element must have a {@link FASTElementDefinition}
|
|
802
|
+
* registered either through the use of the {@link customElement}
|
|
803
|
+
* decorator or a call to `FASTElement.define`.
|
|
804
|
+
*/
|
|
805
|
+
static forCustomElement(element: HTMLElement): ElementController;
|
|
806
|
+
}
|
|
807
|
+
|
|
808
|
+
/**
|
|
809
|
+
* Creates a function that can be used to filter a Node array, selecting only elements.
|
|
810
|
+
* @param selector - An optional selector to restrict the filter to.
|
|
811
|
+
* @public
|
|
812
|
+
*/
|
|
813
|
+
export declare const elements: (selector?: string) => ElementsFilter;
|
|
814
|
+
|
|
815
|
+
/**
|
|
816
|
+
* Elements filter function type.
|
|
817
|
+
*
|
|
818
|
+
* @public
|
|
819
|
+
*/
|
|
820
|
+
export declare type ElementsFilter = (value: Node, index?: number, array?: Node[]) => boolean;
|
|
821
|
+
|
|
822
|
+
/**
|
|
937
823
|
* Represents styles that can be applied to a custom element.
|
|
938
824
|
* @public
|
|
939
825
|
*/
|
|
@@ -944,7 +830,7 @@ export declare class ElementStyles {
|
|
|
944
830
|
/**
|
|
945
831
|
* The behaviors associated with this set of styles.
|
|
946
832
|
*/
|
|
947
|
-
readonly behaviors: ReadonlyArray<
|
|
833
|
+
readonly behaviors: ReadonlyArray<HostBehavior<HTMLElement>> | null;
|
|
948
834
|
/**
|
|
949
835
|
* Gets the StyleStrategy associated with these element styles.
|
|
950
836
|
*/
|
|
@@ -964,7 +850,7 @@ export declare class ElementStyles {
|
|
|
964
850
|
* Associates behaviors with this set of styles.
|
|
965
851
|
* @param behaviors - The behaviors to associate.
|
|
966
852
|
*/
|
|
967
|
-
withBehaviors(...behaviors:
|
|
853
|
+
withBehaviors(...behaviors: HostBehavior<HTMLElement>[]): this;
|
|
968
854
|
/**
|
|
969
855
|
* Sets the strategy that handles adding/removing these styles for an element.
|
|
970
856
|
* @param strategy - The strategy to use.
|
|
@@ -975,6 +861,12 @@ export declare class ElementStyles {
|
|
|
975
861
|
* @param Strategy - The strategy type to construct.
|
|
976
862
|
*/
|
|
977
863
|
static setDefaultStrategy(Strategy: ConstructibleStyleStrategy): void;
|
|
864
|
+
/**
|
|
865
|
+
* Normalizes a set of composable style options.
|
|
866
|
+
* @param styles - The style options to normalize.
|
|
867
|
+
* @returns A singular ElementStyles instance or undefined.
|
|
868
|
+
*/
|
|
869
|
+
static normalize(styles: ComposableStyles | ComposableStyles[] | undefined): ElementStyles | undefined;
|
|
978
870
|
/**
|
|
979
871
|
* Indicates whether the DOM supports the adoptedStyleSheets feature.
|
|
980
872
|
*/
|
|
@@ -985,7 +877,7 @@ export declare class ElementStyles {
|
|
|
985
877
|
* A View representing DOM nodes specifically for rendering the view of a custom element.
|
|
986
878
|
* @public
|
|
987
879
|
*/
|
|
988
|
-
export declare interface ElementView<TSource = any, TParent = any> extends View<TSource, TParent
|
|
880
|
+
export declare interface ElementView<TSource = any, TParent = any> extends View<TSource, TParent> {
|
|
989
881
|
/**
|
|
990
882
|
* Appends the view's DOM nodes to the referenced node.
|
|
991
883
|
* @param node - The parent node to append the view's DOM nodes to.
|
|
@@ -998,7 +890,6 @@ export declare interface ElementView<TSource = any, TParent = any> extends View<
|
|
|
998
890
|
* @public
|
|
999
891
|
*/
|
|
1000
892
|
export declare interface ElementViewTemplate<TSource = any, TParent = any> {
|
|
1001
|
-
type: "element";
|
|
1002
893
|
/**
|
|
1003
894
|
* Creates an ElementView instance based on this template definition.
|
|
1004
895
|
* @param hostBindingTarget - The element that host behaviors will be bound to.
|
|
@@ -1024,67 +915,162 @@ export declare interface ElementViewTemplate<TSource = any, TParent = any> {
|
|
|
1024
915
|
export declare const emptyArray: readonly never[];
|
|
1025
916
|
|
|
1026
917
|
/**
|
|
1027
|
-
*
|
|
918
|
+
* Provides additional contextual information available to behaviors and expressions.
|
|
1028
919
|
* @public
|
|
1029
920
|
*/
|
|
1030
|
-
export declare
|
|
1031
|
-
|
|
1032
|
-
|
|
1033
|
-
|
|
921
|
+
export declare interface ExecutionContext<TParent = any> {
|
|
922
|
+
/**
|
|
923
|
+
* The index of the current item within a repeat context.
|
|
924
|
+
*/
|
|
925
|
+
index: number;
|
|
1034
926
|
/**
|
|
1035
|
-
*
|
|
1036
|
-
* @param directive - The directive that has the configuration for this behavior.
|
|
927
|
+
* The length of the current collection within a repeat context.
|
|
1037
928
|
*/
|
|
1038
|
-
|
|
929
|
+
length: number;
|
|
1039
930
|
/**
|
|
1040
|
-
*
|
|
1041
|
-
* @param source - The source to bind to.
|
|
1042
|
-
* @param context - The execution context that the binding is operating within.
|
|
1043
|
-
* @param targets - The targets that behaviors in a view can attach to.
|
|
931
|
+
* The parent data source within a nested context.
|
|
1044
932
|
*/
|
|
1045
|
-
|
|
933
|
+
parent: TParent;
|
|
1046
934
|
/**
|
|
1047
|
-
*
|
|
1048
|
-
* @param source - The source to unbind from.
|
|
1049
|
-
* @param context - The execution context that the binding is operating within.
|
|
1050
|
-
* @param targets - The targets that behaviors in a view can attach to.
|
|
935
|
+
* The parent execution context when in nested context scenarios.
|
|
1051
936
|
*/
|
|
1052
|
-
|
|
937
|
+
parentContext: ExecutionContext<TParent>;
|
|
1053
938
|
/**
|
|
1054
|
-
*
|
|
1055
|
-
* @param targets - The targets available for behaviors to be attached to.
|
|
939
|
+
* The current event within an event handler.
|
|
1056
940
|
*/
|
|
1057
|
-
|
|
941
|
+
readonly event: Event;
|
|
1058
942
|
/**
|
|
1059
|
-
*
|
|
943
|
+
* Indicates whether the current item within a repeat context
|
|
944
|
+
* has an even index.
|
|
1060
945
|
*/
|
|
1061
|
-
|
|
946
|
+
readonly isEven: boolean;
|
|
947
|
+
/**
|
|
948
|
+
* Indicates whether the current item within a repeat context
|
|
949
|
+
* has an odd index.
|
|
950
|
+
*/
|
|
951
|
+
readonly isOdd: boolean;
|
|
952
|
+
/**
|
|
953
|
+
* Indicates whether the current item within a repeat context
|
|
954
|
+
* is the first item in the collection.
|
|
955
|
+
*/
|
|
956
|
+
readonly isFirst: boolean;
|
|
957
|
+
/**
|
|
958
|
+
* Indicates whether the current item within a repeat context
|
|
959
|
+
* is somewhere in the middle of the collection.
|
|
960
|
+
*/
|
|
961
|
+
readonly isInMiddle: boolean;
|
|
962
|
+
/**
|
|
963
|
+
* Indicates whether the current item within a repeat context
|
|
964
|
+
* is the last item in the collection.
|
|
965
|
+
*/
|
|
966
|
+
readonly isLast: boolean;
|
|
967
|
+
/**
|
|
968
|
+
* Returns the typed event detail of a custom event.
|
|
969
|
+
*/
|
|
970
|
+
eventDetail<TDetail>(): TDetail;
|
|
971
|
+
/**
|
|
972
|
+
* Returns the typed event target of the event.
|
|
973
|
+
*/
|
|
974
|
+
eventTarget<TTarget extends EventTarget>(): TTarget;
|
|
1062
975
|
}
|
|
1063
976
|
|
|
1064
977
|
/**
|
|
1065
|
-
*
|
|
978
|
+
* Provides additional contextual information available to behaviors and expressions.
|
|
1066
979
|
* @public
|
|
1067
980
|
*/
|
|
1068
981
|
export declare const ExecutionContext: Readonly<{
|
|
1069
|
-
default: RootContext;
|
|
1070
982
|
/**
|
|
1071
|
-
*
|
|
1072
|
-
* @param event - The event to set.
|
|
1073
|
-
* @internal
|
|
983
|
+
* A default execution context.
|
|
1074
984
|
*/
|
|
1075
|
-
|
|
985
|
+
default: ExecutionContext<any>;
|
|
986
|
+
/**
|
|
987
|
+
* Gets the current event.
|
|
988
|
+
* @returns An event object.
|
|
989
|
+
*/
|
|
990
|
+
getEvent(): Event | null;
|
|
1076
991
|
/**
|
|
1077
|
-
*
|
|
1078
|
-
* @
|
|
992
|
+
* Sets the current event.
|
|
993
|
+
* @param event - An event object.
|
|
1079
994
|
*/
|
|
1080
|
-
|
|
995
|
+
setEvent(event: Event | null): void;
|
|
1081
996
|
}>;
|
|
1082
997
|
|
|
1083
998
|
/**
|
|
1084
|
-
*
|
|
999
|
+
* The signature of an arrow function capable of being evaluated
|
|
1000
|
+
* against source data and within an execution context.
|
|
1001
|
+
* @public
|
|
1002
|
+
*/
|
|
1003
|
+
export declare type Expression<TSource = any, TReturn = any, TParent = any> = (source: TSource, context: ExecutionContext<TParent>) => TReturn;
|
|
1004
|
+
|
|
1005
|
+
/**
|
|
1006
|
+
* Controls the lifecycle of an expression and provides relevant context.
|
|
1085
1007
|
* @public
|
|
1086
1008
|
*/
|
|
1087
|
-
export declare
|
|
1009
|
+
export declare interface ExpressionController<TSource = any, TParent = any> {
|
|
1010
|
+
/**
|
|
1011
|
+
* The source the expression is evaluated against.
|
|
1012
|
+
*/
|
|
1013
|
+
readonly source: TSource;
|
|
1014
|
+
/**
|
|
1015
|
+
* Indicates how the source's lifetime relates to the controller's lifetime.
|
|
1016
|
+
*/
|
|
1017
|
+
readonly sourceLifetime?: SourceLifetime;
|
|
1018
|
+
/**
|
|
1019
|
+
* The context the expression is evaluated against.
|
|
1020
|
+
*/
|
|
1021
|
+
readonly context: ExecutionContext<TParent>;
|
|
1022
|
+
/**
|
|
1023
|
+
* Indicates whether the controller is bound.
|
|
1024
|
+
*/
|
|
1025
|
+
readonly isBound: boolean;
|
|
1026
|
+
/**
|
|
1027
|
+
* Registers an unbind handler with the controller.
|
|
1028
|
+
* @param behavior - An object to call when the controller unbinds.
|
|
1029
|
+
*/
|
|
1030
|
+
onUnbind(behavior: {
|
|
1031
|
+
unbind(controller: ExpressionController<TSource, TParent>): any;
|
|
1032
|
+
}): void;
|
|
1033
|
+
}
|
|
1034
|
+
|
|
1035
|
+
/**
|
|
1036
|
+
* Enables evaluation of and subscription to a binding.
|
|
1037
|
+
* @public
|
|
1038
|
+
*/
|
|
1039
|
+
export declare interface ExpressionNotifier<TSource = any, TReturn = any, TParent = any> extends Notifier, ExpressionObserver<TSource, TReturn, TParent>, Disposable {
|
|
1040
|
+
/**
|
|
1041
|
+
* Observes the expression.
|
|
1042
|
+
* @param source - The source for the expression.
|
|
1043
|
+
* @param context - The context for the expression.
|
|
1044
|
+
*/
|
|
1045
|
+
observe(source: TSource, context?: ExecutionContext): TReturn;
|
|
1046
|
+
/**
|
|
1047
|
+
* Gets {@link ObservationRecord|ObservationRecords} that the {@link ExpressionNotifier}
|
|
1048
|
+
* is observing.
|
|
1049
|
+
*/
|
|
1050
|
+
records(): IterableIterator<ObservationRecord>;
|
|
1051
|
+
/**
|
|
1052
|
+
* Sets the update mode used by the observer.
|
|
1053
|
+
* @param isAsync - Indicates whether updates should be asynchronous.
|
|
1054
|
+
* @remarks
|
|
1055
|
+
* By default, the update mode is asynchronous, since that provides the best
|
|
1056
|
+
* performance for template rendering scenarios. Passing false to setMode will
|
|
1057
|
+
* instead cause the observer to notify subscribers immediately when changes occur.
|
|
1058
|
+
*/
|
|
1059
|
+
setMode(isAsync: boolean): void;
|
|
1060
|
+
}
|
|
1061
|
+
|
|
1062
|
+
/**
|
|
1063
|
+
* Observes an expression for changes.
|
|
1064
|
+
* @public
|
|
1065
|
+
*/
|
|
1066
|
+
export declare interface ExpressionObserver<TSource = any, TReturn = any, TParent = any> {
|
|
1067
|
+
/**
|
|
1068
|
+
* Binds the expression to the source.
|
|
1069
|
+
* @param controller - The controller that manages the lifecycle and related
|
|
1070
|
+
* context for the expression.
|
|
1071
|
+
*/
|
|
1072
|
+
bind(controller: ExpressionController<TSource, TParent>): TReturn;
|
|
1073
|
+
}
|
|
1088
1074
|
|
|
1089
1075
|
/**
|
|
1090
1076
|
* The FAST global.
|
|
@@ -1101,7 +1087,7 @@ export declare interface FASTElement extends HTMLElement {
|
|
|
1101
1087
|
* The underlying controller that handles the lifecycle and rendering of
|
|
1102
1088
|
* this FASTElement.
|
|
1103
1089
|
*/
|
|
1104
|
-
readonly $fastController:
|
|
1090
|
+
readonly $fastController: ElementController;
|
|
1105
1091
|
/**
|
|
1106
1092
|
* Emits a custom HTML event.
|
|
1107
1093
|
* @param type - The type name of the event.
|
|
@@ -1142,23 +1128,11 @@ export declare interface FASTElement extends HTMLElement {
|
|
|
1142
1128
|
* static helpers for working with FASTElements.
|
|
1143
1129
|
* @public
|
|
1144
1130
|
*/
|
|
1145
|
-
export declare const FASTElement:
|
|
1146
|
-
|
|
1147
|
-
|
|
1148
|
-
|
|
1149
|
-
|
|
1150
|
-
*/
|
|
1151
|
-
from<TBase extends {
|
|
1152
|
-
new (): HTMLElement;
|
|
1153
|
-
prototype: HTMLElement;
|
|
1154
|
-
}>(BaseType: TBase): new () => InstanceType<TBase> & FASTElement;
|
|
1155
|
-
/**
|
|
1156
|
-
* Defines a platform custom element based on the provided type and definition.
|
|
1157
|
-
* @param type - The custom element type to define.
|
|
1158
|
-
* @param nameOrDef - The name of the element to define or a definition object
|
|
1159
|
-
* that describes the element to define.
|
|
1160
|
-
*/
|
|
1161
|
-
define<TType extends Constructable<HTMLElement>>(type: TType, nameOrDef?: string | PartialFASTElementDefinition): TType;
|
|
1131
|
+
export declare const FASTElement: {
|
|
1132
|
+
new (): FASTElement;
|
|
1133
|
+
define: typeof define;
|
|
1134
|
+
compose: typeof compose;
|
|
1135
|
+
from: typeof from;
|
|
1162
1136
|
};
|
|
1163
1137
|
|
|
1164
1138
|
/**
|
|
@@ -1166,7 +1140,7 @@ export declare const FASTElement: (new () => HTMLElement & FASTElement) & {
|
|
|
1166
1140
|
* @public
|
|
1167
1141
|
*/
|
|
1168
1142
|
export declare class FASTElementDefinition<TType extends Constructable<HTMLElement> = Constructable<HTMLElement>> {
|
|
1169
|
-
private
|
|
1143
|
+
private platformDefined;
|
|
1170
1144
|
/**
|
|
1171
1145
|
* The type this element definition describes.
|
|
1172
1146
|
*/
|
|
@@ -1202,23 +1176,36 @@ export declare class FASTElementDefinition<TType extends Constructable<HTMLEleme
|
|
|
1202
1176
|
/**
|
|
1203
1177
|
* Options controlling the creation of the custom element's shadow DOM.
|
|
1204
1178
|
*/
|
|
1205
|
-
readonly shadowOptions?:
|
|
1179
|
+
readonly shadowOptions?: ShadowRootOptions;
|
|
1206
1180
|
/**
|
|
1207
1181
|
* Options controlling how the custom element is defined with the platform.
|
|
1208
1182
|
*/
|
|
1209
|
-
readonly elementOptions
|
|
1183
|
+
readonly elementOptions: ElementDefinitionOptions;
|
|
1210
1184
|
/**
|
|
1211
|
-
*
|
|
1212
|
-
* @param type - The type this definition is being created for.
|
|
1213
|
-
* @param nameOrConfig - The name of the element to define or a config object
|
|
1214
|
-
* that describes the element to define.
|
|
1185
|
+
* The registry to register this component in by default.
|
|
1215
1186
|
*/
|
|
1216
|
-
|
|
1187
|
+
readonly registry: CustomElementRegistry;
|
|
1188
|
+
private constructor();
|
|
1217
1189
|
/**
|
|
1218
1190
|
* Defines a custom element based on this definition.
|
|
1219
1191
|
* @param registry - The element registry to define the element in.
|
|
1192
|
+
* @remarks
|
|
1193
|
+
* This operation is idempotent per registry.
|
|
1220
1194
|
*/
|
|
1221
1195
|
define(registry?: CustomElementRegistry): this;
|
|
1196
|
+
/**
|
|
1197
|
+
* Creates an instance of FASTElementDefinition.
|
|
1198
|
+
* @param type - The type this definition is being created for.
|
|
1199
|
+
* @param nameOrDef - The name of the element to define or a config object
|
|
1200
|
+
* that describes the element to define.
|
|
1201
|
+
*/
|
|
1202
|
+
static compose<TType extends Constructable<HTMLElement> = Constructable<HTMLElement>>(type: TType, nameOrDef?: string | PartialFASTElementDefinition): FASTElementDefinition<TType>;
|
|
1203
|
+
/**
|
|
1204
|
+
* Registers a FASTElement base type.
|
|
1205
|
+
* @param type - The type to register as a base type.
|
|
1206
|
+
* @internal
|
|
1207
|
+
*/
|
|
1208
|
+
static registerBaseType(type: Function): void;
|
|
1222
1209
|
/**
|
|
1223
1210
|
* Gets the element definition associated with the specified type.
|
|
1224
1211
|
* @param type - The custom element type to retrieve the definition for.
|
|
@@ -1250,22 +1237,96 @@ export declare interface FASTGlobal {
|
|
|
1250
1237
|
/**
|
|
1251
1238
|
* Sends a warning to the developer.
|
|
1252
1239
|
* @param code - The warning code to send.
|
|
1253
|
-
* @param
|
|
1240
|
+
* @param values - Values relevant for the warning message.
|
|
1254
1241
|
*/
|
|
1255
|
-
warn(code: number,
|
|
1242
|
+
warn(code: number, values?: Record<string, any>): void;
|
|
1256
1243
|
/**
|
|
1257
1244
|
* Creates an error.
|
|
1258
1245
|
* @param code - The error code to send.
|
|
1259
|
-
* @param
|
|
1246
|
+
* @param values - Values relevant for the error message.
|
|
1260
1247
|
*/
|
|
1261
|
-
error(code: number,
|
|
1248
|
+
error(code: number, values?: Record<string, any>): Error;
|
|
1262
1249
|
/**
|
|
1263
1250
|
* Adds debug messages for errors and warnings.
|
|
1264
1251
|
* @param messages - The message dictionary to add.
|
|
1252
|
+
* @remarks
|
|
1253
|
+
* Message can include placeholders like $\{name\} which can be
|
|
1254
|
+
* replaced by values passed at runtime.
|
|
1265
1255
|
*/
|
|
1266
1256
|
addMessages(messages: Record<number, string>): void;
|
|
1267
1257
|
}
|
|
1268
1258
|
|
|
1259
|
+
declare function from<TBase extends typeof HTMLElement>(BaseType: TBase): new () => InstanceType<TBase> & FASTElement;
|
|
1260
|
+
|
|
1261
|
+
/**
|
|
1262
|
+
* Represents an object that can contribute behavior to a host.
|
|
1263
|
+
* @public
|
|
1264
|
+
*/
|
|
1265
|
+
export declare interface HostBehavior<TSource = any> {
|
|
1266
|
+
/**
|
|
1267
|
+
* Executed when this behavior is attached to a controller.
|
|
1268
|
+
* @param controller - Controls the behavior lifecycle.
|
|
1269
|
+
*/
|
|
1270
|
+
addedCallback?(controller: HostController<TSource>): void;
|
|
1271
|
+
/**
|
|
1272
|
+
* Executed when this behavior is detached from a controller.
|
|
1273
|
+
* @param controller - Controls the behavior lifecycle.
|
|
1274
|
+
*/
|
|
1275
|
+
removedCallback?(controller: HostController<TSource>): void;
|
|
1276
|
+
/**
|
|
1277
|
+
* Executed when this behavior's host is connected.
|
|
1278
|
+
* @param controller - Controls the behavior lifecycle.
|
|
1279
|
+
*/
|
|
1280
|
+
connectedCallback?(controller: HostController<TSource>): void;
|
|
1281
|
+
/**
|
|
1282
|
+
* Executed when this behavior's host is disconnected.
|
|
1283
|
+
* @param controller - Controls the behavior lifecycle.
|
|
1284
|
+
*/
|
|
1285
|
+
disconnectedCallback?(controller: HostController<TSource>): void;
|
|
1286
|
+
}
|
|
1287
|
+
|
|
1288
|
+
/**
|
|
1289
|
+
* Controls the lifecycle and context of behaviors and styles
|
|
1290
|
+
* associated with a component host.
|
|
1291
|
+
* @public
|
|
1292
|
+
*/
|
|
1293
|
+
export declare interface HostController<TSource = any> {
|
|
1294
|
+
/**
|
|
1295
|
+
* The component source.
|
|
1296
|
+
*/
|
|
1297
|
+
readonly source: TSource;
|
|
1298
|
+
/**
|
|
1299
|
+
* Indicates whether the host is connected or not.
|
|
1300
|
+
*/
|
|
1301
|
+
readonly isConnected: boolean;
|
|
1302
|
+
/**
|
|
1303
|
+
* The main set of styles used for the component, independent
|
|
1304
|
+
* of any behavior-specific styles.
|
|
1305
|
+
*/
|
|
1306
|
+
mainStyles: ElementStyles | null;
|
|
1307
|
+
/**
|
|
1308
|
+
* Adds the behavior to the component.
|
|
1309
|
+
* @param behavior - The behavior to add.
|
|
1310
|
+
*/
|
|
1311
|
+
addBehavior(behavior: HostBehavior<TSource>): void;
|
|
1312
|
+
/**
|
|
1313
|
+
* Removes the behavior from the component.
|
|
1314
|
+
* @param behavior - The behavior to remove.
|
|
1315
|
+
* @param force - Forces removal even if this behavior was added more than once.
|
|
1316
|
+
*/
|
|
1317
|
+
removeBehavior(behavior: HostBehavior<TSource>, force?: boolean): void;
|
|
1318
|
+
/**
|
|
1319
|
+
* Adds styles to this element. Providing an HTMLStyleElement will attach the element instance to the shadowRoot.
|
|
1320
|
+
* @param styles - The styles to add.
|
|
1321
|
+
*/
|
|
1322
|
+
addStyles(styles: ElementStyles | HTMLStyleElement | null | undefined): void;
|
|
1323
|
+
/**
|
|
1324
|
+
* Removes styles from this element. Providing an HTMLStyleElement will detach the element instance from the shadowRoot.
|
|
1325
|
+
* @param styles - the styles to remove.
|
|
1326
|
+
*/
|
|
1327
|
+
removeStyles(styles: ElementStyles | HTMLStyleElement | null | undefined): void;
|
|
1328
|
+
}
|
|
1329
|
+
|
|
1269
1330
|
/**
|
|
1270
1331
|
* Transforms a template literal string into a ViewTemplate.
|
|
1271
1332
|
* @param strings - The string fragments that are interpolated with the values.
|
|
@@ -1275,17 +1336,16 @@ export declare interface FASTGlobal {
|
|
|
1275
1336
|
* other template instances, and Directive instances.
|
|
1276
1337
|
* @public
|
|
1277
1338
|
*/
|
|
1278
|
-
export declare function html<TSource = any, TParent = any
|
|
1339
|
+
export declare function html<TSource = any, TParent = any>(strings: TemplateStringsArray, ...values: TemplateValue<TSource, TParent>[]): ViewTemplate<TSource, TParent>;
|
|
1279
1340
|
|
|
1280
1341
|
/**
|
|
1281
1342
|
* A directive that applies bindings.
|
|
1282
1343
|
* @public
|
|
1283
1344
|
*/
|
|
1284
|
-
export declare class HTMLBindingDirective implements HTMLDirective, ViewBehaviorFactory, Aspected {
|
|
1285
|
-
|
|
1286
|
-
|
|
1287
|
-
|
|
1288
|
-
private factory;
|
|
1345
|
+
export declare class HTMLBindingDirective implements HTMLDirective, ViewBehaviorFactory, ViewBehavior, Aspected {
|
|
1346
|
+
dataBinding: Binding;
|
|
1347
|
+
private data;
|
|
1348
|
+
private updateTarget;
|
|
1289
1349
|
/**
|
|
1290
1350
|
* The unique id of the factory.
|
|
1291
1351
|
*/
|
|
@@ -1308,11 +1368,9 @@ export declare class HTMLBindingDirective implements HTMLDirective, ViewBehavior
|
|
|
1308
1368
|
aspectType: Aspect;
|
|
1309
1369
|
/**
|
|
1310
1370
|
* Creates an instance of HTMLBindingDirective.
|
|
1311
|
-
* @param
|
|
1312
|
-
* @param mode - The binding mode to use when applying the binding.
|
|
1313
|
-
* @param options - The options to configure the binding with.
|
|
1371
|
+
* @param dataBinding - The binding configuration to apply.
|
|
1314
1372
|
*/
|
|
1315
|
-
constructor(
|
|
1373
|
+
constructor(dataBinding: Binding);
|
|
1316
1374
|
/**
|
|
1317
1375
|
* Creates HTML to be used within a template.
|
|
1318
1376
|
* @param add - Can be used to add behavior factories to a template.
|
|
@@ -1320,9 +1378,22 @@ export declare class HTMLBindingDirective implements HTMLDirective, ViewBehavior
|
|
|
1320
1378
|
createHTML(add: AddViewBehaviorFactory): string;
|
|
1321
1379
|
/**
|
|
1322
1380
|
* Creates a behavior.
|
|
1323
|
-
* @param targets - The targets available for behaviors to be attached to.
|
|
1324
1381
|
*/
|
|
1325
|
-
createBehavior(
|
|
1382
|
+
createBehavior(): ViewBehavior;
|
|
1383
|
+
/** @internal */
|
|
1384
|
+
bindDefault(controller: ViewController): void;
|
|
1385
|
+
/** @internal */
|
|
1386
|
+
bind: (controller: ViewController) => void;
|
|
1387
|
+
/** @internal */
|
|
1388
|
+
bindContent(controller: ViewController): void;
|
|
1389
|
+
/** @internal */
|
|
1390
|
+
bindEvent(controller: ViewController): void;
|
|
1391
|
+
/** @internal */
|
|
1392
|
+
unbind(controller: ViewController): void;
|
|
1393
|
+
/** @internal */
|
|
1394
|
+
handleEvent(event: Event): void;
|
|
1395
|
+
/** @internal */
|
|
1396
|
+
handleChange(binding: Expression, observer: ExpressionObserver): void;
|
|
1326
1397
|
}
|
|
1327
1398
|
|
|
1328
1399
|
/**
|
|
@@ -1382,149 +1453,157 @@ export declare interface HTMLDirectiveDefinition<TType extends Constructable<HTM
|
|
|
1382
1453
|
* The result of a template compilation operation.
|
|
1383
1454
|
* @public
|
|
1384
1455
|
*/
|
|
1385
|
-
export declare interface HTMLTemplateCompilationResult<TSource = any, TParent = any
|
|
1456
|
+
export declare interface HTMLTemplateCompilationResult<TSource = any, TParent = any> {
|
|
1386
1457
|
/**
|
|
1387
1458
|
* Creates a view instance.
|
|
1388
1459
|
* @param hostBindingTarget - The host binding target for the view.
|
|
1389
1460
|
*/
|
|
1390
|
-
createView(hostBindingTarget?: Element): HTMLView<TSource, TParent
|
|
1461
|
+
createView(hostBindingTarget?: Element): HTMLView<TSource, TParent>;
|
|
1391
1462
|
}
|
|
1392
1463
|
|
|
1393
1464
|
/**
|
|
1394
1465
|
* The standard View implementation, which also implements ElementView and SyntheticView.
|
|
1395
1466
|
* @public
|
|
1396
1467
|
*/
|
|
1397
|
-
export declare class HTMLView<TSource = any, TParent = any
|
|
1468
|
+
export declare class HTMLView<TSource = any, TParent = any> implements ElementView<TSource, TParent>, SyntheticView<TSource, TParent>, ExecutionContext<TParent> {
|
|
1398
1469
|
private fragment;
|
|
1399
1470
|
private factories;
|
|
1400
|
-
|
|
1471
|
+
readonly targets: ViewBehaviorTargets;
|
|
1401
1472
|
private behaviors;
|
|
1473
|
+
private unbindables;
|
|
1402
1474
|
/**
|
|
1403
1475
|
* The data that the view is bound to.
|
|
1404
1476
|
*/
|
|
1405
1477
|
source: TSource | null;
|
|
1478
|
+
/**
|
|
1479
|
+
* Indicates whether the controller is bound.
|
|
1480
|
+
*/
|
|
1481
|
+
isBound: boolean;
|
|
1482
|
+
/**
|
|
1483
|
+
* Indicates how the source's lifetime relates to the controller's lifetime.
|
|
1484
|
+
*/
|
|
1485
|
+
readonly sourceLifetime: SourceLifetime;
|
|
1406
1486
|
/**
|
|
1407
1487
|
* The execution context the view is running within.
|
|
1408
1488
|
*/
|
|
1409
|
-
context:
|
|
1489
|
+
context: ExecutionContext<TParent>;
|
|
1410
1490
|
/**
|
|
1411
|
-
* The
|
|
1491
|
+
* The index of the current item within a repeat context.
|
|
1412
1492
|
*/
|
|
1413
|
-
|
|
1493
|
+
index: number;
|
|
1414
1494
|
/**
|
|
1415
|
-
* The
|
|
1495
|
+
* The length of the current collection within a repeat context.
|
|
1416
1496
|
*/
|
|
1417
|
-
|
|
1497
|
+
length: number;
|
|
1418
1498
|
/**
|
|
1419
|
-
*
|
|
1420
|
-
* @param fragment - The html fragment that contains the nodes for this view.
|
|
1421
|
-
* @param behaviors - The behaviors to be applied to this view.
|
|
1499
|
+
* The parent data source within a nested context.
|
|
1422
1500
|
*/
|
|
1423
|
-
|
|
1501
|
+
readonly parent: TParent;
|
|
1424
1502
|
/**
|
|
1425
|
-
*
|
|
1426
|
-
* @param node - The parent node to append the view's DOM nodes to.
|
|
1503
|
+
* The parent execution context when in nested context scenarios.
|
|
1427
1504
|
*/
|
|
1428
|
-
|
|
1505
|
+
readonly parentContext: ExecutionContext<TParent>;
|
|
1429
1506
|
/**
|
|
1430
|
-
*
|
|
1431
|
-
* @param node - The node to insert the view's DOM before.
|
|
1507
|
+
* The current event within an event handler.
|
|
1432
1508
|
*/
|
|
1433
|
-
|
|
1509
|
+
get event(): Event;
|
|
1434
1510
|
/**
|
|
1435
|
-
*
|
|
1436
|
-
*
|
|
1511
|
+
* Indicates whether the current item within a repeat context
|
|
1512
|
+
* has an even index.
|
|
1437
1513
|
*/
|
|
1438
|
-
|
|
1514
|
+
get isEven(): boolean;
|
|
1439
1515
|
/**
|
|
1440
|
-
*
|
|
1441
|
-
*
|
|
1516
|
+
* Indicates whether the current item within a repeat context
|
|
1517
|
+
* has an odd index.
|
|
1442
1518
|
*/
|
|
1443
|
-
|
|
1519
|
+
get isOdd(): boolean;
|
|
1444
1520
|
/**
|
|
1445
|
-
*
|
|
1446
|
-
*
|
|
1447
|
-
* @param context - The execution context to run the behaviors within.
|
|
1521
|
+
* Indicates whether the current item within a repeat context
|
|
1522
|
+
* is the first item in the collection.
|
|
1448
1523
|
*/
|
|
1449
|
-
|
|
1524
|
+
get isFirst(): boolean;
|
|
1450
1525
|
/**
|
|
1451
|
-
*
|
|
1526
|
+
* Indicates whether the current item within a repeat context
|
|
1527
|
+
* is somewhere in the middle of the collection.
|
|
1452
1528
|
*/
|
|
1453
|
-
|
|
1529
|
+
get isInMiddle(): boolean;
|
|
1454
1530
|
/**
|
|
1455
|
-
*
|
|
1456
|
-
*
|
|
1531
|
+
* Indicates whether the current item within a repeat context
|
|
1532
|
+
* is the last item in the collection.
|
|
1457
1533
|
*/
|
|
1458
|
-
|
|
1459
|
-
}
|
|
1460
|
-
|
|
1461
|
-
/**
|
|
1462
|
-
* Transforms a template literal string into an ItemViewTemplate.
|
|
1463
|
-
* @param strings - The string fragments that are interpolated with the values.
|
|
1464
|
-
* @param values - The values that are interpolated with the string fragments.
|
|
1465
|
-
* @remarks
|
|
1466
|
-
* The html helper supports interpolation of strings, numbers, binding expressions,
|
|
1467
|
-
* other template instances, and Directive instances.
|
|
1468
|
-
* @public
|
|
1469
|
-
*/
|
|
1470
|
-
export declare const item: <TItem = any, TParent = any>(strings: TemplateStringsArray, ...values: TemplateValue<TItem, TParent, ItemContext<TParent>>[]) => ItemViewTemplate<TItem, TParent>;
|
|
1471
|
-
|
|
1472
|
-
/**
|
|
1473
|
-
* Provides additional contextual information when inside a repeat item template.s
|
|
1474
|
-
* @public
|
|
1475
|
-
*/
|
|
1476
|
-
export declare interface ItemContext<TParentSource = any> extends ChildContext<TParentSource> {
|
|
1534
|
+
get isLast(): boolean;
|
|
1477
1535
|
/**
|
|
1478
|
-
*
|
|
1536
|
+
* Returns the typed event detail of a custom event.
|
|
1479
1537
|
*/
|
|
1480
|
-
|
|
1538
|
+
eventDetail<TDetail>(): TDetail;
|
|
1481
1539
|
/**
|
|
1482
|
-
*
|
|
1540
|
+
* Returns the typed event target of the event.
|
|
1483
1541
|
*/
|
|
1484
|
-
|
|
1542
|
+
eventTarget<TTarget extends EventTarget>(): TTarget;
|
|
1485
1543
|
/**
|
|
1486
|
-
*
|
|
1487
|
-
* has an even index.
|
|
1544
|
+
* The first DOM node in the range of nodes that make up the view.
|
|
1488
1545
|
*/
|
|
1489
|
-
|
|
1546
|
+
firstChild: Node;
|
|
1490
1547
|
/**
|
|
1491
|
-
*
|
|
1492
|
-
|
|
1548
|
+
* The last DOM node in the range of nodes that make up the view.
|
|
1549
|
+
*/
|
|
1550
|
+
lastChild: Node;
|
|
1551
|
+
/**
|
|
1552
|
+
* Constructs an instance of HTMLView.
|
|
1553
|
+
* @param fragment - The html fragment that contains the nodes for this view.
|
|
1554
|
+
* @param behaviors - The behaviors to be applied to this view.
|
|
1555
|
+
*/
|
|
1556
|
+
constructor(fragment: DocumentFragment, factories: ReadonlyArray<ViewBehaviorFactory>, targets: ViewBehaviorTargets);
|
|
1557
|
+
/**
|
|
1558
|
+
* Appends the view's DOM nodes to the referenced node.
|
|
1559
|
+
* @param node - The parent node to append the view's DOM nodes to.
|
|
1560
|
+
*/
|
|
1561
|
+
appendTo(node: Node): void;
|
|
1562
|
+
/**
|
|
1563
|
+
* Inserts the view's DOM nodes before the referenced node.
|
|
1564
|
+
* @param node - The node to insert the view's DOM before.
|
|
1565
|
+
*/
|
|
1566
|
+
insertBefore(node: Node): void;
|
|
1567
|
+
/**
|
|
1568
|
+
* Removes the view's DOM nodes.
|
|
1569
|
+
* The nodes are not disposed and the view can later be re-inserted.
|
|
1493
1570
|
*/
|
|
1494
|
-
|
|
1571
|
+
remove(): void;
|
|
1495
1572
|
/**
|
|
1496
|
-
*
|
|
1497
|
-
*
|
|
1573
|
+
* Removes the view and unbinds its behaviors, disposing of DOM nodes afterward.
|
|
1574
|
+
* Once a view has been disposed, it cannot be inserted or bound again.
|
|
1498
1575
|
*/
|
|
1499
|
-
|
|
1576
|
+
dispose(): void;
|
|
1577
|
+
onUnbind(behavior: {
|
|
1578
|
+
unbind(controller: ViewController<TSource, TParent>): any;
|
|
1579
|
+
}): void;
|
|
1500
1580
|
/**
|
|
1501
|
-
*
|
|
1502
|
-
*
|
|
1581
|
+
* Binds a view's behaviors to its binding source.
|
|
1582
|
+
* @param source - The binding source for the view's binding behaviors.
|
|
1583
|
+
* @param context - The execution context to run the behaviors within.
|
|
1503
1584
|
*/
|
|
1504
|
-
|
|
1585
|
+
bind(source: TSource, context?: ExecutionContext<TParent>): void;
|
|
1505
1586
|
/**
|
|
1506
|
-
*
|
|
1507
|
-
* is the last item in the collection.
|
|
1587
|
+
* Unbinds a view's behaviors from its binding source.
|
|
1508
1588
|
*/
|
|
1509
|
-
|
|
1589
|
+
unbind(): void;
|
|
1590
|
+
private evaluateUnbindables;
|
|
1510
1591
|
/**
|
|
1511
|
-
*
|
|
1512
|
-
* @param
|
|
1513
|
-
* @param length - The new length of the list.
|
|
1592
|
+
* Efficiently disposes of a contiguous range of synthetic view instances.
|
|
1593
|
+
* @param views - A contiguous range of views to be disposed.
|
|
1514
1594
|
*/
|
|
1515
|
-
|
|
1595
|
+
static disposeContiguousBatch(views: SyntheticView[]): void;
|
|
1516
1596
|
}
|
|
1517
1597
|
|
|
1518
1598
|
/**
|
|
1519
|
-
*
|
|
1599
|
+
* Observes array lengths.
|
|
1520
1600
|
* @public
|
|
1521
1601
|
*/
|
|
1522
|
-
export declare interface
|
|
1523
|
-
type: "item";
|
|
1602
|
+
export declare interface LengthObserver extends Subscriber {
|
|
1524
1603
|
/**
|
|
1525
|
-
*
|
|
1604
|
+
* The length of the observed array.
|
|
1526
1605
|
*/
|
|
1527
|
-
|
|
1606
|
+
length: number;
|
|
1528
1607
|
}
|
|
1529
1608
|
|
|
1530
1609
|
/**
|
|
@@ -1533,19 +1612,16 @@ export declare interface ItemViewTemplate<TSource = any, TParent = any> {
|
|
|
1533
1612
|
* @returns The length of the array.
|
|
1534
1613
|
* @public
|
|
1535
1614
|
*/
|
|
1536
|
-
declare function
|
|
1537
|
-
export { length_2 as length }
|
|
1615
|
+
export declare function lengthOf<T>(array: readonly T[]): number;
|
|
1538
1616
|
|
|
1539
1617
|
/**
|
|
1540
|
-
*
|
|
1618
|
+
* Creates an event listener binding.
|
|
1619
|
+
* @param binding - The binding to invoke when the event is raised.
|
|
1620
|
+
* @param options - Event listener options.
|
|
1621
|
+
* @returns A binding configuration.
|
|
1541
1622
|
* @public
|
|
1542
1623
|
*/
|
|
1543
|
-
export declare
|
|
1544
|
-
/**
|
|
1545
|
-
* The length of the observed array.
|
|
1546
|
-
*/
|
|
1547
|
-
length: number;
|
|
1548
|
-
}
|
|
1624
|
+
export declare function listener<T = any>(binding: Expression<T>, options?: AddEventListenerOptions): Binding<T>;
|
|
1549
1625
|
|
|
1550
1626
|
/**
|
|
1551
1627
|
* Common APIs related to markup generation.
|
|
@@ -1619,14 +1695,14 @@ export declare abstract class NodeObservationDirective<T extends NodeBehaviorOpt
|
|
|
1619
1695
|
* @param context - The execution context that the binding is operating within.
|
|
1620
1696
|
* @param targets - The targets that behaviors in a view can attach to.
|
|
1621
1697
|
*/
|
|
1622
|
-
bind(
|
|
1698
|
+
bind(controller: ViewController): void;
|
|
1623
1699
|
/**
|
|
1624
1700
|
* Unbinds this behavior from the source.
|
|
1625
1701
|
* @param source - The source to unbind from.
|
|
1626
1702
|
* @param context - The execution context that the binding is operating within.
|
|
1627
1703
|
* @param targets - The targets that behaviors in a view can attach to.
|
|
1628
1704
|
*/
|
|
1629
|
-
unbind(
|
|
1705
|
+
unbind(controller: ViewController): void;
|
|
1630
1706
|
/**
|
|
1631
1707
|
* Gets the data source for the target.
|
|
1632
1708
|
* @param target - The target to get the source for.
|
|
@@ -1664,6 +1740,14 @@ export declare abstract class NodeObservationDirective<T extends NodeBehaviorOpt
|
|
|
1664
1740
|
protected abstract getNodes(target: any): Node[];
|
|
1665
1741
|
}
|
|
1666
1742
|
|
|
1743
|
+
/**
|
|
1744
|
+
* Normalizes the input value into a binding.
|
|
1745
|
+
* @param value - The value to create the default binding for.
|
|
1746
|
+
* @returns A binding configuration for the provided value.
|
|
1747
|
+
* @public
|
|
1748
|
+
*/
|
|
1749
|
+
export declare function normalizeBinding<TSource = any, TReturn = any, TParent = any>(value: Expression<TSource, TReturn, TParent> | Binding<TSource, TReturn, TParent> | {}): Binding<TSource, TReturn, TParent>;
|
|
1750
|
+
|
|
1667
1751
|
/**
|
|
1668
1752
|
* Provides change notifications for an observed subject.
|
|
1669
1753
|
* @public
|
|
@@ -1754,19 +1838,19 @@ export declare const Observable: Readonly<{
|
|
|
1754
1838
|
*/
|
|
1755
1839
|
getAccessors: (target: {}) => Accessor[];
|
|
1756
1840
|
/**
|
|
1757
|
-
* Creates a {@link
|
|
1758
|
-
* provided {@link
|
|
1759
|
-
* @param
|
|
1841
|
+
* Creates a {@link ExpressionNotifier} that can watch the
|
|
1842
|
+
* provided {@link Expression} for changes.
|
|
1843
|
+
* @param expression - The binding to observe.
|
|
1760
1844
|
* @param initialSubscriber - An initial subscriber to changes in the binding value.
|
|
1761
1845
|
* @param isVolatileBinding - Indicates whether the binding's dependency list must be re-evaluated on every value evaluation.
|
|
1762
1846
|
*/
|
|
1763
|
-
binding<TSource = any, TReturn = any>(
|
|
1847
|
+
binding<TSource = any, TReturn = any>(expression: Expression<TSource, TReturn, any>, initialSubscriber?: Subscriber, isVolatileBinding?: boolean): ExpressionNotifier<TSource, TReturn, any>;
|
|
1764
1848
|
/**
|
|
1765
1849
|
* Determines whether a binding expression is volatile and needs to have its dependency list re-evaluated
|
|
1766
1850
|
* on every evaluation of the value.
|
|
1767
|
-
* @param
|
|
1851
|
+
* @param expression - The binding to inspect.
|
|
1768
1852
|
*/
|
|
1769
|
-
isVolatileBinding<TSource_1 = any, TReturn_1 = any>(
|
|
1853
|
+
isVolatileBinding<TSource_1 = any, TReturn_1 = any>(expression: Expression<TSource_1, TReturn_1, any>): boolean;
|
|
1770
1854
|
}>;
|
|
1771
1855
|
|
|
1772
1856
|
/**
|
|
@@ -1793,30 +1877,12 @@ export declare interface ObservationRecord {
|
|
|
1793
1877
|
}
|
|
1794
1878
|
|
|
1795
1879
|
/**
|
|
1796
|
-
*
|
|
1797
|
-
* @
|
|
1798
|
-
|
|
1799
|
-
export declare const onChange: BindingConfig<AddEventListenerOptions> & BindingConfigResolver<AddEventListenerOptions>;
|
|
1800
|
-
|
|
1801
|
-
/**
|
|
1802
|
-
* The default onTime binding configuration.
|
|
1803
|
-
* @public
|
|
1804
|
-
*/
|
|
1805
|
-
export declare const oneTime: BindingConfig<AddEventListenerOptions> & BindingConfigResolver<AddEventListenerOptions>;
|
|
1806
|
-
|
|
1807
|
-
/**
|
|
1808
|
-
* A binding behavior for one-time bindings.
|
|
1880
|
+
* Creates a one time binding
|
|
1881
|
+
* @param binding - The binding to refresh when signaled.
|
|
1882
|
+
* @returns A binding configuration.
|
|
1809
1883
|
* @public
|
|
1810
1884
|
*/
|
|
1811
|
-
export declare
|
|
1812
|
-
/**
|
|
1813
|
-
* Bind this behavior to the source.
|
|
1814
|
-
* @param source - The source to bind to.
|
|
1815
|
-
* @param context - The execution context that the binding is operating within.
|
|
1816
|
-
* @param targets - The targets that behaviors in a view can attach to.
|
|
1817
|
-
*/
|
|
1818
|
-
bind(source: any, context: ExecutionContext, targets: ViewBehaviorTargets): void;
|
|
1819
|
-
}
|
|
1885
|
+
export declare function oneTime<T = any>(binding: Expression<T>): Binding<T>;
|
|
1820
1886
|
|
|
1821
1887
|
/**
|
|
1822
1888
|
* Common APIs related to content parsing.
|
|
@@ -1857,12 +1923,21 @@ export declare interface PartialFASTElementDefinition {
|
|
|
1857
1923
|
readonly attributes?: (AttributeConfiguration | string)[];
|
|
1858
1924
|
/**
|
|
1859
1925
|
* Options controlling the creation of the custom element's shadow DOM.
|
|
1926
|
+
* @remarks
|
|
1927
|
+
* If not provided, defaults to an open shadow root. Provide null
|
|
1928
|
+
* to render to the associated template to the light DOM instead.
|
|
1860
1929
|
*/
|
|
1861
|
-
readonly shadowOptions?: Partial<
|
|
1930
|
+
readonly shadowOptions?: Partial<ShadowRootOptions> | null;
|
|
1862
1931
|
/**
|
|
1863
1932
|
* Options controlling how the custom element is defined with the platform.
|
|
1864
1933
|
*/
|
|
1865
1934
|
readonly elementOptions?: ElementDefinitionOptions;
|
|
1935
|
+
/**
|
|
1936
|
+
* The registry to register this component in by default.
|
|
1937
|
+
* @remarks
|
|
1938
|
+
* If not provided, defaults to the global registry.
|
|
1939
|
+
*/
|
|
1940
|
+
readonly registry?: CustomElementRegistry;
|
|
1866
1941
|
}
|
|
1867
1942
|
|
|
1868
1943
|
/**
|
|
@@ -1918,7 +1993,7 @@ export declare class PropertyChangeNotifier implements Notifier {
|
|
|
1918
1993
|
* @param propertyName - The name of the property to assign the reference to.
|
|
1919
1994
|
* @public
|
|
1920
1995
|
*/
|
|
1921
|
-
export declare const ref: <
|
|
1996
|
+
export declare const ref: <TSource = any, TParent = any>(propertyName: keyof TSource & string) => CaptureType<TSource, TParent>;
|
|
1922
1997
|
|
|
1923
1998
|
/**
|
|
1924
1999
|
* The runtime behavior for template references.
|
|
@@ -1926,117 +2001,56 @@ export declare const ref: <T = any>(propertyName: keyof T & string) => CaptureTy
|
|
|
1926
2001
|
*/
|
|
1927
2002
|
export declare class RefDirective extends StatelessAttachedAttributeDirective<string> {
|
|
1928
2003
|
/**
|
|
1929
|
-
* Bind this behavior
|
|
1930
|
-
* @param
|
|
1931
|
-
* @param context - The execution context that the binding is operating within.
|
|
1932
|
-
* @param targets - The targets that behaviors in a view can attach to.
|
|
1933
|
-
*/
|
|
1934
|
-
bind(source: any, context: ExecutionContext, targets: ViewBehaviorTargets): void;
|
|
1935
|
-
/**
|
|
1936
|
-
* Unbinds this behavior from the source.
|
|
1937
|
-
* @param source - The source to unbind from.
|
|
2004
|
+
* Bind this behavior.
|
|
2005
|
+
* @param controller - The view controller that manages the lifecycle of this behavior.
|
|
1938
2006
|
*/
|
|
1939
|
-
|
|
2007
|
+
bind(controller: ViewController): void;
|
|
1940
2008
|
}
|
|
1941
2009
|
|
|
1942
2010
|
declare const reflectMode = "reflect";
|
|
1943
2011
|
|
|
1944
2012
|
/**
|
|
1945
2013
|
* A directive that enables list rendering.
|
|
1946
|
-
* @param
|
|
1947
|
-
* @param
|
|
1948
|
-
* to render for each item in the array.
|
|
1949
|
-
* @param options - Options used to turn on special repeat features.
|
|
1950
|
-
* @public
|
|
1951
|
-
*/
|
|
1952
|
-
export declare function repeat<TSource = any, TArray extends ReadonlyArray<any> = ReadonlyArray<any>>(itemsBinding: Binding<TSource, TArray, ExecutionContext<TSource>>, templateOrTemplateBinding: ViewTemplate | Binding<TSource, ViewTemplate, RootContext>, options?: {
|
|
1953
|
-
positioning: false;
|
|
1954
|
-
} | {
|
|
1955
|
-
recycle: true;
|
|
1956
|
-
} | {
|
|
1957
|
-
positioning: false;
|
|
1958
|
-
recycle: false;
|
|
1959
|
-
} | {
|
|
1960
|
-
positioning: false;
|
|
1961
|
-
recycle: true;
|
|
1962
|
-
}): CaptureType<TSource>;
|
|
1963
|
-
|
|
1964
|
-
/**
|
|
1965
|
-
* A directive that enables list rendering.
|
|
1966
|
-
* @param itemsBinding - The array to render.
|
|
1967
|
-
* @param templateOrTemplateBinding - The template or a template binding used obtain a template
|
|
1968
|
-
* to render for each item in the array.
|
|
1969
|
-
* @param options - Options used to turn on special repeat features.
|
|
1970
|
-
* @public
|
|
1971
|
-
*/
|
|
1972
|
-
export declare function repeat<TSource = any, TArray extends ReadonlyArray<any> = ReadonlyArray<any>>(itemsBinding: Binding<TSource, TArray, ExecutionContext<TSource>>, templateOrTemplateBinding: ChildViewTemplate | Binding<TSource, ChildViewTemplate, ChildContext>, options?: {
|
|
1973
|
-
positioning: false;
|
|
1974
|
-
} | {
|
|
1975
|
-
recycle: true;
|
|
1976
|
-
} | {
|
|
1977
|
-
positioning: false;
|
|
1978
|
-
recycle: false;
|
|
1979
|
-
} | {
|
|
1980
|
-
positioning: false;
|
|
1981
|
-
recycle: true;
|
|
1982
|
-
}): CaptureType<TSource>;
|
|
1983
|
-
|
|
1984
|
-
/**
|
|
1985
|
-
* A directive that enables list rendering.
|
|
1986
|
-
* @param itemsBinding - The array to render.
|
|
1987
|
-
* @param templateOrTemplateBinding - The template or a template binding used obtain a template
|
|
2014
|
+
* @param items - The array to render.
|
|
2015
|
+
* @param template - The template or a template binding used obtain a template
|
|
1988
2016
|
* to render for each item in the array.
|
|
1989
2017
|
* @param options - Options used to turn on special repeat features.
|
|
1990
2018
|
* @public
|
|
1991
2019
|
*/
|
|
1992
|
-
export declare function repeat<TSource = any, TArray extends ReadonlyArray<any> = ReadonlyArray<any
|
|
1993
|
-
positioning: true;
|
|
1994
|
-
} | {
|
|
1995
|
-
positioning: true;
|
|
1996
|
-
recycle: true;
|
|
1997
|
-
} | {
|
|
1998
|
-
positioning: true;
|
|
1999
|
-
recycle: false;
|
|
2000
|
-
}): CaptureType<TSource>;
|
|
2020
|
+
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>;
|
|
2001
2021
|
|
|
2002
2022
|
/**
|
|
2003
2023
|
* A behavior that renders a template for each item in an array.
|
|
2004
2024
|
* @public
|
|
2005
2025
|
*/
|
|
2006
|
-
export declare class RepeatBehavior<TSource = any> implements
|
|
2026
|
+
export declare class RepeatBehavior<TSource = any> implements ViewBehavior, Subscriber {
|
|
2027
|
+
private directive;
|
|
2007
2028
|
private location;
|
|
2008
|
-
private
|
|
2009
|
-
private templateBinding;
|
|
2010
|
-
private options;
|
|
2011
|
-
private source;
|
|
2029
|
+
private controller;
|
|
2012
2030
|
private views;
|
|
2013
2031
|
private template;
|
|
2014
2032
|
private templateBindingObserver;
|
|
2015
2033
|
private items;
|
|
2016
2034
|
private itemsObserver;
|
|
2017
2035
|
private itemsBindingObserver;
|
|
2018
|
-
private context;
|
|
2019
|
-
private childContext;
|
|
2020
2036
|
private bindView;
|
|
2021
2037
|
/**
|
|
2022
2038
|
* Creates an instance of RepeatBehavior.
|
|
2023
2039
|
* @param location - The location in the DOM to render the repeat.
|
|
2024
|
-
* @param
|
|
2040
|
+
* @param dataBinding - The array to render.
|
|
2025
2041
|
* @param isItemsBindingVolatile - Indicates whether the items binding has volatile dependencies.
|
|
2026
2042
|
* @param templateBinding - The template to render for each item.
|
|
2027
2043
|
* @param isTemplateBindingVolatile - Indicates whether the template binding has volatile dependencies.
|
|
2028
2044
|
* @param options - Options used to turn on special repeat features.
|
|
2029
2045
|
*/
|
|
2030
|
-
constructor(
|
|
2046
|
+
constructor(directive: RepeatDirective);
|
|
2031
2047
|
/**
|
|
2032
|
-
* Bind this behavior
|
|
2033
|
-
* @param
|
|
2034
|
-
* @param context - The execution context that the binding is operating within.
|
|
2048
|
+
* Bind this behavior.
|
|
2049
|
+
* @param controller - The view controller that manages the lifecycle of this behavior.
|
|
2035
2050
|
*/
|
|
2036
|
-
bind(
|
|
2051
|
+
bind(controller: ViewController): void;
|
|
2037
2052
|
/**
|
|
2038
|
-
* Unbinds this behavior
|
|
2039
|
-
* @param source - The source to unbind from.
|
|
2053
|
+
* Unbinds this behavior.
|
|
2040
2054
|
*/
|
|
2041
2055
|
unbind(): void;
|
|
2042
2056
|
/**
|
|
@@ -2044,7 +2058,7 @@ export declare class RepeatBehavior<TSource = any> implements Behavior, Subscrib
|
|
|
2044
2058
|
* @param source - The source of the change.
|
|
2045
2059
|
* @param args - The details about what was changed.
|
|
2046
2060
|
*/
|
|
2047
|
-
handleChange(source: any, args: Splice[]): void;
|
|
2061
|
+
handleChange(source: any, args: Splice[] | ExpressionObserver): void;
|
|
2048
2062
|
private observeItems;
|
|
2049
2063
|
private updateViews;
|
|
2050
2064
|
private refreshAllViews;
|
|
@@ -2056,11 +2070,9 @@ export declare class RepeatBehavior<TSource = any> implements Behavior, Subscrib
|
|
|
2056
2070
|
* @public
|
|
2057
2071
|
*/
|
|
2058
2072
|
export declare class RepeatDirective<TSource = any> implements HTMLDirective, ViewBehaviorFactory {
|
|
2059
|
-
readonly
|
|
2073
|
+
readonly dataBinding: Binding<TSource>;
|
|
2060
2074
|
readonly templateBinding: Binding<TSource, SyntheticViewTemplate>;
|
|
2061
2075
|
readonly options: RepeatOptions;
|
|
2062
|
-
private isItemsBindingVolatile;
|
|
2063
|
-
private isTemplateBindingVolatile;
|
|
2064
2076
|
/**
|
|
2065
2077
|
* The unique id of the factory.
|
|
2066
2078
|
*/
|
|
@@ -2076,16 +2088,16 @@ export declare class RepeatDirective<TSource = any> implements HTMLDirective, Vi
|
|
|
2076
2088
|
createHTML(add: AddViewBehaviorFactory): string;
|
|
2077
2089
|
/**
|
|
2078
2090
|
* Creates an instance of RepeatDirective.
|
|
2079
|
-
* @param
|
|
2091
|
+
* @param dataBinding - The binding that provides the array to render.
|
|
2080
2092
|
* @param templateBinding - The template binding used to obtain a template to render for each item in the array.
|
|
2081
2093
|
* @param options - Options used to turn on special repeat features.
|
|
2082
2094
|
*/
|
|
2083
|
-
constructor(
|
|
2095
|
+
constructor(dataBinding: Binding<TSource>, templateBinding: Binding<TSource, SyntheticViewTemplate>, options: RepeatOptions);
|
|
2084
2096
|
/**
|
|
2085
2097
|
* Creates a behavior for the provided target node.
|
|
2086
2098
|
* @param target - The node instance to create the behavior for.
|
|
2087
2099
|
*/
|
|
2088
|
-
createBehavior(
|
|
2100
|
+
createBehavior(): RepeatBehavior<TSource>;
|
|
2089
2101
|
}
|
|
2090
2102
|
|
|
2091
2103
|
/**
|
|
@@ -2104,65 +2116,16 @@ export declare interface RepeatOptions {
|
|
|
2104
2116
|
}
|
|
2105
2117
|
|
|
2106
2118
|
/**
|
|
2107
|
-
*
|
|
2108
|
-
* @public
|
|
2109
|
-
*/
|
|
2110
|
-
export declare interface RootContext {
|
|
2111
|
-
/**
|
|
2112
|
-
* The current event within an event handler.
|
|
2113
|
-
*/
|
|
2114
|
-
readonly event: Event;
|
|
2115
|
-
/**
|
|
2116
|
-
* Returns the typed event detail of a custom event.
|
|
2117
|
-
*/
|
|
2118
|
-
eventDetail<TDetail = any>(): TDetail;
|
|
2119
|
-
/**
|
|
2120
|
-
* Returns the typed event target of the event.
|
|
2121
|
-
*/
|
|
2122
|
-
eventTarget<TTarget extends EventTarget = EventTarget>(): TTarget;
|
|
2123
|
-
/**
|
|
2124
|
-
* Creates a new execution context descendent from the current context.
|
|
2125
|
-
* @param source - The source for the context if different than the parent.
|
|
2126
|
-
* @returns A child execution context.
|
|
2127
|
-
*/
|
|
2128
|
-
createChildContext<TParentSource>(source: TParentSource): ChildContext<TParentSource>;
|
|
2129
|
-
}
|
|
2130
|
-
|
|
2131
|
-
/**
|
|
2132
|
-
* Creates a signal binding configuration with the supplied options.
|
|
2133
|
-
* @param options - The signal name or a binding to use to retrieve the signal name.
|
|
2134
|
-
* @returns A binding configuration.
|
|
2135
|
-
* @public
|
|
2136
|
-
*/
|
|
2137
|
-
export declare const signal: <T = any>(options: string | Binding<T, any, ExecutionContext<any>>) => BindingConfig<string | Binding<T, any, ExecutionContext<any>>>;
|
|
2138
|
-
|
|
2139
|
-
/**
|
|
2140
|
-
* A binding behavior for signal bindings.
|
|
2119
|
+
* Shadow root initialization options.
|
|
2141
2120
|
* @public
|
|
2142
2121
|
*/
|
|
2143
|
-
export declare
|
|
2144
|
-
private handlerProperty;
|
|
2122
|
+
export declare interface ShadowRootOptions extends ShadowRootInit {
|
|
2145
2123
|
/**
|
|
2146
|
-
*
|
|
2147
|
-
*
|
|
2148
|
-
* @
|
|
2149
|
-
* @param targets - The targets that behaviors in a view can attach to.
|
|
2150
|
-
*/
|
|
2151
|
-
bind(source: any, context: ExecutionContext, targets: ViewBehaviorTargets): void;
|
|
2152
|
-
/**
|
|
2153
|
-
* Unbinds this behavior from the source.
|
|
2154
|
-
* @param source - The source to unbind from.
|
|
2155
|
-
* @param context - The execution context that the binding is operating within.
|
|
2156
|
-
* @param targets - The targets that behaviors in a view can attach to.
|
|
2157
|
-
*/
|
|
2158
|
-
unbind(source: any, context: ExecutionContext, targets: ViewBehaviorTargets): void;
|
|
2159
|
-
private getSignal;
|
|
2160
|
-
/**
|
|
2161
|
-
* Sends the specified signal to signaled bindings.
|
|
2162
|
-
* @param signal - The signal to send.
|
|
2163
|
-
* @public
|
|
2124
|
+
* A registry that provides the custom elements visible
|
|
2125
|
+
* from within this shadow root.
|
|
2126
|
+
* @beta
|
|
2164
2127
|
*/
|
|
2165
|
-
|
|
2128
|
+
registry?: CustomElementRegistry;
|
|
2166
2129
|
}
|
|
2167
2130
|
|
|
2168
2131
|
/**
|
|
@@ -2171,7 +2134,7 @@ export declare class SignalBinding extends UpdateBinding {
|
|
|
2171
2134
|
* @param propertyOrOptions - The options used to configure slotted node observation.
|
|
2172
2135
|
* @public
|
|
2173
2136
|
*/
|
|
2174
|
-
export declare function slotted<
|
|
2137
|
+
export declare function slotted<TSource = any, TParent = any>(propertyOrOptions: (keyof TSource & string) | SlottedDirectiveOptions<keyof TSource & string>): CaptureType<TSource, TParent>;
|
|
2175
2138
|
|
|
2176
2139
|
/**
|
|
2177
2140
|
* The runtime behavior for slotted node observation.
|
|
@@ -2204,6 +2167,28 @@ export declare class SlottedDirective extends NodeObservationDirective<SlottedDi
|
|
|
2204
2167
|
export declare interface SlottedDirectiveOptions<T = any> extends NodeBehaviorOptions<T>, AssignedNodesOptions {
|
|
2205
2168
|
}
|
|
2206
2169
|
|
|
2170
|
+
/**
|
|
2171
|
+
* Describes how the source's lifetime relates to its controller's lifetime.
|
|
2172
|
+
* @public
|
|
2173
|
+
*/
|
|
2174
|
+
export declare const SourceLifetime: Readonly<{
|
|
2175
|
+
/**
|
|
2176
|
+
* The source to controller lifetime relationship is unknown.
|
|
2177
|
+
*/
|
|
2178
|
+
readonly unknown: undefined;
|
|
2179
|
+
/**
|
|
2180
|
+
* The source and controller lifetimes are coupled to one another.
|
|
2181
|
+
* They can/will be GC'd together.
|
|
2182
|
+
*/
|
|
2183
|
+
readonly coupled: 1;
|
|
2184
|
+
}>;
|
|
2185
|
+
|
|
2186
|
+
/**
|
|
2187
|
+
* Describes how the source's lifetime relates to its controller's lifetime.
|
|
2188
|
+
* @public
|
|
2189
|
+
*/
|
|
2190
|
+
export declare type SourceLifetime = typeof SourceLifetime[keyof typeof SourceLifetime];
|
|
2191
|
+
|
|
2207
2192
|
/**
|
|
2208
2193
|
* A splice map is a representation of how a previous array of items
|
|
2209
2194
|
* was transformed into a new array of items. Conceptually it is a list of
|
|
@@ -2360,8 +2345,8 @@ export declare type SpliceStrategySupport = typeof SpliceStrategySupport[keyof t
|
|
|
2360
2345
|
* A base class used for attribute directives that don't need internal state.
|
|
2361
2346
|
* @public
|
|
2362
2347
|
*/
|
|
2363
|
-
export declare abstract class StatelessAttachedAttributeDirective<
|
|
2364
|
-
protected options:
|
|
2348
|
+
export declare abstract class StatelessAttachedAttributeDirective<TOptions> implements HTMLDirective, ViewBehaviorFactory, ViewBehavior {
|
|
2349
|
+
protected options: TOptions;
|
|
2365
2350
|
/**
|
|
2366
2351
|
* The unique id of the factory.
|
|
2367
2352
|
*/
|
|
@@ -2374,12 +2359,7 @@ export declare abstract class StatelessAttachedAttributeDirective<T> implements
|
|
|
2374
2359
|
* Creates an instance of RefDirective.
|
|
2375
2360
|
* @param options - The options to use in configuring the directive.
|
|
2376
2361
|
*/
|
|
2377
|
-
constructor(options:
|
|
2378
|
-
/**
|
|
2379
|
-
* Creates a behavior.
|
|
2380
|
-
* @param targets - The targets available for behaviors to be attached to.
|
|
2381
|
-
*/
|
|
2382
|
-
createBehavior(targets: ViewBehaviorTargets): ViewBehavior;
|
|
2362
|
+
constructor(options: TOptions);
|
|
2383
2363
|
/**
|
|
2384
2364
|
* Creates a placeholder string based on the directive's index within the template.
|
|
2385
2365
|
* @param index - The index of the directive within the template.
|
|
@@ -2388,17 +2368,15 @@ export declare abstract class StatelessAttachedAttributeDirective<T> implements
|
|
|
2388
2368
|
*/
|
|
2389
2369
|
createHTML(add: AddViewBehaviorFactory): string;
|
|
2390
2370
|
/**
|
|
2391
|
-
*
|
|
2392
|
-
* @param
|
|
2393
|
-
* @param context - The execution context that the binding is operating within.
|
|
2394
|
-
* @param targets - The targets that behaviors in a view can attach to.
|
|
2371
|
+
* Creates a behavior.
|
|
2372
|
+
* @param targets - The targets available for behaviors to be attached to.
|
|
2395
2373
|
*/
|
|
2396
|
-
|
|
2374
|
+
createBehavior(): ViewBehavior;
|
|
2397
2375
|
/**
|
|
2398
|
-
*
|
|
2399
|
-
* @param
|
|
2376
|
+
* Bind this behavior.
|
|
2377
|
+
* @param controller - The view controller that manages the lifecycle of this behavior.
|
|
2400
2378
|
*/
|
|
2401
|
-
abstract
|
|
2379
|
+
abstract bind(controller: ViewController): void;
|
|
2402
2380
|
}
|
|
2403
2381
|
|
|
2404
2382
|
/**
|
|
@@ -2525,7 +2503,7 @@ export declare interface SubtreeDirectiveOptions<T = any> extends NodeBehaviorOp
|
|
|
2525
2503
|
* A view representing a range of DOM nodes which can be added/removed ad hoc.
|
|
2526
2504
|
* @public
|
|
2527
2505
|
*/
|
|
2528
|
-
export declare interface SyntheticView<TSource = any, TParent = any
|
|
2506
|
+
export declare interface SyntheticView<TSource = any, TParent = any> extends View<TSource, TParent> {
|
|
2529
2507
|
/**
|
|
2530
2508
|
* The first DOM node in the range of nodes that make up the view.
|
|
2531
2509
|
*/
|
|
@@ -2550,19 +2528,18 @@ export declare interface SyntheticView<TSource = any, TParent = any, TContext ex
|
|
|
2550
2528
|
* A template capable of rendering views not specifically connected to custom elements.
|
|
2551
2529
|
* @public
|
|
2552
2530
|
*/
|
|
2553
|
-
export declare interface SyntheticViewTemplate<TSource = any, TParent = any
|
|
2554
|
-
type: "synthetic";
|
|
2531
|
+
export declare interface SyntheticViewTemplate<TSource = any, TParent = any> {
|
|
2555
2532
|
/**
|
|
2556
2533
|
* Creates a SyntheticView instance based on this template definition.
|
|
2557
2534
|
*/
|
|
2558
|
-
create(): SyntheticView<TSource, TParent
|
|
2535
|
+
create(): SyntheticView<TSource, TParent>;
|
|
2559
2536
|
}
|
|
2560
2537
|
|
|
2561
2538
|
/**
|
|
2562
2539
|
* Represents the types of values that can be interpolated into a template.
|
|
2563
2540
|
* @public
|
|
2564
2541
|
*/
|
|
2565
|
-
export declare type TemplateValue<TSource, TParent = any
|
|
2542
|
+
export declare type TemplateValue<TSource, TParent = any> = Expression<TSource, any, TParent> | Binding<TSource, any, TParent> | HTMLDirective | CaptureType<TSource, TParent>;
|
|
2566
2543
|
|
|
2567
2544
|
/**
|
|
2568
2545
|
* Enables working with trusted types.
|
|
@@ -2589,54 +2566,6 @@ export declare type TrustedTypesPolicy = {
|
|
|
2589
2566
|
createHTML(html: string): string;
|
|
2590
2567
|
};
|
|
2591
2568
|
|
|
2592
|
-
/**
|
|
2593
|
-
* The default twoWay binding configuration.
|
|
2594
|
-
* @public
|
|
2595
|
-
*/
|
|
2596
|
-
export declare const twoWay: BindingConfig<DefaultTwoWayBindingOptions> & BindingConfigResolver<DefaultTwoWayBindingOptions>;
|
|
2597
|
-
|
|
2598
|
-
/**
|
|
2599
|
-
* A binding behavior for bindings that update in two directions.
|
|
2600
|
-
* @public
|
|
2601
|
-
*/
|
|
2602
|
-
export declare class TwoWayBinding extends ChangeBinding {
|
|
2603
|
-
private changeEvent;
|
|
2604
|
-
/**
|
|
2605
|
-
* Bind this behavior to the source.
|
|
2606
|
-
* @param source - The source to bind to.
|
|
2607
|
-
* @param context - The execution context that the binding is operating within.
|
|
2608
|
-
* @param targets - The targets that behaviors in a view can attach to.
|
|
2609
|
-
*/
|
|
2610
|
-
bind(source: any, context: ExecutionContext, targets: ViewBehaviorTargets): void;
|
|
2611
|
-
/**
|
|
2612
|
-
* Unbinds this behavior from the source.
|
|
2613
|
-
* @param source - The source to unbind from.
|
|
2614
|
-
* @param context - The execution context that the binding is operating within.
|
|
2615
|
-
* @param targets - The targets that behaviors in a view can attach to.
|
|
2616
|
-
*/
|
|
2617
|
-
unbind(source: any, context: ExecutionContext, targets: ViewBehaviorTargets): void;
|
|
2618
|
-
/** @internal */
|
|
2619
|
-
handleEvent(event: Event): void;
|
|
2620
|
-
/**
|
|
2621
|
-
* Configures two-way binding.
|
|
2622
|
-
* @param settings - The settings to use for the two-way binding system.
|
|
2623
|
-
*/
|
|
2624
|
-
static configure(settings: TwoWaySettings): void;
|
|
2625
|
-
}
|
|
2626
|
-
|
|
2627
|
-
/**
|
|
2628
|
-
* The settings required to enable two-way binding.
|
|
2629
|
-
* @public
|
|
2630
|
-
*/
|
|
2631
|
-
export declare interface TwoWaySettings {
|
|
2632
|
-
/**
|
|
2633
|
-
* Determines which event to listen to, to detect changes in the view.
|
|
2634
|
-
* @param directive - The directive to determine the change event for.
|
|
2635
|
-
* @param target - The target element to determine the change event for.
|
|
2636
|
-
*/
|
|
2637
|
-
determineChangeEvent(directive: HTMLBindingDirective, target: HTMLElement): string;
|
|
2638
|
-
}
|
|
2639
|
-
|
|
2640
2569
|
/**
|
|
2641
2570
|
* Do not change. Part of shared kernel contract.
|
|
2642
2571
|
* @internal
|
|
@@ -2655,40 +2584,6 @@ export declare interface TypeRegistry<TDefinition extends TypeDefinition> {
|
|
|
2655
2584
|
getForInstance(object: any): TDefinition | undefined;
|
|
2656
2585
|
}
|
|
2657
2586
|
|
|
2658
|
-
/**
|
|
2659
|
-
* A base binding behavior for DOM updates.
|
|
2660
|
-
* @public
|
|
2661
|
-
*/
|
|
2662
|
-
export declare class UpdateBinding implements ViewBehavior {
|
|
2663
|
-
readonly directive: HTMLBindingDirective;
|
|
2664
|
-
protected updateTarget: UpdateTarget;
|
|
2665
|
-
/**
|
|
2666
|
-
* Creates an instance of UpdateBinding.
|
|
2667
|
-
* @param directive - The directive that has the configuration for this behavior.
|
|
2668
|
-
* @param updateTarget - The function used to update the target with the latest value.
|
|
2669
|
-
*/
|
|
2670
|
-
constructor(directive: HTMLBindingDirective, updateTarget: UpdateTarget);
|
|
2671
|
-
/**
|
|
2672
|
-
* Bind this behavior to the source.
|
|
2673
|
-
* @param source - The source to bind to.
|
|
2674
|
-
* @param context - The execution context that the binding is operating within.
|
|
2675
|
-
* @param targets - The targets that behaviors in a view can attach to.
|
|
2676
|
-
*/
|
|
2677
|
-
bind(source: any, context: ExecutionContext, targets: ViewBehaviorTargets): void;
|
|
2678
|
-
/**
|
|
2679
|
-
* Unbinds this behavior from the source.
|
|
2680
|
-
* @param source - The source to unbind from.
|
|
2681
|
-
* @param context - The execution context that the binding is operating within.
|
|
2682
|
-
* @param targets - The targets that behaviors in a view can attach to.
|
|
2683
|
-
*/
|
|
2684
|
-
unbind(source: any, context: ExecutionContext, targets: ViewBehaviorTargets): void;
|
|
2685
|
-
/**
|
|
2686
|
-
* Creates a behavior.
|
|
2687
|
-
* @param targets - The targets available for behaviors to be attached to.
|
|
2688
|
-
*/
|
|
2689
|
-
createBehavior(targets: ViewBehaviorTargets): ViewBehavior;
|
|
2690
|
-
}
|
|
2691
|
-
|
|
2692
2587
|
/**
|
|
2693
2588
|
* A work queue used to synchronize writes to the DOM.
|
|
2694
2589
|
* @public
|
|
@@ -2730,29 +2625,6 @@ export declare interface UpdateQueue {
|
|
|
2730
2625
|
*/
|
|
2731
2626
|
export declare const Updates: UpdateQueue;
|
|
2732
2627
|
|
|
2733
|
-
/**
|
|
2734
|
-
* A target update function.
|
|
2735
|
-
* @param this - The "this" context for the update.
|
|
2736
|
-
* @param target - The node that is targeted by the update.
|
|
2737
|
-
* @param aspect - The aspect of the node that is being targeted.
|
|
2738
|
-
* @param value - The value to assign to the aspect.
|
|
2739
|
-
* @param source - The source object that the value was derived from.
|
|
2740
|
-
* @param context - The execution context that the binding is being run under.
|
|
2741
|
-
* @public
|
|
2742
|
-
*/
|
|
2743
|
-
export declare type UpdateTarget = (this: UpdateTargetThis, target: Node, aspect: string, value: any, source: any, context: ExecutionContext) => void;
|
|
2744
|
-
|
|
2745
|
-
/**
|
|
2746
|
-
* The "this" context for an update target function.
|
|
2747
|
-
* @public
|
|
2748
|
-
*/
|
|
2749
|
-
export declare interface UpdateTargetThis {
|
|
2750
|
-
/**
|
|
2751
|
-
* The directive configuration for the update.
|
|
2752
|
-
*/
|
|
2753
|
-
directive: HTMLBindingDirective;
|
|
2754
|
-
}
|
|
2755
|
-
|
|
2756
2628
|
/**
|
|
2757
2629
|
* Represents objects that can convert values to and from
|
|
2758
2630
|
* view or model representations.
|
|
@@ -2775,11 +2647,11 @@ export declare interface ValueConverter {
|
|
|
2775
2647
|
* Represents a collection of DOM nodes which can be bound to a data source.
|
|
2776
2648
|
* @public
|
|
2777
2649
|
*/
|
|
2778
|
-
export declare interface View<TSource = any, TParent = any
|
|
2650
|
+
export declare interface View<TSource = any, TParent = any> extends Disposable {
|
|
2779
2651
|
/**
|
|
2780
2652
|
* The execution context the view is running within.
|
|
2781
2653
|
*/
|
|
2782
|
-
readonly context:
|
|
2654
|
+
readonly context: ExecutionContext<TParent>;
|
|
2783
2655
|
/**
|
|
2784
2656
|
* The data that the view is bound to.
|
|
2785
2657
|
*/
|
|
@@ -2787,9 +2659,8 @@ export declare interface View<TSource = any, TParent = any, TContext extends Exe
|
|
|
2787
2659
|
/**
|
|
2788
2660
|
* Binds a view's behaviors to its binding source.
|
|
2789
2661
|
* @param source - The binding source for the view's binding behaviors.
|
|
2790
|
-
* @param context - The execution context to run the view within.
|
|
2791
2662
|
*/
|
|
2792
|
-
bind(source: TSource, context
|
|
2663
|
+
bind(source: TSource, context?: ExecutionContext<TParent>): void;
|
|
2793
2664
|
/**
|
|
2794
2665
|
* Unbinds a view's behaviors from its binding source and context.
|
|
2795
2666
|
*/
|
|
@@ -2802,23 +2673,14 @@ export declare interface View<TSource = any, TParent = any, TContext extends Exe
|
|
|
2802
2673
|
*/
|
|
2803
2674
|
export declare interface ViewBehavior<TSource = any, TParent = any> {
|
|
2804
2675
|
/**
|
|
2805
|
-
* Bind this behavior
|
|
2806
|
-
* @param
|
|
2807
|
-
* @param context - The execution context that the binding is operating within.
|
|
2808
|
-
* @param targets - The targets that behaviors in a view can attach to.
|
|
2809
|
-
*/
|
|
2810
|
-
bind(source: TSource, context: ExecutionContext<TParent>, targets: ViewBehaviorTargets): void;
|
|
2811
|
-
/**
|
|
2812
|
-
* Unbinds this behavior from the source.
|
|
2813
|
-
* @param source - The source to unbind from.
|
|
2814
|
-
* @param context - The execution context that the binding is operating within.
|
|
2815
|
-
* @param targets - The targets that behaviors in a view can attach to.
|
|
2676
|
+
* Bind this behavior.
|
|
2677
|
+
* @param controller - The view controller that manages the lifecycle of this behavior.
|
|
2816
2678
|
*/
|
|
2817
|
-
|
|
2679
|
+
bind(controller: ViewController<TSource, TParent>): void;
|
|
2818
2680
|
}
|
|
2819
2681
|
|
|
2820
2682
|
/**
|
|
2821
|
-
* A factory that can create a {@link
|
|
2683
|
+
* A factory that can create a {@link ViewBehavior} associated with a particular
|
|
2822
2684
|
* location within a DOM fragment.
|
|
2823
2685
|
* @public
|
|
2824
2686
|
*/
|
|
@@ -2833,11 +2695,49 @@ export declare interface ViewBehaviorFactory {
|
|
|
2833
2695
|
nodeId: string;
|
|
2834
2696
|
/**
|
|
2835
2697
|
* Creates a behavior.
|
|
2836
|
-
* @param targets - The targets available for behaviors to be attached to.
|
|
2837
2698
|
*/
|
|
2838
|
-
createBehavior(
|
|
2699
|
+
createBehavior(): ViewBehavior;
|
|
2700
|
+
}
|
|
2701
|
+
|
|
2702
|
+
/**
|
|
2703
|
+
* Bridges between ViewBehaviors and HostBehaviors, enabling a host to
|
|
2704
|
+
* control ViewBehaviors.
|
|
2705
|
+
* @public
|
|
2706
|
+
*/
|
|
2707
|
+
export declare interface ViewBehaviorOrchestrator<TSource = any, TParent = any> extends ViewController<TSource, TParent>, HostBehavior<TSource> {
|
|
2708
|
+
/**
|
|
2709
|
+
*
|
|
2710
|
+
* @param nodeId - The structural id of the DOM node to which a behavior will apply.
|
|
2711
|
+
* @param target - The DOM node associated with the id.
|
|
2712
|
+
*/
|
|
2713
|
+
addTarget(nodeId: string, target: Node): void;
|
|
2714
|
+
/**
|
|
2715
|
+
* Adds a behavior.
|
|
2716
|
+
* @param behavior - The behavior to add.
|
|
2717
|
+
*/
|
|
2718
|
+
addBehavior(behavior: ViewBehavior): void;
|
|
2719
|
+
/**
|
|
2720
|
+
* Adds a behavior factory.
|
|
2721
|
+
* @param factory - The behavior factory to add.
|
|
2722
|
+
* @param target - The target the factory will create behaviors for.
|
|
2723
|
+
*/
|
|
2724
|
+
addBehaviorFactory(factory: ViewBehaviorFactory, target: Node): void;
|
|
2839
2725
|
}
|
|
2840
2726
|
|
|
2727
|
+
/**
|
|
2728
|
+
* Bridges between ViewBehaviors and HostBehaviors, enabling a host to
|
|
2729
|
+
* control ViewBehaviors.
|
|
2730
|
+
* @public
|
|
2731
|
+
*/
|
|
2732
|
+
export declare const ViewBehaviorOrchestrator: Readonly<{
|
|
2733
|
+
/**
|
|
2734
|
+
* Creates a ViewBehaviorOrchestrator.
|
|
2735
|
+
* @param source - The source to to associate behaviors with.
|
|
2736
|
+
* @returns A ViewBehaviorOrchestrator.
|
|
2737
|
+
*/
|
|
2738
|
+
create<TSource = any, TParent = any>(source: TSource): ViewBehaviorOrchestrator<TSource, TParent>;
|
|
2739
|
+
}>;
|
|
2740
|
+
|
|
2841
2741
|
/**
|
|
2842
2742
|
* The target nodes available to a behavior.
|
|
2843
2743
|
* @public
|
|
@@ -2847,16 +2747,22 @@ export declare type ViewBehaviorTargets = {
|
|
|
2847
2747
|
};
|
|
2848
2748
|
|
|
2849
2749
|
/**
|
|
2850
|
-
*
|
|
2750
|
+
* Controls the lifecycle of a view and provides relevant context.
|
|
2851
2751
|
* @public
|
|
2852
2752
|
*/
|
|
2853
|
-
export declare
|
|
2854
|
-
private result;
|
|
2753
|
+
export declare interface ViewController<TSource = any, TParent = any> extends ExpressionController<TSource, TParent> {
|
|
2855
2754
|
/**
|
|
2856
|
-
*
|
|
2857
|
-
* Do not use.
|
|
2755
|
+
* The parts of the view that are targeted by view behaviors.
|
|
2858
2756
|
*/
|
|
2859
|
-
|
|
2757
|
+
readonly targets: ViewBehaviorTargets;
|
|
2758
|
+
}
|
|
2759
|
+
|
|
2760
|
+
/**
|
|
2761
|
+
* A template capable of creating HTMLView instances or rendering directly to DOM.
|
|
2762
|
+
* @public
|
|
2763
|
+
*/
|
|
2764
|
+
export declare class ViewTemplate<TSource = any, TParent = any> implements ElementViewTemplate<TSource, TParent>, SyntheticViewTemplate<TSource, TParent> {
|
|
2765
|
+
private result;
|
|
2860
2766
|
/**
|
|
2861
2767
|
* The html representing what this template will
|
|
2862
2768
|
* instantiate, including placeholders for directives.
|
|
@@ -2876,7 +2782,7 @@ export declare class ViewTemplate<TSource = any, TParent = any, TContext extends
|
|
|
2876
2782
|
* Creates an HTMLView instance based on this template definition.
|
|
2877
2783
|
* @param hostBindingTarget - The element that host behaviors will be bound to.
|
|
2878
2784
|
*/
|
|
2879
|
-
create(hostBindingTarget?: Element): HTMLView<TSource, TParent
|
|
2785
|
+
create(hostBindingTarget?: Element): HTMLView<TSource, TParent>;
|
|
2880
2786
|
/**
|
|
2881
2787
|
* Creates an HTMLView from this template, binds it to the source, and then appends it to the host.
|
|
2882
2788
|
* @param source - The data source to bind the template to.
|
|
@@ -2884,7 +2790,7 @@ export declare class ViewTemplate<TSource = any, TParent = any, TContext extends
|
|
|
2884
2790
|
* @param hostBindingTarget - An HTML element to target the host bindings at if different from the
|
|
2885
2791
|
* host that the template is being attached to.
|
|
2886
2792
|
*/
|
|
2887
|
-
render(source: TSource, host: Node, hostBindingTarget?: Element
|
|
2793
|
+
render(source: TSource, host: Node, hostBindingTarget?: Element): HTMLView<TSource, TParent>;
|
|
2888
2794
|
}
|
|
2889
2795
|
|
|
2890
2796
|
/**
|
|
@@ -2898,11 +2804,11 @@ export declare function volatile(target: {}, name: string | Accessor, descriptor
|
|
|
2898
2804
|
|
|
2899
2805
|
/**
|
|
2900
2806
|
* A directive that enables basic conditional rendering in a template.
|
|
2901
|
-
* @param
|
|
2807
|
+
* @param condition - The condition to test for rendering.
|
|
2902
2808
|
* @param templateOrTemplateBinding - The template or a binding that gets
|
|
2903
2809
|
* the template to render when the condition is true.
|
|
2904
2810
|
* @public
|
|
2905
2811
|
*/
|
|
2906
|
-
export declare function when<TSource = any, TReturn = any>(
|
|
2812
|
+
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>;
|
|
2907
2813
|
|
|
2908
2814
|
export { }
|