@stencil/core 2.15.1 → 2.16.1-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 (50) hide show
  1. package/cli/index.cjs +115 -27
  2. package/cli/index.js +115 -27
  3. package/cli/package.json +1 -1
  4. package/compiler/package.json +1 -1
  5. package/compiler/stencil.js +821 -291
  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-private.d.ts +39 -3
  29. package/internal/stencil-public-compiler.d.ts +70 -3
  30. package/internal/stencil-public-docs.d.ts +3 -0
  31. package/internal/testing/index.js +35 -30
  32. package/internal/testing/package.json +1 -1
  33. package/internal/testing/shadow-css.js +9 -9
  34. package/mock-doc/index.cjs +8 -2
  35. package/mock-doc/index.d.ts +9 -2
  36. package/mock-doc/index.js +8 -2
  37. package/mock-doc/package.json +1 -1
  38. package/package.json +22 -16
  39. package/screenshot/index.js +2 -0
  40. package/screenshot/package.json +1 -1
  41. package/sys/node/autoprefixer.js +1 -1
  42. package/sys/node/index.js +2038 -1330
  43. package/sys/node/package.json +1 -1
  44. package/sys/node/worker.js +1 -1
  45. package/testing/index.js +335 -331
  46. package/testing/jest/test/jest-config.spec.d.ts +1 -0
  47. package/testing/jest/test/jest-preprocessor.spec.d.ts +1 -0
  48. package/testing/jest/test/jest-runner.spec.d.ts +1 -0
  49. package/testing/jest/test/jest-serializer.spec.d.ts +1 -0
  50. 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.1",
3
+ "version": "2.16.1-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.1",
3
+ "version": "2.16.1-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",
@@ -708,11 +708,29 @@ export interface ComponentCompilerPropertyComplexType {
708
708
  resolved: string;
709
709
  references: ComponentCompilerTypeReferences;
710
710
  }
711
- export interface ComponentCompilerTypeReferences {
712
- [key: string]: ComponentCompilerTypeReference;
713
- }
711
+ /**
712
+ * A record of `ComponentCompilerTypeReference` entities.
713
+ *
714
+ * Each key in this record is intended to be the names of the types used by a component. However, this is not enforced
715
+ * by the type system (I.E. any string can be used as a key).
716
+ *
717
+ * Note any key can be a user defined type or a TypeScript standard type.
718
+ */
719
+ export declare type ComponentCompilerTypeReferences = Record<string, ComponentCompilerTypeReference>;
720
+ /**
721
+ * Describes a reference to a type used by a component.
722
+ */
714
723
  export interface ComponentCompilerTypeReference {
724
+ /**
725
+ * A type may be defined:
726
+ * - locally (in the same file as the component that uses it)
727
+ * - globally
728
+ * - by importing it into a file (and is defined elsewhere)
729
+ */
715
730
  location: 'local' | 'global' | 'import';
731
+ /**
732
+ * The path to the type reference, if applicable (global types should not need a path associated with them)
733
+ */
716
734
  path?: string;
717
735
  }
