@microsoft/fast-element 2.0.0-beta.14 → 2.0.0-beta.16
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 +36 -0
- package/CHANGELOG.md +18 -1
- package/dist/dts/components/element-controller.d.ts +22 -5
- package/dist/dts/components/hydration.d.ts +14 -0
- package/dist/dts/components/install-hydration.d.ts +1 -0
- package/dist/dts/index.d.ts +1 -1
- package/dist/dts/utilities.d.ts +14 -0
- package/dist/esm/components/element-controller.js +53 -35
- package/dist/esm/components/hydration.js +35 -0
- package/dist/esm/components/install-hydration.js +2 -0
- package/dist/esm/index.js +1 -1
- package/dist/esm/utilities.js +27 -0
- package/dist/fast-element.api.json +125 -0
- package/dist/fast-element.d.ts +21 -3
- package/dist/fast-element.debug.js +53 -35
- package/dist/fast-element.debug.min.js +1 -1
- package/dist/fast-element.js +53 -35
- package/dist/fast-element.min.js +1 -1
- package/dist/fast-element.untrimmed.d.ts +21 -3
- package/docs/api-report.md +7 -0
- package/package.json +11 -2
- package/yarn-error.log +0 -177
package/CHANGELOG.json
CHANGED
|
@@ -1,6 +1,42 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@microsoft/fast-element",
|
|
3
3
|
"entries": [
|
|
4
|
+
{
|
|
5
|
+
"date": "Fri, 28 Oct 2022 20:44:44 GMT",
|
|
6
|
+
"tag": "@microsoft/fast-element_v2.0.0-beta.16",
|
|
7
|
+
"version": "2.0.0-beta.16",
|
|
8
|
+
"comments": {
|
|
9
|
+
"prerelease": [
|
|
10
|
+
{
|
|
11
|
+
"author": "nicholasrice@users.noreply.github.com",
|
|
12
|
+
"package": "@microsoft/fast-element",
|
|
13
|
+
"commit": "5b745b1fb3bf249a7a2d172b7fb69cb08694aadd",
|
|
14
|
+
"comment": "Fixed bug preventing main component stylesheet behaviors from being connected during connectedCallback"
|
|
15
|
+
}
|
|
16
|
+
]
|
|
17
|
+
}
|
|
18
|
+
},
|
|
19
|
+
{
|
|
20
|
+
"date": "Tue, 25 Oct 2022 20:24:32 GMT",
|
|
21
|
+
"tag": "@microsoft/fast-element_v2.0.0-beta.15",
|
|
22
|
+
"version": "2.0.0-beta.15",
|
|
23
|
+
"comments": {
|
|
24
|
+
"prerelease": [
|
|
25
|
+
{
|
|
26
|
+
"author": "nicholasrice@users.noreply.github.com",
|
|
27
|
+
"package": "@microsoft/fast-element",
|
|
28
|
+
"commit": "220cc7e0e0de490e51cc8b6f42ff46b03228beaa",
|
|
29
|
+
"comment": "Updated the ElementController to connect behaviors prior to rendering element templates"
|
|
30
|
+
},
|
|
31
|
+
{
|
|
32
|
+
"author": "nicholasrice@users.noreply.github.com",
|
|
33
|
+
"package": "@microsoft/fast-element",
|
|
34
|
+
"commit": "32ca5de5feda4870ed36329f58ded4a0a0421f02",
|
|
35
|
+
"comment": "Added support to fast-element to support element hydration and the `defer-hydration` attribute"
|
|
36
|
+
}
|
|
37
|
+
]
|
|
38
|
+
}
|
|
39
|
+
},
|
|
4
40
|
{
|
|
5
41
|
"date": "Fri, 14 Oct 2022 18:26:11 GMT",
|
|
6
42
|
"tag": "@microsoft/fast-element_v2.0.0-beta.14",
|
package/CHANGELOG.md
CHANGED
|
@@ -1,9 +1,26 @@
|
|
|
1
1
|
# Change Log - @microsoft/fast-element
|
|
2
2
|
|
|
3
|
-
This log was last generated on Fri,
|
|
3
|
+
This log was last generated on Fri, 28 Oct 2022 20:44:44 GMT and should not be manually modified.
|
|
4
4
|
|
|
5
5
|
<!-- Start content -->
|
|
6
6
|
|
|
7
|
+
## 2.0.0-beta.16
|
|
8
|
+
|
|
9
|
+
Fri, 28 Oct 2022 20:44:44 GMT
|
|
10
|
+
|
|
11
|
+
### Changes
|
|
12
|
+
|
|
13
|
+
- Fixed bug preventing main component stylesheet behaviors from being connected during connectedCallback (nicholasrice@users.noreply.github.com)
|
|
14
|
+
|
|
15
|
+
## 2.0.0-beta.15
|
|
16
|
+
|
|
17
|
+
Tue, 25 Oct 2022 20:24:32 GMT
|
|
18
|
+
|
|
19
|
+
### Changes
|
|
20
|
+
|
|
21
|
+
- Updated the ElementController to connect behaviors prior to rendering element templates (nicholasrice@users.noreply.github.com)
|
|
22
|
+
- Added support to fast-element to support element hydration and the `defer-hydration` attribute (nicholasrice@users.noreply.github.com)
|
|
23
|
+
|
|
7
24
|
## 2.0.0-beta.14
|
|
8
25
|
|
|
9
26
|
Fri, 14 Oct 2022 18:26:11 GMT
|
|
@@ -1,10 +1,17 @@
|
|
|
1
1
|
import { StyleStrategy, StyleTarget } from "../interfaces.js";
|
|
2
|
-
import type { HostBehavior, HostController } from "../styles/host.js";
|
|
3
2
|
import { PropertyChangeNotifier } from "../observation/notifier.js";
|
|
3
|
+
import { ElementStyles } from "../styles/element-styles.js";
|
|
4
|
+
import type { HostBehavior, HostController } from "../styles/host.js";
|
|
4
5
|
import type { ElementViewTemplate } from "../templating/template.js";
|
|
5
6
|
import type { ElementView } from "../templating/view.js";
|
|
6
|
-
import { ElementStyles } from "../styles/element-styles.js";
|
|
7
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
|
+
}
|
|
8
15
|
/**
|
|
9
16
|
* Controls the lifecycle and rendering of a `FASTElement`.
|
|
10
17
|
* @public
|
|
@@ -14,7 +21,13 @@ export declare class ElementController<TElement extends HTMLElement = HTMLElemen
|
|
|
14
21
|
private needsInitialization;
|
|
15
22
|
private hasExistingShadowRoot;
|
|
16
23
|
private _template;
|
|
17
|
-
private
|
|
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;
|
|
18
31
|
private behaviors;
|
|
19
32
|
private _mainStyles;
|
|
20
33
|
/**
|
|
@@ -46,7 +59,6 @@ export declare class ElementController<TElement extends HTMLElement = HTMLElemen
|
|
|
46
59
|
* connected to the document.
|
|
47
60
|
*/
|
|
48
61
|
get isConnected(): boolean;
|
|
49
|
-
private setIsConnected;
|
|
50
62
|
/**
|
|
51
63
|
* Gets/sets the template used to render the component.
|
|
52
64
|
* @remarks
|
|
@@ -113,7 +125,6 @@ export declare class ElementController<TElement extends HTMLElement = HTMLElemen
|
|
|
113
125
|
* Only emits events if connected.
|
|
114
126
|
*/
|
|
115
127
|
emit(type: string, detail?: any, options?: Omit<CustomEventInit, "detail">): void | boolean;
|
|
116
|
-
private finishInitialization;
|
|
117
128
|
private renderTemplate;
|
|
118
129
|
/**
|
|
119
130
|
* Locates or creates a controller for the specified element.
|
|
@@ -124,6 +135,12 @@ export declare class ElementController<TElement extends HTMLElement = HTMLElemen
|
|
|
124
135
|
* decorator or a call to `FASTElement.define`.
|
|
125
136
|
*/
|
|
126
137
|
static forCustomElement(element: HTMLElement): ElementController;
|
|
138
|
+
/**
|
|
139
|
+
* Sets the strategy that ElementController.forCustomElement uses to construct
|
|
140
|
+
* ElementController instances for an element.
|
|
141
|
+
* @param strategy - The strategy to use.
|
|
142
|
+
*/
|
|
143
|
+
static setStrategy(strategy: ElementControllerStrategy): void;
|
|
127
144
|
}
|
|
128
145
|
/**
|
|
129
146
|
* https://wicg.github.io/construct-stylesheets/
|
|
@@ -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
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
package/dist/dts/index.d.ts
CHANGED
|
@@ -24,4 +24,4 @@ export * from "./templating/node-observation.js";
|
|
|
24
24
|
export * from "./components/fast-element.js";
|
|
25
25
|
export * from "./components/fast-definitions.js";
|
|
26
26
|
export * from "./components/attributes.js";
|
|
27
|
-
export { ElementController } from "./components/element-controller.js";
|
|
27
|
+
export { ElementController, ElementControllerStrategy, } from "./components/element-controller.js";
|
package/dist/dts/utilities.d.ts
CHANGED
|
@@ -20,3 +20,17 @@ export declare function composedParent<T extends HTMLElement>(element: T): HTMLE
|
|
|
20
20
|
* @public
|
|
21
21
|
*/
|
|
22
22
|
export declare function composedContains(reference: HTMLElement, test: HTMLElement): boolean;
|
|
23
|
+
/**
|
|
24
|
+
* @internal
|
|
25
|
+
*/
|
|
26
|
+
export declare class UnobservableMutationObserver extends MutationObserver {
|
|
27
|
+
private readonly callback;
|
|
28
|
+
private observedNodes;
|
|
29
|
+
/**
|
|
30
|
+
* An extension of MutationObserver that supports unobserving nodes.
|
|
31
|
+
* @param callback - The callback to invoke when observed nodes are changed.
|
|
32
|
+
*/
|
|
33
|
+
constructor(callback: MutationCallback);
|
|
34
|
+
observe(target: Node, options?: MutationObserverInit | undefined): void;
|
|
35
|
+
unobserve(target: Node): void;
|
|
36
|
+
}
|
|
@@ -15,6 +15,7 @@ function getShadowRoot(element) {
|
|
|
15
15
|
var _a, _b;
|
|
16
16
|
return (_b = (_a = element.shadowRoot) !== null && _a !== void 0 ? _a : shadowRoots.get(element)) !== null && _b !== void 0 ? _b : null;
|
|
17
17
|
}
|
|
18
|
+
let elementControllerStrategy;
|
|
18
19
|
/**
|
|
19
20
|
* Controls the lifecycle and rendering of a `FASTElement`.
|
|
20
21
|
* @public
|
|
@@ -33,7 +34,13 @@ export class ElementController extends PropertyChangeNotifier {
|
|
|
33
34
|
this.needsInitialization = true;
|
|
34
35
|
this.hasExistingShadowRoot = false;
|
|
35
36
|
this._template = null;
|
|
36
|
-
this.
|
|
37
|
+
this.stage = 3 /* Stages.disconnected */;
|
|
38
|
+
/**
|
|
39
|
+
* A guard against connecting behaviors multiple times
|
|
40
|
+
* during connect in scenarios where a behavior adds
|
|
41
|
+
* another behavior during it's connectedCallback
|
|
42
|
+
*/
|
|
43
|
+
this.guardBehaviorConnection = false;
|
|
37
44
|
this.behaviors = null;
|
|
38
45
|
this._mainStyles = null;
|
|
39
46
|
/**
|
|
@@ -89,11 +96,7 @@ export class ElementController extends PropertyChangeNotifier {
|
|
|
89
96
|
*/
|
|
90
97
|
get isConnected() {
|
|
91
98
|
Observable.track(this, isConnectedPropertyName);
|
|
92
|
-
return this.
|
|
93
|
-
}
|
|
94
|
-
setIsConnected(value) {
|
|
95
|
-
this._isConnected = value;
|
|
96
|
-
Observable.notify(this, isConnectedPropertyName);
|
|
99
|
+
return this.stage === 1 /* Stages.connected */;
|
|
97
100
|
}
|
|
98
101
|
/**
|
|
99
102
|
* Gets/sets the template used to render the component.
|
|
@@ -168,7 +171,9 @@ export class ElementController extends PropertyChangeNotifier {
|
|
|
168
171
|
if (count === 0) {
|
|
169
172
|
targetBehaviors.set(behavior, 1);
|
|
170
173
|
behavior.addedCallback && behavior.addedCallback(this);
|
|
171
|
-
if (behavior.connectedCallback &&
|
|
174
|
+
if (behavior.connectedCallback &&
|
|
175
|
+
!this.guardBehaviorConnection &&
|
|
176
|
+
(this.stage === 1 /* Stages.connected */ || this.stage === 0 /* Stages.connecting */)) {
|
|
172
177
|
behavior.connectedCallback(this);
|
|
173
178
|
}
|
|
174
179
|
}
|
|
@@ -192,7 +197,7 @@ export class ElementController extends PropertyChangeNotifier {
|
|
|
192
197
|
}
|
|
193
198
|
if (count === 1 || force) {
|
|
194
199
|
targetBehaviors.delete(behavior);
|
|
195
|
-
if (behavior.disconnectedCallback && this.
|
|
200
|
+
if (behavior.disconnectedCallback && this.stage !== 3 /* Stages.disconnected */) {
|
|
196
201
|
behavior.disconnectedCallback(this);
|
|
197
202
|
}
|
|
198
203
|
behavior.removedCallback && behavior.removedCallback(this);
|
|
@@ -253,31 +258,49 @@ export class ElementController extends PropertyChangeNotifier {
|
|
|
253
258
|
* Runs connected lifecycle behavior on the associated element.
|
|
254
259
|
*/
|
|
255
260
|
connect() {
|
|
256
|
-
if (this.
|
|
261
|
+
if (this.stage !== 3 /* Stages.disconnected */) {
|
|
257
262
|
return;
|
|
258
263
|
}
|
|
259
|
-
|
|
260
|
-
|
|
261
|
-
|
|
262
|
-
|
|
263
|
-
this.
|
|
264
|
+
this.stage = 0 /* Stages.connecting */;
|
|
265
|
+
// If we have any observables that were bound, re-apply their values.
|
|
266
|
+
if (this.boundObservables !== null) {
|
|
267
|
+
const element = this.source;
|
|
268
|
+
const boundObservables = this.boundObservables;
|
|
269
|
+
const propertyNames = Object.keys(boundObservables);
|
|
270
|
+
for (let i = 0, ii = propertyNames.length; i < ii; ++i) {
|
|
271
|
+
const propertyName = propertyNames[i];
|
|
272
|
+
element[propertyName] = boundObservables[propertyName];
|
|
273
|
+
}
|
|
274
|
+
this.boundObservables = null;
|
|
264
275
|
}
|
|
265
276
|
const behaviors = this.behaviors;
|
|
266
277
|
if (behaviors !== null) {
|
|
278
|
+
this.guardBehaviorConnection = true;
|
|
267
279
|
for (const key of behaviors.keys()) {
|
|
268
280
|
key.connectedCallback && key.connectedCallback(this);
|
|
269
281
|
}
|
|
282
|
+
this.guardBehaviorConnection = false;
|
|
283
|
+
}
|
|
284
|
+
if (this.needsInitialization) {
|
|
285
|
+
this.renderTemplate(this.template);
|
|
286
|
+
this.addStyles(this.mainStyles);
|
|
287
|
+
this.needsInitialization = false;
|
|
270
288
|
}
|
|
271
|
-
this.
|
|
289
|
+
else if (this.view !== null) {
|
|
290
|
+
this.view.bind(this.source);
|
|
291
|
+
}
|
|
292
|
+
this.stage = 1 /* Stages.connected */;
|
|
293
|
+
Observable.notify(this, isConnectedPropertyName);
|
|
272
294
|
}
|
|
273
295
|
/**
|
|
274
296
|
* Runs disconnected lifecycle behavior on the associated element.
|
|
275
297
|
*/
|
|
276
298
|
disconnect() {
|
|
277
|
-
if (
|
|
299
|
+
if (this.stage !== 1 /* Stages.connected */) {
|
|
278
300
|
return;
|
|
279
301
|
}
|
|
280
|
-
this.
|
|
302
|
+
this.stage = 2 /* Stages.disconnecting */;
|
|
303
|
+
Observable.notify(this, isConnectedPropertyName);
|
|
281
304
|
if (this.view !== null) {
|
|
282
305
|
this.view.unbind();
|
|
283
306
|
}
|
|
@@ -287,6 +310,7 @@ export class ElementController extends PropertyChangeNotifier {
|
|
|
287
310
|
key.disconnectedCallback && key.disconnectedCallback(this);
|
|
288
311
|
}
|
|
289
312
|
}
|
|
313
|
+
this.stage = 3 /* Stages.disconnected */;
|
|
290
314
|
}
|
|
291
315
|
/**
|
|
292
316
|
* Runs the attribute changed callback for the associated element.
|
|
@@ -309,27 +333,11 @@ export class ElementController extends PropertyChangeNotifier {
|
|
|
309
333
|
* Only emits events if connected.
|
|
310
334
|
*/
|
|
311
335
|
emit(type, detail, options) {
|
|
312
|
-
if (this.
|
|
336
|
+
if (this.stage === 1 /* Stages.connected */) {
|
|
313
337
|
return this.source.dispatchEvent(new CustomEvent(type, Object.assign(Object.assign({ detail }, defaultEventOptions), options)));
|
|
314
338
|
}
|
|
315
339
|
return false;
|
|
316
340
|
}
|
|
317
|
-
finishInitialization() {
|
|
318
|
-
const element = this.source;
|
|
319
|
-
const boundObservables = this.boundObservables;
|
|
320
|
-
// If we have any observables that were bound, re-apply their values.
|
|
321
|
-
if (boundObservables !== null) {
|
|
322
|
-
const propertyNames = Object.keys(boundObservables);
|
|
323
|
-
for (let i = 0, ii = propertyNames.length; i < ii; ++i) {
|
|
324
|
-
const propertyName = propertyNames[i];
|
|
325
|
-
element[propertyName] = boundObservables[propertyName];
|
|
326
|
-
}
|
|
327
|
-
this.boundObservables = null;
|
|
328
|
-
}
|
|
329
|
-
this.renderTemplate(this.template);
|
|
330
|
-
this.addStyles(this.mainStyles);
|
|
331
|
-
this.needsInitialization = false;
|
|
332
|
-
}
|
|
333
341
|
renderTemplate(template) {
|
|
334
342
|
var _a;
|
|
335
343
|
// When getting the host to render to, we start by looking
|
|
@@ -373,9 +381,19 @@ export class ElementController extends PropertyChangeNotifier {
|
|
|
373
381
|
if (definition === void 0) {
|
|
374
382
|
throw FAST.error(1401 /* Message.missingElementDefinition */);
|
|
375
383
|
}
|
|
376
|
-
return (element.$fastController = new
|
|
384
|
+
return (element.$fastController = new elementControllerStrategy(element, definition));
|
|
385
|
+
}
|
|
386
|
+
/**
|
|
387
|
+
* Sets the strategy that ElementController.forCustomElement uses to construct
|
|
388
|
+
* ElementController instances for an element.
|
|
389
|
+
* @param strategy - The strategy to use.
|
|
390
|
+
*/
|
|
391
|
+
static setStrategy(strategy) {
|
|
392
|
+
elementControllerStrategy = strategy;
|
|
377
393
|
}
|
|
378
394
|
}
|
|
395
|
+
// Set default strategy for ElementController
|
|
396
|
+
ElementController.setStrategy(ElementController);
|
|
379
397
|
/**
|
|
380
398
|
* Converts a styleTarget into the operative target. When the provided target is an Element
|
|
381
399
|
* that is a FASTElement, the function will return the ShadowRoot for that element. Otherwise,
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
import { UnobservableMutationObserver } from "../utilities.js";
|
|
2
|
+
import { ElementController } from "./element-controller.js";
|
|
3
|
+
const deferHydrationAttribute = "defer-hydration";
|
|
4
|
+
/**
|
|
5
|
+
* An ElementController capable of hydrating FAST elements from
|
|
6
|
+
* Declarative Shadow DOM.
|
|
7
|
+
*
|
|
8
|
+
* @beta
|
|
9
|
+
*/
|
|
10
|
+
export class HydratableElementController extends ElementController {
|
|
11
|
+
static hydrationObserverHandler(records) {
|
|
12
|
+
for (const record of records) {
|
|
13
|
+
HydratableElementController.hydrationObserver.unobserve(record.target);
|
|
14
|
+
record.target.$fastController.connect();
|
|
15
|
+
}
|
|
16
|
+
}
|
|
17
|
+
connect() {
|
|
18
|
+
if (this.source.hasAttribute(deferHydrationAttribute)) {
|
|
19
|
+
HydratableElementController.hydrationObserver.observe(this.source, {
|
|
20
|
+
attributeFilter: [deferHydrationAttribute],
|
|
21
|
+
});
|
|
22
|
+
}
|
|
23
|
+
else {
|
|
24
|
+
super.connect();
|
|
25
|
+
}
|
|
26
|
+
}
|
|
27
|
+
disconnect() {
|
|
28
|
+
super.disconnect();
|
|
29
|
+
HydratableElementController.hydrationObserver.unobserve(this.source);
|
|
30
|
+
}
|
|
31
|
+
static install() {
|
|
32
|
+
ElementController.setStrategy(HydratableElementController);
|
|
33
|
+
}
|
|
34
|
+
}
|
|
35
|
+
HydratableElementController.hydrationObserver = new UnobservableMutationObserver(HydratableElementController.hydrationObserverHandler);
|
package/dist/esm/index.js
CHANGED
|
@@ -27,4 +27,4 @@ export * from "./templating/node-observation.js";
|
|
|
27
27
|
export * from "./components/fast-element.js";
|
|
28
28
|
export * from "./components/fast-definitions.js";
|
|
29
29
|
export * from "./components/attributes.js";
|
|
30
|
-
export { ElementController } from "./components/element-controller.js";
|
|
30
|
+
export { ElementController, } from "./components/element-controller.js";
|
package/dist/esm/utilities.js
CHANGED
|
@@ -42,3 +42,30 @@ export function composedContains(reference, test) {
|
|
|
42
42
|
}
|
|
43
43
|
return false;
|
|
44
44
|
}
|
|
45
|
+
/**
|
|
46
|
+
* @internal
|
|
47
|
+
*/
|
|
48
|
+
export class UnobservableMutationObserver extends MutationObserver {
|
|
49
|
+
/**
|
|
50
|
+
* An extension of MutationObserver that supports unobserving nodes.
|
|
51
|
+
* @param callback - The callback to invoke when observed nodes are changed.
|
|
52
|
+
*/
|
|
53
|
+
constructor(callback) {
|
|
54
|
+
function handler(mutations) {
|
|
55
|
+
this.callback.call(null, mutations.filter(record => this.observedNodes.has(record.target)));
|
|
56
|
+
}
|
|
57
|
+
super(handler);
|
|
58
|
+
this.callback = callback;
|
|
59
|
+
this.observedNodes = new Set();
|
|
60
|
+
}
|
|
61
|
+
observe(target, options) {
|
|
62
|
+
this.observedNodes.add(target);
|
|
63
|
+
super.observe(target, options);
|
|
64
|
+
}
|
|
65
|
+
unobserve(target) {
|
|
66
|
+
this.observedNodes.delete(target);
|
|
67
|
+
if (this.observedNodes.size < 1) {
|
|
68
|
+
this.disconnect();
|
|
69
|
+
}
|
|
70
|
+
}
|
|
71
|
+
}
|
|
@@ -4267,6 +4267,53 @@
|
|
|
4267
4267
|
],
|
|
4268
4268
|
"name": "removeStyles"
|
|
4269
4269
|
},
|
|
4270
|
+
{
|
|
4271
|
+
"kind": "Method",
|
|
4272
|
+
"canonicalReference": "@microsoft/fast-element!ElementController.setStrategy:member(1)",
|
|
4273
|
+
"docComment": "/**\n * Sets the strategy that ElementController.forCustomElement uses to construct ElementController instances for an element.\n *\n * @param strategy - The strategy to use.\n */\n",
|
|
4274
|
+
"excerptTokens": [
|
|
4275
|
+
{
|
|
4276
|
+
"kind": "Content",
|
|
4277
|
+
"text": "static setStrategy(strategy: "
|
|
4278
|
+
},
|
|
4279
|
+
{
|
|
4280
|
+
"kind": "Reference",
|
|
4281
|
+
"text": "ElementControllerStrategy",
|
|
4282
|
+
"canonicalReference": "@microsoft/fast-element!ElementControllerStrategy:interface"
|
|
4283
|
+
},
|
|
4284
|
+
{
|
|
4285
|
+
"kind": "Content",
|
|
4286
|
+
"text": "): "
|
|
4287
|
+
},
|
|
4288
|
+
{
|
|
4289
|
+
"kind": "Content",
|
|
4290
|
+
"text": "void"
|
|
4291
|
+
},
|
|
4292
|
+
{
|
|
4293
|
+
"kind": "Content",
|
|
4294
|
+
"text": ";"
|
|
4295
|
+
}
|
|
4296
|
+
],
|
|
4297
|
+
"isOptional": false,
|
|
4298
|
+
"isStatic": true,
|
|
4299
|
+
"returnTypeTokenRange": {
|
|
4300
|
+
"startIndex": 3,
|
|
4301
|
+
"endIndex": 4
|
|
4302
|
+
},
|
|
4303
|
+
"releaseTag": "Public",
|
|
4304
|
+
"overloadIndex": 1,
|
|
4305
|
+
"parameters": [
|
|
4306
|
+
{
|
|
4307
|
+
"parameterName": "strategy",
|
|
4308
|
+
"parameterTypeTokenRange": {
|
|
4309
|
+
"startIndex": 1,
|
|
4310
|
+
"endIndex": 2
|
|
4311
|
+
},
|
|
4312
|
+
"isOptional": false
|
|
4313
|
+
}
|
|
4314
|
+
],
|
|
4315
|
+
"name": "setStrategy"
|
|
4316
|
+
},
|
|
4270
4317
|
{
|
|
4271
4318
|
"kind": "Property",
|
|
4272
4319
|
"canonicalReference": "@microsoft/fast-element!ElementController#source:member",
|
|
@@ -4383,6 +4430,84 @@
|
|
|
4383
4430
|
}
|
|
4384
4431
|
]
|
|
4385
4432
|
},
|
|
4433
|
+
{
|
|
4434
|
+
"kind": "Interface",
|
|
4435
|
+
"canonicalReference": "@microsoft/fast-element!ElementControllerStrategy:interface",
|
|
4436
|
+
"docComment": "/**\n * A type that instantiates an ElementController\n *\n * @public\n */\n",
|
|
4437
|
+
"excerptTokens": [
|
|
4438
|
+
{
|
|
4439
|
+
"kind": "Content",
|
|
4440
|
+
"text": "export interface ElementControllerStrategy "
|
|
4441
|
+
}
|
|
4442
|
+
],
|
|
4443
|
+
"releaseTag": "Public",
|
|
4444
|
+
"name": "ElementControllerStrategy",
|
|
4445
|
+
"members": [
|
|
4446
|
+
{
|
|
4447
|
+
"kind": "ConstructSignature",
|
|
4448
|
+
"canonicalReference": "@microsoft/fast-element!ElementControllerStrategy:new(1)",
|
|
4449
|
+
"docComment": "",
|
|
4450
|
+
"excerptTokens": [
|
|
4451
|
+
{
|
|
4452
|
+
"kind": "Content",
|
|
4453
|
+
"text": "new (element: "
|
|
4454
|
+
},
|
|
4455
|
+
{
|
|
4456
|
+
"kind": "Reference",
|
|
4457
|
+
"text": "HTMLElement",
|
|
4458
|
+
"canonicalReference": "!HTMLElement:interface"
|
|
4459
|
+
},
|
|
4460
|
+
{
|
|
4461
|
+
"kind": "Content",
|
|
4462
|
+
"text": ", definition: "
|
|
4463
|
+
},
|
|
4464
|
+
{
|
|
4465
|
+
"kind": "Reference",
|
|
4466
|
+
"text": "FASTElementDefinition",
|
|
4467
|
+
"canonicalReference": "@microsoft/fast-element!FASTElementDefinition:class"
|
|
4468
|
+
},
|
|
4469
|
+
{
|
|
4470
|
+
"kind": "Content",
|
|
4471
|
+
"text": "): "
|
|
4472
|
+
},
|
|
4473
|
+
{
|
|
4474
|
+
"kind": "Reference",
|
|
4475
|
+
"text": "ElementController",
|
|
4476
|
+
"canonicalReference": "@microsoft/fast-element!ElementController:class"
|
|
4477
|
+
},
|
|
4478
|
+
{
|
|
4479
|
+
"kind": "Content",
|
|
4480
|
+
"text": ";"
|
|
4481
|
+
}
|
|
4482
|
+
],
|
|
4483
|
+
"returnTypeTokenRange": {
|
|
4484
|
+
"startIndex": 5,
|
|
4485
|
+
"endIndex": 6
|
|
4486
|
+
},
|
|
4487
|
+
"releaseTag": "Public",
|
|
4488
|
+
"overloadIndex": 1,
|
|
4489
|
+
"parameters": [
|
|
4490
|
+
{
|
|
4491
|
+
"parameterName": "element",
|
|
4492
|
+
"parameterTypeTokenRange": {
|
|
4493
|
+
"startIndex": 1,
|
|
4494
|
+
"endIndex": 2
|
|
4495
|
+
},
|
|
4496
|
+
"isOptional": false
|
|
4497
|
+
},
|
|
4498
|
+
{
|
|
4499
|
+
"parameterName": "definition",
|
|
4500
|
+
"parameterTypeTokenRange": {
|
|
4501
|
+
"startIndex": 3,
|
|
4502
|
+
"endIndex": 4
|
|
4503
|
+
},
|
|
4504
|
+
"isOptional": false
|
|
4505
|
+
}
|
|
4506
|
+
]
|
|
4507
|
+
}
|
|
4508
|
+
],
|
|
4509
|
+
"extendsTokenRanges": []
|
|
4510
|
+
},
|
|
4386
4511
|
{
|
|
4387
4512
|
"kind": "Variable",
|
|
4388
4513
|
"canonicalReference": "@microsoft/fast-element!elements:var",
|
package/dist/fast-element.d.ts
CHANGED
|
@@ -663,7 +663,13 @@ export declare class ElementController<TElement extends HTMLElement = HTMLElemen
|
|
|
663
663
|
private needsInitialization;
|
|
664
664
|
private hasExistingShadowRoot;
|
|
665
665
|
private _template;
|
|
666
|
-
private
|
|
666
|
+
private stage;
|
|
667
|
+
/**
|
|
668
|
+
* A guard against connecting behaviors multiple times
|
|
669
|
+
* during connect in scenarios where a behavior adds
|
|
670
|
+
* another behavior during it's connectedCallback
|
|
671
|
+
*/
|
|
672
|
+
private guardBehaviorConnection;
|
|
667
673
|
private behaviors;
|
|
668
674
|
private _mainStyles;
|
|
669
675
|
/**
|
|
@@ -695,7 +701,6 @@ export declare class ElementController<TElement extends HTMLElement = HTMLElemen
|
|
|
695
701
|
* connected to the document.
|
|
696
702
|
*/
|
|
697
703
|
get isConnected(): boolean;
|
|
698
|
-
private setIsConnected;
|
|
699
704
|
/**
|
|
700
705
|
* Gets/sets the template used to render the component.
|
|
701
706
|
* @remarks
|
|
@@ -755,7 +760,6 @@ export declare class ElementController<TElement extends HTMLElement = HTMLElemen
|
|
|
755
760
|
* Only emits events if connected.
|
|
756
761
|
*/
|
|
757
762
|
emit(type: string, detail?: any, options?: Omit<CustomEventInit, "detail">): void | boolean;
|
|
758
|
-
private finishInitialization;
|
|
759
763
|
private renderTemplate;
|
|
760
764
|
/**
|
|
761
765
|
* Locates or creates a controller for the specified element.
|
|
@@ -766,6 +770,20 @@ export declare class ElementController<TElement extends HTMLElement = HTMLElemen
|
|
|
766
770
|
* decorator or a call to `FASTElement.define`.
|
|
767
771
|
*/
|
|
768
772
|
static forCustomElement(element: HTMLElement): ElementController;
|
|
773
|
+
/**
|
|
774
|
+
* Sets the strategy that ElementController.forCustomElement uses to construct
|
|
775
|
+
* ElementController instances for an element.
|
|
776
|
+
* @param strategy - The strategy to use.
|
|
777
|
+
*/
|
|
778
|
+
static setStrategy(strategy: ElementControllerStrategy): void;
|
|
779
|
+
}
|
|
780
|
+
|
|
781
|
+
/**
|
|
782
|
+
* A type that instantiates an ElementController
|
|
783
|
+
* @public
|
|
784
|
+
*/
|
|
785
|
+
export declare interface ElementControllerStrategy {
|
|
786
|
+
new (element: HTMLElement, definition: FASTElementDefinition): ElementController;
|
|
769
787
|
}
|
|
770
788
|
|
|
771
789
|
/**
|