@stencil/core 2.15.0 → 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 (52) hide show
  1. package/cli/index.cjs +157 -70
  2. package/cli/index.js +157 -70
  3. package/cli/package.json +1 -1
  4. package/compiler/package.json +1 -1
  5. package/compiler/stencil.js +719 -174
  6. package/compiler/stencil.min.js +2 -2
  7. package/dependencies.json +1 -1
  8. package/dev-server/client/index.js +3 -3
  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 +3 -3
  16. package/internal/app-data/package.json +1 -1
  17. package/internal/client/css-shim.js +2 -2
  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/polyfills/css-shim.js +1 -1
  24. package/internal/client/shadow-css.js +2 -3
  25. package/internal/hydrate/index.js +34 -29
  26. package/internal/hydrate/package.json +1 -1
  27. package/internal/hydrate/runner.js +1 -1
  28. package/internal/hydrate/shadow-css.js +9 -9
  29. package/internal/package.json +1 -1
  30. package/internal/stencil-private.d.ts +39 -3
  31. package/internal/stencil-public-compiler.d.ts +69 -3
  32. package/internal/stencil-public-docs.d.ts +3 -0
  33. package/internal/testing/index.js +34 -29
  34. package/internal/testing/package.json +1 -1
  35. package/internal/testing/shadow-css.js +9 -9
  36. package/mock-doc/index.cjs +18 -4
  37. package/mock-doc/index.d.ts +12 -2
  38. package/mock-doc/index.js +18 -4
  39. package/mock-doc/package.json +1 -1
  40. package/package.json +24 -17
  41. package/screenshot/package.json +1 -1
  42. package/sys/node/autoprefixer.js +1 -1
  43. package/sys/node/index.js +2046 -1338
  44. package/sys/node/node-fetch.js +1 -1
  45. package/sys/node/package.json +1 -1
  46. package/sys/node/worker.js +1 -1
  47. package/testing/index.js +8 -8
  48. package/testing/jest/test/jest-config.spec.d.ts +1 -0
  49. package/testing/jest/test/jest-preprocessor.spec.d.ts +1 -0
  50. package/testing/jest/test/jest-runner.spec.d.ts +1 -0
  51. package/testing/jest/test/jest-serializer.spec.d.ts +1 -0
  52. package/testing/package.json +1 -1
