@stencil/core 2.15.2 → 2.16.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.
Files changed (48) hide show
  1. package/cli/index.cjs +34 -16
  2. package/cli/index.js +34 -16
  3. package/cli/package.json +1 -1
  4. package/compiler/package.json +1 -1
  5. package/compiler/stencil.js +641 -242
  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 +3 -3
  13. package/dev-server/index.js +1 -1
  14. package/dev-server/package.json +1 -1
  15. package/dev-server/server-process.js +5 -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 +37 -32
  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 +67 -2
  29. package/internal/stencil-public-docs.d.ts +3 -0
  30. package/internal/testing/index.js +35 -30
  31. package/internal/testing/package.json +1 -1
  32. package/internal/testing/shadow-css.js +9 -9
  33. package/mock-doc/index.cjs +8 -2
  34. package/mock-doc/index.d.ts +9 -2
  35. package/mock-doc/index.js +8 -2
  36. package/mock-doc/package.json +1 -1
  37. package/package.json +22 -14
  38. package/screenshot/index.js +2 -0
  39. package/screenshot/package.json +1 -1
  40. package/sys/node/index.js +1 -1
  41. package/sys/node/package.json +1 -1
  42. package/sys/node/worker.js +1 -1
  43. package/testing/index.js +335 -331
  44. package/testing/jest/test/jest-config.spec.d.ts +1 -0
  45. package/testing/jest/test/jest-preprocessor.spec.d.ts +1 -0
  46. package/testing/jest/test/jest-runner.spec.d.ts +1 -0
  47. package/testing/jest/test/jest-serializer.spec.d.ts +1 -0
  48. package/testing/package.json +1 -1
@@ -59,9 +59,9 @@ function hydrateApp(e, t, o, n, s) {
59
59
  enumerable: !0
60
60
  });
61
61
  } else 64 & l && Object.defineProperty(e, n, {
62
- value() {
63
- const e = getHostRef(this), t = arguments;
64
- return e.$onInstancePromise$.then((() => e.$lazyInstance$[n].apply(e.$lazyInstance$, t))).catch(consoleError);
62
+ value(...e) {
63
+ const t = getHostRef(this);
64
+ return t.$onInstancePromise$.then((() => t.$lazyInstance$[n](...e))).catch(consoleError);
65
65
  }
66
66
  });
67
67
  }));
