@microsoft/fast-element 2.9.1 → 2.10.0
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 +58 -0
- package/CHANGELOG.md +22 -1
- package/dist/context/context.api.json +7 -7
- package/dist/di/di.api.json +12 -12
- package/dist/dts/binding/one-way.d.ts +1 -1
- package/dist/dts/binding/two-way.d.ts +3 -3
- package/dist/dts/components/attributes.d.ts +4 -4
- package/dist/dts/components/element-controller.d.ts +19 -8
- package/dist/dts/components/fast-definitions.d.ts +5 -5
- package/dist/dts/components/fast-element.d.ts +2 -2
- package/dist/dts/context.d.ts +8 -8
- package/dist/dts/di/di.d.ts +15 -15
- package/dist/dts/dom-policy.d.ts +8 -8
- package/dist/dts/dom.d.ts +2 -2
- package/dist/dts/index.d.ts +41 -28
- package/dist/dts/interfaces.d.ts +7 -7
- package/dist/dts/observable.d.ts +4 -2
- package/dist/dts/observation/arrays.d.ts +2 -2
- package/dist/dts/observation/observable.d.ts +3 -3
- package/dist/dts/observation/update-queue.d.ts +1 -1
- package/dist/dts/platform.d.ts +1 -1
- package/dist/dts/state/state.d.ts +10 -10
- package/dist/dts/state/watch.d.ts +1 -1
- package/dist/dts/styles/css-binding-directive.d.ts +2 -2
- package/dist/dts/styles/css-directive.d.ts +1 -1
- package/dist/dts/styles/css.d.ts +4 -4
- package/dist/dts/styles/element-styles.d.ts +2 -2
- package/dist/dts/templating/children.d.ts +2 -2
- package/dist/dts/templating/compiler.d.ts +3 -3
- package/dist/dts/templating/html-binding-directive.d.ts +3 -3
- package/dist/dts/templating/html-directive.d.ts +5 -5
- package/dist/dts/templating/node-observation.d.ts +2 -2
- package/dist/dts/templating/ref.d.ts +1 -1
- package/dist/dts/templating/render.d.ts +10 -10
- package/dist/dts/templating/repeat.d.ts +4 -4
- 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 +2 -2
- package/dist/esm/binding/one-way.js +1 -1
- package/dist/esm/binding/two-way.js +3 -3
- package/dist/esm/components/element-controller.js +152 -106
- package/dist/esm/components/fast-definitions.js +16 -16
- package/dist/esm/context.js +2 -2
- package/dist/esm/di/di.js +73 -63
- package/dist/esm/dom-policy.js +2 -2
- package/dist/esm/dom.js +2 -2
- package/dist/esm/index.js +21 -22
- package/dist/esm/interfaces.js +38 -0
- package/dist/esm/observable.js +1 -1
- package/dist/esm/observation/arrays.js +29 -22
- package/dist/esm/observation/observable.js +3 -3
- package/dist/esm/styles/css.js +2 -2
- package/dist/esm/styles/element-styles.js +9 -9
- package/dist/esm/templating/children.js +1 -1
- package/dist/esm/templating/compiler.js +5 -5
- package/dist/esm/templating/html-binding-directive.js +2 -2
- package/dist/esm/templating/node-observation.js +1 -1
- package/dist/esm/templating/render.js +4 -4
- package/dist/esm/templating/repeat.js +11 -11
- package/dist/esm/templating/slotted.js +1 -1
- package/dist/esm/templating/template.js +7 -7
- package/dist/esm/templating/view.js +9 -9
- package/dist/fast-element.api.json +96 -37
- package/dist/fast-element.d.ts +4 -4
- package/dist/fast-element.debug.js +2414 -2321
- package/dist/fast-element.debug.min.js +2 -2
- package/dist/fast-element.js +2414 -2321
- package/dist/fast-element.min.js +2 -2
- package/dist/fast-element.untrimmed.d.ts +17 -6
- package/docs/api-report.api.md +5 -4
- package/docs/di/api-report.api.md +4 -4
- package/karma.conf.cjs +13 -7
- package/package.json +6 -46
- package/playwright.config.ts +18 -0
- package/test/index.html +11 -0
- package/test/main.ts +10 -0
- package/test/vite.config.ts +19 -0
- package/dist/dts/observation/observable.bench.d.ts +0 -18
- package/dist/dts/templating/render.bench.d.ts +0 -3
- package/dist/dts/templating/repeat-basic-reverse.bench.d.ts +0 -3
- package/dist/dts/templating/repeat-basic-shift.bench.d.ts +0 -3
- package/dist/dts/templating/when-basic.bench.d.ts +0 -3
- package/dist/dts/templating/when-conditional.bench.d.ts +0 -3
- package/dist/dts/templating/when-switch.bench.d.ts +0 -3
- package/dist/esm/observation/observable.bench.js +0 -79
- package/dist/esm/templating/render.bench.js +0 -56
- package/dist/esm/templating/repeat-basic-reverse.bench.js +0 -43
- package/dist/esm/templating/repeat-basic-shift.bench.js +0 -43
- package/dist/esm/templating/when-basic.bench.js +0 -36
- package/dist/esm/templating/when-conditional.bench.js +0 -39
- package/dist/esm/templating/when-switch.bench.js +0 -68
- package/scripts/run-benchmarks.js +0 -46
- package/tensile.config.js +0 -12
package/dist/dts/index.d.ts
CHANGED
|
@@ -1,35 +1,48 @@
|
|
|
1
|
-
export type { Callable,
|
|
2
|
-
export {
|
|
3
|
-
export {
|
|
4
|
-
export {
|
|
5
|
-
export {
|
|
6
|
-
export {
|
|
7
|
-
export {
|
|
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";
|
|
1
|
+
export type { Callable, Class, Constructable, Disposable, FASTGlobal, TrustedTypesPolicy, } from "./interfaces.js";
|
|
2
|
+
export { emptyArray, FAST } from "./platform.js";
|
|
3
|
+
export { DOM, DOMAspect, type DOMPolicy, type DOMSink } from "./dom.js";
|
|
4
|
+
export { ArrayObserver, lengthOf, Sort, sortedCount, Splice, SpliceStrategy, SpliceStrategySupport, type LengthObserver, type SortObserver, } from "./observation/arrays.js";
|
|
5
|
+
export { PropertyChangeNotifier, SubscriberSet, type Notifier, type Subscriber, } from "./observation/notifier.js";
|
|
6
|
+
export { ExecutionContext, Observable, observable, SourceLifetime, volatile, type Accessor, type Expression, type ExpressionController, type ExpressionNotifier, type ExpressionObserver, type ObservationRecord, } from "./observation/observable.js";
|
|
7
|
+
export { Updates, type UpdateQueue } from "./observation/update-queue.js";
|
|
8
|
+
export { Binding, type BindingDirective } from "./binding/binding.js";
|
|
11
9
|
export { normalizeBinding } from "./binding/normalize.js";
|
|
12
|
-
export {
|
|
13
|
-
export {
|
|
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";
|
|
10
|
+
export { oneTime } from "./binding/one-time.js";
|
|
11
|
+
export { listener, oneWay } from "./binding/one-way.js";
|
|
17
12
|
export { CSSBindingDirective } from "./styles/css-binding-directive.js";
|
|
18
|
-
export {
|
|
19
|
-
export {
|
|
13
|
+
export { cssDirective, CSSDirective, type AddBehavior, type CSSDirectiveDefinition, } from "./styles/css-directive.js";
|
|
14
|
+
export { css, type CSSTemplateTag, type CSSValue } from "./styles/css.js";
|
|
15
|
+
export { ElementStyles, type ComposableStyles, type ConstructibleStyleStrategy, } from "./styles/element-styles.js";
|
|
16
|
+
export { type HostBehavior } from "./styles/host.js";
|
|
17
|
+
export type { HostController } from "./styles/host.js";
|
|
18
|
+
export type { StyleStrategy, StyleTarget } from "./styles/style-strategy.js";
|
|
19
|
+
export { children, ChildrenDirective } from "./templating/children.js";
|
|
20
|
+
export type { ChildListDirectiveOptions, ChildrenDirectiveOptions, SubtreeDirectiveOptions, } from "./templating/children.js";
|
|
21
|
+
export { Compiler } from "./templating/compiler.js";
|
|
22
|
+
export type { CompilationStrategy } from "./templating/compiler.js";
|
|
23
|
+
export { HTMLBindingDirective } from "./templating/html-binding-directive.js";
|
|
24
|
+
export type { ContentTemplate, ContentView, } from "./templating/html-binding-directive.js";
|
|
25
|
+
export { htmlDirective, HTMLDirective, StatelessAttachedAttributeDirective, } from "./templating/html-directive.js";
|
|
26
|
+
export type { AddViewBehaviorFactory, Aspected, CompiledViewBehaviorFactory, HTMLDirectiveDefinition, PartialHTMLDirectiveDefinition, ViewBehavior, ViewBehaviorFactory, ViewBehaviorTargets, ViewController, } from "./templating/html-directive.js";
|
|
20
27
|
export { Markup, Parser } from "./templating/markup.js";
|
|
21
|
-
export {
|
|
22
|
-
export {
|
|
28
|
+
export { elements, NodeObservationDirective } from "./templating/node-observation.js";
|
|
29
|
+
export type { ElementsFilter, NodeBehaviorOptions, } from "./templating/node-observation.js";
|
|
23
30
|
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
31
|
export { render, RenderBehavior, RenderDirective } from "./templating/render.js";
|
|
32
|
+
export { repeat, RepeatBehavior, RepeatDirective } from "./templating/repeat.js";
|
|
33
|
+
export type { RepeatOptions } from "./templating/repeat.js";
|
|
34
|
+
export { slotted, SlottedDirective } from "./templating/slotted.js";
|
|
35
|
+
export type { SlottedDirectiveOptions } from "./templating/slotted.js";
|
|
36
|
+
export { html, InlineTemplateDirective, ViewTemplate } from "./templating/template.js";
|
|
37
|
+
export type { CaptureType, ElementViewTemplate, HTMLTemplateCompilationResult, HTMLTemplateTag, SyntheticViewTemplate, TemplateValue, } from "./templating/template.js";
|
|
38
|
+
export { HTMLView, HydrationBindingError } from "./templating/view.js";
|
|
39
|
+
export type { ElementView, HydratableView, SyntheticView, View, } from "./templating/view.js";
|
|
40
|
+
export { when } from "./templating/when.js";
|
|
41
|
+
export { attr, AttributeConfiguration, AttributeDefinition, booleanConverter, nullableBooleanConverter, nullableNumberConverter, } from "./components/attributes.js";
|
|
42
|
+
export type { AttributeMode, DecoratorAttributeConfiguration, ValueConverter, } from "./components/attributes.js";
|
|
43
|
+
export { ElementController, HydratableElementController, needsHydrationAttribute, Stages, type HydrationControllerCallbacks, } from "./components/element-controller.js";
|
|
44
|
+
export type { ElementControllerStrategy } from "./components/element-controller.js";
|
|
45
|
+
export { FASTElementDefinition, fastElementRegistry, TemplateOptions, type TemplateLifecycleCallbacks, } from "./components/fast-definitions.js";
|
|
46
|
+
export type { PartialFASTElementDefinition, ShadowRootOptions, TypeRegistry, } from "./components/fast-definitions.js";
|
|
31
47
|
export { customElement, FASTElement } from "./components/fast-element.js";
|
|
32
|
-
export { FASTElementDefinition, PartialFASTElementDefinition, ShadowRootOptions, fastElementRegistry, TemplateOptions, TypeRegistry, type TemplateLifecycleCallbacks, } 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, type HydrationControllerCallbacks, needsHydrationAttribute, Stages, } from "./components/element-controller.js";
|
|
35
48
|
export { deferHydrationAttribute, isHydratable } from "./components/hydration.js";
|
package/dist/dts/interfaces.d.ts
CHANGED
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
* Represents a callable type such as a function or an object with a "call" method.
|
|
3
3
|
* @public
|
|
4
4
|
*/
|
|
5
|
-
export
|
|
5
|
+
export type Callable = typeof Function.prototype.call | {
|
|
6
6
|
call(): void;
|
|
7
7
|
};
|
|
8
8
|
/**
|
|
@@ -10,14 +10,14 @@ export declare type Callable = typeof Function.prototype.call | {
|
|
|
10
10
|
*
|
|
11
11
|
* @public
|
|
12
12
|
*/
|
|
13
|
-
export
|
|
13
|
+
export type Constructable<T = {}> = {
|
|
14
14
|
new (...args: any[]): T;
|
|
15
15
|
};
|
|
16
16
|
/**
|
|
17
17
|
* Represents a constructable class with a prototype.
|
|
18
18
|
* @public
|
|
19
19
|
*/
|
|
20
|
-
export
|
|
20
|
+
export type Class<T, C = {}> = C & Constructable<T> & {
|
|
21
21
|
/**
|
|
22
22
|
* The class's prototype;
|
|
23
23
|
*/
|
|
@@ -37,7 +37,7 @@ export interface Disposable {
|
|
|
37
37
|
* A policy for use with the standard trustedTypes platform API.
|
|
38
38
|
* @public
|
|
39
39
|
*/
|
|
40
|
-
export
|
|
40
|
+
export type TrustedTypesPolicy = {
|
|
41
41
|
/**
|
|
42
42
|
* Creates trusted HTML.
|
|
43
43
|
* @param html - The HTML to clear as trustworthy.
|
|
@@ -48,14 +48,14 @@ export declare type TrustedTypesPolicy = {
|
|
|
48
48
|
* Reverses all readonly members, making them mutable.
|
|
49
49
|
* @public
|
|
50
50
|
*/
|
|
51
|
-
export
|
|
51
|
+
export type Mutable<T> = {
|
|
52
52
|
-readonly [P in keyof T]: T[P];
|
|
53
53
|
};
|
|
54
54
|
/**
|
|
55
55
|
* A temporary type as a workaround for the TS compiler's erroneous built-in ParameterDecorator type.
|
|
56
56
|
* @public
|
|
57
57
|
*/
|
|
58
|
-
export
|
|
58
|
+
export type ParameterDecorator = (target: Object, propertyKey: string | undefined, parameterIndex: number) => void;
|
|
59
59
|
/**
|
|
60
60
|
* The FAST global.
|
|
61
61
|
* @public
|
|
@@ -97,7 +97,7 @@ export interface FASTGlobal {
|
|
|
97
97
|
* Core services that can be shared across FAST instances.
|
|
98
98
|
* @internal
|
|
99
99
|
*/
|
|
100
|
-
|
|
100
|
+
type KernelServiceId = {
|
|
101
101
|
readonly updateQueue: string | number;
|
|
102
102
|
readonly observable: string | number;
|
|
103
103
|
readonly contextEvent: string | number;
|
package/dist/dts/observable.d.ts
CHANGED
|
@@ -1,5 +1,7 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* Observable exports for easy access to the Observable API
|
|
3
3
|
*/
|
|
4
|
-
export {
|
|
5
|
-
export {
|
|
4
|
+
export { ExecutionContext, Observable, observable, SourceLifetime, volatile, } from "./observation/observable.js";
|
|
5
|
+
export type { Accessor, Expression, ExpressionController, ExpressionNotifier, ExpressionObserver, ObservationRecord, } from "./observation/observable.js";
|
|
6
|
+
export { PropertyChangeNotifier, SubscriberSet } from "./observation/notifier.js";
|
|
7
|
+
export type { Notifier, Subscriber } from "./observation/notifier.js";
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { Subscriber, SubscriberSet } from "./notifier.js";
|
|
1
|
+
import { type Subscriber, SubscriberSet } from "./notifier.js";
|
|
2
2
|
/**
|
|
3
3
|
* A splice map is a representation of how a previous array of items
|
|
4
4
|
* was transformed into a new array of items. Conceptually it is a list of
|
|
@@ -69,7 +69,7 @@ export declare const SpliceStrategySupport: Readonly<{
|
|
|
69
69
|
* The available values for SpliceStrategySupport.
|
|
70
70
|
* @public
|
|
71
71
|
*/
|
|
72
|
-
export
|
|
72
|
+
export type SpliceStrategySupport = (typeof SpliceStrategySupport)[keyof typeof SpliceStrategySupport];
|
|
73
73
|
/**
|
|
74
74
|
* An approach to tracking changes in an array.
|
|
75
75
|
* @public
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { Disposable } from "../interfaces.js";
|
|
1
|
+
import { type Disposable } from "../interfaces.js";
|
|
2
2
|
import type { Notifier, Subscriber } from "./notifier.js";
|
|
3
3
|
/**
|
|
4
4
|
* Represents a getter/setter property accessor on an object.
|
|
@@ -26,7 +26,7 @@ export interface Accessor {
|
|
|
26
26
|
* against source data and within an execution context.
|
|
27
27
|
* @public
|
|
28
28
|
*/
|
|
29
|
-
export
|
|
29
|
+
export type Expression<TSource = any, TReturn = any, TParent = any> = (source: TSource, context: ExecutionContext<TParent>) => TReturn;
|
|
30
30
|
/**
|
|
31
31
|
* A record of observable property access.
|
|
32
32
|
* @public
|
|
@@ -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
|
|
63
|
+
export type SourceLifetime = (typeof SourceLifetime)[keyof typeof SourceLifetime];
|
|
64
64
|
/**
|
|
65
65
|
* Controls the lifecycle of an expression and provides relevant context.
|
|
66
66
|
* @public
|
package/dist/dts/platform.d.ts
CHANGED
|
@@ -1,10 +1,10 @@
|
|
|
1
|
-
import { Disposable } from "../interfaces.js";
|
|
1
|
+
import { type Disposable } from "../interfaces.js";
|
|
2
2
|
import type { Subscriber } from "../observation/notifier.js";
|
|
3
3
|
/**
|
|
4
4
|
* Options for creating state.
|
|
5
5
|
* @beta
|
|
6
6
|
*/
|
|
7
|
-
export
|
|
7
|
+
export type StateOptions = {
|
|
8
8
|
/**
|
|
9
9
|
* Indicates whether to deeply make the state value observable.
|
|
10
10
|
*/
|
|
@@ -18,7 +18,7 @@ export declare type StateOptions = {
|
|
|
18
18
|
* A readonly stateful value.
|
|
19
19
|
* @beta
|
|
20
20
|
*/
|
|
21
|
-
export
|
|
21
|
+
export type ReadonlyState<T> = {
|
|
22
22
|
/**
|
|
23
23
|
* Gets the current state value.
|
|
24
24
|
*/
|
|
@@ -32,7 +32,7 @@ export declare type ReadonlyState<T> = {
|
|
|
32
32
|
* A read/write stateful value.
|
|
33
33
|
* @beta
|
|
34
34
|
*/
|
|
35
|
-
export
|
|
35
|
+
export type State<T> = ReadonlyState<T> & {
|
|
36
36
|
/**
|
|
37
37
|
* Gets or sets the current state value.
|
|
38
38
|
*/
|
|
@@ -59,7 +59,7 @@ export declare function state<T>(value: T, options?: string | StateOptions): Sta
|
|
|
59
59
|
* A readonly stateful value associated with an object owner.
|
|
60
60
|
* @beta
|
|
61
61
|
*/
|
|
62
|
-
export
|
|
62
|
+
export type ReadonlyOwnedState<T> = {
|
|
63
63
|
/**
|
|
64
64
|
* Gets the current stateful value for the owner.
|
|
65
65
|
*/
|
|
@@ -69,7 +69,7 @@ export declare type ReadonlyOwnedState<T> = {
|
|
|
69
69
|
* A read/write stateful value associated with an owner.
|
|
70
70
|
* @beta
|
|
71
71
|
*/
|
|
72
|
-
export
|
|
72
|
+
export type OwnedState<T> = ReadonlyOwnedState<T> & {
|
|
73
73
|
/**
|
|
74
74
|
* Sets
|
|
75
75
|
* @param owner - The object to set the state for the owner.
|
|
@@ -93,7 +93,7 @@ export declare function ownedState<T>(value: T | (() => T), options?: string | S
|
|
|
93
93
|
* State whose value is computed from other dependencies.
|
|
94
94
|
* @beta
|
|
95
95
|
*/
|
|
96
|
-
export
|
|
96
|
+
export type ComputedState<T> = ReadonlyState<T> & Disposable & {
|
|
97
97
|
/**
|
|
98
98
|
* Subscribes to notification of changes in the state.
|
|
99
99
|
* @param subscriber - The object that is subscribing for change notification.
|
|
@@ -109,12 +109,12 @@ export declare type ComputedState<T> = ReadonlyState<T> & Disposable & {
|
|
|
109
109
|
* A callback that enables computation setup.
|
|
110
110
|
* @beta
|
|
111
111
|
*/
|
|
112
|
-
export
|
|
112
|
+
export type ComputedSetupCallback = () => (() => void) | void;
|
|
113
113
|
/**
|
|
114
114
|
* Provides computed state capabilities.
|
|
115
115
|
* @beta
|
|
116
116
|
*/
|
|
117
|
-
export
|
|
117
|
+
export type ComputedBuilder = {
|
|
118
118
|
/**
|
|
119
119
|
* Callbacks related to computed state.
|
|
120
120
|
*/
|
|
@@ -130,7 +130,7 @@ export declare type ComputedBuilder = {
|
|
|
130
130
|
* A callback that initializes the computation.
|
|
131
131
|
* @beta
|
|
132
132
|
*/
|
|
133
|
-
export
|
|
133
|
+
export type ComputedInitializer<T> = (builder: ComputedBuilder) => () => T;
|
|
134
134
|
/**
|
|
135
135
|
* Creates a ComputedState.
|
|
136
136
|
* @param initialize - The initialization callback.
|
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
import type { Binding, BindingDirective } from "../binding/binding.js";
|
|
2
2
|
import type { Subscriber } from "../observation/notifier.js";
|
|
3
3
|
import type { ExpressionObserver } from "../observation/observable.js";
|
|
4
|
-
import { AddBehavior, CSSDirective } from "./css-directive.js";
|
|
4
|
+
import { type AddBehavior, CSSDirective } from "./css-directive.js";
|
|
5
5
|
import type { ComposableStyles } from "./element-styles.js";
|
|
6
6
|
import type { HostBehavior, HostController } from "./host.js";
|
|
7
|
-
|
|
7
|
+
type CSSBindingEntry = {
|
|
8
8
|
observer: ExpressionObserver;
|
|
9
9
|
controller: HostController;
|
|
10
10
|
};
|
|
@@ -5,7 +5,7 @@ import type { ComposableStyles } from "./element-styles.js";
|
|
|
5
5
|
* Used to add behaviors when constructing styles.
|
|
6
6
|
* @public
|
|
7
7
|
*/
|
|
8
|
-
export
|
|
8
|
+
export type AddBehavior = (behavior: HostBehavior<HTMLElement>) => void;
|
|
9
9
|
/**
|
|
10
10
|
* Directive for use in {@link css}.
|
|
11
11
|
*
|
package/dist/dts/styles/css.d.ts
CHANGED
|
@@ -1,12 +1,12 @@
|
|
|
1
|
-
import type { Expression } from "../observation/observable.js";
|
|
2
1
|
import { Binding } from "../binding/binding.js";
|
|
2
|
+
import type { Expression } from "../observation/observable.js";
|
|
3
3
|
import { CSSDirective } from "./css-directive.js";
|
|
4
|
-
import { ComposableStyles, ElementStyles } from "./element-styles.js";
|
|
4
|
+
import { type ComposableStyles, ElementStyles } from "./element-styles.js";
|
|
5
5
|
/**
|
|
6
6
|
* Represents the types of values that can be interpolated into a template.
|
|
7
7
|
* @public
|
|
8
8
|
*/
|
|
9
|
-
export
|
|
9
|
+
export type CSSValue<TSource, TParent = any> = Expression<TSource, any, TParent> | Binding<TSource, any, TParent> | ComposableStyles | CSSDirective;
|
|
10
10
|
/**
|
|
11
11
|
* Transforms a template literal string into styles.
|
|
12
12
|
* @param strings - The string fragments that are interpolated with the values.
|
|
@@ -16,7 +16,7 @@ export declare type CSSValue<TSource, TParent = any> = Expression<TSource, any,
|
|
|
16
16
|
* Use the .partial method to create partial CSS fragments.
|
|
17
17
|
* @public
|
|
18
18
|
*/
|
|
19
|
-
export
|
|
19
|
+
export type CSSTemplateTag = (<TSource = any, TParent = any>(strings: TemplateStringsArray, ...values: CSSValue<TSource, TParent>[]) => ElementStyles) & {
|
|
20
20
|
/**
|
|
21
21
|
* Transforms a template literal string into partial CSS.
|
|
22
22
|
* @param strings - The string fragments that are interpolated with the values.
|
|
@@ -4,12 +4,12 @@ import type { HostBehavior } from "./host.js";
|
|
|
4
4
|
* Represents styles that can be composed into the ShadowDOM of a custom element.
|
|
5
5
|
* @public
|
|
6
6
|
*/
|
|
7
|
-
export
|
|
7
|
+
export type ComposableStyles = string | ElementStyles | CSSStyleSheet;
|
|
8
8
|
/**
|
|
9
9
|
* A type that instantiates a StyleStrategy.
|
|
10
10
|
* @public
|
|
11
11
|
*/
|
|
12
|
-
export
|
|
12
|
+
export type ConstructibleStyleStrategy = {
|
|
13
13
|
/**
|
|
14
14
|
* Creates an instance of the strategy.
|
|
15
15
|
* @param styles - The styles to initialize the strategy with.
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { NodeBehaviorOptions, NodeObservationDirective } from "./node-observation.js";
|
|
1
|
+
import { type NodeBehaviorOptions, NodeObservationDirective } from "./node-observation.js";
|
|
2
2
|
import type { CaptureType } from "./template.js";
|
|
3
3
|
/**
|
|
4
4
|
* The options used to configure child list observation.
|
|
@@ -25,7 +25,7 @@ export interface SubtreeDirectiveOptions<T = any> extends NodeBehaviorOptions<T>
|
|
|
25
25
|
* The options used to configure child/subtree node observation.
|
|
26
26
|
* @public
|
|
27
27
|
*/
|
|
28
|
-
export
|
|
28
|
+
export type ChildrenDirectiveOptions<T = any> = ChildListDirectiveOptions<T> | SubtreeDirectiveOptions<T>;
|
|
29
29
|
/**
|
|
30
30
|
* The runtime behavior for child node observation.
|
|
31
31
|
* @public
|
|
@@ -1,12 +1,12 @@
|
|
|
1
|
-
import { DOMPolicy } from "../dom.js";
|
|
2
|
-
import { ViewBehaviorFactory } from "./html-directive.js";
|
|
1
|
+
import { type DOMPolicy } from "../dom.js";
|
|
2
|
+
import { type ViewBehaviorFactory } from "./html-directive.js";
|
|
3
3
|
import type { HTMLTemplateCompilationResult as TemplateCompilationResult } from "./template.js";
|
|
4
4
|
/**
|
|
5
5
|
* A function capable of compiling a template from the preprocessed form produced
|
|
6
6
|
* by the html template function into a result that can instantiate views.
|
|
7
7
|
* @public
|
|
8
8
|
*/
|
|
9
|
-
export
|
|
9
|
+
export type CompilationStrategy = (
|
|
10
10
|
/**
|
|
11
11
|
* The preprocessed HTML string or template to compile.
|
|
12
12
|
*/
|
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
import { DOMAspect, DOMPolicy } from "../dom.js";
|
|
2
|
-
import { ExecutionContext, Expression, ExpressionObserver } from "../observation/observable.js";
|
|
3
1
|
import type { Binding, BindingDirective } from "../binding/binding.js";
|
|
4
|
-
import {
|
|
2
|
+
import { DOMAspect, type DOMPolicy } from "../dom.js";
|
|
3
|
+
import { ExecutionContext, type Expression, type ExpressionObserver } from "../observation/observable.js";
|
|
4
|
+
import { type AddViewBehaviorFactory, type Aspected, HTMLDirective, type ViewBehavior, type ViewBehaviorFactory, type ViewController } from "./html-directive.js";
|
|
5
5
|
/**
|
|
6
6
|
* A simple View that can be interpolated into HTML content.
|
|
7
7
|
* @public
|
|
@@ -1,12 +1,12 @@
|
|
|
1
|
-
import { DOMAspect, DOMPolicy } from "../dom.js";
|
|
2
|
-
import type { Constructable } from "../interfaces.js";
|
|
3
1
|
import type { Binding } from "../binding/binding.js";
|
|
2
|
+
import { DOMAspect, type DOMPolicy } from "../dom.js";
|
|
3
|
+
import type { Constructable } from "../interfaces.js";
|
|
4
4
|
import type { ExpressionController } from "../observation/observable.js";
|
|
5
5
|
/**
|
|
6
6
|
* The target nodes available to a behavior.
|
|
7
7
|
* @public
|
|
8
8
|
*/
|
|
9
|
-
export
|
|
9
|
+
export type ViewBehaviorTargets = {
|
|
10
10
|
[id: string]: Node;
|
|
11
11
|
};
|
|
12
12
|
/**
|
|
@@ -61,12 +61,12 @@ export interface ViewBehaviorFactory {
|
|
|
61
61
|
* Represents a ViewBehaviorFactory after the compilation process has completed.
|
|
62
62
|
* @public
|
|
63
63
|
*/
|
|
64
|
-
export
|
|
64
|
+
export type CompiledViewBehaviorFactory = Required<ViewBehaviorFactory>;
|
|
65
65
|
/**
|
|
66
66
|
* Used to add behavior factories when constructing templates.
|
|
67
67
|
* @public
|
|
68
68
|
*/
|
|
69
|
-
export
|
|
69
|
+
export type AddViewBehaviorFactory = (factory: ViewBehaviorFactory) => string;
|
|
70
70
|
/**
|
|
71
71
|
* Instructs the template engine to apply behavior to a node.
|
|
72
72
|
* @public
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { StatelessAttachedAttributeDirective, ViewController } from "./html-directive.js";
|
|
1
|
+
import { StatelessAttachedAttributeDirective, type ViewController } from "./html-directive.js";
|
|
2
2
|
/**
|
|
3
3
|
* Options for configuring node observation behavior.
|
|
4
4
|
* @public
|
|
@@ -22,7 +22,7 @@ export interface NodeBehaviorOptions<T = any> {
|
|
|
22
22
|
*
|
|
23
23
|
* @public
|
|
24
24
|
*/
|
|
25
|
-
export
|
|
25
|
+
export type ElementsFilter = (value: Node, index?: number, array?: Node[]) => boolean;
|
|
26
26
|
/**
|
|
27
27
|
* Creates a function that can be used to filter a Node array, selecting only elements.
|
|
28
28
|
* @param selector - An optional selector to restrict the filter to.
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { StatelessAttachedAttributeDirective, ViewController } from "./html-directive.js";
|
|
1
|
+
import { StatelessAttachedAttributeDirective, type ViewController } from "./html-directive.js";
|
|
2
2
|
import type { CaptureType } from "./template.js";
|
|
3
3
|
/**
|
|
4
4
|
* The runtime behavior for template references.
|
|
@@ -1,12 +1,12 @@
|
|
|
1
|
+
import { Binding, type BindingDirective } from "../binding/binding.js";
|
|
1
2
|
import type { FASTElement } from "../components/fast-element.js";
|
|
2
3
|
import type { DOMPolicy } from "../dom.js";
|
|
3
|
-
import { Constructable } from "../interfaces.js";
|
|
4
|
-
import { Binding, BindingDirective } from "../binding/binding.js";
|
|
4
|
+
import { type Constructable } from "../interfaces.js";
|
|
5
5
|
import type { Subscriber } from "../observation/notifier.js";
|
|
6
6
|
import type { ExecutionContext, Expression, ExpressionObserver } from "../observation/observable.js";
|
|
7
7
|
import type { ContentTemplate, ContentView } from "./html-binding-directive.js";
|
|
8
|
-
import { AddViewBehaviorFactory, HTMLDirective, ViewBehavior, ViewBehaviorFactory, ViewController } from "./html-directive.js";
|
|
9
|
-
import { CaptureType, SyntheticViewTemplate, TemplateValue, ViewTemplate } from "./template.js";
|
|
8
|
+
import { type AddViewBehaviorFactory, HTMLDirective, type ViewBehavior, type ViewBehaviorFactory, type ViewController } from "./html-directive.js";
|
|
9
|
+
import { type CaptureType, type SyntheticViewTemplate, type TemplateValue, ViewTemplate } from "./template.js";
|
|
10
10
|
/**
|
|
11
11
|
* A Behavior that enables advanced rendering.
|
|
12
12
|
* @public
|
|
@@ -95,7 +95,7 @@ export interface RenderInstruction {
|
|
|
95
95
|
* Render options that are common to all configurations.
|
|
96
96
|
* @public
|
|
97
97
|
*/
|
|
98
|
-
export
|
|
98
|
+
export type CommonRenderOptions = {
|
|
99
99
|
/**
|
|
100
100
|
* The type this instruction is associated with.
|
|
101
101
|
*/
|
|
@@ -109,7 +109,7 @@ export declare type CommonRenderOptions = {
|
|
|
109
109
|
* Render options used to specify a template.
|
|
110
110
|
* @public
|
|
111
111
|
*/
|
|
112
|
-
export
|
|
112
|
+
export type TemplateRenderOptions = CommonRenderOptions & {
|
|
113
113
|
/**
|
|
114
114
|
* The template to use when rendering.
|
|
115
115
|
*/
|
|
@@ -119,7 +119,7 @@ export declare type TemplateRenderOptions = CommonRenderOptions & {
|
|
|
119
119
|
* Render options that are common to all element render instructions.
|
|
120
120
|
* @public
|
|
121
121
|
*/
|
|
122
|
-
export
|
|
122
|
+
export type BaseElementRenderOptions<TSource = any, TParent = any> = CommonRenderOptions & {
|
|
123
123
|
/**
|
|
124
124
|
* Attributes to use when creating the element template.
|
|
125
125
|
* @remarks
|
|
@@ -149,7 +149,7 @@ export declare type BaseElementRenderOptions<TSource = any, TParent = any> = Com
|
|
|
149
149
|
* Render options for directly creating an element with {@link RenderInstruction.createElementTemplate}
|
|
150
150
|
* @public
|
|
151
151
|
*/
|
|
152
|
-
export
|
|
152
|
+
export type ElementCreateOptions<TSource = any, TParent = any> = Omit<BaseElementRenderOptions, "type" | "name"> & {
|
|
153
153
|
/**
|
|
154
154
|
* Directives to use when creating the element template. These directives are applied directly to the specified tag.
|
|
155
155
|
*
|
|
@@ -162,7 +162,7 @@ export declare type ElementCreateOptions<TSource = any, TParent = any> = Omit<Ba
|
|
|
162
162
|
* Render options used to specify an element.
|
|
163
163
|
* @public
|
|
164
164
|
*/
|
|
165
|
-
export
|
|
165
|
+
export type ElementConstructorRenderOptions<TSource = any, TParent = any> = BaseElementRenderOptions<TSource, TParent> & {
|
|
166
166
|
/**
|
|
167
167
|
* The element to use when rendering.
|
|
168
168
|
*/
|
|
@@ -172,7 +172,7 @@ export declare type ElementConstructorRenderOptions<TSource = any, TParent = any
|
|
|
172
172
|
* Render options use to specify an element by tag name.
|
|
173
173
|
* @public
|
|
174
174
|
*/
|
|
175
|
-
export
|
|
175
|
+
export type TagNameRenderOptions<TSource = any, TParent = any> = BaseElementRenderOptions<TSource, TParent> & {
|
|
176
176
|
/**
|
|
177
177
|
* The tag name to use when rendering.
|
|
178
178
|
*/
|
|
@@ -1,10 +1,10 @@
|
|
|
1
|
+
import type { Binding, BindingDirective } from "../binding/binding.js";
|
|
1
2
|
import { Sort, Splice } from "../observation/arrays.js";
|
|
2
3
|
import type { Subscriber } from "../observation/notifier.js";
|
|
3
|
-
import { Expression, ExpressionObserver } from "../observation/observable.js";
|
|
4
|
-
import type
|
|
5
|
-
import { AddViewBehaviorFactory, HTMLDirective, ViewBehavior, ViewBehaviorFactory, ViewController } from "./html-directive.js";
|
|
4
|
+
import { type Expression, type ExpressionObserver } from "../observation/observable.js";
|
|
5
|
+
import { type AddViewBehaviorFactory, HTMLDirective, type ViewBehavior, type ViewBehaviorFactory, type ViewController } from "./html-directive.js";
|
|
6
6
|
import type { CaptureType, SyntheticViewTemplate, ViewTemplate } from "./template.js";
|
|
7
|
-
import { SyntheticView } from "./view.js";
|
|
7
|
+
import { type SyntheticView } from "./view.js";
|
|
8
8
|
/**
|
|
9
9
|
* Options for configuring repeat behavior.
|
|
10
10
|
* @public
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { NodeBehaviorOptions, NodeObservationDirective } from "./node-observation.js";
|
|
1
|
+
import { type NodeBehaviorOptions, NodeObservationDirective } from "./node-observation.js";
|
|
2
2
|
import type { CaptureType } from "./template.js";
|
|
3
3
|
/**
|
|
4
4
|
* The options used to configure slotted node observation.
|
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
import type { DOMPolicy } from "../dom.js";
|
|
2
1
|
import { Binding } from "../binding/binding.js";
|
|
2
|
+
import type { DOMPolicy } from "../dom.js";
|
|
3
3
|
import type { Expression } from "../observation/observable.js";
|
|
4
|
-
import { AddViewBehaviorFactory, CompiledViewBehaviorFactory, HTMLDirective, ViewBehaviorFactory } from "./html-directive.js";
|
|
4
|
+
import { type AddViewBehaviorFactory, type CompiledViewBehaviorFactory, HTMLDirective, type ViewBehaviorFactory } from "./html-directive.js";
|
|
5
5
|
import type { ElementView, HTMLView, SyntheticView } from "./view.js";
|
|
6
6
|
/**
|
|
7
7
|
* A template capable of creating views specifically for rendering custom elements.
|
|
@@ -65,7 +65,7 @@ export interface HTMLTemplateCompilationResult<TSource = any, TParent = any> {
|
|
|
65
65
|
* Represents the types of values that can be interpolated into a template.
|
|
66
66
|
* @public
|
|
67
67
|
*/
|
|
68
|
-
export
|
|
68
|
+
export type TemplateValue<TSource, TParent = any> = Expression<TSource, any, TParent> | Binding<TSource, any, TParent> | HTMLDirective | CaptureType<TSource, TParent>;
|
|
69
69
|
/**
|
|
70
70
|
* Inlines a template into another template.
|
|
71
71
|
* @public
|
|
@@ -165,7 +165,7 @@ export declare class ViewTemplate<TSource = any, TParent = any> implements Eleme
|
|
|
165
165
|
* other template instances, and Directive instances.
|
|
166
166
|
* @public
|
|
167
167
|
*/
|
|
168
|
-
export
|
|
168
|
+
export type HTMLTemplateTag = (<TSource = any, TParent = any>(strings: TemplateStringsArray, ...values: TemplateValue<TSource, TParent>[]) => ViewTemplate<TSource, TParent>) & {
|
|
169
169
|
/**
|
|
170
170
|
* Transforms a template literal string into partial HTML.
|
|
171
171
|
* @param html - The HTML string fragment to interpolate.
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import { Hydratable } from "../components/hydration.js";
|
|
2
|
-
import { ViewBehaviorBoundaries } from "../hydration/target-builder.js";
|
|
3
|
-
import type { ViewTemplate } from "../templating/template.js";
|
|
2
|
+
import { type ViewBehaviorBoundaries } from "../hydration/target-builder.js";
|
|
4
3
|
import type { Disposable } from "../interfaces.js";
|
|
5
4
|
import { ExecutionContext, SourceLifetime } from "../observation/observable.js";
|
|
5
|
+
import type { ViewTemplate } from "../templating/template.js";
|
|
6
6
|
import type { CompiledViewBehaviorFactory, ViewBehaviorFactory, ViewBehaviorTargets, ViewController } from "./html-directive.js";
|
|
7
7
|
/**
|
|
8
8
|
* Represents a collection of DOM nodes which can be bound to a data source.
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { isString } from "../interfaces.js";
|
|
2
|
-
import { Observable, } from "../observation/observable.js";
|
|
1
|
+
import { isString, Message } from "../interfaces.js";
|
|
2
|
+
import { ExecutionContext, Observable, } from "../observation/observable.js";
|
|
3
3
|
import { FAST, makeSerializationNoop } from "../platform.js";
|
|
4
4
|
import { Binding } from "./binding.js";
|
|
5
5
|
const defaultOptions = {
|
|
@@ -56,7 +56,7 @@ class TwoWayObserver {
|
|
|
56
56
|
const notifier = this.notifier;
|
|
57
57
|
const last = notifier.last; // using internal API!!!
|
|
58
58
|
if (!last) {
|
|
59
|
-
FAST.warn(
|
|
59
|
+
FAST.warn(Message.twoWayBindingRequiresObservables);
|
|
60
60
|
return;
|
|
61
61
|
}
|
|
62
62
|
let value;
|