@microsoft/fast-element 2.0.0-beta.10 → 2.0.0-beta.12
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 +38 -0
- package/CHANGELOG.md +17 -1
- package/dist/dts/components/element-controller.d.ts +26 -1
- package/dist/dts/index.d.ts +1 -1
- package/dist/dts/interfaces.d.ts +2 -3
- package/dist/dts/platform.d.ts +1 -0
- package/dist/dts/polyfills.d.ts +1 -8
- package/dist/dts/styles/element-styles.d.ts +1 -14
- package/dist/dts/templating/repeat.d.ts +3 -1
- package/dist/esm/components/element-controller.js +95 -6
- package/dist/esm/index.js +1 -1
- package/dist/esm/platform.js +1 -0
- package/dist/esm/polyfills.js +1 -55
- package/dist/esm/styles/element-styles.js +0 -33
- package/dist/esm/templating/repeat.js +5 -4
- package/dist/fast-element.api.json +25 -2
- package/dist/fast-element.d.ts +2 -4
- package/dist/fast-element.debug.js +102 -99
- package/dist/fast-element.debug.min.js +1 -1
- package/dist/fast-element.js +102 -99
- package/dist/fast-element.min.js +1 -1
- package/dist/fast-element.untrimmed.d.ts +3 -16
- package/docs/api-report.md +3 -14
- package/package.json +3 -7
package/CHANGELOG.json
CHANGED
|
@@ -1,6 +1,44 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@microsoft/fast-element",
|
|
3
3
|
"entries": [
|
|
4
|
+
{
|
|
5
|
+
"date": "Thu, 06 Oct 2022 23:21:20 GMT",
|
|
6
|
+
"tag": "@microsoft/fast-element_v2.0.0-beta.12",
|
|
7
|
+
"version": "2.0.0-beta.12",
|
|
8
|
+
"comments": {
|
|
9
|
+
"none": [
|
|
10
|
+
{
|
|
11
|
+
"author": "863023+radium-v@users.noreply.github.com",
|
|
12
|
+
"package": "@microsoft/fast-element",
|
|
13
|
+
"commit": "c06e32d72d518bf5c3152efe4e666f233190b445",
|
|
14
|
+
"comment": "upgrade karma to ^6.4.1"
|
|
15
|
+
}
|
|
16
|
+
],
|
|
17
|
+
"prerelease": [
|
|
18
|
+
{
|
|
19
|
+
"author": "roeisenb@microsoft.com",
|
|
20
|
+
"package": "@microsoft/fast-element",
|
|
21
|
+
"commit": "a69c2e3c0700918fef5ba934909781cc8ab71384",
|
|
22
|
+
"comment": "fix: repeat update view context positioning"
|
|
23
|
+
}
|
|
24
|
+
]
|
|
25
|
+
}
|
|
26
|
+
},
|
|
27
|
+
{
|
|
28
|
+
"date": "Wed, 05 Oct 2022 23:26:01 GMT",
|
|
29
|
+
"tag": "@microsoft/fast-element_v2.0.0-beta.11",
|
|
30
|
+
"version": "2.0.0-beta.11",
|
|
31
|
+
"comments": {
|
|
32
|
+
"prerelease": [
|
|
33
|
+
{
|
|
34
|
+
"author": "nicholasrice@users.noreply.github.com",
|
|
35
|
+
"package": "@microsoft/fast-element",
|
|
36
|
+
"commit": "21d1de94be2b9399ddc43a2b93c6483fa7304591",
|
|
37
|
+
"comment": "fix: removed a shadowRoot leak from ElementController"
|
|
38
|
+
}
|
|
39
|
+
]
|
|
40
|
+
}
|
|
41
|
+
},
|
|
4
42
|
{
|
|
5
43
|
"date": "Mon, 03 Oct 2022 23:44:38 GMT",
|
|
6
44
|
"tag": "@microsoft/fast-element_v2.0.0-beta.10",
|
package/CHANGELOG.md
CHANGED
|
@@ -1,9 +1,25 @@
|
|
|
1
1
|
# Change Log - @microsoft/fast-element
|
|
2
2
|
|
|
3
|
-
This log was last generated on
|
|
3
|
+
This log was last generated on Thu, 06 Oct 2022 23:21:20 GMT and should not be manually modified.
|
|
4
4
|
|
|
5
5
|
<!-- Start content -->
|
|
6
6
|
|
|
7
|
+
## 2.0.0-beta.12
|
|
8
|
+
|
|
9
|
+
Thu, 06 Oct 2022 23:21:20 GMT
|
|
10
|
+
|
|
11
|
+
### Changes
|
|
12
|
+
|
|
13
|
+
- fix: repeat update view context positioning (roeisenb@microsoft.com)
|
|
14
|
+
|
|
15
|
+
## 2.0.0-beta.11
|
|
16
|
+
|
|
17
|
+
Wed, 05 Oct 2022 23:26:01 GMT
|
|
18
|
+
|
|
19
|
+
### Changes
|
|
20
|
+
|
|
21
|
+
- fix: removed a shadowRoot leak from ElementController (nicholasrice@users.noreply.github.com)
|
|
22
|
+
|
|
7
23
|
## 2.0.0-beta.10
|
|
8
24
|
|
|
9
25
|
Mon, 03 Oct 2022 23:44:38 GMT
|
|
@@ -1,8 +1,9 @@
|
|
|
1
|
+
import { StyleStrategy, StyleTarget } from "../interfaces.js";
|
|
1
2
|
import type { HostBehavior, HostController } from "../styles/host.js";
|
|
2
3
|
import { PropertyChangeNotifier } from "../observation/notifier.js";
|
|
3
4
|
import type { ElementViewTemplate } from "../templating/template.js";
|
|
4
5
|
import type { ElementView } from "../templating/view.js";
|
|
5
|
-
import
|
|
6
|
+
import { ElementStyles } from "../styles/element-styles.js";
|
|
6
7
|
import { FASTElementDefinition } from "./fast-definitions.js";
|
|
7
8
|
/**
|
|
8
9
|
* Controls the lifecycle and rendering of a `FASTElement`.
|
|
@@ -124,3 +125,27 @@ export declare class ElementController<TElement extends HTMLElement = HTMLElemen
|
|
|
124
125
|
*/
|
|
125
126
|
static forCustomElement(element: HTMLElement): ElementController;
|
|
126
127
|
}
|
|
128
|
+
/**
|
|
129
|
+
* https://wicg.github.io/construct-stylesheets/
|
|
130
|
+
* https://developers.google.com/web/updates/2019/02/constructable-stylesheets
|
|
131
|
+
*
|
|
132
|
+
* @internal
|
|
133
|
+
*/
|
|
134
|
+
export declare class AdoptedStyleSheetsStrategy implements StyleStrategy {
|
|
135
|
+
private static styleSheetCache;
|
|
136
|
+
/** @internal */
|
|
137
|
+
readonly sheets: CSSStyleSheet[];
|
|
138
|
+
constructor(styles: (string | CSSStyleSheet)[]);
|
|
139
|
+
addStylesTo(target: StyleTarget): void;
|
|
140
|
+
removeStylesFrom(target: StyleTarget): void;
|
|
141
|
+
}
|
|
142
|
+
/**
|
|
143
|
+
* @internal
|
|
144
|
+
*/
|
|
145
|
+
export declare class StyleElementStrategy implements StyleStrategy {
|
|
146
|
+
private readonly styles;
|
|
147
|
+
private readonly styleClass;
|
|
148
|
+
constructor(styles: string[]);
|
|
149
|
+
addStylesTo(target: StyleTarget): void;
|
|
150
|
+
removeStylesFrom(target: StyleTarget): void;
|
|
151
|
+
}
|
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
|
|
27
|
+
export { ElementController } from "./components/element-controller.js";
|
package/dist/dts/interfaces.d.ts
CHANGED
|
@@ -112,14 +112,13 @@ export declare const enum KernelServiceId {
|
|
|
112
112
|
updateQueue = 1,
|
|
113
113
|
observable = 2,
|
|
114
114
|
contextEvent = 3,
|
|
115
|
-
elementRegistry = 4
|
|
116
|
-
styleSheetStrategy = 5
|
|
115
|
+
elementRegistry = 4
|
|
117
116
|
}
|
|
118
117
|
/**
|
|
119
118
|
* A node that can be targeted by styles.
|
|
120
119
|
* @public
|
|
121
120
|
*/
|
|
122
|
-
export interface StyleTarget {
|
|
121
|
+
export interface StyleTarget extends Pick<Node, "getRootNode"> {
|
|
123
122
|
/**
|
|
124
123
|
* Stylesheets to be adopted by the node.
|
|
125
124
|
*/
|
package/dist/dts/platform.d.ts
CHANGED
package/dist/dts/polyfills.d.ts
CHANGED
|
@@ -1,8 +1 @@
|
|
|
1
|
-
|
|
2
|
-
export declare class StyleElementStrategy implements StyleStrategy {
|
|
3
|
-
private readonly styles;
|
|
4
|
-
private readonly styleClass;
|
|
5
|
-
constructor(styles: string[]);
|
|
6
|
-
addStylesTo(target: StyleTarget): void;
|
|
7
|
-
removeStylesFrom(target: StyleTarget): void;
|
|
8
|
-
}
|
|
1
|
+
export {};
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { StyleStrategy, StyleTarget } from "../interfaces.js";
|
|
1
|
+
import type { StyleStrategy, StyleTarget } from "../interfaces.js";
|
|
2
2
|
import type { HostBehavior } from "./host.js";
|
|
3
3
|
/**
|
|
4
4
|
* Represents styles that can be composed into the ShadowDOM of a custom element.
|
|
@@ -69,16 +69,3 @@ export declare class ElementStyles {
|
|
|
69
69
|
*/
|
|
70
70
|
static readonly supportsAdoptedStyleSheets: boolean;
|
|
71
71
|
}
|
|
72
|
-
/**
|
|
73
|
-
* https://wicg.github.io/construct-stylesheets/
|
|
74
|
-
* https://developers.google.com/web/updates/2019/02/constructable-stylesheets
|
|
75
|
-
*
|
|
76
|
-
* @internal
|
|
77
|
-
*/
|
|
78
|
-
export declare class AdoptedStyleSheetsStrategy implements StyleStrategy {
|
|
79
|
-
/** @internal */
|
|
80
|
-
readonly sheets: CSSStyleSheet[];
|
|
81
|
-
constructor(styles: (string | CSSStyleSheet)[]);
|
|
82
|
-
addStylesTo(target: StyleTarget): void;
|
|
83
|
-
removeStylesFrom(target: StyleTarget): void;
|
|
84
|
-
}
|
|
@@ -3,6 +3,7 @@ import { Expression, ExpressionObserver } from "../observation/observable.js";
|
|
|
3
3
|
import { Splice } from "../observation/arrays.js";
|
|
4
4
|
import { AddViewBehaviorFactory, Binding, HTMLDirective, ViewBehavior, ViewBehaviorFactory, ViewController } from "./html-directive.js";
|
|
5
5
|
import type { CaptureType, SyntheticViewTemplate, ViewTemplate } from "./template.js";
|
|
6
|
+
import { SyntheticView } from "./view.js";
|
|
6
7
|
/**
|
|
7
8
|
* Options for configuring repeat behavior.
|
|
8
9
|
* @public
|
|
@@ -25,13 +26,14 @@ export declare class RepeatBehavior<TSource = any> implements ViewBehavior, Subs
|
|
|
25
26
|
private directive;
|
|
26
27
|
private location;
|
|
27
28
|
private controller;
|
|
28
|
-
private views;
|
|
29
29
|
private template;
|
|
30
30
|
private templateBindingObserver;
|
|
31
31
|
private items;
|
|
32
32
|
private itemsObserver;
|
|
33
33
|
private itemsBindingObserver;
|
|
34
34
|
private bindView;
|
|
35
|
+
/** @internal */
|
|
36
|
+
views: SyntheticView[];
|
|
35
37
|
/**
|
|
36
38
|
* Creates an instance of RepeatBehavior.
|
|
37
39
|
* @param location - The location in the DOM to render the repeat.
|
|
@@ -2,6 +2,7 @@ import "../interfaces.js";
|
|
|
2
2
|
import { PropertyChangeNotifier } from "../observation/notifier.js";
|
|
3
3
|
import { Observable, SourceLifetime } from "../observation/observable.js";
|
|
4
4
|
import { FAST } from "../platform.js";
|
|
5
|
+
import { ElementStyles } from "../styles/element-styles.js";
|
|
5
6
|
import { FASTElementDefinition } from "./fast-definitions.js";
|
|
6
7
|
const defaultEventOptions = {
|
|
7
8
|
bubbles: true,
|
|
@@ -210,13 +211,13 @@ export class ElementController extends PropertyChangeNotifier {
|
|
|
210
211
|
return;
|
|
211
212
|
}
|
|
212
213
|
const source = this.source;
|
|
213
|
-
const target = (_a = getShadowRoot(source)) !== null && _a !== void 0 ? _a : source.getRootNode();
|
|
214
214
|
if (styles instanceof HTMLElement) {
|
|
215
|
+
const target = (_a = getShadowRoot(source)) !== null && _a !== void 0 ? _a : this.source;
|
|
215
216
|
target.append(styles);
|
|
216
217
|
}
|
|
217
|
-
else if (!styles.isAttachedTo(
|
|
218
|
+
else if (!styles.isAttachedTo(source)) {
|
|
218
219
|
const sourceBehaviors = styles.behaviors;
|
|
219
|
-
styles.addStylesTo(
|
|
220
|
+
styles.addStylesTo(source);
|
|
220
221
|
if (sourceBehaviors !== null) {
|
|
221
222
|
for (let i = 0, ii = sourceBehaviors.length; i < ii; ++i) {
|
|
222
223
|
this.addBehavior(sourceBehaviors[i]);
|
|
@@ -234,13 +235,13 @@ export class ElementController extends PropertyChangeNotifier {
|
|
|
234
235
|
return;
|
|
235
236
|
}
|
|
236
237
|
const source = this.source;
|
|
237
|
-
const target = (_a = getShadowRoot(source)) !== null && _a !== void 0 ? _a : source.getRootNode();
|
|
238
238
|
if (styles instanceof HTMLElement) {
|
|
239
|
+
const target = (_a = getShadowRoot(source)) !== null && _a !== void 0 ? _a : source;
|
|
239
240
|
target.removeChild(styles);
|
|
240
241
|
}
|
|
241
|
-
else if (styles.isAttachedTo(
|
|
242
|
+
else if (styles.isAttachedTo(source)) {
|
|
242
243
|
const sourceBehaviors = styles.behaviors;
|
|
243
|
-
styles.removeStylesFrom(
|
|
244
|
+
styles.removeStylesFrom(source);
|
|
244
245
|
if (sourceBehaviors !== null) {
|
|
245
246
|
for (let i = 0, ii = sourceBehaviors.length; i < ii; ++i) {
|
|
246
247
|
this.addBehavior(sourceBehaviors[i]);
|
|
@@ -375,3 +376,91 @@ export class ElementController extends PropertyChangeNotifier {
|
|
|
375
376
|
return (element.$fastController = new ElementController(element, definition));
|
|
376
377
|
}
|
|
377
378
|
}
|
|
379
|
+
/**
|
|
380
|
+
* Converts a styleTarget into the operative target. When the provided target is an Element
|
|
381
|
+
* that is a FASTElement, the function will return the ShadowRoot for that element. Otherwise,
|
|
382
|
+
* it will return the root node for the element.
|
|
383
|
+
* @param target
|
|
384
|
+
* @returns
|
|
385
|
+
*/
|
|
386
|
+
function normalizeStyleTarget(target) {
|
|
387
|
+
var _a;
|
|
388
|
+
if ("adoptedStyleSheets" in target) {
|
|
389
|
+
return target;
|
|
390
|
+
}
|
|
391
|
+
else {
|
|
392
|
+
return ((_a = getShadowRoot(target)) !== null && _a !== void 0 ? _a : target.getRootNode());
|
|
393
|
+
}
|
|
394
|
+
}
|
|
395
|
+
// Default StyleStrategy implementations are defined in this module because they
|
|
396
|
+
// require access to element shadowRoots, and we don't want to leak shadowRoot
|
|
397
|
+
// objects out of this module.
|
|
398
|
+
/**
|
|
399
|
+
* https://wicg.github.io/construct-stylesheets/
|
|
400
|
+
* https://developers.google.com/web/updates/2019/02/constructable-stylesheets
|
|
401
|
+
*
|
|
402
|
+
* @internal
|
|
403
|
+
*/
|
|
404
|
+
export class AdoptedStyleSheetsStrategy {
|
|
405
|
+
constructor(styles) {
|
|
406
|
+
const styleSheetCache = AdoptedStyleSheetsStrategy.styleSheetCache;
|
|
407
|
+
this.sheets = styles.map((x) => {
|
|
408
|
+
if (x instanceof CSSStyleSheet) {
|
|
409
|
+
return x;
|
|
410
|
+
}
|
|
411
|
+
let sheet = styleSheetCache.get(x);
|
|
412
|
+
if (sheet === void 0) {
|
|
413
|
+
sheet = new CSSStyleSheet();
|
|
414
|
+
sheet.replaceSync(x);
|
|
415
|
+
styleSheetCache.set(x, sheet);
|
|
416
|
+
}
|
|
417
|
+
return sheet;
|
|
418
|
+
});
|
|
419
|
+
}
|
|
420
|
+
addStylesTo(target) {
|
|
421
|
+
const t = normalizeStyleTarget(target);
|
|
422
|
+
t.adoptedStyleSheets = [...t.adoptedStyleSheets, ...this.sheets];
|
|
423
|
+
}
|
|
424
|
+
removeStylesFrom(target) {
|
|
425
|
+
const t = normalizeStyleTarget(target);
|
|
426
|
+
const sheets = this.sheets;
|
|
427
|
+
t.adoptedStyleSheets = t.adoptedStyleSheets.filter((x) => sheets.indexOf(x) === -1);
|
|
428
|
+
}
|
|
429
|
+
}
|
|
430
|
+
AdoptedStyleSheetsStrategy.styleSheetCache = new Map();
|
|
431
|
+
let id = 0;
|
|
432
|
+
const nextStyleId = () => `fast-${++id}`;
|
|
433
|
+
function usableStyleTarget(target) {
|
|
434
|
+
return target === document ? document.body : target;
|
|
435
|
+
}
|
|
436
|
+
/**
|
|
437
|
+
* @internal
|
|
438
|
+
*/
|
|
439
|
+
export class StyleElementStrategy {
|
|
440
|
+
constructor(styles) {
|
|
441
|
+
this.styles = styles;
|
|
442
|
+
this.styleClass = nextStyleId();
|
|
443
|
+
}
|
|
444
|
+
addStylesTo(target) {
|
|
445
|
+
target = usableStyleTarget(normalizeStyleTarget(target));
|
|
446
|
+
const styles = this.styles;
|
|
447
|
+
const styleClass = this.styleClass;
|
|
448
|
+
for (let i = 0; i < styles.length; i++) {
|
|
449
|
+
const element = document.createElement("style");
|
|
450
|
+
element.innerHTML = styles[i];
|
|
451
|
+
element.className = styleClass;
|
|
452
|
+
target.append(element);
|
|
453
|
+
}
|
|
454
|
+
}
|
|
455
|
+
removeStylesFrom(target) {
|
|
456
|
+
target = usableStyleTarget(normalizeStyleTarget(target));
|
|
457
|
+
const styles = target.querySelectorAll(`.${this.styleClass}`);
|
|
458
|
+
styles[0].parentNode;
|
|
459
|
+
for (let i = 0, ii = styles.length; i < ii; ++i) {
|
|
460
|
+
target.removeChild(styles[i]);
|
|
461
|
+
}
|
|
462
|
+
}
|
|
463
|
+
}
|
|
464
|
+
ElementStyles.setDefaultStrategy(ElementStyles.supportsAdoptedStyleSheets
|
|
465
|
+
? AdoptedStyleSheetsStrategy
|
|
466
|
+
: StyleElementStrategy);
|
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
|
|
30
|
+
export { ElementController } from "./components/element-controller.js";
|
package/dist/esm/platform.js
CHANGED
package/dist/esm/polyfills.js
CHANGED
|
@@ -28,58 +28,4 @@ if (!globalThis.trustedTypes) {
|
|
|
28
28
|
createPolicy: (n, r) => r,
|
|
29
29
|
};
|
|
30
30
|
}
|
|
31
|
-
|
|
32
|
-
const propConfig = {
|
|
33
|
-
configurable: false,
|
|
34
|
-
enumerable: false,
|
|
35
|
-
writable: false,
|
|
36
|
-
};
|
|
37
|
-
if (globalThis.FAST === void 0) {
|
|
38
|
-
Reflect.defineProperty(globalThis, "FAST", Object.assign({ value: Object.create(null) }, propConfig));
|
|
39
|
-
}
|
|
40
|
-
const FAST = globalThis.FAST;
|
|
41
|
-
if (FAST.getById === void 0) {
|
|
42
|
-
const storage = Object.create(null);
|
|
43
|
-
Reflect.defineProperty(FAST, "getById", Object.assign({ value(id, initialize) {
|
|
44
|
-
let found = storage[id];
|
|
45
|
-
if (found === void 0) {
|
|
46
|
-
found = initialize ? (storage[id] = initialize()) : null;
|
|
47
|
-
}
|
|
48
|
-
return found;
|
|
49
|
-
} }, propConfig));
|
|
50
|
-
}
|
|
51
|
-
// duplicated from DOM
|
|
52
|
-
const supportsAdoptedStyleSheets = Array.isArray(document.adoptedStyleSheets) &&
|
|
53
|
-
"replace" in CSSStyleSheet.prototype;
|
|
54
|
-
function usableStyleTarget(target) {
|
|
55
|
-
return target === document ? document.body : target;
|
|
56
|
-
}
|
|
57
|
-
let id = 0;
|
|
58
|
-
const nextStyleId = () => `fast-${++id}`;
|
|
59
|
-
export class StyleElementStrategy {
|
|
60
|
-
constructor(styles) {
|
|
61
|
-
this.styles = styles;
|
|
62
|
-
this.styleClass = nextStyleId();
|
|
63
|
-
}
|
|
64
|
-
addStylesTo(target) {
|
|
65
|
-
target = usableStyleTarget(target);
|
|
66
|
-
const styles = this.styles;
|
|
67
|
-
const styleClass = this.styleClass;
|
|
68
|
-
for (let i = 0; i < styles.length; i++) {
|
|
69
|
-
const element = document.createElement("style");
|
|
70
|
-
element.innerHTML = styles[i];
|
|
71
|
-
element.className = styleClass;
|
|
72
|
-
target.append(element);
|
|
73
|
-
}
|
|
74
|
-
}
|
|
75
|
-
removeStylesFrom(target) {
|
|
76
|
-
const styles = target.querySelectorAll(`.${this.styleClass}`);
|
|
77
|
-
target = usableStyleTarget(target);
|
|
78
|
-
for (let i = 0, ii = styles.length; i < ii; ++i) {
|
|
79
|
-
target.removeChild(styles[i]);
|
|
80
|
-
}
|
|
81
|
-
}
|
|
82
|
-
}
|
|
83
|
-
if (!supportsAdoptedStyleSheets) {
|
|
84
|
-
FAST.getById(/* KernelServiceId.styleSheetStrategy */ 5, () => StyleElementStrategy);
|
|
85
|
-
}
|
|
31
|
+
export {};
|
|
@@ -1,6 +1,3 @@
|
|
|
1
|
-
import { FAST } from "../platform.js";
|
|
2
|
-
import "../interfaces.js";
|
|
3
|
-
const styleSheetCache = new Map();
|
|
4
1
|
let DefaultStyleStrategy;
|
|
5
2
|
function reduceStyles(styles) {
|
|
6
3
|
return styles
|
|
@@ -91,33 +88,3 @@ export class ElementStyles {
|
|
|
91
88
|
*/
|
|
92
89
|
ElementStyles.supportsAdoptedStyleSheets = Array.isArray(document.adoptedStyleSheets) &&
|
|
93
90
|
"replace" in CSSStyleSheet.prototype;
|
|
94
|
-
/**
|
|
95
|
-
* https://wicg.github.io/construct-stylesheets/
|
|
96
|
-
* https://developers.google.com/web/updates/2019/02/constructable-stylesheets
|
|
97
|
-
*
|
|
98
|
-
* @internal
|
|
99
|
-
*/
|
|
100
|
-
export class AdoptedStyleSheetsStrategy {
|
|
101
|
-
constructor(styles) {
|
|
102
|
-
this.sheets = styles.map((x) => {
|
|
103
|
-
if (x instanceof CSSStyleSheet) {
|
|
104
|
-
return x;
|
|
105
|
-
}
|
|
106
|
-
let sheet = styleSheetCache.get(x);
|
|
107
|
-
if (sheet === void 0) {
|
|
108
|
-
sheet = new CSSStyleSheet();
|
|
109
|
-
sheet.replaceSync(x);
|
|
110
|
-
styleSheetCache.set(x, sheet);
|
|
111
|
-
}
|
|
112
|
-
return sheet;
|
|
113
|
-
});
|
|
114
|
-
}
|
|
115
|
-
addStylesTo(target) {
|
|
116
|
-
target.adoptedStyleSheets = [...target.adoptedStyleSheets, ...this.sheets];
|
|
117
|
-
}
|
|
118
|
-
removeStylesFrom(target) {
|
|
119
|
-
const sheets = this.sheets;
|
|
120
|
-
target.adoptedStyleSheets = target.adoptedStyleSheets.filter((x) => sheets.indexOf(x) === -1);
|
|
121
|
-
}
|
|
122
|
-
}
|
|
123
|
-
ElementStyles.setDefaultStrategy(FAST.getById(5 /* KernelServiceId.styleSheetStrategy */, () => AdoptedStyleSheetsStrategy));
|
|
@@ -37,10 +37,11 @@ export class RepeatBehavior {
|
|
|
37
37
|
*/
|
|
38
38
|
constructor(directive) {
|
|
39
39
|
this.directive = directive;
|
|
40
|
-
this.views = [];
|
|
41
40
|
this.items = null;
|
|
42
41
|
this.itemsObserver = null;
|
|
43
42
|
this.bindView = bindWithoutPositioning;
|
|
43
|
+
/** @internal */
|
|
44
|
+
this.views = [];
|
|
44
45
|
this.itemsBindingObserver = directive.dataBinding.createObserver(directive, this);
|
|
45
46
|
this.templateBindingObserver = directive.templateBinding.createObserver(directive, this);
|
|
46
47
|
if (directive.options.positioning) {
|
|
@@ -158,10 +159,10 @@ export class RepeatBehavior {
|
|
|
158
159
|
leftoverViews[i].dispose();
|
|
159
160
|
}
|
|
160
161
|
if (this.directive.options.positioning) {
|
|
161
|
-
for (let i = 0,
|
|
162
|
+
for (let i = 0, viewsLength = views.length; i < viewsLength; ++i) {
|
|
162
163
|
const context = views[i].context;
|
|
163
|
-
context.length =
|
|
164
|
-
context.index =
|
|
164
|
+
context.length = viewsLength;
|
|
165
|
+
context.index = i;
|
|
165
166
|
}
|
|
166
167
|
}
|
|
167
168
|
}
|
|
@@ -15154,7 +15154,25 @@
|
|
|
15154
15154
|
"excerptTokens": [
|
|
15155
15155
|
{
|
|
15156
15156
|
"kind": "Content",
|
|
15157
|
-
"text": "export interface StyleTarget "
|
|
15157
|
+
"text": "export interface StyleTarget extends "
|
|
15158
|
+
},
|
|
15159
|
+
{
|
|
15160
|
+
"kind": "Reference",
|
|
15161
|
+
"text": "Pick",
|
|
15162
|
+
"canonicalReference": "!Pick:type"
|
|
15163
|
+
},
|
|
15164
|
+
{
|
|
15165
|
+
"kind": "Content",
|
|
15166
|
+
"text": "<"
|
|
15167
|
+
},
|
|
15168
|
+
{
|
|
15169
|
+
"kind": "Reference",
|
|
15170
|
+
"text": "Node",
|
|
15171
|
+
"canonicalReference": "!Node:interface"
|
|
15172
|
+
},
|
|
15173
|
+
{
|
|
15174
|
+
"kind": "Content",
|
|
15175
|
+
"text": ", \"getRootNode\"> "
|
|
15158
15176
|
}
|
|
15159
15177
|
],
|
|
15160
15178
|
"releaseTag": "Public",
|
|
@@ -15369,7 +15387,12 @@
|
|
|
15369
15387
|
"name": "removeChild"
|
|
15370
15388
|
}
|
|
15371
15389
|
],
|
|
15372
|
-
"extendsTokenRanges": [
|
|
15390
|
+
"extendsTokenRanges": [
|
|
15391
|
+
{
|
|
15392
|
+
"startIndex": 1,
|
|
15393
|
+
"endIndex": 4
|
|
15394
|
+
}
|
|
15395
|
+
]
|
|
15373
15396
|
},
|
|
15374
15397
|
{
|
|
15375
15398
|
"kind": "Interface",
|
package/dist/fast-element.d.ts
CHANGED
|
@@ -32,8 +32,6 @@ export declare type AddBehavior = (behavior: HostBehavior<HTMLElement>) => void;
|
|
|
32
32
|
*/
|
|
33
33
|
export declare type AddViewBehaviorFactory = (factory: ViewBehaviorFactory) => string;
|
|
34
34
|
|
|
35
|
-
/* Excluded from this release type: AdoptedStyleSheetsStrategy */
|
|
36
|
-
|
|
37
35
|
/**
|
|
38
36
|
* An observer for arrays.
|
|
39
37
|
* @public
|
|
@@ -1927,13 +1925,13 @@ export declare class RepeatBehavior<TSource = any> implements ViewBehavior, Subs
|
|
|
1927
1925
|
private directive;
|
|
1928
1926
|
private location;
|
|
1929
1927
|
private controller;
|
|
1930
|
-
private views;
|
|
1931
1928
|
private template;
|
|
1932
1929
|
private templateBindingObserver;
|
|
1933
1930
|
private items;
|
|
1934
1931
|
private itemsObserver;
|
|
1935
1932
|
private itemsBindingObserver;
|
|
1936
1933
|
private bindView;
|
|
1934
|
+
/* Excluded from this release type: views */
|
|
1937
1935
|
/**
|
|
1938
1936
|
* Creates an instance of RepeatBehavior.
|
|
1939
1937
|
* @param location - The location in the DOM to render the repeat.
|
|
@@ -2300,7 +2298,7 @@ export declare interface StyleStrategy {
|
|
|
2300
2298
|
* A node that can be targeted by styles.
|
|
2301
2299
|
* @public
|
|
2302
2300
|
*/
|
|
2303
|
-
export declare interface StyleTarget {
|
|
2301
|
+
export declare interface StyleTarget extends Pick<Node, "getRootNode"> {
|
|
2304
2302
|
/**
|
|
2305
2303
|
* Stylesheets to be adopted by the node.
|
|
2306
2304
|
*/
|