@microsoft/fast-element 2.0.0-beta.3 → 2.0.0-beta.6
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 +147 -0
- package/CHANGELOG.md +42 -1
- package/dist/dts/components/fast-definitions.d.ts +9 -8
- package/dist/dts/components/fast-element.d.ts +12 -24
- package/dist/dts/context.d.ts +1 -1
- package/dist/dts/di/di.d.ts +858 -0
- package/dist/dts/interfaces.d.ts +43 -7
- package/dist/dts/observation/observable.d.ts +19 -13
- package/dist/dts/state/exports.d.ts +3 -0
- package/dist/dts/state/reactive.d.ts +8 -0
- package/dist/dts/state/state.d.ts +141 -0
- package/dist/dts/state/visitor.d.ts +6 -0
- package/dist/dts/state/watch.d.ts +10 -0
- package/dist/dts/styles/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/dts/utilities.d.ts +0 -18
- package/dist/esm/components/fast-definitions.js +25 -27
- package/dist/esm/components/fast-element.js +20 -11
- package/dist/esm/context.js +5 -1
- package/dist/esm/debug.js +35 -4
- package/dist/esm/di/di.js +1351 -0
- package/dist/esm/interfaces.js +4 -0
- package/dist/esm/observation/arrays.js +303 -2
- package/dist/esm/observation/observable.js +11 -6
- package/dist/esm/platform.js +1 -1
- package/dist/esm/state/exports.js +3 -0
- package/dist/esm/state/reactive.js +34 -0
- package/dist/esm/state/state.js +148 -0
- package/dist/esm/state/visitor.js +28 -0
- package/dist/esm/state/watch.js +36 -0
- package/dist/esm/styles/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 +57 -40
- package/dist/esm/templating/template.js +8 -5
- package/dist/esm/templating/view.js +3 -1
- 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/esm/utilities.js +0 -95
- package/dist/fast-element.api.json +2827 -2757
- package/dist/fast-element.d.ts +215 -229
- package/dist/fast-element.debug.js +650 -256
- package/dist/fast-element.debug.min.js +1 -1
- package/dist/fast-element.js +615 -252
- package/dist/fast-element.min.js +1 -1
- package/dist/fast-element.untrimmed.d.ts +223 -234
- package/docs/api-report.md +87 -90
- package/package.json +18 -9
- package/dist/dts/hooks.d.ts +0 -20
- package/dist/dts/observation/splice-strategies.d.ts +0 -13
- package/dist/esm/hooks.js +0 -32
- package/dist/esm/observation/splice-strategies.js +0 -400
package/dist/fast-element.d.ts
CHANGED
|
@@ -147,7 +147,7 @@ export declare interface Aspected {
|
|
|
147
147
|
/**
|
|
148
148
|
* A binding if one is associated with the aspect.
|
|
149
149
|
*/
|
|
150
|
-
|
|
150
|
+
dataBinding?: Binding;
|
|
151
151
|
}
|
|
152
152
|
|
|
153
153
|
/**
|
|
@@ -267,102 +267,80 @@ export declare interface Behavior<TSource = any, TParent = any> {
|
|
|
267
267
|
}
|
|
268
268
|
|
|
269
269
|
/**
|
|
270
|
-
* Creates
|
|
271
|
-
* @param binding - The binding
|
|
272
|
-
* @param
|
|
273
|
-
* @returns A binding
|
|
270
|
+
* Creates an standard binding.
|
|
271
|
+
* @param binding - The binding to refresh when changed.
|
|
272
|
+
* @param isVolatile - Indicates whether the binding is volatile or not.
|
|
273
|
+
* @returns A binding configuration.
|
|
274
274
|
* @public
|
|
275
275
|
*/
|
|
276
|
-
export declare function bind<T = any>(binding:
|
|
276
|
+
export declare function bind<T = any>(binding: Expression<T>, isVolatile?: boolean): Binding<T>;
|
|
277
277
|
|
|
278
278
|
/**
|
|
279
|
-
*
|
|
280
|
-
*
|
|
281
|
-
* @public
|
|
282
|
-
*/
|
|
283
|
-
export declare type Binding<TSource = any, TReturn = any, TParent = any> = (source: TSource, context: ExecutionContext<TParent>) => TReturn;
|
|
284
|
-
|
|
285
|
-
/**
|
|
286
|
-
* Describes the configuration for a binding expression.
|
|
279
|
+
* Captures a binding expression along with related information and capabilities.
|
|
280
|
+
*
|
|
287
281
|
* @public
|
|
288
282
|
*/
|
|
289
|
-
export declare
|
|
283
|
+
export declare abstract class Binding<TSource = any, TReturn = any, TParent = any> {
|
|
284
|
+
/**
|
|
285
|
+
* Options associated with the binding.
|
|
286
|
+
*/
|
|
287
|
+
options?: any;
|
|
290
288
|
/**
|
|
291
|
-
*
|
|
289
|
+
* Whether or not the binding is volatile.
|
|
292
290
|
*/
|
|
293
|
-
|
|
291
|
+
isVolatile?: boolean;
|
|
294
292
|
/**
|
|
295
|
-
*
|
|
293
|
+
* Evaluates the binding expression.
|
|
296
294
|
*/
|
|
297
|
-
|
|
295
|
+
evaluate: Expression<TSource, TReturn, TParent>;
|
|
296
|
+
/**
|
|
297
|
+
* Creates an observer capable of notifying a subscriber when the output of a binding changes.
|
|
298
|
+
* @param directive - The HTML Directive to create the observer for.
|
|
299
|
+
* @param subscriber - The subscriber to changes in the binding.
|
|
300
|
+
*/
|
|
301
|
+
abstract createObserver(directive: HTMLDirective, subscriber: Subscriber): ExpressionObserver<TSource, TReturn, TParent>;
|
|
298
302
|
}
|
|
299
303
|
|
|
300
304
|
/**
|
|
301
|
-
*
|
|
305
|
+
* A binding behavior for bindings that change.
|
|
302
306
|
* @public
|
|
303
307
|
*/
|
|
304
|
-
export declare
|
|
308
|
+
export declare class BindingBehavior implements ViewBehavior {
|
|
309
|
+
readonly directive: HTMLBindingDirective;
|
|
310
|
+
protected updateTarget: UpdateTarget;
|
|
311
|
+
private observerProperty;
|
|
305
312
|
/**
|
|
306
|
-
* Creates
|
|
307
|
-
* @param
|
|
308
|
-
* @param
|
|
309
|
-
* @returns A new binding configuration.
|
|
313
|
+
* Creates an instance of ChangeBinding.
|
|
314
|
+
* @param directive - The directive that has the configuration for this behavior.
|
|
315
|
+
* @param updateTarget - The function used to update the target with the latest value.
|
|
310
316
|
*/
|
|
311
|
-
|
|
312
|
-
}>;
|
|
313
|
-
|
|
314
|
-
/**
|
|
315
|
-
* Creates a new binding configuration based on the supplied options.
|
|
316
|
-
* @public
|
|
317
|
-
*/
|
|
318
|
-
export declare type BindingConfigResolver<T> = (options: T) => BindingConfig<T>;
|
|
319
|
-
|
|
320
|
-
/**
|
|
321
|
-
* Describes how aspects of an HTML element will be affected by bindings.
|
|
322
|
-
* @public
|
|
323
|
-
*/
|
|
324
|
-
export declare type BindingMode = Record<Aspect, (directive: HTMLBindingDirective) => Pick<ViewBehaviorFactory, "createBehavior">>;
|
|
325
|
-
|
|
326
|
-
/**
|
|
327
|
-
* Describes how aspects of an HTML element will be affected by bindings.
|
|
328
|
-
* @public
|
|
329
|
-
*/
|
|
330
|
-
export declare const BindingMode: Readonly<{
|
|
317
|
+
constructor(directive: HTMLBindingDirective, updateTarget: UpdateTarget);
|
|
331
318
|
/**
|
|
332
|
-
*
|
|
333
|
-
* @param
|
|
334
|
-
* @param
|
|
335
|
-
* @
|
|
319
|
+
* Bind this behavior to the source.
|
|
320
|
+
* @param source - The source to bind to.
|
|
321
|
+
* @param context - The execution context that the binding is operating within.
|
|
322
|
+
* @param targets - The targets that behaviors in a view can attach to.
|
|
336
323
|
*/
|
|
337
|
-
|
|
338
|
-
}>;
|
|
339
|
-
|
|
340
|
-
/**
|
|
341
|
-
* Enables evaluation of and subscription to a binding.
|
|
342
|
-
* @public
|
|
343
|
-
*/
|
|
344
|
-
export declare interface BindingObserver<TSource = any, TReturn = any, TParent = any> extends Notifier, Disposable {
|
|
324
|
+
bind(source: any, context: ExecutionContext, targets: ViewBehaviorTargets): void;
|
|
345
325
|
/**
|
|
346
|
-
*
|
|
347
|
-
* @param source - The source
|
|
348
|
-
* @param context - The execution context
|
|
349
|
-
* @
|
|
326
|
+
* Unbinds this behavior from the source.
|
|
327
|
+
* @param source - The source to unbind from.
|
|
328
|
+
* @param context - The execution context that the binding is operating within.
|
|
329
|
+
* @param targets - The targets that behaviors in a view can attach to.
|
|
350
330
|
*/
|
|
351
|
-
|
|
331
|
+
unbind(source: any, context: ExecutionContext, targets: ViewBehaviorTargets): void;
|
|
332
|
+
/* Excluded from this release type: handleChange */
|
|
352
333
|
/**
|
|
353
|
-
*
|
|
354
|
-
*
|
|
334
|
+
* Returns the binding observer used to update the node.
|
|
335
|
+
* @param target - The target node.
|
|
336
|
+
* @returns A BindingObserver.
|
|
355
337
|
*/
|
|
356
|
-
|
|
338
|
+
protected getObserver(target: Node): ExpressionObserver;
|
|
357
339
|
/**
|
|
358
|
-
*
|
|
359
|
-
* @param
|
|
360
|
-
* @remarks
|
|
361
|
-
* By default, the update mode is asynchronous, since that provides the best
|
|
362
|
-
* performance for template rendering scenarios. Passing false to setMode will
|
|
363
|
-
* instead cause the observer to notify subscribers immediately when changes occur.
|
|
340
|
+
* Creates a behavior.
|
|
341
|
+
* @param targets - The targets available for behaviors to be attached to.
|
|
364
342
|
*/
|
|
365
|
-
|
|
343
|
+
createBehavior(targets: ViewBehaviorTargets): ViewBehavior;
|
|
366
344
|
}
|
|
367
345
|
|
|
368
346
|
/**
|
|
@@ -391,42 +369,6 @@ export declare type Callable = typeof Function.prototype.call | {
|
|
|
391
369
|
export declare interface CaptureType<TSource> {
|
|
392
370
|
}
|
|
393
371
|
|
|
394
|
-
/**
|
|
395
|
-
* A binding behavior for bindings that change.
|
|
396
|
-
* @public
|
|
397
|
-
*/
|
|
398
|
-
export declare class ChangeBinding extends UpdateBinding {
|
|
399
|
-
private isBindingVolatile;
|
|
400
|
-
private observerProperty;
|
|
401
|
-
/**
|
|
402
|
-
* Creates an instance of ChangeBinding.
|
|
403
|
-
* @param directive - The directive that has the configuration for this behavior.
|
|
404
|
-
* @param updateTarget - The function used to update the target with the latest value.
|
|
405
|
-
*/
|
|
406
|
-
constructor(directive: HTMLBindingDirective, updateTarget: UpdateTarget);
|
|
407
|
-
/**
|
|
408
|
-
* Returns the binding observer used to update the node.
|
|
409
|
-
* @param target - The target node.
|
|
410
|
-
* @returns A BindingObserver.
|
|
411
|
-
*/
|
|
412
|
-
protected getObserver(target: Node): BindingObserver;
|
|
413
|
-
/**
|
|
414
|
-
* Bind this behavior to the source.
|
|
415
|
-
* @param source - The source to bind to.
|
|
416
|
-
* @param context - The execution context that the binding is operating within.
|
|
417
|
-
* @param targets - The targets that behaviors in a view can attach to.
|
|
418
|
-
*/
|
|
419
|
-
bind(source: any, context: ExecutionContext, targets: ViewBehaviorTargets): void;
|
|
420
|
-
/**
|
|
421
|
-
* Unbinds this behavior from the source.
|
|
422
|
-
* @param source - The source to unbind from.
|
|
423
|
-
* @param context - The execution context that the binding is operating within.
|
|
424
|
-
* @param targets - The targets that behaviors in a view can attach to.
|
|
425
|
-
*/
|
|
426
|
-
unbind(source: any, context: ExecutionContext, targets: ViewBehaviorTargets): void;
|
|
427
|
-
/* Excluded from this release type: handleChange */
|
|
428
|
-
}
|
|
429
|
-
|
|
430
372
|
/**
|
|
431
373
|
* The options used to configure child list observation.
|
|
432
374
|
* @public
|
|
@@ -538,6 +480,10 @@ export declare const Compiler: {
|
|
|
538
480
|
*/
|
|
539
481
|
export declare type ComposableStyles = string | ElementStyles | CSSStyleSheet;
|
|
540
482
|
|
|
483
|
+
declare function compose<TType extends Constructable<HTMLElement> = Constructable<HTMLElement>>(this: TType, nameOrDef: string | PartialFASTElementDefinition): FASTElementDefinition<TType>;
|
|
484
|
+
|
|
485
|
+
declare function compose<TType extends Constructable<HTMLElement> = Constructable<HTMLElement>>(type: TType, nameOrDef?: string | PartialFASTElementDefinition): FASTElementDefinition<TType>;
|
|
486
|
+
|
|
541
487
|
/**
|
|
542
488
|
* Allows for the creation of Constructable mixin classes.
|
|
543
489
|
*
|
|
@@ -559,6 +505,58 @@ export declare type ConstructibleStyleStrategy = {
|
|
|
559
505
|
new (styles: (string | CSSStyleSheet)[]): StyleStrategy;
|
|
560
506
|
};
|
|
561
507
|
|
|
508
|
+
/**
|
|
509
|
+
* A special binding behavior that can bind node content.
|
|
510
|
+
* @public
|
|
511
|
+
*/
|
|
512
|
+
export declare class ContentBehavior extends BindingBehavior {
|
|
513
|
+
/**
|
|
514
|
+
* Unbinds this behavior from the source.
|
|
515
|
+
* @param source - The source to unbind from.
|
|
516
|
+
* @param context - The execution context that the binding is operating within.
|
|
517
|
+
* @param targets - The targets that behaviors in a view can attach to.
|
|
518
|
+
*/
|
|
519
|
+
unbind(source: any, context: ExecutionContext, targets: ViewBehaviorTargets): void;
|
|
520
|
+
}
|
|
521
|
+
|
|
522
|
+
/**
|
|
523
|
+
* A simple template that can create ContentView instances.
|
|
524
|
+
* @public
|
|
525
|
+
*/
|
|
526
|
+
export declare interface ContentTemplate {
|
|
527
|
+
/**
|
|
528
|
+
* Creates a simple content view instance.
|
|
529
|
+
*/
|
|
530
|
+
create(): ContentView;
|
|
531
|
+
}
|
|
532
|
+
|
|
533
|
+
/**
|
|
534
|
+
* A simple View that can be interpolated into HTML content.
|
|
535
|
+
* @public
|
|
536
|
+
*/
|
|
537
|
+
export declare interface ContentView {
|
|
538
|
+
/**
|
|
539
|
+
* Binds a view's behaviors to its binding source.
|
|
540
|
+
* @param source - The binding source for the view's binding behaviors.
|
|
541
|
+
* @param context - The execution context to run the view within.
|
|
542
|
+
*/
|
|
543
|
+
bind(source: any, context: ExecutionContext): void;
|
|
544
|
+
/**
|
|
545
|
+
* Unbinds a view's behaviors from its binding source and context.
|
|
546
|
+
*/
|
|
547
|
+
unbind(): void;
|
|
548
|
+
/**
|
|
549
|
+
* Inserts the view's DOM nodes before the referenced node.
|
|
550
|
+
* @param node - The node to insert the view's DOM before.
|
|
551
|
+
*/
|
|
552
|
+
insertBefore(node: Node): void;
|
|
553
|
+
/**
|
|
554
|
+
* Removes the view's DOM nodes.
|
|
555
|
+
* The nodes are not disposed and the view can later be re-inserted.
|
|
556
|
+
*/
|
|
557
|
+
remove(): void;
|
|
558
|
+
}
|
|
559
|
+
|
|
562
560
|
/**
|
|
563
561
|
* Controls the lifecycle and rendering of a `FASTElement`.
|
|
564
562
|
* @public
|
|
@@ -778,11 +776,9 @@ export declare function customElement(nameOrDef: string | PartialFASTElementDefi
|
|
|
778
776
|
*/
|
|
779
777
|
export declare type DecoratorAttributeConfiguration = Omit<AttributeConfiguration, "property">;
|
|
780
778
|
|
|
781
|
-
|
|
782
|
-
|
|
783
|
-
|
|
784
|
-
*/
|
|
785
|
-
export declare type DefaultBindingOptions = AddEventListenerOptions;
|
|
779
|
+
declare function define<TType extends Constructable<HTMLElement> = Constructable<HTMLElement>>(this: TType, nameOrDef: string | PartialFASTElementDefinition): TType;
|
|
780
|
+
|
|
781
|
+
declare function define<TType extends Constructable<HTMLElement> = Constructable<HTMLElement>>(type: TType, nameOrDef?: string | PartialFASTElementDefinition): TType;
|
|
786
782
|
|
|
787
783
|
/**
|
|
788
784
|
* Provides a mechanism for releasing resources.
|
|
@@ -889,6 +885,12 @@ export declare class ElementStyles {
|
|
|
889
885
|
* @param Strategy - The strategy type to construct.
|
|
890
886
|
*/
|
|
891
887
|
static setDefaultStrategy(Strategy: ConstructibleStyleStrategy): void;
|
|
888
|
+
/**
|
|
889
|
+
* Normalizes a set of composable style options.
|
|
890
|
+
* @param styles - The style options to normalize.
|
|
891
|
+
* @returns A singular ElementStyles instance or undefined.
|
|
892
|
+
*/
|
|
893
|
+
static normalize(styles: ComposableStyles | ComposableStyles[] | undefined): ElementStyles | undefined;
|
|
892
894
|
/**
|
|
893
895
|
* Indicates whether the DOM supports the adoptedStyleSheets feature.
|
|
894
896
|
*/
|
|
@@ -940,7 +942,7 @@ export declare const emptyArray: readonly never[];
|
|
|
940
942
|
* A binding behavior for handling events.
|
|
941
943
|
* @public
|
|
942
944
|
*/
|
|
943
|
-
export declare class
|
|
945
|
+
export declare class EventBehavior {
|
|
944
946
|
readonly directive: HTMLBindingDirective;
|
|
945
947
|
private contextProperty;
|
|
946
948
|
private sourceProperty;
|
|
@@ -1061,6 +1063,48 @@ export declare class ExecutionContext<TParentSource = any> {
|
|
|
1061
1063
|
static create(): ExecutionContext;
|
|
1062
1064
|
}
|
|
1063
1065
|
|
|
1066
|
+
/**
|
|
1067
|
+
* The signature of an arrow function capable of being evaluated
|
|
1068
|
+
* against source data and within an execution context.
|
|
1069
|
+
* @public
|
|
1070
|
+
*/
|
|
1071
|
+
export declare type Expression<TSource = any, TReturn = any, TParent = any> = (source: TSource, context: ExecutionContext<TParent>) => TReturn;
|
|
1072
|
+
|
|
1073
|
+
/**
|
|
1074
|
+
* Enables evaluation of and subscription to a binding.
|
|
1075
|
+
* @public
|
|
1076
|
+
*/
|
|
1077
|
+
export declare interface ExpressionNotifier<TSource = any, TReturn = any, TParent = any> extends Notifier, ExpressionObserver<TSource, TReturn, TParent> {
|
|
1078
|
+
/**
|
|
1079
|
+
* Gets {@link ObservationRecord|ObservationRecords} that the {@link ExpressionNotifier}
|
|
1080
|
+
* is observing.
|
|
1081
|
+
*/
|
|
1082
|
+
records(): IterableIterator<ObservationRecord>;
|
|
1083
|
+
/**
|
|
1084
|
+
* Sets the update mode used by the observer.
|
|
1085
|
+
* @param isAsync - Indicates whether updates should be asynchronous.
|
|
1086
|
+
* @remarks
|
|
1087
|
+
* By default, the update mode is asynchronous, since that provides the best
|
|
1088
|
+
* performance for template rendering scenarios. Passing false to setMode will
|
|
1089
|
+
* instead cause the observer to notify subscribers immediately when changes occur.
|
|
1090
|
+
*/
|
|
1091
|
+
setMode(isAsync: boolean): void;
|
|
1092
|
+
}
|
|
1093
|
+
|
|
1094
|
+
/**
|
|
1095
|
+
* Observes a binding for changes.
|
|
1096
|
+
*
|
|
1097
|
+
* @public
|
|
1098
|
+
*/
|
|
1099
|
+
export declare interface ExpressionObserver<TSource = any, TReturn = any, TParent = any> extends Disposable {
|
|
1100
|
+
/**
|
|
1101
|
+
* Begins observing the binding.
|
|
1102
|
+
* @param source - The source to pass to the binding.
|
|
1103
|
+
* @param context - The context to pass to the binding.
|
|
1104
|
+
*/
|
|
1105
|
+
observe(source: TSource, context?: ExecutionContext<TParent>): TReturn;
|
|
1106
|
+
}
|
|
1107
|
+
|
|
1064
1108
|
/* Excluded from this release type: FAST */
|
|
1065
1109
|
|
|
1066
1110
|
/**
|
|
@@ -1113,29 +1157,11 @@ export declare interface FASTElement extends HTMLElement {
|
|
|
1113
1157
|
* static helpers for working with FASTElements.
|
|
1114
1158
|
* @public
|
|
1115
1159
|
*/
|
|
1116
|
-
export declare const FASTElement:
|
|
1117
|
-
|
|
1118
|
-
|
|
1119
|
-
|
|
1120
|
-
|
|
1121
|
-
*/
|
|
1122
|
-
from<TBase extends {
|
|
1123
|
-
new (): HTMLElement;
|
|
1124
|
-
prototype: HTMLElement;
|
|
1125
|
-
}>(BaseType: TBase): new () => InstanceType<TBase> & FASTElement;
|
|
1126
|
-
/**
|
|
1127
|
-
* Defines a platform custom element based on the provided type and definition.
|
|
1128
|
-
* @param type - The custom element type to define.
|
|
1129
|
-
* @param nameOrDef - The name of the element to define or a definition object
|
|
1130
|
-
* that describes the element to define.
|
|
1131
|
-
*/
|
|
1132
|
-
define<TType extends Constructable<HTMLElement>>(type: TType, nameOrDef?: string | PartialFASTElementDefinition): TType;
|
|
1133
|
-
/**
|
|
1134
|
-
* Defines metadata for a FASTElement which can be used to later define the element.
|
|
1135
|
-
* IMPORTANT: This API will be renamed to "compose" in a future beta.
|
|
1136
|
-
* @public
|
|
1137
|
-
*/
|
|
1138
|
-
metadata<TType_1 extends Constructable<HTMLElement> = Constructable<HTMLElement>>(type: TType_1, nameOrDef?: string | PartialFASTElementDefinition): FASTElementDefinition<TType_1>;
|
|
1160
|
+
export declare const FASTElement: {
|
|
1161
|
+
new (): FASTElement;
|
|
1162
|
+
define: typeof define;
|
|
1163
|
+
compose: typeof compose;
|
|
1164
|
+
from: typeof from;
|
|
1139
1165
|
};
|
|
1140
1166
|
|
|
1141
1167
|
/**
|
|
@@ -1143,7 +1169,7 @@ export declare const FASTElement: (new () => HTMLElement & FASTElement) & {
|
|
|
1143
1169
|
* @public
|
|
1144
1170
|
*/
|
|
1145
1171
|
export declare class FASTElementDefinition<TType extends Constructable<HTMLElement> = Constructable<HTMLElement>> {
|
|
1146
|
-
private
|
|
1172
|
+
private platformDefined;
|
|
1147
1173
|
/**
|
|
1148
1174
|
* The type this element definition describes.
|
|
1149
1175
|
*/
|
|
@@ -1184,13 +1210,7 @@ export declare class FASTElementDefinition<TType extends Constructable<HTMLEleme
|
|
|
1184
1210
|
* Options controlling how the custom element is defined with the platform.
|
|
1185
1211
|
*/
|
|
1186
1212
|
readonly elementOptions?: ElementDefinitionOptions;
|
|
1187
|
-
|
|
1188
|
-
* Creates an instance of FASTElementDefinition.
|
|
1189
|
-
* @param type - The type this definition is being created for.
|
|
1190
|
-
* @param nameOrConfig - The name of the element to define or a config object
|
|
1191
|
-
* that describes the element to define.
|
|
1192
|
-
*/
|
|
1193
|
-
constructor(type: TType, nameOrConfig?: PartialFASTElementDefinition | string);
|
|
1213
|
+
private constructor();
|
|
1194
1214
|
/**
|
|
1195
1215
|
* Defines a custom element based on this definition.
|
|
1196
1216
|
* @param registry - The element registry to define the element in.
|
|
@@ -1198,6 +1218,13 @@ export declare class FASTElementDefinition<TType extends Constructable<HTMLEleme
|
|
|
1198
1218
|
* This operation is idempotent per registry.
|
|
1199
1219
|
*/
|
|
1200
1220
|
define(registry?: CustomElementRegistry): this;
|
|
1221
|
+
/**
|
|
1222
|
+
* Creates an instance of FASTElementDefinition.
|
|
1223
|
+
* @param type - The type this definition is being created for.
|
|
1224
|
+
* @param nameOrDef - The name of the element to define or a config object
|
|
1225
|
+
* that describes the element to define.
|
|
1226
|
+
*/
|
|
1227
|
+
static compose<TType extends Constructable<HTMLElement> = Constructable<HTMLElement>>(type: TType, nameOrDef?: string | PartialFASTElementDefinition): FASTElementDefinition<TType>;
|
|
1201
1228
|
/**
|
|
1202
1229
|
* Gets the element definition associated with the specified type.
|
|
1203
1230
|
* @param type - The custom element type to retrieve the definition for.
|
|
@@ -1212,6 +1239,8 @@ export declare class FASTElementDefinition<TType extends Constructable<HTMLEleme
|
|
|
1212
1239
|
|
|
1213
1240
|
/* Excluded from this release type: FASTGlobal */
|
|
1214
1241
|
|
|
1242
|
+
declare function from<TBase extends typeof HTMLElement>(BaseType: TBase): new () => InstanceType<TBase> & FASTElement;
|
|
1243
|
+
|
|
1215
1244
|
/**
|
|
1216
1245
|
* Transforms a template literal string into a ViewTemplate.
|
|
1217
1246
|
* @param strings - The string fragments that are interpolated with the values.
|
|
@@ -1228,9 +1257,7 @@ export declare function html<TSource = any, TParent = any>(strings: TemplateStri
|
|
|
1228
1257
|
* @public
|
|
1229
1258
|
*/
|
|
1230
1259
|
export declare class HTMLBindingDirective implements HTMLDirective, ViewBehaviorFactory, Aspected {
|
|
1231
|
-
|
|
1232
|
-
mode: BindingMode;
|
|
1233
|
-
options: any;
|
|
1260
|
+
dataBinding: Binding;
|
|
1234
1261
|
private factory;
|
|
1235
1262
|
/**
|
|
1236
1263
|
* The unique id of the factory.
|
|
@@ -1254,11 +1281,9 @@ export declare class HTMLBindingDirective implements HTMLDirective, ViewBehavior
|
|
|
1254
1281
|
aspectType: Aspect;
|
|
1255
1282
|
/**
|
|
1256
1283
|
* Creates an instance of HTMLBindingDirective.
|
|
1257
|
-
* @param
|
|
1258
|
-
* @param mode - The binding mode to use when applying the binding.
|
|
1259
|
-
* @param options - The options to configure the binding with.
|
|
1284
|
+
* @param dataBinding - The binding configuration to apply.
|
|
1260
1285
|
*/
|
|
1261
|
-
constructor(
|
|
1286
|
+
constructor(dataBinding: Binding);
|
|
1262
1287
|
/**
|
|
1263
1288
|
* Creates HTML to be used within a template.
|
|
1264
1289
|
* @param add - Can be used to add behavior factories to a template.
|
|
@@ -1423,6 +1448,15 @@ export declare interface LengthObserver extends Subscriber {
|
|
|
1423
1448
|
*/
|
|
1424
1449
|
export declare function lengthOf<T>(array: readonly T[]): number;
|
|
1425
1450
|
|
|
1451
|
+
/**
|
|
1452
|
+
* Creates an event listener binding.
|
|
1453
|
+
* @param binding - The binding to invoke when the event is raised.
|
|
1454
|
+
* @param options - Event listener options.
|
|
1455
|
+
* @returns A binding configuration.
|
|
1456
|
+
* @public
|
|
1457
|
+
*/
|
|
1458
|
+
export declare function listener<T = any>(binding: Expression<T>, options?: AddEventListenerOptions): Binding<T>;
|
|
1459
|
+
|
|
1426
1460
|
/**
|
|
1427
1461
|
* Common APIs related to markup generation.
|
|
1428
1462
|
* @public
|
|
@@ -1534,6 +1568,14 @@ export declare abstract class NodeObservationDirective<T extends NodeBehaviorOpt
|
|
|
1534
1568
|
protected abstract getNodes(target: any): Node[];
|
|
1535
1569
|
}
|
|
1536
1570
|
|
|
1571
|
+
/**
|
|
1572
|
+
* Normalizes the input value into a binding.
|
|
1573
|
+
* @param value - The value to create the default binding for.
|
|
1574
|
+
* @returns A binding configuration for the provided value.
|
|
1575
|
+
* @public
|
|
1576
|
+
*/
|
|
1577
|
+
export declare function normalizeBinding<TSource = any, TReturn = any, TParent = any>(value: Expression<TSource, TReturn, TParent> | Binding<TSource, TReturn, TParent> | {}): Binding<TSource, TReturn, TParent>;
|
|
1578
|
+
|
|
1537
1579
|
/**
|
|
1538
1580
|
* Provides change notifications for an observed subject.
|
|
1539
1581
|
* @public
|
|
@@ -1620,19 +1662,19 @@ export declare const Observable: Readonly<{
|
|
|
1620
1662
|
*/
|
|
1621
1663
|
getAccessors: (target: {}) => Accessor[];
|
|
1622
1664
|
/**
|
|
1623
|
-
* Creates a {@link
|
|
1624
|
-
* provided {@link
|
|
1665
|
+
* Creates a {@link ExpressionNotifier} that can watch the
|
|
1666
|
+
* provided {@link Expression} for changes.
|
|
1625
1667
|
* @param binding - The binding to observe.
|
|
1626
1668
|
* @param initialSubscriber - An initial subscriber to changes in the binding value.
|
|
1627
1669
|
* @param isVolatileBinding - Indicates whether the binding's dependency list must be re-evaluated on every value evaluation.
|
|
1628
1670
|
*/
|
|
1629
|
-
binding<TSource = any, TReturn = any>(binding:
|
|
1671
|
+
binding<TSource = any, TReturn = any>(binding: Expression<TSource, TReturn, any>, initialSubscriber?: Subscriber, isVolatileBinding?: boolean): ExpressionNotifier<TSource, TReturn, any>;
|
|
1630
1672
|
/**
|
|
1631
1673
|
* Determines whether a binding expression is volatile and needs to have its dependency list re-evaluated
|
|
1632
1674
|
* on every evaluation of the value.
|
|
1633
1675
|
* @param binding - The binding to inspect.
|
|
1634
1676
|
*/
|
|
1635
|
-
isVolatileBinding<TSource_1 = any, TReturn_1 = any>(binding:
|
|
1677
|
+
isVolatileBinding<TSource_1 = any, TReturn_1 = any>(binding: Expression<TSource_1, TReturn_1, any>): boolean;
|
|
1636
1678
|
}>;
|
|
1637
1679
|
|
|
1638
1680
|
/**
|
|
@@ -1659,30 +1701,12 @@ export declare interface ObservationRecord {
|
|
|
1659
1701
|
}
|
|
1660
1702
|
|
|
1661
1703
|
/**
|
|
1662
|
-
*
|
|
1663
|
-
* @
|
|
1664
|
-
|
|
1665
|
-
export declare const onChange: BindingConfig<AddEventListenerOptions> & BindingConfigResolver<AddEventListenerOptions>;
|
|
1666
|
-
|
|
1667
|
-
/**
|
|
1668
|
-
* The default onTime binding configuration.
|
|
1669
|
-
* @public
|
|
1670
|
-
*/
|
|
1671
|
-
export declare const oneTime: BindingConfig<AddEventListenerOptions> & BindingConfigResolver<AddEventListenerOptions>;
|
|
1672
|
-
|
|
1673
|
-
/**
|
|
1674
|
-
* A binding behavior for one-time bindings.
|
|
1704
|
+
* Creates a one time binding
|
|
1705
|
+
* @param binding - The binding to refresh when signaled.
|
|
1706
|
+
* @returns A binding configuration.
|
|
1675
1707
|
* @public
|
|
1676
1708
|
*/
|
|
1677
|
-
export declare
|
|
1678
|
-
/**
|
|
1679
|
-
* Bind this behavior to the source.
|
|
1680
|
-
* @param source - The source to bind to.
|
|
1681
|
-
* @param context - The execution context that the binding is operating within.
|
|
1682
|
-
* @param targets - The targets that behaviors in a view can attach to.
|
|
1683
|
-
*/
|
|
1684
|
-
bind(source: any, context: ExecutionContext, targets: ViewBehaviorTargets): void;
|
|
1685
|
-
}
|
|
1709
|
+
export declare function oneTime<T = any>(binding: Expression<T>): Binding<T>;
|
|
1686
1710
|
|
|
1687
1711
|
/**
|
|
1688
1712
|
* Common APIs related to content parsing.
|
|
@@ -1809,23 +1833,21 @@ declare const reflectMode = "reflect";
|
|
|
1809
1833
|
|
|
1810
1834
|
/**
|
|
1811
1835
|
* A directive that enables list rendering.
|
|
1812
|
-
* @param
|
|
1813
|
-
* @param
|
|
1836
|
+
* @param items - The array to render.
|
|
1837
|
+
* @param template - The template or a template binding used obtain a template
|
|
1814
1838
|
* to render for each item in the array.
|
|
1815
1839
|
* @param options - Options used to turn on special repeat features.
|
|
1816
1840
|
* @public
|
|
1817
1841
|
*/
|
|
1818
|
-
export declare function repeat<TSource = any, TArray extends ReadonlyArray<any> = ReadonlyArray<any>>(
|
|
1842
|
+
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>;
|
|
1819
1843
|
|
|
1820
1844
|
/**
|
|
1821
1845
|
* A behavior that renders a template for each item in an array.
|
|
1822
1846
|
* @public
|
|
1823
1847
|
*/
|
|
1824
1848
|
export declare class RepeatBehavior<TSource = any> implements Behavior, Subscriber {
|
|
1849
|
+
private directive;
|
|
1825
1850
|
private location;
|
|
1826
|
-
private itemsBinding;
|
|
1827
|
-
private templateBinding;
|
|
1828
|
-
private options;
|
|
1829
1851
|
private source;
|
|
1830
1852
|
private views;
|
|
1831
1853
|
private template;
|
|
@@ -1839,13 +1861,13 @@ export declare class RepeatBehavior<TSource = any> implements Behavior, Subscrib
|
|
|
1839
1861
|
/**
|
|
1840
1862
|
* Creates an instance of RepeatBehavior.
|
|
1841
1863
|
* @param location - The location in the DOM to render the repeat.
|
|
1842
|
-
* @param
|
|
1864
|
+
* @param dataBinding - The array to render.
|
|
1843
1865
|
* @param isItemsBindingVolatile - Indicates whether the items binding has volatile dependencies.
|
|
1844
1866
|
* @param templateBinding - The template to render for each item.
|
|
1845
1867
|
* @param isTemplateBindingVolatile - Indicates whether the template binding has volatile dependencies.
|
|
1846
1868
|
* @param options - Options used to turn on special repeat features.
|
|
1847
1869
|
*/
|
|
1848
|
-
constructor(
|
|
1870
|
+
constructor(directive: RepeatDirective, location: Node);
|
|
1849
1871
|
/**
|
|
1850
1872
|
* Bind this behavior to the source.
|
|
1851
1873
|
* @param source - The source to bind to.
|
|
@@ -1862,7 +1884,7 @@ export declare class RepeatBehavior<TSource = any> implements Behavior, Subscrib
|
|
|
1862
1884
|
* @param source - The source of the change.
|
|
1863
1885
|
* @param args - The details about what was changed.
|
|
1864
1886
|
*/
|
|
1865
|
-
handleChange(source: any, args: Splice[]): void;
|
|
1887
|
+
handleChange(source: any, args: Splice[] | ExpressionObserver): void;
|
|
1866
1888
|
private observeItems;
|
|
1867
1889
|
private updateViews;
|
|
1868
1890
|
private refreshAllViews;
|
|
@@ -1874,11 +1896,9 @@ export declare class RepeatBehavior<TSource = any> implements Behavior, Subscrib
|
|
|
1874
1896
|
* @public
|
|
1875
1897
|
*/
|
|
1876
1898
|
export declare class RepeatDirective<TSource = any> implements HTMLDirective, ViewBehaviorFactory {
|
|
1877
|
-
readonly
|
|
1899
|
+
readonly dataBinding: Binding<TSource>;
|
|
1878
1900
|
readonly templateBinding: Binding<TSource, SyntheticViewTemplate>;
|
|
1879
1901
|
readonly options: RepeatOptions;
|
|
1880
|
-
private isItemsBindingVolatile;
|
|
1881
|
-
private isTemplateBindingVolatile;
|
|
1882
1902
|
/**
|
|
1883
1903
|
* The unique id of the factory.
|
|
1884
1904
|
*/
|
|
@@ -1894,11 +1914,11 @@ export declare class RepeatDirective<TSource = any> implements HTMLDirective, Vi
|
|
|
1894
1914
|
createHTML(add: AddViewBehaviorFactory): string;
|
|
1895
1915
|
/**
|
|
1896
1916
|
* Creates an instance of RepeatDirective.
|
|
1897
|
-
* @param
|
|
1917
|
+
* @param dataBinding - The binding that provides the array to render.
|
|
1898
1918
|
* @param templateBinding - The template binding used to obtain a template to render for each item in the array.
|
|
1899
1919
|
* @param options - Options used to turn on special repeat features.
|
|
1900
1920
|
*/
|
|
1901
|
-
constructor(
|
|
1921
|
+
constructor(dataBinding: Binding<TSource>, templateBinding: Binding<TSource, SyntheticViewTemplate>, options: RepeatOptions);
|
|
1902
1922
|
/**
|
|
1903
1923
|
* Creates a behavior for the provided target node.
|
|
1904
1924
|
* @param target - The node instance to create the behavior for.
|
|
@@ -2316,7 +2336,7 @@ export declare interface SyntheticViewTemplate<TSource = any, TParent = any> {
|
|
|
2316
2336
|
* Represents the types of values that can be interpolated into a template.
|
|
2317
2337
|
* @public
|
|
2318
2338
|
*/
|
|
2319
|
-
export declare type TemplateValue<TSource, TParent = any> = Binding<TSource, any, TParent> | HTMLDirective | CaptureType<TSource>;
|
|
2339
|
+
export declare type TemplateValue<TSource, TParent = any> = Expression<TSource, any, TParent> | Binding<TSource, any, TParent> | HTMLDirective | CaptureType<TSource>;
|
|
2320
2340
|
|
|
2321
2341
|
/**
|
|
2322
2342
|
* Enables working with trusted types.
|
|
@@ -2347,40 +2367,6 @@ export declare type TrustedTypesPolicy = {
|
|
|
2347
2367
|
|
|
2348
2368
|
/* Excluded from this release type: TypeRegistry */
|
|
2349
2369
|
|
|
2350
|
-
/**
|
|
2351
|
-
* A base binding behavior for DOM updates.
|
|
2352
|
-
* @public
|
|
2353
|
-
*/
|
|
2354
|
-
export declare class UpdateBinding implements ViewBehavior {
|
|
2355
|
-
readonly directive: HTMLBindingDirective;
|
|
2356
|
-
protected updateTarget: UpdateTarget;
|
|
2357
|
-
/**
|
|
2358
|
-
* Creates an instance of UpdateBinding.
|
|
2359
|
-
* @param directive - The directive that has the configuration for this behavior.
|
|
2360
|
-
* @param updateTarget - The function used to update the target with the latest value.
|
|
2361
|
-
*/
|
|
2362
|
-
constructor(directive: HTMLBindingDirective, updateTarget: UpdateTarget);
|
|
2363
|
-
/**
|
|
2364
|
-
* Bind this behavior to the source.
|
|
2365
|
-
* @param source - The source to bind to.
|
|
2366
|
-
* @param context - The execution context that the binding is operating within.
|
|
2367
|
-
* @param targets - The targets that behaviors in a view can attach to.
|
|
2368
|
-
*/
|
|
2369
|
-
bind(source: any, context: ExecutionContext, targets: ViewBehaviorTargets): void;
|
|
2370
|
-
/**
|
|
2371
|
-
* Unbinds this behavior from the source.
|
|
2372
|
-
* @param source - The source to unbind from.
|
|
2373
|
-
* @param context - The execution context that the binding is operating within.
|
|
2374
|
-
* @param targets - The targets that behaviors in a view can attach to.
|
|
2375
|
-
*/
|
|
2376
|
-
unbind(source: any, context: ExecutionContext, targets: ViewBehaviorTargets): void;
|
|
2377
|
-
/**
|
|
2378
|
-
* Creates a behavior.
|
|
2379
|
-
* @param targets - The targets available for behaviors to be attached to.
|
|
2380
|
-
*/
|
|
2381
|
-
createBehavior(targets: ViewBehaviorTargets): ViewBehavior;
|
|
2382
|
-
}
|
|
2383
|
-
|
|
2384
2370
|
/**
|
|
2385
2371
|
* A work queue used to synchronize writes to the DOM.
|
|
2386
2372
|
* @public
|
|
@@ -2585,11 +2571,11 @@ export declare function volatile(target: {}, name: string | Accessor, descriptor
|
|
|
2585
2571
|
|
|
2586
2572
|
/**
|
|
2587
2573
|
* A directive that enables basic conditional rendering in a template.
|
|
2588
|
-
* @param
|
|
2574
|
+
* @param condition - The condition to test for rendering.
|
|
2589
2575
|
* @param templateOrTemplateBinding - The template or a binding that gets
|
|
2590
2576
|
* the template to render when the condition is true.
|
|
2591
2577
|
* @public
|
|
2592
2578
|
*/
|
|
2593
|
-
export declare function when<TSource = any, TReturn = any>(
|
|
2579
|
+
export declare function when<TSource = any, TReturn = any>(condition: Expression<TSource, TReturn> | boolean, templateOrTemplateBinding: SyntheticViewTemplate | Expression<TSource, SyntheticViewTemplate>): CaptureType<TSource>;
|
|
2594
2580
|
|
|
2595
2581
|
export { }
|