@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/CHANGELOG.json
CHANGED
|
@@ -1,6 +1,64 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@microsoft/fast-element",
|
|
3
3
|
"entries": [
|
|
4
|
+
{
|
|
5
|
+
"date": "Tue, 17 Feb 2026 20:49:29 GMT",
|
|
6
|
+
"version": "2.10.0",
|
|
7
|
+
"tag": "@microsoft/fast-element_v2.10.0",
|
|
8
|
+
"comments": {
|
|
9
|
+
"patch": [
|
|
10
|
+
{
|
|
11
|
+
"author": "863023+radium-v@users.noreply.github.com",
|
|
12
|
+
"package": "@microsoft/fast-element",
|
|
13
|
+
"commit": "4176d0cb01260e6c5d03c53351eb9be0d2736b90",
|
|
14
|
+
"comment": "chore: enable verbatimModuleSyntax to identify type-only imports and exports"
|
|
15
|
+
}
|
|
16
|
+
],
|
|
17
|
+
"none": [
|
|
18
|
+
{
|
|
19
|
+
"author": "863023+radium-v@users.noreply.github.com",
|
|
20
|
+
"package": "@microsoft/fast-element",
|
|
21
|
+
"commit": "65f87c8f1fff03011d77f8159bae96e0f3fe9fce",
|
|
22
|
+
"comment": "chore: remove benchmark scripts and related utilities from fast-element package"
|
|
23
|
+
},
|
|
24
|
+
{
|
|
25
|
+
"author": "machi@microsoft.com",
|
|
26
|
+
"package": "@microsoft/fast-element",
|
|
27
|
+
"commit": "b5ed37b3aa98bc37430f2ba5cd47de3768066a3a",
|
|
28
|
+
"comment": "introduce playwright for testing"
|
|
29
|
+
}
|
|
30
|
+
],
|
|
31
|
+
"minor": [
|
|
32
|
+
{
|
|
33
|
+
"author": "863023+radium-v@users.noreply.github.com",
|
|
34
|
+
"package": "@microsoft/fast-element",
|
|
35
|
+
"commit": "350bb02ec3c35f7b354314dd9e4dfb614c335723",
|
|
36
|
+
"comment": "feat: pass source element to hydration lifecycle callbacks"
|
|
37
|
+
},
|
|
38
|
+
{
|
|
39
|
+
"author": "863023+radium-v@users.noreply.github.com",
|
|
40
|
+
"package": "@microsoft/fast-element",
|
|
41
|
+
"commit": "57ef1a5495298ad3aadc6b74c95b10bbdbdde3ca",
|
|
42
|
+
"comment": "feat(hydration): add hydrationStarted callback and update documentation"
|
|
43
|
+
}
|
|
44
|
+
]
|
|
45
|
+
}
|
|
46
|
+
},
|
|
47
|
+
{
|
|
48
|
+
"date": "Tue, 27 Jan 2026 17:28:54 GMT",
|
|
49
|
+
"version": "2.9.2",
|
|
50
|
+
"tag": "@microsoft/fast-element_v2.9.2",
|
|
51
|
+
"comments": {
|
|
52
|
+
"patch": [
|
|
53
|
+
{
|
|
54
|
+
"author": "863023+radium-v@users.noreply.github.com",
|
|
55
|
+
"package": "@microsoft/fast-element",
|
|
56
|
+
"commit": "d1cd327a6d37cea742b1b1df48f807fe9a1da4f7",
|
|
57
|
+
"comment": "chore: hoist devDependencies"
|
|
58
|
+
}
|
|
59
|
+
]
|
|
60
|
+
}
|
|
61
|
+
},
|
|
4
62
|
{
|
|
5
63
|
"date": "Tue, 16 Dec 2025 21:27:19 GMT",
|
|
6
64
|
"version": "2.9.1",
|
package/CHANGELOG.md
CHANGED
|
@@ -1,9 +1,30 @@
|
|
|
1
1
|
# Change Log - @microsoft/fast-element
|
|
2
2
|
|
|
3
|
-
<!-- This log was last generated on Tue,
|
|
3
|
+
<!-- This log was last generated on Tue, 17 Feb 2026 20:49:29 GMT and should not be manually modified. -->
|
|
4
4
|
|
|
5
5
|
<!-- Start content -->
|
|
6
6
|
|
|
7
|
+
## 2.10.0
|
|
8
|
+
|
|
9
|
+
Tue, 17 Feb 2026 20:49:29 GMT
|
|
10
|
+
|
|
11
|
+
### Minor changes
|
|
12
|
+
|
|
13
|
+
- feat: pass source element to hydration lifecycle callbacks (863023+radium-v@users.noreply.github.com)
|
|
14
|
+
- feat(hydration): add hydrationStarted callback and update documentation (863023+radium-v@users.noreply.github.com)
|
|
15
|
+
|
|
16
|
+
### Patches
|
|
17
|
+
|
|
18
|
+
- chore: enable verbatimModuleSyntax to identify type-only imports and exports (863023+radium-v@users.noreply.github.com)
|
|
19
|
+
|
|
20
|
+
## 2.9.2
|
|
21
|
+
|
|
22
|
+
Tue, 27 Jan 2026 17:28:54 GMT
|
|
23
|
+
|
|
24
|
+
### Patches
|
|
25
|
+
|
|
26
|
+
- chore: hoist devDependencies (863023+radium-v@users.noreply.github.com)
|
|
27
|
+
|
|
7
28
|
## 2.9.1
|
|
8
29
|
|
|
9
30
|
Tue, 16 Dec 2025 21:27:19 GMT
|
|
@@ -179,7 +179,7 @@
|
|
|
179
179
|
"excerptTokens": [
|
|
180
180
|
{
|
|
181
181
|
"kind": "Content",
|
|
182
|
-
"text": "export
|
|
182
|
+
"text": "export type Context<T> = "
|
|
183
183
|
},
|
|
184
184
|
{
|
|
185
185
|
"kind": "Content",
|
|
@@ -462,7 +462,7 @@
|
|
|
462
462
|
"excerptTokens": [
|
|
463
463
|
{
|
|
464
464
|
"kind": "Content",
|
|
465
|
-
"text": "export
|
|
465
|
+
"text": "export type ContextCallback<ValueType> = "
|
|
466
466
|
},
|
|
467
467
|
{
|
|
468
468
|
"kind": "Content",
|
|
@@ -501,7 +501,7 @@
|
|
|
501
501
|
"excerptTokens": [
|
|
502
502
|
{
|
|
503
503
|
"kind": "Content",
|
|
504
|
-
"text": "export
|
|
504
|
+
"text": "export type ContextDecorator<T = "
|
|
505
505
|
},
|
|
506
506
|
{
|
|
507
507
|
"kind": "Content",
|
|
@@ -812,7 +812,7 @@
|
|
|
812
812
|
"excerptTokens": [
|
|
813
813
|
{
|
|
814
814
|
"kind": "Content",
|
|
815
|
-
"text": "export
|
|
815
|
+
"text": "export type ContextType<T extends "
|
|
816
816
|
},
|
|
817
817
|
{
|
|
818
818
|
"kind": "Reference",
|
|
@@ -869,7 +869,7 @@
|
|
|
869
869
|
"excerptTokens": [
|
|
870
870
|
{
|
|
871
871
|
"kind": "Content",
|
|
872
|
-
"text": "export
|
|
872
|
+
"text": "export type FASTContext<T> = "
|
|
873
873
|
},
|
|
874
874
|
{
|
|
875
875
|
"kind": "Reference",
|
|
@@ -976,7 +976,7 @@
|
|
|
976
976
|
"excerptTokens": [
|
|
977
977
|
{
|
|
978
978
|
"kind": "Content",
|
|
979
|
-
"text": "export
|
|
979
|
+
"text": "export type FASTContextRequestStrategy = "
|
|
980
980
|
},
|
|
981
981
|
{
|
|
982
982
|
"kind": "Content",
|
|
@@ -1038,7 +1038,7 @@
|
|
|
1038
1038
|
"excerptTokens": [
|
|
1039
1039
|
{
|
|
1040
1040
|
"kind": "Content",
|
|
1041
|
-
"text": "export
|
|
1041
|
+
"text": "export type UnknownContext = "
|
|
1042
1042
|
},
|
|
1043
1043
|
{
|
|
1044
1044
|
"kind": "Reference",
|
package/dist/di/di.api.json
CHANGED
|
@@ -250,7 +250,7 @@
|
|
|
250
250
|
"excerptTokens": [
|
|
251
251
|
{
|
|
252
252
|
"kind": "Content",
|
|
253
|
-
"text": "export
|
|
253
|
+
"text": "export type AsyncRegistrationLocator = "
|
|
254
254
|
},
|
|
255
255
|
{
|
|
256
256
|
"kind": "Content",
|
|
@@ -1487,7 +1487,7 @@
|
|
|
1487
1487
|
},
|
|
1488
1488
|
{
|
|
1489
1489
|
"kind": "Content",
|
|
1490
|
-
"text": "
|
|
1490
|
+
"text": ">(target: T & "
|
|
1491
1491
|
},
|
|
1492
1492
|
{
|
|
1493
1493
|
"kind": "Reference",
|
|
@@ -1523,7 +1523,7 @@
|
|
|
1523
1523
|
},
|
|
1524
1524
|
{
|
|
1525
1525
|
"kind": "Content",
|
|
1526
|
-
"text": "
|
|
1526
|
+
"text": ">(target: T_1 & "
|
|
1527
1527
|
},
|
|
1528
1528
|
{
|
|
1529
1529
|
"kind": "Reference",
|
|
@@ -2108,7 +2108,7 @@
|
|
|
2108
2108
|
"excerptTokens": [
|
|
2109
2109
|
{
|
|
2110
2110
|
"kind": "Content",
|
|
2111
|
-
"text": "export
|
|
2111
|
+
"text": "export type Injectable<T = "
|
|
2112
2112
|
},
|
|
2113
2113
|
{
|
|
2114
2114
|
"kind": "Content",
|
|
@@ -2241,7 +2241,7 @@
|
|
|
2241
2241
|
"excerptTokens": [
|
|
2242
2242
|
{
|
|
2243
2243
|
"kind": "Content",
|
|
2244
|
-
"text": "export
|
|
2244
|
+
"text": "export type Key = "
|
|
2245
2245
|
},
|
|
2246
2246
|
{
|
|
2247
2247
|
"kind": "Reference",
|
|
@@ -2459,7 +2459,7 @@
|
|
|
2459
2459
|
"excerptTokens": [
|
|
2460
2460
|
{
|
|
2461
2461
|
"kind": "Content",
|
|
2462
|
-
"text": "export
|
|
2462
|
+
"text": "export type ParentLocator = "
|
|
2463
2463
|
},
|
|
2464
2464
|
{
|
|
2465
2465
|
"kind": "Content",
|
|
@@ -2494,7 +2494,7 @@
|
|
|
2494
2494
|
"excerptTokens": [
|
|
2495
2495
|
{
|
|
2496
2496
|
"kind": "Content",
|
|
2497
|
-
"text": "export
|
|
2497
|
+
"text": "export type RegisterSelf<T extends "
|
|
2498
2498
|
},
|
|
2499
2499
|
{
|
|
2500
2500
|
"kind": "Reference",
|
|
@@ -2695,7 +2695,7 @@
|
|
|
2695
2695
|
},
|
|
2696
2696
|
{
|
|
2697
2697
|
"kind": "Content",
|
|
2698
|
-
"text": "
|
|
2698
|
+
"text": ">(key: "
|
|
2699
2699
|
},
|
|
2700
2700
|
{
|
|
2701
2701
|
"kind": "Reference",
|
|
@@ -2731,7 +2731,7 @@
|
|
|
2731
2731
|
},
|
|
2732
2732
|
{
|
|
2733
2733
|
"kind": "Content",
|
|
2734
|
-
"text": "
|
|
2734
|
+
"text": ">(key: "
|
|
2735
2735
|
},
|
|
2736
2736
|
{
|
|
2737
2737
|
"kind": "Reference",
|
|
@@ -2961,7 +2961,7 @@
|
|
|
2961
2961
|
"excerptTokens": [
|
|
2962
2962
|
{
|
|
2963
2963
|
"kind": "Content",
|
|
2964
|
-
"text": "export
|
|
2964
|
+
"text": "export type ResolveCallback<T = "
|
|
2965
2965
|
},
|
|
2966
2966
|
{
|
|
2967
2967
|
"kind": "Content",
|
|
@@ -3035,7 +3035,7 @@
|
|
|
3035
3035
|
"excerptTokens": [
|
|
3036
3036
|
{
|
|
3037
3037
|
"kind": "Content",
|
|
3038
|
-
"text": "export
|
|
3038
|
+
"text": "export type Resolved<K> = "
|
|
3039
3039
|
},
|
|
3040
3040
|
{
|
|
3041
3041
|
"kind": "Content",
|
|
@@ -4724,7 +4724,7 @@
|
|
|
4724
4724
|
"excerptTokens": [
|
|
4725
4725
|
{
|
|
4726
4726
|
"kind": "Content",
|
|
4727
|
-
"text": "export
|
|
4727
|
+
"text": "export type Transformer<K> = "
|
|
4728
4728
|
},
|
|
4729
4729
|
{
|
|
4730
4730
|
"kind": "Content",
|
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
import type { DOMPolicy } from "../dom.js";
|
|
2
|
-
import { Expression } from "../observation/observable.js";
|
|
3
|
-
import { Binding, BindingDirective } from "./binding.js";
|
|
2
|
+
import { type Expression } from "../observation/observable.js";
|
|
3
|
+
import { Binding, type BindingDirective } from "./binding.js";
|
|
4
4
|
/**
|
|
5
5
|
* The twoWay binding options.
|
|
6
6
|
* @public
|
|
7
7
|
*/
|
|
8
|
-
export
|
|
8
|
+
export type TwoWayBindingOptions = {
|
|
9
9
|
changeEvent?: string;
|
|
10
10
|
fromView?: (value: any) => any;
|
|
11
11
|
};
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { Accessor } from "../observation/observable.js";
|
|
1
|
+
import { type Accessor } from "../observation/observable.js";
|
|
2
2
|
/**
|
|
3
3
|
* Represents objects that can convert values to and from
|
|
4
4
|
* view or model representations.
|
|
@@ -29,12 +29,12 @@ declare const reflectMode = "reflect";
|
|
|
29
29
|
* changes in the DOM, but does not reflect property changes back.
|
|
30
30
|
* @public
|
|
31
31
|
*/
|
|
32
|
-
export
|
|
32
|
+
export type AttributeMode = typeof reflectMode | typeof booleanMode | "fromView";
|
|
33
33
|
/**
|
|
34
34
|
* Metadata used to configure a custom attribute's behavior.
|
|
35
35
|
* @public
|
|
36
36
|
*/
|
|
37
|
-
export
|
|
37
|
+
export type AttributeConfiguration = {
|
|
38
38
|
property: string;
|
|
39
39
|
attribute?: string;
|
|
40
40
|
mode?: AttributeMode;
|
|
@@ -54,7 +54,7 @@ export declare const AttributeConfiguration: Readonly<{
|
|
|
54
54
|
* Metadata used to configure a custom attribute's behavior through a decorator.
|
|
55
55
|
* @public
|
|
56
56
|
*/
|
|
57
|
-
export
|
|
57
|
+
export type DecoratorAttributeConfiguration = Omit<AttributeConfiguration, "property">;
|
|
58
58
|
/**
|
|
59
59
|
* A {@link ValueConverter} that converts to and from `boolean` values.
|
|
60
60
|
* @remarks
|
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
import { PropertyChangeNotifier } from "../observation/notifier.js";
|
|
2
|
-
import { ExecutionContext, ExpressionController, SourceLifetime } from "../observation/observable.js";
|
|
2
|
+
import { ExecutionContext, type ExpressionController, SourceLifetime } from "../observation/observable.js";
|
|
3
3
|
import { ElementStyles } from "../styles/element-styles.js";
|
|
4
4
|
import type { HostBehavior, HostController } from "../styles/host.js";
|
|
5
5
|
import type { StyleStrategy, StyleTarget } from "../styles/style-strategy.js";
|
|
6
6
|
import type { ElementViewTemplate } from "../templating/template.js";
|
|
7
7
|
import type { ElementView } from "../templating/view.js";
|
|
8
|
-
import { FASTElementDefinition, ShadowRootOptions } from "./fast-definitions.js";
|
|
8
|
+
import { FASTElementDefinition, type ShadowRootOptions } from "./fast-definitions.js";
|
|
9
9
|
/**
|
|
10
10
|
* @deprecated Use the export from ./hydration.js instead.
|
|
11
11
|
*/
|
|
@@ -269,15 +269,22 @@ export declare const needsHydrationAttribute = "needs-hydration";
|
|
|
269
269
|
* Lifecycle callbacks for element hydration events
|
|
270
270
|
* @public
|
|
271
271
|
*/
|
|
272
|
-
export interface HydrationControllerCallbacks {
|
|
272
|
+
export interface HydrationControllerCallbacks<TElement extends HTMLElement = HTMLElement> {
|
|
273
273
|
/**
|
|
274
|
-
* Called
|
|
274
|
+
* Called once when the first element enters the hydration pipeline.
|
|
275
|
+
* This is the earliest point at which we know a component has been
|
|
276
|
+
* async-defined with `defer-and-hydrate`, a template is pending via
|
|
277
|
+
* `<f-template>`, and the element has `needs-hydration`.
|
|
275
278
|
*/
|
|
276
|
-
|
|
279
|
+
hydrationStarted?(): void;
|
|
277
280
|
/**
|
|
278
|
-
* Called
|
|
281
|
+
* Called before an individual element's hydration begins
|
|
279
282
|
*/
|
|
280
|
-
|
|
283
|
+
elementWillHydrate?(source: TElement): void;
|
|
284
|
+
/**
|
|
285
|
+
* Called after an individual element's hydration has finished
|
|
286
|
+
*/
|
|
287
|
+
elementDidHydrate?(source: TElement): void;
|
|
281
288
|
/**
|
|
282
289
|
* Called after all elements have completed hydration
|
|
283
290
|
*/
|
|
@@ -305,7 +312,11 @@ export declare class HydratableElementController<TElement extends HTMLElement =
|
|
|
305
312
|
/**
|
|
306
313
|
* Lifecycle callbacks for hydration events
|
|
307
314
|
*/
|
|
308
|
-
static lifecycleCallbacks
|
|
315
|
+
static lifecycleCallbacks: HydrationControllerCallbacks;
|
|
316
|
+
/**
|
|
317
|
+
* Whether the hydrationStarted callback has already been invoked.
|
|
318
|
+
*/
|
|
319
|
+
private static hydrationStarted;
|
|
309
320
|
/**
|
|
310
321
|
* An idle callback ID used to track hydration completion
|
|
311
322
|
*/
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import { Constructable } from "../interfaces.js";
|
|
2
|
-
import { TypeRegistry } from "../platform.js";
|
|
3
|
-
import { ComposableStyles, ElementStyles } from "../styles/element-styles.js";
|
|
1
|
+
import { type Constructable } from "../interfaces.js";
|
|
2
|
+
import { type TypeRegistry } from "../platform.js";
|
|
3
|
+
import { type ComposableStyles, ElementStyles } from "../styles/element-styles.js";
|
|
4
4
|
import type { ElementViewTemplate } from "../templating/template.js";
|
|
5
5
|
import { AttributeConfiguration, AttributeDefinition } from "./attributes.js";
|
|
6
6
|
/**
|
|
@@ -8,7 +8,7 @@ import { AttributeConfiguration, AttributeDefinition } from "./attributes.js";
|
|
|
8
8
|
* @internal
|
|
9
9
|
*/
|
|
10
10
|
export declare const fastElementRegistry: TypeRegistry<FASTElementDefinition>;
|
|
11
|
-
export { TypeRegistry };
|
|
11
|
+
export type { TypeRegistry };
|
|
12
12
|
/**
|
|
13
13
|
* Shadow root initialization options.
|
|
14
14
|
* @public
|
|
@@ -32,7 +32,7 @@ export declare const TemplateOptions: {
|
|
|
32
32
|
* Type for the `TemplateOptions` const enum.
|
|
33
33
|
* @alpha
|
|
34
34
|
*/
|
|
35
|
-
export
|
|
35
|
+
export type TemplateOptions = (typeof TemplateOptions)[keyof typeof TemplateOptions];
|
|
36
36
|
/**
|
|
37
37
|
* Lifecycle callbacks for template events.
|
|
38
38
|
* @public
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import { Constructable } from "../interfaces.js";
|
|
1
|
+
import { type Constructable } from "../interfaces.js";
|
|
2
2
|
import { ElementController } from "./element-controller.js";
|
|
3
|
-
import { FASTElementDefinition, PartialFASTElementDefinition } from "./fast-definitions.js";
|
|
3
|
+
import { FASTElementDefinition, type PartialFASTElementDefinition } from "./fast-definitions.js";
|
|
4
4
|
/**
|
|
5
5
|
* Represents a custom element based on the FASTElement infrastructure.
|
|
6
6
|
* @public
|
package/dist/dts/context.d.ts
CHANGED
|
@@ -1,9 +1,9 @@
|
|
|
1
|
-
import { Constructable, ParameterDecorator } from "./interfaces.js";
|
|
1
|
+
import { type Constructable, type ParameterDecorator } from "./interfaces.js";
|
|
2
2
|
/**
|
|
3
3
|
* A Context object defines an optional initial value for a Context, as well as a name identifier for debugging purposes.
|
|
4
4
|
* @public
|
|
5
5
|
*/
|
|
6
|
-
export
|
|
6
|
+
export type Context<T> = {
|
|
7
7
|
readonly name: string;
|
|
8
8
|
readonly initialValue?: T;
|
|
9
9
|
};
|
|
@@ -13,13 +13,13 @@ export declare type Context<T> = {
|
|
|
13
13
|
* resolving the associated dependency.
|
|
14
14
|
* @public
|
|
15
15
|
*/
|
|
16
|
-
export
|
|
16
|
+
export type ContextDecorator<T = any> = Readonly<Context<T>> & PropertyDecorator & ParameterDecorator;
|
|
17
17
|
/**
|
|
18
18
|
* A Context object defines an optional initial value for a Context, as well as a name identifier for debugging purposes.
|
|
19
19
|
* The FASTContext can also be used as a decorator to declare context dependencies or as a key for DI.
|
|
20
20
|
* @public
|
|
21
21
|
*/
|
|
22
|
-
export
|
|
22
|
+
export type FASTContext<T> = ContextDecorator<T> & {
|
|
23
23
|
get(target: EventTarget): T;
|
|
24
24
|
provide(target: EventTarget, value: T): void;
|
|
25
25
|
request(target: EventTarget, callback: ContextCallback<T>, multiple?: boolean): void;
|
|
@@ -31,7 +31,7 @@ export declare type FASTContext<T> = ContextDecorator<T> & {
|
|
|
31
31
|
* By default this is handled via Context.dispatch, which dispatches a ContextEvent.
|
|
32
32
|
* @public
|
|
33
33
|
*/
|
|
34
|
-
export
|
|
34
|
+
export type FASTContextRequestStrategy = <T extends UnknownContext>(target: EventTarget, context: T, callback: ContextCallback<ContextType<T>>, multiple: any) => void;
|
|
35
35
|
declare const contextEventType = "context-request";
|
|
36
36
|
/**
|
|
37
37
|
* Enables using:
|
|
@@ -130,18 +130,18 @@ export declare const Context: Readonly<{
|
|
|
130
130
|
* An unknown context type.
|
|
131
131
|
* @public
|
|
132
132
|
*/
|
|
133
|
-
export
|
|
133
|
+
export type UnknownContext = Context<unknown>;
|
|
134
134
|
/**
|
|
135
135
|
* A helper type which can extract a Context value type from a Context type
|
|
136
136
|
* @public
|
|
137
137
|
*/
|
|
138
|
-
export
|
|
138
|
+
export type ContextType<T extends UnknownContext> = T extends Context<infer Y> ? Y : never;
|
|
139
139
|
/**
|
|
140
140
|
* A callback which is provided by a context requester and is called with the value satisfying the request.
|
|
141
141
|
* This callback can be called multiple times by context providers as the requested value is changed.
|
|
142
142
|
* @public
|
|
143
143
|
*/
|
|
144
|
-
export
|
|
144
|
+
export type ContextCallback<ValueType> = (value: ValueType, dispose?: () => void) => void;
|
|
145
145
|
/**
|
|
146
146
|
* An event fired by a context requester to signal it desires a named context.
|
|
147
147
|
*
|
package/dist/dts/di/di.d.ts
CHANGED
|
@@ -2,8 +2,8 @@
|
|
|
2
2
|
* Big thanks to https://github.com/fkleuver and the https://github.com/aurelia/aurelia project
|
|
3
3
|
* for the bulk of this code and many of the associated tests.
|
|
4
4
|
*/
|
|
5
|
-
import { ContextDecorator } from "../context.js";
|
|
6
|
-
import { Constructable } from "../interfaces.js";
|
|
5
|
+
import { type ContextDecorator } from "../context.js";
|
|
6
|
+
import { type Constructable } from "../interfaces.js";
|
|
7
7
|
/**
|
|
8
8
|
* Represents a custom callback for resolving a request from the container.
|
|
9
9
|
* The handler is the container that is invoking the callback. The requestor
|
|
@@ -13,7 +13,7 @@ import { Constructable } from "../interfaces.js";
|
|
|
13
13
|
* the callback needs a place or key against which to store state across resolutions.
|
|
14
14
|
* @public
|
|
15
15
|
*/
|
|
16
|
-
export
|
|
16
|
+
export type ResolveCallback<T = any> = (handler: Container, requestor: Container, resolver: Resolver<T>) => T;
|
|
17
17
|
interface ResolverLike<C, K = any> {
|
|
18
18
|
readonly $isResolver: true;
|
|
19
19
|
resolve(handler: C, requestor: C): Resolved<K>;
|
|
@@ -47,7 +47,7 @@ export interface Registration<K = any> {
|
|
|
47
47
|
* to the requestor.
|
|
48
48
|
* @public
|
|
49
49
|
*/
|
|
50
|
-
export
|
|
50
|
+
export type Transformer<K> = (instance: Resolved<K>) => Resolved<K>;
|
|
51
51
|
/**
|
|
52
52
|
* Used by the default Resolver to create instances of objects when needed.
|
|
53
53
|
* @public
|
|
@@ -274,7 +274,7 @@ export declare class ResolverBuilder<K> {
|
|
|
274
274
|
* Represents an object that can register itself.
|
|
275
275
|
* @public
|
|
276
276
|
*/
|
|
277
|
-
export
|
|
277
|
+
export type RegisterSelf<T extends Constructable> = {
|
|
278
278
|
/**
|
|
279
279
|
* Registers itself with the container.
|
|
280
280
|
* @param container - The container to register with.
|
|
@@ -290,18 +290,18 @@ export declare type RegisterSelf<T extends Constructable> = {
|
|
|
290
290
|
* A key that is used to register dependencies with a dependency injection container.
|
|
291
291
|
* @public
|
|
292
292
|
*/
|
|
293
|
-
export
|
|
293
|
+
export type Key = PropertyKey | object | ContextDecorator | Constructable | Resolver;
|
|
294
294
|
/**
|
|
295
295
|
* Represents something resolved from a service locator.
|
|
296
296
|
* @public
|
|
297
297
|
*/
|
|
298
|
-
export
|
|
298
|
+
export type Resolved<K> = K extends ContextDecorator<infer T> ? T : K extends Constructable ? InstanceType<K> : K extends ResolverLike<any, infer T1> ? T1 extends Constructable ? InstanceType<T1> : T1 : K;
|
|
299
299
|
/**
|
|
300
300
|
* A class that declares constructor injected dependencies through
|
|
301
301
|
* a static "inject" field array of keys.
|
|
302
302
|
* @public
|
|
303
303
|
*/
|
|
304
|
-
export
|
|
304
|
+
export type Injectable<T = {}> = Constructable<T> & {
|
|
305
305
|
inject?: Key[];
|
|
306
306
|
};
|
|
307
307
|
/**
|
|
@@ -310,12 +310,12 @@ export declare type Injectable<T = {}> = Constructable<T> & {
|
|
|
310
310
|
* A container owner is usually an HTMLElement instance.
|
|
311
311
|
* @public
|
|
312
312
|
*/
|
|
313
|
-
export
|
|
313
|
+
export type ParentLocator = (owner: any) => Container | null;
|
|
314
314
|
/**
|
|
315
315
|
* A function capable of asynchronously locating a resolver for a key.
|
|
316
316
|
* @public
|
|
317
317
|
*/
|
|
318
|
-
export
|
|
318
|
+
export type AsyncRegistrationLocator = (key: Key) => Promise<Registration | null>;
|
|
319
319
|
/**
|
|
320
320
|
* Configuration for a dependency injection container.
|
|
321
321
|
* @public
|
|
@@ -513,7 +513,7 @@ export declare const DI: Readonly<{
|
|
|
513
513
|
*
|
|
514
514
|
* @public
|
|
515
515
|
*/
|
|
516
|
-
transient<T extends Constructable
|
|
516
|
+
transient<T extends Constructable>(target: T & Partial<RegisterSelf<T>>): T & RegisterSelf<T>;
|
|
517
517
|
/**
|
|
518
518
|
* Registers the `target` class as a singleton dependency; the class will only be created once. Each
|
|
519
519
|
* consecutive time the dependency is resolved, the same instance will be returned.
|
|
@@ -537,7 +537,7 @@ export declare const DI: Readonly<{
|
|
|
537
537
|
*
|
|
538
538
|
* @public
|
|
539
539
|
*/
|
|
540
|
-
singleton<T_1 extends Constructable
|
|
540
|
+
singleton<T_1 extends Constructable>(target: T_1 & Partial<RegisterSelf<T_1>>, options?: SingletonOptions): T_1 & RegisterSelf<T_1>;
|
|
541
541
|
}>;
|
|
542
542
|
/**
|
|
543
543
|
* The key that resolves the dependency injection Container itself.
|
|
@@ -596,7 +596,7 @@ export declare function transient<T extends Constructable>(): typeof transientDe
|
|
|
596
596
|
* @public
|
|
597
597
|
*/
|
|
598
598
|
export declare function transient<T extends Constructable>(target: T & Partial<RegisterSelf<T>>): T & RegisterSelf<T>;
|
|
599
|
-
|
|
599
|
+
type SingletonOptions = {
|
|
600
600
|
scoped: boolean;
|
|
601
601
|
};
|
|
602
602
|
declare function singletonDecorator<T extends Constructable>(target: T & Partial<RegisterSelf<T>>): T & RegisterSelf<T>;
|
|
@@ -827,7 +827,7 @@ export declare const Registration: Readonly<{
|
|
|
827
827
|
* @param key - The key to register the singleton under.
|
|
828
828
|
* @param value - The class to instantiate as a singleton when first requested.
|
|
829
829
|
*/
|
|
830
|
-
singleton<T_1 extends Constructable
|
|
830
|
+
singleton<T_1 extends Constructable>(key: Key, value: T_1): Registration<InstanceType<T_1>>;
|
|
831
831
|
/**
|
|
832
832
|
* Creates an instance from a class.
|
|
833
833
|
* Every time you request this {@link Key} you will get a new instance.
|
|
@@ -840,7 +840,7 @@ export declare const Registration: Readonly<{
|
|
|
840
840
|
* @param key - The key to register the instance type under.
|
|
841
841
|
* @param value - The class to instantiate each time the key is requested.
|
|
842
842
|
*/
|
|
843
|
-
transient<T_2 extends Constructable
|
|
843
|
+
transient<T_2 extends Constructable>(key: Key, value: T_2): Registration<InstanceType<T_2>>;
|
|
844
844
|
/**
|
|
845
845
|
* Delegates to a callback function to provide the dependency.
|
|
846
846
|
* Every time you request this {@link Key} the callback will be invoked to provide
|
package/dist/dts/dom-policy.d.ts
CHANGED
|
@@ -1,15 +1,15 @@
|
|
|
1
|
-
import { DOMAspect,
|
|
2
|
-
import { TrustedTypesPolicy } from "./interfaces.js";
|
|
1
|
+
import { DOMAspect, type DOMSink, type DOMPolicy as IDOMPolicy } from "./dom.js";
|
|
2
|
+
import { type TrustedTypesPolicy } from "./interfaces.js";
|
|
3
3
|
/**
|
|
4
4
|
* A specific DOM sink guard for a node aspect.
|
|
5
5
|
* @public
|
|
6
6
|
*/
|
|
7
|
-
export
|
|
7
|
+
export type DOMSinkGuards = Record<string, (tagName: string | null, aspect: DOMAspect, aspectName: string, sink: DOMSink) => DOMSink>;
|
|
8
8
|
/**
|
|
9
9
|
* Aspect-specific guards for a DOM Policy.
|
|
10
10
|
* @public
|
|
11
11
|
*/
|
|
12
|
-
export
|
|
12
|
+
export type DOMAspectGuards = {
|
|
13
13
|
/**
|
|
14
14
|
* Guards for attributes.
|
|
15
15
|
*/
|
|
@@ -39,12 +39,12 @@ export declare type DOMAspectGuards = {
|
|
|
39
39
|
* Element-specific guards for a DOM Policy.
|
|
40
40
|
* @public
|
|
41
41
|
*/
|
|
42
|
-
export
|
|
42
|
+
export type DOMElementGuards = Record<string, DOMAspectGuards>;
|
|
43
43
|
/**
|
|
44
44
|
* Guard configuration for a DOM Policy.
|
|
45
45
|
* @public
|
|
46
46
|
*/
|
|
47
|
-
export
|
|
47
|
+
export type DOMGuards = {
|
|
48
48
|
/**
|
|
49
49
|
* Guards for specific elements.
|
|
50
50
|
*/
|
|
@@ -58,7 +58,7 @@ export declare type DOMGuards = {
|
|
|
58
58
|
* Options for creating a DOM Policy.
|
|
59
59
|
* @public
|
|
60
60
|
*/
|
|
61
|
-
export
|
|
61
|
+
export type DOMPolicyOptions = {
|
|
62
62
|
/**
|
|
63
63
|
* The trusted type to use for HTML creation.
|
|
64
64
|
*/
|
|
@@ -78,6 +78,6 @@ declare const DOMPolicy: Readonly<{
|
|
|
78
78
|
* @param options The options to use in creating the policy.
|
|
79
79
|
* @returns The newly created DOMPolicy.
|
|
80
80
|
*/
|
|
81
|
-
create(options?: DOMPolicyOptions): Readonly<
|
|
81
|
+
create(options?: DOMPolicyOptions): Readonly<IDOMPolicy>;
|
|
82
82
|
}>;
|
|
83
83
|
export { DOMPolicy };
|
package/dist/dts/dom.d.ts
CHANGED
|
@@ -36,12 +36,12 @@ export declare const DOMAspect: Readonly<{
|
|
|
36
36
|
* The type of HTML aspect to target.
|
|
37
37
|
* @public
|
|
38
38
|
*/
|
|
39
|
-
export
|
|
39
|
+
export type DOMAspect = (typeof DOMAspect)[Exclude<keyof typeof DOMAspect, "none">];
|
|
40
40
|
/**
|
|
41
41
|
* A function used to send values to a DOM sink.
|
|
42
42
|
* @public
|
|
43
43
|
*/
|
|
44
|
-
export
|
|
44
|
+
export type DOMSink = (target: Node, aspectName: string, value: any, ...args: any[]) => void;
|
|
45
45
|
/**
|
|
46
46
|
* A security policy that FAST can use to interact with the DOM.
|
|
47
47
|
* @public
|