@microsoft/fast-element 2.0.0-beta.2 → 2.0.0-beta.21
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 +509 -0
- package/CHANGELOG.md +189 -1
- package/dist/dts/components/attributes.d.ts +15 -0
- package/dist/dts/components/{controller.d.ts → element-controller.d.ts} +74 -28
- package/dist/dts/components/fast-definitions.d.ts +41 -9
- package/dist/dts/components/fast-element.d.ts +14 -26
- package/dist/dts/components/hydration.d.ts +14 -0
- package/dist/{esm/observation/behavior.js → dts/components/install-hydration.d.ts} +0 -0
- package/dist/dts/context.d.ts +7 -7
- package/dist/dts/di/di.d.ts +894 -0
- package/dist/dts/dom-policy.d.ts +83 -0
- package/dist/dts/dom.d.ts +100 -0
- package/dist/dts/index.d.ts +5 -4
- 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 +62 -80
- package/dist/dts/metadata.d.ts +5 -5
- package/dist/dts/observation/observable.d.ts +99 -54
- package/dist/dts/pending-task.d.ts +32 -0
- package/dist/dts/platform.d.ts +8 -1
- package/dist/dts/polyfills.d.ts +0 -8
- package/dist/dts/state/exports.d.ts +3 -0
- package/dist/dts/state/reactive.d.ts +8 -0
- package/dist/dts/state/state.d.ts +141 -0
- package/dist/dts/state/visitor.d.ts +6 -0
- package/dist/dts/state/watch.d.ts +10 -0
- package/dist/dts/styles/css-directive.d.ts +2 -2
- package/dist/dts/styles/css.d.ts +0 -5
- package/dist/dts/styles/element-styles.d.ts +10 -17
- package/dist/dts/styles/host.d.ts +68 -0
- package/dist/dts/styles/style-strategy.d.ts +42 -0
- package/dist/dts/templating/binding-signal.d.ts +12 -27
- package/dist/dts/templating/binding-two-way.d.ts +22 -37
- package/dist/dts/templating/binding.d.ts +76 -208
- package/dist/dts/templating/children.d.ts +1 -1
- package/dist/dts/templating/compiler.d.ts +11 -13
- package/dist/dts/templating/html-directive.d.ts +91 -97
- package/dist/dts/templating/node-observation.d.ts +15 -6
- package/dist/dts/templating/ref.d.ts +7 -11
- package/dist/dts/templating/render.d.ts +296 -0
- package/dist/dts/templating/repeat.d.ts +23 -34
- package/dist/dts/templating/slotted.d.ts +1 -1
- package/dist/dts/templating/template.d.ts +92 -14
- package/dist/dts/templating/view.d.ts +81 -11
- package/dist/dts/templating/when.d.ts +3 -3
- package/dist/dts/testing/exports.d.ts +3 -0
- package/dist/dts/testing/fakes.d.ts +14 -0
- package/dist/dts/testing/fixture.d.ts +84 -0
- package/dist/dts/testing/timeout.d.ts +7 -0
- package/dist/dts/utilities.d.ts +55 -19
- package/dist/esm/components/attributes.js +28 -5
- package/dist/esm/components/{controller.js → element-controller.js} +238 -137
- package/dist/esm/components/fast-definitions.js +38 -30
- package/dist/esm/components/fast-element.js +27 -16
- package/dist/esm/components/hydration.js +35 -0
- package/dist/esm/components/install-hydration.js +2 -0
- package/dist/esm/context.js +7 -3
- package/dist/esm/debug.js +41 -5
- package/dist/esm/di/di.js +1430 -0
- package/dist/esm/dom-policy.js +345 -0
- package/dist/esm/dom.js +101 -0
- package/dist/esm/index.js +4 -2
- package/dist/esm/index.rollup.debug.js +3 -1
- package/dist/esm/index.rollup.js +3 -1
- package/dist/esm/interfaces.js +52 -0
- package/dist/esm/metadata.js +9 -8
- package/dist/esm/observation/arrays.js +303 -2
- package/dist/esm/observation/observable.js +88 -142
- package/dist/esm/observation/update-queue.js +2 -2
- package/dist/esm/pending-task.js +28 -0
- package/dist/esm/platform.js +28 -3
- package/dist/esm/polyfills.js +3 -61
- package/dist/esm/state/exports.js +3 -0
- package/dist/esm/state/reactive.js +34 -0
- package/dist/esm/state/state.js +148 -0
- package/dist/esm/state/visitor.js +28 -0
- package/dist/esm/state/watch.js +36 -0
- package/dist/esm/styles/css.js +4 -9
- package/dist/esm/styles/element-styles.js +14 -33
- package/dist/esm/styles/host.js +1 -0
- package/dist/esm/styles/style-strategy.js +1 -0
- package/dist/esm/templating/binding-signal.js +67 -62
- package/dist/esm/templating/binding-two-way.js +72 -39
- package/dist/esm/templating/binding.js +142 -286
- package/dist/esm/templating/children.js +8 -4
- package/dist/esm/templating/compiler.js +59 -43
- package/dist/esm/templating/html-directive.js +56 -75
- package/dist/esm/templating/node-observation.js +20 -13
- package/dist/esm/templating/ref.js +4 -12
- package/dist/esm/templating/render.js +402 -0
- package/dist/esm/templating/repeat.js +88 -75
- package/dist/esm/templating/template.js +132 -60
- package/dist/esm/templating/view.js +113 -29
- package/dist/esm/templating/when.js +5 -4
- package/dist/esm/testing/exports.js +3 -0
- package/dist/esm/testing/fakes.js +107 -0
- package/dist/esm/testing/fixture.js +86 -0
- package/dist/esm/testing/timeout.js +24 -0
- package/dist/esm/utilities.js +97 -96
- package/dist/fast-element.api.json +9741 -8201
- package/dist/fast-element.d.ts +889 -646
- package/dist/fast-element.debug.js +2001 -1167
- package/dist/fast-element.debug.min.js +1 -1
- package/dist/fast-element.js +1907 -1109
- package/dist/fast-element.min.js +1 -1
- package/dist/fast-element.untrimmed.d.ts +913 -703
- package/docs/api-report.md +331 -258
- package/package.json +38 -16
- package/dist/dts/hooks.d.ts +0 -20
- package/dist/dts/observation/behavior.d.ts +0 -19
- package/dist/dts/observation/splice-strategies.d.ts +0 -13
- package/dist/dts/templating/dom.d.ts +0 -41
- package/dist/esm/hooks.js +0 -32
- package/dist/esm/observation/splice-strategies.js +0 -400
- package/dist/esm/templating/dom.js +0 -49
package/CHANGELOG.md
CHANGED
|
@@ -1,9 +1,197 @@
|
|
|
1
1
|
# Change Log - @microsoft/fast-element
|
|
2
2
|
|
|
3
|
-
This log was last generated on
|
|
3
|
+
This log was last generated on Tue, 14 Feb 2023 04:02:35 GMT and should not be manually modified.
|
|
4
4
|
|
|
5
5
|
<!-- Start content -->
|
|
6
6
|
|
|
7
|
+
## 2.0.0-beta.21
|
|
8
|
+
|
|
9
|
+
Tue, 14 Feb 2023 04:02:35 GMT
|
|
10
|
+
|
|
11
|
+
### Changes
|
|
12
|
+
|
|
13
|
+
- fix: cleanup types, docs, etc. in root source files of fast-element in preparation for release (rob@bluespire.com)
|
|
14
|
+
- Remove un-necessary expression from StyleElementStrategy (nicholasrice@users.noreply.github.com)
|
|
15
|
+
|
|
16
|
+
## 2.0.0-beta.20
|
|
17
|
+
|
|
18
|
+
Wed, 11 Jan 2023 22:07:47 GMT
|
|
19
|
+
|
|
20
|
+
### Changes
|
|
21
|
+
|
|
22
|
+
- add nullableBooleanConverter for attributes (863023+radium-v@users.noreply.github.com)
|
|
23
|
+
- update return type for dangerousHTML to DangerousHTMLDirective (chhol@microsoft.com)
|
|
24
|
+
- chore: remove deprecated APIs from fast-element (rob@bluespire.com)
|
|
25
|
+
- chore: cleanup fast-element interfaces (roeisenb@microsoft.com)
|
|
26
|
+
- refactor(fast-element): replace dangerousHTML with html.partial (roeisenb@microsoft.com)
|
|
27
|
+
- feat: add ability to inline templates (roeisenb@microsoft.com)
|
|
28
|
+
|
|
29
|
+
## 2.0.0-beta.19
|
|
30
|
+
|
|
31
|
+
Fri, 02 Dec 2022 01:18:22 GMT
|
|
32
|
+
|
|
33
|
+
### Changes
|
|
34
|
+
|
|
35
|
+
- feat: add kernel mode with isolation by default (roeisenb@microsoft.com)
|
|
36
|
+
|
|
37
|
+
## 2.0.0-beta.18
|
|
38
|
+
|
|
39
|
+
Tue, 15 Nov 2022 02:40:34 GMT
|
|
40
|
+
|
|
41
|
+
### Changes
|
|
42
|
+
|
|
43
|
+
- chore: move ViewBehaviorOrchestrator to utilities (roeisenb@microsoft.com)
|
|
44
|
+
- feat: add new DOM Policy protection throughout (roeisenb@microsoft.com)
|
|
45
|
+
|
|
46
|
+
## 2.0.0-beta.17
|
|
47
|
+
|
|
48
|
+
Tue, 01 Nov 2022 23:26:26 GMT
|
|
49
|
+
|
|
50
|
+
### Changes
|
|
51
|
+
|
|
52
|
+
- fix: prevent circular reference errors when stringifying DOM nodes controlled by FAST's rendering engine (roeisenb@microsoft.com)
|
|
53
|
+
|
|
54
|
+
## 2.0.0-beta.16
|
|
55
|
+
|
|
56
|
+
Fri, 28 Oct 2022 20:44:44 GMT
|
|
57
|
+
|
|
58
|
+
### Changes
|
|
59
|
+
|
|
60
|
+
- Fixed bug preventing main component stylesheet behaviors from being connected during connectedCallback (nicholasrice@users.noreply.github.com)
|
|
61
|
+
|
|
62
|
+
## 2.0.0-beta.15
|
|
63
|
+
|
|
64
|
+
Tue, 25 Oct 2022 20:24:32 GMT
|
|
65
|
+
|
|
66
|
+
### Changes
|
|
67
|
+
|
|
68
|
+
- Updated the ElementController to connect behaviors prior to rendering element templates (nicholasrice@users.noreply.github.com)
|
|
69
|
+
- Added support to fast-element to support element hydration and the `defer-hydration` attribute (nicholasrice@users.noreply.github.com)
|
|
70
|
+
|
|
71
|
+
## 2.0.0-beta.14
|
|
72
|
+
|
|
73
|
+
Fri, 14 Oct 2022 18:26:11 GMT
|
|
74
|
+
|
|
75
|
+
### Changes
|
|
76
|
+
|
|
77
|
+
- fix: tokenList bindings track adds and removes from multiple sources (roeisenb@microsoft.com)
|
|
78
|
+
- refactor: remove duplication and re-organize binding behavior logic (roeisenb@microsoft.com)
|
|
79
|
+
|
|
80
|
+
## 2.0.0-beta.13
|
|
81
|
+
|
|
82
|
+
Mon, 10 Oct 2022 20:28:02 GMT
|
|
83
|
+
|
|
84
|
+
### Changes
|
|
85
|
+
|
|
86
|
+
- fix: prevent event callbacks when controller is not bound (roeisenb@microsoft.com)
|
|
87
|
+
|
|
88
|
+
## 2.0.0-beta.12
|
|
89
|
+
|
|
90
|
+
Thu, 06 Oct 2022 23:21:20 GMT
|
|
91
|
+
|
|
92
|
+
### Changes
|
|
93
|
+
|
|
94
|
+
- fix: repeat update view context positioning (roeisenb@microsoft.com)
|
|
95
|
+
|
|
96
|
+
## 2.0.0-beta.11
|
|
97
|
+
|
|
98
|
+
Wed, 05 Oct 2022 23:26:01 GMT
|
|
99
|
+
|
|
100
|
+
### Changes
|
|
101
|
+
|
|
102
|
+
- fix: removed a shadowRoot leak from ElementController (nicholasrice@users.noreply.github.com)
|
|
103
|
+
|
|
104
|
+
## 2.0.0-beta.10
|
|
105
|
+
|
|
106
|
+
Mon, 03 Oct 2022 23:44:38 GMT
|
|
107
|
+
|
|
108
|
+
### Changes
|
|
109
|
+
|
|
110
|
+
- fix: observation kernel missing binding observer disconnect method (roeisenb@microsoft.com)
|
|
111
|
+
- feat: less surprising class bindings w/ more flexibility for developers (roeisenb@microsoft.com)
|
|
112
|
+
- fix: don't allow registering FASTElement itself as a web component (roeisenb@microsoft.com)
|
|
113
|
+
|
|
114
|
+
## 2.0.0-beta.9
|
|
115
|
+
|
|
116
|
+
Wed, 28 Sep 2022 20:45:51 GMT
|
|
117
|
+
|
|
118
|
+
### Changes
|
|
119
|
+
|
|
120
|
+
- fix: ensure composed templates receive the existing execution context (roeisenb@microsoft.com)
|
|
121
|
+
|
|
122
|
+
## 2.0.0-beta.8
|
|
123
|
+
|
|
124
|
+
Tue, 27 Sep 2022 22:31:52 GMT
|
|
125
|
+
|
|
126
|
+
### Changes
|
|
127
|
+
|
|
128
|
+
- fix: correct view state when processing unbindables during rebind (roeisenb@microsoft.com)
|
|
129
|
+
- fix: do not crash when null/undefined is provided literally in templates (roeisenb@microsoft.com)
|
|
130
|
+
|
|
131
|
+
## 2.0.0-beta.7
|
|
132
|
+
|
|
133
|
+
Fri, 23 Sep 2022 22:53:27 GMT
|
|
134
|
+
|
|
135
|
+
### Changes
|
|
136
|
+
|
|
137
|
+
- feat: improve parent typing and fix repeat context type bug (roeisenb@microsoft.com)
|
|
138
|
+
- feat: prepare fast-element for scoped element registries (roeisenb@microsoft.com)
|
|
139
|
+
- persist totalAvailableViews to compare against removeIndex (wendywendy@microsoft.com)
|
|
140
|
+
- make ElementsFilter type arguments optional (863023+radium-v@users.noreply.github.com)
|
|
141
|
+
- fix(fast-element): attributes properly located in inheritance hierarchy (roeisenb@microsoft.com)
|
|
142
|
+
- Adds PendingTask community protocol (nicholasrice@users.noreply.github.com)
|
|
143
|
+
- feat: new behavior and context API design (roeisenb@microsoft.com)
|
|
144
|
+
- feat: implement getAsync code path for dependency injection (roeisenb@microsoft.com)
|
|
145
|
+
|
|
146
|
+
## 2.0.0-beta.6
|
|
147
|
+
|
|
148
|
+
Thu, 01 Sep 2022 21:53:34 GMT
|
|
149
|
+
|
|
150
|
+
### Changes
|
|
151
|
+
|
|
152
|
+
- feat: add new state, ownedState, and computedState APIs (roeisenb@microsoft.com)
|
|
153
|
+
|
|
154
|
+
## 2.0.0-beta.5
|
|
155
|
+
|
|
156
|
+
Thu, 18 Aug 2022 20:46:10 GMT
|
|
157
|
+
|
|
158
|
+
### Changes
|
|
159
|
+
|
|
160
|
+
- Fix ExpressionObserer bug where watcher was not reset if the binding threw (nicholasrice@users.noreply.github.com)
|
|
161
|
+
- make insertbefore noop in view (prudepixie@users.noreply.github.com)
|
|
162
|
+
- make sure default options for recycle gets set in different scenarios (prudepixie@users.noreply.github.com)
|
|
163
|
+
- refactor: remove dependency of DI on FASTElement (roeisenb@microsoft.com)
|
|
164
|
+
- add subpath export for package.json to packages (32497422+KingOfTac@users.noreply.github.com)
|
|
165
|
+
- change default array strategy to merge strategy, update repeat directive (prudepixie@users.noreply.github.com)
|
|
166
|
+
- assert FASTElement's type so that instanceof behavior is consistent with other class implementations (nicholasrice@users.noreply.github.com)
|
|
167
|
+
|
|
168
|
+
## 2.0.0-beta.4
|
|
169
|
+
|
|
170
|
+
Mon, 18 Jul 2022 21:10:01 GMT
|
|
171
|
+
|
|
172
|
+
### Changes
|
|
173
|
+
|
|
174
|
+
- feat: extract all error messages from context and DI (roeisenb@microsoft.com)
|
|
175
|
+
- feat: introduce new binding API (roeisenb@microsoft.com)
|
|
176
|
+
- Enabled DOM Container fallback functions when a container cannot be located. (roeisenb@microsoft.com)
|
|
177
|
+
- feat: add render directive, renderWith decorator, and RenderInstruction (roeisenb@microsoft.com)
|
|
178
|
+
- only store removed views if it can't be reused right away (prudepixie@users.noreply.github.com)
|
|
179
|
+
- fix: enable createElementTemplate to have undefined attributes (32497422+KingOfTac@users.noreply.github.com)
|
|
180
|
+
- use index to track reusable views (prudepixie@users.noreply.github.com)
|
|
181
|
+
- feat: enable render, repeat, and when template helpers to handle static data in addition to the already supported dynamic bindings (roeisenb@microsoft.com)
|
|
182
|
+
- fix: FASTElementDefinition#isDefined should be true only after define (roeisenb@microsoft.com)
|
|
183
|
+
- feat: move testing and dependency injection to fast-element (roeisenb@microsoft.com)
|
|
184
|
+
- fix: warn when host bindings are accidentally applied on non CE views (roeisenb@microsoft.com)
|
|
185
|
+
- feat: perf and safety improvements to fast element definition (roeisenb@microsoft.com)
|
|
186
|
+
|
|
187
|
+
## 2.0.0-beta.3
|
|
188
|
+
|
|
189
|
+
Wed, 22 Jun 2022 20:17:50 GMT
|
|
190
|
+
|
|
191
|
+
### Changes
|
|
192
|
+
|
|
193
|
+
- fix: correct aspect type for content that looks like an attribute (nicholasrice@users.noreply.github.com)
|
|
194
|
+
|
|
7
195
|
## 2.0.0-beta.2
|
|
8
196
|
|
|
9
197
|
Wed, 15 Jun 2022 17:41:10 GMT
|
|
@@ -40,6 +40,16 @@ export declare type AttributeConfiguration = {
|
|
|
40
40
|
mode?: AttributeMode;
|
|
41
41
|
converter?: ValueConverter;
|
|
42
42
|
};
|
|
43
|
+
/**
|
|
44
|
+
* Metadata used to configure a custom attribute's behavior.
|
|
45
|
+
* @public
|
|
46
|
+
*/
|
|
47
|
+
export declare const AttributeConfiguration: Readonly<{
|
|
48
|
+
/**
|
|
49
|
+
* Locates all attribute configurations associated with a type.
|
|
50
|
+
*/
|
|
51
|
+
locate: (target: {}) => AttributeConfiguration[];
|
|
52
|
+
}>;
|
|
43
53
|
/**
|
|
44
54
|
* Metadata used to configure a custom attribute's behavior through a decorator.
|
|
45
55
|
* @public
|
|
@@ -52,6 +62,11 @@ export declare type DecoratorAttributeConfiguration = Omit<AttributeConfiguratio
|
|
|
52
62
|
* @public
|
|
53
63
|
*/
|
|
54
64
|
export declare const booleanConverter: ValueConverter;
|
|
65
|
+
/**
|
|
66
|
+
* A {@link ValueConverter} that converts to and from `boolean` values. `null`, `undefined`, `""`, and `void` values are converted to `null`.
|
|
67
|
+
* @public
|
|
68
|
+
*/
|
|
69
|
+
export declare const nullableBooleanConverter: ValueConverter;
|
|
55
70
|
/**
|
|
56
71
|
* A {@link ValueConverter} that converts to and from `number` values.
|
|
57
72
|
* @remarks
|
|
@@ -1,21 +1,35 @@
|
|
|
1
|
-
import type { Behavior } from "../observation/behavior.js";
|
|
2
1
|
import { PropertyChangeNotifier } from "../observation/notifier.js";
|
|
3
|
-
import
|
|
2
|
+
import { ElementStyles } from "../styles/element-styles.js";
|
|
3
|
+
import type { HostBehavior, HostController } from "../styles/host.js";
|
|
4
|
+
import type { StyleStrategy, StyleTarget } from "../styles/style-strategy.js";
|
|
4
5
|
import type { ElementViewTemplate } from "../templating/template.js";
|
|
5
6
|
import type { ElementView } from "../templating/view.js";
|
|
6
7
|
import { FASTElementDefinition } from "./fast-definitions.js";
|
|
8
|
+
/**
|
|
9
|
+
* A type that instantiates an ElementController
|
|
10
|
+
* @public
|
|
11
|
+
*/
|
|
12
|
+
export interface ElementControllerStrategy {
|
|
13
|
+
new (element: HTMLElement, definition: FASTElementDefinition): ElementController;
|
|
14
|
+
}
|
|
7
15
|
/**
|
|
8
16
|
* Controls the lifecycle and rendering of a `FASTElement`.
|
|
9
17
|
* @public
|
|
10
18
|
*/
|
|
11
|
-
export declare class
|
|
19
|
+
export declare class ElementController<TElement extends HTMLElement = HTMLElement> extends PropertyChangeNotifier implements HostController<TElement> {
|
|
12
20
|
private boundObservables;
|
|
13
|
-
private behaviors;
|
|
14
21
|
private needsInitialization;
|
|
15
22
|
private hasExistingShadowRoot;
|
|
16
23
|
private _template;
|
|
17
|
-
private
|
|
18
|
-
|
|
24
|
+
private stage;
|
|
25
|
+
/**
|
|
26
|
+
* A guard against connecting behaviors multiple times
|
|
27
|
+
* during connect in scenarios where a behavior adds
|
|
28
|
+
* another behavior during it's connectedCallback
|
|
29
|
+
*/
|
|
30
|
+
private guardBehaviorConnection;
|
|
31
|
+
private behaviors;
|
|
32
|
+
private _mainStyles;
|
|
19
33
|
/**
|
|
20
34
|
* This allows Observable.getNotifier(...) to return the Controller
|
|
21
35
|
* when the notifier for the Controller itself is being requested. The
|
|
@@ -28,7 +42,7 @@ export declare class Controller<TElement extends HTMLElement = HTMLElement> exte
|
|
|
28
42
|
/**
|
|
29
43
|
* The element being controlled by this controller.
|
|
30
44
|
*/
|
|
31
|
-
readonly
|
|
45
|
+
readonly source: TElement;
|
|
32
46
|
/**
|
|
33
47
|
* The element definition that instructs this controller
|
|
34
48
|
* in how to handle rendering and other platform integrations.
|
|
@@ -45,7 +59,6 @@ export declare class Controller<TElement extends HTMLElement = HTMLElement> exte
|
|
|
45
59
|
* connected to the document.
|
|
46
60
|
*/
|
|
47
61
|
get isConnected(): boolean;
|
|
48
|
-
private setIsConnected;
|
|
49
62
|
/**
|
|
50
63
|
* Gets/sets the template used to render the component.
|
|
51
64
|
* @remarks
|
|
@@ -54,12 +67,11 @@ export declare class Controller<TElement extends HTMLElement = HTMLElement> exte
|
|
|
54
67
|
get template(): ElementViewTemplate<TElement> | null;
|
|
55
68
|
set template(value: ElementViewTemplate<TElement> | null);
|
|
56
69
|
/**
|
|
57
|
-
*
|
|
58
|
-
*
|
|
59
|
-
* This value can only be accurately read after connect but can be set at any time.
|
|
70
|
+
* The main set of styles used for the component, independent
|
|
71
|
+
* of any dynamically added styles.
|
|
60
72
|
*/
|
|
61
|
-
get
|
|
62
|
-
set
|
|
73
|
+
get mainStyles(): ElementStyles | null;
|
|
74
|
+
set mainStyles(value: ElementStyles | null);
|
|
63
75
|
/**
|
|
64
76
|
* Creates a Controller to control the specified element.
|
|
65
77
|
* @param element - The element to be controlled by this controller.
|
|
@@ -68,6 +80,17 @@ export declare class Controller<TElement extends HTMLElement = HTMLElement> exte
|
|
|
68
80
|
* @internal
|
|
69
81
|
*/
|
|
70
82
|
constructor(element: TElement, definition: FASTElementDefinition);
|
|
83
|
+
/**
|
|
84
|
+
* Adds the behavior to the component.
|
|
85
|
+
* @param behavior - The behavior to add.
|
|
86
|
+
*/
|
|
87
|
+
addBehavior(behavior: HostBehavior<TElement>): void;
|
|
88
|
+
/**
|
|
89
|
+
* Removes the behavior from the component.
|
|
90
|
+
* @param behavior - The behavior to remove.
|
|
91
|
+
* @param force - Forces removal even if this behavior was added more than once.
|
|
92
|
+
*/
|
|
93
|
+
removeBehavior(behavior: HostBehavior<TElement>, force?: boolean): void;
|
|
71
94
|
/**
|
|
72
95
|
* Adds styles to this element. Providing an HTMLStyleElement will attach the element instance to the shadowRoot.
|
|
73
96
|
* @param styles - The styles to add.
|
|
@@ -78,25 +101,14 @@ export declare class Controller<TElement extends HTMLElement = HTMLElement> exte
|
|
|
78
101
|
* @param styles - the styles to remove.
|
|
79
102
|
*/
|
|
80
103
|
removeStyles(styles: ElementStyles | HTMLStyleElement | null | undefined): void;
|
|
81
|
-
/**
|
|
82
|
-
* Adds behaviors to this element.
|
|
83
|
-
* @param behaviors - The behaviors to add.
|
|
84
|
-
*/
|
|
85
|
-
addBehaviors(behaviors: ReadonlyArray<Behavior<TElement>>): void;
|
|
86
|
-
/**
|
|
87
|
-
* Removes behaviors from this element.
|
|
88
|
-
* @param behaviors - The behaviors to remove.
|
|
89
|
-
* @param force - Forces unbinding of behaviors.
|
|
90
|
-
*/
|
|
91
|
-
removeBehaviors(behaviors: ReadonlyArray<Behavior<TElement>>, force?: boolean): void;
|
|
92
104
|
/**
|
|
93
105
|
* Runs connected lifecycle behavior on the associated element.
|
|
94
106
|
*/
|
|
95
|
-
|
|
107
|
+
connect(): void;
|
|
96
108
|
/**
|
|
97
109
|
* Runs disconnected lifecycle behavior on the associated element.
|
|
98
110
|
*/
|
|
99
|
-
|
|
111
|
+
disconnect(): void;
|
|
100
112
|
/**
|
|
101
113
|
* Runs the attribute changed callback for the associated element.
|
|
102
114
|
* @param name - The name of the attribute that changed.
|
|
@@ -113,7 +125,11 @@ export declare class Controller<TElement extends HTMLElement = HTMLElement> exte
|
|
|
113
125
|
* Only emits events if connected.
|
|
114
126
|
*/
|
|
115
127
|
emit(type: string, detail?: any, options?: Omit<CustomEventInit, "detail">): void | boolean;
|
|
116
|
-
|
|
128
|
+
/**
|
|
129
|
+
* Opts out of JSON stringification.
|
|
130
|
+
* @internal
|
|
131
|
+
*/
|
|
132
|
+
toJSON: () => undefined;
|
|
117
133
|
private renderTemplate;
|
|
118
134
|
/**
|
|
119
135
|
* Locates or creates a controller for the specified element.
|
|
@@ -123,5 +139,35 @@ export declare class Controller<TElement extends HTMLElement = HTMLElement> exte
|
|
|
123
139
|
* registered either through the use of the {@link customElement}
|
|
124
140
|
* decorator or a call to `FASTElement.define`.
|
|
125
141
|
*/
|
|
126
|
-
static forCustomElement(element: HTMLElement):
|
|
142
|
+
static forCustomElement(element: HTMLElement): ElementController;
|
|
143
|
+
/**
|
|
144
|
+
* Sets the strategy that ElementController.forCustomElement uses to construct
|
|
145
|
+
* ElementController instances for an element.
|
|
146
|
+
* @param strategy - The strategy to use.
|
|
147
|
+
*/
|
|
148
|
+
static setStrategy(strategy: ElementControllerStrategy): void;
|
|
149
|
+
}
|
|
150
|
+
/**
|
|
151
|
+
* https://wicg.github.io/construct-stylesheets/
|
|
152
|
+
* https://developers.google.com/web/updates/2019/02/constructable-stylesheets
|
|
153
|
+
*
|
|
154
|
+
* @internal
|
|
155
|
+
*/
|
|
156
|
+
export declare class AdoptedStyleSheetsStrategy implements StyleStrategy {
|
|
157
|
+
private static styleSheetCache;
|
|
158
|
+
/** @internal */
|
|
159
|
+
readonly sheets: CSSStyleSheet[];
|
|
160
|
+
constructor(styles: (string | CSSStyleSheet)[]);
|
|
161
|
+
addStylesTo(target: StyleTarget): void;
|
|
162
|
+
removeStylesFrom(target: StyleTarget): void;
|
|
163
|
+
}
|
|
164
|
+
/**
|
|
165
|
+
* @internal
|
|
166
|
+
*/
|
|
167
|
+
export declare class StyleElementStrategy implements StyleStrategy {
|
|
168
|
+
private readonly styles;
|
|
169
|
+
private readonly styleClass;
|
|
170
|
+
constructor(styles: string[]);
|
|
171
|
+
addStylesTo(target: StyleTarget): void;
|
|
172
|
+
removeStylesFrom(target: StyleTarget): void;
|
|
127
173
|
}
|
|
@@ -2,6 +2,18 @@ import { Constructable } from "../interfaces.js";
|
|
|
2
2
|
import { ComposableStyles, ElementStyles } from "../styles/element-styles.js";
|
|
3
3
|
import type { ElementViewTemplate } from "../templating/template.js";
|
|
4
4
|
import { AttributeConfiguration, AttributeDefinition } from "./attributes.js";
|
|
5
|
+
/**
|
|
6
|
+
* Shadow root initialization options.
|
|
7
|
+
* @public
|
|
8
|
+
*/
|
|
9
|
+
export interface ShadowRootOptions extends ShadowRootInit {
|
|
10
|
+
/**
|
|
11
|
+
* A registry that provides the custom elements visible
|
|
12
|
+
* from within this shadow root.
|
|
13
|
+
* @beta
|
|
14
|
+
*/
|
|
15
|
+
registry?: CustomElementRegistry;
|
|
16
|
+
}
|
|
5
17
|
/**
|
|
6
18
|
* Represents metadata configuration for a custom element.
|
|
7
19
|
* @public
|
|
@@ -25,19 +37,28 @@ export interface PartialFASTElementDefinition {
|
|
|
25
37
|
readonly attributes?: (AttributeConfiguration | string)[];
|
|
26
38
|
/**
|
|
27
39
|
* Options controlling the creation of the custom element's shadow DOM.
|
|
40
|
+
* @remarks
|
|
41
|
+
* If not provided, defaults to an open shadow root. Provide null
|
|
42
|
+
* to render to the associated template to the light DOM instead.
|
|
28
43
|
*/
|
|
29
|
-
readonly shadowOptions?: Partial<
|
|
44
|
+
readonly shadowOptions?: Partial<ShadowRootOptions> | null;
|
|
30
45
|
/**
|
|
31
46
|
* Options controlling how the custom element is defined with the platform.
|
|
32
47
|
*/
|
|
33
48
|
readonly elementOptions?: ElementDefinitionOptions;
|
|
49
|
+
/**
|
|
50
|
+
* The registry to register this component in by default.
|
|
51
|
+
* @remarks
|
|
52
|
+
* If not provided, defaults to the global registry.
|
|
53
|
+
*/
|
|
54
|
+
readonly registry?: CustomElementRegistry;
|
|
34
55
|
}
|
|
35
56
|
/**
|
|
36
57
|
* Defines metadata for a FASTElement.
|
|
37
58
|
* @public
|
|
38
59
|
*/
|
|
39
60
|
export declare class FASTElementDefinition<TType extends Constructable<HTMLElement> = Constructable<HTMLElement>> {
|
|
40
|
-
private
|
|
61
|
+
private platformDefined;
|
|
41
62
|
/**
|
|
42
63
|
* The type this element definition describes.
|
|
43
64
|
*/
|
|
@@ -73,18 +94,16 @@ export declare class FASTElementDefinition<TType extends Constructable<HTMLEleme
|
|
|
73
94
|
/**
|
|
74
95
|
* Options controlling the creation of the custom element's shadow DOM.
|
|
75
96
|
*/
|
|
76
|
-
readonly shadowOptions?:
|
|
97
|
+
readonly shadowOptions?: ShadowRootOptions;
|
|
77
98
|
/**
|
|
78
99
|
* Options controlling how the custom element is defined with the platform.
|
|
79
100
|
*/
|
|
80
|
-
readonly elementOptions
|
|
101
|
+
readonly elementOptions: ElementDefinitionOptions;
|
|
81
102
|
/**
|
|
82
|
-
*
|
|
83
|
-
* @param type - The type this definition is being created for.
|
|
84
|
-
* @param nameOrConfig - The name of the element to define or a config object
|
|
85
|
-
* that describes the element to define.
|
|
103
|
+
* The registry to register this component in by default.
|
|
86
104
|
*/
|
|
87
|
-
|
|
105
|
+
readonly registry: CustomElementRegistry;
|
|
106
|
+
private constructor();
|
|
88
107
|
/**
|
|
89
108
|
* Defines a custom element based on this definition.
|
|
90
109
|
* @param registry - The element registry to define the element in.
|
|
@@ -92,6 +111,19 @@ export declare class FASTElementDefinition<TType extends Constructable<HTMLEleme
|
|
|
92
111
|
* This operation is idempotent per registry.
|
|
93
112
|
*/
|
|
94
113
|
define(registry?: CustomElementRegistry): this;
|
|
114
|
+
/**
|
|
115
|
+
* Creates an instance of FASTElementDefinition.
|
|
116
|
+
* @param type - The type this definition is being created for.
|
|
117
|
+
* @param nameOrDef - The name of the element to define or a config object
|
|
118
|
+
* that describes the element to define.
|
|
119
|
+
*/
|
|
120
|
+
static compose<TType extends Constructable<HTMLElement> = Constructable<HTMLElement>>(type: TType, nameOrDef?: string | PartialFASTElementDefinition): FASTElementDefinition<TType>;
|
|
121
|
+
/**
|
|
122
|
+
* Registers a FASTElement base type.
|
|
123
|
+
* @param type - The type to register as a base type.
|
|
124
|
+
* @internal
|
|
125
|
+
*/
|
|
126
|
+
static registerBaseType(type: Function): void;
|
|
95
127
|
/**
|
|
96
128
|
* Gets the element definition associated with the specified type.
|
|
97
129
|
* @param type - The custom element type to retrieve the definition for.
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import
|
|
2
|
-
import {
|
|
1
|
+
import { Constructable } from "../interfaces.js";
|
|
2
|
+
import { ElementController } from "./element-controller.js";
|
|
3
3
|
import { FASTElementDefinition, PartialFASTElementDefinition } from "./fast-definitions.js";
|
|
4
4
|
/**
|
|
5
5
|
* Represents a custom element based on the FASTElement infrastructure.
|
|
@@ -10,7 +10,7 @@ export interface FASTElement extends HTMLElement {
|
|
|
10
10
|
* The underlying controller that handles the lifecycle and rendering of
|
|
11
11
|
* this FASTElement.
|
|
12
12
|
*/
|
|
13
|
-
readonly $fastController:
|
|
13
|
+
readonly $fastController: ElementController;
|
|
14
14
|
/**
|
|
15
15
|
* Emits a custom HTML event.
|
|
16
16
|
* @param type - The type name of the event.
|
|
@@ -45,34 +45,21 @@ export interface FASTElement extends HTMLElement {
|
|
|
45
45
|
*/
|
|
46
46
|
attributeChangedCallback(name: string, oldValue: string | null, newValue: string | null): void;
|
|
47
47
|
}
|
|
48
|
+
declare function compose<TType extends Constructable<HTMLElement> = Constructable<HTMLElement>>(this: TType, nameOrDef: string | PartialFASTElementDefinition): FASTElementDefinition<TType>;
|
|
49
|
+
declare function compose<TType extends Constructable<HTMLElement> = Constructable<HTMLElement>>(type: TType, nameOrDef?: string | PartialFASTElementDefinition): FASTElementDefinition<TType>;
|
|
50
|
+
declare function define<TType extends Constructable<HTMLElement> = Constructable<HTMLElement>>(this: TType, nameOrDef: string | PartialFASTElementDefinition): TType;
|
|
51
|
+
declare function define<TType extends Constructable<HTMLElement> = Constructable<HTMLElement>>(type: TType, nameOrDef?: string | PartialFASTElementDefinition): TType;
|
|
52
|
+
declare function from<TBase extends typeof HTMLElement>(BaseType: TBase): new () => InstanceType<TBase> & FASTElement;
|
|
48
53
|
/**
|
|
49
54
|
* A minimal base class for FASTElements that also provides
|
|
50
55
|
* static helpers for working with FASTElements.
|
|
51
56
|
* @public
|
|
52
57
|
*/
|
|
53
|
-
export declare const FASTElement:
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
*/
|
|
59
|
-
from<TBase extends {
|
|
60
|
-
new (): HTMLElement;
|
|
61
|
-
prototype: HTMLElement;
|
|
62
|
-
}>(BaseType: TBase): new () => InstanceType<TBase> & FASTElement;
|
|
63
|
-
/**
|
|
64
|
-
* Defines a platform custom element based on the provided type and definition.
|
|
65
|
-
* @param type - The custom element type to define.
|
|
66
|
-
* @param nameOrDef - The name of the element to define or a definition object
|
|
67
|
-
* that describes the element to define.
|
|
68
|
-
*/
|
|
69
|
-
define<TType extends Constructable<HTMLElement>>(type: TType, nameOrDef?: string | PartialFASTElementDefinition): TType;
|
|
70
|
-
/**
|
|
71
|
-
* Defines metadata for a FASTElement which can be used to later define the element.
|
|
72
|
-
* IMPORTANT: This API will be renamed to "compose" in a future beta.
|
|
73
|
-
* @public
|
|
74
|
-
*/
|
|
75
|
-
metadata<TType_1 extends Constructable<HTMLElement> = Constructable<HTMLElement>>(type: TType_1, nameOrDef?: string | PartialFASTElementDefinition): FASTElementDefinition<TType_1>;
|
|
58
|
+
export declare const FASTElement: {
|
|
59
|
+
new (): FASTElement;
|
|
60
|
+
define: typeof define;
|
|
61
|
+
compose: typeof compose;
|
|
62
|
+
from: typeof from;
|
|
76
63
|
};
|
|
77
64
|
/**
|
|
78
65
|
* Decorator: Defines a platform custom element based on `FASTElement`.
|
|
@@ -81,3 +68,4 @@ export declare const FASTElement: (new () => HTMLElement & FASTElement) & {
|
|
|
81
68
|
* @public
|
|
82
69
|
*/
|
|
83
70
|
export declare function customElement(nameOrDef: string | PartialFASTElementDefinition): (type: Constructable<HTMLElement>) => void;
|
|
71
|
+
export {};
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import { ElementController } from "./element-controller.js";
|
|
2
|
+
/**
|
|
3
|
+
* An ElementController capable of hydrating FAST elements from
|
|
4
|
+
* Declarative Shadow DOM.
|
|
5
|
+
*
|
|
6
|
+
* @beta
|
|
7
|
+
*/
|
|
8
|
+
export declare class HydratableElementController<TElement extends HTMLElement = HTMLElement> extends ElementController<TElement> {
|
|
9
|
+
private static hydrationObserver;
|
|
10
|
+
private static hydrationObserverHandler;
|
|
11
|
+
connect(): void;
|
|
12
|
+
disconnect(): void;
|
|
13
|
+
static install(): void;
|
|
14
|
+
}
|
|
File without changes
|
package/dist/dts/context.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import
|
|
1
|
+
import { Constructable } 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
|
|
@@ -11,31 +11,31 @@ export declare type Context<T> = {
|
|
|
11
11
|
* A constant key that can be used to represent a Context dependency.
|
|
12
12
|
* The key can be used for context or DI but also doubles as a decorator for
|
|
13
13
|
* resolving the associated dependency.
|
|
14
|
-
* @
|
|
14
|
+
* @public
|
|
15
15
|
*/
|
|
16
16
|
export declare 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
22
|
export declare 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;
|
|
26
|
-
handle(target: EventTarget, callback: (event: ContextEvent<FASTContext<T>>) => void):
|
|
26
|
+
handle(target: EventTarget, callback: (event: ContextEvent<FASTContext<T>>) => void): void;
|
|
27
27
|
};
|
|
28
28
|
/**
|
|
29
29
|
* A strategy that controls how all Context.request API calls are handled.
|
|
30
30
|
* @remarks
|
|
31
|
-
* By default this is handled via Context.dispatch, which
|
|
32
|
-
* @
|
|
31
|
+
* By default this is handled via Context.dispatch, which dispatches a ContextEvent.
|
|
32
|
+
* @public
|
|
33
33
|
*/
|
|
34
34
|
export declare 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 the {@link https://github.com/webcomponents-cg/community-protocols/blob/main/proposals/context.md | W3C Community Context protocol.}
|
|
38
|
-
* @
|
|
38
|
+
* @public
|
|
39
39
|
*/
|
|
40
40
|
export declare const Context: Readonly<{
|
|
41
41
|
/**
|