@microsoft/fast-element 2.0.0-beta.9 → 2.0.1
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/.eslintrc.json +1 -1
- package/CHANGELOG.json +518 -0
- package/CHANGELOG.md +181 -1
- package/README.md +1 -9
- package/api-extractor.context.json +14 -0
- package/api-extractor.di.json +14 -0
- package/dist/context/context.api.json +1068 -0
- package/dist/di/di.api.json +4929 -0
- package/dist/dts/binding/binding.d.ts +49 -0
- package/dist/dts/binding/normalize.d.ts +9 -0
- package/dist/dts/binding/one-time.d.ts +11 -0
- package/dist/dts/binding/one-way.d.ts +20 -0
- package/dist/dts/{templating/binding-signal.d.ts → binding/signal.d.ts} +19 -4
- package/dist/dts/{templating/binding-two-way.d.ts → binding/two-way.d.ts} +9 -5
- package/dist/dts/components/attributes.d.ts +7 -1
- package/dist/dts/components/element-controller.d.ts +104 -8
- package/dist/dts/components/element-hydration.d.ts +2 -0
- package/dist/dts/components/fast-definitions.d.ts +6 -0
- package/dist/dts/components/hydration.d.ts +56 -0
- package/dist/dts/components/install-hydration.d.ts +1 -0
- package/dist/dts/context.d.ts +29 -15
- package/dist/dts/di/di.d.ts +0 -5
- package/dist/dts/dom-policy.d.ts +83 -0
- package/dist/dts/dom.d.ts +100 -0
- package/dist/dts/hydration/target-builder.d.ts +63 -0
- package/dist/dts/index.d.ts +33 -26
- package/dist/dts/index.rollup.d.ts +0 -1
- package/dist/dts/index.rollup.debug.d.ts +0 -1
- package/dist/dts/interfaces.d.ts +32 -82
- package/dist/dts/metadata.d.ts +6 -5
- package/dist/dts/observation/arrays.d.ts +1 -1
- package/dist/dts/observation/observable.bench.d.ts +18 -0
- package/dist/dts/observation/observable.d.ts +5 -5
- package/dist/dts/pending-task.d.ts +19 -7
- package/dist/dts/platform.d.ts +11 -2
- package/dist/dts/polyfills.d.ts +0 -8
- package/dist/dts/styles/css-binding-directive.d.ts +60 -0
- package/dist/dts/styles/css.d.ts +9 -7
- package/dist/dts/styles/element-styles.d.ts +1 -14
- package/dist/dts/styles/host.d.ts +2 -5
- package/dist/dts/styles/style-strategy.d.ts +42 -0
- package/dist/dts/templating/compiler.d.ts +11 -13
- package/dist/dts/templating/{binding.d.ts → html-binding-directive.d.ts} +21 -41
- package/dist/dts/templating/html-directive.d.ts +44 -140
- package/dist/dts/templating/install-hydratable-view-templates.d.ts +1 -0
- package/dist/dts/templating/node-observation.d.ts +11 -1
- package/dist/dts/templating/ref.d.ts +4 -0
- package/dist/dts/templating/render.bench.d.ts +3 -0
- package/dist/dts/templating/render.d.ts +49 -9
- package/dist/dts/templating/repeat-basic-reverse.bench.d.ts +3 -0
- package/dist/dts/templating/repeat-basic-shift.bench.d.ts +3 -0
- package/dist/dts/templating/repeat.d.ts +31 -9
- package/dist/dts/templating/template.d.ts +97 -12
- package/dist/dts/templating/view.d.ts +146 -29
- package/dist/dts/templating/when-basic.bench.d.ts +3 -0
- package/dist/dts/templating/when-conditional.bench.d.ts +3 -0
- package/dist/dts/templating/when-switch.bench.d.ts +3 -0
- package/dist/dts/templating/when.d.ts +3 -1
- package/dist/dts/testing/fakes.d.ts +12 -1
- package/dist/dts/tsdoc-metadata.json +1 -1
- package/dist/dts/utilities.d.ts +55 -1
- package/dist/esm/binding/binding.js +18 -0
- package/dist/esm/binding/normalize.js +17 -0
- package/dist/esm/binding/one-time.js +21 -0
- package/dist/esm/binding/one-way.js +30 -0
- package/dist/esm/{templating/binding-signal.js → binding/signal.js} +22 -6
- package/dist/esm/{templating/binding-two-way.js → binding/two-way.js} +18 -12
- package/dist/esm/components/attributes.js +19 -6
- package/dist/esm/components/element-controller.js +319 -49
- package/dist/esm/components/element-hydration.js +2 -0
- package/dist/esm/components/fast-definitions.js +12 -4
- package/dist/esm/components/fast-element.js +3 -1
- package/dist/esm/components/hydration.js +104 -0
- package/dist/esm/components/install-hydration.js +3 -0
- package/dist/esm/context.js +26 -4
- package/dist/esm/debug.js +8 -2
- package/dist/esm/di/di.js +9 -12
- package/dist/esm/dom-policy.js +345 -0
- package/dist/esm/dom.js +101 -0
- package/dist/esm/hydration/target-builder.js +175 -0
- package/dist/esm/index.js +34 -25
- package/dist/esm/index.rollup.debug.js +3 -1
- package/dist/esm/index.rollup.js +3 -1
- package/dist/esm/interfaces.js +51 -3
- package/dist/esm/metadata.js +11 -8
- package/dist/esm/observation/arrays.js +1 -1
- package/dist/esm/observation/observable.bench.js +79 -0
- package/dist/esm/observation/observable.js +20 -15
- package/dist/esm/observation/update-queue.js +2 -2
- package/dist/esm/pending-task.js +13 -1
- package/dist/esm/platform.js +12 -2
- package/dist/esm/polyfills.js +3 -61
- package/dist/esm/styles/css-binding-directive.js +76 -0
- package/dist/esm/styles/css.js +14 -7
- package/dist/esm/styles/element-styles.js +0 -33
- package/dist/esm/styles/style-strategy.js +1 -0
- package/dist/esm/templating/children.js +8 -4
- package/dist/esm/templating/compiler.js +37 -44
- package/dist/esm/templating/html-binding-directive.js +218 -0
- package/dist/esm/templating/html-directive.js +25 -152
- package/dist/esm/templating/install-hydratable-view-templates.js +17 -0
- package/dist/esm/templating/node-observation.js +14 -8
- package/dist/esm/templating/ref.js +1 -1
- package/dist/esm/templating/render.bench.js +56 -0
- package/dist/esm/templating/render.js +74 -30
- package/dist/esm/templating/repeat-basic-reverse.bench.js +43 -0
- package/dist/esm/templating/repeat-basic-shift.bench.js +43 -0
- package/dist/esm/templating/repeat.js +116 -17
- package/dist/esm/templating/template.js +135 -60
- package/dist/esm/templating/view.js +254 -34
- package/dist/esm/templating/when-basic.bench.js +36 -0
- package/dist/esm/templating/when-conditional.bench.js +39 -0
- package/dist/esm/templating/when-switch.bench.js +68 -0
- package/dist/esm/templating/when.js +12 -5
- package/dist/esm/testing/fakes.js +32 -1
- package/dist/esm/testing/fixture.js +1 -1
- package/dist/esm/utilities.js +97 -1
- package/dist/fast-element.api.json +9789 -5667
- package/dist/fast-element.d.ts +813 -2392
- package/dist/fast-element.debug.js +2788 -974
- package/dist/fast-element.debug.min.js +3 -1
- package/dist/fast-element.js +2641 -833
- package/dist/fast-element.min.js +3 -1
- package/dist/fast-element.untrimmed.d.ts +662 -314
- package/docs/{api-report.md → api-report.api.md} +238 -151
- package/docs/context/api-report.api.md +69 -0
- package/docs/di/api-report.api.md +315 -0
- package/karma.conf.cjs +2 -1
- package/package.json +59 -47
- package/scripts/run-api-extractor.js +51 -0
- package/scripts/run-benchmarks.js +46 -0
- package/tensile.config.js +12 -0
- package/dist/dts/templating/dom.d.ts +0 -41
- package/dist/esm/templating/binding.js +0 -282
- package/dist/esm/templating/dom.js +0 -49
- package/docs/guide/declaring-templates.md +0 -230
- package/docs/guide/defining-elements.md +0 -214
- package/docs/guide/leveraging-css.md +0 -253
- package/docs/guide/next-steps.md +0 -13
- package/docs/guide/observables-and-state.md +0 -213
- package/docs/guide/using-directives.md +0 -576
- package/docs/guide/working-with-shadow-dom.md +0 -296
|
@@ -0,0 +1,100 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* The type of HTML aspect to target.
|
|
3
|
+
* @public
|
|
4
|
+
*/
|
|
5
|
+
export declare const DOMAspect: Readonly<{
|
|
6
|
+
/**
|
|
7
|
+
* Not aspected.
|
|
8
|
+
*/
|
|
9
|
+
readonly none: 0;
|
|
10
|
+
/**
|
|
11
|
+
* An attribute.
|
|
12
|
+
*/
|
|
13
|
+
readonly attribute: 1;
|
|
14
|
+
/**
|
|
15
|
+
* A boolean attribute.
|
|
16
|
+
*/
|
|
17
|
+
readonly booleanAttribute: 2;
|
|
18
|
+
/**
|
|
19
|
+
* A property.
|
|
20
|
+
*/
|
|
21
|
+
readonly property: 3;
|
|
22
|
+
/**
|
|
23
|
+
* Content
|
|
24
|
+
*/
|
|
25
|
+
readonly content: 4;
|
|
26
|
+
/**
|
|
27
|
+
* A token list.
|
|
28
|
+
*/
|
|
29
|
+
readonly tokenList: 5;
|
|
30
|
+
/**
|
|
31
|
+
* An event.
|
|
32
|
+
*/
|
|
33
|
+
readonly event: 6;
|
|
34
|
+
}>;
|
|
35
|
+
/**
|
|
36
|
+
* The type of HTML aspect to target.
|
|
37
|
+
* @public
|
|
38
|
+
*/
|
|
39
|
+
export declare type DOMAspect = (typeof DOMAspect)[Exclude<keyof typeof DOMAspect, "none">];
|
|
40
|
+
/**
|
|
41
|
+
* A function used to send values to a DOM sink.
|
|
42
|
+
* @public
|
|
43
|
+
*/
|
|
44
|
+
export declare type DOMSink = (target: Node, aspectName: string, value: any, ...args: any[]) => void;
|
|
45
|
+
/**
|
|
46
|
+
* A security policy that FAST can use to interact with the DOM.
|
|
47
|
+
* @public
|
|
48
|
+
*/
|
|
49
|
+
export interface DOMPolicy {
|
|
50
|
+
/**
|
|
51
|
+
* Creates safe HTML from the provided value.
|
|
52
|
+
* @param value - The source to convert to safe HTML.
|
|
53
|
+
*/
|
|
54
|
+
createHTML(value: string): string;
|
|
55
|
+
/**
|
|
56
|
+
* Protects a DOM sink that intends to write to the DOM.
|
|
57
|
+
* @param tagName - The tag name for the element to write to.
|
|
58
|
+
* @param aspect - The aspect of the DOM to write to.
|
|
59
|
+
* @param aspectName - The name of the aspect to write to.
|
|
60
|
+
* @param sink - The sink that is used to write to the DOM.
|
|
61
|
+
*/
|
|
62
|
+
protect(tagName: string | null, aspect: DOMAspect, aspectName: string, sink: DOMSink): DOMSink;
|
|
63
|
+
}
|
|
64
|
+
/**
|
|
65
|
+
* Common DOM APIs.
|
|
66
|
+
* @public
|
|
67
|
+
*/
|
|
68
|
+
export declare const DOM: Readonly<{
|
|
69
|
+
/**
|
|
70
|
+
* Gets the dom policy used by the templating system.
|
|
71
|
+
*/
|
|
72
|
+
readonly policy: DOMPolicy;
|
|
73
|
+
/**
|
|
74
|
+
* Sets the dom policy used by the templating system.
|
|
75
|
+
* @param policy - The policy to set.
|
|
76
|
+
* @remarks
|
|
77
|
+
* This API can only be called once, for security reasons. It should be
|
|
78
|
+
* called by the application developer at the start of their program.
|
|
79
|
+
*/
|
|
80
|
+
setPolicy(value: DOMPolicy): void;
|
|
81
|
+
/**
|
|
82
|
+
* Sets an attribute value on an element.
|
|
83
|
+
* @param element - The element to set the attribute value on.
|
|
84
|
+
* @param attributeName - The attribute name to set.
|
|
85
|
+
* @param value - The value of the attribute to set.
|
|
86
|
+
* @remarks
|
|
87
|
+
* If the value is `null` or `undefined`, the attribute is removed, otherwise
|
|
88
|
+
* it is set to the provided value using the standard `setAttribute` API.
|
|
89
|
+
*/
|
|
90
|
+
setAttribute(element: HTMLElement, attributeName: string, value: any): void;
|
|
91
|
+
/**
|
|
92
|
+
* Sets a boolean attribute value.
|
|
93
|
+
* @param element - The element to set the boolean attribute value on.
|
|
94
|
+
* @param attributeName - The attribute name to set.
|
|
95
|
+
* @param value - The value of the attribute to set.
|
|
96
|
+
* @remarks
|
|
97
|
+
* If the value is true, the attribute is added; otherwise it is removed.
|
|
98
|
+
*/
|
|
99
|
+
setBooleanAttribute(element: HTMLElement, attributeName: string, value: boolean): void;
|
|
100
|
+
}>;
|
|
@@ -0,0 +1,63 @@
|
|
|
1
|
+
import type { CompiledViewBehaviorFactory, ViewBehaviorFactory, ViewBehaviorTargets } from "../templating/html-directive.js";
|
|
2
|
+
export declare class HydrationTargetElementError extends Error {
|
|
3
|
+
/**
|
|
4
|
+
* The Compiled View Behavior Factories that belong to the view.
|
|
5
|
+
*/
|
|
6
|
+
readonly factories: CompiledViewBehaviorFactory[];
|
|
7
|
+
/**
|
|
8
|
+
* The node to target factory.
|
|
9
|
+
*/
|
|
10
|
+
readonly node: Element;
|
|
11
|
+
/**
|
|
12
|
+
* String representation of the HTML in the template that
|
|
13
|
+
* threw the target element error.
|
|
14
|
+
*/
|
|
15
|
+
templateString?: string;
|
|
16
|
+
constructor(
|
|
17
|
+
/**
|
|
18
|
+
* The error message
|
|
19
|
+
*/
|
|
20
|
+
message: string | undefined,
|
|
21
|
+
/**
|
|
22
|
+
* The Compiled View Behavior Factories that belong to the view.
|
|
23
|
+
*/
|
|
24
|
+
factories: CompiledViewBehaviorFactory[],
|
|
25
|
+
/**
|
|
26
|
+
* The node to target factory.
|
|
27
|
+
*/
|
|
28
|
+
node: Element);
|
|
29
|
+
}
|
|
30
|
+
/**
|
|
31
|
+
* Represents the DOM boundaries controlled by a view
|
|
32
|
+
*/
|
|
33
|
+
export interface ViewBoundaries {
|
|
34
|
+
first: Node;
|
|
35
|
+
last: Node;
|
|
36
|
+
}
|
|
37
|
+
/**
|
|
38
|
+
* Stores relationships between a {@link ViewBehaviorFactory} and
|
|
39
|
+
* the {@link ViewBoundaries} the factory created.
|
|
40
|
+
*/
|
|
41
|
+
export interface ViewBehaviorBoundaries {
|
|
42
|
+
[factoryId: string]: ViewBoundaries;
|
|
43
|
+
}
|
|
44
|
+
/**
|
|
45
|
+
* Returns a range object inclusive of all nodes including and between the
|
|
46
|
+
* provided first and last node.
|
|
47
|
+
* @param first - The first node
|
|
48
|
+
* @param last - This last node
|
|
49
|
+
* @returns
|
|
50
|
+
*/
|
|
51
|
+
export declare function createRangeForNodes(first: Node, last: Node): Range;
|
|
52
|
+
/**
|
|
53
|
+
* Maps {@link CompiledViewBehaviorFactory} ids to the corresponding node targets for the view.
|
|
54
|
+
* @param firstNode - The first node of the view.
|
|
55
|
+
* @param lastNode - The last node of the view.
|
|
56
|
+
* @param factories - The Compiled View Behavior Factories that belong to the view.
|
|
57
|
+
* @returns - A {@link ViewBehaviorTargets } object for the factories in the view.
|
|
58
|
+
*/
|
|
59
|
+
export declare function buildViewBindingTargets(firstNode: Node, lastNode: Node, factories: CompiledViewBehaviorFactory[]): {
|
|
60
|
+
targets: ViewBehaviorTargets;
|
|
61
|
+
boundaries: ViewBehaviorBoundaries;
|
|
62
|
+
};
|
|
63
|
+
export declare function targetFactory(factory: ViewBehaviorFactory, node: Node, targets: ViewBehaviorTargets): void;
|
package/dist/dts/index.d.ts
CHANGED
|
@@ -1,27 +1,34 @@
|
|
|
1
|
-
export type { Callable, Constructable, Disposable, FASTGlobal,
|
|
2
|
-
export
|
|
3
|
-
export
|
|
4
|
-
export
|
|
5
|
-
export
|
|
6
|
-
export
|
|
7
|
-
export
|
|
8
|
-
export
|
|
9
|
-
export
|
|
10
|
-
export
|
|
11
|
-
export
|
|
12
|
-
export
|
|
13
|
-
export
|
|
1
|
+
export type { Callable, Constructable, Class, Disposable, FASTGlobal, TrustedTypesPolicy, } from "./interfaces.js";
|
|
2
|
+
export { FAST, emptyArray } from "./platform.js";
|
|
3
|
+
export { DOMAspect, DOMSink, DOMPolicy, DOM } from "./dom.js";
|
|
4
|
+
export { Accessor, Expression, ExecutionContext, ExpressionController, ExpressionObserver, ExpressionNotifier, Observable, observable, ObservationRecord, SourceLifetime, volatile, } from "./observation/observable.js";
|
|
5
|
+
export { Notifier, PropertyChangeNotifier, Subscriber, SubscriberSet, } from "./observation/notifier.js";
|
|
6
|
+
export { ArrayObserver, LengthObserver, lengthOf, Splice, SpliceStrategy, SpliceStrategySupport, } from "./observation/arrays.js";
|
|
7
|
+
export { UpdateQueue, Updates } from "./observation/update-queue.js";
|
|
8
|
+
export { Binding, BindingDirective } from "./binding/binding.js";
|
|
9
|
+
export { listener, oneWay } from "./binding/one-way.js";
|
|
10
|
+
export { oneTime } from "./binding/one-time.js";
|
|
11
|
+
export { normalizeBinding } from "./binding/normalize.js";
|
|
12
|
+
export { ComposableStyles, ConstructibleStyleStrategy, ElementStyles, } from "./styles/element-styles.js";
|
|
13
|
+
export { css, CSSTemplateTag, CSSValue } from "./styles/css.js";
|
|
14
|
+
export { AddBehavior, cssDirective, CSSDirective, CSSDirectiveDefinition, } from "./styles/css-directive.js";
|
|
15
|
+
export { HostController, HostBehavior } from "./styles/host.js";
|
|
16
|
+
export { StyleStrategy, StyleTarget } from "./styles/style-strategy.js";
|
|
17
|
+
export { CSSBindingDirective } from "./styles/css-binding-directive.js";
|
|
18
|
+
export { CaptureType, ElementViewTemplate, html, HTMLTemplateCompilationResult, HTMLTemplateTag, InlineTemplateDirective, SyntheticViewTemplate, TemplateValue, ViewTemplate, } from "./templating/template.js";
|
|
19
|
+
export { CompilationStrategy, Compiler } from "./templating/compiler.js";
|
|
14
20
|
export { Markup, Parser } from "./templating/markup.js";
|
|
15
|
-
export
|
|
16
|
-
export
|
|
17
|
-
export
|
|
18
|
-
export
|
|
19
|
-
export
|
|
20
|
-
export
|
|
21
|
-
export
|
|
22
|
-
export
|
|
23
|
-
export
|
|
24
|
-
export
|
|
25
|
-
export
|
|
26
|
-
export
|
|
27
|
-
export
|
|
21
|
+
export { ContentTemplate, ContentView, HTMLBindingDirective, } from "./templating/html-binding-directive.js";
|
|
22
|
+
export { AddViewBehaviorFactory, Aspected, CompiledViewBehaviorFactory, htmlDirective, HTMLDirective, HTMLDirectiveDefinition, PartialHTMLDirectiveDefinition, StatelessAttachedAttributeDirective, ViewBehavior, ViewBehaviorFactory, ViewBehaviorTargets, ViewController, } from "./templating/html-directive.js";
|
|
23
|
+
export { ref, RefDirective } from "./templating/ref.js";
|
|
24
|
+
export { when } from "./templating/when.js";
|
|
25
|
+
export { repeat, RepeatBehavior, RepeatDirective, RepeatOptions, } from "./templating/repeat.js";
|
|
26
|
+
export { slotted, SlottedDirective, SlottedDirectiveOptions, } from "./templating/slotted.js";
|
|
27
|
+
export { children, ChildrenDirective, ChildrenDirectiveOptions, ChildListDirectiveOptions, SubtreeDirectiveOptions, } from "./templating/children.js";
|
|
28
|
+
export { ElementView, HTMLView, SyntheticView, View, HydratableView, HydrationBindingError, } from "./templating/view.js";
|
|
29
|
+
export { elements, ElementsFilter, NodeBehaviorOptions, NodeObservationDirective, } from "./templating/node-observation.js";
|
|
30
|
+
export { render, RenderBehavior, RenderDirective } from "./templating/render.js";
|
|
31
|
+
export { customElement, FASTElement } from "./components/fast-element.js";
|
|
32
|
+
export { FASTElementDefinition, PartialFASTElementDefinition, ShadowRootOptions, } from "./components/fast-definitions.js";
|
|
33
|
+
export { attr, AttributeConfiguration, AttributeDefinition, AttributeMode, booleanConverter, DecoratorAttributeConfiguration, nullableBooleanConverter, nullableNumberConverter, ValueConverter, } from "./components/attributes.js";
|
|
34
|
+
export { ElementController, ElementControllerStrategy, HydratableElementController, } from "./components/element-controller.js";
|
package/dist/dts/interfaces.d.ts
CHANGED
|
@@ -6,7 +6,7 @@ export declare type Callable = typeof Function.prototype.call | {
|
|
|
6
6
|
call(): void;
|
|
7
7
|
};
|
|
8
8
|
/**
|
|
9
|
-
*
|
|
9
|
+
* Represents a type which can be constructed with the new operator.
|
|
10
10
|
*
|
|
11
11
|
* @public
|
|
12
12
|
*/
|
|
@@ -14,18 +14,14 @@ export declare type Constructable<T = {}> = {
|
|
|
14
14
|
new (...args: any[]): T;
|
|
15
15
|
};
|
|
16
16
|
/**
|
|
17
|
-
* Represents a class.
|
|
17
|
+
* Represents a constructable class with a prototype.
|
|
18
18
|
* @public
|
|
19
19
|
*/
|
|
20
|
-
export declare type Class<T, C = {}> = C & {
|
|
20
|
+
export declare type Class<T, C = {}> = C & Constructable<T> & {
|
|
21
21
|
/**
|
|
22
22
|
* The class's prototype;
|
|
23
23
|
*/
|
|
24
24
|
readonly prototype: T;
|
|
25
|
-
/**
|
|
26
|
-
* The class's constructor.
|
|
27
|
-
*/
|
|
28
|
-
new (...args: any[]): T;
|
|
29
25
|
};
|
|
30
26
|
/**
|
|
31
27
|
* Provides a mechanism for releasing resources.
|
|
@@ -37,18 +33,6 @@ export interface Disposable {
|
|
|
37
33
|
*/
|
|
38
34
|
dispose(): void;
|
|
39
35
|
}
|
|
40
|
-
/**
|
|
41
|
-
* Reverses all readonly members, making them mutable.
|
|
42
|
-
* @internal
|
|
43
|
-
*/
|
|
44
|
-
export declare type Mutable<T> = {
|
|
45
|
-
-readonly [P in keyof T]: T[P];
|
|
46
|
-
};
|
|
47
|
-
/**
|
|
48
|
-
* Extracts the item type from an array.
|
|
49
|
-
* @public
|
|
50
|
-
*/
|
|
51
|
-
export declare type ArrayItem<T> = T extends ReadonlyArray<infer TItem> ? TItem : T extends Array<infer TItem> ? TItem : any;
|
|
52
36
|
/**
|
|
53
37
|
* A policy for use with the standard trustedTypes platform API.
|
|
54
38
|
* @public
|
|
@@ -61,20 +45,20 @@ export declare type TrustedTypesPolicy = {
|
|
|
61
45
|
createHTML(html: string): string;
|
|
62
46
|
};
|
|
63
47
|
/**
|
|
64
|
-
*
|
|
48
|
+
* Reverses all readonly members, making them mutable.
|
|
65
49
|
* @public
|
|
66
50
|
*/
|
|
67
|
-
export declare type
|
|
68
|
-
|
|
69
|
-
* Creates a trusted types policy.
|
|
70
|
-
* @param name - The policy name.
|
|
71
|
-
* @param rules - The policy rules implementation.
|
|
72
|
-
*/
|
|
73
|
-
createPolicy(name: string, rules: TrustedTypesPolicy): TrustedTypesPolicy;
|
|
51
|
+
export declare type Mutable<T> = {
|
|
52
|
+
-readonly [P in keyof T]: T[P];
|
|
74
53
|
};
|
|
54
|
+
/**
|
|
55
|
+
* A temporary type as a workaround for the TS compiler's erroneous built-in ParameterDecorator type.
|
|
56
|
+
* @public
|
|
57
|
+
*/
|
|
58
|
+
export declare type ParameterDecorator = (target: Object, propertyKey: string | undefined, parameterIndex: number) => void;
|
|
75
59
|
/**
|
|
76
60
|
* The FAST global.
|
|
77
|
-
* @
|
|
61
|
+
* @public
|
|
78
62
|
*/
|
|
79
63
|
export interface FASTGlobal {
|
|
80
64
|
/**
|
|
@@ -110,69 +94,32 @@ export interface FASTGlobal {
|
|
|
110
94
|
addMessages(messages: Record<number, string>): void;
|
|
111
95
|
}
|
|
112
96
|
/**
|
|
113
|
-
* Core services shared across FAST instances.
|
|
97
|
+
* Core services that can be shared across FAST instances.
|
|
114
98
|
* @internal
|
|
115
99
|
*/
|
|
116
|
-
|
|
117
|
-
updateQueue
|
|
118
|
-
observable
|
|
119
|
-
contextEvent
|
|
120
|
-
elementRegistry
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
* A node that can be targeted by styles.
|
|
125
|
-
* @public
|
|
126
|
-
*/
|
|
127
|
-
export interface StyleTarget {
|
|
128
|
-
/**
|
|
129
|
-
* Stylesheets to be adopted by the node.
|
|
130
|
-
*/
|
|
131
|
-
adoptedStyleSheets?: CSSStyleSheet[];
|
|
132
|
-
/**
|
|
133
|
-
* Adds styles to the target by appending the styles.
|
|
134
|
-
* @param styles - The styles element to add.
|
|
135
|
-
*/
|
|
136
|
-
append(styles: HTMLStyleElement): void;
|
|
137
|
-
/**
|
|
138
|
-
* Removes styles from the target.
|
|
139
|
-
* @param styles - The styles element to remove.
|
|
140
|
-
*/
|
|
141
|
-
removeChild(styles: HTMLStyleElement): void;
|
|
142
|
-
/**
|
|
143
|
-
* Returns all element descendants of node that match selectors.
|
|
144
|
-
* @param selectors - The CSS selector to use for the query.
|
|
145
|
-
*/
|
|
146
|
-
querySelectorAll<E extends Element = Element>(selectors: string): NodeListOf<E>;
|
|
147
|
-
}
|
|
148
|
-
/**
|
|
149
|
-
* Implemented to provide specific behavior when adding/removing styles
|
|
150
|
-
* for elements.
|
|
151
|
-
* @public
|
|
152
|
-
*/
|
|
153
|
-
export interface StyleStrategy {
|
|
154
|
-
/**
|
|
155
|
-
* Adds styles to the target.
|
|
156
|
-
* @param target - The target to add the styles to.
|
|
157
|
-
*/
|
|
158
|
-
addStylesTo(target: StyleTarget): void;
|
|
159
|
-
/**
|
|
160
|
-
* Removes styles from the target.
|
|
161
|
-
* @param target - The target to remove the styles from.
|
|
162
|
-
*/
|
|
163
|
-
removeStylesFrom(target: StyleTarget): void;
|
|
164
|
-
}
|
|
100
|
+
declare type KernelServiceId = {
|
|
101
|
+
readonly updateQueue: string | number;
|
|
102
|
+
readonly observable: string | number;
|
|
103
|
+
readonly contextEvent: string | number;
|
|
104
|
+
readonly elementRegistry: string | number;
|
|
105
|
+
};
|
|
106
|
+
declare let KernelServiceId: KernelServiceId;
|
|
107
|
+
export { KernelServiceId };
|
|
165
108
|
/**
|
|
166
109
|
* Warning and error messages.
|
|
167
110
|
* @internal
|
|
168
111
|
*/
|
|
169
112
|
export declare const enum Message {
|
|
170
113
|
needsArrayObservation = 1101,
|
|
171
|
-
|
|
114
|
+
onlySetDOMPolicyOnce = 1201,
|
|
172
115
|
bindingInnerHTMLRequiresTrustedTypes = 1202,
|
|
173
116
|
twoWayBindingRequiresObservables = 1203,
|
|
174
117
|
hostBindingWithoutHost = 1204,
|
|
175
118
|
unsupportedBindingBehavior = 1205,
|
|
119
|
+
directCallToHTMLTagNotAllowed = 1206,
|
|
120
|
+
onlySetTemplatePolicyOnce = 1207,
|
|
121
|
+
cannotSetTemplatePolicyAfterCompilation = 1208,
|
|
122
|
+
blockedByDOMPolicy = 1209,
|
|
176
123
|
missingElementDefinition = 1401,
|
|
177
124
|
noRegistrationForContext = 1501,
|
|
178
125
|
noFactoryForResolver = 1502,
|
|
@@ -190,14 +137,17 @@ export declare const enum Message {
|
|
|
190
137
|
connectUpdateRequiresController = 1514
|
|
191
138
|
}
|
|
192
139
|
/**
|
|
193
|
-
*
|
|
140
|
+
* Determines whether or not an object is a function.
|
|
141
|
+
* @public
|
|
194
142
|
*/
|
|
195
143
|
export declare const isFunction: (object: any) => object is Function;
|
|
196
144
|
/**
|
|
197
|
-
*
|
|
145
|
+
* Determines whether or not an object is a string.
|
|
146
|
+
* @public
|
|
198
147
|
*/
|
|
199
148
|
export declare const isString: (object: any) => object is string;
|
|
200
149
|
/**
|
|
201
|
-
*
|
|
150
|
+
* A function which does nothing.
|
|
151
|
+
* @public
|
|
202
152
|
*/
|
|
203
153
|
export declare const noop: () => undefined;
|
package/dist/dts/metadata.d.ts
CHANGED
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import type { Constructable } from "./interfaces.js";
|
|
2
2
|
/**
|
|
3
3
|
* Provides basic metadata capabilities used by Context and Dependency Injection.
|
|
4
|
+
* @public
|
|
4
5
|
*/
|
|
5
6
|
export declare const Metadata: Readonly<{
|
|
6
7
|
/**
|
|
@@ -8,18 +9,18 @@ export declare const Metadata: Readonly<{
|
|
|
8
9
|
* @param Type - The type to get the metadata for.
|
|
9
10
|
* @returns The metadata array or a frozen empty array if no metadata is found.
|
|
10
11
|
*/
|
|
11
|
-
getDesignParamTypes: (Type:
|
|
12
|
+
getDesignParamTypes: (Type: Constructable) => readonly any[];
|
|
12
13
|
/**
|
|
13
14
|
* Gets the "annotation:paramtypes" metadata for the specified type.
|
|
14
15
|
* @param Type - The type to get the metadata for.
|
|
15
16
|
* @returns The metadata array or a frozen empty array if no metadata is found.
|
|
16
17
|
*/
|
|
17
|
-
getAnnotationParamTypes: (Type:
|
|
18
|
+
getAnnotationParamTypes: (Type: Constructable) => readonly any[];
|
|
18
19
|
/**
|
|
19
|
-
*
|
|
20
|
-
* @param Type - Gets the "annotation:paramtypes" metadata for the specified type. If none is found,
|
|
20
|
+
* Gets the "annotation:paramtypes" metadata for the specified type. If none is found,
|
|
21
21
|
* an empty, mutable metadata array is created and added.
|
|
22
|
-
* @
|
|
22
|
+
* @param Type - The type to get or create the metadata for.
|
|
23
|
+
* @returns A mutable metadata array.
|
|
23
24
|
*/
|
|
24
25
|
getOrCreateAnnotationParamTypes(Type: Constructable): any[];
|
|
25
26
|
}>;
|
|
@@ -57,7 +57,7 @@ export declare const SpliceStrategySupport: Readonly<{
|
|
|
57
57
|
* The available values for SpliceStrategySupport.
|
|
58
58
|
* @public
|
|
59
59
|
*/
|
|
60
|
-
export declare type SpliceStrategySupport = typeof SpliceStrategySupport[keyof typeof SpliceStrategySupport];
|
|
60
|
+
export declare type SpliceStrategySupport = (typeof SpliceStrategySupport)[keyof typeof SpliceStrategySupport];
|
|
61
61
|
/**
|
|
62
62
|
* An approach to tracking changes in an array.
|
|
63
63
|
* @public
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import { FASTElement } from "../index.js";
|
|
2
|
+
export declare class TestObservable extends FASTElement {
|
|
3
|
+
private _greetMessage;
|
|
4
|
+
private _name;
|
|
5
|
+
private _exit;
|
|
6
|
+
firstName: string;
|
|
7
|
+
lastName: string;
|
|
8
|
+
connectedCallback(): void;
|
|
9
|
+
get greetMessage(): string;
|
|
10
|
+
set greetMessage(value: string);
|
|
11
|
+
get name(): string;
|
|
12
|
+
set name(value: string);
|
|
13
|
+
get exit(): boolean;
|
|
14
|
+
set exit(value: boolean);
|
|
15
|
+
}
|
|
16
|
+
declare const itemRenderer: () => HTMLElement;
|
|
17
|
+
export default itemRenderer;
|
|
18
|
+
export { tests } from "@tensile-perf/web-components";
|
|
@@ -60,7 +60,7 @@ export declare const SourceLifetime: Readonly<{
|
|
|
60
60
|
* Describes how the source's lifetime relates to its controller's lifetime.
|
|
61
61
|
* @public
|
|
62
62
|
*/
|
|
63
|
-
export declare type SourceLifetime = typeof SourceLifetime[keyof typeof SourceLifetime];
|
|
63
|
+
export declare type SourceLifetime = (typeof SourceLifetime)[keyof typeof SourceLifetime];
|
|
64
64
|
/**
|
|
65
65
|
* Controls the lifecycle of an expression and provides relevant context.
|
|
66
66
|
* @public
|
|
@@ -176,17 +176,17 @@ export declare const Observable: Readonly<{
|
|
|
176
176
|
/**
|
|
177
177
|
* Creates a {@link ExpressionNotifier} that can watch the
|
|
178
178
|
* provided {@link Expression} for changes.
|
|
179
|
-
* @param
|
|
179
|
+
* @param expression - The binding to observe.
|
|
180
180
|
* @param initialSubscriber - An initial subscriber to changes in the binding value.
|
|
181
181
|
* @param isVolatileBinding - Indicates whether the binding's dependency list must be re-evaluated on every value evaluation.
|
|
182
182
|
*/
|
|
183
|
-
binding<TSource = any, TReturn = any>(
|
|
183
|
+
binding<TSource = any, TReturn = any>(expression: Expression<TSource, TReturn, any>, initialSubscriber?: Subscriber, isVolatileBinding?: boolean): ExpressionNotifier<TSource, TReturn, any>;
|
|
184
184
|
/**
|
|
185
185
|
* Determines whether a binding expression is volatile and needs to have its dependency list re-evaluated
|
|
186
186
|
* on every evaluation of the value.
|
|
187
|
-
* @param
|
|
187
|
+
* @param expression - The binding to inspect.
|
|
188
188
|
*/
|
|
189
|
-
isVolatileBinding<TSource_1 = any, TReturn_1 = any>(
|
|
189
|
+
isVolatileBinding<TSource_1 = any, TReturn_1 = any>(expression: Expression<TSource_1, TReturn_1, any>): boolean;
|
|
190
190
|
}>;
|
|
191
191
|
/**
|
|
192
192
|
* Decorator: Defines an observable property on the target.
|
|
@@ -1,20 +1,32 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* This module provides
|
|
3
|
-
*/
|
|
4
1
|
/**
|
|
5
2
|
* An implementation of the https://github.com/webcomponents-cg/community-protocols/blob/main/proposals/pending-task.md proposal.
|
|
6
|
-
* @
|
|
3
|
+
* @public
|
|
7
4
|
*/
|
|
8
5
|
export interface PendingTask extends Event {
|
|
9
|
-
|
|
6
|
+
/**
|
|
7
|
+
* A promise that resolves when the pending task is complete.
|
|
8
|
+
*/
|
|
9
|
+
readonly complete: Promise<void>;
|
|
10
10
|
}
|
|
11
11
|
/**
|
|
12
12
|
* A concrete implementation of {@link PendingTask}
|
|
13
|
-
* @
|
|
13
|
+
* @public
|
|
14
14
|
*/
|
|
15
15
|
export declare class PendingTaskEvent extends Event implements PendingTask {
|
|
16
|
-
complete: Promise<void>;
|
|
16
|
+
readonly complete: Promise<void>;
|
|
17
|
+
/**
|
|
18
|
+
* The type of the pending task event.
|
|
19
|
+
*/
|
|
17
20
|
static readonly type = "pending-task";
|
|
21
|
+
/**
|
|
22
|
+
* Creates an instance of PendingTaskEvent.
|
|
23
|
+
* @param complete - A promise that resolves when the pending task is complete.
|
|
24
|
+
*/
|
|
18
25
|
constructor(complete: Promise<void>);
|
|
26
|
+
/**
|
|
27
|
+
* Determines whether a value is a PendingTaskEvent.
|
|
28
|
+
* @param value - The value to check.
|
|
29
|
+
* @returns True if the value is a PendingTaskEvent; false otherwise.
|
|
30
|
+
*/
|
|
19
31
|
static isPendingTask<T extends Event>(value: T | PendingTask): value is PendingTask;
|
|
20
32
|
}
|
package/dist/dts/platform.d.ts
CHANGED
|
@@ -1,7 +1,8 @@
|
|
|
1
|
-
import
|
|
1
|
+
import { FASTGlobal } from "./interfaces.js";
|
|
2
|
+
import "./polyfills.js";
|
|
2
3
|
/**
|
|
3
4
|
* The FAST global.
|
|
4
|
-
* @
|
|
5
|
+
* @public
|
|
5
6
|
*/
|
|
6
7
|
export declare const FAST: FASTGlobal;
|
|
7
8
|
/**
|
|
@@ -39,3 +40,11 @@ export declare function createTypeRegistry<TDefinition extends TypeDefinition>()
|
|
|
39
40
|
* @internal
|
|
40
41
|
*/
|
|
41
42
|
export declare function createMetadataLocator<TMetadata>(): (target: {}) => TMetadata[];
|
|
43
|
+
/**
|
|
44
|
+
* Makes a type noop for JSON serialization.
|
|
45
|
+
* @param type - The type to make noop for JSON serialization.
|
|
46
|
+
* @internal
|
|
47
|
+
*/
|
|
48
|
+
export declare function makeSerializationNoop(type: {
|
|
49
|
+
readonly prototype: any;
|
|
50
|
+
}): void;
|
package/dist/dts/polyfills.d.ts
CHANGED
|
@@ -1,8 +0,0 @@
|
|
|
1
|
-
import type { StyleStrategy, StyleTarget } from "./interfaces.js";
|
|
2
|
-
export declare class StyleElementStrategy implements StyleStrategy {
|
|
3
|
-
private readonly styles;
|
|
4
|
-
private readonly styleClass;
|
|
5
|
-
constructor(styles: string[]);
|
|
6
|
-
addStylesTo(target: StyleTarget): void;
|
|
7
|
-
removeStylesFrom(target: StyleTarget): void;
|
|
8
|
-
}
|
|
@@ -0,0 +1,60 @@
|
|
|
1
|
+
import type { Binding, BindingDirective } from "../binding/binding.js";
|
|
2
|
+
import type { Subscriber } from "../observation/notifier.js";
|
|
3
|
+
import type { ExpressionObserver } from "../observation/observable.js";
|
|
4
|
+
import { AddBehavior, CSSDirective } from "./css-directive.js";
|
|
5
|
+
import type { ComposableStyles } from "./element-styles.js";
|
|
6
|
+
import type { HostBehavior, HostController } from "./host.js";
|
|
7
|
+
declare type CSSBindingEntry = {
|
|
8
|
+
observer: ExpressionObserver;
|
|
9
|
+
controller: HostController;
|
|
10
|
+
};
|
|
11
|
+
/**
|
|
12
|
+
* Enables bindings in CSS.
|
|
13
|
+
*
|
|
14
|
+
* @public
|
|
15
|
+
*/
|
|
16
|
+
export declare class CSSBindingDirective implements HostBehavior, Subscriber, CSSDirective, BindingDirective {
|
|
17
|
+
readonly dataBinding: Binding;
|
|
18
|
+
readonly targetAspect: string;
|
|
19
|
+
/**
|
|
20
|
+
* Creates an instance of CSSBindingDirective.
|
|
21
|
+
* @param dataBinding - The binding to use in CSS.
|
|
22
|
+
* @param targetAspect - The CSS property to target.
|
|
23
|
+
*/
|
|
24
|
+
constructor(dataBinding: Binding, targetAspect: string);
|
|
25
|
+
/**
|
|
26
|
+
* Creates a CSS fragment to interpolate into the CSS document.
|
|
27
|
+
* @returns - the string to interpolate into CSS
|
|
28
|
+
*/
|
|
29
|
+
createCSS(add: AddBehavior): ComposableStyles;
|
|
30
|
+
/**
|
|
31
|
+
* Executed when this behavior is attached to a controller.
|
|
32
|
+
* @param controller - Controls the behavior lifecycle.
|
|
33
|
+
*/
|
|
34
|
+
addedCallback(controller: HostController<HTMLElement & {
|
|
35
|
+
$cssBindings: Map<CSSBindingDirective, CSSBindingEntry>;
|
|
36
|
+
}>): void;
|
|
37
|
+
/**
|
|
38
|
+
* Executed when this behavior's host is connected.
|
|
39
|
+
* @param controller - Controls the behavior lifecycle.
|
|
40
|
+
*/
|
|
41
|
+
connectedCallback(controller: HostController<HTMLElement & {
|
|
42
|
+
$cssBindings: Map<CSSBindingDirective, CSSBindingEntry>;
|
|
43
|
+
}>): void;
|
|
44
|
+
/**
|
|
45
|
+
* Executed when this behavior is detached from a controller.
|
|
46
|
+
* @param controller - Controls the behavior lifecycle.
|
|
47
|
+
*/
|
|
48
|
+
removedCallback(controller: HostController<HTMLElement & {
|
|
49
|
+
$cssBindings: Map<CSSBindingDirective, CSSBindingEntry>;
|
|
50
|
+
}>): void;
|
|
51
|
+
/**
|
|
52
|
+
* Called when a subject this instance has subscribed to changes.
|
|
53
|
+
* @param subject - The subject of the change.
|
|
54
|
+
* @param args - The event args detailing the change that occurred.
|
|
55
|
+
*
|
|
56
|
+
* @internal
|
|
57
|
+
*/
|
|
58
|
+
handleChange(_: any, observer: ExpressionObserver): void;
|
|
59
|
+
}
|
|
60
|
+
export {};
|