@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
package/dist/fast-element.d.ts
CHANGED
|
@@ -250,18 +250,18 @@ export declare type AttributeMode = typeof reflectMode | typeof booleanMode | "f
|
|
|
250
250
|
* element's bind/unbind operations.
|
|
251
251
|
* @public
|
|
252
252
|
*/
|
|
253
|
-
export declare interface Behavior<TSource = any, TParent = any
|
|
253
|
+
export declare interface Behavior<TSource = any, TParent = any> {
|
|
254
254
|
/**
|
|
255
255
|
* Bind this behavior to the source.
|
|
256
256
|
* @param source - The source to bind to.
|
|
257
257
|
* @param context - The execution context that the binding is operating within.
|
|
258
258
|
*/
|
|
259
|
-
bind(source: TSource, context:
|
|
259
|
+
bind(source: TSource, context: ExecutionContext<TParent>): void;
|
|
260
260
|
/**
|
|
261
261
|
* Unbinds this behavior from the source.
|
|
262
262
|
* @param source - The source to unbind from.
|
|
263
263
|
*/
|
|
264
|
-
unbind(source: TSource, context:
|
|
264
|
+
unbind(source: TSource, context: ExecutionContext<TParent>): void;
|
|
265
265
|
}
|
|
266
266
|
|
|
267
267
|
/**
|
|
@@ -278,7 +278,7 @@ export declare function bind<T = any>(binding: Binding<T>, config?: BindingConfi
|
|
|
278
278
|
* as part of a template binding update.
|
|
279
279
|
* @public
|
|
280
280
|
*/
|
|
281
|
-
export declare type Binding<TSource = any, TReturn = any,
|
|
281
|
+
export declare type Binding<TSource = any, TReturn = any, TParent = any> = (source: TSource, context: ExecutionContext<TParent>) => TReturn;
|
|
282
282
|
|
|
283
283
|
/**
|
|
284
284
|
* Describes the configuration for a binding expression.
|
|
@@ -425,39 +425,6 @@ export declare class ChangeBinding extends UpdateBinding {
|
|
|
425
425
|
/* Excluded from this release type: handleChange */
|
|
426
426
|
}
|
|
427
427
|
|
|
428
|
-
/**
|
|
429
|
-
* Transforms a template literal string into a ChildViewTemplate.
|
|
430
|
-
* @param strings - The string fragments that are interpolated with the values.
|
|
431
|
-
* @param values - The values that are interpolated with the string fragments.
|
|
432
|
-
* @remarks
|
|
433
|
-
* The html helper supports interpolation of strings, numbers, binding expressions,
|
|
434
|
-
* other template instances, and Directive instances.
|
|
435
|
-
* @public
|
|
436
|
-
*/
|
|
437
|
-
export declare const child: <TChild = any, TParent = any>(strings: TemplateStringsArray, ...values: TemplateValue<TChild, TParent, ChildContext<TParent>>[]) => ChildViewTemplate<TChild, TParent>;
|
|
438
|
-
|
|
439
|
-
/**
|
|
440
|
-
* Provides additional contextual information when inside a child template.
|
|
441
|
-
* @public
|
|
442
|
-
*/
|
|
443
|
-
export declare interface ChildContext<TParentSource = any> extends RootContext {
|
|
444
|
-
/**
|
|
445
|
-
* The parent data source within a nested context.
|
|
446
|
-
*/
|
|
447
|
-
readonly parent: TParentSource;
|
|
448
|
-
/**
|
|
449
|
-
* The parent execution context when in nested context scenarios.
|
|
450
|
-
*/
|
|
451
|
-
readonly parentContext: ChildContext<TParentSource>;
|
|
452
|
-
/**
|
|
453
|
-
* Creates a new execution context descent suitable for use in list rendering.
|
|
454
|
-
* @param item - The list item to serve as the source.
|
|
455
|
-
* @param index - The index of the item in the list.
|
|
456
|
-
* @param length - The length of the list.
|
|
457
|
-
*/
|
|
458
|
-
createItemContext(index: number, length: number): ItemContext<TParentSource>;
|
|
459
|
-
}
|
|
460
|
-
|
|
461
428
|
/**
|
|
462
429
|
* The options used to configure child list observation.
|
|
463
430
|
* @public
|
|
@@ -508,18 +475,6 @@ export declare class ChildrenDirective extends NodeObservationDirective<Children
|
|
|
508
475
|
*/
|
|
509
476
|
export declare type ChildrenDirectiveOptions<T = any> = ChildListDirectiveOptions<T> | SubtreeDirectiveOptions<T>;
|
|
510
477
|
|
|
511
|
-
/**
|
|
512
|
-
* A template capable of rendering child views not specifically connected to custom elements.
|
|
513
|
-
* @public
|
|
514
|
-
*/
|
|
515
|
-
export declare interface ChildViewTemplate<TSource = any, TParent = any> {
|
|
516
|
-
type: "child";
|
|
517
|
-
/**
|
|
518
|
-
* Creates a SyntheticView instance based on this template definition.
|
|
519
|
-
*/
|
|
520
|
-
create(): SyntheticView<TSource, TParent, ChildContext<TParent>>;
|
|
521
|
-
}
|
|
522
|
-
|
|
523
478
|
/**
|
|
524
479
|
* A function capable of compiling a template from the preprocessed form produced
|
|
525
480
|
* by the html template function into a result that can instantiate views.
|
|
@@ -559,7 +514,7 @@ export declare const Compiler: {
|
|
|
559
514
|
* it is recommended that you clone the original and pass the clone to this API.
|
|
560
515
|
* @public
|
|
561
516
|
*/
|
|
562
|
-
compile<TSource = any, TParent = any
|
|
517
|
+
compile<TSource = any, TParent = any>(html: string | HTMLTemplateElement, directives: Record<string, ViewBehaviorFactory>): HTMLTemplateCompilationResult<TSource, TParent>;
|
|
563
518
|
/**
|
|
564
519
|
* Sets the default compilation strategy that will be used by the ViewTemplate whenever
|
|
565
520
|
* it needs to compile a view preprocessed with the html template function.
|
|
@@ -827,15 +782,6 @@ export declare type DecoratorAttributeConfiguration = Omit<AttributeConfiguratio
|
|
|
827
782
|
*/
|
|
828
783
|
export declare type DefaultBindingOptions = AddEventListenerOptions;
|
|
829
784
|
|
|
830
|
-
/**
|
|
831
|
-
* The default twoWay binding options.
|
|
832
|
-
* @public
|
|
833
|
-
*/
|
|
834
|
-
export declare type DefaultTwoWayBindingOptions = DefaultBindingOptions & {
|
|
835
|
-
changeEvent?: string;
|
|
836
|
-
fromView?: (value: any) => any;
|
|
837
|
-
};
|
|
838
|
-
|
|
839
785
|
/**
|
|
840
786
|
* Provides a mechanism for releasing resources.
|
|
841
787
|
* @public
|
|
@@ -951,7 +897,7 @@ export declare class ElementStyles {
|
|
|
951
897
|
* A View representing DOM nodes specifically for rendering the view of a custom element.
|
|
952
898
|
* @public
|
|
953
899
|
*/
|
|
954
|
-
export declare interface ElementView<TSource = any, TParent = any> extends View<TSource, TParent
|
|
900
|
+
export declare interface ElementView<TSource = any, TParent = any> extends View<TSource, TParent> {
|
|
955
901
|
/**
|
|
956
902
|
* Appends the view's DOM nodes to the referenced node.
|
|
957
903
|
* @param node - The parent node to append the view's DOM nodes to.
|
|
@@ -964,7 +910,6 @@ export declare interface ElementView<TSource = any, TParent = any> extends View<
|
|
|
964
910
|
* @public
|
|
965
911
|
*/
|
|
966
912
|
export declare interface ElementViewTemplate<TSource = any, TParent = any> {
|
|
967
|
-
type: "element";
|
|
968
913
|
/**
|
|
969
914
|
* Creates an ElementView instance based on this template definition.
|
|
970
915
|
* @param hostBindingTarget - The element that host behaviors will be bound to.
|
|
@@ -1025,24 +970,94 @@ export declare class EventBinding {
|
|
|
1025
970
|
}
|
|
1026
971
|
|
|
1027
972
|
/**
|
|
1028
|
-
*
|
|
973
|
+
* Provides additional contextual information available to behaviors and expressions.
|
|
1029
974
|
* @public
|
|
1030
975
|
*/
|
|
1031
|
-
export declare
|
|
1032
|
-
|
|
976
|
+
export declare class ExecutionContext<TParentSource = any> {
|
|
977
|
+
/**
|
|
978
|
+
* The default execution context.
|
|
979
|
+
*/
|
|
980
|
+
static readonly default: ExecutionContext<any>;
|
|
981
|
+
/**
|
|
982
|
+
* The index of the current item within a repeat context.
|
|
983
|
+
*/
|
|
984
|
+
index: number;
|
|
985
|
+
/**
|
|
986
|
+
* The length of the current collection within a repeat context.
|
|
987
|
+
*/
|
|
988
|
+
length: number;
|
|
989
|
+
/**
|
|
990
|
+
* The parent data source within a nested context.
|
|
991
|
+
*/
|
|
992
|
+
readonly parent: TParentSource;
|
|
993
|
+
/**
|
|
994
|
+
* The parent execution context when in nested context scenarios.
|
|
995
|
+
*/
|
|
996
|
+
readonly parentContext: ExecutionContext<TParentSource>;
|
|
997
|
+
private constructor();
|
|
998
|
+
/**
|
|
999
|
+
* The current event within an event handler.
|
|
1000
|
+
*/
|
|
1001
|
+
get event(): Event;
|
|
1002
|
+
/**
|
|
1003
|
+
* Indicates whether the current item within a repeat context
|
|
1004
|
+
* has an even index.
|
|
1005
|
+
*/
|
|
1006
|
+
get isEven(): boolean;
|
|
1007
|
+
/**
|
|
1008
|
+
* Indicates whether the current item within a repeat context
|
|
1009
|
+
* has an odd index.
|
|
1010
|
+
*/
|
|
1011
|
+
get isOdd(): boolean;
|
|
1012
|
+
/**
|
|
1013
|
+
* Indicates whether the current item within a repeat context
|
|
1014
|
+
* is the first item in the collection.
|
|
1015
|
+
*/
|
|
1016
|
+
get isFirst(): boolean;
|
|
1017
|
+
/**
|
|
1018
|
+
* Indicates whether the current item within a repeat context
|
|
1019
|
+
* is somewhere in the middle of the collection.
|
|
1020
|
+
*/
|
|
1021
|
+
get isInMiddle(): boolean;
|
|
1022
|
+
/**
|
|
1023
|
+
* Indicates whether the current item within a repeat context
|
|
1024
|
+
* is the last item in the collection.
|
|
1025
|
+
*/
|
|
1026
|
+
get isLast(): boolean;
|
|
1027
|
+
/**
|
|
1028
|
+
* Returns the typed event detail of a custom event.
|
|
1029
|
+
*/
|
|
1030
|
+
eventDetail<TDetail>(): TDetail;
|
|
1031
|
+
/**
|
|
1032
|
+
* Returns the typed event target of the event.
|
|
1033
|
+
*/
|
|
1034
|
+
eventTarget<TTarget extends EventTarget>(): TTarget;
|
|
1035
|
+
/**
|
|
1036
|
+
* Updates the position/size on a context associated with a list item.
|
|
1037
|
+
* @param index - The new index of the item.
|
|
1038
|
+
* @param length - The new length of the list.
|
|
1039
|
+
*/
|
|
1040
|
+
updatePosition(index: number, length: number): void;
|
|
1041
|
+
/**
|
|
1042
|
+
* Creates a new execution context descendent from the current context.
|
|
1043
|
+
* @param source - The source for the context if different than the parent.
|
|
1044
|
+
* @returns A child execution context.
|
|
1045
|
+
*/
|
|
1046
|
+
createChildContext<TParentSource>(parentSource: TParentSource): ExecutionContext<TParentSource>;
|
|
1047
|
+
/**
|
|
1048
|
+
* Creates a new execution context descent suitable for use in list rendering.
|
|
1049
|
+
* @param item - The list item to serve as the source.
|
|
1050
|
+
* @param index - The index of the item in the list.
|
|
1051
|
+
* @param length - The length of the list.
|
|
1052
|
+
*/
|
|
1053
|
+
createItemContext(index: number, length: number): ExecutionContext<TParentSource>;
|
|
1033
1054
|
/* Excluded from this release type: setEvent */
|
|
1034
1055
|
/**
|
|
1035
1056
|
* Creates a new root execution context.
|
|
1036
1057
|
* @returns A new execution context.
|
|
1037
1058
|
*/
|
|
1038
|
-
create():
|
|
1039
|
-
}
|
|
1040
|
-
|
|
1041
|
-
/**
|
|
1042
|
-
* Represents some sort of execution context.
|
|
1043
|
-
* @public
|
|
1044
|
-
*/
|
|
1045
|
-
export declare type ExecutionContext<TParentSource = any> = RootContext | ChildContext<TParentSource> | ItemContext<TParentSource>;
|
|
1059
|
+
static create(): ExecutionContext;
|
|
1060
|
+
}
|
|
1046
1061
|
|
|
1047
1062
|
/* Excluded from this release type: FAST */
|
|
1048
1063
|
|
|
@@ -1113,6 +1128,12 @@ export declare const FASTElement: (new () => HTMLElement & FASTElement) & {
|
|
|
1113
1128
|
* that describes the element to define.
|
|
1114
1129
|
*/
|
|
1115
1130
|
define<TType extends Constructable<HTMLElement>>(type: TType, nameOrDef?: string | PartialFASTElementDefinition): TType;
|
|
1131
|
+
/**
|
|
1132
|
+
* Defines metadata for a FASTElement which can be used to later define the element.
|
|
1133
|
+
* IMPORTANT: This API will be renamed to "compose" in a future beta.
|
|
1134
|
+
* @public
|
|
1135
|
+
*/
|
|
1136
|
+
metadata<TType_1 extends Constructable<HTMLElement> = Constructable<HTMLElement>>(type: TType_1, nameOrDef?: string | PartialFASTElementDefinition): FASTElementDefinition<TType_1>;
|
|
1116
1137
|
};
|
|
1117
1138
|
|
|
1118
1139
|
/**
|
|
@@ -1171,6 +1192,8 @@ export declare class FASTElementDefinition<TType extends Constructable<HTMLEleme
|
|
|
1171
1192
|
/**
|
|
1172
1193
|
* Defines a custom element based on this definition.
|
|
1173
1194
|
* @param registry - The element registry to define the element in.
|
|
1195
|
+
* @remarks
|
|
1196
|
+
* This operation is idempotent per registry.
|
|
1174
1197
|
*/
|
|
1175
1198
|
define(registry?: CustomElementRegistry): this;
|
|
1176
1199
|
/**
|
|
@@ -1196,7 +1219,7 @@ export declare class FASTElementDefinition<TType extends Constructable<HTMLEleme
|
|
|
1196
1219
|
* other template instances, and Directive instances.
|
|
1197
1220
|
* @public
|
|
1198
1221
|
*/
|
|
1199
|
-
export declare function html<TSource = any, TParent = any
|
|
1222
|
+
export declare function html<TSource = any, TParent = any>(strings: TemplateStringsArray, ...values: TemplateValue<TSource, TParent>[]): ViewTemplate<TSource, TParent>;
|
|
1200
1223
|
|
|
1201
1224
|
/**
|
|
1202
1225
|
* A directive that applies bindings.
|
|
@@ -1303,19 +1326,19 @@ export declare interface HTMLDirectiveDefinition<TType extends Constructable<HTM
|
|
|
1303
1326
|
* The result of a template compilation operation.
|
|
1304
1327
|
* @public
|
|
1305
1328
|
*/
|
|
1306
|
-
export declare interface HTMLTemplateCompilationResult<TSource = any, TParent = any
|
|
1329
|
+
export declare interface HTMLTemplateCompilationResult<TSource = any, TParent = any> {
|
|
1307
1330
|
/**
|
|
1308
1331
|
* Creates a view instance.
|
|
1309
1332
|
* @param hostBindingTarget - The host binding target for the view.
|
|
1310
1333
|
*/
|
|
1311
|
-
createView(hostBindingTarget?: Element): HTMLView<TSource, TParent
|
|
1334
|
+
createView(hostBindingTarget?: Element): HTMLView<TSource, TParent>;
|
|
1312
1335
|
}
|
|
1313
1336
|
|
|
1314
1337
|
/**
|
|
1315
1338
|
* The standard View implementation, which also implements ElementView and SyntheticView.
|
|
1316
1339
|
* @public
|
|
1317
1340
|
*/
|
|
1318
|
-
export declare class HTMLView<TSource = any, TParent = any
|
|
1341
|
+
export declare class HTMLView<TSource = any, TParent = any> implements ElementView<TSource, TParent>, SyntheticView<TSource, TParent> {
|
|
1319
1342
|
private fragment;
|
|
1320
1343
|
private factories;
|
|
1321
1344
|
private targets;
|
|
@@ -1327,7 +1350,7 @@ export declare class HTMLView<TSource = any, TParent = any, TContext extends Exe
|
|
|
1327
1350
|
/**
|
|
1328
1351
|
* The execution context the view is running within.
|
|
1329
1352
|
*/
|
|
1330
|
-
context:
|
|
1353
|
+
context: ExecutionContext<TParent> | null;
|
|
1331
1354
|
/**
|
|
1332
1355
|
* The first DOM node in the range of nodes that make up the view.
|
|
1333
1356
|
*/
|
|
@@ -1367,7 +1390,7 @@ export declare class HTMLView<TSource = any, TParent = any, TContext extends Exe
|
|
|
1367
1390
|
* @param source - The binding source for the view's binding behaviors.
|
|
1368
1391
|
* @param context - The execution context to run the behaviors within.
|
|
1369
1392
|
*/
|
|
1370
|
-
bind(source: TSource, context:
|
|
1393
|
+
bind(source: TSource, context: ExecutionContext<TParent>): void;
|
|
1371
1394
|
/**
|
|
1372
1395
|
* Unbinds a view's behaviors from its binding source.
|
|
1373
1396
|
*/
|
|
@@ -1380,72 +1403,14 @@ export declare class HTMLView<TSource = any, TParent = any, TContext extends Exe
|
|
|
1380
1403
|
}
|
|
1381
1404
|
|
|
1382
1405
|
/**
|
|
1383
|
-
*
|
|
1384
|
-
* @param strings - The string fragments that are interpolated with the values.
|
|
1385
|
-
* @param values - The values that are interpolated with the string fragments.
|
|
1386
|
-
* @remarks
|
|
1387
|
-
* The html helper supports interpolation of strings, numbers, binding expressions,
|
|
1388
|
-
* other template instances, and Directive instances.
|
|
1389
|
-
* @public
|
|
1390
|
-
*/
|
|
1391
|
-
export declare const item: <TItem = any, TParent = any>(strings: TemplateStringsArray, ...values: TemplateValue<TItem, TParent, ItemContext<TParent>>[]) => ItemViewTemplate<TItem, TParent>;
|
|
1392
|
-
|
|
1393
|
-
/**
|
|
1394
|
-
* Provides additional contextual information when inside a repeat item template.s
|
|
1395
|
-
* @public
|
|
1396
|
-
*/
|
|
1397
|
-
export declare interface ItemContext<TParentSource = any> extends ChildContext<TParentSource> {
|
|
1398
|
-
/**
|
|
1399
|
-
* The index of the current item within a repeat context.
|
|
1400
|
-
*/
|
|
1401
|
-
readonly index: number;
|
|
1402
|
-
/**
|
|
1403
|
-
* The length of the current collection within a repeat context.
|
|
1404
|
-
*/
|
|
1405
|
-
readonly length: number;
|
|
1406
|
-
/**
|
|
1407
|
-
* Indicates whether the current item within a repeat context
|
|
1408
|
-
* has an even index.
|
|
1409
|
-
*/
|
|
1410
|
-
readonly isEven: boolean;
|
|
1411
|
-
/**
|
|
1412
|
-
* Indicates whether the current item within a repeat context
|
|
1413
|
-
* has an odd index.
|
|
1414
|
-
*/
|
|
1415
|
-
readonly isOdd: boolean;
|
|
1416
|
-
/**
|
|
1417
|
-
* Indicates whether the current item within a repeat context
|
|
1418
|
-
* is the first item in the collection.
|
|
1419
|
-
*/
|
|
1420
|
-
readonly isFirst: boolean;
|
|
1421
|
-
/**
|
|
1422
|
-
* Indicates whether the current item within a repeat context
|
|
1423
|
-
* is somewhere in the middle of the collection.
|
|
1424
|
-
*/
|
|
1425
|
-
readonly isInMiddle: boolean;
|
|
1426
|
-
/**
|
|
1427
|
-
* Indicates whether the current item within a repeat context
|
|
1428
|
-
* is the last item in the collection.
|
|
1429
|
-
*/
|
|
1430
|
-
readonly isLast: boolean;
|
|
1431
|
-
/**
|
|
1432
|
-
* Updates the position/size on a context associated with a list item.
|
|
1433
|
-
* @param index - The new index of the item.
|
|
1434
|
-
* @param length - The new length of the list.
|
|
1435
|
-
*/
|
|
1436
|
-
updatePosition(index: number, length: number): void;
|
|
1437
|
-
}
|
|
1438
|
-
|
|
1439
|
-
/**
|
|
1440
|
-
* A template capable of rendering item views not specifically connected to custom elements.
|
|
1406
|
+
* Observes array lengths.
|
|
1441
1407
|
* @public
|
|
1442
1408
|
*/
|
|
1443
|
-
export declare interface
|
|
1444
|
-
type: "item";
|
|
1409
|
+
export declare interface LengthObserver extends Subscriber {
|
|
1445
1410
|
/**
|
|
1446
|
-
*
|
|
1411
|
+
* The length of the observed array.
|
|
1447
1412
|
*/
|
|
1448
|
-
|
|
1413
|
+
length: number;
|
|
1449
1414
|
}
|
|
1450
1415
|
|
|
1451
1416
|
/**
|
|
@@ -1454,19 +1419,7 @@ export declare interface ItemViewTemplate<TSource = any, TParent = any> {
|
|
|
1454
1419
|
* @returns The length of the array.
|
|
1455
1420
|
* @public
|
|
1456
1421
|
*/
|
|
1457
|
-
declare function
|
|
1458
|
-
export { length_2 as length }
|
|
1459
|
-
|
|
1460
|
-
/**
|
|
1461
|
-
* Observes array lengths.
|
|
1462
|
-
* @public
|
|
1463
|
-
*/
|
|
1464
|
-
export declare interface LengthObserver extends Subscriber {
|
|
1465
|
-
/**
|
|
1466
|
-
* The length of the observed array.
|
|
1467
|
-
*/
|
|
1468
|
-
length: number;
|
|
1469
|
-
}
|
|
1422
|
+
export declare function lengthOf<T>(array: readonly T[]): number;
|
|
1470
1423
|
|
|
1471
1424
|
/**
|
|
1472
1425
|
* Common APIs related to markup generation.
|
|
@@ -1671,13 +1624,13 @@ export declare const Observable: Readonly<{
|
|
|
1671
1624
|
* @param initialSubscriber - An initial subscriber to changes in the binding value.
|
|
1672
1625
|
* @param isVolatileBinding - Indicates whether the binding's dependency list must be re-evaluated on every value evaluation.
|
|
1673
1626
|
*/
|
|
1674
|
-
binding<TSource = any, TReturn = any>(binding: Binding<TSource, TReturn,
|
|
1627
|
+
binding<TSource = any, TReturn = any>(binding: Binding<TSource, TReturn, any>, initialSubscriber?: Subscriber, isVolatileBinding?: boolean): BindingObserver<TSource, TReturn, any>;
|
|
1675
1628
|
/**
|
|
1676
1629
|
* Determines whether a binding expression is volatile and needs to have its dependency list re-evaluated
|
|
1677
1630
|
* on every evaluation of the value.
|
|
1678
1631
|
* @param binding - The binding to inspect.
|
|
1679
1632
|
*/
|
|
1680
|
-
isVolatileBinding<TSource_1 = any, TReturn_1 = any>(binding: Binding<TSource_1, TReturn_1,
|
|
1633
|
+
isVolatileBinding<TSource_1 = any, TReturn_1 = any>(binding: Binding<TSource_1, TReturn_1, any>): boolean;
|
|
1681
1634
|
}>;
|
|
1682
1635
|
|
|
1683
1636
|
/**
|
|
@@ -1860,55 +1813,7 @@ declare const reflectMode = "reflect";
|
|
|
1860
1813
|
* @param options - Options used to turn on special repeat features.
|
|
1861
1814
|
* @public
|
|
1862
1815
|
*/
|
|
1863
|
-
export declare function repeat<TSource = any, TArray extends ReadonlyArray<any> = ReadonlyArray<any>>(itemsBinding: Binding<TSource, TArray, ExecutionContext<TSource>>, templateOrTemplateBinding: ViewTemplate | Binding<TSource, ViewTemplate
|
|
1864
|
-
positioning: false;
|
|
1865
|
-
} | {
|
|
1866
|
-
recycle: true;
|
|
1867
|
-
} | {
|
|
1868
|
-
positioning: false;
|
|
1869
|
-
recycle: false;
|
|
1870
|
-
} | {
|
|
1871
|
-
positioning: false;
|
|
1872
|
-
recycle: true;
|
|
1873
|
-
}): CaptureType<TSource>;
|
|
1874
|
-
|
|
1875
|
-
/**
|
|
1876
|
-
* A directive that enables list rendering.
|
|
1877
|
-
* @param itemsBinding - The array to render.
|
|
1878
|
-
* @param templateOrTemplateBinding - The template or a template binding used obtain a template
|
|
1879
|
-
* to render for each item in the array.
|
|
1880
|
-
* @param options - Options used to turn on special repeat features.
|
|
1881
|
-
* @public
|
|
1882
|
-
*/
|
|
1883
|
-
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?: {
|
|
1884
|
-
positioning: false;
|
|
1885
|
-
} | {
|
|
1886
|
-
recycle: true;
|
|
1887
|
-
} | {
|
|
1888
|
-
positioning: false;
|
|
1889
|
-
recycle: false;
|
|
1890
|
-
} | {
|
|
1891
|
-
positioning: false;
|
|
1892
|
-
recycle: true;
|
|
1893
|
-
}): CaptureType<TSource>;
|
|
1894
|
-
|
|
1895
|
-
/**
|
|
1896
|
-
* A directive that enables list rendering.
|
|
1897
|
-
* @param itemsBinding - The array to render.
|
|
1898
|
-
* @param templateOrTemplateBinding - The template or a template binding used obtain a template
|
|
1899
|
-
* to render for each item in the array.
|
|
1900
|
-
* @param options - Options used to turn on special repeat features.
|
|
1901
|
-
* @public
|
|
1902
|
-
*/
|
|
1903
|
-
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: {
|
|
1904
|
-
positioning: true;
|
|
1905
|
-
} | {
|
|
1906
|
-
positioning: true;
|
|
1907
|
-
recycle: true;
|
|
1908
|
-
} | {
|
|
1909
|
-
positioning: true;
|
|
1910
|
-
recycle: false;
|
|
1911
|
-
}): CaptureType<TSource>;
|
|
1816
|
+
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>;
|
|
1912
1817
|
|
|
1913
1818
|
/**
|
|
1914
1819
|
* A behavior that renders a template for each item in an array.
|
|
@@ -2014,68 +1919,6 @@ export declare interface RepeatOptions {
|
|
|
2014
1919
|
recycle?: boolean;
|
|
2015
1920
|
}
|
|
2016
1921
|
|
|
2017
|
-
/**
|
|
2018
|
-
* Provides additional contextual information available to behaviors and expressions.
|
|
2019
|
-
* @public
|
|
2020
|
-
*/
|
|
2021
|
-
export declare interface RootContext {
|
|
2022
|
-
/**
|
|
2023
|
-
* The current event within an event handler.
|
|
2024
|
-
*/
|
|
2025
|
-
readonly event: Event;
|
|
2026
|
-
/**
|
|
2027
|
-
* Returns the typed event detail of a custom event.
|
|
2028
|
-
*/
|
|
2029
|
-
eventDetail<TDetail = any>(): TDetail;
|
|
2030
|
-
/**
|
|
2031
|
-
* Returns the typed event target of the event.
|
|
2032
|
-
*/
|
|
2033
|
-
eventTarget<TTarget extends EventTarget = EventTarget>(): TTarget;
|
|
2034
|
-
/**
|
|
2035
|
-
* Creates a new execution context descendent from the current context.
|
|
2036
|
-
* @param source - The source for the context if different than the parent.
|
|
2037
|
-
* @returns A child execution context.
|
|
2038
|
-
*/
|
|
2039
|
-
createChildContext<TParentSource>(source: TParentSource): ChildContext<TParentSource>;
|
|
2040
|
-
}
|
|
2041
|
-
|
|
2042
|
-
/**
|
|
2043
|
-
* Creates a signal binding configuration with the supplied options.
|
|
2044
|
-
* @param options - The signal name or a binding to use to retrieve the signal name.
|
|
2045
|
-
* @returns A binding configuration.
|
|
2046
|
-
* @public
|
|
2047
|
-
*/
|
|
2048
|
-
export declare const signal: <T = any>(options: string | Binding<T, any, ExecutionContext<any>>) => BindingConfig<string | Binding<T, any, ExecutionContext<any>>>;
|
|
2049
|
-
|
|
2050
|
-
/**
|
|
2051
|
-
* A binding behavior for signal bindings.
|
|
2052
|
-
* @public
|
|
2053
|
-
*/
|
|
2054
|
-
export declare class SignalBinding extends UpdateBinding {
|
|
2055
|
-
private handlerProperty;
|
|
2056
|
-
/**
|
|
2057
|
-
* Bind this behavior to the source.
|
|
2058
|
-
* @param source - The source to bind to.
|
|
2059
|
-
* @param context - The execution context that the binding is operating within.
|
|
2060
|
-
* @param targets - The targets that behaviors in a view can attach to.
|
|
2061
|
-
*/
|
|
2062
|
-
bind(source: any, context: ExecutionContext, targets: ViewBehaviorTargets): void;
|
|
2063
|
-
/**
|
|
2064
|
-
* Unbinds this behavior from the source.
|
|
2065
|
-
* @param source - The source to unbind from.
|
|
2066
|
-
* @param context - The execution context that the binding is operating within.
|
|
2067
|
-
* @param targets - The targets that behaviors in a view can attach to.
|
|
2068
|
-
*/
|
|
2069
|
-
unbind(source: any, context: ExecutionContext, targets: ViewBehaviorTargets): void;
|
|
2070
|
-
private getSignal;
|
|
2071
|
-
/**
|
|
2072
|
-
* Sends the specified signal to signaled bindings.
|
|
2073
|
-
* @param signal - The signal to send.
|
|
2074
|
-
* @public
|
|
2075
|
-
*/
|
|
2076
|
-
static send(signal: string): void;
|
|
2077
|
-
}
|
|
2078
|
-
|
|
2079
1922
|
/**
|
|
2080
1923
|
* A directive that observes the `assignedNodes()` of a slot and updates a property
|
|
2081
1924
|
* whenever they change.
|
|
@@ -2435,7 +2278,7 @@ export declare interface SubtreeDirectiveOptions<T = any> extends NodeBehaviorOp
|
|
|
2435
2278
|
* A view representing a range of DOM nodes which can be added/removed ad hoc.
|
|
2436
2279
|
* @public
|
|
2437
2280
|
*/
|
|
2438
|
-
export declare interface SyntheticView<TSource = any, TParent = any
|
|
2281
|
+
export declare interface SyntheticView<TSource = any, TParent = any> extends View<TSource, TParent> {
|
|
2439
2282
|
/**
|
|
2440
2283
|
* The first DOM node in the range of nodes that make up the view.
|
|
2441
2284
|
*/
|
|
@@ -2460,19 +2303,18 @@ export declare interface SyntheticView<TSource = any, TParent = any, TContext ex
|
|
|
2460
2303
|
* A template capable of rendering views not specifically connected to custom elements.
|
|
2461
2304
|
* @public
|
|
2462
2305
|
*/
|
|
2463
|
-
export declare interface SyntheticViewTemplate<TSource = any, TParent = any
|
|
2464
|
-
type: "synthetic";
|
|
2306
|
+
export declare interface SyntheticViewTemplate<TSource = any, TParent = any> {
|
|
2465
2307
|
/**
|
|
2466
2308
|
* Creates a SyntheticView instance based on this template definition.
|
|
2467
2309
|
*/
|
|
2468
|
-
create(): SyntheticView<TSource, TParent
|
|
2310
|
+
create(): SyntheticView<TSource, TParent>;
|
|
2469
2311
|
}
|
|
2470
2312
|
|
|
2471
2313
|
/**
|
|
2472
2314
|
* Represents the types of values that can be interpolated into a template.
|
|
2473
2315
|
* @public
|
|
2474
2316
|
*/
|
|
2475
|
-
export declare type TemplateValue<TSource, TParent = any
|
|
2317
|
+
export declare type TemplateValue<TSource, TParent = any> = Binding<TSource, any, TParent> | HTMLDirective | CaptureType<TSource>;
|
|
2476
2318
|
|
|
2477
2319
|
/**
|
|
2478
2320
|
* Enables working with trusted types.
|
|
@@ -2499,53 +2341,6 @@ export declare type TrustedTypesPolicy = {
|
|
|
2499
2341
|
createHTML(html: string): string;
|
|
2500
2342
|
};
|
|
2501
2343
|
|
|
2502
|
-
/**
|
|
2503
|
-
* The default twoWay binding configuration.
|
|
2504
|
-
* @public
|
|
2505
|
-
*/
|
|
2506
|
-
export declare const twoWay: BindingConfig<DefaultTwoWayBindingOptions> & BindingConfigResolver<DefaultTwoWayBindingOptions>;
|
|
2507
|
-
|
|
2508
|
-
/**
|
|
2509
|
-
* A binding behavior for bindings that update in two directions.
|
|
2510
|
-
* @public
|
|
2511
|
-
*/
|
|
2512
|
-
export declare class TwoWayBinding extends ChangeBinding {
|
|
2513
|
-
private changeEvent;
|
|
2514
|
-
/**
|
|
2515
|
-
* Bind this behavior to the source.
|
|
2516
|
-
* @param source - The source to bind to.
|
|
2517
|
-
* @param context - The execution context that the binding is operating within.
|
|
2518
|
-
* @param targets - The targets that behaviors in a view can attach to.
|
|
2519
|
-
*/
|
|
2520
|
-
bind(source: any, context: ExecutionContext, targets: ViewBehaviorTargets): void;
|
|
2521
|
-
/**
|
|
2522
|
-
* Unbinds this behavior from the source.
|
|
2523
|
-
* @param source - The source to unbind from.
|
|
2524
|
-
* @param context - The execution context that the binding is operating within.
|
|
2525
|
-
* @param targets - The targets that behaviors in a view can attach to.
|
|
2526
|
-
*/
|
|
2527
|
-
unbind(source: any, context: ExecutionContext, targets: ViewBehaviorTargets): void;
|
|
2528
|
-
/* Excluded from this release type: handleEvent */
|
|
2529
|
-
/**
|
|
2530
|
-
* Configures two-way binding.
|
|
2531
|
-
* @param settings - The settings to use for the two-way binding system.
|
|
2532
|
-
*/
|
|
2533
|
-
static configure(settings: TwoWaySettings): void;
|
|
2534
|
-
}
|
|
2535
|
-
|
|
2536
|
-
/**
|
|
2537
|
-
* The settings required to enable two-way binding.
|
|
2538
|
-
* @public
|
|
2539
|
-
*/
|
|
2540
|
-
export declare interface TwoWaySettings {
|
|
2541
|
-
/**
|
|
2542
|
-
* Determines which event to listen to, to detect changes in the view.
|
|
2543
|
-
* @param directive - The directive to determine the change event for.
|
|
2544
|
-
* @param target - The target element to determine the change event for.
|
|
2545
|
-
*/
|
|
2546
|
-
determineChangeEvent(directive: HTMLBindingDirective, target: HTMLElement): string;
|
|
2547
|
-
}
|
|
2548
|
-
|
|
2549
2344
|
/* Excluded from this release type: TypeDefinition */
|
|
2550
2345
|
|
|
2551
2346
|
/* Excluded from this release type: TypeRegistry */
|
|
@@ -2670,11 +2465,11 @@ export declare interface ValueConverter {
|
|
|
2670
2465
|
* Represents a collection of DOM nodes which can be bound to a data source.
|
|
2671
2466
|
* @public
|
|
2672
2467
|
*/
|
|
2673
|
-
export declare interface View<TSource = any, TParent = any
|
|
2468
|
+
export declare interface View<TSource = any, TParent = any> extends Disposable {
|
|
2674
2469
|
/**
|
|
2675
2470
|
* The execution context the view is running within.
|
|
2676
2471
|
*/
|
|
2677
|
-
readonly context:
|
|
2472
|
+
readonly context: ExecutionContext<TParent> | null;
|
|
2678
2473
|
/**
|
|
2679
2474
|
* The data that the view is bound to.
|
|
2680
2475
|
*/
|
|
@@ -2684,7 +2479,7 @@ export declare interface View<TSource = any, TParent = any, TContext extends Exe
|
|
|
2684
2479
|
* @param source - The binding source for the view's binding behaviors.
|
|
2685
2480
|
* @param context - The execution context to run the view within.
|
|
2686
2481
|
*/
|
|
2687
|
-
bind(source: TSource, context:
|
|
2482
|
+
bind(source: TSource, context: ExecutionContext<TParent>): void;
|
|
2688
2483
|
/**
|
|
2689
2484
|
* Unbinds a view's behaviors from its binding source and context.
|
|
2690
2485
|
*/
|
|
@@ -2745,13 +2540,8 @@ export declare type ViewBehaviorTargets = {
|
|
|
2745
2540
|
* A template capable of creating HTMLView instances or rendering directly to DOM.
|
|
2746
2541
|
* @public
|
|
2747
2542
|
*/
|
|
2748
|
-
export declare class ViewTemplate<TSource = any, TParent = any
|
|
2543
|
+
export declare class ViewTemplate<TSource = any, TParent = any> implements ElementViewTemplate<TSource, TParent>, SyntheticViewTemplate<TSource, TParent> {
|
|
2749
2544
|
private result;
|
|
2750
|
-
/**
|
|
2751
|
-
* Used for TypeScript purposes only.
|
|
2752
|
-
* Do not use.
|
|
2753
|
-
*/
|
|
2754
|
-
type: any;
|
|
2755
2545
|
/**
|
|
2756
2546
|
* The html representing what this template will
|
|
2757
2547
|
* instantiate, including placeholders for directives.
|
|
@@ -2771,7 +2561,7 @@ export declare class ViewTemplate<TSource = any, TParent = any, TContext extends
|
|
|
2771
2561
|
* Creates an HTMLView instance based on this template definition.
|
|
2772
2562
|
* @param hostBindingTarget - The element that host behaviors will be bound to.
|
|
2773
2563
|
*/
|
|
2774
|
-
create(hostBindingTarget?: Element): HTMLView<TSource, TParent
|
|
2564
|
+
create(hostBindingTarget?: Element): HTMLView<TSource, TParent>;
|
|
2775
2565
|
/**
|
|
2776
2566
|
* Creates an HTMLView from this template, binds it to the source, and then appends it to the host.
|
|
2777
2567
|
* @param source - The data source to bind the template to.
|
|
@@ -2779,7 +2569,7 @@ export declare class ViewTemplate<TSource = any, TParent = any, TContext extends
|
|
|
2779
2569
|
* @param hostBindingTarget - An HTML element to target the host bindings at if different from the
|
|
2780
2570
|
* host that the template is being attached to.
|
|
2781
2571
|
*/
|
|
2782
|
-
render(source: TSource, host: Node, hostBindingTarget?: Element, context?:
|
|
2572
|
+
render(source: TSource, host: Node, hostBindingTarget?: Element, context?: ExecutionContext): HTMLView<TSource, TParent>;
|
|
2783
2573
|
}
|
|
2784
2574
|
|
|
2785
2575
|
/**
|