@@ -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.1",
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.1",
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`.
@@ -486,6 +525,7 @@ export interface ConfigFlags {
486
525
  e2e?: boolean;
487
526
  emulate?: string;
488
527
  es5?: boolean;
528
+ esm?: boolean;
489
529
  headless?: boolean;
490
530
  help?: boolean;
491
531
  log?: boolean;
@@ -1720,9 +1760,23 @@ export interface OutputTargetCustom extends OutputTargetBase {
1720
1760
  generator: (config: Config, compilerCtx: any, buildCtx: any, docs: any) => Promise<void>;
1721
1761
  copy?: CopyTask[];
1722
1762
  }
1763
+ /**
1764
+ * Output target for generating [custom data](https://github.com/microsoft/vscode-custom-data) for VS Code as a JSON
1765
+ * file.
1766
+ */
1723
1767
  export interface OutputTargetDocsVscode extends OutputTargetBase {
1768
+ /**
1769
+ * Designates this output target to be used for generating VS Code custom data.
1770
+ * @see OutputTargetBase#type
1771
+ */
1724
1772
  type: 'docs-vscode';
1773
+ /**
1774
+ * The location on disk to write the JSON file.
1775
+ */
1725
1776
  file: string;
1777
+ /**
1778
+ * A base URL to find the source code of the component(s) described in the JSON file.
1779
+ */
1726
1780
  sourceCodeBaseUrl?: string;
1727
1781
  }
1728
1782
  export interface OutputTargetDocsReadme extends OutputTargetBase {
@@ -1779,7 +1833,13 @@ export interface OutputTargetDistCustomElementsBundle extends OutputTargetBaseNe
1779
1833
  includeGlobalScripts?: boolean;
1780
1834
  minify?: boolean;
1781
1835
  }
1836
+ /**
1837
+ * The base type for output targets. All output targets should extend this base type.
1838
+ */
1782
1839
  export interface OutputTargetBase {
1840
+ /**
1841
+ * A unique string to differentiate one output target from another
1842
+ */
1783
1843
  type: string;
1784
1844
  }
1785
1845
  export declare type OutputTargetBuild = OutputTargetDistCollection | OutputTargetDistLazy;
@@ -1899,7 +1959,7 @@ export interface LoadConfigInit {
1899
1959
  * User config object to merge into default config and
1900
1960
  * config loaded from a file path.
1901
1961
  */
1902
- config?: Config;
1962
+ config?: UnvalidatedConfig;
1903
1963
  /**
1904
1964
  * Absolute path to a Stencil config file. This path cannot be
1905
1965
  * relative and it does not resolve config files within a directory.
@@ -1914,8 +1974,13 @@ export interface LoadConfigInit {
1914
1974
  */
1915
1975
  initTsConfig?: boolean;
1916
1976
  }
1977
+ /**
1978
+ * Results from an attempt to load a config. The values on this interface
1979
+ * have not yet been validated and are not ready to be used for arbitrary
1980
+ * operations around the codebase.
1981
+ */
1917
1982
  export interface LoadConfigResults {
1918
- config: Config;
1983
+ config: UnvalidatedConfig;
1919
1984
  diagnostics: Diagnostic[];
1920
1985
  tsconfig: {
1921
1986
  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;
@@ -98,7 +98,7 @@ const defaultConsoleError = e => {
98
98
  caughtErrors.push(new Error(e.join(", ")));
99
99
  }, consoleDevWarn = (...e) => {
100
100
  const t = e.filter((e => "string" == typeof e || "number" == typeof e || "boolean" == typeof e));
101
- console.warn.apply(console, t);
101
+ console.warn(...t);
102
102
  }, nextTick = e => {
103
103
  queuedTicks.push(e);
104
104
  }, win = mockDoc.setupGlobal(global), doc = win.document;
@@ -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.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
@@ -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.1 | 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);
@@ -4263,9 +4267,11 @@ function cloneDocument(srcDoc) {
4263
4267
  const dstWin = cloneWindow(srcDoc.defaultView);
4264
4268
  return dstWin.document;
4265
4269
  }
4270
+ // TODO(STENCIL-345) - Evaluate reconciling MockWindow, Window differences
4266
4271
  /**
4267
4272
  * Constrain setTimeout() to 1ms, but still async. Also
4268
4273
  * only allow setInterval() to fire once, also constrained to 1ms.
4274
+ * @param win the mock window instance to update
4269
4275
  */
4270
4276
  function constrainTimeouts(win) {
4271
4277
  win.__allowInterval = false;
@@ -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
  };
@@ -917,6 +923,7 @@ declare function cloneDocument(srcDoc: Document): Document;
917
923
  /**
918
924
  * Constrain setTimeout() to 1ms, but still async. Also
919
925
  * only allow setInterval() to fire once, also constrained to 1ms.
926
+ * @param win the mock window instance to update
920
927
  */
921
928
  declare function constrainTimeouts(win: any): void;
922
929
  export { MockAttr, MockAttributeMap, MockComment, MockCustomEvent, MockDocument, MockElement, MockHTMLElement, MockHeaders, MockKeyboardEvent, MockMouseEvent, MockNode, MockRequest, MockRequestInfo, MockRequestInit, MockResponse, MockResponseInit, MockTextNode, MockWindow, NODE_TYPES, SerializeNodeToHtmlOptions, cloneAttributes, cloneDocument, cloneWindow, constrainTimeouts, createDocument, createFragment, parseHtmlToDocument, parseHtmlToFragment, patchWindow, resetDocument, serializeNodeToHtml, setupGlobal, teardownGlobal }
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.1 | 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);
@@ -4260,9 +4264,11 @@ function cloneDocument(srcDoc) {
4260
4264
  const dstWin = cloneWindow(srcDoc.defaultView);
4261
4265
  return dstWin.document;
4262
4266
  }
4267
+ // TODO(STENCIL-345) - Evaluate reconciling MockWindow, Window differences
4263
4268
  /**
4264
4269
  * Constrain setTimeout() to 1ms, but still async. Also
4265
4270
  * only allow setInterval() to fire once, also constrained to 1ms.
4271
+ * @param win the mock window instance to update
4266
4272
  */
4267
4273
  function constrainTimeouts(win) {
4268
4274
  win.__allowInterval = false;
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@stencil/core/mock-doc",
3
- "version": "2.15.2",
3
+ "version": "2.16.1",
4
4
  "description": "Mock window, document and DOM outside of a browser environment.",
5
5
  "main": "./index.cjs",
6
6
  "module": "./index.js",