ednl-liftstatus-web-components 1.16.2 → 1.17.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/dist/cjs/ednl-liftstatus-web-components.cjs.js +12 -3
- package/dist/cjs/ednl-liftstatus-web-components.cjs.js.map +1 -0
- package/dist/cjs/{index-01253266.js → index-5047dacb.js} +305 -190
- package/dist/cjs/index-5047dacb.js.map +1 -0
- package/dist/cjs/index.cjs.js +2 -0
- package/dist/cjs/index.cjs.js.map +1 -0
- package/dist/cjs/loader.cjs.js +6 -3
- package/dist/cjs/loader.cjs.js.map +1 -0
- package/dist/cjs/{ls-3d-scene_8.cjs.entry.js → ls-3d-scene_9.cjs.entry.js} +29750 -25542
- package/dist/cjs/ls-3d-scene_9.cjs.entry.js.map +1 -0
- package/dist/cjs/ls-counters.cjs.entry.js +3 -1
- package/dist/cjs/ls-counters.cjs.entry.js.map +1 -0
- package/dist/cjs/ls-history.cjs.entry.js +3 -1
- package/dist/cjs/ls-history.cjs.entry.js.map +1 -0
- package/dist/cjs/ls-status-history.cjs.entry.js +3 -1
- package/dist/cjs/ls-status-history.cjs.entry.js.map +1 -0
- package/dist/collection/collection-manifest.json +2 -2
- package/dist/collection/components/ls-3d-scene/ls-3d-scene.js +47 -18
- package/dist/collection/components/ls-3d-scene/ls-3d-scene.js.map +1 -0
- package/dist/collection/components/ls-counters/ls-counters.js +1 -0
- package/dist/collection/components/ls-counters/ls-counters.js.map +1 -0
- package/dist/collection/components/ls-data/ls-data.js +79 -40
- package/dist/collection/components/ls-data/ls-data.js.map +1 -0
- package/dist/collection/components/ls-history/ls-history.js +1 -0
- package/dist/collection/components/ls-history/ls-history.js.map +1 -0
- package/dist/collection/components/ls-indicator/ls-indicator.js +31 -7
- package/dist/collection/components/ls-indicator/ls-indicator.js.map +1 -0
- package/dist/collection/components/ls-recent-stops/ls-recent-stops.js +44 -14
- package/dist/collection/components/ls-recent-stops/ls-recent-stops.js.map +1 -0
- package/dist/collection/components/ls-status/ls-status.js +29 -14
- package/dist/collection/components/ls-status/ls-status.js.map +1 -0
- package/dist/collection/components/ls-status-history/ls-status-history.js +1 -0
- package/dist/collection/components/ls-status-history/ls-status-history.js.map +1 -0
- package/dist/collection/components/ls-status-item/ls-status-item.js +50 -32
- package/dist/collection/components/ls-status-item/ls-status-item.js.map +1 -0
- package/dist/collection/components/ls-status-messages/ls-status-messages.js +36 -35
- package/dist/collection/components/ls-status-messages/ls-status-messages.js.map +1 -0
- package/dist/collection/components/ls-swimlane/ls-swimlane.js +34 -25
- package/dist/collection/components/ls-swimlane/ls-swimlane.js.map +1 -0
- package/dist/collection/components/lsdate-picker/ls-date-picker.js +96 -80
- package/dist/collection/components/lsdate-picker/ls-date-picker.js.map +1 -0
- package/dist/collection/index.js +1 -0
- package/dist/collection/index.js.map +1 -0
- package/dist/collection/store.js +84 -27
- package/dist/collection/store.js.map +1 -0
- package/dist/collection/stores/status-codes.store.js +1 -0
- package/dist/collection/stores/status-codes.store.js.map +1 -0
- package/dist/collection/utils/sensorInfo.js +1 -0
- package/dist/collection/utils/sensorInfo.js.map +1 -0
- package/dist/components/includes.js +3 -1
- package/dist/components/includes.js.map +1 -0
- package/dist/components/index.d.ts +9 -15
- package/dist/components/index.js +3 -13
- package/dist/components/index.js.map +1 -0
- package/dist/components/isNil.js +2 -0
- package/dist/components/isNil.js.map +1 -0
- package/dist/components/ls-3d-scene.js +6169 -5343
- package/dist/components/ls-3d-scene.js.map +1 -0
- package/dist/components/ls-counters.js +2 -0
- package/dist/components/ls-counters.js.map +1 -0
- package/dist/components/ls-data.js +207 -125
- package/dist/components/ls-data.js.map +1 -0
- package/dist/components/ls-date-picker.js +831 -679
- package/dist/components/ls-date-picker.js.map +1 -0
- package/dist/components/ls-history.js +2 -0
- package/dist/components/ls-history.js.map +1 -0
- package/dist/components/ls-indicator.js +2 -0
- package/dist/components/ls-indicator.js.map +1 -0
- package/dist/components/ls-indicator2.js +16 -7
- package/dist/components/ls-indicator2.js.map +1 -0
- package/dist/components/ls-recent-stops.js +24 -14
- package/dist/components/ls-recent-stops.js.map +1 -0
- package/dist/components/ls-status-history.js +2 -0
- package/dist/components/ls-status-history.js.map +1 -0
- package/dist/components/ls-status-item.js +2 -0
- package/dist/components/ls-status-item.js.map +1 -0
- package/dist/components/ls-status-item2.js +29 -27
- package/dist/components/ls-status-item2.js.map +1 -0
- package/dist/components/ls-status-messages.js +21 -36
- package/dist/components/ls-status-messages.js.map +1 -0
- package/dist/components/ls-status.js +12 -12
- package/dist/components/ls-status.js.map +1 -0
- package/dist/components/ls-swimlane.js +20 -27
- package/dist/components/ls-swimlane.js.map +1 -0
- package/dist/components/nl-be.js +3 -1
- package/dist/components/nl-be.js.map +1 -0
- package/dist/components/process-es6.js +3 -1
- package/dist/components/process-es6.js.map +1 -0
- package/dist/components/relativeTime.js +3 -1
- package/dist/components/relativeTime.js.map +1 -0
- package/dist/components/sensorInfo.js +2 -0
- package/dist/components/sensorInfo.js.map +1 -0
- package/dist/components/store.js +886 -28
- package/dist/components/store.js.map +1 -0
- package/dist/components/time.js +61 -34
- package/dist/components/time.js.map +1 -0
- package/dist/components/toNumber.js +3 -1
- package/dist/components/toNumber.js.map +1 -0
- package/dist/components/values.js +3 -1
- package/dist/components/values.js.map +1 -0
- package/dist/ednl-liftstatus-web-components/ednl-liftstatus-web-components.esm.js +2 -1
- package/dist/ednl-liftstatus-web-components/ednl-liftstatus-web-components.esm.js.map +1 -0
- package/dist/ednl-liftstatus-web-components/index.esm.js +2 -0
- package/dist/ednl-liftstatus-web-components/index.esm.js.map +1 -0
- package/dist/ednl-liftstatus-web-components/p-3d8601fe.js +3 -0
- package/dist/ednl-liftstatus-web-components/p-3d8601fe.js.map +1 -0
- package/dist/ednl-liftstatus-web-components/p-911965f2.entry.js +15 -0
- package/dist/ednl-liftstatus-web-components/p-911965f2.entry.js.map +1 -0
- package/dist/ednl-liftstatus-web-components/p-afa00fea.entry.js +2 -0
- package/dist/ednl-liftstatus-web-components/p-afa00fea.entry.js.map +1 -0
- package/dist/ednl-liftstatus-web-components/p-c682d3e1.entry.js +2 -0
- package/dist/ednl-liftstatus-web-components/p-c682d3e1.entry.js.map +1 -0
- package/dist/ednl-liftstatus-web-components/p-fb00c1ae.entry.js +2 -0
- package/dist/ednl-liftstatus-web-components/p-fb00c1ae.entry.js.map +1 -0
- package/dist/esm/ednl-liftstatus-web-components.js +9 -3
- package/dist/esm/ednl-liftstatus-web-components.js.map +1 -0
- package/dist/esm/{index-186928b9.js → index-e0592687.js} +305 -191
- package/dist/esm/index-e0592687.js.map +1 -0
- package/dist/esm/index.js +2 -0
- package/dist/esm/index.js.map +1 -0
- package/dist/esm/loader.js +6 -3
- package/dist/esm/loader.js.map +1 -0
- package/dist/esm/{ls-3d-scene_8.entry.js → ls-3d-scene_9.entry.js} +29668 -25461
- package/dist/esm/ls-3d-scene_9.entry.js.map +1 -0
- package/dist/esm/ls-counters.entry.js +3 -1
- package/dist/esm/ls-counters.entry.js.map +1 -0
- package/dist/esm/ls-history.entry.js +3 -1
- package/dist/esm/ls-history.entry.js.map +1 -0
- package/dist/esm/ls-status-history.entry.js +3 -1
- package/dist/esm/ls-status-history.entry.js.map +1 -0
- package/dist/esm/polyfills/css-shim.js +1 -1
- package/dist/types/components/ls-3d-scene/ls-3d-scene.d.ts +6 -2
- package/dist/types/components/ls-data/ls-data.d.ts +5 -0
- package/dist/types/components/ls-indicator/ls-indicator.d.ts +6 -1
- package/dist/types/components/ls-recent-stops/ls-recent-stops.d.ts +7 -1
- package/dist/types/components/ls-status/ls-status.d.ts +6 -1
- package/dist/types/components/ls-status-item/ls-status-item.d.ts +7 -6
- package/dist/types/components/ls-status-messages/ls-status-messages.d.ts +6 -1
- package/dist/types/components/ls-swimlane/ls-swimlane.d.ts +6 -0
- package/dist/types/components/lsdate-picker/ls-date-picker.d.ts +6 -1
- package/dist/types/components.d.ts +72 -0
- package/dist/types/stencil-public-runtime.d.ts +91 -19
- package/dist/types/store.d.ts +4 -2
- package/loader/index.d.ts +9 -0
- package/package.json +34 -33
- package/dist/cjs/ls-date-picker.cjs.entry.js +0 -2841
- package/dist/cjs/store-88e3d058.js +0 -264
- package/dist/components/isEmpty.js +0 -801
- package/dist/ednl-liftstatus-web-components/p-0542d430.entry.js +0 -1
- package/dist/ednl-liftstatus-web-components/p-134747b9.entry.js +0 -1
- package/dist/ednl-liftstatus-web-components/p-41365384.entry.js +0 -8
- package/dist/ednl-liftstatus-web-components/p-584500ff.entry.js +0 -1
- package/dist/ednl-liftstatus-web-components/p-7132b359.entry.js +0 -1
- package/dist/ednl-liftstatus-web-components/p-ae805e35.js +0 -1
- package/dist/ednl-liftstatus-web-components/p-ce59b37f.js +0 -2
- package/dist/esm/ls-date-picker.entry.js +0 -2837
- package/dist/esm/store-ecc953a5.js +0 -257
|
@@ -1,19 +1,28 @@
|
|
|
1
1
|
'use strict';
|
|
2
2
|
|
|
3
|
-
|
|
3
|
+
Object.defineProperty(exports, '__esModule', { value: true });
|
|
4
|
+
|
|
5
|
+
const index = require('./index-5047dacb.js');
|
|
4
6
|
|
|
5
7
|
/*
|
|
6
|
-
Stencil Client Patch Browser
|
|
8
|
+
Stencil Client Patch Browser v3.2.0 | MIT Licensed | https://stenciljs.com
|
|
7
9
|
*/
|
|
8
10
|
const patchBrowser = () => {
|
|
9
11
|
const importMeta = (typeof document === 'undefined' ? new (require('u' + 'rl').URL)('file:' + __filename).href : (document.currentScript && document.currentScript.src || new URL('ednl-liftstatus-web-components.cjs.js', document.baseURI).href));
|
|
10
12
|
const opts = {};
|
|
13
|
+
// TODO(STENCIL-663): Remove code related to deprecated `safari10` field.
|
|
11
14
|
if (importMeta !== '') {
|
|
12
15
|
opts.resourcesUrl = new URL('.', importMeta).href;
|
|
16
|
+
// TODO(STENCIL-661): Remove code related to the dynamic import shim
|
|
17
|
+
// TODO(STENCIL-663): Remove code related to deprecated `safari10` field.
|
|
13
18
|
}
|
|
14
19
|
return index.promiseResolve(opts);
|
|
15
20
|
};
|
|
16
21
|
|
|
17
22
|
patchBrowser().then(options => {
|
|
18
|
-
return index.bootstrapLazy([["ls-counters.cjs",[[1,"ls-counters"]]],["ls-
|
|
23
|
+
return index.bootstrapLazy([["ls-counters.cjs",[[1,"ls-counters"]]],["ls-history.cjs",[[1,"ls-history"]]],["ls-status-history.cjs",[[1,"ls-status-history"]]],["ls-3d-scene_9.cjs",[[1,"ls-3d-scene",{"idKey":[1,"id-key"],"movementState":[32],"currentStop":[32],"lastPassedStop":[32],"time":[32]}],[1,"ls-status",{"sensorIds":[1,"sensor-ids"],"idKey":[1,"id-key"],"sensorIdsArray":[32]}],[1,"ls-data",{"accessToken":[1,"access-token"],"idKey":[1,"id-key"]}],[1,"ls-date-picker",{"idKey":[1,"id-key"]}],[1,"ls-recent-stops",{"idKey":[1,"id-key"],"loadingState":[32]},[[9,"resize","resizeWindow"]]],[1,"ls-status-messages",{"showTitle":[4,"show-title"],"severityOptions":[1,"severity-options"],"idKey":[1,"id-key"],"statusMessages":[32],"lastChange":[32],"time":[32]}],[1,"ls-swimlane",{"sensorIds":[1,"sensor-ids"],"idKey":[1,"id-key"]}],[1,"ls-indicator",{"sensorId":[2,"sensor-id"],"idKey":[1,"id-key"],"dataLabel":[32],"sensorData":[32]}],[1,"ls-status-item",{"sensorId":[2,"sensor-id"],"idKey":[1,"id-key"],"sensorData":[32],"timestamp":[32]}]]]], options);
|
|
19
24
|
});
|
|
25
|
+
|
|
26
|
+
exports.setNonce = index.setNonce;
|
|
27
|
+
|
|
28
|
+
//# sourceMappingURL=ednl-liftstatus-web-components.cjs.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"file":"ednl-liftstatus-web-components.cjs.js","mappings":";;;;;;AAAA;AACA;AACA;AAiBA,MAAM,YAAY,GAAG,MAAM;AAkC3B,IAAI,MAAM,UAAU,GAAG,gOAAe,CAAC;AACvC,IAAI,MAAM,IAAI,GAAiE,EAAE,CAAC;AAgBlF;AACA,IAAI,IAAuB,UAAU,KAAK,EAAE,EAAE;AAC9C,QAAQ,IAAI,CAAC,YAAY,GAAG,IAAI,GAAG,CAAC,GAAG,EAAE,UAAU,CAAC,CAAC,IAAI,CAAC;AAC1D;AACA;AACA,KAaK;AACL,IAAI,OAAOA,oBAAc,CAAC,IAAI,CAAC,CAAC;AAChC,CAAC;;ACtFD,YAAY,EAAE,CAAC,IAAI,CAAC,OAAO,IAAI;AAE/B,EAAE,OAAOC,mBAAa,CAAC,4BAA4B,EAAE,OAAO,CAAC,CAAC;AAC9D,CAAC,CAAC;;;;","names":["promiseResolve","bootstrapLazy"],"sources":["./node_modules/@stencil/core/internal/client/patch-browser.js","@lazy-browser-entrypoint?app-data=conditional"],"sourcesContent":["/*\n Stencil Client Patch Browser v3.2.0 | MIT Licensed | https://stenciljs.com\n */\nimport { BUILD, NAMESPACE } from '@stencil/core/internal/app-data';\nimport { consoleDevInfo, plt, win, doc, promiseResolve, H } from '@stencil/core';\n/**\n * Helper method for querying a `meta` tag that contains a nonce value\n * out of a DOM's head.\n *\n * @param doc The DOM containing the `head` to query against\n * @returns The content of the meta tag representing the nonce value, or `undefined` if no tag\n * exists or the tag has no content.\n */\nfunction queryNonceMetaTagContent(doc) {\n var _a, _b, _c;\n return (_c = (_b = (_a = doc.head) === null || _a === void 0 ? void 0 : _a.querySelector('meta[name=\"csp-nonce\"]')) === null || _b === void 0 ? void 0 : _b.getAttribute('content')) !== null && _c !== void 0 ? _c : undefined;\n}\n// TODO(STENCIL-661): Remove code related to the dynamic import shim\nconst getDynamicImportFunction = (namespace) => `__sc_import_${namespace.replace(/\\s|-/g, '_')}`;\nconst patchBrowser = () => {\n // NOTE!! This fn cannot use async/await!\n if (BUILD.isDev && !BUILD.isTesting) {\n consoleDevInfo('Running in development mode.');\n }\n // TODO(STENCIL-659): Remove code implementing the CSS variable shim\n if (BUILD.cssVarShim) {\n // shim css vars\n // TODO(STENCIL-659): Remove code implementing the CSS variable shim\n plt.$cssShim$ = win.__cssshim;\n }\n if (BUILD.cloneNodeFix) {\n // opted-in to polyfill cloneNode() for slot polyfilled components\n patchCloneNodeFix(H.prototype);\n }\n if (BUILD.profile && !performance.mark) {\n // not all browsers support performance.mark/measure (Safari 10)\n // because the mark/measure APIs are designed to write entries to a buffer in the browser that does not exist,\n // simply stub the implementations out.\n // TODO(STENCIL-323): Remove this patch when support for older browsers is removed (breaking)\n // @ts-ignore\n performance.mark = performance.measure = () => {\n /*noop*/\n };\n performance.getEntriesByName = () => [];\n }\n // @ts-ignore\n const scriptElm = \n // TODO(STENCIL-661): Remove code related to the dynamic import shim\n // TODO(STENCIL-663): Remove code related to deprecated `safari10` field.\n BUILD.scriptDataOpts || BUILD.safari10 || BUILD.dynamicImportShim\n ? Array.from(doc.querySelectorAll('script')).find((s) => new RegExp(`\\/${NAMESPACE}(\\\\.esm)?\\\\.js($|\\\\?|#)`).test(s.src) ||\n s.getAttribute('data-stencil-namespace') === NAMESPACE)\n : null;\n const importMeta = import.meta.url;\n const opts = BUILD.scriptDataOpts ? (scriptElm || {})['data-opts'] || {} : {};\n // TODO(STENCIL-663): Remove code related to deprecated `safari10` field.\n if (BUILD.safari10 && 'onbeforeload' in scriptElm && !history.scrollRestoration /* IS_ESM_BUILD */) {\n // Safari < v11 support: This IF is true if it's Safari below v11.\n // This fn cannot use async/await since Safari didn't support it until v11,\n // however, Safari 10 did support modules. Safari 10 also didn't support \"nomodule\",\n // so both the ESM file and nomodule file would get downloaded. Only Safari\n // has 'onbeforeload' in the script, and \"history.scrollRestoration\" was added\n // to Safari in v11. Return a noop then() so the async/await ESM code doesn't continue.\n // IS_ESM_BUILD is replaced at build time so this check doesn't happen in systemjs builds.\n return {\n then() {\n /* promise noop */\n },\n };\n }\n // TODO(STENCIL-663): Remove code related to deprecated `safari10` field.\n if (!BUILD.safari10 && importMeta !== '') {\n opts.resourcesUrl = new URL('.', importMeta).href;\n // TODO(STENCIL-661): Remove code related to the dynamic import shim\n // TODO(STENCIL-663): Remove code related to deprecated `safari10` field.\n }\n else if (BUILD.dynamicImportShim || BUILD.safari10) {\n opts.resourcesUrl = new URL('.', new URL(scriptElm.getAttribute('data-resources-url') || scriptElm.src, win.location.href)).href;\n // TODO(STENCIL-661): Remove code related to the dynamic import shim\n if (BUILD.dynamicImportShim) {\n patchDynamicImport(opts.resourcesUrl, scriptElm);\n }\n // TODO(STENCIL-661): Remove code related to the dynamic import shim\n if (BUILD.dynamicImportShim && !win.customElements) {\n // module support, but no custom elements support (Old Edge)\n // @ts-ignore\n return import(/* webpackChunkName: \"polyfills-dom\" */ './dom.js').then(() => opts);\n }\n }\n return promiseResolve(opts);\n};\n// TODO(STENCIL-661): Remove code related to the dynamic import shim\nconst patchDynamicImport = (base, orgScriptElm) => {\n const importFunctionName = getDynamicImportFunction(NAMESPACE);\n try {\n // test if this browser supports dynamic imports\n // There is a caching issue in V8, that breaks using import() in Function\n // By generating a random string, we can workaround it\n // Check https://bugs.chromium.org/p/chromium/issues/detail?id=990810 for more info\n win[importFunctionName] = new Function('w', `return import(w);//${Math.random()}`);\n }\n catch (e) {\n // this shim is specifically for browsers that do support \"esm\" imports\n // however, they do NOT support \"dynamic\" imports\n // basically this code is for old Edge, v18 and below\n const moduleMap = new Map();\n win[importFunctionName] = (src) => {\n var _a;\n const url = new URL(src, base).href;\n let mod = moduleMap.get(url);\n if (!mod) {\n const script = doc.createElement('script');\n script.type = 'module';\n script.crossOrigin = orgScriptElm.crossOrigin;\n script.src = URL.createObjectURL(new Blob([`import * as m from '${url}'; window.${importFunctionName}.m = m;`], {\n type: 'application/javascript',\n }));\n // Apply CSP nonce to the script tag if it exists\n const nonce = (_a = plt.$nonce$) !== null && _a !== void 0 ? _a : queryNonceMetaTagContent(doc);\n if (nonce != null) {\n script.setAttribute('nonce', nonce);\n }\n mod = new Promise((resolve) => {\n script.onload = () => {\n resolve(win[importFunctionName].m);\n script.remove();\n };\n });\n moduleMap.set(url, mod);\n doc.head.appendChild(script);\n }\n return mod;\n };\n }\n};\nconst patchCloneNodeFix = (HTMLElementPrototype) => {\n const nativeCloneNodeFn = HTMLElementPrototype.cloneNode;\n HTMLElementPrototype.cloneNode = function (deep) {\n if (this.nodeName === 'TEMPLATE') {\n return nativeCloneNodeFn.call(this, deep);\n }\n const clonedNode = nativeCloneNodeFn.call(this, false);\n const srcChildNodes = this.childNodes;\n if (deep) {\n for (let i = 0; i < srcChildNodes.length; i++) {\n // Node.ATTRIBUTE_NODE === 2, and checking because IE11\n if (srcChildNodes[i].nodeType !== 2) {\n clonedNode.appendChild(srcChildNodes[i].cloneNode(true));\n }\n }\n }\n return clonedNode;\n };\n};\nexport { patchBrowser };\n","export { setNonce } from '@stencil/core';\nimport { bootstrapLazy } from '@stencil/core';\nimport { patchBrowser } from '@stencil/core/internal/client/patch-browser';\nimport { globalScripts } from '@stencil/core/internal/app-globals';\npatchBrowser().then(options => {\n globalScripts();\n return bootstrapLazy([/*!__STENCIL_LAZY_DATA__*/], options);\n});\n"],"version":3}
|
|
@@ -22,67 +22,23 @@ function _interopNamespace(e) {
|
|
|
22
22
|
|
|
23
23
|
const NAMESPACE = 'ednl-liftstatus-web-components';
|
|
24
24
|
|
|
25
|
+
/**
|
|
26
|
+
* Virtual DOM patching algorithm based on Snabbdom by
|
|
27
|
+
* Simon Friis Vindum (@paldepind)
|
|
28
|
+
* Licensed under the MIT License
|
|
29
|
+
* https://github.com/snabbdom/snabbdom/blob/master/LICENSE
|
|
30
|
+
*
|
|
31
|
+
* Modified for Stencil's renderer and slot projection
|
|
32
|
+
*/
|
|
25
33
|
let scopeId;
|
|
26
34
|
let hostTagName;
|
|
27
35
|
let isSvgMode = false;
|
|
28
36
|
let renderingRef = null;
|
|
29
37
|
let queuePending = false;
|
|
30
|
-
const
|
|
31
|
-
const
|
|
32
|
-
|
|
33
|
-
$flags$: 0,
|
|
34
|
-
$resourcesUrl$: '',
|
|
35
|
-
jmp: (h) => h(),
|
|
36
|
-
raf: (h) => requestAnimationFrame(h),
|
|
37
|
-
ael: (el, eventName, listener, opts) => el.addEventListener(eventName, listener, opts),
|
|
38
|
-
rel: (el, eventName, listener, opts) => el.removeEventListener(eventName, listener, opts),
|
|
39
|
-
ce: (eventName, opts) => new CustomEvent(eventName, opts),
|
|
40
|
-
};
|
|
41
|
-
const promiseResolve = (v) => Promise.resolve(v);
|
|
42
|
-
const supportsConstructableStylesheets = /*@__PURE__*/ (() => {
|
|
43
|
-
try {
|
|
44
|
-
new CSSStyleSheet();
|
|
45
|
-
return typeof new CSSStyleSheet().replaceSync === 'function';
|
|
46
|
-
}
|
|
47
|
-
catch (e) { }
|
|
48
|
-
return false;
|
|
49
|
-
})()
|
|
50
|
-
;
|
|
51
|
-
const addHostEventListeners = (elm, hostRef, listeners, attachParentListeners) => {
|
|
52
|
-
if (listeners) {
|
|
53
|
-
listeners.map(([flags, name, method]) => {
|
|
54
|
-
const target = getHostListenerTarget(elm, flags) ;
|
|
55
|
-
const handler = hostListenerProxy(hostRef, method);
|
|
56
|
-
const opts = hostListenerOpts(flags);
|
|
57
|
-
plt.ael(target, name, handler, opts);
|
|
58
|
-
(hostRef.$rmListeners$ = hostRef.$rmListeners$ || []).push(() => plt.rel(target, name, handler, opts));
|
|
59
|
-
});
|
|
60
|
-
}
|
|
61
|
-
};
|
|
62
|
-
const hostListenerProxy = (hostRef, methodName) => (ev) => {
|
|
63
|
-
try {
|
|
64
|
-
{
|
|
65
|
-
if (hostRef.$flags$ & 256 /* HOST_FLAGS.isListenReady */) {
|
|
66
|
-
// instance is ready, let's call it's member method for this event
|
|
67
|
-
hostRef.$lazyInstance$[methodName](ev);
|
|
68
|
-
}
|
|
69
|
-
else {
|
|
70
|
-
(hostRef.$queuedListeners$ = hostRef.$queuedListeners$ || []).push([methodName, ev]);
|
|
71
|
-
}
|
|
72
|
-
}
|
|
73
|
-
}
|
|
74
|
-
catch (e) {
|
|
75
|
-
consoleError(e);
|
|
76
|
-
}
|
|
77
|
-
};
|
|
78
|
-
const getHostListenerTarget = (elm, flags) => {
|
|
79
|
-
if (flags & 8 /* LISTENER_FLAGS.TargetWindow */)
|
|
80
|
-
return win;
|
|
81
|
-
return elm;
|
|
38
|
+
const getAssetPath = (path) => {
|
|
39
|
+
const assetUrl = new URL(path, plt.$resourcesUrl$);
|
|
40
|
+
return assetUrl.origin !== win.location.origin ? assetUrl.href : assetUrl.pathname;
|
|
82
41
|
};
|
|
83
|
-
// prettier-ignore
|
|
84
|
-
const hostListenerOpts = (flags) => (flags & 2 /* LISTENER_FLAGS.Capture */) !== 0;
|
|
85
|
-
const HYDRATED_CSS = '{visibility:hidden}.hydrated{visibility:inherit}';
|
|
86
42
|
const createTime = (fnName, tagName = '') => {
|
|
87
43
|
{
|
|
88
44
|
return () => {
|
|
@@ -97,76 +53,7 @@ const uniqueTime = (key, measureText) => {
|
|
|
97
53
|
};
|
|
98
54
|
}
|
|
99
55
|
};
|
|
100
|
-
const
|
|
101
|
-
const registerStyle = (scopeId, cssText, allowCS) => {
|
|
102
|
-
let style = styles.get(scopeId);
|
|
103
|
-
if (supportsConstructableStylesheets && allowCS) {
|
|
104
|
-
style = (style || new CSSStyleSheet());
|
|
105
|
-
if (typeof style === 'string') {
|
|
106
|
-
style = cssText;
|
|
107
|
-
}
|
|
108
|
-
else {
|
|
109
|
-
style.replaceSync(cssText);
|
|
110
|
-
}
|
|
111
|
-
}
|
|
112
|
-
else {
|
|
113
|
-
style = cssText;
|
|
114
|
-
}
|
|
115
|
-
styles.set(scopeId, style);
|
|
116
|
-
};
|
|
117
|
-
const addStyle = (styleContainerNode, cmpMeta, mode, hostElm) => {
|
|
118
|
-
let scopeId = getScopeId(cmpMeta);
|
|
119
|
-
const style = styles.get(scopeId);
|
|
120
|
-
// if an element is NOT connected then getRootNode() will return the wrong root node
|
|
121
|
-
// so the fallback is to always use the document for the root node in those cases
|
|
122
|
-
styleContainerNode = styleContainerNode.nodeType === 11 /* NODE_TYPE.DocumentFragment */ ? styleContainerNode : doc;
|
|
123
|
-
if (style) {
|
|
124
|
-
if (typeof style === 'string') {
|
|
125
|
-
styleContainerNode = styleContainerNode.head || styleContainerNode;
|
|
126
|
-
let appliedStyles = rootAppliedStyles.get(styleContainerNode);
|
|
127
|
-
let styleElm;
|
|
128
|
-
if (!appliedStyles) {
|
|
129
|
-
rootAppliedStyles.set(styleContainerNode, (appliedStyles = new Set()));
|
|
130
|
-
}
|
|
131
|
-
if (!appliedStyles.has(scopeId)) {
|
|
132
|
-
{
|
|
133
|
-
{
|
|
134
|
-
styleElm = doc.createElement('style');
|
|
135
|
-
styleElm.innerHTML = style;
|
|
136
|
-
}
|
|
137
|
-
styleContainerNode.insertBefore(styleElm, styleContainerNode.querySelector('link'));
|
|
138
|
-
}
|
|
139
|
-
if (appliedStyles) {
|
|
140
|
-
appliedStyles.add(scopeId);
|
|
141
|
-
}
|
|
142
|
-
}
|
|
143
|
-
}
|
|
144
|
-
else if (!styleContainerNode.adoptedStyleSheets.includes(style)) {
|
|
145
|
-
styleContainerNode.adoptedStyleSheets = [...styleContainerNode.adoptedStyleSheets, style];
|
|
146
|
-
}
|
|
147
|
-
}
|
|
148
|
-
return scopeId;
|
|
149
|
-
};
|
|
150
|
-
const attachStyles = (hostRef) => {
|
|
151
|
-
const cmpMeta = hostRef.$cmpMeta$;
|
|
152
|
-
const elm = hostRef.$hostElement$;
|
|
153
|
-
const flags = cmpMeta.$flags$;
|
|
154
|
-
const endAttachStyles = createTime('attachStyles', cmpMeta.$tagName$);
|
|
155
|
-
const scopeId = addStyle(elm.shadowRoot ? elm.shadowRoot : elm.getRootNode(), cmpMeta);
|
|
156
|
-
if (flags & 10 /* CMP_FLAGS.needsScopedEncapsulation */) {
|
|
157
|
-
// only required when we're NOT using native shadow dom (slot)
|
|
158
|
-
// or this browser doesn't support native shadow dom
|
|
159
|
-
// and this host element was NOT created with SSR
|
|
160
|
-
// let's pick out the inner content for slot projection
|
|
161
|
-
// create a node to represent where the original
|
|
162
|
-
// content was first placed, which is useful later on
|
|
163
|
-
// DOM WRITE!!
|
|
164
|
-
elm['s-sc'] = scopeId;
|
|
165
|
-
elm.classList.add(scopeId + '-h');
|
|
166
|
-
}
|
|
167
|
-
endAttachStyles();
|
|
168
|
-
};
|
|
169
|
-
const getScopeId = (cmp, mode) => 'sc-' + (cmp.$tagName$);
|
|
56
|
+
const HYDRATED_CSS = '{visibility:hidden}.hydrated{visibility:inherit}';
|
|
170
57
|
/**
|
|
171
58
|
* Default style mode id
|
|
172
59
|
*/
|
|
@@ -176,11 +63,30 @@ const getScopeId = (cmp, mode) => 'sc-' + (cmp.$tagName$);
|
|
|
176
63
|
*/
|
|
177
64
|
const EMPTY_OBJ = {};
|
|
178
65
|
const isDef = (v) => v != null;
|
|
66
|
+
/**
|
|
67
|
+
* Check whether a value is a 'complex type', defined here as an object or a
|
|
68
|
+
* function.
|
|
69
|
+
*
|
|
70
|
+
* @param o the value to check
|
|
71
|
+
* @returns whether it's a complex type or not
|
|
72
|
+
*/
|
|
179
73
|
const isComplexType = (o) => {
|
|
180
74
|
// https://jsperf.com/typeof-fn-object/5
|
|
181
75
|
o = typeof o;
|
|
182
76
|
return o === 'object' || o === 'function';
|
|
183
77
|
};
|
|
78
|
+
/**
|
|
79
|
+
* Helper method for querying a `meta` tag that contains a nonce value
|
|
80
|
+
* out of a DOM's head.
|
|
81
|
+
*
|
|
82
|
+
* @param doc The DOM containing the `head` to query against
|
|
83
|
+
* @returns The content of the meta tag representing the nonce value, or `undefined` if no tag
|
|
84
|
+
* exists or the tag has no content.
|
|
85
|
+
*/
|
|
86
|
+
function queryNonceMetaTagContent(doc) {
|
|
87
|
+
var _a, _b, _c;
|
|
88
|
+
return (_c = (_b = (_a = doc.head) === null || _a === void 0 ? void 0 : _a.querySelector('meta[name="csp-nonce"]')) === null || _b === void 0 ? void 0 : _b.getAttribute('content')) !== null && _c !== void 0 ? _c : undefined;
|
|
89
|
+
}
|
|
184
90
|
/**
|
|
185
91
|
* Production h() function based on Preact by
|
|
186
92
|
* Jason Miller (@developit)
|
|
@@ -189,7 +95,6 @@ const isComplexType = (o) => {
|
|
|
189
95
|
*
|
|
190
96
|
* Modified for Stencil's compiler and vdom
|
|
191
97
|
*/
|
|
192
|
-
// const stack: any[] = [];
|
|
193
98
|
// export function h(nodeName: string | d.FunctionalComponent, vnodeData: d.PropsType, child?: d.ChildType): d.VNode;
|
|
194
99
|
// export function h(nodeName: string | d.FunctionalComponent, vnodeData: d.PropsType, ...children: d.ChildType[]): d.VNode;
|
|
195
100
|
const h = (nodeName, vnodeData, ...children) => {
|
|
@@ -240,6 +145,14 @@ const h = (nodeName, vnodeData, ...children) => {
|
|
|
240
145
|
}
|
|
241
146
|
return vnode;
|
|
242
147
|
};
|
|
148
|
+
/**
|
|
149
|
+
* A utility function for creating a virtual DOM node from a tag and some
|
|
150
|
+
* possible text content.
|
|
151
|
+
*
|
|
152
|
+
* @param tag the tag for this element
|
|
153
|
+
* @param text possible text content for the node
|
|
154
|
+
* @returns a newly-minted virtual DOM node
|
|
155
|
+
*/
|
|
243
156
|
const newVNode = (tag, text) => {
|
|
244
157
|
const vnode = {
|
|
245
158
|
$flags$: 0,
|
|
@@ -254,7 +167,151 @@ const newVNode = (tag, text) => {
|
|
|
254
167
|
return vnode;
|
|
255
168
|
};
|
|
256
169
|
const Host = {};
|
|
170
|
+
/**
|
|
171
|
+
* Check whether a given node is a Host node or not
|
|
172
|
+
*
|
|
173
|
+
* @param node the virtual DOM node to check
|
|
174
|
+
* @returns whether it's a Host node or not
|
|
175
|
+
*/
|
|
257
176
|
const isHost = (node) => node && node.$tag$ === Host;
|
|
177
|
+
/**
|
|
178
|
+
* Parse a new property value for a given property type.
|
|
179
|
+
*
|
|
180
|
+
* While the prop value can reasonably be expected to be of `any` type as far as TypeScript's type checker is concerned,
|
|
181
|
+
* it is not safe to assume that the string returned by evaluating `typeof propValue` matches:
|
|
182
|
+
* 1. `any`, the type given to `propValue` in the function signature
|
|
183
|
+
* 2. the type stored from `propType`.
|
|
184
|
+
*
|
|
185
|
+
* This function provides the capability to parse/coerce a property's value to potentially any other JavaScript type.
|
|
186
|
+
*
|
|
187
|
+
* Property values represented in TSX preserve their type information. In the example below, the number 0 is passed to
|
|
188
|
+
* a component. This `propValue` will preserve its type information (`typeof propValue === 'number'`). Note that is
|
|
189
|
+
* based on the type of the value being passed in, not the type declared of the class member decorated with `@Prop`.
|
|
190
|
+
* ```tsx
|
|
191
|
+
* <my-cmp prop-val={0}></my-cmp>
|
|
192
|
+
* ```
|
|
193
|
+
*
|
|
194
|
+
* HTML prop values on the other hand, will always a string
|
|
195
|
+
*
|
|
196
|
+
* @param propValue the new value to coerce to some type
|
|
197
|
+
* @param propType the type of the prop, expressed as a binary number
|
|
198
|
+
* @returns the parsed/coerced value
|
|
199
|
+
*/
|
|
200
|
+
const parsePropertyValue = (propValue, propType) => {
|
|
201
|
+
// ensure this value is of the correct prop type
|
|
202
|
+
if (propValue != null && !isComplexType(propValue)) {
|
|
203
|
+
if (propType & 4 /* MEMBER_FLAGS.Boolean */) {
|
|
204
|
+
// per the HTML spec, any string value means it is a boolean true value
|
|
205
|
+
// but we'll cheat here and say that the string "false" is the boolean false
|
|
206
|
+
return propValue === 'false' ? false : propValue === '' || !!propValue;
|
|
207
|
+
}
|
|
208
|
+
if (propType & 2 /* MEMBER_FLAGS.Number */) {
|
|
209
|
+
// force it to be a number
|
|
210
|
+
return parseFloat(propValue);
|
|
211
|
+
}
|
|
212
|
+
if (propType & 1 /* MEMBER_FLAGS.String */) {
|
|
213
|
+
// could have been passed as a number or boolean
|
|
214
|
+
// but we still want it as a string
|
|
215
|
+
return String(propValue);
|
|
216
|
+
}
|
|
217
|
+
// redundant return here for better minification
|
|
218
|
+
return propValue;
|
|
219
|
+
}
|
|
220
|
+
// not sure exactly what type we want
|
|
221
|
+
// so no need to change to a different type
|
|
222
|
+
return propValue;
|
|
223
|
+
};
|
|
224
|
+
const getElement = (ref) => (getHostRef(ref).$hostElement$ );
|
|
225
|
+
/**
|
|
226
|
+
* Helper function to create & dispatch a custom Event on a provided target
|
|
227
|
+
* @param elm the target of the Event
|
|
228
|
+
* @param name the name to give the custom Event
|
|
229
|
+
* @param opts options for configuring a custom Event
|
|
230
|
+
* @returns the custom Event
|
|
231
|
+
*/
|
|
232
|
+
const emitEvent = (elm, name, opts) => {
|
|
233
|
+
const ev = plt.ce(name, opts);
|
|
234
|
+
elm.dispatchEvent(ev);
|
|
235
|
+
return ev;
|
|
236
|
+
};
|
|
237
|
+
const rootAppliedStyles = /*@__PURE__*/ new WeakMap();
|
|
238
|
+
const registerStyle = (scopeId, cssText, allowCS) => {
|
|
239
|
+
let style = styles.get(scopeId);
|
|
240
|
+
if (supportsConstructableStylesheets && allowCS) {
|
|
241
|
+
style = (style || new CSSStyleSheet());
|
|
242
|
+
if (typeof style === 'string') {
|
|
243
|
+
style = cssText;
|
|
244
|
+
}
|
|
245
|
+
else {
|
|
246
|
+
style.replaceSync(cssText);
|
|
247
|
+
}
|
|
248
|
+
}
|
|
249
|
+
else {
|
|
250
|
+
style = cssText;
|
|
251
|
+
}
|
|
252
|
+
styles.set(scopeId, style);
|
|
253
|
+
};
|
|
254
|
+
const addStyle = (styleContainerNode, cmpMeta, mode, hostElm) => {
|
|
255
|
+
var _a;
|
|
256
|
+
let scopeId = getScopeId(cmpMeta);
|
|
257
|
+
const style = styles.get(scopeId);
|
|
258
|
+
// if an element is NOT connected then getRootNode() will return the wrong root node
|
|
259
|
+
// so the fallback is to always use the document for the root node in those cases
|
|
260
|
+
styleContainerNode = styleContainerNode.nodeType === 11 /* NODE_TYPE.DocumentFragment */ ? styleContainerNode : doc;
|
|
261
|
+
if (style) {
|
|
262
|
+
if (typeof style === 'string') {
|
|
263
|
+
styleContainerNode = styleContainerNode.head || styleContainerNode;
|
|
264
|
+
let appliedStyles = rootAppliedStyles.get(styleContainerNode);
|
|
265
|
+
let styleElm;
|
|
266
|
+
if (!appliedStyles) {
|
|
267
|
+
rootAppliedStyles.set(styleContainerNode, (appliedStyles = new Set()));
|
|
268
|
+
}
|
|
269
|
+
if (!appliedStyles.has(scopeId)) {
|
|
270
|
+
{
|
|
271
|
+
// TODO(STENCIL-659): Remove code implementing the CSS variable shim
|
|
272
|
+
{
|
|
273
|
+
styleElm = doc.createElement('style');
|
|
274
|
+
styleElm.innerHTML = style;
|
|
275
|
+
}
|
|
276
|
+
// Apply CSP nonce to the style tag if it exists
|
|
277
|
+
const nonce = (_a = plt.$nonce$) !== null && _a !== void 0 ? _a : queryNonceMetaTagContent(doc);
|
|
278
|
+
if (nonce != null) {
|
|
279
|
+
styleElm.setAttribute('nonce', nonce);
|
|
280
|
+
}
|
|
281
|
+
styleContainerNode.insertBefore(styleElm, styleContainerNode.querySelector('link'));
|
|
282
|
+
}
|
|
283
|
+
if (appliedStyles) {
|
|
284
|
+
appliedStyles.add(scopeId);
|
|
285
|
+
}
|
|
286
|
+
}
|
|
287
|
+
}
|
|
288
|
+
else if (!styleContainerNode.adoptedStyleSheets.includes(style)) {
|
|
289
|
+
styleContainerNode.adoptedStyleSheets = [...styleContainerNode.adoptedStyleSheets, style];
|
|
290
|
+
}
|
|
291
|
+
}
|
|
292
|
+
return scopeId;
|
|
293
|
+
};
|
|
294
|
+
const attachStyles = (hostRef) => {
|
|
295
|
+
const cmpMeta = hostRef.$cmpMeta$;
|
|
296
|
+
const elm = hostRef.$hostElement$;
|
|
297
|
+
const flags = cmpMeta.$flags$;
|
|
298
|
+
const endAttachStyles = createTime('attachStyles', cmpMeta.$tagName$);
|
|
299
|
+
const scopeId = addStyle(elm.shadowRoot ? elm.shadowRoot : elm.getRootNode(), cmpMeta);
|
|
300
|
+
// TODO(STENCIL-662): Remove code related to deprecated shadowDomShim field
|
|
301
|
+
if (flags & 10 /* CMP_FLAGS.needsScopedEncapsulation */) {
|
|
302
|
+
// only required when we're NOT using native shadow dom (slot)
|
|
303
|
+
// or this browser doesn't support native shadow dom
|
|
304
|
+
// and this host element was NOT created with SSR
|
|
305
|
+
// let's pick out the inner content for slot projection
|
|
306
|
+
// create a node to represent where the original
|
|
307
|
+
// content was first placed, which is useful later on
|
|
308
|
+
// DOM WRITE!!
|
|
309
|
+
elm['s-sc'] = scopeId;
|
|
310
|
+
elm.classList.add(scopeId + '-h');
|
|
311
|
+
}
|
|
312
|
+
endAttachStyles();
|
|
313
|
+
};
|
|
314
|
+
const getScopeId = (cmp, mode) => 'sc-' + (cmp.$tagName$);
|
|
258
315
|
/**
|
|
259
316
|
* Production setAccessor() function based on Preact by
|
|
260
317
|
* Jason Miller (@developit)
|
|
@@ -426,6 +483,21 @@ const createElm = (oldParentVNode, newParentVNode, childIndex, parentElm) => {
|
|
|
426
483
|
}
|
|
427
484
|
return elm;
|
|
428
485
|
};
|
|
486
|
+
/**
|
|
487
|
+
* Create DOM nodes corresponding to a list of {@link d.Vnode} objects and
|
|
488
|
+
* add them to the DOM in the appropriate place.
|
|
489
|
+
*
|
|
490
|
+
* @param parentElm the DOM node which should be used as a parent for the new
|
|
491
|
+
* DOM nodes
|
|
492
|
+
* @param before a child of the `parentElm` which the new children should be
|
|
493
|
+
* inserted before (optional)
|
|
494
|
+
* @param parentVNode the parent virtual DOM node
|
|
495
|
+
* @param vnodes the new child virtual DOM nodes to produce DOM nodes for
|
|
496
|
+
* @param startIdx the index in the child virtual DOM nodes at which to start
|
|
497
|
+
* creating DOM nodes (inclusive)
|
|
498
|
+
* @param endIdx the index in the child virtual DOM nodes at which to stop
|
|
499
|
+
* creating DOM nodes (inclusive)
|
|
500
|
+
*/
|
|
429
501
|
const addVnodes = (parentElm, before, parentVNode, vnodes, startIdx, endIdx) => {
|
|
430
502
|
let containerElm = (parentElm);
|
|
431
503
|
let childNode;
|
|
@@ -442,6 +514,19 @@ const addVnodes = (parentElm, before, parentVNode, vnodes, startIdx, endIdx) =>
|
|
|
442
514
|
}
|
|
443
515
|
}
|
|
444
516
|
};
|
|
517
|
+
/**
|
|
518
|
+
* Remove the DOM elements corresponding to a list of {@link d.VNode} objects.
|
|
519
|
+
* This can be used to, for instance, clean up after a list of children which
|
|
520
|
+
* should no longer be shown.
|
|
521
|
+
*
|
|
522
|
+
* This function also handles some of Stencil's slot relocation logic.
|
|
523
|
+
*
|
|
524
|
+
* @param vnodes a list of virtual DOM nodes to remove
|
|
525
|
+
* @param startIdx the index at which to start removing nodes (inclusive)
|
|
526
|
+
* @param endIdx the index at which to stop removing nodes (inclusive)
|
|
527
|
+
* @param vnode a VNode
|
|
528
|
+
* @param elm an element
|
|
529
|
+
*/
|
|
445
530
|
const removeVnodes = (vnodes, startIdx, endIdx, vnode, elm) => {
|
|
446
531
|
for (; startIdx <= endIdx; ++startIdx) {
|
|
447
532
|
if ((vnode = vnodes[startIdx])) {
|
|
@@ -634,7 +719,8 @@ const updateChildren = (parentElm, oldCh, newVNode, newCh) => {
|
|
|
634
719
|
*
|
|
635
720
|
* So, in other words, if `key` attrs are not set on VNodes which may be
|
|
636
721
|
* changing order within a `children` array or something along those lines then
|
|
637
|
-
* we could obtain a false
|
|
722
|
+
* we could obtain a false negative and then have to do needless re-rendering
|
|
723
|
+
* (i.e. we'd say two VNodes aren't equal when in fact they should be).
|
|
638
724
|
*
|
|
639
725
|
* @param leftVNode the first VNode to check
|
|
640
726
|
* @param rightVNode the second VNode to check
|
|
@@ -704,6 +790,18 @@ const callNodeRefs = (vNode) => {
|
|
|
704
790
|
vNode.$children$ && vNode.$children$.map(callNodeRefs);
|
|
705
791
|
}
|
|
706
792
|
};
|
|
793
|
+
/**
|
|
794
|
+
* The main entry point for Stencil's virtual DOM-based rendering engine
|
|
795
|
+
*
|
|
796
|
+
* Given a {@link d.HostRef} container and some virtual DOM nodes, this
|
|
797
|
+
* function will handle creating a virtual DOM tree with a single root, patching
|
|
798
|
+
* the current virtual DOM tree onto an old one (if any), dealing with slot
|
|
799
|
+
* relocation, and reflecting attributes.
|
|
800
|
+
*
|
|
801
|
+
* @param hostRef data needed to root and render the virtual DOM tree, such as
|
|
802
|
+
* the DOM node into which it should be rendered.
|
|
803
|
+
* @param renderFnResults the virtual DOM nodes to be rendered
|
|
804
|
+
*/
|
|
707
805
|
const renderVdom = (hostRef, renderFnResults) => {
|
|
708
806
|
const hostElm = hostRef.$hostElement$;
|
|
709
807
|
const oldVNode = hostRef.$vnode$ || newVNode(null, null);
|
|
@@ -719,19 +817,6 @@ const renderVdom = (hostRef, renderFnResults) => {
|
|
|
719
817
|
// synchronous patch
|
|
720
818
|
patch(oldVNode, rootVnode);
|
|
721
819
|
};
|
|
722
|
-
const getElement = (ref) => (getHostRef(ref).$hostElement$ );
|
|
723
|
-
/**
|
|
724
|
-
* Helper function to create & dispatch a custom Event on a provided target
|
|
725
|
-
* @param elm the target of the Event
|
|
726
|
-
* @param name the name to give the custom Event
|
|
727
|
-
* @param opts options for configuring a custom Event
|
|
728
|
-
* @returns the custom Event
|
|
729
|
-
*/
|
|
730
|
-
const emitEvent = (elm, name, opts) => {
|
|
731
|
-
const ev = plt.ce(name, opts);
|
|
732
|
-
elm.dispatchEvent(ev);
|
|
733
|
-
return ev;
|
|
734
|
-
};
|
|
735
820
|
const attachToAncestor = (hostRef, ancestorComponent) => {
|
|
736
821
|
if (ancestorComponent && !hostRef.$onRenderResolve$ && ancestorComponent['s-p']) {
|
|
737
822
|
ancestorComponent['s-p'].push(new Promise((r) => (hostRef.$onRenderResolve$ = r)));
|
|
@@ -915,53 +1000,6 @@ const then = (promise, thenFn) => {
|
|
|
915
1000
|
};
|
|
916
1001
|
const addHydratedFlag = (elm) => elm.classList.add('hydrated')
|
|
917
1002
|
;
|
|
918
|
-
/**
|
|
919
|
-
* Parse a new property value for a given property type.
|
|
920
|
-
*
|
|
921
|
-
* While the prop value can reasonably be expected to be of `any` type as far as TypeScript's type checker is concerned,
|
|
922
|
-
* it is not safe to assume that the string returned by evaluating `typeof propValue` matches:
|
|
923
|
-
* 1. `any`, the type given to `propValue` in the function signature
|
|
924
|
-
* 2. the type stored from `propType`.
|
|
925
|
-
*
|
|
926
|
-
* This function provides the capability to parse/coerce a property's value to potentially any other JavaScript type.
|
|
927
|
-
*
|
|
928
|
-
* Property values represented in TSX preserve their type information. In the example below, the number 0 is passed to
|
|
929
|
-
* a component. This `propValue` will preserve its type information (`typeof propValue === 'number'`). Note that is
|
|
930
|
-
* based on the type of the value being passed in, not the type declared of the class member decorated with `@Prop`.
|
|
931
|
-
* ```tsx
|
|
932
|
-
* <my-cmp prop-val={0}></my-cmp>
|
|
933
|
-
* ```
|
|
934
|
-
*
|
|
935
|
-
* HTML prop values on the other hand, will always a string
|
|
936
|
-
*
|
|
937
|
-
* @param propValue the new value to coerce to some type
|
|
938
|
-
* @param propType the type of the prop, expressed as a binary number
|
|
939
|
-
* @returns the parsed/coerced value
|
|
940
|
-
*/
|
|
941
|
-
const parsePropertyValue = (propValue, propType) => {
|
|
942
|
-
// ensure this value is of the correct prop type
|
|
943
|
-
if (propValue != null && !isComplexType(propValue)) {
|
|
944
|
-
if (propType & 4 /* MEMBER_FLAGS.Boolean */) {
|
|
945
|
-
// per the HTML spec, any string value means it is a boolean true value
|
|
946
|
-
// but we'll cheat here and say that the string "false" is the boolean false
|
|
947
|
-
return propValue === 'false' ? false : propValue === '' || !!propValue;
|
|
948
|
-
}
|
|
949
|
-
if (propType & 2 /* MEMBER_FLAGS.Number */) {
|
|
950
|
-
// force it to be a number
|
|
951
|
-
return parseFloat(propValue);
|
|
952
|
-
}
|
|
953
|
-
if (propType & 1 /* MEMBER_FLAGS.String */) {
|
|
954
|
-
// could have been passed as a number or boolean
|
|
955
|
-
// but we still want it as a string
|
|
956
|
-
return String(propValue);
|
|
957
|
-
}
|
|
958
|
-
// redundant return here for better minification
|
|
959
|
-
return propValue;
|
|
960
|
-
}
|
|
961
|
-
// not sure exactly what type we want
|
|
962
|
-
// so no need to change to a different type
|
|
963
|
-
return propValue;
|
|
964
|
-
};
|
|
965
1003
|
const getValue = (ref, propName) => getHostRef(ref).$instanceValues$.get(propName);
|
|
966
1004
|
const setValue = (ref, propName, newVal, cmpMeta) => {
|
|
967
1005
|
// check our new property value against our internal value
|
|
@@ -1005,6 +1043,16 @@ const setValue = (ref, propName, newVal, cmpMeta) => {
|
|
|
1005
1043
|
}
|
|
1006
1044
|
}
|
|
1007
1045
|
};
|
|
1046
|
+
/**
|
|
1047
|
+
* Attach a series of runtime constructs to a compiled Stencil component
|
|
1048
|
+
* constructor, including getters and setters for the `@Prop` and `@State`
|
|
1049
|
+
* decorators, callbacks for when attributes change, and so on.
|
|
1050
|
+
*
|
|
1051
|
+
* @param Cstr the constructor for a component that we need to process
|
|
1052
|
+
* @param cmpMeta metadata collected previously about the component
|
|
1053
|
+
* @param flags a number used to store a series of bit flags
|
|
1054
|
+
* @returns a reference to the same constructor passed in (but now mutated)
|
|
1055
|
+
*/
|
|
1008
1056
|
const proxyComponent = (Cstr, cmpMeta, flags) => {
|
|
1009
1057
|
if (cmpMeta.$members$) {
|
|
1010
1058
|
if (Cstr.watchers) {
|
|
@@ -1246,6 +1294,7 @@ const disconnectedCallback = (elm) => {
|
|
|
1246
1294
|
}
|
|
1247
1295
|
};
|
|
1248
1296
|
const bootstrapLazy = (lazyBundles, options = {}) => {
|
|
1297
|
+
var _a;
|
|
1249
1298
|
const endBootstrap = createTime();
|
|
1250
1299
|
const cmpTags = [];
|
|
1251
1300
|
const exclude = options.exclude || [];
|
|
@@ -1325,6 +1374,11 @@ const bootstrapLazy = (lazyBundles, options = {}) => {
|
|
|
1325
1374
|
{
|
|
1326
1375
|
visibilityStyle.innerHTML = cmpTags + HYDRATED_CSS;
|
|
1327
1376
|
visibilityStyle.setAttribute('data-styles', '');
|
|
1377
|
+
// Apply CSP nonce to the style tag if it exists
|
|
1378
|
+
const nonce = (_a = plt.$nonce$) !== null && _a !== void 0 ? _a : queryNonceMetaTagContent(doc);
|
|
1379
|
+
if (nonce != null) {
|
|
1380
|
+
visibilityStyle.setAttribute('nonce', nonce);
|
|
1381
|
+
}
|
|
1328
1382
|
head.insertBefore(visibilityStyle, metaCharset ? metaCharset.nextSibling : head.firstChild);
|
|
1329
1383
|
}
|
|
1330
1384
|
// Process deferred connectedCallbacks now all components have been registered
|
|
@@ -1340,10 +1394,47 @@ const bootstrapLazy = (lazyBundles, options = {}) => {
|
|
|
1340
1394
|
// Fallback appLoad event
|
|
1341
1395
|
endBootstrap();
|
|
1342
1396
|
};
|
|
1343
|
-
const
|
|
1344
|
-
|
|
1345
|
-
|
|
1397
|
+
const addHostEventListeners = (elm, hostRef, listeners, attachParentListeners) => {
|
|
1398
|
+
if (listeners) {
|
|
1399
|
+
listeners.map(([flags, name, method]) => {
|
|
1400
|
+
const target = getHostListenerTarget(elm, flags) ;
|
|
1401
|
+
const handler = hostListenerProxy(hostRef, method);
|
|
1402
|
+
const opts = hostListenerOpts(flags);
|
|
1403
|
+
plt.ael(target, name, handler, opts);
|
|
1404
|
+
(hostRef.$rmListeners$ = hostRef.$rmListeners$ || []).push(() => plt.rel(target, name, handler, opts));
|
|
1405
|
+
});
|
|
1406
|
+
}
|
|
1407
|
+
};
|
|
1408
|
+
const hostListenerProxy = (hostRef, methodName) => (ev) => {
|
|
1409
|
+
try {
|
|
1410
|
+
{
|
|
1411
|
+
if (hostRef.$flags$ & 256 /* HOST_FLAGS.isListenReady */) {
|
|
1412
|
+
// instance is ready, let's call it's member method for this event
|
|
1413
|
+
hostRef.$lazyInstance$[methodName](ev);
|
|
1414
|
+
}
|
|
1415
|
+
else {
|
|
1416
|
+
(hostRef.$queuedListeners$ = hostRef.$queuedListeners$ || []).push([methodName, ev]);
|
|
1417
|
+
}
|
|
1418
|
+
}
|
|
1419
|
+
}
|
|
1420
|
+
catch (e) {
|
|
1421
|
+
consoleError(e);
|
|
1422
|
+
}
|
|
1346
1423
|
};
|
|
1424
|
+
const getHostListenerTarget = (elm, flags) => {
|
|
1425
|
+
if (flags & 8 /* LISTENER_FLAGS.TargetWindow */)
|
|
1426
|
+
return win;
|
|
1427
|
+
return elm;
|
|
1428
|
+
};
|
|
1429
|
+
// prettier-ignore
|
|
1430
|
+
const hostListenerOpts = (flags) => (flags & 2 /* LISTENER_FLAGS.Capture */) !== 0;
|
|
1431
|
+
/**
|
|
1432
|
+
* Assigns the given value to the nonce property on the runtime platform object.
|
|
1433
|
+
* During runtime, this value is used to set the nonce attribute on all dynamically created script and style tags.
|
|
1434
|
+
* @param nonce The value to be assigned to the platform nonce property.
|
|
1435
|
+
* @returns void
|
|
1436
|
+
*/
|
|
1437
|
+
const setNonce = (nonce) => (plt.$nonce$ = nonce);
|
|
1347
1438
|
const hostRefs = /*@__PURE__*/ new WeakMap();
|
|
1348
1439
|
const getHostRef = (ref) => hostRefs.get(ref);
|
|
1349
1440
|
const registerInstance = (lazyInstance, hostRef) => hostRefs.set((hostRef.$lazyInstance$ = lazyInstance), hostRef);
|
|
@@ -1387,6 +1478,27 @@ const loadModule = (cmpMeta, hostRef, hmrVersionId) => {
|
|
|
1387
1478
|
}, consoleError);
|
|
1388
1479
|
};
|
|
1389
1480
|
const styles = /*@__PURE__*/ new Map();
|
|
1481
|
+
const win = typeof window !== 'undefined' ? window : {};
|
|
1482
|
+
const doc = win.document || { head: {} };
|
|
1483
|
+
const plt = {
|
|
1484
|
+
$flags$: 0,
|
|
1485
|
+
$resourcesUrl$: '',
|
|
1486
|
+
jmp: (h) => h(),
|
|
1487
|
+
raf: (h) => requestAnimationFrame(h),
|
|
1488
|
+
ael: (el, eventName, listener, opts) => el.addEventListener(eventName, listener, opts),
|
|
1489
|
+
rel: (el, eventName, listener, opts) => el.removeEventListener(eventName, listener, opts),
|
|
1490
|
+
ce: (eventName, opts) => new CustomEvent(eventName, opts),
|
|
1491
|
+
};
|
|
1492
|
+
const promiseResolve = (v) => Promise.resolve(v);
|
|
1493
|
+
const supportsConstructableStylesheets = /*@__PURE__*/ (() => {
|
|
1494
|
+
try {
|
|
1495
|
+
new CSSStyleSheet();
|
|
1496
|
+
return typeof new CSSStyleSheet().replaceSync === 'function';
|
|
1497
|
+
}
|
|
1498
|
+
catch (e) { }
|
|
1499
|
+
return false;
|
|
1500
|
+
})()
|
|
1501
|
+
;
|
|
1390
1502
|
const queueDomReads = [];
|
|
1391
1503
|
const queueDomWrites = [];
|
|
1392
1504
|
const queueTask = (queue, write) => (cb) => {
|
|
@@ -1439,3 +1551,6 @@ exports.getRenderingRef = getRenderingRef;
|
|
|
1439
1551
|
exports.h = h;
|
|
1440
1552
|
exports.promiseResolve = promiseResolve;
|
|
1441
1553
|
exports.registerInstance = registerInstance;
|
|
1554
|
+
exports.setNonce = setNonce;
|
|
1555
|
+
|
|
1556
|
+
//# sourceMappingURL=index-5047dacb.js.map
|