@stencil/core 2.15.2 → 2.16.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (47) hide show
  1. package/cli/index.cjs +6 -6
  2. package/cli/index.js +6 -6
  3. package/cli/package.json +1 -1
  4. package/compiler/package.json +1 -1
  5. package/compiler/stencil.js +439 -102
  6. package/compiler/stencil.min.js +2 -2
  7. package/dependencies.json +1 -1
  8. package/dev-server/client/index.js +1 -1
  9. package/dev-server/client/package.json +1 -1
  10. package/dev-server/client/test/hmr-util.spec.d.ts +1 -0
  11. package/dev-server/client/test/status.spec.d.ts +1 -0
  12. package/dev-server/connector.html +2 -2
  13. package/dev-server/index.js +1 -1
  14. package/dev-server/package.json +1 -1
  15. package/dev-server/server-process.js +3 -3
  16. package/internal/app-data/package.json +1 -1
  17. package/internal/client/css-shim.js +1 -1
  18. package/internal/client/dom.js +1 -1
  19. package/internal/client/index.js +11 -9
  20. package/internal/client/package.json +1 -1
  21. package/internal/client/patch-browser.js +1 -1
  22. package/internal/client/patch-esm.js +1 -1
  23. package/internal/client/shadow-css.js +2 -3
  24. package/internal/hydrate/index.js +34 -29
  25. package/internal/hydrate/package.json +1 -1
  26. package/internal/hydrate/shadow-css.js +9 -9
  27. package/internal/package.json +1 -1
  28. package/internal/stencil-public-compiler.d.ts +66 -2
  29. package/internal/stencil-public-docs.d.ts +3 -0
  30. package/internal/testing/index.js +34 -29
  31. package/internal/testing/package.json +1 -1
  32. package/internal/testing/shadow-css.js +9 -9
  33. package/mock-doc/index.cjs +6 -2
  34. package/mock-doc/index.d.ts +8 -2
  35. package/mock-doc/index.js +6 -2
  36. package/mock-doc/package.json +1 -1
  37. package/package.json +21 -14
  38. package/screenshot/package.json +1 -1
  39. package/sys/node/index.js +1 -1
  40. package/sys/node/package.json +1 -1
  41. package/sys/node/worker.js +1 -1
  42. package/testing/index.js +2 -2
  43. package/testing/jest/test/jest-config.spec.d.ts +1 -0
  44. package/testing/jest/test/jest-preprocessor.spec.d.ts +1 -0
  45. package/testing/jest/test/jest-runner.spec.d.ts +1 -0
  46. package/testing/jest/test/jest-serializer.spec.d.ts +1 -0
  47. package/testing/package.json +1 -1