@@ -1 +1 @@
1
- var __assign=this&&this.__assign||function(){return(__assign=Object.assign||function(e){for(var t,r=1,n=arguments.length;r<n;r++)for(var s in t=arguments[r])Object.prototype.hasOwnProperty.call(t,s)&&(e[s]=t[s]);return e}).apply(this,arguments)},StyleNode=function(){this.start=0,this.end=0,this.previous=null,this.parent=null,this.rules=null,this.parsedCssText="",this.cssText="",this.atRule=!1,this.type=0,this.keyframesName="",this.selector="",this.parsedSelector=""};function parse(e){return parseCss(lex(e=clean(e)),e)}function clean(e){return e.replace(RX.comments,"").replace(RX.port,"")}function lex(e){var t=new StyleNode;t.start=0,t.end=e.length;for(var r=t,n=0,s=e.length;n<s;n++)if(e[n]===OPEN_BRACE){r.rules||(r.rules=[]);var o=r,a=o.rules[o.rules.length-1]||null;(r=new StyleNode).start=n+1,r.parent=o,r.previous=a,o.rules.push(r)}else e[n]===CLOSE_BRACE&&(r.end=n+1,r=r.parent||t);return t}function parseCss(e,t){var r=t.substring(e.start,e.end-1);if(e.parsedCssText=e.cssText=r.trim(),e.parent){var n=e.previous?e.previous.end:e.parent.start;r=(r=(r=_expandUnicodeEscapes(r=t.substring(n,e.start-1))).replace(RX.multipleSpaces," ")).substring(r.lastIndexOf(";")+1);var s=e.parsedSelector=e.selector=r.trim();e.atRule=0===s.indexOf(AT_START),e.atRule?0===s.indexOf(MEDIA_START)?e.type=types.MEDIA_RULE:s.match(RX.keyframesRule)&&(e.type=types.KEYFRAMES_RULE,e.keyframesName=e.selector.split(RX.multipleSpaces).pop()):0===s.indexOf(VAR_START)?e.type=types.MIXIN_RULE:e.type=types.STYLE_RULE}var o=e.rules;if(o)for(var a=0,i=o.length,l=void 0;a<i&&(l=o[a]);a++)parseCss(l,t);return e}function _expandUnicodeEscapes(e){return e.replace(/\\([0-9a-f]{1,6})\s/gi,(function(){for(var e=arguments[1],t=6-e.length;t--;)e="0"+e;return"\\"+e}))}var types={STYLE_RULE:1,KEYFRAMES_RULE:7,MEDIA_RULE:4,MIXIN_RULE:1e3},OPEN_BRACE="{",CLOSE_BRACE="}",RX={comments:/\/\*[^*]*\*+([^/*][^*]*\*+)*\//gim,port:/@import[^;]*;/gim,customProp:/(?:^[^;\-\s}]+)?--[^;{}]*?:[^{};]*?(?:[;\n]|$)/gim,mixinProp:/(?:^[^;\-\s}]+)?--[^;{}]*?:[^{};]*?{[^}]*?}(?:[;\n]|$)?/gim,mixinApply:/@apply\s*\(?[^);]*\)?\s*(?:[;\n]|$)?/gim,varApply:/[^;:]*?:[^;]*?var\([^;]*\)(?:[;\n]|$)?/gim,keyframesRule:/^@[^\s]*keyframes/,multipleSpaces:/\s+/g},VAR_START="--",MEDIA_START="@media",AT_START="@";function findRegex(e,t,r){e.lastIndex=0;var n=t.substring(r).match(e);if(n){var s=r+n.index;return{start:s,end:s+n[0].length}}return null}var VAR_USAGE_START=/\bvar\(/,VAR_ASSIGN_START=/\B--[\w-]+\s*:/,COMMENTS=/\/\*[^*]*\*+([^/*][^*]*\*+)*\//gim,TRAILING_LINES=/^[\t ]+\n/gm;function resolveVar(e,t,r){return e[t]?e[t]:r?executeTemplate(r,e):""}function findVarEndIndex(e,t){for(var r=0,n=t;n<e.length;n++){var s=e[n];if("("===s)r++;else if(")"===s&&--r<=0)return n+1}return n}function parseVar(e,t){var r=findRegex(VAR_USAGE_START,e,t);if(!r)return null;var n=findVarEndIndex(e,r.start),s=e.substring(r.end,n-1).split(","),o=s[0],a=s.slice(1);return{start:r.start,end:n,propName:o.trim(),fallback:a.length>0?a.join(",").trim():void 0}}function compileVar(e,t,r){var n=parseVar(e,r);if(!n)return t.push(e.substring(r,e.length)),e.length;var s=n.propName,o=null!=n.fallback?compileTemplate(n.fallback):void 0;return t.push(e.substring(r,n.start),(function(e){return resolveVar(e,s,o)})),n.end}function executeTemplate(e,t){for(var r="",n=0;n<e.length;n++){var s=e[n];r+="string"==typeof s?s:s(t)}return r}function findEndValue(e,t){for(var r=!1,n=!1,s=t;s<e.length;s++){var o=e[s];if(r)n&&'"'===o&&(r=!1),n||"'"!==o||(r=!1);else if('"'===o)r=!0,n=!0;else if("'"===o)r=!0,n=!1;else{if(";"===o)return s+1;if("}"===o)return s}}return s}function removeCustomAssigns(e){for(var t="",r=0;;){var n=findRegex(VAR_ASSIGN_START,e,r),s=n?n.start:e.length;if(t+=e.substring(r,s),!n)break;r=findEndValue(e,s)}return t}function compileTemplate(e){var t=0;e=removeCustomAssigns(e=e.replace(COMMENTS,"")).replace(TRAILING_LINES,"");for(var r=[];t<e.length;)t=compileVar(e,r,t);return r}function resolveValues(e){var t={};e.forEach((function(e){e.declarations.forEach((function(e){t[e.prop]=e.value}))}));for(var r={},n=Object.entries(t),s=function(e){var t=!1;if(n.forEach((function(e){var n=e[0],s=executeTemplate(e[1],r);s!==r[n]&&(r[n]=s,t=!0)})),!t)return"break"},o=0;o<10;o++){if("break"===s())break}return r}function getSelectors(e,t){if(void 0===t&&(t=0),!e.rules)return[];var r=[];return e.rules.filter((function(e){return e.type===types.STYLE_RULE})).forEach((function(e){var n=getDeclarations(e.cssText);n.length>0&&e.parsedSelector.split(",").forEach((function(e){e=e.trim(),r.push({selector:e,declarations:n,specificity:computeSpecificity(),nu:t})})),t++})),r}function computeSpecificity(e){return 1}var IMPORTANT="!important",FIND_DECLARATIONS=/(?:^|[;\s{]\s*)(--[\w-]*?)\s*:\s*(?:((?:'(?:\\'|.)*?'|"(?:\\"|.)*?"|\([^)]*?\)|[^};{])+)|\{([^}]*)\}(?:(?=[;\s}])|$))/gm;function getDeclarations(e){for(var t,r=[];t=FIND_DECLARATIONS.exec(e.trim());){var n=normalizeValue(t[2]),s=n.value,o=n.important;r.push({prop:t[1].trim(),value:compileTemplate(s),important:o})}return r}function normalizeValue(e){var t=(e=e.replace(/\s+/gim," ").trim()).endsWith(IMPORTANT);return t&&(e=e.substr(0,e.length-IMPORTANT.length).trim()),{value:e,important:t}}function getActiveSelectors(e,t,r){var n=[],s=getScopesForElement(t,e);return r.forEach((function(e){return n.push(e)})),s.forEach((function(e){return n.push(e)})),sortSelectors(getSelectorsForScopes(n).filter((function(t){return matches(e,t.selector)})))}function getScopesForElement(e,t){for(var r=[];t;){var n=e.get(t);n&&r.push(n),t=t.parentElement}return r}function getSelectorsForScopes(e){var t=[];return e.forEach((function(e){t.push.apply(t,e.selectors)})),t}function sortSelectors(e){return e.sort((function(e,t){return e.specificity===t.specificity?e.nu-t.nu:e.specificity-t.specificity})),e}function matches(e,t){return":root"===t||"html"===t||e.matches(t)}function parseCSS(e){var t=parse(e),r=compileTemplate(e);return{original:e,template:r,selectors:getSelectors(t),usesCssVars:r.length>1}}function addGlobalStyle(e,t){if(e.some((function(e){return e.styleEl===t})))return!1;var r=parseCSS(t.textContent);return r.styleEl=t,e.push(r),!0}function updateGlobalScopes(e){var t=resolveValues(getSelectorsForScopes(e));e.forEach((function(e){e.usesCssVars&&(e.styleEl.textContent=executeTemplate(e.template,t))}))}function reScope(e,t){var r=e.template.map((function(r){return"string"==typeof r?replaceScope(r,e.scopeId,t):r})),n=e.selectors.map((function(r){return __assign(__assign({},r),{selector:replaceScope(r.selector,e.scopeId,t)})}));return __assign(__assign({},e),{template:r,selectors:n,scopeId:t})}function replaceScope(e,t,r){return e=replaceAll(e,"\\.".concat(t),".".concat(r))}function replaceAll(e,t,r){return e.replace(new RegExp(t,"g"),r)}function loadDocument(e,t){return loadDocumentStyles(e,t),loadDocumentLinks(e,t).then((function(){updateGlobalScopes(t)}))}function startWatcher(e,t){"undefined"!=typeof MutationObserver&&new MutationObserver((function(){loadDocumentStyles(e,t)&&updateGlobalScopes(t)})).observe(document.head,{childList:!0})}function loadDocumentLinks(e,t){for(var r=[],n=e.querySelectorAll('link[rel="stylesheet"][href]:not([data-no-shim])'),s=0;s<n.length;s++)r.push(addGlobalLink(e,t,n[s]));return Promise.all(r)}function loadDocumentStyles(e,t){return Array.from(e.querySelectorAll("style:not([data-styles]):not([data-no-shim])")).map((function(e){return addGlobalStyle(t,e)})).some(Boolean)}function addGlobalLink(e,t,r){var n=r.href;return fetch(n).then((function(e){return e.text()})).then((function(s){if(hasCssVariables(s)&&r.parentNode){hasRelativeUrls(s)&&(s=fixRelativeUrls(s,n));var o=e.createElement("style");o.setAttribute("data-styles",""),o.textContent=s,addGlobalStyle(t,o),r.parentNode.insertBefore(o,r),r.remove()}})).catch((function(e){console.error(e)}))}var CSS_VARIABLE_REGEXP=/[\s;{]--[-a-zA-Z0-9]+\s*:/m;function hasCssVariables(e){return e.indexOf("var(")>-1||CSS_VARIABLE_REGEXP.test(e)}var CSS_URL_REGEXP=/url[\s]*\([\s]*['"]?(?!(?:https?|data)\:|\/)([^\'\"\)]*)[\s]*['"]?\)[\s]*/gim;function hasRelativeUrls(e){return CSS_URL_REGEXP.lastIndex=0,CSS_URL_REGEXP.test(e)}function fixRelativeUrls(e,t){var r=t.replace(/[^/]*$/,"");return e.replace(CSS_URL_REGEXP,(function(e,t){var n=r+t;return e.replace(t,n)}))}var CustomStyle=function(){function e(e,t){this.win=e,this.doc=t,this.count=0,this.hostStyleMap=new WeakMap,this.hostScopeMap=new WeakMap,this.globalScopes=[],this.scopesMap=new Map,this.didInit=!1}return e.prototype.i=function(){var e=this;return this.didInit||!this.win.requestAnimationFrame?Promise.resolve():(this.didInit=!0,new Promise((function(t){e.win.requestAnimationFrame((function(){startWatcher(e.doc,e.globalScopes),loadDocument(e.doc,e.globalScopes).then((function(){return t()}))}))})))},e.prototype.addLink=function(e){var t=this;return addGlobalLink(this.doc,this.globalScopes,e).then((function(){t.updateGlobal()}))},e.prototype.addGlobalStyle=function(e){addGlobalStyle(this.globalScopes,e)&&this.updateGlobal()},e.prototype.createHostStyle=function(e,t,r,n){if(this.hostScopeMap.has(e))throw new Error("host style already created");var s=this.registerHostTemplate(r,t,n),o=this.doc.createElement("style");return o.setAttribute("data-no-shim",""),s.usesCssVars?n?(o["s-sc"]=t="".concat(s.scopeId,"-").concat(this.count),o.textContent="/*needs update*/",this.hostStyleMap.set(e,o),this.hostScopeMap.set(e,reScope(s,t)),this.count++):(s.styleEl=o,s.usesCssVars||(o.textContent=executeTemplate(s.template,{})),this.globalScopes.push(s),this.updateGlobal(),this.hostScopeMap.set(e,s)):o.textContent=r,o},e.prototype.removeHost=function(e){var t=this.hostStyleMap.get(e);t&&t.remove(),this.hostStyleMap.delete(e),this.hostScopeMap.delete(e)},e.prototype.updateHost=function(e){var t=this.hostScopeMap.get(e);if(t&&t.usesCssVars&&t.isScoped){var r=this.hostStyleMap.get(e);if(r){var n=resolveValues(getActiveSelectors(e,this.hostScopeMap,this.globalScopes));r.textContent=executeTemplate(t.template,n)}}},e.prototype.updateGlobal=function(){updateGlobalScopes(this.globalScopes)},e.prototype.registerHostTemplate=function(e,t,r){var n=this.scopesMap.get(t);return n||((n=parseCSS(e)).scopeId=t,n.isScoped=r,this.scopesMap.set(t,n)),n},e}();!function(e){!e||e.__cssshim||e.CSS&&e.CSS.supports&&e.CSS.supports("color","var(--c)")||(e.__cssshim=new CustomStyle(e,e.document))}("undefined"!=typeof window&&window);
1
+ var __assign=this&&this.__assign||function(){return(__assign=Object.assign||function(e){for(var t,r=1,n=arguments.length;r<n;r++)for(var s in t=arguments[r])Object.prototype.hasOwnProperty.call(t,s)&&(e[s]=t[s]);return e}).apply(this,arguments)},StyleNode=function(){this.start=0,this.end=0,this.previous=null,this.parent=null,this.rules=null,this.parsedCssText="",this.cssText="",this.atRule=!1,this.type=0,this.keyframesName="",this.selector="",this.parsedSelector=""};function parse(e){return parseCss(lex(e=clean(e)),e)}function clean(e){return e.replace(RX.comments,"").replace(RX.port,"")}function lex(e){var t=new StyleNode;t.start=0,t.end=e.length;for(var r=t,n=0,s=e.length;n<s;n++)if(e[n]===OPEN_BRACE){r.rules||(r.rules=[]);var o=r,a=o.rules[o.rules.length-1]||null;(r=new StyleNode).start=n+1,r.parent=o,r.previous=a,o.rules.push(r)}else e[n]===CLOSE_BRACE&&(r.end=n+1,r=r.parent||t);return t}function parseCss(e,t){var r=t.substring(e.start,e.end-1);if(e.parsedCssText=e.cssText=r.trim(),e.parent){var n=e.previous?e.previous.end:e.parent.start;r=(r=(r=_expandUnicodeEscapes(r=t.substring(n,e.start-1))).replace(RX.multipleSpaces," ")).substring(r.lastIndexOf(";")+1);var s=e.parsedSelector=e.selector=r.trim();e.atRule=0===s.indexOf(AT_START),e.atRule?0===s.indexOf(MEDIA_START)?e.type=types.MEDIA_RULE:s.match(RX.keyframesRule)&&(e.type=types.KEYFRAMES_RULE,e.keyframesName=e.selector.split(RX.multipleSpaces).pop()):0===s.indexOf(VAR_START)?e.type=types.MIXIN_RULE:e.type=types.STYLE_RULE}var o=e.rules;if(o)for(var a=0,i=o.length,l=void 0;a<i&&(l=o[a]);a++)parseCss(l,t);return e}function _expandUnicodeEscapes(e){return e.replace(/\\([0-9a-f]{1,6})\s/gi,(function(){for(var e=arguments[1],t=6-e.length;t--;)e="0"+e;return"\\"+e}))}var types={STYLE_RULE:1,KEYFRAMES_RULE:7,MEDIA_RULE:4,MIXIN_RULE:1e3},OPEN_BRACE="{",CLOSE_BRACE="}",RX={comments:/\/\*[^*]*\*+([^/*][^*]*\*+)*\//gim,port:/@import[^;]*;/gim,customProp:/(?:^[^;\-\s}]+)?--[^;{}]*?:[^{};]*?(?:[;\n]|$)/gim,mixinProp:/(?:^[^;\-\s}]+)?--[^;{}]*?:[^{};]*?{[^}]*?}(?:[;\n]|$)?/gim,mixinApply:/@apply\s*\(?[^);]*\)?\s*(?:[;\n]|$)?/gim,varApply:/[^;:]*?:[^;]*?var\([^;]*\)(?:[;\n]|$)?/gim,keyframesRule:/^@[^\s]*keyframes/,multipleSpaces:/\s+/g},VAR_START="--",MEDIA_START="@media",AT_START="@";function findRegex(e,t,r){e.lastIndex=0;var n=t.substring(r).match(e);if(n){var s=r+n.index;return{start:s,end:s+n[0].length}}return null}var VAR_USAGE_START=/\bvar\(/,VAR_ASSIGN_START=/\B--[\w-]+\s*:/,COMMENTS=/\/\*[^*]*\*+([^/*][^*]*\*+)*\//gim,TRAILING_LINES=/^[\t ]+\n/gm;function resolveVar(e,t,r){return e[t]?e[t]:r?executeTemplate(r,e):""}function findVarEndIndex(e,t){for(var r=0,n=t;n<e.length;n++){var s=e[n];if("("===s)r++;else if(")"===s&&--r<=0)return n+1}return n}function parseVar(e,t){var r=findRegex(VAR_USAGE_START,e,t);if(!r)return null;var n=findVarEndIndex(e,r.start),s=e.substring(r.end,n-1).split(","),o=s[0],a=s.slice(1);return{start:r.start,end:n,propName:o.trim(),fallback:a.length>0?a.join(",").trim():void 0}}function compileVar(e,t,r){var n=parseVar(e,r);if(!n)return t.push(e.substring(r,e.length)),e.length;var s=n.propName,o=null!=n.fallback?compileTemplate(n.fallback):void 0;return t.push(e.substring(r,n.start),(function(e){return resolveVar(e,s,o)})),n.end}function executeTemplate(e,t){for(var r="",n=0;n<e.length;n++){var s=e[n];r+="string"==typeof s?s:s(t)}return r}function findEndValue(e,t){for(var r=!1,n=!1,s=t;s<e.length;s++){var o=e[s];if(r)n&&'"'===o&&(r=!1),n||"'"!==o||(r=!1);else if('"'===o)r=!0,n=!0;else if("'"===o)r=!0,n=!1;else{if(";"===o)return s+1;if("}"===o)return s}}return s}function removeCustomAssigns(e){for(var t="",r=0;;){var n=findRegex(VAR_ASSIGN_START,e,r),s=n?n.start:e.length;if(t+=e.substring(r,s),!n)break;r=findEndValue(e,s)}return t}function compileTemplate(e){var t=0;e=removeCustomAssigns(e=e.replace(COMMENTS,"")).replace(TRAILING_LINES,"");for(var r=[];t<e.length;)t=compileVar(e,r,t);return r}function resolveValues(e){var t={};e.forEach((function(e){e.declarations.forEach((function(e){t[e.prop]=e.value}))}));for(var r={},n=Object.entries(t),s=function(e){var t=!1;if(n.forEach((function(e){var n=e[0],s=executeTemplate(e[1],r);s!==r[n]&&(r[n]=s,t=!0)})),!t)return"break"},o=0;o<10;o++){if("break"===s())break}return r}function getSelectors(e,t){if(void 0===t&&(t=0),!e.rules)return[];var r=[];return e.rules.filter((function(e){return e.type===types.STYLE_RULE})).forEach((function(e){var n=getDeclarations(e.cssText);n.length>0&&e.parsedSelector.split(",").forEach((function(e){e=e.trim(),r.push({selector:e,declarations:n,specificity:computeSpecificity(),nu:t})})),t++})),r}function computeSpecificity(e){return 1}var IMPORTANT="!important",FIND_DECLARATIONS=/(?:^|[;\s{]\s*)(--[\w-]*?)\s*:\s*(?:((?:'(?:\\'|.)*?'|"(?:\\"|.)*?"|\([^)]*?\)|[^};{])+)|\{([^}]*)\}(?:(?=[;\s}])|$))/gm;function getDeclarations(e){for(var t,r=[];t=FIND_DECLARATIONS.exec(e.trim());){var n=normalizeValue(t[2]),s=n.value,o=n.important;r.push({prop:t[1].trim(),value:compileTemplate(s),important:o})}return r}function normalizeValue(e){var t=(e=e.replace(/\s+/gim," ").trim()).endsWith(IMPORTANT);return t&&(e=e.slice(0,e.length-IMPORTANT.length).trim()),{value:e,important:t}}function getActiveSelectors(e,t,r){var n=[],s=getScopesForElement(t,e);return r.forEach((function(e){return n.push(e)})),s.forEach((function(e){return n.push(e)})),sortSelectors(getSelectorsForScopes(n).filter((function(t){return matches(e,t.selector)})))}function getScopesForElement(e,t){for(var r=[];t;){var n=e.get(t);n&&r.push(n),t=t.parentElement}return r}function getSelectorsForScopes(e){var t=[];return e.forEach((function(e){t.push.apply(t,e.selectors)})),t}function sortSelectors(e){return e.sort((function(e,t){return e.specificity===t.specificity?e.nu-t.nu:e.specificity-t.specificity})),e}function matches(e,t){return":root"===t||"html"===t||e.matches(t)}function parseCSS(e){var t=parse(e),r=compileTemplate(e);return{original:e,template:r,selectors:getSelectors(t),usesCssVars:r.length>1}}function addGlobalStyle(e,t){if(e.some((function(e){return e.styleEl===t})))return!1;var r=parseCSS(t.textContent);return r.styleEl=t,e.push(r),!0}function updateGlobalScopes(e){var t=resolveValues(getSelectorsForScopes(e));e.forEach((function(e){e.usesCssVars&&(e.styleEl.textContent=executeTemplate(e.template,t))}))}function reScope(e,t){var r=e.template.map((function(r){return"string"==typeof r?replaceScope(r,e.scopeId,t):r})),n=e.selectors.map((function(r){return __assign(__assign({},r),{selector:replaceScope(r.selector,e.scopeId,t)})}));return __assign(__assign({},e),{template:r,selectors:n,scopeId:t})}function replaceScope(e,t,r){return e=replaceAll(e,"\\.".concat(t),".".concat(r))}function replaceAll(e,t,r){return e.replace(new RegExp(t,"g"),r)}function loadDocument(e,t){return loadDocumentStyles(e,t),loadDocumentLinks(e,t).then((function(){updateGlobalScopes(t)}))}function startWatcher(e,t){"undefined"!=typeof MutationObserver&&new MutationObserver((function(){loadDocumentStyles(e,t)&&updateGlobalScopes(t)})).observe(document.head,{childList:!0})}function loadDocumentLinks(e,t){for(var r=[],n=e.querySelectorAll('link[rel="stylesheet"][href]:not([data-no-shim])'),s=0;s<n.length;s++)r.push(addGlobalLink(e,t,n[s]));return Promise.all(r)}function loadDocumentStyles(e,t){return Array.from(e.querySelectorAll("style:not([data-styles]):not([data-no-shim])")).map((function(e){return addGlobalStyle(t,e)})).some(Boolean)}function addGlobalLink(e,t,r){var n=r.href;return fetch(n).then((function(e){return e.text()})).then((function(s){if(hasCssVariables(s)&&r.parentNode){hasRelativeUrls(s)&&(s=fixRelativeUrls(s,n));var o=e.createElement("style");o.setAttribute("data-styles",""),o.textContent=s,addGlobalStyle(t,o),r.parentNode.insertBefore(o,r),r.remove()}})).catch((function(e){console.error(e)}))}var CSS_VARIABLE_REGEXP=/[\s;{]--[-a-zA-Z0-9]+\s*:/m;function hasCssVariables(e){return e.indexOf("var(")>-1||CSS_VARIABLE_REGEXP.test(e)}var CSS_URL_REGEXP=/url[\s]*\([\s]*['"]?(?!(?:https?|data)\:|\/)([^\'\"\)]*)[\s]*['"]?\)[\s]*/gim;function hasRelativeUrls(e){return CSS_URL_REGEXP.lastIndex=0,CSS_URL_REGEXP.test(e)}function fixRelativeUrls(e,t){var r=t.replace(/[^/]*$/,"");return e.replace(CSS_URL_REGEXP,(function(e,t){var n=r+t;return e.replace(t,n)}))}var CustomStyle=function(){function e(e,t){this.win=e,this.doc=t,this.count=0,this.hostStyleMap=new WeakMap,this.hostScopeMap=new WeakMap,this.globalScopes=[],this.scopesMap=new Map,this.didInit=!1}return e.prototype.i=function(){var e=this;return this.didInit||!this.win.requestAnimationFrame?Promise.resolve():(this.didInit=!0,new Promise((function(t){e.win.requestAnimationFrame((function(){startWatcher(e.doc,e.globalScopes),loadDocument(e.doc,e.globalScopes).then((function(){return t()}))}))})))},e.prototype.addLink=function(e){var t=this;return addGlobalLink(this.doc,this.globalScopes,e).then((function(){t.updateGlobal()}))},e.prototype.addGlobalStyle=function(e){addGlobalStyle(this.globalScopes,e)&&this.updateGlobal()},e.prototype.createHostStyle=function(e,t,r,n){if(this.hostScopeMap.has(e))throw new Error("host style already created");var s=this.registerHostTemplate(r,t,n),o=this.doc.createElement("style");return o.setAttribute("data-no-shim",""),s.usesCssVars?n?(o["s-sc"]=t="".concat(s.scopeId,"-").concat(this.count),o.textContent="/*needs update*/",this.hostStyleMap.set(e,o),this.hostScopeMap.set(e,reScope(s,t)),this.count++):(s.styleEl=o,s.usesCssVars||(o.textContent=executeTemplate(s.template,{})),this.globalScopes.push(s),this.updateGlobal(),this.hostScopeMap.set(e,s)):o.textContent=r,o},e.prototype.removeHost=function(e){var t=this.hostStyleMap.get(e);t&&t.remove(),this.hostStyleMap.delete(e),this.hostScopeMap.delete(e)},e.prototype.updateHost=function(e){var t=this.hostScopeMap.get(e);if(t&&t.usesCssVars&&t.isScoped){var r=this.hostStyleMap.get(e);if(r){var n=resolveValues(getActiveSelectors(e,this.hostScopeMap,this.globalScopes));r.textContent=executeTemplate(t.template,n)}}},e.prototype.updateGlobal=function(){updateGlobalScopes(this.globalScopes)},e.prototype.registerHostTemplate=function(e,t,r){var n=this.scopesMap.get(t);return n||((n=parseCSS(e)).scopeId=t,n.isScoped=r,this.scopesMap.set(t,n)),n},e}();!function(e){!e||e.__cssshim||e.CSS&&e.CSS.supports&&e.CSS.supports("color","var(--c)")||(e.__cssshim=new CustomStyle(e,e.document))}("undefined"!=typeof window&&window);
@@ -1,5 +1,5 @@
1
1
  /*
2
- Stencil Client Platform v2.15.0 | MIT Licensed | https://stenciljs.com
2
+ Stencil Client Platform v2.16.0 | MIT Licensed | https://stenciljs.com
3
3
  */
4
4
  /**
5
5
  * @license
@@ -15,7 +15,6 @@
15
15
  const safeSelector = (selector) => {
16
16
  const placeholders = [];
17
17
  let index = 0;
18
- let content;
19
18
  // Replaces attribute selectors with placeholders.
20
19
  // The WS in [attr="va lue"] would otherwise be interpreted as a selector separator.
21
20
  selector = selector.replace(/(\[[^\]]*\])/g, (_, keep) => {
@@ -26,7 +25,7 @@ const safeSelector = (selector) => {
26
25
  });
27
26
  // Replaces the expression in `:nth-child(2n + 1)` with a placeholder.
28
27
  // WS and "+" would otherwise be interpreted as selector separators.
29
- content = selector.replace(/(:nth-[-\w]+)(\([^)]+\))/g, (_, pseudo, exp) => {
28
+ const content = selector.replace(/(:nth-[-\w]+)(\([^)]+\))/g, (_, pseudo, exp) => {
30
29
  const replaceBy = `__ph-${index}__`;
31
30
  placeholders.push(exp);
32
31
  index++;
@@ -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.0",
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
@@ -655,7 +655,7 @@ const templateWindows = new Map, createHydrateBuildId = () => {
655
655
  }, commentre = /\/\*[^*]*\*+([^/*][^*]*\*+)*\//g, getCssSelectors = e => {
656
656
  SELECTORS.all.length = SELECTORS.tags.length = SELECTORS.classNames.length = SELECTORS.ids.length = SELECTORS.attrs.length = 0;
657
657
  const t = (e = e.replace(/\./g, " .").replace(/\#/g, " #").replace(/\[/g, " [").replace(/\>/g, " > ").replace(/\+/g, " + ").replace(/\~/g, " ~ ").replace(/\*/g, " * ").replace(/\:not\((.*?)\)/g, " ")).split(" ");
658
- for (let e = 0, r = t.length; e < r; e++) t[e] = t[e].split(":")[0], 0 !== t[e].length && ("." === t[e].charAt(0) ? SELECTORS.classNames.push(t[e].substr(1)) : "#" === t[e].charAt(0) ? SELECTORS.ids.push(t[e].substr(1)) : "[" === t[e].charAt(0) ? (t[e] = t[e].substr(1).split("=")[0].split("]")[0].trim(),
658
+ for (let e = 0, r = t.length; e < r; e++) t[e] = t[e].split(":")[0], 0 !== t[e].length && ("." === t[e].charAt(0) ? SELECTORS.classNames.push(t[e].slice(1)) : "#" === t[e].charAt(0) ? SELECTORS.ids.push(t[e].slice(1)) : "[" === t[e].charAt(0) ? (t[e] = t[e].slice(1).split("=")[0].split("]")[0].trim(),
659
659
  SELECTORS.attrs.push(t[e].toLowerCase())) : /[a-z]/g.test(t[e].charAt(0)) && SELECTORS.tags.push(t[e].toLowerCase()));
660
660
  return SELECTORS.classNames = SELECTORS.classNames.sort(((e, t) => e.length < t.length ? -1 : e.length > t.length ? 1 : 0)),
661
661
  SELECTORS;
@@ -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.0",
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",
@@ -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`.
@@ -1665,6 +1704,7 @@ export interface OutputTargetDist extends OutputTargetBase {
1665
1704
  }
1666
1705
  export interface OutputTargetDistCollection extends OutputTargetBase {
1667
1706
  type: 'dist-collection';
1707
+ empty?: boolean;
1668
1708
  dir: string;
1669
1709
  collectionDir: string;
1670
1710
  }
@@ -1685,6 +1725,7 @@ export interface OutputTargetDistLazy extends OutputTargetBase {
1685
1725
  esmIndexFile?: string;
1686
1726
  cjsIndexFile?: string;
1687
1727
  systemLoaderFile?: string;
1728
+ legacyLoaderFile?: string;
1688
1729
  empty?: boolean;
1689
1730
  }
1690
1731
  export interface OutputTargetDistGlobalStyles extends OutputTargetBase {
@@ -1695,7 +1736,7 @@ export interface OutputTargetDistLazyLoader extends OutputTargetBase {
1695
1736
  type: 'dist-lazy-loader';
1696
1737
  dir: string;
1697
1738
  esmDir: string;
1698
- esmEs5Dir: string;
1739
+ esmEs5Dir?: string;
1699
1740
  cjsDir: string;
1700
1741
  componentDts: string;
1701
1742
  empty: boolean;
@@ -1718,9 +1759,23 @@ export interface OutputTargetCustom extends OutputTargetBase {
1718
1759
  generator: (config: Config, compilerCtx: any, buildCtx: any, docs: any) => Promise<void>;
1719
1760
  copy?: CopyTask[];
1720
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
+ */
1721
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
+ */
1722
1771
  type: 'docs-vscode';
1772
+ /**
1773
+ * The location on disk to write the JSON file.
1774
+ */
1723
1775
  file: string;
1776
+ /**
1777
+ * A base URL to find the source code of the component(s) described in the JSON file.
1778
+ */
1724
1779
  sourceCodeBaseUrl?: string;
1725
1780
  }
1726
1781
  export interface OutputTargetDocsReadme extends OutputTargetBase {
@@ -1777,7 +1832,13 @@ export interface OutputTargetDistCustomElementsBundle extends OutputTargetBaseNe
1777
1832
  includeGlobalScripts?: boolean;
1778
1833
  minify?: boolean;
1779
1834
  }
1835
+ /**
1836
+ * The base type for output targets. All output targets should extend this base type.
1837
+ */
1780
1838
  export interface OutputTargetBase {
1839
+ /**
1840
+ * A unique string to differentiate one output target from another
1841
+ */
1781
1842
  type: string;
1782
1843
  }
1783
1844
  export declare type OutputTargetBuild = OutputTargetDistCollection | OutputTargetDistLazy;
@@ -1897,7 +1958,7 @@ export interface LoadConfigInit {
1897
1958
  * User config object to merge into default config and
1898
1959
  * config loaded from a file path.
1899
1960
  */
1900
- config?: Config;
1961
+ config?: UnvalidatedConfig;
1901
1962
  /**
1902
1963
  * Absolute path to a Stencil config file. This path cannot be
1903
1964
  * relative and it does not resolve config files within a directory.
@@ -1912,8 +1973,13 @@ export interface LoadConfigInit {
1912
1973
  */
1913
1974
  initTsConfig?: boolean;
1914
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
+ */
1915
1981
  export interface LoadConfigResults {
1916
- config: Config;
1982
+ config: UnvalidatedConfig;
1917
1983
  diagnostics: Diagnostic[];
1918
1984
  tsconfig: {
1919
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.0",
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);