@stencil/core 2.11.0 → 2.14.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.
- package/cli/index.cjs +33 -8
- package/cli/index.js +33 -8
- package/cli/package.json +1 -1
- package/compiler/lib.dom.d.ts +2855 -4909
- package/compiler/lib.dom.iterable.d.ts +42 -66
- package/compiler/lib.es2015.core.d.ts +60 -18
- package/compiler/lib.es2015.iterable.d.ts +3 -11
- package/compiler/lib.es2015.promise.d.ts +2 -74
- package/compiler/lib.es2015.symbol.wellknown.d.ts +3 -3
- package/compiler/lib.es2018.intl.d.ts +23 -11
- package/compiler/lib.es2019.string.d.ts +8 -2
- package/compiler/lib.es2020.bigint.d.ts +2 -2
- package/compiler/lib.es2020.intl.d.ts +173 -114
- package/compiler/lib.es2020.promise.d.ts +2 -3
- package/compiler/lib.es2021.d.ts +1 -0
- package/compiler/lib.es2021.intl.d.ts +44 -0
- package/compiler/lib.es2021.promise.d.ts +8 -1
- package/compiler/lib.es5.d.ts +112 -52
- package/compiler/lib.esnext.intl.d.ts +1 -10
- package/compiler/lib.webworker.d.ts +1013 -1267
- package/compiler/lib.webworker.iterable.d.ts +28 -34
- package/compiler/package.json +1 -1
- package/compiler/stencil.js +391 -112
- package/compiler/stencil.min.js +2 -2
- package/dependencies.json +2 -1
- package/dev-server/client/index.js +1 -1
- package/dev-server/client/package.json +1 -1
- package/dev-server/connector.html +3 -3
- package/dev-server/index.js +1 -1
- package/dev-server/package.json +1 -1
- package/dev-server/server-process.js +16 -5
- package/internal/app-data/package.json +1 -1
- package/internal/client/css-shim.js +2 -2
- package/internal/client/dom.js +1 -1
- package/internal/client/index.js +34 -7
- package/internal/client/package.json +1 -1
- package/internal/client/patch-browser.js +5 -1
- package/internal/client/patch-esm.js +1 -1
- package/internal/client/polyfills/css-shim.js +1 -1
- package/internal/client/shadow-css.js +1 -1
- package/internal/hydrate/index.js +2 -1
- package/internal/hydrate/package.json +1 -1
- package/internal/hydrate/runner.js +1 -1
- package/internal/package.json +1 -1
- package/internal/stencil-public-runtime.d.ts +6 -4
- package/internal/testing/index.js +15 -13
- package/internal/testing/package.json +1 -1
- package/mock-doc/index.cjs +33 -3
- package/mock-doc/index.d.ts +4 -3
- package/mock-doc/index.js +33 -3
- package/mock-doc/package.json +1 -1
- package/package.json +7 -7
- package/readme.md +52 -85
- package/screenshot/package.json +1 -1
- package/sys/node/autoprefixer.js +2 -2
- package/sys/node/index.js +22 -18
- package/sys/node/package.json +1 -1
- package/sys/node/worker.js +1 -1
- package/testing/index.js +430 -402
- package/testing/jest/jest-config.d.ts +11 -0
- package/testing/jest/jest-environment.d.ts +1 -0
- package/testing/jest/jest-preprocessor.d.ts +56 -8
- package/testing/jest/jest-runner.d.ts +4 -0
- package/testing/jest-preset.js +5 -0
- package/testing/package.json +1 -1
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
/*
|
|
2
|
-
Stencil Client Patch Esm v2.
|
|
2
|
+
Stencil Client Patch Esm v2.14.0 | MIT Licensed | https://stenciljs.com
|
|
3
3
|
*/
|
|
4
4
|
import { BUILD } from '@stencil/core/internal/app-data';
|
|
5
5
|
import { CSS, plt, win, promiseResolve } from '@stencil/core';
|
|
@@ -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,"\\."+t,"."+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=s.scopeId+"-"+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.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);
|
|
@@ -281,7 +281,8 @@ const createTime = (e, t = "") => {
|
|
|
281
281
|
t;
|
|
282
282
|
}, validateInputProperties = e => {
|
|
283
283
|
const t = Object.keys(e);
|
|
284
|
-
t.indexOf("
|
|
284
|
+
-1 !== t.indexOf("value") && (t.indexOf("type"), t.indexOf("min"), t.indexOf("max"),
|
|
285
|
+
t.indexOf("step"));
|
|
285
286
|
}, setAccessor = (e, t, o, n, s, l) => {
|
|
286
287
|
if (o !== n) {
|
|
287
288
|
let a = isMemberInElement(e, t), r = t.toLowerCase();
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@stencil/core/internal/hydrate",
|
|
3
|
-
"version": "2.
|
|
3
|
+
"version": "2.14.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
|
|
@@ -305,7 +305,7 @@ function finalizeHydrate(e, t, r, s, n) {
|
|
|
305
305
|
absFilePath: null,
|
|
306
306
|
lines: []
|
|
307
307
|
};
|
|
308
|
-
null != t && (null != t.stack ? s.messageText = t.stack.toString() : null != t.message ? s.messageText = t.message.
|
|
308
|
+
null != t && (null != t.stack ? s.messageText = t.stack.toString() : null != t.message ? s.messageText = t.message.length ? t.message : "UNKNOWN ERROR" : s.messageText = t.toString()),
|
|
309
309
|
null == e || shouldIgnoreError(s.messageText) || e.push(s);
|
|
310
310
|
})(t, e);
|
|
311
311
|
}
|
package/internal/package.json
CHANGED
|
@@ -666,7 +666,7 @@ export declare namespace JSXBase {
|
|
|
666
666
|
use: JSXBase.SVGAttributes;
|
|
667
667
|
view: JSXBase.SVGAttributes;
|
|
668
668
|
}
|
|
669
|
-
interface SlotAttributes {
|
|
669
|
+
interface SlotAttributes extends JSXAttributes {
|
|
670
670
|
name?: string;
|
|
671
671
|
slot?: string;
|
|
672
672
|
onSlotchange?: (event: Event) => void;
|
|
@@ -1427,9 +1427,7 @@ export declare namespace JSXBase {
|
|
|
1427
1427
|
z?: number | string;
|
|
1428
1428
|
zoomAndPan?: string;
|
|
1429
1429
|
}
|
|
1430
|
-
interface DOMAttributes<T
|
|
1431
|
-
key?: string | number;
|
|
1432
|
-
ref?: (elm?: T) => void;
|
|
1430
|
+
interface DOMAttributes<T> extends JSXAttributes<T> {
|
|
1433
1431
|
slot?: string;
|
|
1434
1432
|
part?: string;
|
|
1435
1433
|
exportparts?: string;
|
|
@@ -1550,6 +1548,10 @@ export declare namespace JSXBase {
|
|
|
1550
1548
|
onTransitionEndCapture?: (event: TransitionEvent) => void;
|
|
1551
1549
|
}
|
|
1552
1550
|
}
|
|
1551
|
+
export interface JSXAttributes<T = Element> {
|
|
1552
|
+
key?: string | number;
|
|
1553
|
+
ref?: (elm?: T) => void;
|
|
1554
|
+
}
|
|
1553
1555
|
export interface CustomElementsDefineOptions {
|
|
1554
1556
|
exclude?: string[];
|
|
1555
1557
|
resourcesUrl?: string;
|
|
@@ -228,8 +228,10 @@ const createTime = (e, t = "") => {
|
|
|
228
228
|
return t.$attrs$ = e.vattrs, t.$children$ = e.vchildren, t.$key$ = e.vkey, t.$name$ = e.vname,
|
|
229
229
|
t;
|
|
230
230
|
}, validateInputProperties = e => {
|
|
231
|
-
const t = Object.keys(e), a = t.indexOf("
|
|
232
|
-
-1
|
|
231
|
+
const t = Object.keys(e), a = t.indexOf("value");
|
|
232
|
+
if (-1 === a) return;
|
|
233
|
+
const o = t.indexOf("type"), s = t.indexOf("min"), n = t.indexOf("max"), l = t.indexOf("step");
|
|
234
|
+
(a < o || a < s || a < n || a < l) && consoleDevWarn('The "value" prop of <input> should be set after "min", "max", "type" and "step"');
|
|
233
235
|
}, setAccessor = (e, t, a, o, s, n) => {
|
|
234
236
|
if (a !== o) {
|
|
235
237
|
let l = isMemberInElement(e, t), r = t.toLowerCase();
|
|
@@ -303,20 +305,20 @@ const createElm = (e, t, a, o) => {
|
|
|
303
305
|
appData.BUILD.vdomText && null !== l ? appData.BUILD.vdomText && appData.BUILD.slotRelocation && (r = a["s-cr"]) ? r.parentNode.textContent = l : appData.BUILD.vdomText && e.$text$ !== l && (a.data = l) : (appData.BUILD.svg && (isSvgMode = "svg" === n || "foreignObject" !== n && isSvgMode),
|
|
304
306
|
(appData.BUILD.vdomAttribute || appData.BUILD.reflect) && (appData.BUILD.slot && "slot" === n || updateElement(e, t, isSvgMode)),
|
|
305
307
|
appData.BUILD.updatable && null !== o && null !== s ? ((e, t, a, o) => {
|
|
306
|
-
let s, n, l = 0, r = 0, p = 0, i = 0, d = t.length - 1, c = t[0], $ = t[d],
|
|
307
|
-
for (;l <= d && r <=
|
|
308
|
-
c = t[++l],
|
|
309
|
-
patch(c, h), e.insertBefore(c.$elm$, $.$elm$.nextSibling), c = t[++l], h = o[--
|
|
310
|
-
patch($,
|
|
311
|
-
if (p = -1, appData.BUILD.vdomKey) for (i = l; i <= d; ++i) if (t[i] && null !== t[i].$key$ && t[i].$key$ ===
|
|
308
|
+
let s, n, l = 0, r = 0, p = 0, i = 0, d = t.length - 1, c = t[0], $ = t[d], u = o.length - 1, m = o[0], h = o[u];
|
|
309
|
+
for (;l <= d && r <= u; ) if (null == c) c = t[++l]; else if (null == $) $ = t[--d]; else if (null == m) m = o[++r]; else if (null == h) h = o[--u]; else if (isSameVnode(c, m)) patch(c, m),
|
|
310
|
+
c = t[++l], m = o[++r]; else if (isSameVnode($, h)) patch($, h), $ = t[--d], h = o[--u]; else if (isSameVnode(c, h)) !appData.BUILD.slotRelocation || "slot" !== c.$tag$ && "slot" !== h.$tag$ || putBackInOriginalLocation(c.$elm$.parentNode, !1),
|
|
311
|
+
patch(c, h), e.insertBefore(c.$elm$, $.$elm$.nextSibling), c = t[++l], h = o[--u]; else if (isSameVnode($, m)) !appData.BUILD.slotRelocation || "slot" !== c.$tag$ && "slot" !== h.$tag$ || putBackInOriginalLocation($.$elm$.parentNode, !1),
|
|
312
|
+
patch($, m), e.insertBefore($.$elm$, c.$elm$), $ = t[--d], m = o[++r]; else {
|
|
313
|
+
if (p = -1, appData.BUILD.vdomKey) for (i = l; i <= d; ++i) if (t[i] && null !== t[i].$key$ && t[i].$key$ === m.$key$) {
|
|
312
314
|
p = i;
|
|
313
315
|
break;
|
|
314
316
|
}
|
|
315
|
-
appData.BUILD.vdomKey && p >= 0 ? (n = t[p], n.$tag$ !==
|
|
316
|
-
t[p] = void 0, s = n.$elm$),
|
|
317
|
+
appData.BUILD.vdomKey && p >= 0 ? (n = t[p], n.$tag$ !== m.$tag$ ? s = createElm(t && t[r], a, p, e) : (patch(n, m),
|
|
318
|
+
t[p] = void 0, s = n.$elm$), m = o[++r]) : (s = createElm(t && t[r], a, r, e), m = o[++r]),
|
|
317
319
|
s && (appData.BUILD.slotRelocation ? parentReferenceNode(c.$elm$).insertBefore(s, referenceNode(c.$elm$)) : c.$elm$.parentNode.insertBefore(s, c.$elm$));
|
|
318
320
|
}
|
|
319
|
-
l > d ? addVnodes(e, null == o[
|
|
321
|
+
l > d ? addVnodes(e, null == o[u + 1] ? null : o[u + 1].$elm$, a, o, r, u) : appData.BUILD.updatable && r > u && removeVnodes(t, l, d);
|
|
320
322
|
})(a, o, t, s) : null !== s ? (appData.BUILD.updatable && appData.BUILD.vdomText && null !== e.$text$ && (a.textContent = ""),
|
|
321
323
|
addVnodes(a, null, t, s, 0, s.length - 1)) : appData.BUILD.updatable && null !== o && removeVnodes(o, 0, o.length - 1),
|
|
322
324
|
appData.BUILD.svg && isSvgMode && "svg" === n && (isSvgMode = !1));
|
|
@@ -923,10 +925,10 @@ exports.addHostEventListeners = addHostEventListeners, exports.bootstrapLazy = (
|
|
|
923
925
|
}
|
|
924
926
|
})();
|
|
925
927
|
const a = createTime("bootstrapLazy"), o = [], s = t.exclude || [], n = win.customElements, l = doc.head, r = l.querySelector("meta[charset]"), p = doc.createElement("style"), i = [], d = doc.querySelectorAll("[sty-id]");
|
|
926
|
-
let c, $ = !0,
|
|
928
|
+
let c, $ = !0, u = 0;
|
|
927
929
|
if (Object.assign(plt, t), plt.$resourcesUrl$ = new URL(t.resourcesUrl || "./", doc.baseURI).href,
|
|
928
930
|
appData.BUILD.asyncQueue && t.syncQueue && (plt.$flags$ |= 4), appData.BUILD.hydrateClientSide && (plt.$flags$ |= 2),
|
|
929
|
-
appData.BUILD.hydrateClientSide && appData.BUILD.shadowDom) for (;
|
|
931
|
+
appData.BUILD.hydrateClientSide && appData.BUILD.shadowDom) for (;u < d.length; u++) registerStyle(d[u].getAttribute("sty-id"), d[u].innerHTML.replace(/\/\*!@([^\/]+)\*\/[^\{]+\{/g, "$1{"));
|
|
930
932
|
e.map((e => {
|
|
931
933
|
e[1].map((a => {
|
|
932
934
|
const l = {
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@stencil/core/internal/testing",
|
|
3
|
-
"version": "2.
|
|
3
|
+
"version": "2.14.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
|
package/mock-doc/index.cjs
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
/*!
|
|
2
|
-
Stencil Mock Doc (CommonJS) v2.
|
|
2
|
+
Stencil Mock Doc (CommonJS) v2.14.0 | MIT Licensed | https://stenciljs.com
|
|
3
3
|
*/
|
|
4
4
|
var mockDoc = (function(exports) {
|
|
5
5
|
'use strict';
|
|
@@ -222,7 +222,7 @@ class MockCustomElementRegistry {
|
|
|
222
222
|
whenDefined(tagName) {
|
|
223
223
|
tagName = tagName.toLowerCase();
|
|
224
224
|
if (this.__registry != null && this.__registry.has(tagName) === true) {
|
|
225
|
-
return Promise.resolve();
|
|
225
|
+
return Promise.resolve(this.__registry.get(tagName).cstr);
|
|
226
226
|
}
|
|
227
227
|
return new Promise((resolve) => {
|
|
228
228
|
if (this.__whenDefined == null) {
|
|
@@ -547,7 +547,7 @@ class MockCSSStyleDeclaration {
|
|
|
547
547
|
const splt = rule.split(':');
|
|
548
548
|
if (splt.length > 1) {
|
|
549
549
|
const prop = splt[0].trim();
|
|
550
|
-
const value = splt
|
|
550
|
+
const value = splt.slice(1).join(':').trim();
|
|
551
551
|
if (prop !== '' && value !== '') {
|
|
552
552
|
this._styles.set(jsCaseToCssCase(prop), value);
|
|
553
553
|
}
|
|
@@ -629,6 +629,21 @@ class MockEvent {
|
|
|
629
629
|
stopImmediatePropagation() {
|
|
630
630
|
this.cancelBubble = true;
|
|
631
631
|
}
|
|
632
|
+
composedPath() {
|
|
633
|
+
const composedPath = [];
|
|
634
|
+
let currentElement = this.target;
|
|
635
|
+
while (currentElement) {
|
|
636
|
+
composedPath.push(currentElement);
|
|
637
|
+
if (!currentElement.parentElement && currentElement.nodeName === "#document" /* DOCUMENT_NODE */) {
|
|
638
|
+
// the current element doesn't have a parent, but we've detected it's our root document node. push the window
|
|
639
|
+
// object associated with the document onto the path
|
|
640
|
+
composedPath.push(currentElement.defaultView);
|
|
641
|
+
break;
|
|
642
|
+
}
|
|
643
|
+
currentElement = currentElement.parentElement;
|
|
644
|
+
}
|
|
645
|
+
return composedPath;
|
|
646
|
+
}
|
|
632
647
|
}
|
|
633
648
|
class MockCustomEvent extends MockEvent {
|
|
634
649
|
constructor(type, customEventInitDic) {
|
|
@@ -1510,6 +1525,9 @@ class MockNode {
|
|
|
1510
1525
|
return null;
|
|
1511
1526
|
}
|
|
1512
1527
|
contains(otherNode) {
|
|
1528
|
+
if (otherNode === this) {
|
|
1529
|
+
return true;
|
|
1530
|
+
}
|
|
1513
1531
|
return this.childNodes.includes(otherNode);
|
|
1514
1532
|
}
|
|
1515
1533
|
removeChild(childNode) {
|
|
@@ -3452,9 +3470,19 @@ class MockPerformance {
|
|
|
3452
3470
|
getEntriesByType() {
|
|
3453
3471
|
return [];
|
|
3454
3472
|
}
|
|
3473
|
+
// Stencil's implementation of `mark` is non-compliant with the `Performance` interface. Because Stencil will
|
|
3474
|
+
// instantiate an instance of this class and may attempt to assign it to a variable of type `Performance`, the return
|
|
3475
|
+
// type must match the `Performance` interface (rather than typing this function as returning `void` and ignoring the
|
|
3476
|
+
// associated errors returned by the type checker)
|
|
3477
|
+
// @ts-ignore
|
|
3455
3478
|
mark() {
|
|
3456
3479
|
//
|
|
3457
3480
|
}
|
|
3481
|
+
// Stencil's implementation of `measure` is non-compliant with the `Performance` interface. Because Stencil will
|
|
3482
|
+
// instantiate an instance of this class and may attempt to assign it to a variable of type `Performance`, the return
|
|
3483
|
+
// type must match the `Performance` interface (rather than typing this function as returning `void` and ignoring the
|
|
3484
|
+
// associated errors returned by the type checker)
|
|
3485
|
+
// @ts-ignore
|
|
3458
3486
|
measure() {
|
|
3459
3487
|
//
|
|
3460
3488
|
}
|
|
@@ -4204,6 +4232,8 @@ function cloneWindow(srcWin, opts = {}) {
|
|
|
4204
4232
|
}
|
|
4205
4233
|
const clonedWin = new MockWindow(false);
|
|
4206
4234
|
if (!opts.customElementProxy) {
|
|
4235
|
+
// TODO(STENCIL-345) - Evaluate reconciling MockWindow, Window differences
|
|
4236
|
+
// @ts-ignore
|
|
4207
4237
|
srcWin.customElements = null;
|
|
4208
4238
|
}
|
|
4209
4239
|
if (srcWin.document != null) {
|
package/mock-doc/index.d.ts
CHANGED
|
@@ -103,7 +103,7 @@ declare class MockCustomElementRegistry implements CustomElementRegistry {
|
|
|
103
103
|
get(tagName: string): any;
|
|
104
104
|
upgrade(_rootNode: any): void;
|
|
105
105
|
clear(): void;
|
|
106
|
-
whenDefined(tagName: string): Promise<
|
|
106
|
+
whenDefined(tagName: string): Promise<CustomElementConstructor>;
|
|
107
107
|
}
|
|
108
108
|
declare function createCustomElement(customElements: MockCustomElementRegistry, ownerDocument: any, tagName: string): any;
|
|
109
109
|
declare function connectNode(ownerDocument: any, node: MockNode): void;
|
|
@@ -283,6 +283,7 @@ declare class MockEvent {
|
|
|
283
283
|
preventDefault(): void;
|
|
284
284
|
stopPropagation(): void;
|
|
285
285
|
stopImmediatePropagation(): void;
|
|
286
|
+
composedPath(): MockElement[];
|
|
286
287
|
}
|
|
287
288
|
declare class MockCustomEvent extends MockEvent {
|
|
288
289
|
detail: any;
|
|
@@ -637,8 +638,8 @@ declare class MockPerformance implements Performance {
|
|
|
637
638
|
getEntries(): any;
|
|
638
639
|
getEntriesByName(): any;
|
|
639
640
|
getEntriesByType(): any;
|
|
640
|
-
mark():
|
|
641
|
-
measure():
|
|
641
|
+
mark(): PerformanceMark;
|
|
642
|
+
measure(): PerformanceMeasure;
|
|
642
643
|
get navigation(): any;
|
|
643
644
|
now(): number;
|
|
644
645
|
get onresourcetimingbufferfull(): any;
|
package/mock-doc/index.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
/*!
|
|
2
|
-
Stencil Mock Doc v2.
|
|
2
|
+
Stencil Mock Doc v2.14.0 | MIT Licensed | https://stenciljs.com
|
|
3
3
|
*/
|
|
4
4
|
const CONTENT_REF_ID = 'r';
|
|
5
5
|
const ORG_LOCATION_ID = 'o';
|
|
@@ -219,7 +219,7 @@ class MockCustomElementRegistry {
|
|
|
219
219
|
whenDefined(tagName) {
|
|
220
220
|
tagName = tagName.toLowerCase();
|
|
221
221
|
if (this.__registry != null && this.__registry.has(tagName) === true) {
|
|
222
|
-
return Promise.resolve();
|
|
222
|
+
return Promise.resolve(this.__registry.get(tagName).cstr);
|
|
223
223
|
}
|
|
224
224
|
return new Promise((resolve) => {
|
|
225
225
|
if (this.__whenDefined == null) {
|
|
@@ -544,7 +544,7 @@ class MockCSSStyleDeclaration {
|
|
|
544
544
|
const splt = rule.split(':');
|
|
545
545
|
if (splt.length > 1) {
|
|
546
546
|
const prop = splt[0].trim();
|
|
547
|
-
const value = splt
|
|
547
|
+
const value = splt.slice(1).join(':').trim();
|
|
548
548
|
if (prop !== '' && value !== '') {
|
|
549
549
|
this._styles.set(jsCaseToCssCase(prop), value);
|
|
550
550
|
}
|
|
@@ -626,6 +626,21 @@ class MockEvent {
|
|
|
626
626
|
stopImmediatePropagation() {
|
|
627
627
|
this.cancelBubble = true;
|
|
628
628
|
}
|
|
629
|
+
composedPath() {
|
|
630
|
+
const composedPath = [];
|
|
631
|
+
let currentElement = this.target;
|
|
632
|
+
while (currentElement) {
|
|
633
|
+
composedPath.push(currentElement);
|
|
634
|
+
if (!currentElement.parentElement && currentElement.nodeName === "#document" /* DOCUMENT_NODE */) {
|
|
635
|
+
// the current element doesn't have a parent, but we've detected it's our root document node. push the window
|
|
636
|
+
// object associated with the document onto the path
|
|
637
|
+
composedPath.push(currentElement.defaultView);
|
|
638
|
+
break;
|
|
639
|
+
}
|
|
640
|
+
currentElement = currentElement.parentElement;
|
|
641
|
+
}
|
|
642
|
+
return composedPath;
|
|
643
|
+
}
|
|
629
644
|
}
|
|
630
645
|
class MockCustomEvent extends MockEvent {
|
|
631
646
|
constructor(type, customEventInitDic) {
|
|
@@ -1507,6 +1522,9 @@ class MockNode {
|
|
|
1507
1522
|
return null;
|
|
1508
1523
|
}
|
|
1509
1524
|
contains(otherNode) {
|
|
1525
|
+
if (otherNode === this) {
|
|
1526
|
+
return true;
|
|
1527
|
+
}
|
|
1510
1528
|
return this.childNodes.includes(otherNode);
|
|
1511
1529
|
}
|
|
1512
1530
|
removeChild(childNode) {
|
|
@@ -3449,9 +3467,19 @@ class MockPerformance {
|
|
|
3449
3467
|
getEntriesByType() {
|
|
3450
3468
|
return [];
|
|
3451
3469
|
}
|
|
3470
|
+
// Stencil's implementation of `mark` is non-compliant with the `Performance` interface. Because Stencil will
|
|
3471
|
+
// instantiate an instance of this class and may attempt to assign it to a variable of type `Performance`, the return
|
|
3472
|
+
// type must match the `Performance` interface (rather than typing this function as returning `void` and ignoring the
|
|
3473
|
+
// associated errors returned by the type checker)
|
|
3474
|
+
// @ts-ignore
|
|
3452
3475
|
mark() {
|
|
3453
3476
|
//
|
|
3454
3477
|
}
|
|
3478
|
+
// Stencil's implementation of `measure` is non-compliant with the `Performance` interface. Because Stencil will
|
|
3479
|
+
// instantiate an instance of this class and may attempt to assign it to a variable of type `Performance`, the return
|
|
3480
|
+
// type must match the `Performance` interface (rather than typing this function as returning `void` and ignoring the
|
|
3481
|
+
// associated errors returned by the type checker)
|
|
3482
|
+
// @ts-ignore
|
|
3455
3483
|
measure() {
|
|
3456
3484
|
//
|
|
3457
3485
|
}
|
|
@@ -4201,6 +4229,8 @@ function cloneWindow(srcWin, opts = {}) {
|
|
|
4201
4229
|
}
|
|
4202
4230
|
const clonedWin = new MockWindow(false);
|
|
4203
4231
|
if (!opts.customElementProxy) {
|
|
4232
|
+
// TODO(STENCIL-345) - Evaluate reconciling MockWindow, Window differences
|
|
4233
|
+
// @ts-ignore
|
|
4204
4234
|
srcWin.customElements = null;
|
|
4205
4235
|
}
|
|
4206
4236
|
if (srcWin.document != null) {
|
package/mock-doc/package.json
CHANGED
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@stencil/core",
|
|
3
|
-
"version": "2.
|
|
3
|
+
"version": "2.14.0",
|
|
4
4
|
"license": "MIT",
|
|
5
5
|
"main": "./internal/stencil-core/index.cjs",
|
|
6
6
|
"module": "./internal/stencil-core/index.js",
|
|
@@ -68,7 +68,7 @@
|
|
|
68
68
|
"@types/graceful-fs": "^4.1.5",
|
|
69
69
|
"@types/inquirer": "^7.3.1",
|
|
70
70
|
"@types/is-glob": "^4.0.1",
|
|
71
|
-
"@types/jest": "^
|
|
71
|
+
"@types/jest": "^27.0.3",
|
|
72
72
|
"@types/listr": "^0.14.2",
|
|
73
73
|
"@types/mime-types": "^2.1.0",
|
|
74
74
|
"@types/node": "^14.14.35",
|
|
@@ -98,9 +98,9 @@
|
|
|
98
98
|
"graceful-fs": "~4.2.6",
|
|
99
99
|
"hash.js": "^1.1.7",
|
|
100
100
|
"inquirer": "^7.3.3",
|
|
101
|
-
"jest": "^
|
|
102
|
-
"jest-cli": "^
|
|
103
|
-
"jest-environment-node": "^
|
|
101
|
+
"jest": "^27.4.5",
|
|
102
|
+
"jest-cli": "^27.4.5",
|
|
103
|
+
"jest-environment-node": "^27.4.4",
|
|
104
104
|
"listr": "^0.14.3",
|
|
105
105
|
"magic-string": "^0.25.7",
|
|
106
106
|
"merge-source-map": "^1.1.0",
|
|
@@ -113,7 +113,7 @@
|
|
|
113
113
|
"path-browserify": "^1.0.1",
|
|
114
114
|
"pixelmatch": "4.0.2",
|
|
115
115
|
"postcss": "^8.2.8",
|
|
116
|
-
"prettier": "2.
|
|
116
|
+
"prettier": "2.5.1",
|
|
117
117
|
"prompts": "2.4.0",
|
|
118
118
|
"puppeteer": "~10.0.0",
|
|
119
119
|
"rollup": "2.42.3",
|
|
@@ -123,7 +123,7 @@
|
|
|
123
123
|
"sizzle": "^2.3.6",
|
|
124
124
|
"terser": "5.6.1",
|
|
125
125
|
"tslib": "^2.1.0",
|
|
126
|
-
"typescript": "4.
|
|
126
|
+
"typescript": "4.5.4",
|
|
127
127
|
"webpack": "^4.46.0",
|
|
128
128
|
"ws": "7.4.6"
|
|
129
129
|
},
|
package/readme.md
CHANGED
|
@@ -1,34 +1,56 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
1
|
+
<p align="center">
|
|
2
|
+
<a href="#">
|
|
3
|
+
<img alt="stencil-logo" src="https://github.com/ionic-team/stencil/blob/main/stencil-logo.png" width="60">
|
|
4
|
+
</a>
|
|
5
|
+
</p>
|
|
6
|
+
|
|
7
|
+
<h1 align="center">
|
|
8
|
+
Stencil
|
|
9
|
+
</h1>
|
|
10
|
+
|
|
11
|
+
<p align="center">
|
|
12
|
+
A compiler for generating <a href="https://www.webcomponents.org/introduction">Web Components</a>
|
|
13
|
+
</p>
|
|
14
|
+
|
|
15
|
+
<p align="center">
|
|
16
|
+
<a href="https://www.npmjs.com/package/@stencil/core">
|
|
17
|
+
<img src="https://img.shields.io/npm/v/@stencil/core.svg" alt="StencilJS is released under the MIT license." /></a>
|
|
18
|
+
<a href="https://github.com/ionic-team/stencil/blob/main/LICENSE.md">
|
|
19
|
+
<img src="https://img.shields.io/badge/license-MIT-yellow.svg" alt="StencilJS is released under the MIT license." />
|
|
20
|
+
</a>
|
|
21
|
+
<a href="https://github.com/ionic-team/stencil/blob/main/.github/CONTRIBUTING.md">
|
|
22
|
+
<img src="https://img.shields.io/badge/PRs-welcome-brightgreen.svg" alt="PRs welcome!" />
|
|
23
|
+
</a>
|
|
24
|
+
<a href="https://twitter.com/stenciljs">
|
|
25
|
+
<img src="https://img.shields.io/twitter/follow/stenciljs.svg?label=Follow%20@stenciljs" alt="Follow @stenciljs">
|
|
26
|
+
</a>
|
|
27
|
+
</p>
|
|
28
|
+
|
|
29
|
+
<h2 align="center">
|
|
30
|
+
<a href="https://stenciljs.com/docs/getting-started#starting-a-new-project">Quick Start</a>
|
|
31
|
+
<span> · </span>
|
|
32
|
+
<a href="https://stenciljs.com/docs/introduction">Documentation</a>
|
|
33
|
+
<span> · </span>
|
|
34
|
+
<a href="https://github.com/ionic-team/stencil/blob/main/.github/CONTRIBUTING.md">Contribute</a>
|
|
35
|
+
<span> · </span>
|
|
36
|
+
<a href="https://ionicframework.com/blog/tag/stencil/">Blog</a>
|
|
37
|
+
<br />
|
|
38
|
+
Community:
|
|
39
|
+
<a href="https://stencil-worldwide.herokuapp.com">Slack</a>
|
|
40
|
+
<span> · </span>
|
|
41
|
+
<a href="https://forum.ionicframework.com/c/stencil/21/">Forums</a>
|
|
42
|
+
<span> · </span>
|
|
43
|
+
<a href="https://twitter.com/stenciljs">Twitter</a>
|
|
44
|
+
</h2>
|
|
45
|
+
|
|
46
|
+
[Stencil](https://stenciljs.com/) is a simple compiler for generating Web Components and static site generated progressive web apps (PWA). Stencil was built by the [Ionic](https://ionic.io/) team for its next generation of performant mobile and desktop Web Components.
|
|
47
|
+
|
|
48
|
+
Stencil combines the best concepts of the most popular frontend frameworks into a compile-time rather than run-time tool. It combines TypeScript, JSX, an asynchronous rendering pipeline to ensure smooth running animations and lazy-loading, to generate 100% standards-based Web Components that run on both [modern browsers and legacy browsers](https://stenciljs.com/docs/browser-support).
|
|
15
49
|
|
|
16
50
|
Stencil components are just Web Components, so they work in any major framework or with no framework at all. In many cases, Stencil can be used as a drop in replacement for traditional frontend frameworks given the capabilities now available in the browser, though using it as such is certainly not required.
|
|
17
51
|
|
|
18
52
|
Stencil also enables a number of key capabilities on top of Web Components, in particular Server Side Rendering (SSR) without the need to run a headless browser, pre-rendering, and objects-as-properties (instead of just strings).
|
|
19
53
|
|
|
20
|
-
*Note: Stencil and [Ionic Framework](https://ionicframework.com/) are completely independent projects. Stencil does not prescribe any specific UI framework, but Ionic Framework is the largest user of Stencil (today!)*
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
## Why Stencil?
|
|
24
|
-
|
|
25
|
-
Stencil is a new approach to a popular idea: building fast and feature-rich apps in the browser. Stencil was created to take advantage of major new capabilities available natively in the browser, such as Custom Elements v1, enabling developers to ship far less code and build faster apps that are compatible with any and all frameworks.
|
|
26
|
-
|
|
27
|
-
Stencil is also a solution to organizations and library authors struggling to build reusable components across a diverse spectrum of frontend frameworks, each with their own component system. Stencil components work in React, Vue, Angular and Ember, as well as they work with jQuery or with no framework at all, because they are just plain HTML elements.
|
|
28
|
-
|
|
29
|
-
Compared to using Custom Elements directly, inside of every Stencil component is an efficient JSX rendering system, asynchronous rendering pipeline to prevent jank, and more. This makes Stencil components more performant while maintaining full compatibility with plain Custom Elements. Think of Stencil as creating pre-baked Custom Elements as if you wrote in those features yourself.
|
|
30
|
-
|
|
31
|
-
|
|
32
54
|
## Getting Started
|
|
33
55
|
|
|
34
56
|
To create a new project using an interactive cli, run:
|
|
@@ -43,7 +65,6 @@ To start developing your new Stencil project, run:
|
|
|
43
65
|
npm start
|
|
44
66
|
```
|
|
45
67
|
|
|
46
|
-
|
|
47
68
|
## Creating components
|
|
48
69
|
|
|
49
70
|
Stencil components are TypeScript classes with decorator metadata. The decorators themselves are purely build-time annotations so the compiler can read metadata about each component, and removed entirely for smaller efficient components.
|
|
@@ -60,7 +81,6 @@ import { Component, Prop, h } from '@stencil/core';
|
|
|
60
81
|
export class MyComponent {
|
|
61
82
|
|
|
62
83
|
@Prop() first: string;
|
|
63
|
-
|
|
64
84
|
@Prop() last: string;
|
|
65
85
|
|
|
66
86
|
render() {
|
|
@@ -73,66 +93,13 @@ export class MyComponent {
|
|
|
73
93
|
}
|
|
74
94
|
```
|
|
75
95
|
|
|
76
|
-
Note: the `.tsx` extension is required, as this is the standard for TypeScript classes that use JSX.
|
|
77
|
-
|
|
78
96
|
To use this component, just use it like any other HTML element:
|
|
79
97
|
|
|
80
98
|
```html
|
|
81
99
|
<my-component first="Stencil" last="JS"></my-component>
|
|
82
100
|
```
|
|
83
101
|
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
### Components
|
|
90
|
-
|
|
91
|
-
| Decorator | Description |
|
|
92
|
-
| -------------- | --- |
|
|
93
|
-
| `@Component()` | Indicate a class is a Stencil component. |
|
|
94
|
-
| | |
|
|
95
|
-
| `@Prop()` | Creates a property that will exist on the element and be data-bound to this component. |
|
|
96
|
-
| `@State()` | Creates a local state variable that will not be placed on the element. |
|
|
97
|
-
| `@Method()` | Expose specific methods to be publicly accessible. |
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
## Why "Stencil?"
|
|
101
|
-
|
|
102
|
-
A Stencil is a tool artists use for drawing perfect shapes easily. We want Stencil to be a similar tool for web developers: a tool that helps web developers build powerful Web Components and apps that use them, but without creating non-standard runtime requirements.
|
|
103
|
-
|
|
104
|
-
Stencil is a tool developers use to create Web Components with some powerful features baked in, but it gets out of the way at runtime.
|
|
105
|
-
|
|
106
|
-
- [Using Web Components in Ionic - Polymer Summit](https://youtu.be/UfD-k7aHkQE)
|
|
107
|
-
- [Stencil: A built-time approach to the web - JSConf EU](https://youtu.be/M1F81V-NhP0)
|
|
108
|
-
- [Architecting A Component Compiler - dotJS](https://youtu.be/RZ6MLELGsD8)
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
## Related
|
|
112
|
-
|
|
113
|
-
- [Stencil Documentation](https://stenciljs.com/)
|
|
114
|
-
- [Stencil Worldwide Slack](https://stencil-worldwide.herokuapp.com)
|
|
115
|
-
- [Ionic](https://ionicframework.com/)
|
|
116
|
-
- [Ionic Worldwide Slack](http://ionicworldwide.herokuapp.com/)
|
|
117
|
-
- [Ionicons](http://ionicons.com/)
|
|
118
|
-
- [Capacitor](https://capacitorjs.com/)
|
|
119
|
-
|
|
120
|
-
## Testing powered by
|
|
121
|
-
<a target="_blank" href="https://www.browserstack.com/"><img width="200" src="https://www.browserstack.com/images/layout/browserstack-logo-600x315.png"></a><br>
|
|
122
|
-
[BrowserStack Open-Source Program](https://www.browserstack.com/open-source)
|
|
123
|
-
|
|
124
|
-
## License
|
|
125
|
-
|
|
126
|
-
- [MIT](https://raw.githubusercontent.com/ionic-team/stencil/main/LICENSE.md)
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
[npm-badge]: https://img.shields.io/npm/v/@stencil/core.svg
|
|
130
|
-
[npm-badge-url]: https://www.npmjs.com/package/@stencil/core
|
|
131
|
-
[npm-license]: https://img.shields.io/npm/l/@stencil/core.svg
|
|
132
|
-
[npm-license-url]: https://github.com/ionic-team/stencil/blob/main/LICENSE
|
|
133
|
-
[circle-badge]: https://circleci.com/gh/ionic-team/stencil.svg?style=shield
|
|
134
|
-
[circle-badge-url]: https://circleci.com/gh/ionic-team/stencil
|
|
135
|
-
[browserstack-badge]: https://www.browserstack.com/automate/badge.svg?badge_key=WVNVbkRJdDBJQnBEMzZuWUdlMEZuTjlPUm9sOHZsSVNkUlJTRkJVQkx0ST0tLTFhbk5jRUNEVWxJL1J0SVR0WUFndnc9PQ==--90c84981a2ed2ede760ca48fbfc3fdd5b71d3e5e
|
|
136
|
-
[browserstack-badge-url]: https://www.browserstack.com/automate/public-build/WVNVbkRJdDBJQnBEMzZuWUdlMEZuTjlPUm9sOHZsSVNkUlJTRkJVQkx0ST0tLTFhbk5jRUNEVWxJL1J0SVR0WUFndnc9PQ==--90c84981a2ed2ede760ca48fbfc3fdd5b71d3e5e
|
|
137
|
-
[appveyor-badge]: https://ci.appveyor.com/api/projects/status/92d75dgkohgyap5r/branch/master?svg=true
|
|
138
|
-
[appveyor-badge-url]: https://ci.appveyor.com/project/Ionitron/stencil/branch/master
|
|
102
|
+
## Thanks
|
|
103
|
+
Stencil's internal testing suite is supported by the [BrowserStack Open-Source Program](https://www.browserstack.com/open-source)
|
|
104
|
+
<br>
|
|
105
|
+
<a target="_blank" href="https://www.browserstack.com/"><img width="200" src="https://www.browserstack.com/images/layout/browserstack-logo-600x315.png"></a>
|