718
736
  export interface ComponentCompilerStaticEvent {
@@ -2087,11 +2105,29 @@ export interface NewSpecPageOptions {
2087
2105
  attachStyles?: boolean;
2088
2106
  strictBuild?: boolean;
2089
2107
  }
2108
+ /**
2109
+ * A record of `TypesMemberNameData` entities.
2110
+ *
2111
+ * Each key in this record is intended to be the path to a file that declares one or more types used by a component.
2112
+ * However, this is not enforced by the type system - users of this interface should not make any assumptions regarding
2113
+ * the format of the path used as a key (relative vs. absolute)
2114
+ */
2090
2115
  export interface TypesImportData {
2091
2116
  [key: string]: TypesMemberNameData[];
2092
2117
  }
2118
+ /**
2119
+ * A type describing how Stencil may alias an imported type to avoid naming collisions when performing operations such
2120
+ * as generating `components.d.ts` files.
2121
+ */
2093
2122
  export interface TypesMemberNameData {
2123
+ /**
2124
+ * The name of the type as it's used within a file.
2125
+ */
2094
2126
  localName: string;
2127
+ /**
2128
+ * An alias that Stencil may apply to the `localName` to avoid naming collisions. This name does not appear in the
2129
+ * file that is using `localName`.
2130
+ */
2095
2131
  importName?: string;
2096
2132
  }
2097
2133
  export interface TypesModule {
@@ -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;
@@ -1665,6 +1705,7 @@ export interface OutputTargetDist extends OutputTargetBase {
1665
1705
  }
1666
1706
  export interface OutputTargetDistCollection extends OutputTargetBase {
1667
1707
  type: 'dist-collection';
1708
+ empty?: boolean;
1668
1709
  dir: string;
1669
1710
  collectionDir: string;
1670
1711
  }
@@ -1685,6 +1726,7 @@ export interface OutputTargetDistLazy extends OutputTargetBase {
1685
1726
  esmIndexFile?: string;
1686
1727
  cjsIndexFile?: string;
1687
1728
  systemLoaderFile?: string;
1729
+ legacyLoaderFile?: string;
1688
1730
  empty?: boolean;
1689
1731
  }
1690
1732
  export interface OutputTargetDistGlobalStyles extends OutputTargetBase {
@@ -1695,7 +1737,7 @@ export interface OutputTargetDistLazyLoader extends OutputTargetBase {
1695
1737
  type: 'dist-lazy-loader';
1696
1738
  dir: string;
1697
1739
  esmDir: string;
1698
- esmEs5Dir: string;
1740
+ esmEs5Dir?: string;
1699
1741
  cjsDir: string;
1700
1742
  componentDts: string;
1701
1743
  empty: boolean;
@@ -1718,9 +1760,23 @@ export interface OutputTargetCustom extends OutputTargetBase {
1718
1760
  generator: (config: Config, compilerCtx: any, buildCtx: any, docs: any) => Promise<void>;
1719
1761
  copy?: CopyTask[];
1720
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
+ */
1721
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
+ */
1722
1772
  type: 'docs-vscode';
1773
+ /**
1774
+ * The location on disk to write the JSON file.
1775
+ */
1723
1776
  file: string;
1777
+ /**
1778
+ * A base URL to find the source code of the component(s) described in the JSON file.
1779
+ */
1724
1780
  sourceCodeBaseUrl?: string;
1725
1781
  }
1726
1782
  export interface OutputTargetDocsReadme extends OutputTargetBase {
@@ -1777,7 +1833,13 @@ export interface OutputTargetDistCustomElementsBundle extends OutputTargetBaseNe
1777
1833
  includeGlobalScripts?: boolean;
1778
1834
  minify?: boolean;
1779
1835
  }
1836
+ /**
1837
+ * The base type for output targets. All output targets should extend this base type.
1838
+ */
1780
1839
  export interface OutputTargetBase {
1840
+ /**
1841
+ * A unique string to differentiate one output target from another
1842
+ */
1781
1843
  type: string;
1782
1844
  }
1783
1845
  export declare type OutputTargetBuild = OutputTargetDistCollection | OutputTargetDistLazy;
@@ -1897,7 +1959,7 @@ export interface LoadConfigInit {
1897
1959
  * User config object to merge into default config and
1898
1960
  * config loaded from a file path.
1899
1961
  */
1900
- config?: Config;
1962
+ config?: UnvalidatedConfig;
1901
1963
  /**
1902
1964
  * Absolute path to a Stencil config file. This path cannot be
1903
1965
  * relative and it does not resolve config files within a directory.
@@ -1912,8 +1974,13 @@ export interface LoadConfigInit {
1912
1974
  */
1913
1975
  initTsConfig?: boolean;
1914
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
+ */
1915
1982
  export interface LoadConfigResults {
1916
- config: Config;
1983
+ config: UnvalidatedConfig;
1917
1984
  diagnostics: Diagnostic[];
1918
1985
  tsconfig: {
1919
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.1",
3
+ "version": "2.16.1-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.1 | MIT Licensed | https://stenciljs.com
2
+ Stencil Mock Doc (CommonJS) v2.16.1-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);
@@ -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 }