@microsoft/fast-element 2.0.0-beta.6 → 2.0.0-beta.8
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 +78 -0
- package/CHANGELOG.md +25 -1
- package/dist/dts/components/attributes.d.ts +10 -0
- package/dist/dts/components/{controller.d.ts → element-controller.d.ts} +24 -25
- package/dist/dts/components/fast-definitions.d.ts +28 -3
- package/dist/dts/components/fast-element.d.ts +2 -2
- package/dist/dts/di/di.d.ts +41 -0
- package/dist/dts/index.d.ts +2 -2
- package/dist/dts/observation/observable.d.ts +86 -47
- package/dist/dts/pending-task.d.ts +20 -0
- package/dist/dts/platform.d.ts +6 -0
- package/dist/dts/styles/css-directive.d.ts +2 -2
- package/dist/dts/styles/element-styles.d.ts +3 -3
- package/dist/dts/styles/host.d.ts +68 -0
- package/dist/dts/templating/binding-signal.d.ts +2 -2
- package/dist/dts/templating/binding-two-way.d.ts +11 -3
- package/dist/dts/templating/binding.d.ts +21 -119
- package/dist/dts/templating/children.d.ts +1 -1
- package/dist/dts/templating/html-directive.d.ts +69 -39
- package/dist/dts/templating/node-observation.d.ts +4 -5
- package/dist/dts/templating/ref.d.ts +5 -13
- package/dist/dts/templating/render.d.ts +15 -20
- package/dist/dts/templating/repeat.d.ts +11 -16
- package/dist/dts/templating/slotted.d.ts +1 -1
- package/dist/dts/templating/template.d.ts +4 -4
- package/dist/dts/templating/view.d.ts +68 -9
- package/dist/dts/templating/when.d.ts +1 -1
- package/dist/dts/testing/exports.d.ts +1 -0
- package/dist/dts/testing/fakes.d.ts +4 -0
- package/dist/dts/testing/fixture.d.ts +0 -6
- package/dist/esm/components/attributes.js +13 -4
- package/dist/esm/components/{controller.js → element-controller.js} +95 -105
- package/dist/esm/components/fast-definitions.js +3 -1
- package/dist/esm/components/fast-element.js +4 -4
- package/dist/esm/di/di.js +87 -3
- package/dist/esm/index.js +2 -1
- package/dist/esm/observation/observable.js +59 -126
- package/dist/esm/pending-task.js +16 -0
- package/dist/esm/platform.js +24 -0
- package/dist/esm/styles/css.js +4 -4
- package/dist/esm/{observation/behavior.js → styles/host.js} +0 -0
- package/dist/esm/templating/binding-signal.js +21 -17
- package/dist/esm/templating/binding-two-way.js +32 -27
- package/dist/esm/templating/binding.js +73 -177
- package/dist/esm/templating/html-directive.js +78 -7
- package/dist/esm/templating/node-observation.js +9 -8
- package/dist/esm/templating/ref.js +4 -12
- package/dist/esm/templating/render.js +30 -31
- package/dist/esm/templating/repeat.js +37 -38
- package/dist/esm/templating/template.js +3 -4
- package/dist/esm/templating/view.js +98 -29
- package/dist/esm/testing/exports.js +1 -0
- package/dist/esm/testing/fakes.js +76 -0
- package/dist/esm/testing/fixture.js +1 -3
- package/dist/fast-element.api.json +5720 -5385
- package/dist/fast-element.d.ts +510 -399
- package/dist/fast-element.debug.js +497 -514
- package/dist/fast-element.debug.min.js +1 -1
- package/dist/fast-element.js +497 -514
- package/dist/fast-element.min.js +1 -1
- package/dist/fast-element.untrimmed.d.ts +519 -405
- package/docs/api-report.md +197 -129
- package/package.json +5 -1
- package/dist/dts/observation/behavior.d.ts +0 -19
|
@@ -24,7 +24,7 @@ export declare interface Accessor {
|
|
|
24
24
|
* Used to add behaviors when constructing styles.
|
|
25
25
|
* @public
|
|
26
26
|
*/
|
|
27
|
-
export declare type AddBehavior = (behavior:
|
|
27
|
+
export declare type AddBehavior = (behavior: HostBehavior<HTMLElement>) => void;
|
|
28
28
|
|
|
29
29
|
/**
|
|
30
30
|
* Used to add behavior factories when constructing templates.
|
|
@@ -188,6 +188,17 @@ export declare type AttributeConfiguration = {
|
|
|
188
188
|
converter?: ValueConverter;
|
|
189
189
|
};
|
|
190
190
|
|
|
191
|
+
/**
|
|
192
|
+
* Metadata used to configure a custom attribute's behavior.
|
|
193
|
+
* @public
|
|
194
|
+
*/
|
|
195
|
+
export declare const AttributeConfiguration: Readonly<{
|
|
196
|
+
/**
|
|
197
|
+
* Locates all attribute configurations associated with a type.
|
|
198
|
+
*/
|
|
199
|
+
locate: (target: {}) => AttributeConfiguration[];
|
|
200
|
+
}>;
|
|
201
|
+
|
|
191
202
|
/**
|
|
192
203
|
* An implementation of {@link Accessor} that supports reactivity,
|
|
193
204
|
* change callbacks, attribute reflection, and type conversion for
|
|
@@ -266,25 +277,6 @@ export declare class AttributeDefinition implements Accessor {
|
|
|
266
277
|
*/
|
|
267
278
|
export declare type AttributeMode = typeof reflectMode | typeof booleanMode | "fromView";
|
|
268
279
|
|
|
269
|
-
/**
|
|
270
|
-
* Represents an object that can contribute behavior to a view or
|
|
271
|
-
* element's bind/unbind operations.
|
|
272
|
-
* @public
|
|
273
|
-
*/
|
|
274
|
-
export declare interface Behavior<TSource = any, TParent = any> {
|
|
275
|
-
/**
|
|
276
|
-
* Bind this behavior to the source.
|
|
277
|
-
* @param source - The source to bind to.
|
|
278
|
-
* @param context - The execution context that the binding is operating within.
|
|
279
|
-
*/
|
|
280
|
-
bind(source: TSource, context: ExecutionContext<TParent>): void;
|
|
281
|
-
/**
|
|
282
|
-
* Unbinds this behavior from the source.
|
|
283
|
-
* @param source - The source to unbind from.
|
|
284
|
-
*/
|
|
285
|
-
unbind(source: TSource, context: ExecutionContext<TParent>): void;
|
|
286
|
-
}
|
|
287
|
-
|
|
288
280
|
/**
|
|
289
281
|
* Creates an standard binding.
|
|
290
282
|
* @param binding - The binding to refresh when changed.
|
|
@@ -300,18 +292,18 @@ export declare function bind<T = any>(binding: Expression<T>, isVolatile?: boole
|
|
|
300
292
|
* @public
|
|
301
293
|
*/
|
|
302
294
|
export declare abstract class Binding<TSource = any, TReturn = any, TParent = any> {
|
|
295
|
+
evaluate: Expression<TSource, TReturn, TParent>;
|
|
296
|
+
isVolatile: boolean;
|
|
303
297
|
/**
|
|
304
298
|
* Options associated with the binding.
|
|
305
299
|
*/
|
|
306
300
|
options?: any;
|
|
307
301
|
/**
|
|
308
|
-
*
|
|
309
|
-
|
|
310
|
-
|
|
311
|
-
/**
|
|
312
|
-
* Evaluates the binding expression.
|
|
302
|
+
* Creates a binding.
|
|
303
|
+
* @param evaluate - Evaluates the binding.
|
|
304
|
+
* @param isVolatile - Indicates whether the binding is volatile.
|
|
313
305
|
*/
|
|
314
|
-
evaluate: Expression<TSource, TReturn, TParent
|
|
306
|
+
constructor(evaluate: Expression<TSource, TReturn, TParent>, isVolatile?: boolean);
|
|
315
307
|
/**
|
|
316
308
|
* Creates an observer capable of notifying a subscriber when the output of a binding changes.
|
|
317
309
|
* @param directive - The HTML Directive to create the observer for.
|
|
@@ -320,49 +312,6 @@ export declare abstract class Binding<TSource = any, TReturn = any, TParent = an
|
|
|
320
312
|
abstract createObserver(directive: HTMLDirective, subscriber: Subscriber): ExpressionObserver<TSource, TReturn, TParent>;
|
|
321
313
|
}
|
|
322
314
|
|
|
323
|
-
/**
|
|
324
|
-
* A binding behavior for bindings that change.
|
|
325
|
-
* @public
|
|
326
|
-
*/
|
|
327
|
-
export declare class BindingBehavior implements ViewBehavior {
|
|
328
|
-
readonly directive: HTMLBindingDirective;
|
|
329
|
-
protected updateTarget: UpdateTarget;
|
|
330
|
-
private observerProperty;
|
|
331
|
-
/**
|
|
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.
|
|
335
|
-
*/
|
|
336
|
-
constructor(directive: HTMLBindingDirective, updateTarget: UpdateTarget);
|
|
337
|
-
/**
|
|
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.
|
|
342
|
-
*/
|
|
343
|
-
bind(source: any, context: ExecutionContext, targets: ViewBehaviorTargets): void;
|
|
344
|
-
/**
|
|
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.
|
|
349
|
-
*/
|
|
350
|
-
unbind(source: any, context: ExecutionContext, targets: ViewBehaviorTargets): void;
|
|
351
|
-
/** @internal */
|
|
352
|
-
handleChange(binding: Expression, observer: ExpressionObserver): void;
|
|
353
|
-
/**
|
|
354
|
-
* Returns the binding observer used to update the node.
|
|
355
|
-
* @param target - The target node.
|
|
356
|
-
* @returns A BindingObserver.
|
|
357
|
-
*/
|
|
358
|
-
protected getObserver(target: Node): ExpressionObserver;
|
|
359
|
-
/**
|
|
360
|
-
* Creates a behavior.
|
|
361
|
-
* @param targets - The targets available for behaviors to be attached to.
|
|
362
|
-
*/
|
|
363
|
-
createBehavior(targets: ViewBehaviorTargets): ViewBehavior;
|
|
364
|
-
}
|
|
365
|
-
|
|
366
315
|
/**
|
|
367
316
|
* A {@link ValueConverter} that converts to and from `boolean` values.
|
|
368
317
|
* @remarks
|
|
@@ -386,7 +335,7 @@ export declare type Callable = typeof Function.prototype.call | {
|
|
|
386
335
|
* into templates.
|
|
387
336
|
* @public
|
|
388
337
|
*/
|
|
389
|
-
export declare interface CaptureType<TSource> {
|
|
338
|
+
export declare interface CaptureType<TSource, TParent> {
|
|
390
339
|
}
|
|
391
340
|
|
|
392
341
|
/**
|
|
@@ -402,7 +351,7 @@ export declare interface ChildListDirectiveOptions<T = any> extends NodeBehavior
|
|
|
402
351
|
* @param propertyOrOptions - The options used to configure child node observation.
|
|
403
352
|
* @public
|
|
404
353
|
*/
|
|
405
|
-
export declare function children<
|
|
354
|
+
export declare function children<TSource = any, TParent = any>(propertyOrOptions: (keyof TSource & string) | ChildrenDirectiveOptions<keyof TSource & string>): CaptureType<TSource, TParent>;
|
|
406
355
|
|
|
407
356
|
/**
|
|
408
357
|
* The runtime behavior for child node observation.
|
|
@@ -525,20 +474,6 @@ export declare type ConstructibleStyleStrategy = {
|
|
|
525
474
|
new (styles: (string | CSSStyleSheet)[]): StyleStrategy;
|
|
526
475
|
};
|
|
527
476
|
|
|
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
477
|
/**
|
|
543
478
|
* A simple template that can create ContentView instances.
|
|
544
479
|
* @public
|
|
@@ -555,12 +490,13 @@ export declare interface ContentTemplate {
|
|
|
555
490
|
* @public
|
|
556
491
|
*/
|
|
557
492
|
export declare interface ContentView {
|
|
493
|
+
readonly context: ExecutionContext;
|
|
558
494
|
/**
|
|
559
495
|
* Binds a view's behaviors to its binding source.
|
|
560
496
|
* @param source - The binding source for the view's binding behaviors.
|
|
561
497
|
* @param context - The execution context to run the view within.
|
|
562
498
|
*/
|
|
563
|
-
bind(source: any
|
|
499
|
+
bind(source: any): void;
|
|
564
500
|
/**
|
|
565
501
|
* Unbinds a view's behaviors from its binding source and context.
|
|
566
502
|
*/
|
|
@@ -578,126 +514,11 @@ export declare interface ContentView {
|
|
|
578
514
|
}
|
|
579
515
|
|
|
580
516
|
/**
|
|
581
|
-
*
|
|
582
|
-
* @
|
|
517
|
+
* Creates a function capable of locating metadata associated with a type.
|
|
518
|
+
* @returns A metadata locator function.
|
|
519
|
+
* @internal
|
|
583
520
|
*/
|
|
584
|
-
export declare
|
|
585
|
-
private boundObservables;
|
|
586
|
-
private behaviors;
|
|
587
|
-
private needsInitialization;
|
|
588
|
-
private hasExistingShadowRoot;
|
|
589
|
-
private _template;
|
|
590
|
-
private _styles;
|
|
591
|
-
private _isConnected;
|
|
592
|
-
/**
|
|
593
|
-
* This allows Observable.getNotifier(...) to return the Controller
|
|
594
|
-
* when the notifier for the Controller itself is being requested. The
|
|
595
|
-
* result is that the Observable system does not need to create a separate
|
|
596
|
-
* instance of Notifier for observables on the Controller. The component and
|
|
597
|
-
* the controller will now share the same notifier, removing one-object construct
|
|
598
|
-
* per web component instance.
|
|
599
|
-
*/
|
|
600
|
-
private readonly $fastController;
|
|
601
|
-
/**
|
|
602
|
-
* The element being controlled by this controller.
|
|
603
|
-
*/
|
|
604
|
-
readonly element: TElement;
|
|
605
|
-
/**
|
|
606
|
-
* The element definition that instructs this controller
|
|
607
|
-
* in how to handle rendering and other platform integrations.
|
|
608
|
-
*/
|
|
609
|
-
readonly definition: FASTElementDefinition;
|
|
610
|
-
/**
|
|
611
|
-
* The view associated with the custom element.
|
|
612
|
-
* @remarks
|
|
613
|
-
* If `null` then the element is managing its own rendering.
|
|
614
|
-
*/
|
|
615
|
-
readonly view: ElementView<TElement> | null;
|
|
616
|
-
/**
|
|
617
|
-
* Indicates whether or not the custom element has been
|
|
618
|
-
* connected to the document.
|
|
619
|
-
*/
|
|
620
|
-
get isConnected(): boolean;
|
|
621
|
-
private setIsConnected;
|
|
622
|
-
/**
|
|
623
|
-
* Gets/sets the template used to render the component.
|
|
624
|
-
* @remarks
|
|
625
|
-
* This value can only be accurately read after connect but can be set at any time.
|
|
626
|
-
*/
|
|
627
|
-
get template(): ElementViewTemplate<TElement> | null;
|
|
628
|
-
set template(value: ElementViewTemplate<TElement> | null);
|
|
629
|
-
/**
|
|
630
|
-
* Gets/sets the primary styles used for the component.
|
|
631
|
-
* @remarks
|
|
632
|
-
* This value can only be accurately read after connect but can be set at any time.
|
|
633
|
-
*/
|
|
634
|
-
get styles(): ElementStyles | null;
|
|
635
|
-
set styles(value: ElementStyles | null);
|
|
636
|
-
/**
|
|
637
|
-
* Creates a Controller to control the specified element.
|
|
638
|
-
* @param element - The element to be controlled by this controller.
|
|
639
|
-
* @param definition - The element definition metadata that instructs this
|
|
640
|
-
* controller in how to handle rendering and other platform integrations.
|
|
641
|
-
* @internal
|
|
642
|
-
*/
|
|
643
|
-
constructor(element: TElement, definition: FASTElementDefinition);
|
|
644
|
-
/**
|
|
645
|
-
* Adds styles to this element. Providing an HTMLStyleElement will attach the element instance to the shadowRoot.
|
|
646
|
-
* @param styles - The styles to add.
|
|
647
|
-
*/
|
|
648
|
-
addStyles(styles: ElementStyles | HTMLStyleElement | null | undefined): void;
|
|
649
|
-
/**
|
|
650
|
-
* Removes styles from this element. Providing an HTMLStyleElement will detach the element instance from the shadowRoot.
|
|
651
|
-
* @param styles - the styles to remove.
|
|
652
|
-
*/
|
|
653
|
-
removeStyles(styles: ElementStyles | HTMLStyleElement | null | undefined): void;
|
|
654
|
-
/**
|
|
655
|
-
* Adds behaviors to this element.
|
|
656
|
-
* @param behaviors - The behaviors to add.
|
|
657
|
-
*/
|
|
658
|
-
addBehaviors(behaviors: ReadonlyArray<Behavior<TElement>>): void;
|
|
659
|
-
/**
|
|
660
|
-
* Removes behaviors from this element.
|
|
661
|
-
* @param behaviors - The behaviors to remove.
|
|
662
|
-
* @param force - Forces unbinding of behaviors.
|
|
663
|
-
*/
|
|
664
|
-
removeBehaviors(behaviors: ReadonlyArray<Behavior<TElement>>, force?: boolean): void;
|
|
665
|
-
/**
|
|
666
|
-
* Runs connected lifecycle behavior on the associated element.
|
|
667
|
-
*/
|
|
668
|
-
onConnectedCallback(): void;
|
|
669
|
-
/**
|
|
670
|
-
* Runs disconnected lifecycle behavior on the associated element.
|
|
671
|
-
*/
|
|
672
|
-
onDisconnectedCallback(): void;
|
|
673
|
-
/**
|
|
674
|
-
* Runs the attribute changed callback for the associated element.
|
|
675
|
-
* @param name - The name of the attribute that changed.
|
|
676
|
-
* @param oldValue - The previous value of the attribute.
|
|
677
|
-
* @param newValue - The new value of the attribute.
|
|
678
|
-
*/
|
|
679
|
-
onAttributeChangedCallback(name: string, oldValue: string | null, newValue: string | null): void;
|
|
680
|
-
/**
|
|
681
|
-
* Emits a custom HTML event.
|
|
682
|
-
* @param type - The type name of the event.
|
|
683
|
-
* @param detail - The event detail object to send with the event.
|
|
684
|
-
* @param options - The event options. By default bubbles and composed.
|
|
685
|
-
* @remarks
|
|
686
|
-
* Only emits events if connected.
|
|
687
|
-
*/
|
|
688
|
-
emit(type: string, detail?: any, options?: Omit<CustomEventInit, "detail">): void | boolean;
|
|
689
|
-
private finishInitialization;
|
|
690
|
-
private renderTemplate;
|
|
691
|
-
/**
|
|
692
|
-
* Locates or creates a controller for the specified element.
|
|
693
|
-
* @param element - The element to return the controller for.
|
|
694
|
-
* @remarks
|
|
695
|
-
* The specified element must have a {@link FASTElementDefinition}
|
|
696
|
-
* registered either through the use of the {@link customElement}
|
|
697
|
-
* decorator or a call to `FASTElement.define`.
|
|
698
|
-
*/
|
|
699
|
-
static forCustomElement(element: HTMLElement): Controller;
|
|
700
|
-
}
|
|
521
|
+
export declare function createMetadataLocator<TMetadata>(): (target: {}) => TMetadata[];
|
|
701
522
|
|
|
702
523
|
/**
|
|
703
524
|
* Do not change. Part of shared kernel contract.
|
|
@@ -863,6 +684,127 @@ export declare const DOM: Readonly<{
|
|
|
863
684
|
setBooleanAttribute(element: HTMLElement, attributeName: string, value: boolean): void;
|
|
864
685
|
}>;
|
|
865
686
|
|
|
687
|
+
/**
|
|
688
|
+
* Controls the lifecycle and rendering of a `FASTElement`.
|
|
689
|
+
* @public
|
|
690
|
+
*/
|
|
691
|
+
export declare class ElementController<TElement extends HTMLElement = HTMLElement> extends PropertyChangeNotifier implements HostController<TElement> {
|
|
692
|
+
private boundObservables;
|
|
693
|
+
private needsInitialization;
|
|
694
|
+
private hasExistingShadowRoot;
|
|
695
|
+
private _template;
|
|
696
|
+
private _isConnected;
|
|
697
|
+
private behaviors;
|
|
698
|
+
private _mainStyles;
|
|
699
|
+
/**
|
|
700
|
+
* This allows Observable.getNotifier(...) to return the Controller
|
|
701
|
+
* when the notifier for the Controller itself is being requested. The
|
|
702
|
+
* result is that the Observable system does not need to create a separate
|
|
703
|
+
* instance of Notifier for observables on the Controller. The component and
|
|
704
|
+
* the controller will now share the same notifier, removing one-object construct
|
|
705
|
+
* per web component instance.
|
|
706
|
+
*/
|
|
707
|
+
private readonly $fastController;
|
|
708
|
+
/**
|
|
709
|
+
* The element being controlled by this controller.
|
|
710
|
+
*/
|
|
711
|
+
readonly source: TElement;
|
|
712
|
+
/**
|
|
713
|
+
* The element definition that instructs this controller
|
|
714
|
+
* in how to handle rendering and other platform integrations.
|
|
715
|
+
*/
|
|
716
|
+
readonly definition: FASTElementDefinition;
|
|
717
|
+
/**
|
|
718
|
+
* The view associated with the custom element.
|
|
719
|
+
* @remarks
|
|
720
|
+
* If `null` then the element is managing its own rendering.
|
|
721
|
+
*/
|
|
722
|
+
readonly view: ElementView<TElement> | null;
|
|
723
|
+
/**
|
|
724
|
+
* Indicates whether or not the custom element has been
|
|
725
|
+
* connected to the document.
|
|
726
|
+
*/
|
|
727
|
+
get isConnected(): boolean;
|
|
728
|
+
private setIsConnected;
|
|
729
|
+
/**
|
|
730
|
+
* Gets/sets the template used to render the component.
|
|
731
|
+
* @remarks
|
|
732
|
+
* This value can only be accurately read after connect but can be set at any time.
|
|
733
|
+
*/
|
|
734
|
+
get template(): ElementViewTemplate<TElement> | null;
|
|
735
|
+
set template(value: ElementViewTemplate<TElement> | null);
|
|
736
|
+
/**
|
|
737
|
+
* The main set of styles used for the component, independent
|
|
738
|
+
* of any dynamically added styles.
|
|
739
|
+
*/
|
|
740
|
+
get mainStyles(): ElementStyles | null;
|
|
741
|
+
set mainStyles(value: ElementStyles | null);
|
|
742
|
+
/**
|
|
743
|
+
* Creates a Controller to control the specified element.
|
|
744
|
+
* @param element - The element to be controlled by this controller.
|
|
745
|
+
* @param definition - The element definition metadata that instructs this
|
|
746
|
+
* controller in how to handle rendering and other platform integrations.
|
|
747
|
+
* @internal
|
|
748
|
+
*/
|
|
749
|
+
constructor(element: TElement, definition: FASTElementDefinition);
|
|
750
|
+
/**
|
|
751
|
+
* Adds the behavior to the component.
|
|
752
|
+
* @param behavior - The behavior to add.
|
|
753
|
+
*/
|
|
754
|
+
addBehavior(behavior: HostBehavior<TElement>): void;
|
|
755
|
+
/**
|
|
756
|
+
* Removes the behavior from the component.
|
|
757
|
+
* @param behavior - The behavior to remove.
|
|
758
|
+
* @param force - Forces removal even if this behavior was added more than once.
|
|
759
|
+
*/
|
|
760
|
+
removeBehavior(behavior: HostBehavior<TElement>, force?: boolean): void;
|
|
761
|
+
/**
|
|
762
|
+
* Adds styles to this element. Providing an HTMLStyleElement will attach the element instance to the shadowRoot.
|
|
763
|
+
* @param styles - The styles to add.
|
|
764
|
+
*/
|
|
765
|
+
addStyles(styles: ElementStyles | HTMLStyleElement | null | undefined): void;
|
|
766
|
+
/**
|
|
767
|
+
* Removes styles from this element. Providing an HTMLStyleElement will detach the element instance from the shadowRoot.
|
|
768
|
+
* @param styles - the styles to remove.
|
|
769
|
+
*/
|
|
770
|
+
removeStyles(styles: ElementStyles | HTMLStyleElement | null | undefined): void;
|
|
771
|
+
/**
|
|
772
|
+
* Runs connected lifecycle behavior on the associated element.
|
|
773
|
+
*/
|
|
774
|
+
connect(): void;
|
|
775
|
+
/**
|
|
776
|
+
* Runs disconnected lifecycle behavior on the associated element.
|
|
777
|
+
*/
|
|
778
|
+
disconnect(): void;
|
|
779
|
+
/**
|
|
780
|
+
* Runs the attribute changed callback for the associated element.
|
|
781
|
+
* @param name - The name of the attribute that changed.
|
|
782
|
+
* @param oldValue - The previous value of the attribute.
|
|
783
|
+
* @param newValue - The new value of the attribute.
|
|
784
|
+
*/
|
|
785
|
+
onAttributeChangedCallback(name: string, oldValue: string | null, newValue: string | null): void;
|
|
786
|
+
/**
|
|
787
|
+
* Emits a custom HTML event.
|
|
788
|
+
* @param type - The type name of the event.
|
|
789
|
+
* @param detail - The event detail object to send with the event.
|
|
790
|
+
* @param options - The event options. By default bubbles and composed.
|
|
791
|
+
* @remarks
|
|
792
|
+
* Only emits events if connected.
|
|
793
|
+
*/
|
|
794
|
+
emit(type: string, detail?: any, options?: Omit<CustomEventInit, "detail">): void | boolean;
|
|
795
|
+
private finishInitialization;
|
|
796
|
+
private renderTemplate;
|
|
797
|
+
/**
|
|
798
|
+
* Locates or creates a controller for the specified element.
|
|
799
|
+
* @param element - The element to return the controller for.
|
|
800
|
+
* @remarks
|
|
801
|
+
* The specified element must have a {@link FASTElementDefinition}
|
|
802
|
+
* registered either through the use of the {@link customElement}
|
|
803
|
+
* decorator or a call to `FASTElement.define`.
|
|
804
|
+
*/
|
|
805
|
+
static forCustomElement(element: HTMLElement): ElementController;
|
|
806
|
+
}
|
|
807
|
+
|
|
866
808
|
/**
|
|
867
809
|
* Creates a function that can be used to filter a Node array, selecting only elements.
|
|
868
810
|
* @param selector - An optional selector to restrict the filter to.
|
|
@@ -875,7 +817,7 @@ export declare const elements: (selector?: string) => ElementsFilter;
|
|
|
875
817
|
*
|
|
876
818
|
* @public
|
|
877
819
|
*/
|
|
878
|
-
export declare type ElementsFilter = (value: Node, index
|
|
820
|
+
export declare type ElementsFilter = (value: Node, index?: number, array?: Node[]) => boolean;
|
|
879
821
|
|
|
880
822
|
/**
|
|
881
823
|
* Represents styles that can be applied to a custom element.
|
|
@@ -888,7 +830,7 @@ export declare class ElementStyles {
|
|
|
888
830
|
/**
|
|
889
831
|
* The behaviors associated with this set of styles.
|
|
890
832
|
*/
|
|
891
|
-
readonly behaviors: ReadonlyArray<
|
|
833
|
+
readonly behaviors: ReadonlyArray<HostBehavior<HTMLElement>> | null;
|
|
892
834
|
/**
|
|
893
835
|
* Gets the StyleStrategy associated with these element styles.
|
|
894
836
|
*/
|
|
@@ -908,7 +850,7 @@ export declare class ElementStyles {
|
|
|
908
850
|
* Associates behaviors with this set of styles.
|
|
909
851
|
* @param behaviors - The behaviors to associate.
|
|
910
852
|
*/
|
|
911
|
-
withBehaviors(...behaviors:
|
|
853
|
+
withBehaviors(...behaviors: HostBehavior<HTMLElement>[]): this;
|
|
912
854
|
/**
|
|
913
855
|
* Sets the strategy that handles adding/removing these styles for an element.
|
|
914
856
|
* @param strategy - The strategy to use.
|
|
@@ -956,69 +898,27 @@ export declare interface ElementViewTemplate<TSource = any, TParent = any> {
|
|
|
956
898
|
/**
|
|
957
899
|
* Creates an HTMLView from this template, binds it to the source, and then appends it to the host.
|
|
958
900
|
* @param source - The data source to bind the template to.
|
|
959
|
-
* @param host - The Element where the template will be rendered.
|
|
960
|
-
* @param hostBindingTarget - An HTML element to target the host bindings at if different from the
|
|
961
|
-
* host that the template is being attached to.
|
|
962
|
-
*/
|
|
963
|
-
render(source: TSource, host: Node, hostBindingTarget?: Element): ElementView<TSource, TParent>;
|
|
964
|
-
}
|
|
965
|
-
|
|
966
|
-
/**
|
|
967
|
-
* A readonly, empty array.
|
|
968
|
-
* @remarks
|
|
969
|
-
* Typically returned by APIs that return arrays when there are
|
|
970
|
-
* no actual items to return.
|
|
971
|
-
* @public
|
|
972
|
-
*/
|
|
973
|
-
export declare const emptyArray: readonly never[];
|
|
974
|
-
|
|
975
|
-
/**
|
|
976
|
-
* A binding behavior for handling events.
|
|
977
|
-
* @public
|
|
978
|
-
*/
|
|
979
|
-
export declare class EventBehavior {
|
|
980
|
-
readonly directive: HTMLBindingDirective;
|
|
981
|
-
private contextProperty;
|
|
982
|
-
private sourceProperty;
|
|
983
|
-
/**
|
|
984
|
-
* Creates an instance of EventBinding.
|
|
985
|
-
* @param directive - The directive that has the configuration for this behavior.
|
|
986
|
-
*/
|
|
987
|
-
constructor(directive: HTMLBindingDirective);
|
|
988
|
-
/**
|
|
989
|
-
* Bind this behavior to the source.
|
|
990
|
-
* @param source - The source to bind to.
|
|
991
|
-
* @param context - The execution context that the binding is operating within.
|
|
992
|
-
* @param targets - The targets that behaviors in a view can attach to.
|
|
993
|
-
*/
|
|
994
|
-
bind(source: any, context: ExecutionContext, targets: ViewBehaviorTargets): void;
|
|
995
|
-
/**
|
|
996
|
-
* Unbinds this behavior from the source.
|
|
997
|
-
* @param source - The source to unbind from.
|
|
998
|
-
* @param context - The execution context that the binding is operating within.
|
|
999
|
-
* @param targets - The targets that behaviors in a view can attach to.
|
|
1000
|
-
*/
|
|
1001
|
-
unbind(source: any, context: ExecutionContext, targets: ViewBehaviorTargets): void;
|
|
1002
|
-
/**
|
|
1003
|
-
* Creates a behavior.
|
|
1004
|
-
* @param targets - The targets available for behaviors to be attached to.
|
|
1005
|
-
*/
|
|
1006
|
-
createBehavior(targets: ViewBehaviorTargets): ViewBehavior;
|
|
1007
|
-
/**
|
|
1008
|
-
* @internal
|
|
901
|
+
* @param host - The Element where the template will be rendered.
|
|
902
|
+
* @param hostBindingTarget - An HTML element to target the host bindings at if different from the
|
|
903
|
+
* host that the template is being attached to.
|
|
1009
904
|
*/
|
|
1010
|
-
|
|
905
|
+
render(source: TSource, host: Node, hostBindingTarget?: Element): ElementView<TSource, TParent>;
|
|
1011
906
|
}
|
|
1012
907
|
|
|
908
|
+
/**
|
|
909
|
+
* A readonly, empty array.
|
|
910
|
+
* @remarks
|
|
911
|
+
* Typically returned by APIs that return arrays when there are
|
|
912
|
+
* no actual items to return.
|
|
913
|
+
* @public
|
|
914
|
+
*/
|
|
915
|
+
export declare const emptyArray: readonly never[];
|
|
916
|
+
|
|
1013
917
|
/**
|
|
1014
918
|
* Provides additional contextual information available to behaviors and expressions.
|
|
1015
919
|
* @public
|
|
1016
920
|
*/
|
|
1017
|
-
export declare
|
|
1018
|
-
/**
|
|
1019
|
-
* The default execution context.
|
|
1020
|
-
*/
|
|
1021
|
-
static readonly default: ExecutionContext<any>;
|
|
921
|
+
export declare interface ExecutionContext<TParent = any> {
|
|
1022
922
|
/**
|
|
1023
923
|
* The index of the current item within a repeat context.
|
|
1024
924
|
*/
|
|
@@ -1030,41 +930,40 @@ export declare class ExecutionContext<TParentSource = any> {
|
|
|
1030
930
|
/**
|
|
1031
931
|
* The parent data source within a nested context.
|
|
1032
932
|
*/
|
|
1033
|
-
|
|
933
|
+
parent: TParent;
|
|
1034
934
|
/**
|
|
1035
935
|
* The parent execution context when in nested context scenarios.
|
|
1036
936
|
*/
|
|
1037
|
-
|
|
1038
|
-
private constructor();
|
|
937
|
+
parentContext: ExecutionContext<TParent>;
|
|
1039
938
|
/**
|
|
1040
939
|
* The current event within an event handler.
|
|
1041
940
|
*/
|
|
1042
|
-
|
|
941
|
+
readonly event: Event;
|
|
1043
942
|
/**
|
|
1044
943
|
* Indicates whether the current item within a repeat context
|
|
1045
944
|
* has an even index.
|
|
1046
945
|
*/
|
|
1047
|
-
|
|
946
|
+
readonly isEven: boolean;
|
|
1048
947
|
/**
|
|
1049
948
|
* Indicates whether the current item within a repeat context
|
|
1050
949
|
* has an odd index.
|
|
1051
950
|
*/
|
|
1052
|
-
|
|
951
|
+
readonly isOdd: boolean;
|
|
1053
952
|
/**
|
|
1054
953
|
* Indicates whether the current item within a repeat context
|
|
1055
954
|
* is the first item in the collection.
|
|
1056
955
|
*/
|
|
1057
|
-
|
|
956
|
+
readonly isFirst: boolean;
|
|
1058
957
|
/**
|
|
1059
958
|
* Indicates whether the current item within a repeat context
|
|
1060
959
|
* is somewhere in the middle of the collection.
|
|
1061
960
|
*/
|
|
1062
|
-
|
|
961
|
+
readonly isInMiddle: boolean;
|
|
1063
962
|
/**
|
|
1064
963
|
* Indicates whether the current item within a repeat context
|
|
1065
964
|
* is the last item in the collection.
|
|
1066
965
|
*/
|
|
1067
|
-
|
|
966
|
+
readonly isLast: boolean;
|
|
1068
967
|
/**
|
|
1069
968
|
* Returns the typed event detail of a custom event.
|
|
1070
969
|
*/
|
|
@@ -1073,37 +972,28 @@ export declare class ExecutionContext<TParentSource = any> {
|
|
|
1073
972
|
* Returns the typed event target of the event.
|
|
1074
973
|
*/
|
|
1075
974
|
eventTarget<TTarget extends EventTarget>(): TTarget;
|
|
975
|
+
}
|
|
976
|
+
|
|
977
|
+
/**
|
|
978
|
+
* Provides additional contextual information available to behaviors and expressions.
|
|
979
|
+
* @public
|
|
980
|
+
*/
|
|
981
|
+
export declare const ExecutionContext: Readonly<{
|
|
1076
982
|
/**
|
|
1077
|
-
*
|
|
1078
|
-
* @param index - The new index of the item.
|
|
1079
|
-
* @param length - The new length of the list.
|
|
1080
|
-
*/
|
|
1081
|
-
updatePosition(index: number, length: number): void;
|
|
1082
|
-
/**
|
|
1083
|
-
* Creates a new execution context descendent from the current context.
|
|
1084
|
-
* @param source - The source for the context if different than the parent.
|
|
1085
|
-
* @returns A child execution context.
|
|
1086
|
-
*/
|
|
1087
|
-
createChildContext<TParentSource>(parentSource: TParentSource): ExecutionContext<TParentSource>;
|
|
1088
|
-
/**
|
|
1089
|
-
* Creates a new execution context descent suitable for use in list rendering.
|
|
1090
|
-
* @param item - The list item to serve as the source.
|
|
1091
|
-
* @param index - The index of the item in the list.
|
|
1092
|
-
* @param length - The length of the list.
|
|
983
|
+
* A default execution context.
|
|
1093
984
|
*/
|
|
1094
|
-
|
|
985
|
+
default: ExecutionContext<any>;
|
|
1095
986
|
/**
|
|
1096
|
-
*
|
|
1097
|
-
* @
|
|
1098
|
-
* @internal
|
|
987
|
+
* Gets the current event.
|
|
988
|
+
* @returns An event object.
|
|
1099
989
|
*/
|
|
1100
|
-
|
|
990
|
+
getEvent(): Event | null;
|
|
1101
991
|
/**
|
|
1102
|
-
*
|
|
1103
|
-
* @
|
|
992
|
+
* Sets the current event.
|
|
993
|
+
* @param event - An event object.
|
|
1104
994
|
*/
|
|
1105
|
-
|
|
1106
|
-
}
|
|
995
|
+
setEvent(event: Event | null): void;
|
|
996
|
+
}>;
|
|
1107
997
|
|
|
1108
998
|
/**
|
|
1109
999
|
* The signature of an arrow function capable of being evaluated
|
|
@@ -1112,11 +1002,47 @@ export declare class ExecutionContext<TParentSource = any> {
|
|
|
1112
1002
|
*/
|
|
1113
1003
|
export declare type Expression<TSource = any, TReturn = any, TParent = any> = (source: TSource, context: ExecutionContext<TParent>) => TReturn;
|
|
1114
1004
|
|
|
1005
|
+
/**
|
|
1006
|
+
* Controls the lifecycle of an expression and provides relevant context.
|
|
1007
|
+
* @public
|
|
1008
|
+
*/
|
|
1009
|
+
export declare interface ExpressionController<TSource = any, TParent = any> {
|
|
1010
|
+
/**
|
|
1011
|
+
* The source the expression is evaluated against.
|
|
1012
|
+
*/
|
|
1013
|
+
readonly source: TSource;
|
|
1014
|
+
/**
|
|
1015
|
+
* Indicates how the source's lifetime relates to the controller's lifetime.
|
|
1016
|
+
*/
|
|
1017
|
+
readonly sourceLifetime?: SourceLifetime;
|
|
1018
|
+
/**
|
|
1019
|
+
* The context the expression is evaluated against.
|
|
1020
|
+
*/
|
|
1021
|
+
readonly context: ExecutionContext<TParent>;
|
|
1022
|
+
/**
|
|
1023
|
+
* Indicates whether the controller is bound.
|
|
1024
|
+
*/
|
|
1025
|
+
readonly isBound: boolean;
|
|
1026
|
+
/**
|
|
1027
|
+
* Registers an unbind handler with the controller.
|
|
1028
|
+
* @param behavior - An object to call when the controller unbinds.
|
|
1029
|
+
*/
|
|
1030
|
+
onUnbind(behavior: {
|
|
1031
|
+
unbind(controller: ExpressionController<TSource, TParent>): any;
|
|
1032
|
+
}): void;
|
|
1033
|
+
}
|
|
1034
|
+
|
|
1115
1035
|
/**
|
|
1116
1036
|
* Enables evaluation of and subscription to a binding.
|
|
1117
1037
|
* @public
|
|
1118
1038
|
*/
|
|
1119
|
-
export declare interface ExpressionNotifier<TSource = any, TReturn = any, TParent = any> extends Notifier, ExpressionObserver<TSource, TReturn, TParent
|
|
1039
|
+
export declare interface ExpressionNotifier<TSource = any, TReturn = any, TParent = any> extends Notifier, ExpressionObserver<TSource, TReturn, TParent>, Disposable {
|
|
1040
|
+
/**
|
|
1041
|
+
* Observes the expression.
|
|
1042
|
+
* @param source - The source for the expression.
|
|
1043
|
+
* @param context - The context for the expression.
|
|
1044
|
+
*/
|
|
1045
|
+
observe(source: TSource, context?: ExecutionContext): TReturn;
|
|
1120
1046
|
/**
|
|
1121
1047
|
* Gets {@link ObservationRecord|ObservationRecords} that the {@link ExpressionNotifier}
|
|
1122
1048
|
* is observing.
|
|
@@ -1134,17 +1060,16 @@ export declare interface ExpressionNotifier<TSource = any, TReturn = any, TParen
|
|
|
1134
1060
|
}
|
|
1135
1061
|
|
|
1136
1062
|
/**
|
|
1137
|
-
* Observes
|
|
1138
|
-
*
|
|
1063
|
+
* Observes an expression for changes.
|
|
1139
1064
|
* @public
|
|
1140
1065
|
*/
|
|
1141
|
-
export declare interface ExpressionObserver<TSource = any, TReturn = any, TParent = any>
|
|
1066
|
+
export declare interface ExpressionObserver<TSource = any, TReturn = any, TParent = any> {
|
|
1142
1067
|
/**
|
|
1143
|
-
*
|
|
1144
|
-
* @param
|
|
1145
|
-
*
|
|
1068
|
+
* Binds the expression to the source.
|
|
1069
|
+
* @param controller - The controller that manages the lifecycle and related
|
|
1070
|
+
* context for the expression.
|
|
1146
1071
|
*/
|
|
1147
|
-
|
|
1072
|
+
bind(controller: ExpressionController<TSource, TParent>): TReturn;
|
|
1148
1073
|
}
|
|
1149
1074
|
|
|
1150
1075
|
/**
|
|
@@ -1162,7 +1087,7 @@ export declare interface FASTElement extends HTMLElement {
|
|
|
1162
1087
|
* The underlying controller that handles the lifecycle and rendering of
|
|
1163
1088
|
* this FASTElement.
|
|
1164
1089
|
*/
|
|
1165
|
-
readonly $fastController:
|
|
1090
|
+
readonly $fastController: ElementController;
|
|
1166
1091
|
/**
|
|
1167
1092
|
* Emits a custom HTML event.
|
|
1168
1093
|
* @param type - The type name of the event.
|
|
@@ -1251,11 +1176,15 @@ export declare class FASTElementDefinition<TType extends Constructable<HTMLEleme
|
|
|
1251
1176
|
/**
|
|
1252
1177
|
* Options controlling the creation of the custom element's shadow DOM.
|
|
1253
1178
|
*/
|
|
1254
|
-
readonly shadowOptions?:
|
|
1179
|
+
readonly shadowOptions?: ShadowRootOptions;
|
|
1255
1180
|
/**
|
|
1256
1181
|
* Options controlling how the custom element is defined with the platform.
|
|
1257
1182
|
*/
|
|
1258
|
-
readonly elementOptions
|
|
1183
|
+
readonly elementOptions: ElementDefinitionOptions;
|
|
1184
|
+
/**
|
|
1185
|
+
* The registry to register this component in by default.
|
|
1186
|
+
*/
|
|
1187
|
+
readonly registry: CustomElementRegistry;
|
|
1259
1188
|
private constructor();
|
|
1260
1189
|
/**
|
|
1261
1190
|
* Defines a custom element based on this definition.
|
|
@@ -1323,6 +1252,75 @@ export declare interface FASTGlobal {
|
|
|
1323
1252
|
|
|
1324
1253
|
declare function from<TBase extends typeof HTMLElement>(BaseType: TBase): new () => InstanceType<TBase> & FASTElement;
|
|
1325
1254
|
|
|
1255
|
+
/**
|
|
1256
|
+
* Represents an object that can contribute behavior to a host.
|
|
1257
|
+
* @public
|
|
1258
|
+
*/
|
|
1259
|
+
export declare interface HostBehavior<TSource = any> {
|
|
1260
|
+
/**
|
|
1261
|
+
* Executed when this behavior is attached to a controller.
|
|
1262
|
+
* @param controller - Controls the behavior lifecycle.
|
|
1263
|
+
*/
|
|
1264
|
+
addedCallback?(controller: HostController<TSource>): void;
|
|
1265
|
+
/**
|
|
1266
|
+
* Executed when this behavior is detached from a controller.
|
|
1267
|
+
* @param controller - Controls the behavior lifecycle.
|
|
1268
|
+
*/
|
|
1269
|
+
removedCallback?(controller: HostController<TSource>): void;
|
|
1270
|
+
/**
|
|
1271
|
+
* Executed when this behavior's host is connected.
|
|
1272
|
+
* @param controller - Controls the behavior lifecycle.
|
|
1273
|
+
*/
|
|
1274
|
+
connectedCallback?(controller: HostController<TSource>): void;
|
|
1275
|
+
/**
|
|
1276
|
+
* Executed when this behavior's host is disconnected.
|
|
1277
|
+
* @param controller - Controls the behavior lifecycle.
|
|
1278
|
+
*/
|
|
1279
|
+
disconnectedCallback?(controller: HostController<TSource>): void;
|
|
1280
|
+
}
|
|
1281
|
+
|
|
1282
|
+
/**
|
|
1283
|
+
* Controls the lifecycle and context of behaviors and styles
|
|
1284
|
+
* associated with a component host.
|
|
1285
|
+
* @public
|
|
1286
|
+
*/
|
|
1287
|
+
export declare interface HostController<TSource = any> {
|
|
1288
|
+
/**
|
|
1289
|
+
* The component source.
|
|
1290
|
+
*/
|
|
1291
|
+
readonly source: TSource;
|
|
1292
|
+
/**
|
|
1293
|
+
* Indicates whether the host is connected or not.
|
|
1294
|
+
*/
|
|
1295
|
+
readonly isConnected: boolean;
|
|
1296
|
+
/**
|
|
1297
|
+
* The main set of styles used for the component, independent
|
|
1298
|
+
* of any behavior-specific styles.
|
|
1299
|
+
*/
|
|
1300
|
+
mainStyles: ElementStyles | null;
|
|
1301
|
+
/**
|
|
1302
|
+
* Adds the behavior to the component.
|
|
1303
|
+
* @param behavior - The behavior to add.
|
|
1304
|
+
*/
|
|
1305
|
+
addBehavior(behavior: HostBehavior<TSource>): void;
|
|
1306
|
+
/**
|
|
1307
|
+
* Removes the behavior from the component.
|
|
1308
|
+
* @param behavior - The behavior to remove.
|
|
1309
|
+
* @param force - Forces removal even if this behavior was added more than once.
|
|
1310
|
+
*/
|
|
1311
|
+
removeBehavior(behavior: HostBehavior<TSource>, force?: boolean): void;
|
|
1312
|
+
/**
|
|
1313
|
+
* Adds styles to this element. Providing an HTMLStyleElement will attach the element instance to the shadowRoot.
|
|
1314
|
+
* @param styles - The styles to add.
|
|
1315
|
+
*/
|
|
1316
|
+
addStyles(styles: ElementStyles | HTMLStyleElement | null | undefined): void;
|
|
1317
|
+
/**
|
|
1318
|
+
* Removes styles from this element. Providing an HTMLStyleElement will detach the element instance from the shadowRoot.
|
|
1319
|
+
* @param styles - the styles to remove.
|
|
1320
|
+
*/
|
|
1321
|
+
removeStyles(styles: ElementStyles | HTMLStyleElement | null | undefined): void;
|
|
1322
|
+
}
|
|
1323
|
+
|
|
1326
1324
|
/**
|
|
1327
1325
|
* Transforms a template literal string into a ViewTemplate.
|
|
1328
1326
|
* @param strings - The string fragments that are interpolated with the values.
|
|
@@ -1338,9 +1336,10 @@ export declare function html<TSource = any, TParent = any>(strings: TemplateStri
|
|
|
1338
1336
|
* A directive that applies bindings.
|
|
1339
1337
|
* @public
|
|
1340
1338
|
*/
|
|
1341
|
-
export declare class HTMLBindingDirective implements HTMLDirective, ViewBehaviorFactory, Aspected {
|
|
1339
|
+
export declare class HTMLBindingDirective implements HTMLDirective, ViewBehaviorFactory, ViewBehavior, Aspected {
|
|
1342
1340
|
dataBinding: Binding;
|
|
1343
|
-
private
|
|
1341
|
+
private data;
|
|
1342
|
+
private updateTarget;
|
|
1344
1343
|
/**
|
|
1345
1344
|
* The unique id of the factory.
|
|
1346
1345
|
*/
|
|
@@ -1373,9 +1372,22 @@ export declare class HTMLBindingDirective implements HTMLDirective, ViewBehavior
|
|
|
1373
1372
|
createHTML(add: AddViewBehaviorFactory): string;
|
|
1374
1373
|
/**
|
|
1375
1374
|
* Creates a behavior.
|
|
1376
|
-
* @param targets - The targets available for behaviors to be attached to.
|
|
1377
1375
|
*/
|
|
1378
|
-
createBehavior(
|
|
1376
|
+
createBehavior(): ViewBehavior;
|
|
1377
|
+
/** @internal */
|
|
1378
|
+
bindDefault(controller: ViewController): void;
|
|
1379
|
+
/** @internal */
|
|
1380
|
+
bind: (controller: ViewController) => void;
|
|
1381
|
+
/** @internal */
|
|
1382
|
+
bindContent(controller: ViewController): void;
|
|
1383
|
+
/** @internal */
|
|
1384
|
+
bindEvent(controller: ViewController): void;
|
|
1385
|
+
/** @internal */
|
|
1386
|
+
unbind(controller: ViewController): void;
|
|
1387
|
+
/** @internal */
|
|
1388
|
+
handleEvent(event: Event): void;
|
|
1389
|
+
/** @internal */
|
|
1390
|
+
handleChange(binding: Expression, observer: ExpressionObserver): void;
|
|
1379
1391
|
}
|
|
1380
1392
|
|
|
1381
1393
|
/**
|
|
@@ -1447,19 +1459,75 @@ export declare interface HTMLTemplateCompilationResult<TSource = any, TParent =
|
|
|
1447
1459
|
* The standard View implementation, which also implements ElementView and SyntheticView.
|
|
1448
1460
|
* @public
|
|
1449
1461
|
*/
|
|
1450
|
-
export declare class HTMLView<TSource = any, TParent = any> implements ElementView<TSource, TParent>, SyntheticView<TSource, TParent> {
|
|
1462
|
+
export declare class HTMLView<TSource = any, TParent = any> implements ElementView<TSource, TParent>, SyntheticView<TSource, TParent>, ExecutionContext<TParent> {
|
|
1451
1463
|
private fragment;
|
|
1452
1464
|
private factories;
|
|
1453
|
-
|
|
1465
|
+
readonly targets: ViewBehaviorTargets;
|
|
1454
1466
|
private behaviors;
|
|
1467
|
+
private unbindables;
|
|
1455
1468
|
/**
|
|
1456
1469
|
* The data that the view is bound to.
|
|
1457
1470
|
*/
|
|
1458
1471
|
source: TSource | null;
|
|
1472
|
+
isBound: boolean;
|
|
1473
|
+
selfContained: boolean;
|
|
1459
1474
|
/**
|
|
1460
1475
|
* The execution context the view is running within.
|
|
1461
1476
|
*/
|
|
1462
|
-
context: ExecutionContext<TParent
|
|
1477
|
+
get context(): ExecutionContext<TParent>;
|
|
1478
|
+
/**
|
|
1479
|
+
* The index of the current item within a repeat context.
|
|
1480
|
+
*/
|
|
1481
|
+
index: number;
|
|
1482
|
+
/**
|
|
1483
|
+
* The length of the current collection within a repeat context.
|
|
1484
|
+
*/
|
|
1485
|
+
length: number;
|
|
1486
|
+
/**
|
|
1487
|
+
* The parent data source within a nested context.
|
|
1488
|
+
*/
|
|
1489
|
+
readonly parent: TParent;
|
|
1490
|
+
/**
|
|
1491
|
+
* The parent execution context when in nested context scenarios.
|
|
1492
|
+
*/
|
|
1493
|
+
readonly parentContext: ExecutionContext<TParent>;
|
|
1494
|
+
/**
|
|
1495
|
+
* The current event within an event handler.
|
|
1496
|
+
*/
|
|
1497
|
+
get event(): Event;
|
|
1498
|
+
/**
|
|
1499
|
+
* Indicates whether the current item within a repeat context
|
|
1500
|
+
* has an even index.
|
|
1501
|
+
*/
|
|
1502
|
+
get isEven(): boolean;
|
|
1503
|
+
/**
|
|
1504
|
+
* Indicates whether the current item within a repeat context
|
|
1505
|
+
* has an odd index.
|
|
1506
|
+
*/
|
|
1507
|
+
get isOdd(): boolean;
|
|
1508
|
+
/**
|
|
1509
|
+
* Indicates whether the current item within a repeat context
|
|
1510
|
+
* is the first item in the collection.
|
|
1511
|
+
*/
|
|
1512
|
+
get isFirst(): boolean;
|
|
1513
|
+
/**
|
|
1514
|
+
* Indicates whether the current item within a repeat context
|
|
1515
|
+
* is somewhere in the middle of the collection.
|
|
1516
|
+
*/
|
|
1517
|
+
get isInMiddle(): boolean;
|
|
1518
|
+
/**
|
|
1519
|
+
* Indicates whether the current item within a repeat context
|
|
1520
|
+
* is the last item in the collection.
|
|
1521
|
+
*/
|
|
1522
|
+
get isLast(): boolean;
|
|
1523
|
+
/**
|
|
1524
|
+
* Returns the typed event detail of a custom event.
|
|
1525
|
+
*/
|
|
1526
|
+
eventDetail<TDetail>(): TDetail;
|
|
1527
|
+
/**
|
|
1528
|
+
* Returns the typed event target of the event.
|
|
1529
|
+
*/
|
|
1530
|
+
eventTarget<TTarget extends EventTarget>(): TTarget;
|
|
1463
1531
|
/**
|
|
1464
1532
|
* The first DOM node in the range of nodes that make up the view.
|
|
1465
1533
|
*/
|
|
@@ -1494,16 +1562,20 @@ export declare class HTMLView<TSource = any, TParent = any> implements ElementVi
|
|
|
1494
1562
|
* Once a view has been disposed, it cannot be inserted or bound again.
|
|
1495
1563
|
*/
|
|
1496
1564
|
dispose(): void;
|
|
1565
|
+
onUnbind(behavior: {
|
|
1566
|
+
unbind(controller: ViewController<TSource, TParent>): any;
|
|
1567
|
+
}): void;
|
|
1497
1568
|
/**
|
|
1498
1569
|
* Binds a view's behaviors to its binding source.
|
|
1499
1570
|
* @param source - The binding source for the view's binding behaviors.
|
|
1500
1571
|
* @param context - The execution context to run the behaviors within.
|
|
1501
1572
|
*/
|
|
1502
|
-
bind(source: TSource
|
|
1573
|
+
bind(source: TSource): void;
|
|
1503
1574
|
/**
|
|
1504
1575
|
* Unbinds a view's behaviors from its binding source.
|
|
1505
1576
|
*/
|
|
1506
1577
|
unbind(): void;
|
|
1578
|
+
private evaluateUnbindables;
|
|
1507
1579
|
/**
|
|
1508
1580
|
* Efficiently disposes of a contiguous range of synthetic view instances.
|
|
1509
1581
|
* @param views - A contiguous range of views to be disposed.
|
|
@@ -1611,14 +1683,14 @@ export declare abstract class NodeObservationDirective<T extends NodeBehaviorOpt
|
|
|
1611
1683
|
* @param context - The execution context that the binding is operating within.
|
|
1612
1684
|
* @param targets - The targets that behaviors in a view can attach to.
|
|
1613
1685
|
*/
|
|
1614
|
-
bind(
|
|
1686
|
+
bind(controller: ViewController): void;
|
|
1615
1687
|
/**
|
|
1616
1688
|
* Unbinds this behavior from the source.
|
|
1617
1689
|
* @param source - The source to unbind from.
|
|
1618
1690
|
* @param context - The execution context that the binding is operating within.
|
|
1619
1691
|
* @param targets - The targets that behaviors in a view can attach to.
|
|
1620
1692
|
*/
|
|
1621
|
-
unbind(
|
|
1693
|
+
unbind(controller: ViewController): void;
|
|
1622
1694
|
/**
|
|
1623
1695
|
* Gets the data source for the target.
|
|
1624
1696
|
* @param target - The target to get the source for.
|
|
@@ -1839,12 +1911,21 @@ export declare interface PartialFASTElementDefinition {
|
|
|
1839
1911
|
readonly attributes?: (AttributeConfiguration | string)[];
|
|
1840
1912
|
/**
|
|
1841
1913
|
* Options controlling the creation of the custom element's shadow DOM.
|
|
1914
|
+
* @remarks
|
|
1915
|
+
* If not provided, defaults to an open shadow root. Provide null
|
|
1916
|
+
* to render to the associated template to the light DOM instead.
|
|
1842
1917
|
*/
|
|
1843
|
-
readonly shadowOptions?: Partial<
|
|
1918
|
+
readonly shadowOptions?: Partial<ShadowRootOptions> | null;
|
|
1844
1919
|
/**
|
|
1845
1920
|
* Options controlling how the custom element is defined with the platform.
|
|
1846
1921
|
*/
|
|
1847
1922
|
readonly elementOptions?: ElementDefinitionOptions;
|
|
1923
|
+
/**
|
|
1924
|
+
* The registry to register this component in by default.
|
|
1925
|
+
* @remarks
|
|
1926
|
+
* If not provided, defaults to the global registry.
|
|
1927
|
+
*/
|
|
1928
|
+
readonly registry?: CustomElementRegistry;
|
|
1848
1929
|
}
|
|
1849
1930
|
|
|
1850
1931
|
/**
|
|
@@ -1900,7 +1981,7 @@ export declare class PropertyChangeNotifier implements Notifier {
|
|
|
1900
1981
|
* @param propertyName - The name of the property to assign the reference to.
|
|
1901
1982
|
* @public
|
|
1902
1983
|
*/
|
|
1903
|
-
export declare const ref: <
|
|
1984
|
+
export declare const ref: <TSource = any, TParent = any>(propertyName: keyof TSource & string) => CaptureType<TSource, TParent>;
|
|
1904
1985
|
|
|
1905
1986
|
/**
|
|
1906
1987
|
* The runtime behavior for template references.
|
|
@@ -1908,17 +1989,10 @@ export declare const ref: <T = any>(propertyName: keyof T & string) => CaptureTy
|
|
|
1908
1989
|
*/
|
|
1909
1990
|
export declare class RefDirective extends StatelessAttachedAttributeDirective<string> {
|
|
1910
1991
|
/**
|
|
1911
|
-
* Bind this behavior
|
|
1912
|
-
* @param
|
|
1913
|
-
* @param context - The execution context that the binding is operating within.
|
|
1914
|
-
* @param targets - The targets that behaviors in a view can attach to.
|
|
1915
|
-
*/
|
|
1916
|
-
bind(source: any, context: ExecutionContext, targets: ViewBehaviorTargets): void;
|
|
1917
|
-
/**
|
|
1918
|
-
* Unbinds this behavior from the source.
|
|
1919
|
-
* @param source - The source to unbind from.
|
|
1992
|
+
* Bind this behavior.
|
|
1993
|
+
* @param controller - The view controller that manages the lifecycle of this behavior.
|
|
1920
1994
|
*/
|
|
1921
|
-
|
|
1995
|
+
bind(controller: ViewController): void;
|
|
1922
1996
|
}
|
|
1923
1997
|
|
|
1924
1998
|
declare const reflectMode = "reflect";
|
|
@@ -1931,24 +2005,22 @@ declare const reflectMode = "reflect";
|
|
|
1931
2005
|
* @param options - Options used to turn on special repeat features.
|
|
1932
2006
|
* @public
|
|
1933
2007
|
*/
|
|
1934
|
-
export declare function repeat<TSource = any, TArray extends ReadonlyArray<any> = ReadonlyArray<any
|
|
2008
|
+
export declare function repeat<TSource = any, TArray extends ReadonlyArray<any> = ReadonlyArray<any>, TParent = any>(items: Expression<TSource, TArray, TParent> | Binding<TSource, TArray, TParent> | ReadonlyArray<any>, template: Expression<TSource, ViewTemplate<any, TSource>> | Binding<TSource, ViewTemplate<any, TSource>> | ViewTemplate<any, TSource>, options?: RepeatOptions): CaptureType<TSource, TParent>;
|
|
1935
2009
|
|
|
1936
2010
|
/**
|
|
1937
2011
|
* A behavior that renders a template for each item in an array.
|
|
1938
2012
|
* @public
|
|
1939
2013
|
*/
|
|
1940
|
-
export declare class RepeatBehavior<TSource = any> implements
|
|
2014
|
+
export declare class RepeatBehavior<TSource = any> implements ViewBehavior, Subscriber {
|
|
1941
2015
|
private directive;
|
|
1942
2016
|
private location;
|
|
1943
|
-
private
|
|
2017
|
+
private controller;
|
|
1944
2018
|
private views;
|
|
1945
2019
|
private template;
|
|
1946
2020
|
private templateBindingObserver;
|
|
1947
2021
|
private items;
|
|
1948
2022
|
private itemsObserver;
|
|
1949
2023
|
private itemsBindingObserver;
|
|
1950
|
-
private context;
|
|
1951
|
-
private childContext;
|
|
1952
2024
|
private bindView;
|
|
1953
2025
|
/**
|
|
1954
2026
|
* Creates an instance of RepeatBehavior.
|
|
@@ -1959,16 +2031,14 @@ export declare class RepeatBehavior<TSource = any> implements Behavior, Subscrib
|
|
|
1959
2031
|
* @param isTemplateBindingVolatile - Indicates whether the template binding has volatile dependencies.
|
|
1960
2032
|
* @param options - Options used to turn on special repeat features.
|
|
1961
2033
|
*/
|
|
1962
|
-
constructor(directive: RepeatDirective
|
|
2034
|
+
constructor(directive: RepeatDirective);
|
|
1963
2035
|
/**
|
|
1964
|
-
* Bind this behavior
|
|
1965
|
-
* @param
|
|
1966
|
-
* @param context - The execution context that the binding is operating within.
|
|
2036
|
+
* Bind this behavior.
|
|
2037
|
+
* @param controller - The view controller that manages the lifecycle of this behavior.
|
|
1967
2038
|
*/
|
|
1968
|
-
bind(
|
|
2039
|
+
bind(controller: ViewController): void;
|
|
1969
2040
|
/**
|
|
1970
|
-
* Unbinds this behavior
|
|
1971
|
-
* @param source - The source to unbind from.
|
|
2041
|
+
* Unbinds this behavior.
|
|
1972
2042
|
*/
|
|
1973
2043
|
unbind(): void;
|
|
1974
2044
|
/**
|
|
@@ -2015,7 +2085,7 @@ export declare class RepeatDirective<TSource = any> implements HTMLDirective, Vi
|
|
|
2015
2085
|
* Creates a behavior for the provided target node.
|
|
2016
2086
|
* @param target - The node instance to create the behavior for.
|
|
2017
2087
|
*/
|
|
2018
|
-
createBehavior(
|
|
2088
|
+
createBehavior(): RepeatBehavior<TSource>;
|
|
2019
2089
|
}
|
|
2020
2090
|
|
|
2021
2091
|
/**
|
|
@@ -2033,13 +2103,26 @@ export declare interface RepeatOptions {
|
|
|
2033
2103
|
recycle?: boolean;
|
|
2034
2104
|
}
|
|
2035
2105
|
|
|
2106
|
+
/**
|
|
2107
|
+
* Shadow root initialization options.
|
|
2108
|
+
* @public
|
|
2109
|
+
*/
|
|
2110
|
+
export declare interface ShadowRootOptions extends ShadowRootInit {
|
|
2111
|
+
/**
|
|
2112
|
+
* A registry that provides the custom elements visible
|
|
2113
|
+
* from within this shadow root.
|
|
2114
|
+
* @beta
|
|
2115
|
+
*/
|
|
2116
|
+
registry?: CustomElementRegistry;
|
|
2117
|
+
}
|
|
2118
|
+
|
|
2036
2119
|
/**
|
|
2037
2120
|
* A directive that observes the `assignedNodes()` of a slot and updates a property
|
|
2038
2121
|
* whenever they change.
|
|
2039
2122
|
* @param propertyOrOptions - The options used to configure slotted node observation.
|
|
2040
2123
|
* @public
|
|
2041
2124
|
*/
|
|
2042
|
-
export declare function slotted<
|
|
2125
|
+
export declare function slotted<TSource = any, TParent = any>(propertyOrOptions: (keyof TSource & string) | SlottedDirectiveOptions<keyof TSource & string>): CaptureType<TSource, TParent>;
|
|
2043
2126
|
|
|
2044
2127
|
/**
|
|
2045
2128
|
* The runtime behavior for slotted node observation.
|
|
@@ -2072,6 +2155,28 @@ export declare class SlottedDirective extends NodeObservationDirective<SlottedDi
|
|
|
2072
2155
|
export declare interface SlottedDirectiveOptions<T = any> extends NodeBehaviorOptions<T>, AssignedNodesOptions {
|
|
2073
2156
|
}
|
|
2074
2157
|
|
|
2158
|
+
/**
|
|
2159
|
+
* Describes how the source's lifetime relates to its controller's lifetime.
|
|
2160
|
+
* @public
|
|
2161
|
+
*/
|
|
2162
|
+
export declare const SourceLifetime: Readonly<{
|
|
2163
|
+
/**
|
|
2164
|
+
* The source to controller lifetime relationship is unknown.
|
|
2165
|
+
*/
|
|
2166
|
+
readonly unknown: undefined;
|
|
2167
|
+
/**
|
|
2168
|
+
* The source and controller lifetimes are coupled to one another.
|
|
2169
|
+
* They can/will be GC'd together.
|
|
2170
|
+
*/
|
|
2171
|
+
readonly coupled: 1;
|
|
2172
|
+
}>;
|
|
2173
|
+
|
|
2174
|
+
/**
|
|
2175
|
+
* Describes how the source's lifetime relates to its controller's lifetime.
|
|
2176
|
+
* @public
|
|
2177
|
+
*/
|
|
2178
|
+
export declare type SourceLifetime = typeof SourceLifetime[keyof typeof SourceLifetime];
|
|
2179
|
+
|
|
2075
2180
|
/**
|
|
2076
2181
|
* A splice map is a representation of how a previous array of items
|
|
2077
2182
|
* was transformed into a new array of items. Conceptually it is a list of
|
|
@@ -2228,8 +2333,8 @@ export declare type SpliceStrategySupport = typeof SpliceStrategySupport[keyof t
|
|
|
2228
2333
|
* A base class used for attribute directives that don't need internal state.
|
|
2229
2334
|
* @public
|
|
2230
2335
|
*/
|
|
2231
|
-
export declare abstract class StatelessAttachedAttributeDirective<
|
|
2232
|
-
protected options:
|
|
2336
|
+
export declare abstract class StatelessAttachedAttributeDirective<TOptions> implements HTMLDirective, ViewBehaviorFactory, ViewBehavior {
|
|
2337
|
+
protected options: TOptions;
|
|
2233
2338
|
/**
|
|
2234
2339
|
* The unique id of the factory.
|
|
2235
2340
|
*/
|
|
@@ -2242,12 +2347,7 @@ export declare abstract class StatelessAttachedAttributeDirective<T> implements
|
|
|
2242
2347
|
* Creates an instance of RefDirective.
|
|
2243
2348
|
* @param options - The options to use in configuring the directive.
|
|
2244
2349
|
*/
|
|
2245
|
-
constructor(options:
|
|
2246
|
-
/**
|
|
2247
|
-
* Creates a behavior.
|
|
2248
|
-
* @param targets - The targets available for behaviors to be attached to.
|
|
2249
|
-
*/
|
|
2250
|
-
createBehavior(targets: ViewBehaviorTargets): ViewBehavior;
|
|
2350
|
+
constructor(options: TOptions);
|
|
2251
2351
|
/**
|
|
2252
2352
|
* Creates a placeholder string based on the directive's index within the template.
|
|
2253
2353
|
* @param index - The index of the directive within the template.
|
|
@@ -2256,17 +2356,15 @@ export declare abstract class StatelessAttachedAttributeDirective<T> implements
|
|
|
2256
2356
|
*/
|
|
2257
2357
|
createHTML(add: AddViewBehaviorFactory): string;
|
|
2258
2358
|
/**
|
|
2259
|
-
*
|
|
2260
|
-
* @param
|
|
2261
|
-
* @param context - The execution context that the binding is operating within.
|
|
2262
|
-
* @param targets - The targets that behaviors in a view can attach to.
|
|
2359
|
+
* Creates a behavior.
|
|
2360
|
+
* @param targets - The targets available for behaviors to be attached to.
|
|
2263
2361
|
*/
|
|
2264
|
-
|
|
2362
|
+
createBehavior(): ViewBehavior;
|
|
2265
2363
|
/**
|
|
2266
|
-
*
|
|
2267
|
-
* @param
|
|
2364
|
+
* Bind this behavior.
|
|
2365
|
+
* @param controller - The view controller that manages the lifecycle of this behavior.
|
|
2268
2366
|
*/
|
|
2269
|
-
abstract
|
|
2367
|
+
abstract bind(controller: ViewController): void;
|
|
2270
2368
|
}
|
|
2271
2369
|
|
|
2272
2370
|
/**
|
|
@@ -2429,7 +2527,7 @@ export declare interface SyntheticViewTemplate<TSource = any, TParent = any> {
|
|
|
2429
2527
|
* Represents the types of values that can be interpolated into a template.
|
|
2430
2528
|
* @public
|
|
2431
2529
|
*/
|
|
2432
|
-
export declare type TemplateValue<TSource, TParent = any> = Expression<TSource, any, TParent> | Binding<TSource, any, TParent> | HTMLDirective | CaptureType<TSource>;
|
|
2530
|
+
export declare type TemplateValue<TSource, TParent = any> = Expression<TSource, any, TParent> | Binding<TSource, any, TParent> | HTMLDirective | CaptureType<TSource, TParent>;
|
|
2433
2531
|
|
|
2434
2532
|
/**
|
|
2435
2533
|
* Enables working with trusted types.
|
|
@@ -2515,29 +2613,6 @@ export declare interface UpdateQueue {
|
|
|
2515
2613
|
*/
|
|
2516
2614
|
export declare const Updates: UpdateQueue;
|
|
2517
2615
|
|
|
2518
|
-
/**
|
|
2519
|
-
* A target update function.
|
|
2520
|
-
* @param this - The "this" context for the update.
|
|
2521
|
-
* @param target - The node that is targeted by the update.
|
|
2522
|
-
* @param aspect - The aspect of the node that is being targeted.
|
|
2523
|
-
* @param value - The value to assign to the aspect.
|
|
2524
|
-
* @param source - The source object that the value was derived from.
|
|
2525
|
-
* @param context - The execution context that the binding is being run under.
|
|
2526
|
-
* @public
|
|
2527
|
-
*/
|
|
2528
|
-
export declare type UpdateTarget = (this: UpdateTargetThis, target: Node, aspect: string, value: any, source: any, context: ExecutionContext) => void;
|
|
2529
|
-
|
|
2530
|
-
/**
|
|
2531
|
-
* The "this" context for an update target function.
|
|
2532
|
-
* @public
|
|
2533
|
-
*/
|
|
2534
|
-
export declare interface UpdateTargetThis {
|
|
2535
|
-
/**
|
|
2536
|
-
* The directive configuration for the update.
|
|
2537
|
-
*/
|
|
2538
|
-
directive: HTMLBindingDirective;
|
|
2539
|
-
}
|
|
2540
|
-
|
|
2541
2616
|
/**
|
|
2542
2617
|
* Represents objects that can convert values to and from
|
|
2543
2618
|
* view or model representations.
|
|
@@ -2564,7 +2639,7 @@ export declare interface View<TSource = any, TParent = any> extends Disposable {
|
|
|
2564
2639
|
/**
|
|
2565
2640
|
* The execution context the view is running within.
|
|
2566
2641
|
*/
|
|
2567
|
-
readonly context: ExecutionContext<TParent
|
|
2642
|
+
readonly context: ExecutionContext<TParent>;
|
|
2568
2643
|
/**
|
|
2569
2644
|
* The data that the view is bound to.
|
|
2570
2645
|
*/
|
|
@@ -2572,9 +2647,8 @@ export declare interface View<TSource = any, TParent = any> extends Disposable {
|
|
|
2572
2647
|
/**
|
|
2573
2648
|
* Binds a view's behaviors to its binding source.
|
|
2574
2649
|
* @param source - The binding source for the view's binding behaviors.
|
|
2575
|
-
* @param context - The execution context to run the view within.
|
|
2576
2650
|
*/
|
|
2577
|
-
bind(source: TSource
|
|
2651
|
+
bind(source: TSource): void;
|
|
2578
2652
|
/**
|
|
2579
2653
|
* Unbinds a view's behaviors from its binding source and context.
|
|
2580
2654
|
*/
|
|
@@ -2587,23 +2661,14 @@ export declare interface View<TSource = any, TParent = any> extends Disposable {
|
|
|
2587
2661
|
*/
|
|
2588
2662
|
export declare interface ViewBehavior<TSource = any, TParent = any> {
|
|
2589
2663
|
/**
|
|
2590
|
-
* Bind this behavior
|
|
2591
|
-
* @param
|
|
2592
|
-
* @param context - The execution context that the binding is operating within.
|
|
2593
|
-
* @param targets - The targets that behaviors in a view can attach to.
|
|
2594
|
-
*/
|
|
2595
|
-
bind(source: TSource, context: ExecutionContext<TParent>, targets: ViewBehaviorTargets): void;
|
|
2596
|
-
/**
|
|
2597
|
-
* Unbinds this behavior from the source.
|
|
2598
|
-
* @param source - The source to unbind from.
|
|
2599
|
-
* @param context - The execution context that the binding is operating within.
|
|
2600
|
-
* @param targets - The targets that behaviors in a view can attach to.
|
|
2664
|
+
* Bind this behavior.
|
|
2665
|
+
* @param controller - The view controller that manages the lifecycle of this behavior.
|
|
2601
2666
|
*/
|
|
2602
|
-
|
|
2667
|
+
bind(controller: ViewController<TSource, TParent>): void;
|
|
2603
2668
|
}
|
|
2604
2669
|
|
|
2605
2670
|
/**
|
|
2606
|
-
* A factory that can create a {@link
|
|
2671
|
+
* A factory that can create a {@link ViewBehavior} associated with a particular
|
|
2607
2672
|
* location within a DOM fragment.
|
|
2608
2673
|
* @public
|
|
2609
2674
|
*/
|
|
@@ -2618,11 +2683,49 @@ export declare interface ViewBehaviorFactory {
|
|
|
2618
2683
|
nodeId: string;
|
|
2619
2684
|
/**
|
|
2620
2685
|
* Creates a behavior.
|
|
2621
|
-
* @param targets - The targets available for behaviors to be attached to.
|
|
2622
2686
|
*/
|
|
2623
|
-
createBehavior(
|
|
2687
|
+
createBehavior(): ViewBehavior;
|
|
2688
|
+
}
|
|
2689
|
+
|
|
2690
|
+
/**
|
|
2691
|
+
* Bridges between ViewBehaviors and HostBehaviors, enabling a host to
|
|
2692
|
+
* control ViewBehaviors.
|
|
2693
|
+
* @public
|
|
2694
|
+
*/
|
|
2695
|
+
export declare interface ViewBehaviorOrchestrator<TSource = any, TParent = any> extends ViewController<TSource, TParent>, HostBehavior<TSource> {
|
|
2696
|
+
/**
|
|
2697
|
+
*
|
|
2698
|
+
* @param nodeId - The structural id of the DOM node to which a behavior will apply.
|
|
2699
|
+
* @param target - The DOM node associated with the id.
|
|
2700
|
+
*/
|
|
2701
|
+
addTarget(nodeId: string, target: Node): void;
|
|
2702
|
+
/**
|
|
2703
|
+
* Adds a behavior.
|
|
2704
|
+
* @param behavior - The behavior to add.
|
|
2705
|
+
*/
|
|
2706
|
+
addBehavior(behavior: ViewBehavior): void;
|
|
2707
|
+
/**
|
|
2708
|
+
* Adds a behavior factory.
|
|
2709
|
+
* @param factory - The behavior factory to add.
|
|
2710
|
+
* @param target - The target the factory will create behaviors for.
|
|
2711
|
+
*/
|
|
2712
|
+
addBehaviorFactory(factory: ViewBehaviorFactory, target: Node): void;
|
|
2624
2713
|
}
|
|
2625
2714
|
|
|
2715
|
+
/**
|
|
2716
|
+
* Bridges between ViewBehaviors and HostBehaviors, enabling a host to
|
|
2717
|
+
* control ViewBehaviors.
|
|
2718
|
+
* @public
|
|
2719
|
+
*/
|
|
2720
|
+
export declare const ViewBehaviorOrchestrator: Readonly<{
|
|
2721
|
+
/**
|
|
2722
|
+
* Creates a ViewBehaviorOrchestrator.
|
|
2723
|
+
* @param source - The source to to associate behaviors with.
|
|
2724
|
+
* @returns A ViewBehaviorOrchestrator.
|
|
2725
|
+
*/
|
|
2726
|
+
create<TSource = any, TParent = any>(source: TSource): ViewBehaviorOrchestrator<TSource, TParent>;
|
|
2727
|
+
}>;
|
|
2728
|
+
|
|
2626
2729
|
/**
|
|
2627
2730
|
* The target nodes available to a behavior.
|
|
2628
2731
|
* @public
|
|
@@ -2631,6 +2734,17 @@ export declare type ViewBehaviorTargets = {
|
|
|
2631
2734
|
[id: string]: Node;
|
|
2632
2735
|
};
|
|
2633
2736
|
|
|
2737
|
+
/**
|
|
2738
|
+
* Controls the lifecycle of a view and provides relevant context.
|
|
2739
|
+
* @public
|
|
2740
|
+
*/
|
|
2741
|
+
export declare interface ViewController<TSource = any, TParent = any> extends ExpressionController<TSource, TParent> {
|
|
2742
|
+
/**
|
|
2743
|
+
* The parts of the view that are targeted by view behaviors.
|
|
2744
|
+
*/
|
|
2745
|
+
readonly targets: ViewBehaviorTargets;
|
|
2746
|
+
}
|
|
2747
|
+
|
|
2634
2748
|
/**
|
|
2635
2749
|
* A template capable of creating HTMLView instances or rendering directly to DOM.
|
|
2636
2750
|
* @public
|
|
@@ -2664,7 +2778,7 @@ export declare class ViewTemplate<TSource = any, TParent = any> implements Eleme
|
|
|
2664
2778
|
* @param hostBindingTarget - An HTML element to target the host bindings at if different from the
|
|
2665
2779
|
* host that the template is being attached to.
|
|
2666
2780
|
*/
|
|
2667
|
-
render(source: TSource, host: Node, hostBindingTarget?: Element
|
|
2781
|
+
render(source: TSource, host: Node, hostBindingTarget?: Element): HTMLView<TSource, TParent>;
|
|
2668
2782
|
}
|
|
2669
2783
|
|
|
2670
2784
|
/**
|
|
@@ -2683,6 +2797,6 @@ export declare function volatile(target: {}, name: string | Accessor, descriptor
|
|
|
2683
2797
|
* the template to render when the condition is true.
|
|
2684
2798
|
* @public
|
|
2685
2799
|
*/
|
|
2686
|
-
export declare function when<TSource = any, TReturn = any>(condition: Expression<TSource, TReturn> | boolean, templateOrTemplateBinding: SyntheticViewTemplate | Expression<TSource, SyntheticViewTemplate>): CaptureType<TSource>;
|
|
2800
|
+
export declare function when<TSource = any, TReturn = any, TParent = any>(condition: Expression<TSource, TReturn, TParent> | boolean, templateOrTemplateBinding: SyntheticViewTemplate<TSource, TParent> | Expression<TSource, SyntheticViewTemplate<TSource, TParent>, TParent>): CaptureType<TSource, TParent>;
|
|
2687
2801
|
|
|
2688
2802
|
export { }
|