@microsoft/fast-element 2.0.0-beta.3 → 2.0.0-beta.4
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 +81 -0
- package/CHANGELOG.md +20 -1
- package/dist/dts/components/fast-definitions.d.ts +9 -8
- package/dist/dts/components/fast-element.d.ts +8 -4
- package/dist/dts/context.d.ts +1 -1
- package/dist/dts/di/di.d.ts +854 -0
- package/dist/dts/hooks.d.ts +2 -2
- package/dist/dts/interfaces.d.ts +38 -7
- package/dist/dts/observation/observable.d.ts +19 -13
- package/dist/dts/styles/element-styles.d.ts +6 -0
- package/dist/dts/templating/binding-signal.d.ts +10 -27
- package/dist/dts/templating/binding-two-way.d.ts +16 -41
- package/dist/dts/templating/binding.d.ts +79 -118
- package/dist/dts/templating/html-directive.d.ts +28 -2
- package/dist/dts/templating/render.d.ts +277 -0
- package/dist/dts/templating/repeat.d.ts +12 -16
- package/dist/dts/templating/template.d.ts +3 -3
- package/dist/dts/templating/when.d.ts +3 -3
- package/dist/dts/testing/exports.d.ts +2 -0
- package/dist/dts/testing/fixture.d.ts +90 -0
- package/dist/dts/testing/timeout.d.ts +7 -0
- package/dist/esm/components/fast-definitions.js +25 -27
- package/dist/esm/components/fast-element.js +16 -8
- package/dist/esm/context.js +5 -1
- package/dist/esm/debug.js +34 -4
- package/dist/esm/di/di.js +1349 -0
- package/dist/esm/observation/observable.js +4 -4
- package/dist/esm/platform.js +1 -1
- package/dist/esm/styles/element-styles.js +14 -0
- package/dist/esm/templating/binding-signal.js +56 -61
- package/dist/esm/templating/binding-two-way.js +51 -35
- package/dist/esm/templating/binding.js +137 -156
- package/dist/esm/templating/compiler.js +29 -7
- package/dist/esm/templating/html-directive.js +12 -1
- package/dist/esm/templating/render.js +392 -0
- package/dist/esm/templating/repeat.js +54 -40
- package/dist/esm/templating/template.js +8 -5
- package/dist/esm/templating/when.js +5 -4
- package/dist/esm/testing/exports.js +2 -0
- package/dist/esm/testing/fixture.js +88 -0
- package/dist/esm/testing/timeout.js +24 -0
- package/dist/fast-element.api.json +3257 -3151
- package/dist/fast-element.d.ts +210 -209
- package/dist/fast-element.debug.js +329 -248
- package/dist/fast-element.debug.min.js +1 -1
- package/dist/fast-element.js +295 -244
- package/dist/fast-element.min.js +1 -1
- package/dist/fast-element.untrimmed.d.ts +218 -214
- package/docs/api-report.md +83 -85
- package/package.json +13 -1
|
@@ -159,7 +159,7 @@ export declare interface Aspected {
|
|
|
159
159
|
/**
|
|
160
160
|
* A binding if one is associated with the aspect.
|
|
161
161
|
*/
|
|
162
|
-
|
|
162
|
+
dataBinding?: Binding;
|
|
163
163
|
}
|
|
164
164
|
|
|
165
165
|
/**
|
|
@@ -286,102 +286,81 @@ export declare interface Behavior<TSource = any, TParent = any> {
|
|
|
286
286
|
}
|
|
287
287
|
|
|
288
288
|
/**
|
|
289
|
-
* Creates
|
|
290
|
-
* @param binding - The binding
|
|
291
|
-
* @param
|
|
292
|
-
* @returns A binding
|
|
289
|
+
* Creates an standard binding.
|
|
290
|
+
* @param binding - The binding to refresh when changed.
|
|
291
|
+
* @param isVolatile - Indicates whether the binding is volatile or not.
|
|
292
|
+
* @returns A binding configuration.
|
|
293
293
|
* @public
|
|
294
294
|
*/
|
|
295
|
-
export declare function bind<T = any>(binding:
|
|
295
|
+
export declare function bind<T = any>(binding: Expression<T>, isVolatile?: boolean): Binding<T>;
|
|
296
296
|
|
|
297
297
|
/**
|
|
298
|
-
*
|
|
299
|
-
*
|
|
300
|
-
* @public
|
|
301
|
-
*/
|
|
302
|
-
export declare type Binding<TSource = any, TReturn = any, TParent = any> = (source: TSource, context: ExecutionContext<TParent>) => TReturn;
|
|
303
|
-
|
|
304
|
-
/**
|
|
305
|
-
* Describes the configuration for a binding expression.
|
|
298
|
+
* Captures a binding expression along with related information and capabilities.
|
|
299
|
+
*
|
|
306
300
|
* @public
|
|
307
301
|
*/
|
|
308
|
-
export declare
|
|
302
|
+
export declare abstract class Binding<TSource = any, TReturn = any, TParent = any> {
|
|
303
|
+
/**
|
|
304
|
+
* Options associated with the binding.
|
|
305
|
+
*/
|
|
306
|
+
options?: any;
|
|
309
307
|
/**
|
|
310
|
-
*
|
|
308
|
+
* Whether or not the binding is volatile.
|
|
311
309
|
*/
|
|
312
|
-
|
|
310
|
+
isVolatile?: boolean;
|
|
313
311
|
/**
|
|
314
|
-
*
|
|
312
|
+
* Evaluates the binding expression.
|
|
315
313
|
*/
|
|
316
|
-
|
|
314
|
+
evaluate: Expression<TSource, TReturn, TParent>;
|
|
315
|
+
/**
|
|
316
|
+
* Creates an observer capable of notifying a subscriber when the output of a binding changes.
|
|
317
|
+
* @param directive - The HTML Directive to create the observer for.
|
|
318
|
+
* @param subscriber - The subscriber to changes in the binding.
|
|
319
|
+
*/
|
|
320
|
+
abstract createObserver(directive: HTMLDirective, subscriber: Subscriber): ExpressionObserver<TSource, TReturn, TParent>;
|
|
317
321
|
}
|
|
318
322
|
|
|
319
323
|
/**
|
|
320
|
-
*
|
|
324
|
+
* A binding behavior for bindings that change.
|
|
321
325
|
* @public
|
|
322
326
|
*/
|
|
323
|
-
export declare
|
|
327
|
+
export declare class BindingBehavior implements ViewBehavior {
|
|
328
|
+
readonly directive: HTMLBindingDirective;
|
|
329
|
+
protected updateTarget: UpdateTarget;
|
|
330
|
+
private observerProperty;
|
|
324
331
|
/**
|
|
325
|
-
* Creates
|
|
326
|
-
* @param
|
|
327
|
-
* @param
|
|
328
|
-
* @returns A new binding configuration.
|
|
332
|
+
* Creates an instance of ChangeBinding.
|
|
333
|
+
* @param directive - The directive that has the configuration for this behavior.
|
|
334
|
+
* @param updateTarget - The function used to update the target with the latest value.
|
|
329
335
|
*/
|
|
330
|
-
|
|
331
|
-
}>;
|
|
332
|
-
|
|
333
|
-
/**
|
|
334
|
-
* Creates a new binding configuration based on the supplied options.
|
|
335
|
-
* @public
|
|
336
|
-
*/
|
|
337
|
-
export declare type BindingConfigResolver<T> = (options: T) => BindingConfig<T>;
|
|
338
|
-
|
|
339
|
-
/**
|
|
340
|
-
* Describes how aspects of an HTML element will be affected by bindings.
|
|
341
|
-
* @public
|
|
342
|
-
*/
|
|
343
|
-
export declare type BindingMode = Record<Aspect, (directive: HTMLBindingDirective) => Pick<ViewBehaviorFactory, "createBehavior">>;
|
|
344
|
-
|
|
345
|
-
/**
|
|
346
|
-
* Describes how aspects of an HTML element will be affected by bindings.
|
|
347
|
-
* @public
|
|
348
|
-
*/
|
|
349
|
-
export declare const BindingMode: Readonly<{
|
|
336
|
+
constructor(directive: HTMLBindingDirective, updateTarget: UpdateTarget);
|
|
350
337
|
/**
|
|
351
|
-
*
|
|
352
|
-
* @param
|
|
353
|
-
* @param
|
|
354
|
-
* @
|
|
338
|
+
* Bind this behavior to the source.
|
|
339
|
+
* @param source - The source to bind to.
|
|
340
|
+
* @param context - The execution context that the binding is operating within.
|
|
341
|
+
* @param targets - The targets that behaviors in a view can attach to.
|
|
355
342
|
*/
|
|
356
|
-
|
|
357
|
-
}>;
|
|
358
|
-
|
|
359
|
-
/**
|
|
360
|
-
* Enables evaluation of and subscription to a binding.
|
|
361
|
-
* @public
|
|
362
|
-
*/
|
|
363
|
-
export declare interface BindingObserver<TSource = any, TReturn = any, TParent = any> extends Notifier, Disposable {
|
|
343
|
+
bind(source: any, context: ExecutionContext, targets: ViewBehaviorTargets): void;
|
|
364
344
|
/**
|
|
365
|
-
*
|
|
366
|
-
* @param source - The source
|
|
367
|
-
* @param context - The execution context
|
|
368
|
-
* @
|
|
345
|
+
* Unbinds this behavior from the source.
|
|
346
|
+
* @param source - The source to unbind from.
|
|
347
|
+
* @param context - The execution context that the binding is operating within.
|
|
348
|
+
* @param targets - The targets that behaviors in a view can attach to.
|
|
369
349
|
*/
|
|
370
|
-
|
|
350
|
+
unbind(source: any, context: ExecutionContext, targets: ViewBehaviorTargets): void;
|
|
351
|
+
/** @internal */
|
|
352
|
+
handleChange(binding: Expression, observer: ExpressionObserver): void;
|
|
371
353
|
/**
|
|
372
|
-
*
|
|
373
|
-
*
|
|
354
|
+
* Returns the binding observer used to update the node.
|
|
355
|
+
* @param target - The target node.
|
|
356
|
+
* @returns A BindingObserver.
|
|
374
357
|
*/
|
|
375
|
-
|
|
358
|
+
protected getObserver(target: Node): ExpressionObserver;
|
|
376
359
|
/**
|
|
377
|
-
*
|
|
378
|
-
* @param
|
|
379
|
-
* @remarks
|
|
380
|
-
* By default, the update mode is asynchronous, since that provides the best
|
|
381
|
-
* performance for template rendering scenarios. Passing false to setMode will
|
|
382
|
-
* instead cause the observer to notify subscribers immediately when changes occur.
|
|
360
|
+
* Creates a behavior.
|
|
361
|
+
* @param targets - The targets available for behaviors to be attached to.
|
|
383
362
|
*/
|
|
384
|
-
|
|
363
|
+
createBehavior(targets: ViewBehaviorTargets): ViewBehavior;
|
|
385
364
|
}
|
|
386
365
|
|
|
387
366
|
/**
|
|
@@ -410,43 +389,6 @@ export declare type Callable = typeof Function.prototype.call | {
|
|
|
410
389
|
export declare interface CaptureType<TSource> {
|
|
411
390
|
}
|
|
412
391
|
|
|
413
|
-
/**
|
|
414
|
-
* A binding behavior for bindings that change.
|
|
415
|
-
* @public
|
|
416
|
-
*/
|
|
417
|
-
export declare class ChangeBinding extends UpdateBinding {
|
|
418
|
-
private isBindingVolatile;
|
|
419
|
-
private observerProperty;
|
|
420
|
-
/**
|
|
421
|
-
* Creates an instance of ChangeBinding.
|
|
422
|
-
* @param directive - The directive that has the configuration for this behavior.
|
|
423
|
-
* @param updateTarget - The function used to update the target with the latest value.
|
|
424
|
-
*/
|
|
425
|
-
constructor(directive: HTMLBindingDirective, updateTarget: UpdateTarget);
|
|
426
|
-
/**
|
|
427
|
-
* Returns the binding observer used to update the node.
|
|
428
|
-
* @param target - The target node.
|
|
429
|
-
* @returns A BindingObserver.
|
|
430
|
-
*/
|
|
431
|
-
protected getObserver(target: Node): BindingObserver;
|
|
432
|
-
/**
|
|
433
|
-
* Bind this behavior to the source.
|
|
434
|
-
* @param source - The source to bind to.
|
|
435
|
-
* @param context - The execution context that the binding is operating within.
|
|
436
|
-
* @param targets - The targets that behaviors in a view can attach to.
|
|
437
|
-
*/
|
|
438
|
-
bind(source: any, context: ExecutionContext, targets: ViewBehaviorTargets): void;
|
|
439
|
-
/**
|
|
440
|
-
* Unbinds this behavior from the source.
|
|
441
|
-
* @param source - The source to unbind from.
|
|
442
|
-
* @param context - The execution context that the binding is operating within.
|
|
443
|
-
* @param targets - The targets that behaviors in a view can attach to.
|
|
444
|
-
*/
|
|
445
|
-
unbind(source: any, context: ExecutionContext, targets: ViewBehaviorTargets): void;
|
|
446
|
-
/** @internal */
|
|
447
|
-
handleChange(binding: Binding, observer: BindingObserver): void;
|
|
448
|
-
}
|
|
449
|
-
|
|
450
392
|
/**
|
|
451
393
|
* The options used to configure child list observation.
|
|
452
394
|
* @public
|
|
@@ -558,6 +500,10 @@ export declare const Compiler: {
|
|
|
558
500
|
*/
|
|
559
501
|
export declare type ComposableStyles = string | ElementStyles | CSSStyleSheet;
|
|
560
502
|
|
|
503
|
+
declare function compose<TType extends Constructable<HTMLElement> = Constructable<HTMLElement>>(this: TType, nameOrDef: string | PartialFASTElementDefinition): FASTElementDefinition<TType>;
|
|
504
|
+
|
|
505
|
+
declare function compose<TType extends Constructable<HTMLElement> = Constructable<HTMLElement>>(type: TType, nameOrDef?: string | PartialFASTElementDefinition): FASTElementDefinition<TType>;
|
|
506
|
+
|
|
561
507
|
/**
|
|
562
508
|
* Allows for the creation of Constructable mixin classes.
|
|
563
509
|
*
|
|
@@ -579,6 +525,58 @@ export declare type ConstructibleStyleStrategy = {
|
|
|
579
525
|
new (styles: (string | CSSStyleSheet)[]): StyleStrategy;
|
|
580
526
|
};
|
|
581
527
|
|
|
528
|
+
/**
|
|
529
|
+
* A special binding behavior that can bind node content.
|
|
530
|
+
* @public
|
|
531
|
+
*/
|
|
532
|
+
export declare class ContentBehavior extends BindingBehavior {
|
|
533
|
+
/**
|
|
534
|
+
* Unbinds this behavior from the source.
|
|
535
|
+
* @param source - The source to unbind from.
|
|
536
|
+
* @param context - The execution context that the binding is operating within.
|
|
537
|
+
* @param targets - The targets that behaviors in a view can attach to.
|
|
538
|
+
*/
|
|
539
|
+
unbind(source: any, context: ExecutionContext, targets: ViewBehaviorTargets): void;
|
|
540
|
+
}
|
|
541
|
+
|
|
542
|
+
/**
|
|
543
|
+
* A simple template that can create ContentView instances.
|
|
544
|
+
* @public
|
|
545
|
+
*/
|
|
546
|
+
export declare interface ContentTemplate {
|
|
547
|
+
/**
|
|
548
|
+
* Creates a simple content view instance.
|
|
549
|
+
*/
|
|
550
|
+
create(): ContentView;
|
|
551
|
+
}
|
|
552
|
+
|
|
553
|
+
/**
|
|
554
|
+
* A simple View that can be interpolated into HTML content.
|
|
555
|
+
* @public
|
|
556
|
+
*/
|
|
557
|
+
export declare interface ContentView {
|
|
558
|
+
/**
|
|
559
|
+
* Binds a view's behaviors to its binding source.
|
|
560
|
+
* @param source - The binding source for the view's binding behaviors.
|
|
561
|
+
* @param context - The execution context to run the view within.
|
|
562
|
+
*/
|
|
563
|
+
bind(source: any, context: ExecutionContext): void;
|
|
564
|
+
/**
|
|
565
|
+
* Unbinds a view's behaviors from its binding source and context.
|
|
566
|
+
*/
|
|
567
|
+
unbind(): void;
|
|
568
|
+
/**
|
|
569
|
+
* Inserts the view's DOM nodes before the referenced node.
|
|
570
|
+
* @param node - The node to insert the view's DOM before.
|
|
571
|
+
*/
|
|
572
|
+
insertBefore(node: Node): void;
|
|
573
|
+
/**
|
|
574
|
+
* Removes the view's DOM nodes.
|
|
575
|
+
* The nodes are not disposed and the view can later be re-inserted.
|
|
576
|
+
*/
|
|
577
|
+
remove(): void;
|
|
578
|
+
}
|
|
579
|
+
|
|
582
580
|
/**
|
|
583
581
|
* Controls the lifecycle and rendering of a `FASTElement`.
|
|
584
582
|
* @public
|
|
@@ -809,11 +807,9 @@ export declare function customElement(nameOrDef: string | PartialFASTElementDefi
|
|
|
809
807
|
*/
|
|
810
808
|
export declare type DecoratorAttributeConfiguration = Omit<AttributeConfiguration, "property">;
|
|
811
809
|
|
|
812
|
-
|
|
813
|
-
|
|
814
|
-
|
|
815
|
-
*/
|
|
816
|
-
export declare type DefaultBindingOptions = AddEventListenerOptions;
|
|
810
|
+
declare function define<TType extends Constructable<HTMLElement> = Constructable<HTMLElement>>(this: TType, nameOrDef: string | PartialFASTElementDefinition): TType;
|
|
811
|
+
|
|
812
|
+
declare function define<TType extends Constructable<HTMLElement> = Constructable<HTMLElement>>(type: TType, nameOrDef?: string | PartialFASTElementDefinition): TType;
|
|
817
813
|
|
|
818
814
|
/**
|
|
819
815
|
* Provides a mechanism for releasing resources.
|
|
@@ -923,6 +919,12 @@ export declare class ElementStyles {
|
|
|
923
919
|
* @param Strategy - The strategy type to construct.
|
|
924
920
|
*/
|
|
925
921
|
static setDefaultStrategy(Strategy: ConstructibleStyleStrategy): void;
|
|
922
|
+
/**
|
|
923
|
+
* Normalizes a set of composable style options.
|
|
924
|
+
* @param styles - The style options to normalize.
|
|
925
|
+
* @returns A singular ElementStyles instance or undefined.
|
|
926
|
+
*/
|
|
927
|
+
static normalize(styles: ComposableStyles | ComposableStyles[] | undefined): ElementStyles | undefined;
|
|
926
928
|
/**
|
|
927
929
|
* Indicates whether the DOM supports the adoptedStyleSheets feature.
|
|
928
930
|
*/
|
|
@@ -974,7 +976,7 @@ export declare const emptyArray: readonly never[];
|
|
|
974
976
|
* A binding behavior for handling events.
|
|
975
977
|
* @public
|
|
976
978
|
*/
|
|
977
|
-
export declare class
|
|
979
|
+
export declare class EventBehavior {
|
|
978
980
|
readonly directive: HTMLBindingDirective;
|
|
979
981
|
private contextProperty;
|
|
980
982
|
private sourceProperty;
|
|
@@ -1103,6 +1105,48 @@ export declare class ExecutionContext<TParentSource = any> {
|
|
|
1103
1105
|
static create(): ExecutionContext;
|
|
1104
1106
|
}
|
|
1105
1107
|
|
|
1108
|
+
/**
|
|
1109
|
+
* The signature of an arrow function capable of being evaluated
|
|
1110
|
+
* against source data and within an execution context.
|
|
1111
|
+
* @public
|
|
1112
|
+
*/
|
|
1113
|
+
export declare type Expression<TSource = any, TReturn = any, TParent = any> = (source: TSource, context: ExecutionContext<TParent>) => TReturn;
|
|
1114
|
+
|
|
1115
|
+
/**
|
|
1116
|
+
* Enables evaluation of and subscription to a binding.
|
|
1117
|
+
* @public
|
|
1118
|
+
*/
|
|
1119
|
+
export declare interface ExpressionNotifier<TSource = any, TReturn = any, TParent = any> extends Notifier, ExpressionObserver<TSource, TReturn, TParent> {
|
|
1120
|
+
/**
|
|
1121
|
+
* Gets {@link ObservationRecord|ObservationRecords} that the {@link ExpressionNotifier}
|
|
1122
|
+
* is observing.
|
|
1123
|
+
*/
|
|
1124
|
+
records(): IterableIterator<ObservationRecord>;
|
|
1125
|
+
/**
|
|
1126
|
+
* Sets the update mode used by the observer.
|
|
1127
|
+
* @param isAsync - Indicates whether updates should be asynchronous.
|
|
1128
|
+
* @remarks
|
|
1129
|
+
* By default, the update mode is asynchronous, since that provides the best
|
|
1130
|
+
* performance for template rendering scenarios. Passing false to setMode will
|
|
1131
|
+
* instead cause the observer to notify subscribers immediately when changes occur.
|
|
1132
|
+
*/
|
|
1133
|
+
setMode(isAsync: boolean): void;
|
|
1134
|
+
}
|
|
1135
|
+
|
|
1136
|
+
/**
|
|
1137
|
+
* Observes a binding for changes.
|
|
1138
|
+
*
|
|
1139
|
+
* @public
|
|
1140
|
+
*/
|
|
1141
|
+
export declare interface ExpressionObserver<TSource = any, TReturn = any, TParent = any> extends Disposable {
|
|
1142
|
+
/**
|
|
1143
|
+
* Begins observing the binding.
|
|
1144
|
+
* @param source - The source to pass to the binding.
|
|
1145
|
+
* @param context - The context to pass to the binding.
|
|
1146
|
+
*/
|
|
1147
|
+
observe(source: TSource, context?: ExecutionContext<TParent>): TReturn;
|
|
1148
|
+
}
|
|
1149
|
+
|
|
1106
1150
|
/**
|
|
1107
1151
|
* The FAST global.
|
|
1108
1152
|
* @internal
|
|
@@ -1175,13 +1219,12 @@ export declare const FASTElement: (new () => HTMLElement & FASTElement) & {
|
|
|
1175
1219
|
* @param nameOrDef - The name of the element to define or a definition object
|
|
1176
1220
|
* that describes the element to define.
|
|
1177
1221
|
*/
|
|
1178
|
-
define
|
|
1222
|
+
define: typeof define;
|
|
1179
1223
|
/**
|
|
1180
1224
|
* Defines metadata for a FASTElement which can be used to later define the element.
|
|
1181
|
-
* IMPORTANT: This API will be renamed to "compose" in a future beta.
|
|
1182
1225
|
* @public
|
|
1183
1226
|
*/
|
|
1184
|
-
|
|
1227
|
+
compose: typeof compose;
|
|
1185
1228
|
};
|
|
1186
1229
|
|
|
1187
1230
|
/**
|
|
@@ -1189,7 +1232,7 @@ export declare const FASTElement: (new () => HTMLElement & FASTElement) & {
|
|
|
1189
1232
|
* @public
|
|
1190
1233
|
*/
|
|
1191
1234
|
export declare class FASTElementDefinition<TType extends Constructable<HTMLElement> = Constructable<HTMLElement>> {
|
|
1192
|
-
private
|
|
1235
|
+
private platformDefined;
|
|
1193
1236
|
/**
|
|
1194
1237
|
* The type this element definition describes.
|
|
1195
1238
|
*/
|
|
@@ -1230,13 +1273,7 @@ export declare class FASTElementDefinition<TType extends Constructable<HTMLEleme
|
|
|
1230
1273
|
* Options controlling how the custom element is defined with the platform.
|
|
1231
1274
|
*/
|
|
1232
1275
|
readonly elementOptions?: ElementDefinitionOptions;
|
|
1233
|
-
|
|
1234
|
-
* Creates an instance of FASTElementDefinition.
|
|
1235
|
-
* @param type - The type this definition is being created for.
|
|
1236
|
-
* @param nameOrConfig - The name of the element to define or a config object
|
|
1237
|
-
* that describes the element to define.
|
|
1238
|
-
*/
|
|
1239
|
-
constructor(type: TType, nameOrConfig?: PartialFASTElementDefinition | string);
|
|
1276
|
+
private constructor();
|
|
1240
1277
|
/**
|
|
1241
1278
|
* Defines a custom element based on this definition.
|
|
1242
1279
|
* @param registry - The element registry to define the element in.
|
|
@@ -1244,6 +1281,13 @@ export declare class FASTElementDefinition<TType extends Constructable<HTMLEleme
|
|
|
1244
1281
|
* This operation is idempotent per registry.
|
|
1245
1282
|
*/
|
|
1246
1283
|
define(registry?: CustomElementRegistry): this;
|
|
1284
|
+
/**
|
|
1285
|
+
* Creates an instance of FASTElementDefinition.
|
|
1286
|
+
* @param type - The type this definition is being created for.
|
|
1287
|
+
* @param nameOrDef - The name of the element to define or a config object
|
|
1288
|
+
* that describes the element to define.
|
|
1289
|
+
*/
|
|
1290
|
+
static compose<TType extends Constructable<HTMLElement> = Constructable<HTMLElement>>(type: TType, nameOrDef?: string | PartialFASTElementDefinition): FASTElementDefinition<TType>;
|
|
1247
1291
|
/**
|
|
1248
1292
|
* Gets the element definition associated with the specified type.
|
|
1249
1293
|
* @param type - The custom element type to retrieve the definition for.
|
|
@@ -1275,18 +1319,21 @@ export declare interface FASTGlobal {
|
|
|
1275
1319
|
/**
|
|
1276
1320
|
* Sends a warning to the developer.
|
|
1277
1321
|
* @param code - The warning code to send.
|
|
1278
|
-
* @param
|
|
1322
|
+
* @param values - Values relevant for the warning message.
|
|
1279
1323
|
*/
|
|
1280
|
-
warn(code: number,
|
|
1324
|
+
warn(code: number, values?: Record<string, any>): void;
|
|
1281
1325
|
/**
|
|
1282
1326
|
* Creates an error.
|
|
1283
1327
|
* @param code - The error code to send.
|
|
1284
|
-
* @param
|
|
1328
|
+
* @param values - Values relevant for the error message.
|
|
1285
1329
|
*/
|
|
1286
|
-
error(code: number,
|
|
1330
|
+
error(code: number, values?: Record<string, any>): Error;
|
|
1287
1331
|
/**
|
|
1288
1332
|
* Adds debug messages for errors and warnings.
|
|
1289
1333
|
* @param messages - The message dictionary to add.
|
|
1334
|
+
* @remarks
|
|
1335
|
+
* Message can include placeholders like $\{name\} which can be
|
|
1336
|
+
* replaced by values passed at runtime.
|
|
1290
1337
|
*/
|
|
1291
1338
|
addMessages(messages: Record<number, string>): void;
|
|
1292
1339
|
}
|
|
@@ -1307,9 +1354,7 @@ export declare function html<TSource = any, TParent = any>(strings: TemplateStri
|
|
|
1307
1354
|
* @public
|
|
1308
1355
|
*/
|
|
1309
1356
|
export declare class HTMLBindingDirective implements HTMLDirective, ViewBehaviorFactory, Aspected {
|
|
1310
|
-
|
|
1311
|
-
mode: BindingMode;
|
|
1312
|
-
options: any;
|
|
1357
|
+
dataBinding: Binding;
|
|
1313
1358
|
private factory;
|
|
1314
1359
|
/**
|
|
1315
1360
|
* The unique id of the factory.
|
|
@@ -1333,11 +1378,9 @@ export declare class HTMLBindingDirective implements HTMLDirective, ViewBehavior
|
|
|
1333
1378
|
aspectType: Aspect;
|
|
1334
1379
|
/**
|
|
1335
1380
|
* Creates an instance of HTMLBindingDirective.
|
|
1336
|
-
* @param
|
|
1337
|
-
* @param mode - The binding mode to use when applying the binding.
|
|
1338
|
-
* @param options - The options to configure the binding with.
|
|
1381
|
+
* @param dataBinding - The binding configuration to apply.
|
|
1339
1382
|
*/
|
|
1340
|
-
constructor(
|
|
1383
|
+
constructor(dataBinding: Binding);
|
|
1341
1384
|
/**
|
|
1342
1385
|
* Creates HTML to be used within a template.
|
|
1343
1386
|
* @param add - Can be used to add behavior factories to a template.
|
|
@@ -1502,6 +1545,15 @@ export declare interface LengthObserver extends Subscriber {
|
|
|
1502
1545
|
*/
|
|
1503
1546
|
export declare function lengthOf<T>(array: readonly T[]): number;
|
|
1504
1547
|
|
|
1548
|
+
/**
|
|
1549
|
+
* Creates an event listener binding.
|
|
1550
|
+
* @param binding - The binding to invoke when the event is raised.
|
|
1551
|
+
* @param options - Event listener options.
|
|
1552
|
+
* @returns A binding configuration.
|
|
1553
|
+
* @public
|
|
1554
|
+
*/
|
|
1555
|
+
export declare function listener<T = any>(binding: Expression<T>, options?: AddEventListenerOptions): Binding<T>;
|
|
1556
|
+
|
|
1505
1557
|
/**
|
|
1506
1558
|
* Common APIs related to markup generation.
|
|
1507
1559
|
* @public
|
|
@@ -1619,6 +1671,14 @@ export declare abstract class NodeObservationDirective<T extends NodeBehaviorOpt
|
|
|
1619
1671
|
protected abstract getNodes(target: any): Node[];
|
|
1620
1672
|
}
|
|
1621
1673
|
|
|
1674
|
+
/**
|
|
1675
|
+
* Normalizes the input value into a binding.
|
|
1676
|
+
* @param value - The value to create the default binding for.
|
|
1677
|
+
* @returns A binding configuration for the provided value.
|
|
1678
|
+
* @public
|
|
1679
|
+
*/
|
|
1680
|
+
export declare function normalizeBinding<TSource = any, TReturn = any, TParent = any>(value: Expression<TSource, TReturn, TParent> | Binding<TSource, TReturn, TParent> | {}): Binding<TSource, TReturn, TParent>;
|
|
1681
|
+
|
|
1622
1682
|
/**
|
|
1623
1683
|
* Provides change notifications for an observed subject.
|
|
1624
1684
|
* @public
|
|
@@ -1709,19 +1769,19 @@ export declare const Observable: Readonly<{
|
|
|
1709
1769
|
*/
|
|
1710
1770
|
getAccessors: (target: {}) => Accessor[];
|
|
1711
1771
|
/**
|
|
1712
|
-
* Creates a {@link
|
|
1713
|
-
* provided {@link
|
|
1772
|
+
* Creates a {@link ExpressionNotifier} that can watch the
|
|
1773
|
+
* provided {@link Expression} for changes.
|
|
1714
1774
|
* @param binding - The binding to observe.
|
|
1715
1775
|
* @param initialSubscriber - An initial subscriber to changes in the binding value.
|
|
1716
1776
|
* @param isVolatileBinding - Indicates whether the binding's dependency list must be re-evaluated on every value evaluation.
|
|
1717
1777
|
*/
|
|
1718
|
-
binding<TSource = any, TReturn = any>(binding:
|
|
1778
|
+
binding<TSource = any, TReturn = any>(binding: Expression<TSource, TReturn, any>, initialSubscriber?: Subscriber, isVolatileBinding?: boolean): ExpressionNotifier<TSource, TReturn, any>;
|
|
1719
1779
|
/**
|
|
1720
1780
|
* Determines whether a binding expression is volatile and needs to have its dependency list re-evaluated
|
|
1721
1781
|
* on every evaluation of the value.
|
|
1722
1782
|
* @param binding - The binding to inspect.
|
|
1723
1783
|
*/
|
|
1724
|
-
isVolatileBinding<TSource_1 = any, TReturn_1 = any>(binding:
|
|
1784
|
+
isVolatileBinding<TSource_1 = any, TReturn_1 = any>(binding: Expression<TSource_1, TReturn_1, any>): boolean;
|
|
1725
1785
|
}>;
|
|
1726
1786
|
|
|
1727
1787
|
/**
|
|
@@ -1748,30 +1808,12 @@ export declare interface ObservationRecord {
|
|
|
1748
1808
|
}
|
|
1749
1809
|
|
|
1750
1810
|
/**
|
|
1751
|
-
*
|
|
1811
|
+
* Creates a one time binding
|
|
1812
|
+
* @param binding - The binding to refresh when signaled.
|
|
1813
|
+
* @returns A binding configuration.
|
|
1752
1814
|
* @public
|
|
1753
1815
|
*/
|
|
1754
|
-
export declare
|
|
1755
|
-
|
|
1756
|
-
/**
|
|
1757
|
-
* The default onTime binding configuration.
|
|
1758
|
-
* @public
|
|
1759
|
-
*/
|
|
1760
|
-
export declare const oneTime: BindingConfig<AddEventListenerOptions> & BindingConfigResolver<AddEventListenerOptions>;
|
|
1761
|
-
|
|
1762
|
-
/**
|
|
1763
|
-
* A binding behavior for one-time bindings.
|
|
1764
|
-
* @public
|
|
1765
|
-
*/
|
|
1766
|
-
export declare class OneTimeBinding extends UpdateBinding {
|
|
1767
|
-
/**
|
|
1768
|
-
* Bind this behavior to the source.
|
|
1769
|
-
* @param source - The source to bind to.
|
|
1770
|
-
* @param context - The execution context that the binding is operating within.
|
|
1771
|
-
* @param targets - The targets that behaviors in a view can attach to.
|
|
1772
|
-
*/
|
|
1773
|
-
bind(source: any, context: ExecutionContext, targets: ViewBehaviorTargets): void;
|
|
1774
|
-
}
|
|
1816
|
+
export declare function oneTime<T = any>(binding: Expression<T>): Binding<T>;
|
|
1775
1817
|
|
|
1776
1818
|
/**
|
|
1777
1819
|
* Common APIs related to content parsing.
|
|
@@ -1898,23 +1940,21 @@ declare const reflectMode = "reflect";
|
|
|
1898
1940
|
|
|
1899
1941
|
/**
|
|
1900
1942
|
* A directive that enables list rendering.
|
|
1901
|
-
* @param
|
|
1902
|
-
* @param
|
|
1943
|
+
* @param items - The array to render.
|
|
1944
|
+
* @param template - The template or a template binding used obtain a template
|
|
1903
1945
|
* to render for each item in the array.
|
|
1904
1946
|
* @param options - Options used to turn on special repeat features.
|
|
1905
1947
|
* @public
|
|
1906
1948
|
*/
|
|
1907
|
-
export declare function repeat<TSource = any, TArray extends ReadonlyArray<any> = ReadonlyArray<any>>(
|
|
1949
|
+
export declare function repeat<TSource = any, TArray extends ReadonlyArray<any> = ReadonlyArray<any>>(items: Expression<TSource, TArray, ExecutionContext<TSource>> | Binding<TSource, TArray> | ReadonlyArray<any>, template: Expression<TSource, ViewTemplate> | Binding<TSource, ViewTemplate> | ViewTemplate, options?: RepeatOptions): CaptureType<TSource>;
|
|
1908
1950
|
|
|
1909
1951
|
/**
|
|
1910
1952
|
* A behavior that renders a template for each item in an array.
|
|
1911
1953
|
* @public
|
|
1912
1954
|
*/
|
|
1913
1955
|
export declare class RepeatBehavior<TSource = any> implements Behavior, Subscriber {
|
|
1956
|
+
private directive;
|
|
1914
1957
|
private location;
|
|
1915
|
-
private itemsBinding;
|
|
1916
|
-
private templateBinding;
|
|
1917
|
-
private options;
|
|
1918
1958
|
private source;
|
|
1919
1959
|
private views;
|
|
1920
1960
|
private template;
|
|
@@ -1928,13 +1968,13 @@ export declare class RepeatBehavior<TSource = any> implements Behavior, Subscrib
|
|
|
1928
1968
|
/**
|
|
1929
1969
|
* Creates an instance of RepeatBehavior.
|
|
1930
1970
|
* @param location - The location in the DOM to render the repeat.
|
|
1931
|
-
* @param
|
|
1971
|
+
* @param dataBinding - The array to render.
|
|
1932
1972
|
* @param isItemsBindingVolatile - Indicates whether the items binding has volatile dependencies.
|
|
1933
1973
|
* @param templateBinding - The template to render for each item.
|
|
1934
1974
|
* @param isTemplateBindingVolatile - Indicates whether the template binding has volatile dependencies.
|
|
1935
1975
|
* @param options - Options used to turn on special repeat features.
|
|
1936
1976
|
*/
|
|
1937
|
-
constructor(
|
|
1977
|
+
constructor(directive: RepeatDirective, location: Node);
|
|
1938
1978
|
/**
|
|
1939
1979
|
* Bind this behavior to the source.
|
|
1940
1980
|
* @param source - The source to bind to.
|
|
@@ -1951,7 +1991,7 @@ export declare class RepeatBehavior<TSource = any> implements Behavior, Subscrib
|
|
|
1951
1991
|
* @param source - The source of the change.
|
|
1952
1992
|
* @param args - The details about what was changed.
|
|
1953
1993
|
*/
|
|
1954
|
-
handleChange(source: any, args: Splice[]): void;
|
|
1994
|
+
handleChange(source: any, args: Splice[] | ExpressionObserver): void;
|
|
1955
1995
|
private observeItems;
|
|
1956
1996
|
private updateViews;
|
|
1957
1997
|
private refreshAllViews;
|
|
@@ -1963,11 +2003,9 @@ export declare class RepeatBehavior<TSource = any> implements Behavior, Subscrib
|
|
|
1963
2003
|
* @public
|
|
1964
2004
|
*/
|
|
1965
2005
|
export declare class RepeatDirective<TSource = any> implements HTMLDirective, ViewBehaviorFactory {
|
|
1966
|
-
readonly
|
|
2006
|
+
readonly dataBinding: Binding<TSource>;
|
|
1967
2007
|
readonly templateBinding: Binding<TSource, SyntheticViewTemplate>;
|
|
1968
2008
|
readonly options: RepeatOptions;
|
|
1969
|
-
private isItemsBindingVolatile;
|
|
1970
|
-
private isTemplateBindingVolatile;
|
|
1971
2009
|
/**
|
|
1972
2010
|
* The unique id of the factory.
|
|
1973
2011
|
*/
|
|
@@ -1983,11 +2021,11 @@ export declare class RepeatDirective<TSource = any> implements HTMLDirective, Vi
|
|
|
1983
2021
|
createHTML(add: AddViewBehaviorFactory): string;
|
|
1984
2022
|
/**
|
|
1985
2023
|
* Creates an instance of RepeatDirective.
|
|
1986
|
-
* @param
|
|
2024
|
+
* @param dataBinding - The binding that provides the array to render.
|
|
1987
2025
|
* @param templateBinding - The template binding used to obtain a template to render for each item in the array.
|
|
1988
2026
|
* @param options - Options used to turn on special repeat features.
|
|
1989
2027
|
*/
|
|
1990
|
-
constructor(
|
|
2028
|
+
constructor(dataBinding: Binding<TSource>, templateBinding: Binding<TSource, SyntheticViewTemplate>, options: RepeatOptions);
|
|
1991
2029
|
/**
|
|
1992
2030
|
* Creates a behavior for the provided target node.
|
|
1993
2031
|
* @param target - The node instance to create the behavior for.
|
|
@@ -2406,7 +2444,7 @@ export declare interface SyntheticViewTemplate<TSource = any, TParent = any> {
|
|
|
2406
2444
|
* Represents the types of values that can be interpolated into a template.
|
|
2407
2445
|
* @public
|
|
2408
2446
|
*/
|
|
2409
|
-
export declare type TemplateValue<TSource, TParent = any> = Binding<TSource, any, TParent> | HTMLDirective | CaptureType<TSource>;
|
|
2447
|
+
export declare type TemplateValue<TSource, TParent = any> = Expression<TSource, any, TParent> | Binding<TSource, any, TParent> | HTMLDirective | CaptureType<TSource>;
|
|
2410
2448
|
|
|
2411
2449
|
/**
|
|
2412
2450
|
* Enables working with trusted types.
|
|
@@ -2451,40 +2489,6 @@ export declare interface TypeRegistry<TDefinition extends TypeDefinition> {
|
|
|
2451
2489
|
getForInstance(object: any): TDefinition | undefined;
|
|
2452
2490
|
}
|
|
2453
2491
|
|
|
2454
|
-
/**
|
|
2455
|
-
* A base binding behavior for DOM updates.
|
|
2456
|
-
* @public
|
|
2457
|
-
*/
|
|
2458
|
-
export declare class UpdateBinding implements ViewBehavior {
|
|
2459
|
-
readonly directive: HTMLBindingDirective;
|
|
2460
|
-
protected updateTarget: UpdateTarget;
|
|
2461
|
-
/**
|
|
2462
|
-
* Creates an instance of UpdateBinding.
|
|
2463
|
-
* @param directive - The directive that has the configuration for this behavior.
|
|
2464
|
-
* @param updateTarget - The function used to update the target with the latest value.
|
|
2465
|
-
*/
|
|
2466
|
-
constructor(directive: HTMLBindingDirective, updateTarget: UpdateTarget);
|
|
2467
|
-
/**
|
|
2468
|
-
* Bind this behavior to the source.
|
|
2469
|
-
* @param source - The source to bind to.
|
|
2470
|
-
* @param context - The execution context that the binding is operating within.
|
|
2471
|
-
* @param targets - The targets that behaviors in a view can attach to.
|
|
2472
|
-
*/
|
|
2473
|
-
bind(source: any, context: ExecutionContext, targets: ViewBehaviorTargets): void;
|
|
2474
|
-
/**
|
|
2475
|
-
* Unbinds this behavior from the source.
|
|
2476
|
-
* @param source - The source to unbind from.
|
|
2477
|
-
* @param context - The execution context that the binding is operating within.
|
|
2478
|
-
* @param targets - The targets that behaviors in a view can attach to.
|
|
2479
|
-
*/
|
|
2480
|
-
unbind(source: any, context: ExecutionContext, targets: ViewBehaviorTargets): void;
|
|
2481
|
-
/**
|
|
2482
|
-
* Creates a behavior.
|
|
2483
|
-
* @param targets - The targets available for behaviors to be attached to.
|
|
2484
|
-
*/
|
|
2485
|
-
createBehavior(targets: ViewBehaviorTargets): ViewBehavior;
|
|
2486
|
-
}
|
|
2487
|
-
|
|
2488
2492
|
/**
|
|
2489
2493
|
* A work queue used to synchronize writes to the DOM.
|
|
2490
2494
|
* @public
|
|
@@ -2689,11 +2693,11 @@ export declare function volatile(target: {}, name: string | Accessor, descriptor
|
|
|
2689
2693
|
|
|
2690
2694
|
/**
|
|
2691
2695
|
* A directive that enables basic conditional rendering in a template.
|
|
2692
|
-
* @param
|
|
2696
|
+
* @param condition - The condition to test for rendering.
|
|
2693
2697
|
* @param templateOrTemplateBinding - The template or a binding that gets
|
|
2694
2698
|
* the template to render when the condition is true.
|
|
2695
2699
|
* @public
|
|
2696
2700
|
*/
|
|
2697
|
-
export declare function when<TSource = any, TReturn = any>(
|
|
2701
|
+
export declare function when<TSource = any, TReturn = any>(condition: Expression<TSource, TReturn> | boolean, templateOrTemplateBinding: SyntheticViewTemplate | Expression<TSource, SyntheticViewTemplate>): CaptureType<TSource>;
|
|
2698
2702
|
|
|
2699
2703
|
export { }
|