UNPKG

@claromentis/design-system

Version:

Claromentis Design System Component Library

123 lines (120 loc) 8.7 kB
import { d as doc, N as NAMESPACE, w as win, p as promiseResolve, a as plt, H, b as bootstrapLazy } from './index-f2c46e82.js'; export { s as setNonce } from './index-f2c46e82.js'; /* Stencil Client Patch Browser v2.22.3 | MIT Licensed | https://stenciljs.com */ /** * Helper method for querying a `meta` tag that contains a nonce value * out of a DOM's head. * * @param doc The DOM containing the `head` to query against * @returns The content of the meta tag representing the nonce value, or `undefined` if no tag * exists or the tag has no content. */ function queryNonceMetaTagContent(doc) { var _a, _b, _c; 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; } const getDynamicImportFunction = (namespace) => `__sc_import_${namespace.replace(/\s|-/g, '_')}`; const patchBrowser = () => { { // opted-in to polyfill cloneNode() for slot polyfilled components patchCloneNodeFix(H.prototype); } // @ts-ignore const scriptElm = Array.from(doc.querySelectorAll('script')).find((s) => new RegExp(`\/${NAMESPACE}(\\.esm)?\\.js($|\\?|#)`).test(s.src) || s.getAttribute('data-stencil-namespace') === NAMESPACE) ; const opts = {}; if ('onbeforeload' in scriptElm && !history.scrollRestoration /* IS_ESM_BUILD */) { // Safari < v11 support: This IF is true if it's Safari below v11. // This fn cannot use async/await since Safari didn't support it until v11, // however, Safari 10 did support modules. Safari 10 also didn't support "nomodule", // so both the ESM file and nomodule file would get downloaded. Only Safari // has 'onbeforeload' in the script, and "history.scrollRestoration" was added // to Safari in v11. Return a noop then() so the async/await ESM code doesn't continue. // IS_ESM_BUILD is replaced at build time so this check doesn't happen in systemjs builds. return { then() { /* promise noop */ }, }; } { opts.resourcesUrl = new URL('.', new URL(scriptElm.getAttribute('data-resources-url') || scriptElm.src, win.location.href)).href; { patchDynamicImport(opts.resourcesUrl, scriptElm); } if (!win.customElements) { // module support, but no custom elements support (Old Edge) // @ts-ignore return import(/* webpackChunkName: "polyfills-dom" */ './dom-64053c71.js').then(() => opts); } } return promiseResolve(opts); }; const patchDynamicImport = (base, orgScriptElm) => { const importFunctionName = getDynamicImportFunction(NAMESPACE); try { // test if this browser supports dynamic imports // There is a caching issue in V8, that breaks using import() in Function // By generating a random string, we can workaround it // Check https://bugs.chromium.org/p/chromium/issues/detail?id=990810 for more info win[importFunctionName] = new Function('w', `return import(w);//${Math.random()}`); } catch (e) { // this shim is specifically for browsers that do support "esm" imports // however, they do NOT support "dynamic" imports // basically this code is for old Edge, v18 and below const moduleMap = new Map(); win[importFunctionName] = (src) => { var _a; const url = new URL(src, base).href; let mod = moduleMap.get(url); if (!mod) { const script = doc.createElement('script'); script.type = 'module'; script.crossOrigin = orgScriptElm.crossOrigin; script.src = URL.createObjectURL(new Blob([`import * as m from '${url}'; window.${importFunctionName}.m = m;`], { type: 'application/javascript', })); // Apply CSP nonce to the script tag if it exists const nonce = (_a = plt.$nonce$) !== null && _a !== void 0 ? _a : queryNonceMetaTagContent(doc); if (nonce != null) { script.setAttribute('nonce', nonce); } mod = new Promise((resolve) => { script.onload = () => { resolve(win[importFunctionName].m); script.remove(); }; }); moduleMap.set(url, mod); doc.head.appendChild(script); } return mod; }; } }; const patchCloneNodeFix = (HTMLElementPrototype) => { const nativeCloneNodeFn = HTMLElementPrototype.cloneNode; HTMLElementPrototype.cloneNode = function (deep) { if (this.nodeName === 'TEMPLATE') { return nativeCloneNodeFn.call(this, deep); } const clonedNode = nativeCloneNodeFn.call(this, false); const srcChildNodes = this.childNodes; if (deep) { for (let i = 0; i < srcChildNodes.length; i++) { // Node.ATTRIBUTE_NODE === 2, and checking because IE11 if (srcChildNodes[i].nodeType !== 2) { clonedNode.appendChild(srcChildNodes[i].cloneNode(true)); } } } return clonedNode; }; }; patchBrowser().then(options => { return bootstrapLazy([["cla-card-header",[[1,"cla-card-header"]]],["cla-wrapped-buttons",[[1,"cla-wrapped-buttons",{"styleclass":[1],"primarybuttontext":[1],"primarybuttonhref":[1],"primarybuttonclass":[1],"secondarybuttontext":[1],"secondarybuttonhref":[1],"secondarybuttonclass":[1]}]]],["cla-badge_29",[[1,"cla-card-media",{"placeholder":[1],"height":[1],"styleclass":[1],"preserveaspect":[4],"bgcolor":[1],"iconcolor":[1]}],[4,"cla-picker",{"name":[1025],"value":[1032],"displayinput":[4],"block":[4],"image":[1],"iconid":[1],"pickerLabelText":[1025,"picker-label-text"],"showlabeltext":[1028],"checked":[1028],"disabled":[4]},[[0,"click","onClick"]]],[1,"cla-badge",{"styleclass":[1],"colour":[1]}],[1,"cla-banner",{"position":[1]}],[1,"cla-button",{"type":[1025],"name":[1],"value":[8],"color":[1],"size":[1],"block":[4],"outline":[4],"disabled":[516]},[[0,"click","onClick"]]],[1,"cla-card",{"href":[1],"styleclass":[1],"statusborder":[1]}],[1,"cla-card-figure"],[1,"cla-card-footer"],[1,"cla-card-image",{"img":[1],"alt":[1]}],[4,"cla-checkbox",{"name":[1],"large":[4],"inverted":[4],"value":[2],"block":[4],"disabled":[516],"checked":[1028]}],[1,"cla-insignia",{"colour":[1],"width":[1],"shape":[1],"type":[1]}],[1,"cla-insignia-image",{"source":[1],"alt":[1]}],[1,"cla-item",{"orientate":[1]}],[1,"cla-label",{"hidden":[4]}],[1,"cla-menu",{"closeOnSelect":[4,"close-on-select"],"toggle":[32],"isMobile":[32]},[[9,"mousedown","handleClick"],[9,"resize","handleWindowResize"],[8,"keydown","handleKeyDown"]]],[1,"cla-nav",{"inline":[4]}],[1,"cla-nav-item",{"active":[4],"navtitle":[4],"href":[8],"name":[8],"size":[1]}],[1,"cla-picker-group",{"multiselectable":[4]},[[0,"claPickerSelect","onPickerSelect"],[0,"claPickerDeselect","onPickerDeselect"],[0,"claPickerDidLoad","onSelectDidLoad"]]],[1,"cla-popover",{"toggle":[32]},[[9,"mousedown","clickOff"]]],[1,"cla-progress",{"minimum":[2],"current":[2],"maximum":[2],"barcolour":[1],"percentageComplete":[1026,"percentage-complete"],"percentageRemaining":[1026,"percentage-remaining"],"showprogresstext":[4],"showremainingtext":[4],"hideremainingprogress":[4],"unit":[1],"showvalueas":[1],"showunit":[4],"width":[1],"height":[1]}],[1,"cla-progress-circle",{"percentage":[2],"primarycolor":[1],"size":[1],"inverted":[4],"customtext":[1]}],[4,"cla-radio",{"name":[1],"large":[4],"inverted":[4],"value":[8],"block":[4],"disabled":[516],"checked":[1028]}],[1,"cla-status-indicator",{"color":[1],"shape":[1],"size":[1],"statusletter":[1],"badgestyle":[4],"inverted":[4],"rtl":[4]}],[1,"cla-structured-list",{"inverted":[4],"rtl":[4],"sortable":[4]}],[4,"cla-toggle-switch",{"name":[1],"ontext":[1],"offtext":[1],"large":[4],"inverted":[4],"value":[2],"block":[4],"disabled":[516],"checked":[1028]}],[1,"cla-user-list",{"styleclass":[1],"title":[1],"href":[1],"plusnumber":[2]}],[1,"cla-user-list-item",{"href":[1],"img":[1]}],[1,"cla-icon",{"iconid":[1],"fill":[1025],"status":[1025]}],[1,"ion-icon",{"mode":[1025],"color":[1],"ariaLabel":[1537,"aria-label"],"ariaHidden":[513,"aria-hidden"],"ios":[1],"md":[1],"flipRtl":[4,"flip-rtl"],"name":[513],"src":[1],"icon":[8],"size":[1],"lazy":[4],"sanitize":[4],"svgContent":[32],"isVisible":[32]}]]]], options); });