@@ -210,7 +210,8 @@ const createTime = (e, t = "") => {
210
210
  let n = styles.get(e);
211
211
  n = t, styles.set(e, n);
212
212
  }, addStyle = (e, t, o, n) => {
213
- let s = getScopeId(t, o), l = styles.get(s);
213
+ let s = getScopeId(t, o);
214
+ const l = styles.get(s);
214
215
  if (!BUILD.attachStyles) return s;
215
216
  if (e = 11 === e.nodeType ? e : doc, l) if ("string" == typeof l) {
216
217
  e = e.head || e;
@@ -235,8 +236,8 @@ const createTime = (e, t = "") => {
235
236
  o.classList.add(l + "-h"), BUILD.scoped && 2 & n && o.classList.add(l + "-s")),
236
237
  s();
237
238
  }, getScopeId = (e, t) => "sc-" + (BUILD.mode && t && 32 & e.$flags$ ? e.$tagName$ + "-" + t : e.$tagName$), computeMode = e => modeResolutionChain.map((t => t(e))).find((e => !!e)), setMode = e => modeResolutionChain.push(e), getMode = e => getHostRef(e).$modeName$, EMPTY_OBJ = {}, isComplexType = e => "object" == (e = typeof e) || "function" === e, isPromise = e => !!e && ("object" == typeof e || "function" == typeof e) && "function" == typeof e.then, h = (e, t, ...o) => {
238
- let n = null, s = null, l = null, a = !1, r = !1, i = [];
239
- const d = t => {
239
+ let n = null, s = null, l = null, a = !1, r = !1;
240
+ const i = [], d = t => {
240
241
  for (let o = 0; o < t.length; o++) n = t[o], Array.isArray(n) ? d(n) : null != n && "boolean" != typeof n && ((a = "function" != typeof e && !isComplexType(n)) ? n = String(n) : BUILD.isDev && "function" != typeof e && n.$flags$,
241
242
  a && r ? i[i.length - 1].$text$ += n : i.push(a ? newVNode(null, n) : n), r = a);
242
243
  };
@@ -297,7 +298,7 @@ const createTime = (e, t = "") => {
297
298
  const i = isComplexType(n);
298
299
  if ((a || i && null !== n) && !s) try {
299
300
  if (e.tagName.includes("-")) e[t] = n; else {
300
- let s = null == n ? "" : n;
301
+ const s = null == n ? "" : n;
301
302
  "list" === t ? a = !1 : null != o && e[t] == s || (e[t] = s);
302
303
  }
303
304
  } catch (e) {}
@@ -317,21 +318,22 @@ const createTime = (e, t = "") => {
317
318
  let scopeId, contentRef, hostTagName, useNativeShadowDom = !1, checkSlotFallbackVisibility = !1, checkSlotRelocate = !1, isSvgMode = !1;
318
319
 
319
320
  const createElm = (e, t, o, n) => {
320
- let s, l, a, r = t.$children$[o], i = 0;
321
- if (BUILD.slotRelocation && !useNativeShadowDom && (checkSlotRelocate = !0, "slot" === r.$tag$ && (scopeId && n.classList.add(scopeId + "-s"),
322
- r.$flags$ |= r.$children$ ? 2 : 1)), BUILD.isDev && r.$elm$ && consoleDevError(`The JSX ${null !== r.$text$ ? `"${r.$text$}" text` : `"${r.$tag$}" element`} node should not be shared within the same renderer. The renderer caches element lookups in order to improve performance. However, a side effect from this is that the exact same JSX node should not be reused. For more information please see https://stenciljs.com/docs/templating-jsx#avoid-shared-jsx-nodes`),
323
- BUILD.vdomText && null !== r.$text$) s = r.$elm$ = doc.createTextNode(r.$text$); else if (BUILD.slotRelocation && 1 & r.$flags$) s = r.$elm$ = BUILD.isDebug || BUILD.hydrateServerSide ? slotReferenceDebugNode(r) : doc.createTextNode(""); else {
324
- if (BUILD.svg && !isSvgMode && (isSvgMode = "svg" === r.$tag$), s = r.$elm$ = BUILD.svg ? doc.createElementNS(isSvgMode ? "http://www.w3.org/2000/svg" : "http://www.w3.org/1999/xhtml", BUILD.slotRelocation && 2 & r.$flags$ ? "slot-fb" : r.$tag$) : doc.createElement(BUILD.slotRelocation && 2 & r.$flags$ ? "slot-fb" : r.$tag$),
325
- BUILD.svg && isSvgMode && "foreignObject" === r.$tag$ && (isSvgMode = !1), BUILD.vdomAttribute && updateElement(null, r, isSvgMode),
326
- (BUILD.shadowDom || BUILD.scoped) && null != scopeId && s["s-si"] !== scopeId && s.classList.add(s["s-si"] = scopeId),
327
- r.$children$) for (i = 0; i < r.$children$.length; ++i) l = createElm(e, r, i, s),
328
- l && s.appendChild(l);
329
- BUILD.svg && ("svg" === r.$tag$ ? isSvgMode = !1 : "foreignObject" === s.tagName && (isSvgMode = !0));
321
+ const s = t.$children$[o];
322
+ let l, a, r, i = 0;
323
+ if (BUILD.slotRelocation && !useNativeShadowDom && (checkSlotRelocate = !0, "slot" === s.$tag$ && (scopeId && n.classList.add(scopeId + "-s"),
324
+ s.$flags$ |= s.$children$ ? 2 : 1)), BUILD.isDev && s.$elm$ && consoleDevError(`The JSX ${null !== s.$text$ ? `"${s.$text$}" text` : `"${s.$tag$}" element`} node should not be shared within the same renderer. The renderer caches element lookups in order to improve performance. However, a side effect from this is that the exact same JSX node should not be reused. For more information please see https://stenciljs.com/docs/templating-jsx#avoid-shared-jsx-nodes`),
325
+ BUILD.vdomText && null !== s.$text$) l = s.$elm$ = doc.createTextNode(s.$text$); else if (BUILD.slotRelocation && 1 & s.$flags$) l = s.$elm$ = BUILD.isDebug || BUILD.hydrateServerSide ? slotReferenceDebugNode(s) : doc.createTextNode(""); else {
326
+ if (BUILD.svg && !isSvgMode && (isSvgMode = "svg" === s.$tag$), l = s.$elm$ = BUILD.svg ? doc.createElementNS(isSvgMode ? "http://www.w3.org/2000/svg" : "http://www.w3.org/1999/xhtml", BUILD.slotRelocation && 2 & s.$flags$ ? "slot-fb" : s.$tag$) : doc.createElement(BUILD.slotRelocation && 2 & s.$flags$ ? "slot-fb" : s.$tag$),
327
+ BUILD.svg && isSvgMode && "foreignObject" === s.$tag$ && (isSvgMode = !1), BUILD.vdomAttribute && updateElement(null, s, isSvgMode),
328
+ (BUILD.shadowDom || BUILD.scoped) && null != scopeId && l["s-si"] !== scopeId && l.classList.add(l["s-si"] = scopeId),
329
+ s.$children$) for (i = 0; i < s.$children$.length; ++i) a = createElm(e, s, i, l),
330
+ a && l.appendChild(a);
331
+ BUILD.svg && ("svg" === s.$tag$ ? isSvgMode = !1 : "foreignObject" === l.tagName && (isSvgMode = !0));
330
332
  }
331
- return BUILD.slotRelocation && (s["s-hn"] = hostTagName, 3 & r.$flags$ && (s["s-sr"] = !0,
332
- s["s-cr"] = contentRef, s["s-sn"] = r.$name$ || "", a = e && e.$children$ && e.$children$[o],
333
- a && a.$tag$ === r.$tag$ && e.$elm$ && putBackInOriginalLocation(e.$elm$, !1))),
334
- s;
333
+ return BUILD.slotRelocation && (l["s-hn"] = hostTagName, 3 & s.$flags$ && (l["s-sr"] = !0,
334
+ l["s-cr"] = contentRef, l["s-sn"] = s.$name$ || "", r = e && e.$children$ && e.$children$[o],
335
+ r && r.$tag$ === s.$tag$ && e.$elm$ && putBackInOriginalLocation(e.$elm$, !1))),
336
+ l;
335
337
  }, putBackInOriginalLocation = (e, t) => {
336
338
  plt.$flags$ |= 1;
337
339
  const o = e.childNodes;
@@ -372,22 +374,24 @@ const createElm = (e, t, o, n) => {
372
374
  addVnodes(o, null, t, s, 0, s.length - 1)) : BUILD.updatable && null !== n && removeVnodes(n, 0, n.length - 1),
373
375
  BUILD.svg && isSvgMode && "svg" === l && (isSvgMode = !1));
374
376
  }, updateFallbackSlotVisibility = e => {
375
- let t, o, n, s, l, a, r = e.childNodes;
376
- for (o = 0, n = r.length; o < n; o++) if (t = r[o], 1 === t.nodeType) {
377
- if (t["s-sr"]) for (l = t["s-sn"], t.hidden = !1, s = 0; s < n; s++) if (a = r[s].nodeType,
378
- r[s]["s-hn"] !== t["s-hn"] || "" !== l) {
379
- if (1 === a && l === r[s].getAttribute("slot")) {
380
- t.hidden = !0;
377
+ const t = e.childNodes;
378
+ let o, n, s, l, a, r;
379
+ for (n = 0, s = t.length; n < s; n++) if (o = t[n], 1 === o.nodeType) {
380
+ if (o["s-sr"]) for (a = o["s-sn"], o.hidden = !1, l = 0; l < s; l++) if (r = t[l].nodeType,
381
+ t[l]["s-hn"] !== o["s-hn"] || "" !== a) {
382
+ if (1 === r && a === t[l].getAttribute("slot")) {
383
+ o.hidden = !0;
381
384
  break;
382
385
  }
383
- } else if (1 === a || 3 === a && "" !== r[s].textContent.trim()) {
384
- t.hidden = !0;
386
+ } else if (1 === r || 3 === r && "" !== t[l].textContent.trim()) {
387
+ o.hidden = !0;
385
388
  break;
386
389
  }
387
- updateFallbackSlotVisibility(t);
390
+ updateFallbackSlotVisibility(o);
388
391
  }
389
392
  }, relocateNodes = [], relocateSlotContent = e => {
390
- let t, o, n, s, l, a, r = 0, i = e.childNodes, d = i.length;
393
+ let t, o, n, s, l, a, r = 0;
394
+ const i = e.childNodes, d = i.length;
391
395
  for (;r < d; r++) {
392
396
  if (t = i[r], t["s-sr"] && (o = t["s-cr"]) && o.parentNode) for (n = o.parentNode.childNodes,
393
397
  s = t["s-sn"], a = n.length - 1; a >= 0; a--) o = n[a], o["s-cn"] || o["s-nr"] || o["s-hn"] === t["s-hn"] || (isNodeLocatedInSlot(o, s) ? (l = relocateNodes.find((e => e.$nodeToRelocate$ === o)),
@@ -782,7 +786,8 @@ const callRender = (e, t, o) => {
782
786
  e.cloneNode = function(e) {
783
787
  const o = this, n = !!BUILD.shadowDom && o.shadowRoot && supportsShadow, s = t.call(o, !!n && e);
784
788
  if (BUILD.slot && !n && e) {
785
- let e, t, n = 0, l = [ "s-id", "s-cr", "s-lr", "s-rc", "s-sc", "s-p", "s-cn", "s-sr", "s-sn", "s-hn", "s-ol", "s-nr", "s-si" ];
789
+ let e, t, n = 0;
790
+ const l = [ "s-id", "s-cr", "s-lr", "s-rc", "s-sc", "s-p", "s-cn", "s-sr", "s-sn", "s-hn", "s-ol", "s-nr", "s-si" ];
786
791
  for (;n < o.childNodes.length; n++) e = o.childNodes[n]["s-nr"], t = l.every((e => !o.childNodes[n][e])),
787
792
  e && (BUILD.appendChildSlotFix && s.__appendChild ? s.__appendChild(e.cloneNode(!0)) : s.appendChild(e.cloneNode(!0))),
788
793
  t && s.appendChild(o.childNodes[n].cloneNode(!0));
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@stencil/core/internal/hydrate",
3
- "version": "2.15.2",
3
+ "version": "2.16.0",
4
4
  "description": "Stencil internal hydrate 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
@@ -55,15 +55,15 @@ const _parenSuffix = ")(?:\\(((?:\\([^)(]*\\)|[^)(]*)+?)\\))?([^,{]*)", _cssColo
55
55
  return c;
56
56
  }, r = (e => {
57
57
  const t = [];
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;
65
- })), {
66
- content: o,
58
+ let o = 0;
59
+ return {
60
+ content: (e = e.replace(/(\[[^\]]*\])/g, ((e, s) => {
61
+ const c = `__ph-${o}__`;
62
+ return t.push(s), o++, c;
63
+ }))).replace(/(:nth-[-\w]+)(\([^)]+\))/g, ((e, s, c) => {
64
+ const r = `__ph-${o}__`;
65
+ return t.push(c), o++, s + r;
66
+ })),
67
67
  placeholders: t
68
68
  };
69
69
  })(e);
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@stencil/core/internal",
3
- "version": "2.15.2",
3
+ "version": "2.16.0",
4
4
  "description": "Stencil internals only to be imported by the Stencil Compiler. Breaking changes can and will happen at any time.",
5
5
  "main": "./index.js",
6
6
  "types": "./index.d.ts",
@@ -251,6 +251,13 @@ export interface ConfigExtras {
251
251
  * and below. Defaults to `false`.
252
252
  */
253
253
  dynamicImportShim?: boolean;
254
+ /**
255
+ * Experimental flag. Projects that use a Stencil library built using the `dist` output target may have trouble lazily
256
+ * loading components when using a bundler such as Vite or Parcel. Setting this flag to `true` will change how Stencil
257
+ * lazily loads components in a way that works with additional bundlers. Setting this flag to `true` will increase
258
+ * the size of the compiled output. Defaults to `false`.
259
+ */
260
+ experimentalImportInjection?: boolean;
254
261
  /**
255
262
  * Dispatches component lifecycle events. Mainly used for testing. Defaults to `false`.
256
263
  */
@@ -317,6 +324,38 @@ export interface Config extends StencilConfig {
317
324
  _isValidated?: boolean;
318
325
  _isTesting?: boolean;
319
326
  }
327
+ /**
328
+ * A 'loose' type useful for wrapping an incomplete / possible malformed
329
+ * object as we work on getting it comply with a particular Interface T.
330
+ *
331
+ * Example:
332
+ *
333
+ * ```ts
334
+ * interface Foo {
335
+ * bar: string
336
+ * }
337
+ *
338
+ * function validateFoo(foo: Loose<Foo>): Foo {
339
+ * let validatedFoo = {
340
+ * ...foo,
341
+ * bar: foo.bar || DEFAULT_BAR
342
+ * }
343
+ *
344
+ * return validatedFoo
345
+ * }
346
+ * ```
347
+ *
348
+ * Use this when you need to take user input or something from some other part
349
+ * of the world that we don't control and transform it into something
350
+ * conforming to a given interface. For best results, pair with a validation
351
+ * function as shown in the example.
352
+ */
353
+ declare type Loose<T extends Object> = Record<string, any> & Partial<T>;
354
+ /**
355
+ * A Loose version of the Config interface. This is intended to let us load a partial config
356
+ * and have type information carry though as we construct an object which is a valid `Config`.
357
+ */
358
+ export declare type UnvalidatedConfig = Loose<Config>;
320
359
  export interface HydratedFlag {
321
360
  /**
322
361
  * Defaults to `hydrated`.
@@ -1720,9 +1759,23 @@ export interface OutputTargetCustom extends OutputTargetBase {
1720
1759
  generator: (config: Config, compilerCtx: any, buildCtx: any, docs: any) => Promise<void>;
1721
1760
  copy?: CopyTask[];
1722
1761
  }
1762
+ /**
1763
+ * Output target for generating [custom data](https://github.com/microsoft/vscode-custom-data) for VS Code as a JSON
1764
+ * file.
1765
+ */
1723
1766
  export interface OutputTargetDocsVscode extends OutputTargetBase {
1767
+ /**
1768
+ * Designates this output target to be used for generating VS Code custom data.
1769
+ * @see OutputTargetBase#type
1770
+ */
1724
1771
  type: 'docs-vscode';
1772
+ /**
1773
+ * The location on disk to write the JSON file.
1774
+ */
1725
1775
  file: string;
1776
+ /**
1777
+ * A base URL to find the source code of the component(s) described in the JSON file.
1778
+ */
1726
1779
  sourceCodeBaseUrl?: string;
1727
1780
  }
1728
1781
  export interface OutputTargetDocsReadme extends OutputTargetBase {
@@ -1779,7 +1832,13 @@ export interface OutputTargetDistCustomElementsBundle extends OutputTargetBaseNe
1779
1832
  includeGlobalScripts?: boolean;
1780
1833
  minify?: boolean;
1781
1834
  }
1835
+ /**
1836
+ * The base type for output targets. All output targets should extend this base type.
1837
+ */
1782
1838
  export interface OutputTargetBase {
1839
+ /**
1840
+ * A unique string to differentiate one output target from another
1841
+ */
1783
1842
  type: string;
1784
1843
  }
1785
1844
  export declare type OutputTargetBuild = OutputTargetDistCollection | OutputTargetDistLazy;
@@ -1899,7 +1958,7 @@ export interface LoadConfigInit {
1899
1958
  * User config object to merge into default config and
1900
1959
  * config loaded from a file path.
1901
1960
  */
1902
- config?: Config;
1961
+ config?: UnvalidatedConfig;
1903
1962
  /**
1904
1963
  * Absolute path to a Stencil config file. This path cannot be
1905
1964
  * relative and it does not resolve config files within a directory.
@@ -1914,8 +1973,13 @@ export interface LoadConfigInit {
1914
1973
  */
1915
1974
  initTsConfig?: boolean;
1916
1975
  }
1976
+ /**
1977
+ * Results from an attempt to load a config. The values on this interface
1978
+ * have not yet been validated and are not ready to be used for arbitrary
1979
+ * operations around the codebase.
1980
+ */
1917
1981
  export interface LoadConfigResults {
1918
- config: Config;
1982
+ config: UnvalidatedConfig;
1919
1983
  diagnostics: Diagnostic[];
1920
1984
  tsconfig: {
1921
1985
  path: string;
@@ -49,6 +49,9 @@ export interface JsonDocsProp {
49
49
  name: string;
50
50
  type: string;
51
51
  mutable: boolean;
52
+ /**
53
+ * The name of the attribute that is exposed to configure a compiled web component
54
+ */
52
55
  attr?: string;
53
56
  reflectToAttr: boolean;
54
57
  docs: string;
@@ -156,7 +156,8 @@ const createTime = (e, t = "") => {
156
156
  let o = styles.get(e);
157
157
  o = t, styles.set(e, o);
158
158
  }, addStyle = (e, t, a, o) => {
159
- let s = getScopeId(t, a), n = styles.get(s);
159
+ let s = getScopeId(t, a);
160
+ const n = styles.get(s);
160
161
  if (!appData.BUILD.attachStyles) return s;
161
162
  if (e = 11 === e.nodeType ? e : doc, n) if ("string" == typeof n) {
162
163
  e = e.head || e;
@@ -181,8 +182,8 @@ const createTime = (e, t = "") => {
181
182
  a.classList.add(n + "-h"), appData.BUILD.scoped && 2 & o && a.classList.add(n + "-s")),
182
183
  s();
183
184
  }, getScopeId = (e, t) => "sc-" + (appData.BUILD.mode && t && 32 & e.$flags$ ? e.$tagName$ + "-" + t : e.$tagName$), computeMode = e => modeResolutionChain.map((t => t(e))).find((e => !!e)), EMPTY_OBJ = {}, isComplexType = e => "object" == (e = typeof e) || "function" === e, h = (e, t, ...a) => {
184
- let o = null, s = null, n = null, l = !1, r = !1, p = [];
185
- const i = t => {
185
+ let o = null, s = null, n = null, l = !1, r = !1;
186
+ const p = [], i = t => {
186
187
  for (let a = 0; a < t.length; a++) o = t[a], Array.isArray(o) ? i(o) : null != o && "boolean" != typeof o && ((l = "function" != typeof e && !isComplexType(o)) ? o = String(o) : appData.BUILD.isDev && "function" != typeof e && void 0 === o.$flags$ && consoleDevError("vNode passed as children has unexpected type.\nMake sure it's using the correct h() function.\nEmpty objects can also be the cause, look for JSX comments that became objects."),
187
188
  l && r ? p[p.length - 1].$text$ += o : p.push(l ? newVNode(null, o) : o), r = l);
188
189
  };
@@ -246,7 +247,7 @@ const createTime = (e, t = "") => {
246
247
  const p = isComplexType(o);
247
248
  if ((l || p && null !== o) && !s) try {
248
249
  if (e.tagName.includes("-")) e[t] = o; else {
249
- let s = null == o ? "" : o;
250
+ const s = null == o ? "" : o;
250
251
  "list" === t ? l = !1 : null != a && e[t] == s || (e[t] = s);
251
252
  }
252
253
  } catch (e) {}
@@ -267,22 +268,23 @@ const createTime = (e, t = "") => {
267
268
  let scopeId, contentRef, hostTagName, useNativeShadowDom = !1, checkSlotFallbackVisibility = !1, checkSlotRelocate = !1, isSvgMode = !1;
268
269
 
269
270
  const createElm = (e, t, a, o) => {
270
- let s, n, l, r = t.$children$[a], p = 0;
271
+ const s = t.$children$[a];
272
+ let n, l, r, p = 0;
271
273
  if (appData.BUILD.slotRelocation && !useNativeShadowDom && (checkSlotRelocate = !0,
272
- "slot" === r.$tag$ && (scopeId && o.classList.add(scopeId + "-s"), r.$flags$ |= r.$children$ ? 2 : 1)),
273
- appData.BUILD.isDev && r.$elm$ && consoleDevError(`The JSX ${null !== r.$text$ ? `"${r.$text$}" text` : `"${r.$tag$}" element`} node should not be shared within the same renderer. The renderer caches element lookups in order to improve performance. However, a side effect from this is that the exact same JSX node should not be reused. For more information please see https://stenciljs.com/docs/templating-jsx#avoid-shared-jsx-nodes`),
274
- appData.BUILD.vdomText && null !== r.$text$) s = r.$elm$ = doc.createTextNode(r.$text$); else if (appData.BUILD.slotRelocation && 1 & r.$flags$) s = r.$elm$ = appData.BUILD.isDebug || appData.BUILD.hydrateServerSide ? slotReferenceDebugNode(r) : doc.createTextNode(""); else {
275
- if (appData.BUILD.svg && !isSvgMode && (isSvgMode = "svg" === r.$tag$), s = r.$elm$ = appData.BUILD.svg ? doc.createElementNS(isSvgMode ? "http://www.w3.org/2000/svg" : "http://www.w3.org/1999/xhtml", appData.BUILD.slotRelocation && 2 & r.$flags$ ? "slot-fb" : r.$tag$) : doc.createElement(appData.BUILD.slotRelocation && 2 & r.$flags$ ? "slot-fb" : r.$tag$),
276
- appData.BUILD.svg && isSvgMode && "foreignObject" === r.$tag$ && (isSvgMode = !1),
277
- appData.BUILD.vdomAttribute && updateElement(null, r, isSvgMode), (appData.BUILD.shadowDom || appData.BUILD.scoped) && null != scopeId && s["s-si"] !== scopeId && s.classList.add(s["s-si"] = scopeId),
278
- r.$children$) for (p = 0; p < r.$children$.length; ++p) n = createElm(e, r, p, s),
279
- n && s.appendChild(n);
280
- appData.BUILD.svg && ("svg" === r.$tag$ ? isSvgMode = !1 : "foreignObject" === s.tagName && (isSvgMode = !0));
274
+ "slot" === s.$tag$ && (scopeId && o.classList.add(scopeId + "-s"), s.$flags$ |= s.$children$ ? 2 : 1)),
275
+ appData.BUILD.isDev && s.$elm$ && consoleDevError(`The JSX ${null !== s.$text$ ? `"${s.$text$}" text` : `"${s.$tag$}" element`} node should not be shared within the same renderer. The renderer caches element lookups in order to improve performance. However, a side effect from this is that the exact same JSX node should not be reused. For more information please see https://stenciljs.com/docs/templating-jsx#avoid-shared-jsx-nodes`),
276
+ appData.BUILD.vdomText && null !== s.$text$) n = s.$elm$ = doc.createTextNode(s.$text$); else if (appData.BUILD.slotRelocation && 1 & s.$flags$) n = s.$elm$ = appData.BUILD.isDebug || appData.BUILD.hydrateServerSide ? slotReferenceDebugNode(s) : doc.createTextNode(""); else {
277
+ if (appData.BUILD.svg && !isSvgMode && (isSvgMode = "svg" === s.$tag$), n = s.$elm$ = appData.BUILD.svg ? doc.createElementNS(isSvgMode ? "http://www.w3.org/2000/svg" : "http://www.w3.org/1999/xhtml", appData.BUILD.slotRelocation && 2 & s.$flags$ ? "slot-fb" : s.$tag$) : doc.createElement(appData.BUILD.slotRelocation && 2 & s.$flags$ ? "slot-fb" : s.$tag$),
278
+ appData.BUILD.svg && isSvgMode && "foreignObject" === s.$tag$ && (isSvgMode = !1),
279
+ appData.BUILD.vdomAttribute && updateElement(null, s, isSvgMode), (appData.BUILD.shadowDom || appData.BUILD.scoped) && null != scopeId && n["s-si"] !== scopeId && n.classList.add(n["s-si"] = scopeId),
280
+ s.$children$) for (p = 0; p < s.$children$.length; ++p) l = createElm(e, s, p, n),
281
+ l && n.appendChild(l);
282
+ appData.BUILD.svg && ("svg" === s.$tag$ ? isSvgMode = !1 : "foreignObject" === n.tagName && (isSvgMode = !0));
281
283
  }
282
- return appData.BUILD.slotRelocation && (s["s-hn"] = hostTagName, 3 & r.$flags$ && (s["s-sr"] = !0,
283
- s["s-cr"] = contentRef, s["s-sn"] = r.$name$ || "", l = e && e.$children$ && e.$children$[a],
284
- l && l.$tag$ === r.$tag$ && e.$elm$ && putBackInOriginalLocation(e.$elm$, !1))),
285
- s;
284
+ return appData.BUILD.slotRelocation && (n["s-hn"] = hostTagName, 3 & s.$flags$ && (n["s-sr"] = !0,
285
+ n["s-cr"] = contentRef, n["s-sn"] = s.$name$ || "", r = e && e.$children$ && e.$children$[a],
286
+ r && r.$tag$ === s.$tag$ && e.$elm$ && putBackInOriginalLocation(e.$elm$, !1))),
287
+ n;
286
288
  }, putBackInOriginalLocation = (e, t) => {
287
289
  plt.$flags$ |= 1;
288
290
  const a = e.childNodes;
@@ -323,22 +325,24 @@ const createElm = (e, t, a, o) => {
323
325
  addVnodes(a, null, t, s, 0, s.length - 1)) : appData.BUILD.updatable && null !== o && removeVnodes(o, 0, o.length - 1),
324
326
  appData.BUILD.svg && isSvgMode && "svg" === n && (isSvgMode = !1));
325
327
  }, updateFallbackSlotVisibility = e => {
326
- let t, a, o, s, n, l, r = e.childNodes;
327
- for (a = 0, o = r.length; a < o; a++) if (t = r[a], 1 === t.nodeType) {
328
- if (t["s-sr"]) for (n = t["s-sn"], t.hidden = !1, s = 0; s < o; s++) if (l = r[s].nodeType,
329
- r[s]["s-hn"] !== t["s-hn"] || "" !== n) {
330
- if (1 === l && n === r[s].getAttribute("slot")) {
331
- t.hidden = !0;
328
+ const t = e.childNodes;
329
+ let a, o, s, n, l, r;
330
+ for (o = 0, s = t.length; o < s; o++) if (a = t[o], 1 === a.nodeType) {
331
+ if (a["s-sr"]) for (l = a["s-sn"], a.hidden = !1, n = 0; n < s; n++) if (r = t[n].nodeType,
332
+ t[n]["s-hn"] !== a["s-hn"] || "" !== l) {
333
+ if (1 === r && l === t[n].getAttribute("slot")) {
334
+ a.hidden = !0;
332
335
  break;
333
336
  }
334
- } else if (1 === l || 3 === l && "" !== r[s].textContent.trim()) {
335
- t.hidden = !0;
337
+ } else if (1 === r || 3 === r && "" !== t[n].textContent.trim()) {
338
+ a.hidden = !0;
336
339
  break;
337
340
  }
338
- updateFallbackSlotVisibility(t);
341
+ updateFallbackSlotVisibility(a);
339
342
  }
340
343
  }, relocateNodes = [], relocateSlotContent = e => {
341
- let t, a, o, s, n, l, r = 0, p = e.childNodes, i = p.length;
344
+ let t, a, o, s, n, l, r = 0;
345
+ const p = e.childNodes, i = p.length;
342
346
  for (;r < i; r++) {
343
347
  if (t = p[r], t["s-sr"] && (a = t["s-cr"]) && a.parentNode) for (o = a.parentNode.childNodes,
344
348
  s = t["s-sn"], l = o.length - 1; l >= 0; l--) a = o[l], a["s-cn"] || a["s-nr"] || a["s-hn"] === t["s-hn"] || (isNodeLocatedInSlot(a, s) ? (n = relocateNodes.find((e => e.$nodeToRelocate$ === a)),
@@ -724,7 +728,8 @@ const callRender = (e, t, a) => {
724
728
  e.cloneNode = function(e) {
725
729
  const a = this, o = !!appData.BUILD.shadowDom && a.shadowRoot && exports.supportsShadow, s = t.call(a, !!o && e);
726
730
  if (appData.BUILD.slot && !o && e) {
727
- let e, t, o = 0, n = [ "s-id", "s-cr", "s-lr", "s-rc", "s-sc", "s-p", "s-cn", "s-sr", "s-sn", "s-hn", "s-ol", "s-nr", "s-si" ];
731
+ let e, t, o = 0;
732
+ const n = [ "s-id", "s-cr", "s-lr", "s-rc", "s-sc", "s-p", "s-cn", "s-sr", "s-sn", "s-hn", "s-ol", "s-nr", "s-si" ];
728
733
  for (;o < a.childNodes.length; o++) e = a.childNodes[o]["s-nr"], t = n.every((e => !a.childNodes[o][e])),
729
734
  e && (appData.BUILD.appendChildSlotFix && s.__appendChild ? s.__appendChild(e.cloneNode(!0)) : s.appendChild(e.cloneNode(!0))),
730
735
  t && s.appendChild(a.childNodes[o].cloneNode(!0));
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@stencil/core/internal/testing",
3
- "version": "2.15.2",
3
+ "version": "2.16.0",
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
@@ -55,15 +55,15 @@ const _parenSuffix = ")(?:\\(((?:\\([^)(]*\\)|[^)(]*)+?)\\))?([^,{]*)", _cssColo
55
55
  return c;
56
56
  }, r = (e => {
57
57
  const t = [];
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;
65
- })), {
66
- content: o,
58
+ let o = 0;
59
+ return {
60
+ content: (e = e.replace(/(\[[^\]]*\])/g, ((e, s) => {
61
+ const c = `__ph-${o}__`;
62
+ return t.push(s), o++, c;
63
+ }))).replace(/(:nth-[-\w]+)(\([^)]+\))/g, ((e, s, c) => {
64
+ const r = `__ph-${o}__`;
65
+ return t.push(c), o++, s + r;
66
+ })),
67
67
  placeholders: t
68
68
  };
69
69
  })(e);
@@ -1,5 +1,5 @@
1
1
  /*!
2
- Stencil Mock Doc (CommonJS) v2.15.2 | MIT Licensed | https://stenciljs.com
2
+ Stencil Mock Doc (CommonJS) v2.16.0 | MIT Licensed | https://stenciljs.com
3
3
  */
4
4
  var mockDoc = (function(exports) {
5
5
  'use strict';
@@ -1528,7 +1528,11 @@ class MockNode {
1528
1528
  if (otherNode === this) {
1529
1529
  return true;
1530
1530
  }
1531
- return this.childNodes.includes(otherNode);
1531
+ const childNodes = Array.from(this.childNodes);
1532
+ if (childNodes.includes(otherNode)) {
1533
+ return true;
1534
+ }
1535
+ return childNodes.some((node) => this.contains.bind(node)(otherNode));
1532
1536
  }
1533
1537
  removeChild(childNode) {
1534
1538
  const index = this.childNodes.indexOf(childNode);
@@ -191,6 +191,7 @@ declare class MockLinkElement extends MockHTMLElement {
191
191
  set href(value: string);
192
192
  }
193
193
  declare class MockMetaElement extends MockHTMLElement {
194
+ content: string;
194
195
  constructor(ownerDocument: any);
195
196
  }
196
197
  declare class MockScriptElement extends MockHTMLElement {
@@ -754,6 +755,11 @@ declare class MockWindow {
754
755
  screenY: number;
755
756
  scrollX: number;
756
757
  scrollY: number;
758
+ CustomEvent: typeof MockCustomEvent;
759
+ Event: typeof MockEvent;
760
+ Headers: typeof MockHeaders;
761
+ KeyboardEvent: typeof MockKeyboardEvent;
762
+ MouseEvent: typeof MockMouseEvent;
757
763
  constructor(html?: string | boolean);
758
764
  addEventListener(type: string, handler: (ev?: any) => void): void;
759
765
  alert(msg: string): void;
@@ -791,8 +797,8 @@ declare class MockWindow {
791
797
  get IntersectionObserver(): typeof MockIntersectionObserver;
792
798
  get localStorage(): MockStorage;
793
799
  set localStorage(locStorage: MockStorage);
794
- get location(): Location;
795
- set location(val: Location);
800
+ get location(): MockLocation;
801
+ set location(val: Location | string);
796
802
  matchMedia(): {
797
803
  matches: boolean;
798
804
  };
package/mock-doc/index.js CHANGED
@@ -1,5 +1,5 @@
1
1
  /*!
2
- Stencil Mock Doc v2.15.2 | MIT Licensed | https://stenciljs.com
2
+ Stencil Mock Doc v2.16.0 | MIT Licensed | https://stenciljs.com
3
3
  */
4
4
  const CONTENT_REF_ID = 'r';
5
5
  const ORG_LOCATION_ID = 'o';
@@ -1525,7 +1525,11 @@ class MockNode {
1525
1525
  if (otherNode === this) {
1526
1526
  return true;
1527
1527
  }
1528
- return this.childNodes.includes(otherNode);
1528
+ const childNodes = Array.from(this.childNodes);
1529
+ if (childNodes.includes(otherNode)) {
1530
+ return true;
1531
+ }
1532
+ return childNodes.some((node) => this.contains.bind(node)(otherNode));
1529
1533
  }
1530
1534
  removeChild(childNode) {
1531
1535
  const index = this.childNodes.indexOf(childNode);
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@stencil/core/mock-doc",
3
- "version": "2.15.2",
3
+ "version": "2.16.0",
4
4
  "description": "Mock window, document and DOM outside of a browser environment.",
5
5
  "main": "./index.cjs",
6
6
  "module": "./index.js",
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@stencil/core",
3
- "version": "2.15.2",
3
+ "version": "2.16.0",
4
4
  "license": "MIT",
5
5
  "main": "./internal/stencil-core/index.cjs",
6
6
  "module": "./internal/stencil-core/index.js",
@@ -24,36 +24,38 @@
24
24
  "testing/"
25
25
  ],
26
26
  "scripts": {
27
+ "build": "node scripts --prepare && npm run tsc.prod && npm run rollup.prod.ci",
27
28
  "clean": "rm -rf build/ cli/ compiler/ dev-server/ internal/ mock-doc/ sys/ testing/ && npm run clean-scripts",
28
29
  "clean-scripts": "rm -rf scripts/build",
29
- "start": "npm run watch",
30
- "build": "node scripts --prepare && npm run tsc.prod && npm run rollup.prod.ci",
31
- "watch": "node scripts && npm run tsc && concurrently \"npm run rollup.watch\" \"npm run tsc.watch\"",
30
+ "license": "node scripts --license",
31
+ "lint": "eslint \"src/*.ts\" \"src/**/*.ts\" \"src/**/*.tsx\"",
32
+ "prettier": "npm run prettier.base -- --write",
33
+ "prettier.base": "prettier \"./({bin,scripts,src,test}/**/*.{ts,tsx,js,jsx})|bin/stencil\"",
34
+ "prettier.dry-run": "npm run prettier.base -- --list-different",
32
35
  "release": "node scripts --release --publish",
33
36
  "release.prepare": "node scripts --release --prepare",
34
- "tsc": "tsc --incremental",
35
- "tsc.prod": "tsc",
36
- "tsc.scripts": "tsc -p scripts/tsconfig.json",
37
- "tsc.watch": "tsc --incremental --watch",
38
37
  "rollup": "rollup --config",
39
38
  "rollup.prod": "rollup --config --config-prod",
40
39
  "rollup.prod.ci": "rollup --config --config-prod --config-ci",
41
40
  "rollup.watch": "rollup --watch --config",
42
- "license": "node scripts --license",
43
- "prettier": "npm run prettier.base -- --write",
44
- "prettier.base": "prettier \"./({bin,scripts,src,test}/**/*.{ts,tsx,js,jsx})|bin/stencil\"",
45
- "prettier.dry-run": "npm run prettier.base -- --list-different",
41
+ "start": "npm run watch",
46
42
  "test": "jest --coverage",
47
43
  "test.analysis": "cd test && npm run analysis.build-and-analyze",
44
+ "test.bundlers": "cd test && npm run bundlers",
48
45
  "test.dist": "node scripts --validate-build",
49
46
  "test.end-to-end": "cd test/end-to-end && npm ci && npm test && npm run test.dist",
50
47
  "test.jest": "jest",
51
48
  "test.karma": "cd test/karma && npm ci && npm run karma",
52
49
  "test.karma.prod": "cd test/karma && npm ci && npm run karma.prod",
53
- "test.testing": "node scripts/test/validate-testing.js",
54
50
  "test.prod": "npm run test.dist && npm run test.end-to-end && npm run test.jest && npm run test.karma && npm run test.sys.node && npm run test.testing && npm run test.analysis",
51
+ "test.testing": "node scripts/test/validate-testing.js",
55
52
  "test.watch": "jest --watch",
56
- "test.watch-all": "jest --watchAll --coverage"
53
+ "test.watch-all": "jest --watchAll --coverage",
54
+ "tsc": "tsc --incremental",
55
+ "tsc.prod": "tsc",
56
+ "tsc.scripts": "tsc -p scripts/tsconfig.json",
57
+ "tsc.watch": "tsc --incremental --watch",
58
+ "watch": "node scripts && npm run tsc && concurrently \"npm run rollup.watch\" \"npm run tsc.watch\""
57
59
  },
58
60
  "devDependencies": {
59
61
  "@ionic/prettier-config": "^2.0.0",
@@ -63,6 +65,7 @@
63
65
  "@rollup/plugin-replace": "2.3.4",
64
66
  "@rollup/pluginutils": "4.1.0",
65
67
  "@types/autoprefixer": "^10.2.0",
68
+ "@types/eslint": "^8.4.2",
66
69
  "@types/exit": "^0.1.31",
67
70
  "@types/fs-extra": "^9.0.8",
68
71
  "@types/glob": "^7.1.2",
@@ -83,6 +86,8 @@
83
86
  "@types/webpack": "^4.41.26",
84
87
  "@types/ws": "^7.4.0",
85
88
  "@types/yarnpkg__lockfile": "^1.1.5",
89
+ "@typescript-eslint/eslint-plugin": "^5.20.0",
90
+ "@typescript-eslint/parser": "^5.20.0",
86
91
  "@yarnpkg/lockfile": "^1.1.0",
87
92
  "ansi-colors": "4.1.1",
88
93
  "autoprefixer": "10.2.5",
@@ -91,6 +96,8 @@
91
96
  "core-js-builder": "~3.6.5",
92
97
  "css": "^3.0.0",
93
98
  "dts-bundle-generator": "~5.3.0",
99
+ "eslint": "^8.13.0",
100
+ "eslint-config-prettier": "^8.5.0",
94
101
  "execa": "4.1.0",
95
102
  "exit": "^0.1.2",
96
103
  "fast-deep-equal": "3.1.3",
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@stencil/core/screenshot",
3
- "version": "2.15.2",
3
+ "version": "2.16.0",
4
4
  "description": "Stencil Screenshot.",
5
5
  "main": "./index.js",
6
6
  "types": "./index.d.ts",
package/sys/node/index.js CHANGED
@@ -1,5 +1,5 @@
1
1
  /*!
2
- Stencil Node System v2.15.2 | MIT Licensed | https://stenciljs.com
2
+ Stencil Node System v2.16.0 | MIT Licensed | https://stenciljs.com
3
3
  */
4
4
  function _interopDefaultLegacy(e) {
5
5
  return e && "object" == typeof e && "default" in e ? e : {