@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
|
@@ -159,7 +159,7 @@ export declare interface Aspected {
|
|
|
159
159
|
/**
|
|
160
160
|
* A binding if one is associated with the aspect.
|
|
161
161
|
*/
|
|
162
|
-
|
|
162
|
+
dataBinding?: Binding;
|
|
163
163
|
}
|
|
164
164
|
|
|
165
165
|
/**
|
|
@@ -286,102 +286,81 @@ export declare interface Behavior<TSource = any, TParent = any> {
|
|
|
286
286
|
}
|
|
287
287
|
|
|
288
288
|
/**
|
|
289
|
-
* Creates
|
|
290
|
-
* @param binding - The binding
|
|
291
|
-
* @param
|
|
292
|
-
* @returns A binding
|
|
289
|
+
* Creates an standard binding.
|
|
290
|
+
* @param binding - The binding to refresh when changed.
|
|
291
|
+
* @param isVolatile - Indicates whether the binding is volatile or not.
|
|
292
|
+
* @returns A binding configuration.
|
|
293
293
|
* @public
|
|
294
294
|
*/
|
|
295
|
-
export declare function bind<T = any>(binding:
|
|
295
|
+
export declare function bind<T = any>(binding: Expression<T>, isVolatile?: boolean): Binding<T>;
|
|
296
296
|
|
|
297
297
|
/**
|
|
298
|
-
*
|
|
299
|
-
*
|
|
300
|
-
* @public
|
|
301
|
-
*/
|
|
302
|
-
export declare type Binding<TSource = any, TReturn = any, TParent = any> = (source: TSource, context: ExecutionContext<TParent>) => TReturn;
|
|
303
|
-
|
|
304
|
-
/**
|
|
305
|
-
* Describes the configuration for a binding expression.
|
|
298
|
+
* Captures a binding expression along with related information and capabilities.
|
|
299
|
+
*
|
|
306
300
|
* @public
|
|
307
301
|
*/
|
|
308
|
-
export declare
|
|
302
|
+
export declare abstract class Binding<TSource = any, TReturn = any, TParent = any> {
|
|
303
|
+
/**
|
|
304
|
+
* Options associated with the binding.
|
|
305
|
+
*/
|
|
306
|
+
options?: any;
|
|
309
307
|
/**
|
|
310
|
-
*
|
|
308
|
+
* Whether or not the binding is volatile.
|
|
311
309
|
*/
|
|
312
|
-
|
|
310
|
+
isVolatile?: boolean;
|
|
313
311
|
/**
|
|
314
|
-
*
|
|
312
|
+
* Evaluates the binding expression.
|
|
315
313
|
*/
|
|
316
|
-
|
|
314
|
+
evaluate: Expression<TSource, TReturn, TParent>;
|
|
315
|
+
/**
|
|
316
|
+
* Creates an observer capable of notifying a subscriber when the output of a binding changes.
|
|
317
|
+
* @param directive - The HTML Directive to create the observer for.
|
|
318
|
+
* @param subscriber - The subscriber to changes in the binding.
|
|
319
|
+
*/
|
|
320
|
+
abstract createObserver(directive: HTMLDirective, subscriber: Subscriber): ExpressionObserver<TSource, TReturn, TParent>;
|
|
317
321
|
}
|
|
318
322
|
|
|
319
323
|
/**
|
|
320
|
-
*
|
|
324
|
+
* A binding behavior for bindings that change.
|
|
321
325
|
* @public
|
|
322
326
|
*/
|
|
323
|
-
export declare
|
|
327
|
+
export declare class BindingBehavior implements ViewBehavior {
|
|
328
|
+
readonly directive: HTMLBindingDirective;
|
|
329
|
+
protected updateTarget: UpdateTarget;
|
|
330
|
+
private observerProperty;
|
|
324
331
|
/**
|
|
325
|
-
* Creates
|
|
326
|
-
* @param
|
|
327
|
-
* @param
|
|
328
|
-
* @returns A new binding configuration.
|
|
332
|
+
* Creates an instance of ChangeBinding.
|
|
333
|
+
* @param directive - The directive that has the configuration for this behavior.
|
|
334
|
+
* @param updateTarget - The function used to update the target with the latest value.
|
|
329
335
|
*/
|
|
330
|
-
|
|
331
|
-
}>;
|
|
332
|
-
|
|
333
|
-
/**
|
|
334
|
-
* Creates a new binding configuration based on the supplied options.
|
|
335
|
-
* @public
|
|
336
|
-
*/
|
|
337
|
-
export declare type BindingConfigResolver<T> = (options: T) => BindingConfig<T>;
|
|
338
|
-
|
|
339
|
-
/**
|
|
340
|
-
* Describes how aspects of an HTML element will be affected by bindings.
|
|
341
|
-
* @public
|
|
342
|
-
*/
|
|
343
|
-
export declare type BindingMode = Record<Aspect, (directive: HTMLBindingDirective) => Pick<ViewBehaviorFactory, "createBehavior">>;
|
|
344
|
-
|
|
345
|
-
/**
|
|
346
|
-
* Describes how aspects of an HTML element will be affected by bindings.
|
|
347
|
-
* @public
|
|
348
|
-
*/
|
|
349
|
-
export declare const BindingMode: Readonly<{
|
|
336
|
+
constructor(directive: HTMLBindingDirective, updateTarget: UpdateTarget);
|
|
350
337
|
/**
|
|
351
|
-
*
|
|
352
|
-
* @param
|
|
353
|
-
* @param
|
|
354
|
-
* @
|
|
338
|
+
* Bind this behavior to the source.
|
|
339
|
+
* @param source - The source to bind to.
|
|
340
|
+
* @param context - The execution context that the binding is operating within.
|
|
341
|
+
* @param targets - The targets that behaviors in a view can attach to.
|
|
355
342
|
*/
|
|
356
|
-
|
|
357
|
-
}>;
|
|
358
|
-
|
|
359
|
-
/**
|
|
360
|
-
* Enables evaluation of and subscription to a binding.
|
|
361
|
-
* @public
|
|
362
|
-
*/
|
|
363
|
-
export declare interface BindingObserver<TSource = any, TReturn = any, TParent = any> extends Notifier, Disposable {
|
|
343
|
+
bind(source: any, context: ExecutionContext, targets: ViewBehaviorTargets): void;
|
|
364
344
|
/**
|
|
365
|
-
*
|
|
366
|
-
* @param source - The source
|
|
367
|
-
* @param context - The execution context
|
|
368
|
-
* @
|
|
345
|
+
* Unbinds this behavior from the source.
|
|
346
|
+
* @param source - The source to unbind from.
|
|
347
|
+
* @param context - The execution context that the binding is operating within.
|
|
348
|
+
* @param targets - The targets that behaviors in a view can attach to.
|
|
369
349
|
*/
|
|
370
|
-
|
|
350
|
+
unbind(source: any, context: ExecutionContext, targets: ViewBehaviorTargets): void;
|
|
351
|
+
/** @internal */
|
|
352
|
+
handleChange(binding: Expression, observer: ExpressionObserver): void;
|
|
371
353
|
/**
|
|
372
|
-
*
|
|
373
|
-
*
|
|
354
|
+
* Returns the binding observer used to update the node.
|
|
355
|
+
* @param target - The target node.
|
|
356
|
+
* @returns A BindingObserver.
|
|
374
357
|
*/
|
|
375
|
-
|
|
358
|
+
protected getObserver(target: Node): ExpressionObserver;
|
|
376
359
|
/**
|
|
377
|
-
*
|
|
378
|
-
* @param
|
|
379
|
-
* @remarks
|
|
380
|
-
* By default, the update mode is asynchronous, since that provides the best
|
|
381
|
-
* performance for template rendering scenarios. Passing false to setMode will
|
|
382
|
-
* instead cause the observer to notify subscribers immediately when changes occur.
|
|
360
|
+
* Creates a behavior.
|
|
361
|
+
* @param targets - The targets available for behaviors to be attached to.
|
|
383
362
|
*/
|
|
384
|
-
|
|
363
|
+
createBehavior(targets: ViewBehaviorTargets): ViewBehavior;
|
|
385
364
|
}
|
|
386
365
|
|
|
387
366
|
/**
|
|
@@ -410,43 +389,6 @@ export declare type Callable = typeof Function.prototype.call | {
|
|
|
410
389
|
export declare interface CaptureType<TSource> {
|
|
411
390
|
}
|
|
412
391
|
|
|
413
|
-
/**
|
|
414
|
-
* A binding behavior for bindings that change.
|
|
415
|
-
* @public
|
|
416
|
-
*/
|
|
417
|
-
export declare class ChangeBinding extends UpdateBinding {
|
|
418
|
-
private isBindingVolatile;
|
|
419
|
-
private observerProperty;
|
|
420
|
-
/**
|
|
421
|
-
* Creates an instance of ChangeBinding.
|
|
422
|
-
* @param directive - The directive that has the configuration for this behavior.
|
|
423
|
-
* @param updateTarget - The function used to update the target with the latest value.
|
|
424
|
-
*/
|
|
425
|
-
constructor(directive: HTMLBindingDirective, updateTarget: UpdateTarget);
|
|
426
|
-
/**
|
|
427
|
-
* Returns the binding observer used to update the node.
|
|
428
|
-
* @param target - The target node.
|
|
429
|
-
* @returns A BindingObserver.
|
|
430
|
-
*/
|
|
431
|
-
protected getObserver(target: Node): BindingObserver;
|
|
432
|
-
/**
|
|
433
|
-
* Bind this behavior to the source.
|
|
434
|
-
* @param source - The source to bind to.
|
|
435
|
-
* @param context - The execution context that the binding is operating within.
|
|
436
|
-
* @param targets - The targets that behaviors in a view can attach to.
|
|
437
|
-
*/
|
|
438
|
-
bind(source: any, context: ExecutionContext, targets: ViewBehaviorTargets): void;
|
|
439
|
-
/**
|
|
440
|
-
* Unbinds this behavior from the source.
|
|
441
|
-
* @param source - The source to unbind from.
|
|
442
|
-
* @param context - The execution context that the binding is operating within.
|
|
443
|
-
* @param targets - The targets that behaviors in a view can attach to.
|
|
444
|
-
*/
|
|
445
|
-
unbind(source: any, context: ExecutionContext, targets: ViewBehaviorTargets): void;
|
|
446
|
-
/** @internal */
|
|
447
|
-
handleChange(binding: Binding, observer: BindingObserver): void;
|
|
448
|
-
}
|
|
449
|
-
|
|
450
392
|
/**
|
|
451
393
|
* The options used to configure child list observation.
|
|
452
394
|
* @public
|
|
@@ -558,6 +500,10 @@ export declare const Compiler: {
|
|
|
558
500
|
*/
|
|
559
501
|
export declare type ComposableStyles = string | ElementStyles | CSSStyleSheet;
|
|
560
502
|
|
|
503
|
+
declare function compose<TType extends Constructable<HTMLElement> = Constructable<HTMLElement>>(this: TType, nameOrDef: string | PartialFASTElementDefinition): FASTElementDefinition<TType>;
|
|
504
|
+
|
|
505
|
+
declare function compose<TType extends Constructable<HTMLElement> = Constructable<HTMLElement>>(type: TType, nameOrDef?: string | PartialFASTElementDefinition): FASTElementDefinition<TType>;
|
|
506
|
+
|
|
561
507
|
/**
|
|
562
508
|
* Allows for the creation of Constructable mixin classes.
|
|
563
509
|
*
|
|
@@ -579,6 +525,58 @@ export declare type ConstructibleStyleStrategy = {
|
|
|
579
525
|
new (styles: (string | CSSStyleSheet)[]): StyleStrategy;
|
|
580
526
|
};
|
|
581
527
|
|
|
528
|
+
/**
|
|
529
|
+
* A special binding behavior that can bind node content.
|
|
530
|
+
* @public
|
|
531
|
+
*/
|
|
532
|
+
export declare class ContentBehavior extends BindingBehavior {
|
|
533
|
+
/**
|
|
534
|
+
* Unbinds this behavior from the source.
|
|
535
|
+
* @param source - The source to unbind from.
|
|
536
|
+
* @param context - The execution context that the binding is operating within.
|
|
537
|
+
* @param targets - The targets that behaviors in a view can attach to.
|
|
538
|
+
*/
|
|
539
|
+
unbind(source: any, context: ExecutionContext, targets: ViewBehaviorTargets): void;
|
|
540
|
+
}
|
|
541
|
+
|
|
542
|
+
/**
|
|
543
|
+
* A simple template that can create ContentView instances.
|
|
544
|
+
* @public
|
|
545
|
+
*/
|
|
546
|
+
export declare interface ContentTemplate {
|
|
547
|
+
/**
|
|
548
|
+
* Creates a simple content view instance.
|
|
549
|
+
*/
|
|
550
|
+
create(): ContentView;
|
|
551
|
+
}
|
|
552
|
+
|
|
553
|
+
/**
|
|
554
|
+
* A simple View that can be interpolated into HTML content.
|
|
555
|
+
* @public
|
|
556
|
+
*/
|
|
557
|
+
export declare interface ContentView {
|
|
558
|
+
/**
|
|
559
|
+
* Binds a view's behaviors to its binding source.
|
|
560
|
+
* @param source - The binding source for the view's binding behaviors.
|
|
561
|
+
* @param context - The execution context to run the view within.
|
|
562
|
+
*/
|
|
563
|
+
bind(source: any, context: ExecutionContext): void;
|
|
564
|
+
/**
|
|
565
|
+
* Unbinds a view's behaviors from its binding source and context.
|
|
566
|
+
*/
|
|
567
|
+
unbind(): void;
|
|
568
|
+
/**
|
|
569
|
+
* Inserts the view's DOM nodes before the referenced node.
|
|
570
|
+
* @param node - The node to insert the view's DOM before.
|
|
571
|
+
*/
|
|
572
|
+
insertBefore(node: Node): void;
|
|
573
|
+
/**
|
|
574
|
+
* Removes the view's DOM nodes.
|
|
575
|
+
* The nodes are not disposed and the view can later be re-inserted.
|
|
576
|
+
*/
|
|
577
|
+
remove(): void;
|
|
578
|
+
}
|
|
579
|
+
|
|
582
580
|
/**
|
|
583
581
|
* Controls the lifecycle and rendering of a `FASTElement`.
|
|
584
582
|
* @public
|
|
@@ -809,11 +807,9 @@ export declare function customElement(nameOrDef: string | PartialFASTElementDefi
|
|
|
809
807
|
*/
|
|
810
808
|
export declare type DecoratorAttributeConfiguration = Omit<AttributeConfiguration, "property">;
|
|
811
809
|
|
|
812
|
-
|
|
813
|
-
|
|
814
|
-
|
|
815
|
-
*/
|
|
816
|
-
export declare type DefaultBindingOptions = AddEventListenerOptions;
|
|
810
|
+
declare function define<TType extends Constructable<HTMLElement> = Constructable<HTMLElement>>(this: TType, nameOrDef: string | PartialFASTElementDefinition): TType;
|
|
811
|
+
|
|
812
|
+
declare function define<TType extends Constructable<HTMLElement> = Constructable<HTMLElement>>(type: TType, nameOrDef?: string | PartialFASTElementDefinition): TType;
|
|
817
813
|
|
|
818
814
|
/**
|
|
819
815
|
* Provides a mechanism for releasing resources.
|
|
@@ -923,6 +919,12 @@ export declare class ElementStyles {
|
|
|
923
919
|
* @param Strategy - The strategy type to construct.
|
|
924
920
|
*/
|
|
925
921
|
static setDefaultStrategy(Strategy: ConstructibleStyleStrategy): void;
|
|
922
|
+
/**
|
|
923
|
+
* Normalizes a set of composable style options.
|
|
924
|
+
* @param styles - The style options to normalize.
|
|
925
|
+
* @returns A singular ElementStyles instance or undefined.
|
|
926
|
+
*/
|
|
927
|
+
static normalize(styles: ComposableStyles | ComposableStyles[] | undefined): ElementStyles | undefined;
|
|
926
928
|
/**
|
|
927
929
|
* Indicates whether the DOM supports the adoptedStyleSheets feature.
|
|
928
930
|
*/
|
|
@@ -974,7 +976,7 @@ export declare const emptyArray: readonly never[];
|
|
|
974
976
|
* A binding behavior for handling events.
|
|
975
977
|
* @public
|
|
976
978
|
*/
|
|
977
|
-
export declare class
|
|
979
|
+
export declare class EventBehavior {
|
|
978
980
|
readonly directive: HTMLBindingDirective;
|
|
979
981
|
private contextProperty;
|
|
980
982
|
private sourceProperty;
|
|
@@ -1103,6 +1105,48 @@ export declare class ExecutionContext<TParentSource = any> {
|
|
|
1103
1105
|
static create(): ExecutionContext;
|
|
1104
1106
|
}
|
|
1105
1107
|
|
|
1108
|
+
/**
|
|
1109
|
+
* The signature of an arrow function capable of being evaluated
|
|
1110
|
+
* against source data and within an execution context.
|
|
1111
|
+
* @public
|
|
1112
|
+
*/
|
|
1113
|
+
export declare type Expression<TSource = any, TReturn = any, TParent = any> = (source: TSource, context: ExecutionContext<TParent>) => TReturn;
|
|
1114
|
+
|
|
1115
|
+
/**
|
|
1116
|
+
* Enables evaluation of and subscription to a binding.
|
|
1117
|
+
* @public
|
|
1118
|
+
*/
|
|
1119
|
+
export declare interface ExpressionNotifier<TSource = any, TReturn = any, TParent = any> extends Notifier, ExpressionObserver<TSource, TReturn, TParent> {
|
|
1120
|
+
/**
|
|
1121
|
+
* Gets {@link ObservationRecord|ObservationRecords} that the {@link ExpressionNotifier}
|
|
1122
|
+
* is observing.
|
|
1123
|
+
*/
|
|
1124
|
+
records(): IterableIterator<ObservationRecord>;
|
|
1125
|
+
/**
|
|
1126
|
+
* Sets the update mode used by the observer.
|
|
1127
|
+
* @param isAsync - Indicates whether updates should be asynchronous.
|
|
1128
|
+
* @remarks
|
|
1129
|
+
* By default, the update mode is asynchronous, since that provides the best
|
|
1130
|
+
* performance for template rendering scenarios. Passing false to setMode will
|
|
1131
|
+
* instead cause the observer to notify subscribers immediately when changes occur.
|
|
1132
|
+
*/
|
|
1133
|
+
setMode(isAsync: boolean): void;
|
|
1134
|
+
}
|
|
1135
|
+
|
|
1136
|
+
/**
|
|
1137
|
+
* Observes a binding for changes.
|
|
1138
|
+
*
|
|
1139
|
+
* @public
|
|
1140
|
+
*/
|
|
1141
|
+
export declare interface ExpressionObserver<TSource = any, TReturn = any, TParent = any> extends Disposable {
|
|
1142
|
+
/**
|
|
1143
|
+
* Begins observing the binding.
|
|
1144
|
+
* @param source - The source to pass to the binding.
|
|
1145
|
+
* @param context - The context to pass to the binding.
|
|
1146
|
+
*/
|
|
1147
|
+
observe(source: TSource, context?: ExecutionContext<TParent>): TReturn;
|
|
1148
|
+
}
|
|
1149
|
+
|
|
1106
1150
|
/**
|
|
1107
1151
|
* The FAST global.
|
|
1108
1152
|
* @internal
|
|
@@ -1159,29 +1203,11 @@ export declare interface FASTElement extends HTMLElement {
|
|
|
1159
1203
|
* static helpers for working with FASTElements.
|
|
1160
1204
|
* @public
|
|
1161
1205
|
*/
|
|
1162
|
-
export declare const FASTElement:
|
|
1163
|
-
|
|
1164
|
-
|
|
1165
|
-
|
|
1166
|
-
|
|
1167
|
-
*/
|
|
1168
|
-
from<TBase extends {
|
|
1169
|
-
new (): HTMLElement;
|
|
1170
|
-
prototype: HTMLElement;
|
|
1171
|
-
}>(BaseType: TBase): new () => InstanceType<TBase> & FASTElement;
|
|
1172
|
-
/**
|
|
1173
|
-
* Defines a platform custom element based on the provided type and definition.
|
|
1174
|
-
* @param type - The custom element type to define.
|
|
1175
|
-
* @param nameOrDef - The name of the element to define or a definition object
|
|
1176
|
-
* that describes the element to define.
|
|
1177
|
-
*/
|
|
1178
|
-
define<TType extends Constructable<HTMLElement>>(type: TType, nameOrDef?: string | PartialFASTElementDefinition): TType;
|
|
1179
|
-
/**
|
|
1180
|
-
* Defines metadata for a FASTElement which can be used to later define the element.
|
|
1181
|
-
* IMPORTANT: This API will be renamed to "compose" in a future beta.
|
|
1182
|
-
* @public
|
|
1183
|
-
*/
|
|
1184
|
-
metadata<TType_1 extends Constructable<HTMLElement> = Constructable<HTMLElement>>(type: TType_1, nameOrDef?: string | PartialFASTElementDefinition): FASTElementDefinition<TType_1>;
|
|
1206
|
+
export declare const FASTElement: {
|
|
1207
|
+
new (): FASTElement;
|
|
1208
|
+
define: typeof define;
|
|
1209
|
+
compose: typeof compose;
|
|
1210
|
+
from: typeof from;
|
|
1185
1211
|
};
|
|
1186
1212
|
|
|
1187
1213
|
/**
|
|
@@ -1189,7 +1215,7 @@ export declare const FASTElement: (new () => HTMLElement & FASTElement) & {
|
|
|
1189
1215
|
* @public
|
|
1190
1216
|
*/
|
|
1191
1217
|
export declare class FASTElementDefinition<TType extends Constructable<HTMLElement> = Constructable<HTMLElement>> {
|
|
1192
|
-
private
|
|
1218
|
+
private platformDefined;
|
|
1193
1219
|
/**
|
|
1194
1220
|
* The type this element definition describes.
|
|
1195
1221
|
*/
|
|
@@ -1230,13 +1256,7 @@ export declare class FASTElementDefinition<TType extends Constructable<HTMLEleme
|
|
|
1230
1256
|
* Options controlling how the custom element is defined with the platform.
|
|
1231
1257
|
*/
|
|
1232
1258
|
readonly elementOptions?: ElementDefinitionOptions;
|
|
1233
|
-
|
|
1234
|
-
* Creates an instance of FASTElementDefinition.
|
|
1235
|
-
* @param type - The type this definition is being created for.
|
|
1236
|
-
* @param nameOrConfig - The name of the element to define or a config object
|
|
1237
|
-
* that describes the element to define.
|
|
1238
|
-
*/
|
|
1239
|
-
constructor(type: TType, nameOrConfig?: PartialFASTElementDefinition | string);
|
|
1259
|
+
private constructor();
|
|
1240
1260
|
/**
|
|
1241
1261
|
* Defines a custom element based on this definition.
|
|
1242
1262
|
* @param registry - The element registry to define the element in.
|
|
@@ -1244,6 +1264,13 @@ export declare class FASTElementDefinition<TType extends Constructable<HTMLEleme
|
|
|
1244
1264
|
* This operation is idempotent per registry.
|
|
1245
1265
|
*/
|
|
1246
1266
|
define(registry?: CustomElementRegistry): this;
|
|
1267
|
+
/**
|
|
1268
|
+
* Creates an instance of FASTElementDefinition.
|
|
1269
|
+
* @param type - The type this definition is being created for.
|
|
1270
|
+
* @param nameOrDef - The name of the element to define or a config object
|
|
1271
|
+
* that describes the element to define.
|
|
1272
|
+
*/
|
|
1273
|
+
static compose<TType extends Constructable<HTMLElement> = Constructable<HTMLElement>>(type: TType, nameOrDef?: string | PartialFASTElementDefinition): FASTElementDefinition<TType>;
|
|
1247
1274
|
/**
|
|
1248
1275
|
* Gets the element definition associated with the specified type.
|
|
1249
1276
|
* @param type - The custom element type to retrieve the definition for.
|
|
@@ -1275,22 +1302,27 @@ export declare interface FASTGlobal {
|
|
|
1275
1302
|
/**
|
|
1276
1303
|
* Sends a warning to the developer.
|
|
1277
1304
|
* @param code - The warning code to send.
|
|
1278
|
-
* @param
|
|
1305
|
+
* @param values - Values relevant for the warning message.
|
|
1279
1306
|
*/
|
|
1280
|
-
warn(code: number,
|
|
1307
|
+
warn(code: number, values?: Record<string, any>): void;
|
|
1281
1308
|
/**
|
|
1282
1309
|
* Creates an error.
|
|
1283
1310
|
* @param code - The error code to send.
|
|
1284
|
-
* @param
|
|
1311
|
+
* @param values - Values relevant for the error message.
|
|
1285
1312
|
*/
|
|
1286
|
-
error(code: number,
|
|
1313
|
+
error(code: number, values?: Record<string, any>): Error;
|
|
1287
1314
|
/**
|
|
1288
1315
|
* Adds debug messages for errors and warnings.
|
|
1289
1316
|
* @param messages - The message dictionary to add.
|
|
1317
|
+
* @remarks
|
|
1318
|
+
* Message can include placeholders like $\{name\} which can be
|
|
1319
|
+
* replaced by values passed at runtime.
|
|
1290
1320
|
*/
|
|
1291
1321
|
addMessages(messages: Record<number, string>): void;
|
|
1292
1322
|
}
|
|
1293
1323
|
|
|
1324
|
+
declare function from<TBase extends typeof HTMLElement>(BaseType: TBase): new () => InstanceType<TBase> & FASTElement;
|
|
1325
|
+
|
|
1294
1326
|
/**
|
|
1295
1327
|
* Transforms a template literal string into a ViewTemplate.
|
|
1296
1328
|
* @param strings - The string fragments that are interpolated with the values.
|
|
@@ -1307,9 +1339,7 @@ export declare function html<TSource = any, TParent = any>(strings: TemplateStri
|
|
|
1307
1339
|
* @public
|
|
1308
1340
|
*/
|
|
1309
1341
|
export declare class HTMLBindingDirective implements HTMLDirective, ViewBehaviorFactory, Aspected {
|
|
1310
|
-
|
|
1311
|
-
mode: BindingMode;
|
|
1312
|
-
options: any;
|
|
1342
|
+
dataBinding: Binding;
|
|
1313
1343
|
private factory;
|
|
1314
1344
|
/**
|
|
1315
1345
|
* The unique id of the factory.
|
|
@@ -1333,11 +1363,9 @@ export declare class HTMLBindingDirective implements HTMLDirective, ViewBehavior
|
|
|
1333
1363
|
aspectType: Aspect;
|
|
1334
1364
|
/**
|
|
1335
1365
|
* Creates an instance of HTMLBindingDirective.
|
|
1336
|
-
* @param
|
|
1337
|
-
* @param mode - The binding mode to use when applying the binding.
|
|
1338
|
-
* @param options - The options to configure the binding with.
|
|
1366
|
+
* @param dataBinding - The binding configuration to apply.
|
|
1339
1367
|
*/
|
|
1340
|
-
constructor(
|
|
1368
|
+
constructor(dataBinding: Binding);
|
|
1341
1369
|
/**
|
|
1342
1370
|
* Creates HTML to be used within a template.
|
|
1343
1371
|
* @param add - Can be used to add behavior factories to a template.
|
|
@@ -1502,6 +1530,15 @@ export declare interface LengthObserver extends Subscriber {
|
|
|
1502
1530
|
*/
|
|
1503
1531
|
export declare function lengthOf<T>(array: readonly T[]): number;
|
|
1504
1532
|
|
|
1533
|
+
/**
|
|
1534
|
+
* Creates an event listener binding.
|
|
1535
|
+
* @param binding - The binding to invoke when the event is raised.
|
|
1536
|
+
* @param options - Event listener options.
|
|
1537
|
+
* @returns A binding configuration.
|
|
1538
|
+
* @public
|
|
1539
|
+
*/
|
|
1540
|
+
export declare function listener<T = any>(binding: Expression<T>, options?: AddEventListenerOptions): Binding<T>;
|
|
1541
|
+
|
|
1505
1542
|
/**
|
|
1506
1543
|
* Common APIs related to markup generation.
|
|
1507
1544
|
* @public
|
|
@@ -1619,6 +1656,14 @@ export declare abstract class NodeObservationDirective<T extends NodeBehaviorOpt
|
|
|
1619
1656
|
protected abstract getNodes(target: any): Node[];
|
|
1620
1657
|
}
|
|
1621
1658
|
|
|
1659
|
+
/**
|
|
1660
|
+
* Normalizes the input value into a binding.
|
|
1661
|
+
* @param value - The value to create the default binding for.
|
|
1662
|
+
* @returns A binding configuration for the provided value.
|
|
1663
|
+
* @public
|
|
1664
|
+
*/
|
|
1665
|
+
export declare function normalizeBinding<TSource = any, TReturn = any, TParent = any>(value: Expression<TSource, TReturn, TParent> | Binding<TSource, TReturn, TParent> | {}): Binding<TSource, TReturn, TParent>;
|
|
1666
|
+
|
|
1622
1667
|
/**
|
|
1623
1668
|
* Provides change notifications for an observed subject.
|
|
1624
1669
|
* @public
|
|
@@ -1709,19 +1754,19 @@ export declare const Observable: Readonly<{
|
|
|
1709
1754
|
*/
|
|
1710
1755
|
getAccessors: (target: {}) => Accessor[];
|
|
1711
1756
|
/**
|
|
1712
|
-
* Creates a {@link
|
|
1713
|
-
* provided {@link
|
|
1757
|
+
* Creates a {@link ExpressionNotifier} that can watch the
|
|
1758
|
+
* provided {@link Expression} for changes.
|
|
1714
1759
|
* @param binding - The binding to observe.
|
|
1715
1760
|
* @param initialSubscriber - An initial subscriber to changes in the binding value.
|
|
1716
1761
|
* @param isVolatileBinding - Indicates whether the binding's dependency list must be re-evaluated on every value evaluation.
|
|
1717
1762
|
*/
|
|
1718
|
-
binding<TSource = any, TReturn = any>(binding:
|
|
1763
|
+
binding<TSource = any, TReturn = any>(binding: Expression<TSource, TReturn, any>, initialSubscriber?: Subscriber, isVolatileBinding?: boolean): ExpressionNotifier<TSource, TReturn, any>;
|
|
1719
1764
|
/**
|
|
1720
1765
|
* Determines whether a binding expression is volatile and needs to have its dependency list re-evaluated
|
|
1721
1766
|
* on every evaluation of the value.
|
|
1722
1767
|
* @param binding - The binding to inspect.
|
|
1723
1768
|
*/
|
|
1724
|
-
isVolatileBinding<TSource_1 = any, TReturn_1 = any>(binding:
|
|
1769
|
+
isVolatileBinding<TSource_1 = any, TReturn_1 = any>(binding: Expression<TSource_1, TReturn_1, any>): boolean;
|
|
1725
1770
|
}>;
|
|
1726
1771
|
|
|
1727
1772
|
/**
|
|
@@ -1748,30 +1793,12 @@ export declare interface ObservationRecord {
|
|
|
1748
1793
|
}
|
|
1749
1794
|
|
|
1750
1795
|
/**
|
|
1751
|
-
*
|
|
1752
|
-
* @
|
|
1753
|
-
|
|
1754
|
-
export declare const onChange: BindingConfig<AddEventListenerOptions> & BindingConfigResolver<AddEventListenerOptions>;
|
|
1755
|
-
|
|
1756
|
-
/**
|
|
1757
|
-
* The default onTime binding configuration.
|
|
1758
|
-
* @public
|
|
1759
|
-
*/
|
|
1760
|
-
export declare const oneTime: BindingConfig<AddEventListenerOptions> & BindingConfigResolver<AddEventListenerOptions>;
|
|
1761
|
-
|
|
1762
|
-
/**
|
|
1763
|
-
* A binding behavior for one-time bindings.
|
|
1796
|
+
* Creates a one time binding
|
|
1797
|
+
* @param binding - The binding to refresh when signaled.
|
|
1798
|
+
* @returns A binding configuration.
|
|
1764
1799
|
* @public
|
|
1765
1800
|
*/
|
|
1766
|
-
export declare
|
|
1767
|
-
/**
|
|
1768
|
-
* Bind this behavior to the source.
|
|
1769
|
-
* @param source - The source to bind to.
|
|
1770
|
-
* @param context - The execution context that the binding is operating within.
|
|
1771
|
-
* @param targets - The targets that behaviors in a view can attach to.
|
|
1772
|
-
*/
|
|
1773
|
-
bind(source: any, context: ExecutionContext, targets: ViewBehaviorTargets): void;
|
|
1774
|
-
}
|
|
1801
|
+
export declare function oneTime<T = any>(binding: Expression<T>): Binding<T>;
|
|
1775
1802
|
|
|
1776
1803
|
/**
|
|
1777
1804
|
* Common APIs related to content parsing.
|
|
@@ -1898,23 +1925,21 @@ declare const reflectMode = "reflect";
|
|
|
1898
1925
|
|
|
1899
1926
|
/**
|
|
1900
1927
|
* A directive that enables list rendering.
|
|
1901
|
-
* @param
|
|
1902
|
-
* @param
|
|
1928
|
+
* @param items - The array to render.
|
|
1929
|
+
* @param template - The template or a template binding used obtain a template
|
|
1903
1930
|
* to render for each item in the array.
|
|
1904
1931
|
* @param options - Options used to turn on special repeat features.
|
|
1905
1932
|
* @public
|
|
1906
1933
|
*/
|
|
1907
|
-
export declare function repeat<TSource = any, TArray extends ReadonlyArray<any> = ReadonlyArray<any>>(
|
|
1934
|
+
export declare function repeat<TSource = any, TArray extends ReadonlyArray<any> = ReadonlyArray<any>>(items: Expression<TSource, TArray, ExecutionContext<TSource>> | Binding<TSource, TArray> | ReadonlyArray<any>, template: Expression<TSource, ViewTemplate> | Binding<TSource, ViewTemplate> | ViewTemplate, options?: RepeatOptions): CaptureType<TSource>;
|
|
1908
1935
|
|
|
1909
1936
|
/**
|
|
1910
1937
|
* A behavior that renders a template for each item in an array.
|
|
1911
1938
|
* @public
|
|
1912
1939
|
*/
|
|
1913
1940
|
export declare class RepeatBehavior<TSource = any> implements Behavior, Subscriber {
|
|
1941
|
+
private directive;
|
|
1914
1942
|
private location;
|
|
1915
|
-
private itemsBinding;
|
|
1916
|
-
private templateBinding;
|
|
1917
|
-
private options;
|
|
1918
1943
|
private source;
|
|
1919
1944
|
private views;
|
|
1920
1945
|
private template;
|
|
@@ -1928,13 +1953,13 @@ export declare class RepeatBehavior<TSource = any> implements Behavior, Subscrib
|
|
|
1928
1953
|
/**
|
|
1929
1954
|
* Creates an instance of RepeatBehavior.
|
|
1930
1955
|
* @param location - The location in the DOM to render the repeat.
|
|
1931
|
-
* @param
|
|
1956
|
+
* @param dataBinding - The array to render.
|
|
1932
1957
|
* @param isItemsBindingVolatile - Indicates whether the items binding has volatile dependencies.
|
|
1933
1958
|
* @param templateBinding - The template to render for each item.
|
|
1934
1959
|
* @param isTemplateBindingVolatile - Indicates whether the template binding has volatile dependencies.
|
|
1935
1960
|
* @param options - Options used to turn on special repeat features.
|
|
1936
1961
|
*/
|
|
1937
|
-
constructor(
|
|
1962
|
+
constructor(directive: RepeatDirective, location: Node);
|
|
1938
1963
|
/**
|
|
1939
1964
|
* Bind this behavior to the source.
|
|
1940
1965
|
* @param source - The source to bind to.
|
|
@@ -1951,7 +1976,7 @@ export declare class RepeatBehavior<TSource = any> implements Behavior, Subscrib
|
|
|
1951
1976
|
* @param source - The source of the change.
|
|
1952
1977
|
* @param args - The details about what was changed.
|
|
1953
1978
|
*/
|
|
1954
|
-
handleChange(source: any, args: Splice[]): void;
|
|
1979
|
+
handleChange(source: any, args: Splice[] | ExpressionObserver): void;
|
|
1955
1980
|
private observeItems;
|
|
1956
1981
|
private updateViews;
|
|
1957
1982
|
private refreshAllViews;
|
|
@@ -1963,11 +1988,9 @@ export declare class RepeatBehavior<TSource = any> implements Behavior, Subscrib
|
|
|
1963
1988
|
* @public
|
|
1964
1989
|
*/
|
|
1965
1990
|
export declare class RepeatDirective<TSource = any> implements HTMLDirective, ViewBehaviorFactory {
|
|
1966
|
-
readonly
|
|
1991
|
+
readonly dataBinding: Binding<TSource>;
|
|
1967
1992
|
readonly templateBinding: Binding<TSource, SyntheticViewTemplate>;
|
|
1968
1993
|
readonly options: RepeatOptions;
|
|
1969
|
-
private isItemsBindingVolatile;
|
|
1970
|
-
private isTemplateBindingVolatile;
|
|
1971
1994
|
/**
|
|
1972
1995
|
* The unique id of the factory.
|
|
1973
1996
|
*/
|
|
@@ -1983,11 +2006,11 @@ export declare class RepeatDirective<TSource = any> implements HTMLDirective, Vi
|
|
|
1983
2006
|
createHTML(add: AddViewBehaviorFactory): string;
|
|
1984
2007
|
/**
|
|
1985
2008
|
* Creates an instance of RepeatDirective.
|
|
1986
|
-
* @param
|
|
2009
|
+
* @param dataBinding - The binding that provides the array to render.
|
|
1987
2010
|
* @param templateBinding - The template binding used to obtain a template to render for each item in the array.
|
|
1988
2011
|
* @param options - Options used to turn on special repeat features.
|
|
1989
2012
|
*/
|
|
1990
|
-
constructor(
|
|
2013
|
+
constructor(dataBinding: Binding<TSource>, templateBinding: Binding<TSource, SyntheticViewTemplate>, options: RepeatOptions);
|
|
1991
2014
|
/**
|
|
1992
2015
|
* Creates a behavior for the provided target node.
|
|
1993
2016
|
* @param target - The node instance to create the behavior for.
|
|
@@ -2406,7 +2429,7 @@ export declare interface SyntheticViewTemplate<TSource = any, TParent = any> {
|
|
|
2406
2429
|
* Represents the types of values that can be interpolated into a template.
|
|
2407
2430
|
* @public
|
|
2408
2431
|
*/
|
|
2409
|
-
export declare type TemplateValue<TSource, TParent = any> = Binding<TSource, any, TParent> | HTMLDirective | CaptureType<TSource>;
|
|
2432
|
+
export declare type TemplateValue<TSource, TParent = any> = Expression<TSource, any, TParent> | Binding<TSource, any, TParent> | HTMLDirective | CaptureType<TSource>;
|
|
2410
2433
|
|
|
2411
2434
|
/**
|
|
2412
2435
|
* Enables working with trusted types.
|
|
@@ -2451,40 +2474,6 @@ export declare interface TypeRegistry<TDefinition extends TypeDefinition> {
|
|
|
2451
2474
|
getForInstance(object: any): TDefinition | undefined;
|
|
2452
2475
|
}
|
|
2453
2476
|
|
|
2454
|
-
/**
|
|
2455
|
-
* A base binding behavior for DOM updates.
|
|
2456
|
-
* @public
|
|
2457
|
-
*/
|
|
2458
|
-
export declare class UpdateBinding implements ViewBehavior {
|
|
2459
|
-
readonly directive: HTMLBindingDirective;
|
|
2460
|
-
protected updateTarget: UpdateTarget;
|
|
2461
|
-
/**
|
|
2462
|
-
* Creates an instance of UpdateBinding.
|
|
2463
|
-
* @param directive - The directive that has the configuration for this behavior.
|
|
2464
|
-
* @param updateTarget - The function used to update the target with the latest value.
|
|
2465
|
-
*/
|
|
2466
|
-
constructor(directive: HTMLBindingDirective, updateTarget: UpdateTarget);
|
|
2467
|
-
/**
|
|
2468
|
-
* Bind this behavior to the source.
|
|
2469
|
-
* @param source - The source to bind to.
|
|
2470
|
-
* @param context - The execution context that the binding is operating within.
|
|
2471
|
-
* @param targets - The targets that behaviors in a view can attach to.
|
|
2472
|
-
*/
|
|
2473
|
-
bind(source: any, context: ExecutionContext, targets: ViewBehaviorTargets): void;
|
|
2474
|
-
/**
|
|
2475
|
-
* Unbinds this behavior from the source.
|
|
2476
|
-
* @param source - The source to unbind from.
|
|
2477
|
-
* @param context - The execution context that the binding is operating within.
|
|
2478
|
-
* @param targets - The targets that behaviors in a view can attach to.
|
|
2479
|
-
*/
|
|
2480
|
-
unbind(source: any, context: ExecutionContext, targets: ViewBehaviorTargets): void;
|
|
2481
|
-
/**
|
|
2482
|
-
* Creates a behavior.
|
|
2483
|
-
* @param targets - The targets available for behaviors to be attached to.
|
|
2484
|
-
*/
|
|
2485
|
-
createBehavior(targets: ViewBehaviorTargets): ViewBehavior;
|
|
2486
|
-
}
|
|
2487
|
-
|
|
2488
2477
|
/**
|
|
2489
2478
|
* A work queue used to synchronize writes to the DOM.
|
|
2490
2479
|
* @public
|
|
@@ -2689,11 +2678,11 @@ export declare function volatile(target: {}, name: string | Accessor, descriptor
|
|
|
2689
2678
|
|
|
2690
2679
|
/**
|
|
2691
2680
|
* A directive that enables basic conditional rendering in a template.
|
|
2692
|
-
* @param
|
|
2681
|
+
* @param condition - The condition to test for rendering.
|
|
2693
2682
|
* @param templateOrTemplateBinding - The template or a binding that gets
|
|
2694
2683
|
* the template to render when the condition is true.
|
|
2695
2684
|
* @public
|
|
2696
2685
|
*/
|
|
2697
|
-
export declare function when<TSource = any, TReturn = any>(
|
|
2686
|
+
export declare function when<TSource = any, TReturn = any>(condition: Expression<TSource, TReturn> | boolean, templateOrTemplateBinding: SyntheticViewTemplate | Expression<TSource, SyntheticViewTemplate>): CaptureType<TSource>;
|
|
2698
2687
|
|
|
2699
2688
|
export { }
|