@microsoft/fast-element 2.0.0-beta.1 → 2.0.0-beta.2
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 +51 -0
- package/CHANGELOG.md +15 -1
- package/dist/dts/components/fast-definitions.d.ts +2 -0
- package/dist/dts/components/fast-element.d.ts +7 -1
- package/dist/dts/context.d.ts +157 -0
- package/dist/dts/metadata.d.ts +25 -0
- package/dist/dts/observation/arrays.d.ts +1 -1
- package/dist/dts/observation/behavior.d.ts +4 -4
- package/dist/dts/observation/observable.d.ts +43 -62
- package/dist/dts/templating/binding-signal.d.ts +38 -0
- package/dist/dts/templating/binding-two-way.d.ts +56 -0
- package/dist/dts/templating/binding.d.ts +0 -88
- package/dist/dts/templating/compiler.d.ts +1 -2
- package/dist/dts/templating/repeat.d.ts +3 -49
- package/dist/dts/templating/template.d.ts +10 -59
- package/dist/dts/templating/view.d.ts +9 -9
- package/dist/{tsdoc-metadata.json → dts/tsdoc-metadata.json} +0 -0
- package/dist/esm/components/fast-definitions.js +2 -0
- package/dist/esm/components/fast-element.js +10 -2
- package/dist/esm/context.js +159 -0
- package/dist/esm/metadata.js +60 -0
- package/dist/esm/observation/arrays.js +1 -1
- package/dist/esm/observation/observable.js +69 -17
- package/dist/esm/templating/binding-signal.js +84 -0
- package/dist/esm/templating/binding-two-way.js +76 -0
- package/dist/esm/templating/binding.js +1 -158
- package/dist/esm/templating/repeat.js +9 -1
- package/dist/esm/templating/template.js +1 -21
- package/dist/fast-element.api.json +5586 -7541
- package/dist/fast-element.d.ts +119 -329
- package/dist/fast-element.debug.js +92 -199
- package/dist/fast-element.debug.min.js +1 -1
- package/dist/fast-element.js +92 -199
- package/dist/fast-element.min.js +1 -1
- package/dist/fast-element.untrimmed.d.ts +120 -331
- package/docs/api-report.md +50 -156
- package/package.json +20 -4
|
@@ -269,18 +269,18 @@ export declare type AttributeMode = typeof reflectMode | typeof booleanMode | "f
|
|
|
269
269
|
* element's bind/unbind operations.
|
|
270
270
|
* @public
|
|
271
271
|
*/
|
|
272
|
-
export declare interface Behavior<TSource = any, TParent = any
|
|
272
|
+
export declare interface Behavior<TSource = any, TParent = any> {
|
|
273
273
|
/**
|
|
274
274
|
* Bind this behavior to the source.
|
|
275
275
|
* @param source - The source to bind to.
|
|
276
276
|
* @param context - The execution context that the binding is operating within.
|
|
277
277
|
*/
|
|
278
|
-
bind(source: TSource, context:
|
|
278
|
+
bind(source: TSource, context: ExecutionContext<TParent>): void;
|
|
279
279
|
/**
|
|
280
280
|
* Unbinds this behavior from the source.
|
|
281
281
|
* @param source - The source to unbind from.
|
|
282
282
|
*/
|
|
283
|
-
unbind(source: TSource, context:
|
|
283
|
+
unbind(source: TSource, context: ExecutionContext<TParent>): void;
|
|
284
284
|
}
|
|
285
285
|
|
|
286
286
|
/**
|
|
@@ -297,7 +297,7 @@ export declare function bind<T = any>(binding: Binding<T>, config?: BindingConfi
|
|
|
297
297
|
* as part of a template binding update.
|
|
298
298
|
* @public
|
|
299
299
|
*/
|
|
300
|
-
export declare type Binding<TSource = any, TReturn = any,
|
|
300
|
+
export declare type Binding<TSource = any, TReturn = any, TParent = any> = (source: TSource, context: ExecutionContext<TParent>) => TReturn;
|
|
301
301
|
|
|
302
302
|
/**
|
|
303
303
|
* Describes the configuration for a binding expression.
|
|
@@ -445,39 +445,6 @@ export declare class ChangeBinding extends UpdateBinding {
|
|
|
445
445
|
handleChange(binding: Binding, observer: BindingObserver): void;
|
|
446
446
|
}
|
|
447
447
|
|
|
448
|
-
/**
|
|
449
|
-
* Transforms a template literal string into a ChildViewTemplate.
|
|
450
|
-
* @param strings - The string fragments that are interpolated with the values.
|
|
451
|
-
* @param values - The values that are interpolated with the string fragments.
|
|
452
|
-
* @remarks
|
|
453
|
-
* The html helper supports interpolation of strings, numbers, binding expressions,
|
|
454
|
-
* other template instances, and Directive instances.
|
|
455
|
-
* @public
|
|
456
|
-
*/
|
|
457
|
-
export declare const child: <TChild = any, TParent = any>(strings: TemplateStringsArray, ...values: TemplateValue<TChild, TParent, ChildContext<TParent>>[]) => ChildViewTemplate<TChild, TParent>;
|
|
458
|
-
|
|
459
|
-
/**
|
|
460
|
-
* Provides additional contextual information when inside a child template.
|
|
461
|
-
* @public
|
|
462
|
-
*/
|
|
463
|
-
export declare interface ChildContext<TParentSource = any> extends RootContext {
|
|
464
|
-
/**
|
|
465
|
-
* The parent data source within a nested context.
|
|
466
|
-
*/
|
|
467
|
-
readonly parent: TParentSource;
|
|
468
|
-
/**
|
|
469
|
-
* The parent execution context when in nested context scenarios.
|
|
470
|
-
*/
|
|
471
|
-
readonly parentContext: ChildContext<TParentSource>;
|
|
472
|
-
/**
|
|
473
|
-
* Creates a new execution context descent suitable for use in list rendering.
|
|
474
|
-
* @param item - The list item to serve as the source.
|
|
475
|
-
* @param index - The index of the item in the list.
|
|
476
|
-
* @param length - The length of the list.
|
|
477
|
-
*/
|
|
478
|
-
createItemContext(index: number, length: number): ItemContext<TParentSource>;
|
|
479
|
-
}
|
|
480
|
-
|
|
481
448
|
/**
|
|
482
449
|
* The options used to configure child list observation.
|
|
483
450
|
* @public
|
|
@@ -528,18 +495,6 @@ export declare class ChildrenDirective extends NodeObservationDirective<Children
|
|
|
528
495
|
*/
|
|
529
496
|
export declare type ChildrenDirectiveOptions<T = any> = ChildListDirectiveOptions<T> | SubtreeDirectiveOptions<T>;
|
|
530
497
|
|
|
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
498
|
/**
|
|
544
499
|
* A function capable of compiling a template from the preprocessed form produced
|
|
545
500
|
* by the html template function into a result that can instantiate views.
|
|
@@ -579,7 +534,7 @@ export declare const Compiler: {
|
|
|
579
534
|
* it is recommended that you clone the original and pass the clone to this API.
|
|
580
535
|
* @public
|
|
581
536
|
*/
|
|
582
|
-
compile<TSource = any, TParent = any
|
|
537
|
+
compile<TSource = any, TParent = any>(html: string | HTMLTemplateElement, directives: Record<string, ViewBehaviorFactory>): HTMLTemplateCompilationResult<TSource, TParent>;
|
|
583
538
|
/**
|
|
584
539
|
* Sets the default compilation strategy that will be used by the ViewTemplate whenever
|
|
585
540
|
* it needs to compile a view preprocessed with the html template function.
|
|
@@ -858,15 +813,6 @@ export declare type DecoratorAttributeConfiguration = Omit<AttributeConfiguratio
|
|
|
858
813
|
*/
|
|
859
814
|
export declare type DefaultBindingOptions = AddEventListenerOptions;
|
|
860
815
|
|
|
861
|
-
/**
|
|
862
|
-
* The default twoWay binding options.
|
|
863
|
-
* @public
|
|
864
|
-
*/
|
|
865
|
-
export declare type DefaultTwoWayBindingOptions = DefaultBindingOptions & {
|
|
866
|
-
changeEvent?: string;
|
|
867
|
-
fromView?: (value: any) => any;
|
|
868
|
-
};
|
|
869
|
-
|
|
870
816
|
/**
|
|
871
817
|
* Provides a mechanism for releasing resources.
|
|
872
818
|
* @public
|
|
@@ -985,7 +931,7 @@ export declare class ElementStyles {
|
|
|
985
931
|
* A View representing DOM nodes specifically for rendering the view of a custom element.
|
|
986
932
|
* @public
|
|
987
933
|
*/
|
|
988
|
-
export declare interface ElementView<TSource = any, TParent = any> extends View<TSource, TParent
|
|
934
|
+
export declare interface ElementView<TSource = any, TParent = any> extends View<TSource, TParent> {
|
|
989
935
|
/**
|
|
990
936
|
* Appends the view's DOM nodes to the referenced node.
|
|
991
937
|
* @param node - The parent node to append the view's DOM nodes to.
|
|
@@ -998,7 +944,6 @@ export declare interface ElementView<TSource = any, TParent = any> extends View<
|
|
|
998
944
|
* @public
|
|
999
945
|
*/
|
|
1000
946
|
export declare interface ElementViewTemplate<TSource = any, TParent = any> {
|
|
1001
|
-
type: "element";
|
|
1002
947
|
/**
|
|
1003
948
|
* Creates an ElementView instance based on this template definition.
|
|
1004
949
|
* @param hostBindingTarget - The element that host behaviors will be bound to.
|
|
@@ -1062,29 +1007,99 @@ export declare class EventBinding {
|
|
|
1062
1007
|
}
|
|
1063
1008
|
|
|
1064
1009
|
/**
|
|
1065
|
-
*
|
|
1010
|
+
* Provides additional contextual information available to behaviors and expressions.
|
|
1066
1011
|
* @public
|
|
1067
1012
|
*/
|
|
1068
|
-
export declare
|
|
1069
|
-
|
|
1013
|
+
export declare class ExecutionContext<TParentSource = any> {
|
|
1014
|
+
/**
|
|
1015
|
+
* The default execution context.
|
|
1016
|
+
*/
|
|
1017
|
+
static readonly default: ExecutionContext<any>;
|
|
1018
|
+
/**
|
|
1019
|
+
* The index of the current item within a repeat context.
|
|
1020
|
+
*/
|
|
1021
|
+
index: number;
|
|
1022
|
+
/**
|
|
1023
|
+
* The length of the current collection within a repeat context.
|
|
1024
|
+
*/
|
|
1025
|
+
length: number;
|
|
1026
|
+
/**
|
|
1027
|
+
* The parent data source within a nested context.
|
|
1028
|
+
*/
|
|
1029
|
+
readonly parent: TParentSource;
|
|
1030
|
+
/**
|
|
1031
|
+
* The parent execution context when in nested context scenarios.
|
|
1032
|
+
*/
|
|
1033
|
+
readonly parentContext: ExecutionContext<TParentSource>;
|
|
1034
|
+
private constructor();
|
|
1035
|
+
/**
|
|
1036
|
+
* The current event within an event handler.
|
|
1037
|
+
*/
|
|
1038
|
+
get event(): Event;
|
|
1039
|
+
/**
|
|
1040
|
+
* Indicates whether the current item within a repeat context
|
|
1041
|
+
* has an even index.
|
|
1042
|
+
*/
|
|
1043
|
+
get isEven(): boolean;
|
|
1044
|
+
/**
|
|
1045
|
+
* Indicates whether the current item within a repeat context
|
|
1046
|
+
* has an odd index.
|
|
1047
|
+
*/
|
|
1048
|
+
get isOdd(): boolean;
|
|
1049
|
+
/**
|
|
1050
|
+
* Indicates whether the current item within a repeat context
|
|
1051
|
+
* is the first item in the collection.
|
|
1052
|
+
*/
|
|
1053
|
+
get isFirst(): boolean;
|
|
1054
|
+
/**
|
|
1055
|
+
* Indicates whether the current item within a repeat context
|
|
1056
|
+
* is somewhere in the middle of the collection.
|
|
1057
|
+
*/
|
|
1058
|
+
get isInMiddle(): boolean;
|
|
1059
|
+
/**
|
|
1060
|
+
* Indicates whether the current item within a repeat context
|
|
1061
|
+
* is the last item in the collection.
|
|
1062
|
+
*/
|
|
1063
|
+
get isLast(): boolean;
|
|
1064
|
+
/**
|
|
1065
|
+
* Returns the typed event detail of a custom event.
|
|
1066
|
+
*/
|
|
1067
|
+
eventDetail<TDetail>(): TDetail;
|
|
1068
|
+
/**
|
|
1069
|
+
* Returns the typed event target of the event.
|
|
1070
|
+
*/
|
|
1071
|
+
eventTarget<TTarget extends EventTarget>(): TTarget;
|
|
1072
|
+
/**
|
|
1073
|
+
* Updates the position/size on a context associated with a list item.
|
|
1074
|
+
* @param index - The new index of the item.
|
|
1075
|
+
* @param length - The new length of the list.
|
|
1076
|
+
*/
|
|
1077
|
+
updatePosition(index: number, length: number): void;
|
|
1078
|
+
/**
|
|
1079
|
+
* Creates a new execution context descendent from the current context.
|
|
1080
|
+
* @param source - The source for the context if different than the parent.
|
|
1081
|
+
* @returns A child execution context.
|
|
1082
|
+
*/
|
|
1083
|
+
createChildContext<TParentSource>(parentSource: TParentSource): ExecutionContext<TParentSource>;
|
|
1084
|
+
/**
|
|
1085
|
+
* Creates a new execution context descent suitable for use in list rendering.
|
|
1086
|
+
* @param item - The list item to serve as the source.
|
|
1087
|
+
* @param index - The index of the item in the list.
|
|
1088
|
+
* @param length - The length of the list.
|
|
1089
|
+
*/
|
|
1090
|
+
createItemContext(index: number, length: number): ExecutionContext<TParentSource>;
|
|
1070
1091
|
/**
|
|
1071
1092
|
* Sets the event for the current execution context.
|
|
1072
1093
|
* @param event - The event to set.
|
|
1073
1094
|
* @internal
|
|
1074
1095
|
*/
|
|
1075
|
-
setEvent(event: Event | null): void;
|
|
1096
|
+
static setEvent(event: Event | null): void;
|
|
1076
1097
|
/**
|
|
1077
1098
|
* Creates a new root execution context.
|
|
1078
1099
|
* @returns A new execution context.
|
|
1079
1100
|
*/
|
|
1080
|
-
create():
|
|
1081
|
-
}
|
|
1082
|
-
|
|
1083
|
-
/**
|
|
1084
|
-
* Represents some sort of execution context.
|
|
1085
|
-
* @public
|
|
1086
|
-
*/
|
|
1087
|
-
export declare type ExecutionContext<TParentSource = any> = RootContext | ChildContext<TParentSource> | ItemContext<TParentSource>;
|
|
1101
|
+
static create(): ExecutionContext;
|
|
1102
|
+
}
|
|
1088
1103
|
|
|
1089
1104
|
/**
|
|
1090
1105
|
* The FAST global.
|
|
@@ -1159,6 +1174,12 @@ export declare const FASTElement: (new () => HTMLElement & FASTElement) & {
|
|
|
1159
1174
|
* that describes the element to define.
|
|
1160
1175
|
*/
|
|
1161
1176
|
define<TType extends Constructable<HTMLElement>>(type: TType, nameOrDef?: string | PartialFASTElementDefinition): TType;
|
|
1177
|
+
/**
|
|
1178
|
+
* Defines metadata for a FASTElement which can be used to later define the element.
|
|
1179
|
+
* IMPORTANT: This API will be renamed to "compose" in a future beta.
|
|
1180
|
+
* @public
|
|
1181
|
+
*/
|
|
1182
|
+
metadata<TType_1 extends Constructable<HTMLElement> = Constructable<HTMLElement>>(type: TType_1, nameOrDef?: string | PartialFASTElementDefinition): FASTElementDefinition<TType_1>;
|
|
1162
1183
|
};
|
|
1163
1184
|
|
|
1164
1185
|
/**
|
|
@@ -1217,6 +1238,8 @@ export declare class FASTElementDefinition<TType extends Constructable<HTMLEleme
|
|
|
1217
1238
|
/**
|
|
1218
1239
|
* Defines a custom element based on this definition.
|
|
1219
1240
|
* @param registry - The element registry to define the element in.
|
|
1241
|
+
* @remarks
|
|
1242
|
+
* This operation is idempotent per registry.
|
|
1220
1243
|
*/
|
|
1221
1244
|
define(registry?: CustomElementRegistry): this;
|
|
1222
1245
|
/**
|
|
@@ -1275,7 +1298,7 @@ export declare interface FASTGlobal {
|
|
|
1275
1298
|
* other template instances, and Directive instances.
|
|
1276
1299
|
* @public
|
|
1277
1300
|
*/
|
|
1278
|
-
export declare function html<TSource = any, TParent = any
|
|
1301
|
+
export declare function html<TSource = any, TParent = any>(strings: TemplateStringsArray, ...values: TemplateValue<TSource, TParent>[]): ViewTemplate<TSource, TParent>;
|
|
1279
1302
|
|
|
1280
1303
|
/**
|
|
1281
1304
|
* A directive that applies bindings.
|
|
@@ -1382,19 +1405,19 @@ export declare interface HTMLDirectiveDefinition<TType extends Constructable<HTM
|
|
|
1382
1405
|
* The result of a template compilation operation.
|
|
1383
1406
|
* @public
|
|
1384
1407
|
*/
|
|
1385
|
-
export declare interface HTMLTemplateCompilationResult<TSource = any, TParent = any
|
|
1408
|
+
export declare interface HTMLTemplateCompilationResult<TSource = any, TParent = any> {
|
|
1386
1409
|
/**
|
|
1387
1410
|
* Creates a view instance.
|
|
1388
1411
|
* @param hostBindingTarget - The host binding target for the view.
|
|
1389
1412
|
*/
|
|
1390
|
-
createView(hostBindingTarget?: Element): HTMLView<TSource, TParent
|
|
1413
|
+
createView(hostBindingTarget?: Element): HTMLView<TSource, TParent>;
|
|
1391
1414
|
}
|
|
1392
1415
|
|
|
1393
1416
|
/**
|
|
1394
1417
|
* The standard View implementation, which also implements ElementView and SyntheticView.
|
|
1395
1418
|
* @public
|
|
1396
1419
|
*/
|
|
1397
|
-
export declare class HTMLView<TSource = any, TParent = any
|
|
1420
|
+
export declare class HTMLView<TSource = any, TParent = any> implements ElementView<TSource, TParent>, SyntheticView<TSource, TParent> {
|
|
1398
1421
|
private fragment;
|
|
1399
1422
|
private factories;
|
|
1400
1423
|
private targets;
|
|
@@ -1406,7 +1429,7 @@ export declare class HTMLView<TSource = any, TParent = any, TContext extends Exe
|
|
|
1406
1429
|
/**
|
|
1407
1430
|
* The execution context the view is running within.
|
|
1408
1431
|
*/
|
|
1409
|
-
context:
|
|
1432
|
+
context: ExecutionContext<TParent> | null;
|
|
1410
1433
|
/**
|
|
1411
1434
|
* The first DOM node in the range of nodes that make up the view.
|
|
1412
1435
|
*/
|
|
@@ -1446,7 +1469,7 @@ export declare class HTMLView<TSource = any, TParent = any, TContext extends Exe
|
|
|
1446
1469
|
* @param source - The binding source for the view's binding behaviors.
|
|
1447
1470
|
* @param context - The execution context to run the behaviors within.
|
|
1448
1471
|
*/
|
|
1449
|
-
bind(source: TSource, context:
|
|
1472
|
+
bind(source: TSource, context: ExecutionContext<TParent>): void;
|
|
1450
1473
|
/**
|
|
1451
1474
|
* Unbinds a view's behaviors from its binding source.
|
|
1452
1475
|
*/
|
|
@@ -1459,72 +1482,14 @@ export declare class HTMLView<TSource = any, TParent = any, TContext extends Exe
|
|
|
1459
1482
|
}
|
|
1460
1483
|
|
|
1461
1484
|
/**
|
|
1462
|
-
*
|
|
1463
|
-
* @param strings - The string fragments that are interpolated with the values.
|
|
1464
|
-
* @param values - The values that are interpolated with the string fragments.
|
|
1465
|
-
* @remarks
|
|
1466
|
-
* The html helper supports interpolation of strings, numbers, binding expressions,
|
|
1467
|
-
* other template instances, and Directive instances.
|
|
1468
|
-
* @public
|
|
1469
|
-
*/
|
|
1470
|
-
export declare const item: <TItem = any, TParent = any>(strings: TemplateStringsArray, ...values: TemplateValue<TItem, TParent, ItemContext<TParent>>[]) => ItemViewTemplate<TItem, TParent>;
|
|
1471
|
-
|
|
1472
|
-
/**
|
|
1473
|
-
* Provides additional contextual information when inside a repeat item template.s
|
|
1474
|
-
* @public
|
|
1475
|
-
*/
|
|
1476
|
-
export declare interface ItemContext<TParentSource = any> extends ChildContext<TParentSource> {
|
|
1477
|
-
/**
|
|
1478
|
-
* The index of the current item within a repeat context.
|
|
1479
|
-
*/
|
|
1480
|
-
readonly index: number;
|
|
1481
|
-
/**
|
|
1482
|
-
* The length of the current collection within a repeat context.
|
|
1483
|
-
*/
|
|
1484
|
-
readonly length: number;
|
|
1485
|
-
/**
|
|
1486
|
-
* Indicates whether the current item within a repeat context
|
|
1487
|
-
* has an even index.
|
|
1488
|
-
*/
|
|
1489
|
-
readonly isEven: boolean;
|
|
1490
|
-
/**
|
|
1491
|
-
* Indicates whether the current item within a repeat context
|
|
1492
|
-
* has an odd index.
|
|
1493
|
-
*/
|
|
1494
|
-
readonly isOdd: boolean;
|
|
1495
|
-
/**
|
|
1496
|
-
* Indicates whether the current item within a repeat context
|
|
1497
|
-
* is the first item in the collection.
|
|
1498
|
-
*/
|
|
1499
|
-
readonly isFirst: boolean;
|
|
1500
|
-
/**
|
|
1501
|
-
* Indicates whether the current item within a repeat context
|
|
1502
|
-
* is somewhere in the middle of the collection.
|
|
1503
|
-
*/
|
|
1504
|
-
readonly isInMiddle: boolean;
|
|
1505
|
-
/**
|
|
1506
|
-
* Indicates whether the current item within a repeat context
|
|
1507
|
-
* is the last item in the collection.
|
|
1508
|
-
*/
|
|
1509
|
-
readonly isLast: boolean;
|
|
1510
|
-
/**
|
|
1511
|
-
* Updates the position/size on a context associated with a list item.
|
|
1512
|
-
* @param index - The new index of the item.
|
|
1513
|
-
* @param length - The new length of the list.
|
|
1514
|
-
*/
|
|
1515
|
-
updatePosition(index: number, length: number): void;
|
|
1516
|
-
}
|
|
1517
|
-
|
|
1518
|
-
/**
|
|
1519
|
-
* A template capable of rendering item views not specifically connected to custom elements.
|
|
1485
|
+
* Observes array lengths.
|
|
1520
1486
|
* @public
|
|
1521
1487
|
*/
|
|
1522
|
-
export declare interface
|
|
1523
|
-
type: "item";
|
|
1488
|
+
export declare interface LengthObserver extends Subscriber {
|
|
1524
1489
|
/**
|
|
1525
|
-
*
|
|
1490
|
+
* The length of the observed array.
|
|
1526
1491
|
*/
|
|
1527
|
-
|
|
1492
|
+
length: number;
|
|
1528
1493
|
}
|
|
1529
1494
|
|
|
1530
1495
|
/**
|
|
@@ -1533,19 +1498,7 @@ export declare interface ItemViewTemplate<TSource = any, TParent = any> {
|
|
|
1533
1498
|
* @returns The length of the array.
|
|
1534
1499
|
* @public
|
|
1535
1500
|
*/
|
|
1536
|
-
declare function
|
|
1537
|
-
export { length_2 as length }
|
|
1538
|
-
|
|
1539
|
-
/**
|
|
1540
|
-
* Observes array lengths.
|
|
1541
|
-
* @public
|
|
1542
|
-
*/
|
|
1543
|
-
export declare interface LengthObserver extends Subscriber {
|
|
1544
|
-
/**
|
|
1545
|
-
* The length of the observed array.
|
|
1546
|
-
*/
|
|
1547
|
-
length: number;
|
|
1548
|
-
}
|
|
1501
|
+
export declare function lengthOf<T>(array: readonly T[]): number;
|
|
1549
1502
|
|
|
1550
1503
|
/**
|
|
1551
1504
|
* Common APIs related to markup generation.
|
|
@@ -1760,13 +1713,13 @@ export declare const Observable: Readonly<{
|
|
|
1760
1713
|
* @param initialSubscriber - An initial subscriber to changes in the binding value.
|
|
1761
1714
|
* @param isVolatileBinding - Indicates whether the binding's dependency list must be re-evaluated on every value evaluation.
|
|
1762
1715
|
*/
|
|
1763
|
-
binding<TSource = any, TReturn = any>(binding: Binding<TSource, TReturn,
|
|
1716
|
+
binding<TSource = any, TReturn = any>(binding: Binding<TSource, TReturn, any>, initialSubscriber?: Subscriber, isVolatileBinding?: boolean): BindingObserver<TSource, TReturn, any>;
|
|
1764
1717
|
/**
|
|
1765
1718
|
* Determines whether a binding expression is volatile and needs to have its dependency list re-evaluated
|
|
1766
1719
|
* on every evaluation of the value.
|
|
1767
1720
|
* @param binding - The binding to inspect.
|
|
1768
1721
|
*/
|
|
1769
|
-
isVolatileBinding<TSource_1 = any, TReturn_1 = any>(binding: Binding<TSource_1, TReturn_1,
|
|
1722
|
+
isVolatileBinding<TSource_1 = any, TReturn_1 = any>(binding: Binding<TSource_1, TReturn_1, any>): boolean;
|
|
1770
1723
|
}>;
|
|
1771
1724
|
|
|
1772
1725
|
/**
|
|
@@ -1949,55 +1902,7 @@ declare const reflectMode = "reflect";
|
|
|
1949
1902
|
* @param options - Options used to turn on special repeat features.
|
|
1950
1903
|
* @public
|
|
1951
1904
|
*/
|
|
1952
|
-
export declare function repeat<TSource = any, TArray extends ReadonlyArray<any> = ReadonlyArray<any>>(itemsBinding: Binding<TSource, TArray, ExecutionContext<TSource>>, templateOrTemplateBinding: ViewTemplate | Binding<TSource, ViewTemplate
|
|
1953
|
-
positioning: false;
|
|
1954
|
-
} | {
|
|
1955
|
-
recycle: true;
|
|
1956
|
-
} | {
|
|
1957
|
-
positioning: false;
|
|
1958
|
-
recycle: false;
|
|
1959
|
-
} | {
|
|
1960
|
-
positioning: false;
|
|
1961
|
-
recycle: true;
|
|
1962
|
-
}): CaptureType<TSource>;
|
|
1963
|
-
|
|
1964
|
-
/**
|
|
1965
|
-
* A directive that enables list rendering.
|
|
1966
|
-
* @param itemsBinding - The array to render.
|
|
1967
|
-
* @param templateOrTemplateBinding - The template or a template binding used obtain a template
|
|
1968
|
-
* to render for each item in the array.
|
|
1969
|
-
* @param options - Options used to turn on special repeat features.
|
|
1970
|
-
* @public
|
|
1971
|
-
*/
|
|
1972
|
-
export declare function repeat<TSource = any, TArray extends ReadonlyArray<any> = ReadonlyArray<any>>(itemsBinding: Binding<TSource, TArray, ExecutionContext<TSource>>, templateOrTemplateBinding: ChildViewTemplate | Binding<TSource, ChildViewTemplate, ChildContext>, options?: {
|
|
1973
|
-
positioning: false;
|
|
1974
|
-
} | {
|
|
1975
|
-
recycle: true;
|
|
1976
|
-
} | {
|
|
1977
|
-
positioning: false;
|
|
1978
|
-
recycle: false;
|
|
1979
|
-
} | {
|
|
1980
|
-
positioning: false;
|
|
1981
|
-
recycle: true;
|
|
1982
|
-
}): CaptureType<TSource>;
|
|
1983
|
-
|
|
1984
|
-
/**
|
|
1985
|
-
* A directive that enables list rendering.
|
|
1986
|
-
* @param itemsBinding - The array to render.
|
|
1987
|
-
* @param templateOrTemplateBinding - The template or a template binding used obtain a template
|
|
1988
|
-
* to render for each item in the array.
|
|
1989
|
-
* @param options - Options used to turn on special repeat features.
|
|
1990
|
-
* @public
|
|
1991
|
-
*/
|
|
1992
|
-
export declare function repeat<TSource = any, TArray extends ReadonlyArray<any> = ReadonlyArray<any>>(itemsBinding: Binding<TSource, TArray, ExecutionContext<TSource>>, templateOrTemplateBinding: ItemViewTemplate | Binding<TSource, ItemViewTemplate, ItemContext>, options: {
|
|
1993
|
-
positioning: true;
|
|
1994
|
-
} | {
|
|
1995
|
-
positioning: true;
|
|
1996
|
-
recycle: true;
|
|
1997
|
-
} | {
|
|
1998
|
-
positioning: true;
|
|
1999
|
-
recycle: false;
|
|
2000
|
-
}): CaptureType<TSource>;
|
|
1905
|
+
export declare function repeat<TSource = any, TArray extends ReadonlyArray<any> = ReadonlyArray<any>>(itemsBinding: Binding<TSource, TArray, ExecutionContext<TSource>>, templateOrTemplateBinding: ViewTemplate | Binding<TSource, ViewTemplate>, options?: RepeatOptions): CaptureType<TSource>;
|
|
2001
1906
|
|
|
2002
1907
|
/**
|
|
2003
1908
|
* A behavior that renders a template for each item in an array.
|
|
@@ -2103,68 +2008,6 @@ export declare interface RepeatOptions {
|
|
|
2103
2008
|
recycle?: boolean;
|
|
2104
2009
|
}
|
|
2105
2010
|
|
|
2106
|
-
/**
|
|
2107
|
-
* Provides additional contextual information available to behaviors and expressions.
|
|
2108
|
-
* @public
|
|
2109
|
-
*/
|
|
2110
|
-
export declare interface RootContext {
|
|
2111
|
-
/**
|
|
2112
|
-
* The current event within an event handler.
|
|
2113
|
-
*/
|
|
2114
|
-
readonly event: Event;
|
|
2115
|
-
/**
|
|
2116
|
-
* Returns the typed event detail of a custom event.
|
|
2117
|
-
*/
|
|
2118
|
-
eventDetail<TDetail = any>(): TDetail;
|
|
2119
|
-
/**
|
|
2120
|
-
* Returns the typed event target of the event.
|
|
2121
|
-
*/
|
|
2122
|
-
eventTarget<TTarget extends EventTarget = EventTarget>(): TTarget;
|
|
2123
|
-
/**
|
|
2124
|
-
* Creates a new execution context descendent from the current context.
|
|
2125
|
-
* @param source - The source for the context if different than the parent.
|
|
2126
|
-
* @returns A child execution context.
|
|
2127
|
-
*/
|
|
2128
|
-
createChildContext<TParentSource>(source: TParentSource): ChildContext<TParentSource>;
|
|
2129
|
-
}
|
|
2130
|
-
|
|
2131
|
-
/**
|
|
2132
|
-
* Creates a signal binding configuration with the supplied options.
|
|
2133
|
-
* @param options - The signal name or a binding to use to retrieve the signal name.
|
|
2134
|
-
* @returns A binding configuration.
|
|
2135
|
-
* @public
|
|
2136
|
-
*/
|
|
2137
|
-
export declare const signal: <T = any>(options: string | Binding<T, any, ExecutionContext<any>>) => BindingConfig<string | Binding<T, any, ExecutionContext<any>>>;
|
|
2138
|
-
|
|
2139
|
-
/**
|
|
2140
|
-
* A binding behavior for signal bindings.
|
|
2141
|
-
* @public
|
|
2142
|
-
*/
|
|
2143
|
-
export declare class SignalBinding extends UpdateBinding {
|
|
2144
|
-
private handlerProperty;
|
|
2145
|
-
/**
|
|
2146
|
-
* Bind this behavior to the source.
|
|
2147
|
-
* @param source - The source to bind to.
|
|
2148
|
-
* @param context - The execution context that the binding is operating within.
|
|
2149
|
-
* @param targets - The targets that behaviors in a view can attach to.
|
|
2150
|
-
*/
|
|
2151
|
-
bind(source: any, context: ExecutionContext, targets: ViewBehaviorTargets): void;
|
|
2152
|
-
/**
|
|
2153
|
-
* Unbinds this behavior from the source.
|
|
2154
|
-
* @param source - The source to unbind from.
|
|
2155
|
-
* @param context - The execution context that the binding is operating within.
|
|
2156
|
-
* @param targets - The targets that behaviors in a view can attach to.
|
|
2157
|
-
*/
|
|
2158
|
-
unbind(source: any, context: ExecutionContext, targets: ViewBehaviorTargets): void;
|
|
2159
|
-
private getSignal;
|
|
2160
|
-
/**
|
|
2161
|
-
* Sends the specified signal to signaled bindings.
|
|
2162
|
-
* @param signal - The signal to send.
|
|
2163
|
-
* @public
|
|
2164
|
-
*/
|
|
2165
|
-
static send(signal: string): void;
|
|
2166
|
-
}
|
|
2167
|
-
|
|
2168
2011
|
/**
|
|
2169
2012
|
* A directive that observes the `assignedNodes()` of a slot and updates a property
|
|
2170
2013
|
* whenever they change.
|
|
@@ -2525,7 +2368,7 @@ export declare interface SubtreeDirectiveOptions<T = any> extends NodeBehaviorOp
|
|
|
2525
2368
|
* A view representing a range of DOM nodes which can be added/removed ad hoc.
|
|
2526
2369
|
* @public
|
|
2527
2370
|
*/
|
|
2528
|
-
export declare interface SyntheticView<TSource = any, TParent = any
|
|
2371
|
+
export declare interface SyntheticView<TSource = any, TParent = any> extends View<TSource, TParent> {
|
|
2529
2372
|
/**
|
|
2530
2373
|
* The first DOM node in the range of nodes that make up the view.
|
|
2531
2374
|
*/
|
|
@@ -2550,19 +2393,18 @@ export declare interface SyntheticView<TSource = any, TParent = any, TContext ex
|
|
|
2550
2393
|
* A template capable of rendering views not specifically connected to custom elements.
|
|
2551
2394
|
* @public
|
|
2552
2395
|
*/
|
|
2553
|
-
export declare interface SyntheticViewTemplate<TSource = any, TParent = any
|
|
2554
|
-
type: "synthetic";
|
|
2396
|
+
export declare interface SyntheticViewTemplate<TSource = any, TParent = any> {
|
|
2555
2397
|
/**
|
|
2556
2398
|
* Creates a SyntheticView instance based on this template definition.
|
|
2557
2399
|
*/
|
|
2558
|
-
create(): SyntheticView<TSource, TParent
|
|
2400
|
+
create(): SyntheticView<TSource, TParent>;
|
|
2559
2401
|
}
|
|
2560
2402
|
|
|
2561
2403
|
/**
|
|
2562
2404
|
* Represents the types of values that can be interpolated into a template.
|
|
2563
2405
|
* @public
|
|
2564
2406
|
*/
|
|
2565
|
-
export declare type TemplateValue<TSource, TParent = any
|
|
2407
|
+
export declare type TemplateValue<TSource, TParent = any> = Binding<TSource, any, TParent> | HTMLDirective | CaptureType<TSource>;
|
|
2566
2408
|
|
|
2567
2409
|
/**
|
|
2568
2410
|
* Enables working with trusted types.
|
|
@@ -2589,54 +2431,6 @@ export declare type TrustedTypesPolicy = {
|
|
|
2589
2431
|
createHTML(html: string): string;
|
|
2590
2432
|
};
|
|
2591
2433
|
|
|
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
2434
|
/**
|
|
2641
2435
|
* Do not change. Part of shared kernel contract.
|
|
2642
2436
|
* @internal
|
|
@@ -2775,11 +2569,11 @@ export declare interface ValueConverter {
|
|
|
2775
2569
|
* Represents a collection of DOM nodes which can be bound to a data source.
|
|
2776
2570
|
* @public
|
|
2777
2571
|
*/
|
|
2778
|
-
export declare interface View<TSource = any, TParent = any
|
|
2572
|
+
export declare interface View<TSource = any, TParent = any> extends Disposable {
|
|
2779
2573
|
/**
|
|
2780
2574
|
* The execution context the view is running within.
|
|
2781
2575
|
*/
|
|
2782
|
-
readonly context:
|
|
2576
|
+
readonly context: ExecutionContext<TParent> | null;
|
|
2783
2577
|
/**
|
|
2784
2578
|
* The data that the view is bound to.
|
|
2785
2579
|
*/
|
|
@@ -2789,7 +2583,7 @@ export declare interface View<TSource = any, TParent = any, TContext extends Exe
|
|
|
2789
2583
|
* @param source - The binding source for the view's binding behaviors.
|
|
2790
2584
|
* @param context - The execution context to run the view within.
|
|
2791
2585
|
*/
|
|
2792
|
-
bind(source: TSource, context:
|
|
2586
|
+
bind(source: TSource, context: ExecutionContext<TParent>): void;
|
|
2793
2587
|
/**
|
|
2794
2588
|
* Unbinds a view's behaviors from its binding source and context.
|
|
2795
2589
|
*/
|
|
@@ -2850,13 +2644,8 @@ export declare type ViewBehaviorTargets = {
|
|
|
2850
2644
|
* A template capable of creating HTMLView instances or rendering directly to DOM.
|
|
2851
2645
|
* @public
|
|
2852
2646
|
*/
|
|
2853
|
-
export declare class ViewTemplate<TSource = any, TParent = any
|
|
2647
|
+
export declare class ViewTemplate<TSource = any, TParent = any> implements ElementViewTemplate<TSource, TParent>, SyntheticViewTemplate<TSource, TParent> {
|
|
2854
2648
|
private result;
|
|
2855
|
-
/**
|
|
2856
|
-
* Used for TypeScript purposes only.
|
|
2857
|
-
* Do not use.
|
|
2858
|
-
*/
|
|
2859
|
-
type: any;
|
|
2860
2649
|
/**
|
|
2861
2650
|
* The html representing what this template will
|
|
2862
2651
|
* instantiate, including placeholders for directives.
|
|
@@ -2876,7 +2665,7 @@ export declare class ViewTemplate<TSource = any, TParent = any, TContext extends
|
|
|
2876
2665
|
* Creates an HTMLView instance based on this template definition.
|
|
2877
2666
|
* @param hostBindingTarget - The element that host behaviors will be bound to.
|
|
2878
2667
|
*/
|
|
2879
|
-
create(hostBindingTarget?: Element): HTMLView<TSource, TParent
|
|
2668
|
+
create(hostBindingTarget?: Element): HTMLView<TSource, TParent>;
|
|
2880
2669
|
/**
|
|
2881
2670
|
* Creates an HTMLView from this template, binds it to the source, and then appends it to the host.
|
|
2882
2671
|
* @param source - The data source to bind the template to.
|
|
@@ -2884,7 +2673,7 @@ export declare class ViewTemplate<TSource = any, TParent = any, TContext extends
|
|
|
2884
2673
|
* @param hostBindingTarget - An HTML element to target the host bindings at if different from the
|
|
2885
2674
|
* host that the template is being attached to.
|
|
2886
2675
|
*/
|
|
2887
|
-
render(source: TSource, host: Node, hostBindingTarget?: Element, context?:
|
|
2676
|
+
render(source: TSource, host: Node, hostBindingTarget?: Element, context?: ExecutionContext): HTMLView<TSource, TParent>;
|
|
2888
2677
|
}
|
|
2889
2678
|
|
|
2890
2679
|
/**
|