@stencil/core 2.10.0 → 2.12.1
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/cli/index.cjs +25 -4
- package/cli/index.js +25 -4
- package/cli/package.json +1 -1
- package/compiler/package.json +1 -1
- package/compiler/stencil.js +527 -715
- package/compiler/stencil.min.js +2 -2
- package/dependencies.json +1 -1
- package/dev-server/client/index.js +1 -1
- package/dev-server/client/package.json +1 -1
- package/dev-server/connector.html +2 -2
- package/dev-server/index.js +1 -1
- package/dev-server/package.json +1 -1
- package/dev-server/server-process.js +2 -2
- package/internal/app-data/package.json +1 -1
- package/internal/client/css-shim.js +1 -1
- package/internal/client/dom.js +1 -1
- package/internal/client/index.js +11 -7
- package/internal/client/package.json +1 -1
- package/internal/client/patch-browser.js +1 -1
- package/internal/client/patch-esm.js +1 -1
- package/internal/client/shadow-css.js +9 -10
- package/internal/hydrate/index.js +2 -1
- package/internal/hydrate/package.json +1 -1
- package/internal/hydrate/shadow-css.js +59 -62
- package/internal/package.json +1 -1
- package/internal/stencil-public-compiler.d.ts +1 -1
- package/internal/stencil-public-runtime.d.ts +6 -4
- package/internal/testing/index.js +15 -13
- package/internal/testing/package.json +1 -1
- package/internal/testing/shadow-css.js +54 -57
- package/mock-doc/index.cjs +5 -2
- package/mock-doc/index.js +5 -2
- package/mock-doc/package.json +1 -1
- package/package.json +12 -7
- package/readme.md +52 -85
- package/screenshot/package.json +1 -1
- package/sys/node/autoprefixer.js +2 -2
- package/sys/node/index.js +14 -13
- package/sys/node/package.json +1 -1
- package/sys/node/worker.js +1 -1
- package/testing/index.js +79 -71
- package/testing/jest/jest-environment.d.ts +1 -0
- package/testing/jest/jest-preprocessor.d.ts +56 -8
- package/testing/jest-preset.js +5 -0
- package/testing/package.json +1 -1
|
@@ -1,10 +1,10 @@
|
|
|
1
|
-
const _parenSuffix = ")(?:\\(((?:\\([^)(]*\\)|[^)(]*)+?)\\))?([^,{]*)", _cssColonHostRe = new RegExp("(-shadowcsshost" + _parenSuffix, "gim"), _cssColonHostContextRe = new RegExp("(-shadowcsscontext" + _parenSuffix, "gim"), _cssColonSlottedRe = new RegExp("(-shadowcssslotted" + _parenSuffix, "gim"), _polyfillHostNoCombinatorRe = /-shadowcsshost-no-combinator([^\s]*)/, _shadowDOMSelectorsRe = [ /::shadow/g, /::content/g ], _polyfillHostRe = /-shadowcsshost/gim, _colonHostRe = /:host/gim, _colonSlottedRe = /::slotted/gim, _colonHostContextRe = /:host-context/gim, _commentRe = /\/\*\s*[\s\S]*?\*\//g, _commentWithHashRe = /\/\*\s*#\s*source(Mapping)?URL=[\s\S]+?\*\//g, _ruleRe = /(\s*)([^;\{\}]+?)(\s*)((?:{%BLOCK%}?\s*;?)|(?:\s*;))/g, _curlyRe = /([{}])/g, processRules = (e, t) => {
|
|
2
|
-
const
|
|
3
|
-
let
|
|
4
|
-
return
|
|
1
|
+
const _parenSuffix = ")(?:\\(((?:\\([^)(]*\\)|[^)(]*)+?)\\))?([^,{]*)", _cssColonHostRe = new RegExp("(-shadowcsshost" + _parenSuffix, "gim"), _cssColonHostContextRe = new RegExp("(-shadowcsscontext" + _parenSuffix, "gim"), _cssColonSlottedRe = new RegExp("(-shadowcssslotted" + _parenSuffix, "gim"), _polyfillHostNoCombinatorRe = /-shadowcsshost-no-combinator([^\s]*)/, _shadowDOMSelectorsRe = [ /::shadow/g, /::content/g ], _polyfillHostRe = /-shadowcsshost/gim, _colonHostRe = /:host/gim, _colonSlottedRe = /::slotted/gim, _colonHostContextRe = /:host-context/gim, _commentRe = /\/\*\s*[\s\S]*?\*\//g, _commentWithHashRe = /\/\*\s*#\s*source(Mapping)?URL=[\s\S]+?\*\//g, _ruleRe = /(\s*)([^;\{\}]+?)(\s*)((?:{%BLOCK%}?\s*;?)|(?:\s*;))/g, _curlyRe = /([{}])/g, _selectorPartsRe = /(^.*?[^\\])??((:+)(.*)|$)/, processRules = (e, t) => {
|
|
2
|
+
const o = escapeBlocks(e);
|
|
3
|
+
let s = 0;
|
|
4
|
+
return o.escapedString.replace(_ruleRe, ((...e) => {
|
|
5
5
|
const c = e[2];
|
|
6
6
|
let r = "", n = e[4], l = "";
|
|
7
|
-
n && n.startsWith("{%BLOCK%") && (r =
|
|
7
|
+
n && n.startsWith("{%BLOCK%") && (r = o.blocks[s++], n = n.substring("%BLOCK%".length + 1),
|
|
8
8
|
l = "{");
|
|
9
9
|
const a = t({
|
|
10
10
|
selector: c,
|
|
@@ -13,111 +13,108 @@ const _parenSuffix = ")(?:\\(((?:\\([^)(]*\\)|[^)(]*)+?)\\))?([^,{]*)", _cssColo
|
|
|
13
13
|
return `${e[1]}${a.selector}${e[3]}${l}${a.content}${n}`;
|
|
14
14
|
}));
|
|
15
15
|
}, escapeBlocks = e => {
|
|
16
|
-
const t = e.split(_curlyRe),
|
|
16
|
+
const t = e.split(_curlyRe), o = [], s = [];
|
|
17
17
|
let c = 0, r = [];
|
|
18
18
|
for (let e = 0; e < t.length; e++) {
|
|
19
19
|
const n = t[e];
|
|
20
|
-
"}" === n && c--, c > 0 ? r.push(n) : (r.length > 0 && (
|
|
21
|
-
r = []),
|
|
20
|
+
"}" === n && c--, c > 0 ? r.push(n) : (r.length > 0 && (s.push(r.join("")), o.push("%BLOCK%"),
|
|
21
|
+
r = []), o.push(n)), "{" === n && c++;
|
|
22
22
|
}
|
|
23
|
-
return r.length > 0 && (
|
|
24
|
-
escapedString:
|
|
25
|
-
blocks:
|
|
23
|
+
return r.length > 0 && (s.push(r.join("")), o.push("%BLOCK%")), {
|
|
24
|
+
escapedString: o.join(""),
|
|
25
|
+
blocks: s
|
|
26
26
|
};
|
|
27
|
-
}, convertColonRule = (e, t,
|
|
27
|
+
}, convertColonRule = (e, t, o) => e.replace(t, ((...e) => {
|
|
28
28
|
if (e[2]) {
|
|
29
|
-
const t = e[2].split(","),
|
|
29
|
+
const t = e[2].split(","), s = [];
|
|
30
30
|
for (let c = 0; c < t.length; c++) {
|
|
31
31
|
const r = t[c].trim();
|
|
32
32
|
if (!r) break;
|
|
33
|
-
|
|
33
|
+
s.push(o("-shadowcsshost-no-combinator", r, e[3]));
|
|
34
34
|
}
|
|
35
|
-
return
|
|
35
|
+
return s.join(",");
|
|
36
36
|
}
|
|
37
37
|
return "-shadowcsshost-no-combinator" + e[3];
|
|
38
|
-
})), colonHostPartReplacer = (e, t,
|
|
38
|
+
})), colonHostPartReplacer = (e, t, o) => e + t.replace("-shadowcsshost", "") + o, colonHostContextPartReplacer = (e, t, o) => t.indexOf("-shadowcsshost") > -1 ? colonHostPartReplacer(e, t, o) : e + t + o + ", " + t + " " + e + o, injectScopingSelector = (e, t) => e.replace(_selectorPartsRe, ((e, o = "", s, c = "", r = "") => o + t + c + r)), scopeSelectors = (e, t, o, s, c) => processRules(e, (e => {
|
|
39
39
|
let c = e.selector, r = e.content;
|
|
40
|
-
return "@" !== e.selector[0] ? c = ((e, t,
|
|
41
|
-
new RegExp("^(" + e + ")([>\\s~+[.,{:][\\s\\S]*)?$", "m")))(t).test(e))(e, t) ? ((e, t,
|
|
42
|
-
const
|
|
40
|
+
return "@" !== e.selector[0] ? c = ((e, t, o, s) => e.split(",").map((e => s && e.indexOf("." + s) > -1 ? e.trim() : ((e, t) => !(e => (e = e.replace(/\[/g, "\\[").replace(/\]/g, "\\]"),
|
|
41
|
+
new RegExp("^(" + e + ")([>\\s~+[.,{:][\\s\\S]*)?$", "m")))(t).test(e))(e, t) ? ((e, t, o) => {
|
|
42
|
+
const s = "." + (t = t.replace(/\[is=([^\]]*)\]/g, ((e, ...t) => t[0]))), c = e => {
|
|
43
43
|
let c = e.trim();
|
|
44
44
|
if (!c) return "";
|
|
45
|
-
if (e.indexOf("-shadowcsshost-no-combinator") > -1) c = ((e, t,
|
|
45
|
+
if (e.indexOf("-shadowcsshost-no-combinator") > -1) c = ((e, t, o) => {
|
|
46
46
|
if (_polyfillHostRe.lastIndex = 0, _polyfillHostRe.test(e)) {
|
|
47
|
-
const t = `.${
|
|
48
|
-
return e.replace(_polyfillHostNoCombinatorRe, ((e,
|
|
47
|
+
const t = `.${o}`;
|
|
48
|
+
return e.replace(_polyfillHostNoCombinatorRe, ((e, o) => injectScopingSelector(o, t))).replace(_polyfillHostRe, t + " ");
|
|
49
49
|
}
|
|
50
50
|
return t + " " + e;
|
|
51
|
-
})(e, t,
|
|
51
|
+
})(e, t, o); else {
|
|
52
52
|
const t = e.replace(_polyfillHostRe, "");
|
|
53
|
-
|
|
54
|
-
const e = t.match(/([^:]*)(:*)(.*)/);
|
|
55
|
-
e && (c = e[1] + o + e[2] + e[3]);
|
|
56
|
-
}
|
|
53
|
+
t.length > 0 && (c = injectScopingSelector(t, s));
|
|
57
54
|
}
|
|
58
55
|
return c;
|
|
59
56
|
}, r = (e => {
|
|
60
57
|
const t = [];
|
|
61
|
-
let
|
|
62
|
-
return
|
|
63
|
-
const c = `__ph-${
|
|
64
|
-
return t.push(
|
|
65
|
-
}))).replace(/(:nth-[-\w]+)(\([^)]+\))/g, ((e,
|
|
66
|
-
const r = `__ph-${
|
|
67
|
-
return t.push(c),
|
|
58
|
+
let o, s = 0;
|
|
59
|
+
return o = (e = e.replace(/(\[[^\]]*\])/g, ((e, o) => {
|
|
60
|
+
const c = `__ph-${s}__`;
|
|
61
|
+
return t.push(o), s++, c;
|
|
62
|
+
}))).replace(/(:nth-[-\w]+)(\([^)]+\))/g, ((e, o, c) => {
|
|
63
|
+
const r = `__ph-${s}__`;
|
|
64
|
+
return t.push(c), s++, o + r;
|
|
68
65
|
})), {
|
|
69
|
-
content:
|
|
66
|
+
content: o,
|
|
70
67
|
placeholders: t
|
|
71
68
|
};
|
|
72
69
|
})(e);
|
|
73
70
|
let n, l = "", a = 0;
|
|
74
|
-
const
|
|
75
|
-
let
|
|
76
|
-
for (;null !== (n =
|
|
77
|
-
const t = n[1],
|
|
78
|
-
|
|
79
|
-
a =
|
|
71
|
+
const i = /( |>|\+|~(?!=))\s*/g;
|
|
72
|
+
let p = !((e = r.content).indexOf("-shadowcsshost-no-combinator") > -1);
|
|
73
|
+
for (;null !== (n = i.exec(e)); ) {
|
|
74
|
+
const t = n[1], o = e.slice(a, n.index).trim();
|
|
75
|
+
p = p || o.indexOf("-shadowcsshost-no-combinator") > -1, l += `${p ? c(o) : o} ${t} `,
|
|
76
|
+
a = i.lastIndex;
|
|
80
77
|
}
|
|
81
78
|
const h = e.substring(a);
|
|
82
|
-
return
|
|
79
|
+
return p = p || h.indexOf("-shadowcsshost-no-combinator") > -1, l += p ? c(h) : h,
|
|
83
80
|
u = r.placeholders, l.replace(/__ph-(\d+)__/g, ((e, t) => u[+t]));
|
|
84
81
|
var u;
|
|
85
|
-
})(e, t,
|
|
82
|
+
})(e, t, o).trim() : e.trim())).join(", "))(e.selector, t, o, s) : (e.selector.startsWith("@media") || e.selector.startsWith("@supports") || e.selector.startsWith("@page") || e.selector.startsWith("@document")) && (r = scopeSelectors(e.content, t, o, s)),
|
|
86
83
|
{
|
|
87
84
|
selector: c.replace(/\s{2,}/g, " ").trim(),
|
|
88
85
|
content: r
|
|
89
86
|
};
|
|
90
|
-
})), scopeCss = (e, t,
|
|
91
|
-
const
|
|
87
|
+
})), scopeCss = (e, t, o) => {
|
|
88
|
+
const s = t + "-h", c = t + "-s", r = e.match(_commentWithHashRe) || [];
|
|
92
89
|
e = e.replace(_commentRe, "");
|
|
93
90
|
const n = [];
|
|
94
|
-
if (
|
|
91
|
+
if (o) {
|
|
95
92
|
const t = e => {
|
|
96
|
-
const t = `/*!@___${n.length}___*/`,
|
|
93
|
+
const t = `/*!@___${n.length}___*/`, o = `/*!@${e.selector}*/`;
|
|
97
94
|
return n.push({
|
|
98
95
|
placeholder: t,
|
|
99
|
-
comment:
|
|
96
|
+
comment: o
|
|
100
97
|
}), e.selector = t + e.selector, e;
|
|
101
98
|
};
|
|
102
99
|
e = processRules(e, (e => "@" !== e.selector[0] ? t(e) : e.selector.startsWith("@media") || e.selector.startsWith("@supports") || e.selector.startsWith("@page") || e.selector.startsWith("@document") ? (e.content = processRules(e.content, t),
|
|
103
100
|
e) : e));
|
|
104
101
|
}
|
|
105
|
-
const l = ((e, t,
|
|
102
|
+
const l = ((e, t, o, s, c) => {
|
|
106
103
|
const r = ((e, t) => {
|
|
107
|
-
const
|
|
104
|
+
const o = "." + t + " > ", s = [];
|
|
108
105
|
return e = e.replace(_cssColonSlottedRe, ((...e) => {
|
|
109
106
|
if (e[2]) {
|
|
110
|
-
const t = e[2].trim(), c = e[3], r =
|
|
107
|
+
const t = e[2].trim(), c = e[3], r = o + t + c;
|
|
111
108
|
let n = "";
|
|
112
109
|
for (let t = e[4] - 1; t >= 0; t--) {
|
|
113
|
-
const
|
|
114
|
-
if ("}" ===
|
|
115
|
-
n =
|
|
110
|
+
const o = e[5][t];
|
|
111
|
+
if ("}" === o || "," === o) break;
|
|
112
|
+
n = o + n;
|
|
116
113
|
}
|
|
117
114
|
const l = n + r, a = `${n.trimRight()}${r.trim()}`;
|
|
118
115
|
if (l.trim() !== a.trim()) {
|
|
119
116
|
const e = `${a}, ${l}`;
|
|
120
|
-
|
|
117
|
+
s.push({
|
|
121
118
|
orgSelector: l,
|
|
122
119
|
updatedSelector: e
|
|
123
120
|
});
|
|
@@ -126,18 +123,18 @@ const _parenSuffix = ")(?:\\(((?:\\([^)(]*\\)|[^)(]*)+?)\\))?([^,{]*)", _cssColo
|
|
|
126
123
|
}
|
|
127
124
|
return "-shadowcsshost-no-combinator" + e[3];
|
|
128
125
|
})), {
|
|
129
|
-
selectors:
|
|
126
|
+
selectors: s,
|
|
130
127
|
cssText: e
|
|
131
128
|
};
|
|
132
|
-
})(e = (e => convertColonRule(e, _cssColonHostContextRe, colonHostContextPartReplacer))(e = (e => convertColonRule(e, _cssColonHostRe, colonHostPartReplacer))(e = e.replace(_colonHostContextRe, "-shadowcsscontext").replace(_colonHostRe, "-shadowcsshost").replace(_colonSlottedRe, "-shadowcssslotted"))),
|
|
129
|
+
})(e = (e => convertColonRule(e, _cssColonHostContextRe, colonHostContextPartReplacer))(e = (e => convertColonRule(e, _cssColonHostRe, colonHostPartReplacer))(e = e.replace(_colonHostContextRe, "-shadowcsscontext").replace(_colonHostRe, "-shadowcsshost").replace(_colonSlottedRe, "-shadowcssslotted"))), s);
|
|
133
130
|
return e = (e => _shadowDOMSelectorsRe.reduce(((e, t) => e.replace(t, " ")), e))(e = r.cssText),
|
|
134
|
-
t && (e = scopeSelectors(e, t,
|
|
135
|
-
cssText: (e = (e = e.replace(/-shadowcsshost-no-combinator/g, `.${
|
|
131
|
+
t && (e = scopeSelectors(e, t, o, s)), {
|
|
132
|
+
cssText: (e = (e = e.replace(/-shadowcsshost-no-combinator/g, `.${o}`)).replace(/>\s*\*\s+([^{, ]+)/gm, " $1 ")).trim(),
|
|
136
133
|
slottedSelectors: r.selectors
|
|
137
134
|
};
|
|
138
|
-
})(e, t,
|
|
139
|
-
return e = [ l.cssText, ...r ].join("\n"),
|
|
140
|
-
e = e.replace(t,
|
|
135
|
+
})(e, t, s, c);
|
|
136
|
+
return e = [ l.cssText, ...r ].join("\n"), o && n.forEach((({placeholder: t, comment: o}) => {
|
|
137
|
+
e = e.replace(t, o);
|
|
141
138
|
})), l.slottedSelectors.forEach((t => {
|
|
142
139
|
e = e.replace(t.orgSelector, t.updatedSelector);
|
|
143
140
|
})), e;
|
package/internal/package.json
CHANGED
|
@@ -43,7 +43,7 @@ export interface StencilConfig {
|
|
|
43
43
|
* However, it's still common to have styles which should be "global" across all components and the website.
|
|
44
44
|
* A global CSS file is often useful to set CSS Variables.
|
|
45
45
|
*
|
|
46
|
-
* Additonally, the globalStyle config
|
|
46
|
+
* Additonally, the globalStyle config can be used to precompile styles with Sass, PostCss, etc.
|
|
47
47
|
* Below is an example folder structure containing a webapp's global sass file, named app.css.
|
|
48
48
|
*/
|
|
49
49
|
globalStyle?: string;
|
|
@@ -666,7 +666,7 @@ export declare namespace JSXBase {
|
|
|
666
666
|
use: JSXBase.SVGAttributes;
|
|
667
667
|
view: JSXBase.SVGAttributes;
|
|
668
668
|
}
|
|
669
|
-
interface SlotAttributes {
|
|
669
|
+
interface SlotAttributes extends JSXAttributes {
|
|
670
670
|
name?: string;
|
|
671
671
|
slot?: string;
|
|
672
672
|
onSlotchange?: (event: Event) => void;
|
|
@@ -1427,9 +1427,7 @@ export declare namespace JSXBase {
|
|
|
1427
1427
|
z?: number | string;
|
|
1428
1428
|
zoomAndPan?: string;
|
|
1429
1429
|
}
|
|
1430
|
-
interface DOMAttributes<T
|
|
1431
|
-
key?: string | number;
|
|
1432
|
-
ref?: (elm?: T) => void;
|
|
1430
|
+
interface DOMAttributes<T> extends JSXAttributes<T> {
|
|
1433
1431
|
slot?: string;
|
|
1434
1432
|
part?: string;
|
|
1435
1433
|
exportparts?: string;
|
|
@@ -1550,6 +1548,10 @@ export declare namespace JSXBase {
|
|
|
1550
1548
|
onTransitionEndCapture?: (event: TransitionEvent) => void;
|
|
1551
1549
|
}
|
|
1552
1550
|
}
|
|
1551
|
+
export interface JSXAttributes<T = Element> {
|
|
1552
|
+
key?: string | number;
|
|
1553
|
+
ref?: (elm?: T) => void;
|
|
1554
|
+
}
|
|
1553
1555
|
export interface CustomElementsDefineOptions {
|
|
1554
1556
|
exclude?: string[];
|
|
1555
1557
|
resourcesUrl?: string;
|
|
@@ -228,8 +228,10 @@ const createTime = (e, t = "") => {
|
|
|
228
228
|
return t.$attrs$ = e.vattrs, t.$children$ = e.vchildren, t.$key$ = e.vkey, t.$name$ = e.vname,
|
|
229
229
|
t;
|
|
230
230
|
}, validateInputProperties = e => {
|
|
231
|
-
const t = Object.keys(e), a = t.indexOf("
|
|
232
|
-
-1
|
|
231
|
+
const t = Object.keys(e), a = t.indexOf("value");
|
|
232
|
+
if (-1 === a) return;
|
|
233
|
+
const o = t.indexOf("type"), s = t.indexOf("min"), n = t.indexOf("max"), l = t.indexOf("step");
|
|
234
|
+
(a < o || a < s || a < n || a < l) && consoleDevWarn('The "value" prop of <input> should be set after "min", "max", "type" and "step"');
|
|
233
235
|
}, setAccessor = (e, t, a, o, s, n) => {
|
|
234
236
|
if (a !== o) {
|
|
235
237
|
let l = isMemberInElement(e, t), r = t.toLowerCase();
|
|
@@ -303,20 +305,20 @@ const createElm = (e, t, a, o) => {
|
|
|
303
305
|
appData.BUILD.vdomText && null !== l ? appData.BUILD.vdomText && appData.BUILD.slotRelocation && (r = a["s-cr"]) ? r.parentNode.textContent = l : appData.BUILD.vdomText && e.$text$ !== l && (a.data = l) : (appData.BUILD.svg && (isSvgMode = "svg" === n || "foreignObject" !== n && isSvgMode),
|
|
304
306
|
(appData.BUILD.vdomAttribute || appData.BUILD.reflect) && (appData.BUILD.slot && "slot" === n || updateElement(e, t, isSvgMode)),
|
|
305
307
|
appData.BUILD.updatable && null !== o && null !== s ? ((e, t, a, o) => {
|
|
306
|
-
let s, n, l = 0, r = 0, p = 0, i = 0, d = t.length - 1, c = t[0], $ = t[d],
|
|
307
|
-
for (;l <= d && r <=
|
|
308
|
-
c = t[++l],
|
|
309
|
-
patch(c, h), e.insertBefore(c.$elm$, $.$elm$.nextSibling), c = t[++l], h = o[--
|
|
310
|
-
patch($,
|
|
311
|
-
if (p = -1, appData.BUILD.vdomKey) for (i = l; i <= d; ++i) if (t[i] && null !== t[i].$key$ && t[i].$key$ ===
|
|
308
|
+
let s, n, l = 0, r = 0, p = 0, i = 0, d = t.length - 1, c = t[0], $ = t[d], u = o.length - 1, m = o[0], h = o[u];
|
|
309
|
+
for (;l <= d && r <= u; ) if (null == c) c = t[++l]; else if (null == $) $ = t[--d]; else if (null == m) m = o[++r]; else if (null == h) h = o[--u]; else if (isSameVnode(c, m)) patch(c, m),
|
|
310
|
+
c = t[++l], m = o[++r]; else if (isSameVnode($, h)) patch($, h), $ = t[--d], h = o[--u]; else if (isSameVnode(c, h)) !appData.BUILD.slotRelocation || "slot" !== c.$tag$ && "slot" !== h.$tag$ || putBackInOriginalLocation(c.$elm$.parentNode, !1),
|
|
311
|
+
patch(c, h), e.insertBefore(c.$elm$, $.$elm$.nextSibling), c = t[++l], h = o[--u]; else if (isSameVnode($, m)) !appData.BUILD.slotRelocation || "slot" !== c.$tag$ && "slot" !== h.$tag$ || putBackInOriginalLocation($.$elm$.parentNode, !1),
|
|
312
|
+
patch($, m), e.insertBefore($.$elm$, c.$elm$), $ = t[--d], m = o[++r]; else {
|
|
313
|
+
if (p = -1, appData.BUILD.vdomKey) for (i = l; i <= d; ++i) if (t[i] && null !== t[i].$key$ && t[i].$key$ === m.$key$) {
|
|
312
314
|
p = i;
|
|
313
315
|
break;
|
|
314
316
|
}
|
|
315
|
-
appData.BUILD.vdomKey && p >= 0 ? (n = t[p], n.$tag$ !==
|
|
316
|
-
t[p] = void 0, s = n.$elm$),
|
|
317
|
+
appData.BUILD.vdomKey && p >= 0 ? (n = t[p], n.$tag$ !== m.$tag$ ? s = createElm(t && t[r], a, p, e) : (patch(n, m),
|
|
318
|
+
t[p] = void 0, s = n.$elm$), m = o[++r]) : (s = createElm(t && t[r], a, r, e), m = o[++r]),
|
|
317
319
|
s && (appData.BUILD.slotRelocation ? parentReferenceNode(c.$elm$).insertBefore(s, referenceNode(c.$elm$)) : c.$elm$.parentNode.insertBefore(s, c.$elm$));
|
|
318
320
|
}
|
|
319
|
-
l > d ? addVnodes(e, null == o[
|
|
321
|
+
l > d ? addVnodes(e, null == o[u + 1] ? null : o[u + 1].$elm$, a, o, r, u) : appData.BUILD.updatable && r > u && removeVnodes(t, l, d);
|
|
320
322
|
})(a, o, t, s) : null !== s ? (appData.BUILD.updatable && appData.BUILD.vdomText && null !== e.$text$ && (a.textContent = ""),
|
|
321
323
|
addVnodes(a, null, t, s, 0, s.length - 1)) : appData.BUILD.updatable && null !== o && removeVnodes(o, 0, o.length - 1),
|
|
322
324
|
appData.BUILD.svg && isSvgMode && "svg" === n && (isSvgMode = !1));
|
|
@@ -923,10 +925,10 @@ exports.addHostEventListeners = addHostEventListeners, exports.bootstrapLazy = (
|
|
|
923
925
|
}
|
|
924
926
|
})();
|
|
925
927
|
const a = createTime("bootstrapLazy"), o = [], s = t.exclude || [], n = win.customElements, l = doc.head, r = l.querySelector("meta[charset]"), p = doc.createElement("style"), i = [], d = doc.querySelectorAll("[sty-id]");
|
|
926
|
-
let c, $ = !0,
|
|
928
|
+
let c, $ = !0, u = 0;
|
|
927
929
|
if (Object.assign(plt, t), plt.$resourcesUrl$ = new URL(t.resourcesUrl || "./", doc.baseURI).href,
|
|
928
930
|
appData.BUILD.asyncQueue && t.syncQueue && (plt.$flags$ |= 4), appData.BUILD.hydrateClientSide && (plt.$flags$ |= 2),
|
|
929
|
-
appData.BUILD.hydrateClientSide && appData.BUILD.shadowDom) for (;
|
|
931
|
+
appData.BUILD.hydrateClientSide && appData.BUILD.shadowDom) for (;u < d.length; u++) registerStyle(d[u].getAttribute("sty-id"), d[u].innerHTML.replace(/\/\*!@([^\/]+)\*\/[^\{]+\{/g, "$1{"));
|
|
930
932
|
e.map((e => {
|
|
931
933
|
e[1].map((a => {
|
|
932
934
|
const l = {
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@stencil/core/internal/testing",
|
|
3
|
-
"version": "2.
|
|
3
|
+
"version": "2.12.1",
|
|
4
4
|
"description": "Stencil internal testing platform to be imported by the Stencil Compiler. Breaking changes can and will happen at any time.",
|
|
5
5
|
"main": "./index.js",
|
|
6
6
|
"private": true
|
|
@@ -1,10 +1,10 @@
|
|
|
1
|
-
const _parenSuffix = ")(?:\\(((?:\\([^)(]*\\)|[^)(]*)+?)\\))?([^,{]*)", _cssColonHostRe = new RegExp("(-shadowcsshost" + _parenSuffix, "gim"), _cssColonHostContextRe = new RegExp("(-shadowcsscontext" + _parenSuffix, "gim"), _cssColonSlottedRe = new RegExp("(-shadowcssslotted" + _parenSuffix, "gim"), _polyfillHostNoCombinatorRe = /-shadowcsshost-no-combinator([^\s]*)/, _shadowDOMSelectorsRe = [ /::shadow/g, /::content/g ], _polyfillHostRe = /-shadowcsshost/gim, _colonHostRe = /:host/gim, _colonSlottedRe = /::slotted/gim, _colonHostContextRe = /:host-context/gim, _commentRe = /\/\*\s*[\s\S]*?\*\//g, _commentWithHashRe = /\/\*\s*#\s*source(Mapping)?URL=[\s\S]+?\*\//g, _ruleRe = /(\s*)([^;\{\}]+?)(\s*)((?:{%BLOCK%}?\s*;?)|(?:\s*;))/g, _curlyRe = /([{}])/g, processRules = (e, t) => {
|
|
2
|
-
const
|
|
3
|
-
let
|
|
4
|
-
return
|
|
1
|
+
const _parenSuffix = ")(?:\\(((?:\\([^)(]*\\)|[^)(]*)+?)\\))?([^,{]*)", _cssColonHostRe = new RegExp("(-shadowcsshost" + _parenSuffix, "gim"), _cssColonHostContextRe = new RegExp("(-shadowcsscontext" + _parenSuffix, "gim"), _cssColonSlottedRe = new RegExp("(-shadowcssslotted" + _parenSuffix, "gim"), _polyfillHostNoCombinatorRe = /-shadowcsshost-no-combinator([^\s]*)/, _shadowDOMSelectorsRe = [ /::shadow/g, /::content/g ], _polyfillHostRe = /-shadowcsshost/gim, _colonHostRe = /:host/gim, _colonSlottedRe = /::slotted/gim, _colonHostContextRe = /:host-context/gim, _commentRe = /\/\*\s*[\s\S]*?\*\//g, _commentWithHashRe = /\/\*\s*#\s*source(Mapping)?URL=[\s\S]+?\*\//g, _ruleRe = /(\s*)([^;\{\}]+?)(\s*)((?:{%BLOCK%}?\s*;?)|(?:\s*;))/g, _curlyRe = /([{}])/g, _selectorPartsRe = /(^.*?[^\\])??((:+)(.*)|$)/, processRules = (e, t) => {
|
|
2
|
+
const o = escapeBlocks(e);
|
|
3
|
+
let s = 0;
|
|
4
|
+
return o.escapedString.replace(_ruleRe, ((...e) => {
|
|
5
5
|
const c = e[2];
|
|
6
6
|
let r = "", n = e[4], l = "";
|
|
7
|
-
n && n.startsWith("{%BLOCK%") && (r =
|
|
7
|
+
n && n.startsWith("{%BLOCK%") && (r = o.blocks[s++], n = n.substring("%BLOCK%".length + 1),
|
|
8
8
|
l = "{");
|
|
9
9
|
const a = t({
|
|
10
10
|
selector: c,
|
|
@@ -13,60 +13,57 @@ const _parenSuffix = ")(?:\\(((?:\\([^)(]*\\)|[^)(]*)+?)\\))?([^,{]*)", _cssColo
|
|
|
13
13
|
return `${e[1]}${a.selector}${e[3]}${l}${a.content}${n}`;
|
|
14
14
|
}));
|
|
15
15
|
}, escapeBlocks = e => {
|
|
16
|
-
const t = e.split(_curlyRe),
|
|
16
|
+
const t = e.split(_curlyRe), o = [], s = [];
|
|
17
17
|
let c = 0, r = [];
|
|
18
18
|
for (let e = 0; e < t.length; e++) {
|
|
19
19
|
const n = t[e];
|
|
20
|
-
"}" === n && c--, c > 0 ? r.push(n) : (r.length > 0 && (
|
|
21
|
-
r = []),
|
|
20
|
+
"}" === n && c--, c > 0 ? r.push(n) : (r.length > 0 && (s.push(r.join("")), o.push("%BLOCK%"),
|
|
21
|
+
r = []), o.push(n)), "{" === n && c++;
|
|
22
22
|
}
|
|
23
|
-
return r.length > 0 && (
|
|
24
|
-
escapedString:
|
|
25
|
-
blocks:
|
|
23
|
+
return r.length > 0 && (s.push(r.join("")), o.push("%BLOCK%")), {
|
|
24
|
+
escapedString: o.join(""),
|
|
25
|
+
blocks: s
|
|
26
26
|
};
|
|
27
|
-
}, convertColonRule = (e, t,
|
|
27
|
+
}, convertColonRule = (e, t, o) => e.replace(t, ((...e) => {
|
|
28
28
|
if (e[2]) {
|
|
29
|
-
const t = e[2].split(","),
|
|
29
|
+
const t = e[2].split(","), s = [];
|
|
30
30
|
for (let c = 0; c < t.length; c++) {
|
|
31
31
|
const r = t[c].trim();
|
|
32
32
|
if (!r) break;
|
|
33
|
-
|
|
33
|
+
s.push(o("-shadowcsshost-no-combinator", r, e[3]));
|
|
34
34
|
}
|
|
35
|
-
return
|
|
35
|
+
return s.join(",");
|
|
36
36
|
}
|
|
37
37
|
return "-shadowcsshost-no-combinator" + e[3];
|
|
38
|
-
})), colonHostPartReplacer = (e, t,
|
|
38
|
+
})), colonHostPartReplacer = (e, t, o) => e + t.replace("-shadowcsshost", "") + o, colonHostContextPartReplacer = (e, t, o) => t.indexOf("-shadowcsshost") > -1 ? colonHostPartReplacer(e, t, o) : e + t + o + ", " + t + " " + e + o, injectScopingSelector = (e, t) => e.replace(_selectorPartsRe, ((e, o = "", s, c = "", r = "") => o + t + c + r)), scopeSelectors = (e, t, o, s, c) => processRules(e, (e => {
|
|
39
39
|
let c = e.selector, r = e.content;
|
|
40
|
-
return "@" !== e.selector[0] ? c = ((e, t,
|
|
41
|
-
new RegExp("^(" + e + ")([>\\s~+[.,{:][\\s\\S]*)?$", "m")))(t).test(e))(e, t) ? ((e, t,
|
|
42
|
-
const
|
|
40
|
+
return "@" !== e.selector[0] ? c = ((e, t, o, s) => e.split(",").map((e => s && e.indexOf("." + s) > -1 ? e.trim() : ((e, t) => !(e => (e = e.replace(/\[/g, "\\[").replace(/\]/g, "\\]"),
|
|
41
|
+
new RegExp("^(" + e + ")([>\\s~+[.,{:][\\s\\S]*)?$", "m")))(t).test(e))(e, t) ? ((e, t, o) => {
|
|
42
|
+
const s = "." + (t = t.replace(/\[is=([^\]]*)\]/g, ((e, ...t) => t[0]))), c = e => {
|
|
43
43
|
let c = e.trim();
|
|
44
44
|
if (!c) return "";
|
|
45
|
-
if (e.indexOf("-shadowcsshost-no-combinator") > -1) c = ((e, t,
|
|
45
|
+
if (e.indexOf("-shadowcsshost-no-combinator") > -1) c = ((e, t, o) => {
|
|
46
46
|
if (_polyfillHostRe.lastIndex = 0, _polyfillHostRe.test(e)) {
|
|
47
|
-
const t = `.${
|
|
48
|
-
return e.replace(_polyfillHostNoCombinatorRe, ((e,
|
|
47
|
+
const t = `.${o}`;
|
|
48
|
+
return e.replace(_polyfillHostNoCombinatorRe, ((e, o) => injectScopingSelector(o, t))).replace(_polyfillHostRe, t + " ");
|
|
49
49
|
}
|
|
50
50
|
return t + " " + e;
|
|
51
|
-
})(e, t,
|
|
51
|
+
})(e, t, o); else {
|
|
52
52
|
const t = e.replace(_polyfillHostRe, "");
|
|
53
|
-
|
|
54
|
-
const e = t.match(/([^:]*)(:*)(.*)/);
|
|
55
|
-
e && (c = e[1] + o + e[2] + e[3]);
|
|
56
|
-
}
|
|
53
|
+
t.length > 0 && (c = injectScopingSelector(t, s));
|
|
57
54
|
}
|
|
58
55
|
return c;
|
|
59
56
|
}, r = (e => {
|
|
60
57
|
const t = [];
|
|
61
|
-
let
|
|
62
|
-
return
|
|
63
|
-
const c = `__ph-${
|
|
64
|
-
return t.push(
|
|
65
|
-
}))).replace(/(:nth-[-\w]+)(\([^)]+\))/g, ((e,
|
|
66
|
-
const r = `__ph-${
|
|
67
|
-
return t.push(c),
|
|
58
|
+
let o, s = 0;
|
|
59
|
+
return o = (e = e.replace(/(\[[^\]]*\])/g, ((e, o) => {
|
|
60
|
+
const c = `__ph-${s}__`;
|
|
61
|
+
return t.push(o), s++, c;
|
|
62
|
+
}))).replace(/(:nth-[-\w]+)(\([^)]+\))/g, ((e, o, c) => {
|
|
63
|
+
const r = `__ph-${s}__`;
|
|
64
|
+
return t.push(c), s++, o + r;
|
|
68
65
|
})), {
|
|
69
|
-
content:
|
|
66
|
+
content: o,
|
|
70
67
|
placeholders: t
|
|
71
68
|
};
|
|
72
69
|
})(e);
|
|
@@ -74,52 +71,52 @@ const _parenSuffix = ")(?:\\(((?:\\([^)(]*\\)|[^)(]*)+?)\\))?([^,{]*)", _cssColo
|
|
|
74
71
|
const i = /( |>|\+|~(?!=))\s*/g;
|
|
75
72
|
let p = !((e = r.content).indexOf("-shadowcsshost-no-combinator") > -1);
|
|
76
73
|
for (;null !== (n = i.exec(e)); ) {
|
|
77
|
-
const t = n[1],
|
|
78
|
-
p = p ||
|
|
74
|
+
const t = n[1], o = e.slice(a, n.index).trim();
|
|
75
|
+
p = p || o.indexOf("-shadowcsshost-no-combinator") > -1, l += `${p ? c(o) : o} ${t} `,
|
|
79
76
|
a = i.lastIndex;
|
|
80
77
|
}
|
|
81
78
|
const h = e.substring(a);
|
|
82
79
|
return p = p || h.indexOf("-shadowcsshost-no-combinator") > -1, l += p ? c(h) : h,
|
|
83
80
|
u = r.placeholders, l.replace(/__ph-(\d+)__/g, ((e, t) => u[+t]));
|
|
84
81
|
var u;
|
|
85
|
-
})(e, t,
|
|
82
|
+
})(e, t, o).trim() : e.trim())).join(", "))(e.selector, t, o, s) : (e.selector.startsWith("@media") || e.selector.startsWith("@supports") || e.selector.startsWith("@page") || e.selector.startsWith("@document")) && (r = scopeSelectors(e.content, t, o, s)),
|
|
86
83
|
{
|
|
87
84
|
selector: c.replace(/\s{2,}/g, " ").trim(),
|
|
88
85
|
content: r
|
|
89
86
|
};
|
|
90
87
|
}));
|
|
91
88
|
|
|
92
|
-
exports.scopeCss = (e, t,
|
|
93
|
-
const
|
|
89
|
+
exports.scopeCss = (e, t, o) => {
|
|
90
|
+
const s = t + "-h", c = t + "-s", r = e.match(_commentWithHashRe) || [];
|
|
94
91
|
e = e.replace(_commentRe, "");
|
|
95
92
|
const n = [];
|
|
96
|
-
if (
|
|
93
|
+
if (o) {
|
|
97
94
|
const t = e => {
|
|
98
|
-
const t = `/*!@___${n.length}___*/`,
|
|
95
|
+
const t = `/*!@___${n.length}___*/`, o = `/*!@${e.selector}*/`;
|
|
99
96
|
return n.push({
|
|
100
97
|
placeholder: t,
|
|
101
|
-
comment:
|
|
98
|
+
comment: o
|
|
102
99
|
}), e.selector = t + e.selector, e;
|
|
103
100
|
};
|
|
104
101
|
e = processRules(e, (e => "@" !== e.selector[0] ? t(e) : e.selector.startsWith("@media") || e.selector.startsWith("@supports") || e.selector.startsWith("@page") || e.selector.startsWith("@document") ? (e.content = processRules(e.content, t),
|
|
105
102
|
e) : e));
|
|
106
103
|
}
|
|
107
|
-
const l = ((e, t,
|
|
104
|
+
const l = ((e, t, o, s, c) => {
|
|
108
105
|
const r = ((e, t) => {
|
|
109
|
-
const
|
|
106
|
+
const o = "." + t + " > ", s = [];
|
|
110
107
|
return e = e.replace(_cssColonSlottedRe, ((...e) => {
|
|
111
108
|
if (e[2]) {
|
|
112
|
-
const t = e[2].trim(), c = e[3], r =
|
|
109
|
+
const t = e[2].trim(), c = e[3], r = o + t + c;
|
|
113
110
|
let n = "";
|
|
114
111
|
for (let t = e[4] - 1; t >= 0; t--) {
|
|
115
|
-
const
|
|
116
|
-
if ("}" ===
|
|
117
|
-
n =
|
|
112
|
+
const o = e[5][t];
|
|
113
|
+
if ("}" === o || "," === o) break;
|
|
114
|
+
n = o + n;
|
|
118
115
|
}
|
|
119
116
|
const l = n + r, a = `${n.trimRight()}${r.trim()}`;
|
|
120
117
|
if (l.trim() !== a.trim()) {
|
|
121
118
|
const e = `${a}, ${l}`;
|
|
122
|
-
|
|
119
|
+
s.push({
|
|
123
120
|
orgSelector: l,
|
|
124
121
|
updatedSelector: e
|
|
125
122
|
});
|
|
@@ -128,18 +125,18 @@ exports.scopeCss = (e, t, s) => {
|
|
|
128
125
|
}
|
|
129
126
|
return "-shadowcsshost-no-combinator" + e[3];
|
|
130
127
|
})), {
|
|
131
|
-
selectors:
|
|
128
|
+
selectors: s,
|
|
132
129
|
cssText: e
|
|
133
130
|
};
|
|
134
|
-
})(e = (e => convertColonRule(e, _cssColonHostContextRe, colonHostContextPartReplacer))(e = (e => convertColonRule(e, _cssColonHostRe, colonHostPartReplacer))(e = e.replace(_colonHostContextRe, "-shadowcsscontext").replace(_colonHostRe, "-shadowcsshost").replace(_colonSlottedRe, "-shadowcssslotted"))),
|
|
131
|
+
})(e = (e => convertColonRule(e, _cssColonHostContextRe, colonHostContextPartReplacer))(e = (e => convertColonRule(e, _cssColonHostRe, colonHostPartReplacer))(e = e.replace(_colonHostContextRe, "-shadowcsscontext").replace(_colonHostRe, "-shadowcsshost").replace(_colonSlottedRe, "-shadowcssslotted"))), s);
|
|
135
132
|
return e = (e => _shadowDOMSelectorsRe.reduce(((e, t) => e.replace(t, " ")), e))(e = r.cssText),
|
|
136
|
-
t && (e = scopeSelectors(e, t,
|
|
137
|
-
cssText: (e = (e = e.replace(/-shadowcsshost-no-combinator/g, `.${
|
|
133
|
+
t && (e = scopeSelectors(e, t, o, s)), {
|
|
134
|
+
cssText: (e = (e = e.replace(/-shadowcsshost-no-combinator/g, `.${o}`)).replace(/>\s*\*\s+([^{, ]+)/gm, " $1 ")).trim(),
|
|
138
135
|
slottedSelectors: r.selectors
|
|
139
136
|
};
|
|
140
|
-
})(e, t,
|
|
141
|
-
return e = [ l.cssText, ...r ].join("\n"),
|
|
142
|
-
e = e.replace(t,
|
|
137
|
+
})(e, t, s, c);
|
|
138
|
+
return e = [ l.cssText, ...r ].join("\n"), o && n.forEach((({placeholder: t, comment: o}) => {
|
|
139
|
+
e = e.replace(t, o);
|
|
143
140
|
})), l.slottedSelectors.forEach((t => {
|
|
144
141
|
e = e.replace(t.orgSelector, t.updatedSelector);
|
|
145
142
|
})), e;
|
package/mock-doc/index.cjs
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
/*!
|
|
2
|
-
Stencil Mock Doc (CommonJS) v2.
|
|
2
|
+
Stencil Mock Doc (CommonJS) v2.12.1 | MIT Licensed | https://stenciljs.com
|
|
3
3
|
*/
|
|
4
4
|
var mockDoc = (function(exports) {
|
|
5
5
|
'use strict';
|
|
@@ -547,7 +547,7 @@ class MockCSSStyleDeclaration {
|
|
|
547
547
|
const splt = rule.split(':');
|
|
548
548
|
if (splt.length > 1) {
|
|
549
549
|
const prop = splt[0].trim();
|
|
550
|
-
const value = splt
|
|
550
|
+
const value = splt.slice(1).join(':').trim();
|
|
551
551
|
if (prop !== '' && value !== '') {
|
|
552
552
|
this._styles.set(jsCaseToCssCase(prop), value);
|
|
553
553
|
}
|
|
@@ -1510,6 +1510,9 @@ class MockNode {
|
|
|
1510
1510
|
return null;
|
|
1511
1511
|
}
|
|
1512
1512
|
contains(otherNode) {
|
|
1513
|
+
if (otherNode === this) {
|
|
1514
|
+
return true;
|
|
1515
|
+
}
|
|
1513
1516
|
return this.childNodes.includes(otherNode);
|
|
1514
1517
|
}
|
|
1515
1518
|
removeChild(childNode) {
|
package/mock-doc/index.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
/*!
|
|
2
|
-
Stencil Mock Doc v2.
|
|
2
|
+
Stencil Mock Doc v2.12.1 | MIT Licensed | https://stenciljs.com
|
|
3
3
|
*/
|
|
4
4
|
const CONTENT_REF_ID = 'r';
|
|
5
5
|
const ORG_LOCATION_ID = 'o';
|
|
@@ -544,7 +544,7 @@ class MockCSSStyleDeclaration {
|
|
|
544
544
|
const splt = rule.split(':');
|
|
545
545
|
if (splt.length > 1) {
|
|
546
546
|
const prop = splt[0].trim();
|
|
547
|
-
const value = splt
|
|
547
|
+
const value = splt.slice(1).join(':').trim();
|
|
548
548
|
if (prop !== '' && value !== '') {
|
|
549
549
|
this._styles.set(jsCaseToCssCase(prop), value);
|
|
550
550
|
}
|
|
@@ -1507,6 +1507,9 @@ class MockNode {
|
|
|
1507
1507
|
return null;
|
|
1508
1508
|
}
|
|
1509
1509
|
contains(otherNode) {
|
|
1510
|
+
if (otherNode === this) {
|
|
1511
|
+
return true;
|
|
1512
|
+
}
|
|
1510
1513
|
return this.childNodes.includes(otherNode);
|
|
1511
1514
|
}
|
|
1512
1515
|
removeChild(childNode) {
|