UNPKG

@bulmil/core

Version:

![bulmil](https://user-images.githubusercontent.com/2362138/65766959-c721a080-e16f-11e9-9fb9-45a5a2ad0391.jpg)

84 lines (80 loc) 8.52 kB
'use strict'; const index = require('./index-5d375335.js'); /* Stencil Client Patch Browser v2.0.1 | MIT Licensed | https://stenciljs.com */ const getDynamicImportFunction = (namespace) => `__sc_import_${namespace.replace(/\s|-/g, '_')}`; const patchBrowser = () => { { // shim css vars index.plt.$cssShim$ = index.win.__cssshim; } // @ts-ignore const scriptElm = Array.from(index.doc.querySelectorAll('script')).find(s => new RegExp(`\/${index.NAMESPACE}(\\.esm)?\\.js($|\\?|#)`).test(s.src) || s.getAttribute('data-stencil-namespace') === index.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, index.win.location.href)).href; { patchDynamicImport(opts.resourcesUrl, scriptElm); } if ( !index.win.customElements) { // module support, but no custom elements support (Old Edge) // @ts-ignore return Promise.resolve().then(function () { return require(/* webpackChunkName: "polyfills-dom" */ './dom-4fd1a369.js'); }).then(() => opts); } } return index.promiseResolve(opts); }; const patchDynamicImport = (base, orgScriptElm) => { const importFunctionName = getDynamicImportFunction(index.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 index.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(); index.win[importFunctionName] = (src) => { const url = new URL(src, base).href; let mod = moduleMap.get(url); if (!mod) { const script = index.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' })); mod = new Promise(resolve => { script.onload = () => { resolve(index.win[importFunctionName].m); script.remove(); }; }); moduleMap.set(url, mod); index.doc.head.appendChild(script); } return mod; }; } }; patchBrowser().then(options => { return index.bootstrapLazy([["bm-badge.cjs",[[4,"bm-badge",{"color":[1],"position":[1],"isOutlined":[4,"is-outlined"],"isLight":[4,"is-light"]}]]],["bm-box.cjs",[[4,"bm-box"]]],["bm-breadcrumb.cjs",[[4,"bm-breadcrumb",{"alignment":[1],"size":[1],"separator":[1]}]]],["bm-button.cjs",[[4,"bm-button",{"disabled":[4],"color":[1],"size":[1],"isFullwidth":[4,"is-fullwidth"],"isOutlined":[4,"is-outlined"],"isLight":[4,"is-light"],"isInverted":[4,"is-inverted"],"isRounded":[4,"is-rounded"],"isHovered":[4,"is-hovered"],"isFocused":[4,"is-focused"],"isActive":[4,"is-active"],"isStatic":[4,"is-static"],"isLoading":[4,"is-loading"]}]]],["bm-buttons.cjs",[[4,"bm-buttons",{"size":[1]}]]],["bm-card.cjs",[[4,"bm-card"]]],["bm-card-content.cjs",[[4,"bm-card-content"]]],["bm-card-footer.cjs",[[4,"bm-card-footer"]]],["bm-card-header.cjs",[[4,"bm-card-header"]]],["bm-card-image.cjs",[[4,"bm-card-image"]]],["bm-checkbox.cjs",[[4,"bm-checkbox",{"inputClass":[1,"input-class"],"labelClass":[1,"label-class"],"checked":[4],"disabled":[4]}]]],["bm-column.cjs",[[0,"bm-column",{"sizes":[1],"isNarrow":[4,"is-narrow"]}]]],["bm-columns.cjs",[[0,"bm-columns",{"isCentered":[4,"is-centered"],"isMobile":[4,"is-mobile"],"isDesktop":[4,"is-desktop"],"isMultiline":[4,"is-multiline"],"isGapless":[4,"is-gapless"],"isVcentered":[4,"is-vcentered"],"gaps":[1]}]]],["bm-container.cjs",[[0,"bm-container",{"breakpoint":[1],"isFluid":[4,"is-fluid"]}]]],["bm-content.cjs",[[4,"bm-content",{"size":[1]}]]],["bm-divider.cjs",[[4,"bm-divider",{"alignment":[1],"color":[1],"isLight":[4,"is-light"],"isVertical":[4,"is-vertical"]}]]],["bm-dropdown.cjs",[[4,"bm-dropdown",{"isActive":[1540,"is-active"],"isRight":[4,"is-right"],"isUp":[4,"is-up"],"isHoverable":[4,"is-hoverable"]}]]],["bm-field.cjs",[[4,"bm-field",{"label":[1],"message":[1],"hasAddons":[4,"has-addons"],"size":[1],"isHorizontal":[4,"is-horizontal"],"isGrouped":[4,"is-grouped"],"isGroupedMultiline":[4,"is-grouped-multiline"]}]]],["bm-file.cjs",[[0,"bm-file",{"name":[1],"placeholder":[1],"color":[1],"size":[1],"alignment":[1],"hasName":[4,"has-name"],"isRight":[4,"is-right"],"isFullwidth":[4,"is-fullwidth"],"file":[1040],"isBoxed":[4,"is-boxed"]}]]],["bm-footer.cjs",[[4,"bm-footer"]]],["bm-icon.cjs",[[4,"bm-icon",{"color":[1],"size":[1]}]]],["bm-image.cjs",[[4,"bm-image",{"size":[1]}]]],["bm-input.cjs",[[0,"bm-input",{"controlClass":[1,"control-class"],"placeholder":[1],"value":[8],"type":[1],"color":[1],"size":[1],"state":[1],"name":[1],"required":[4],"disabled":[4],"readonly":[4],"isRounded":[4,"is-rounded"],"isLoading":[4,"is-loading"],"isStatic":[4,"is-static"]}]]],["bm-menu.cjs",[[4,"bm-menu"]]],["bm-message.cjs",[[4,"bm-message",{"color":[1],"size":[1]}]]],["bm-modal.cjs",[[4,"bm-modal",{"isActive":[1540,"is-active"],"hasModalCard":[4,"has-modal-card"]}]]],["bm-navbar.cjs",[[4,"bm-navbar",{"isTransparent":[4,"is-transparent"],"color":[1],"fixedPosition":[1,"fixed-position"],"isSpaced":[4,"is-spaced"]}]]],["bm-notification.cjs",[[4,"bm-notification",{"color":[1],"dismissable":[4]}]]],["bm-pagination.cjs",[[4,"bm-pagination",{"size":[1],"alignment":[1],"isRounded":[4,"is-rounded"]}]]],["bm-panel.cjs",[[4,"bm-panel",{"color":[1]}]]],["bm-progress.cjs",[[0,"bm-progress",{"value":[2],"max":[2],"color":[1],"size":[1]}]]],["bm-radio.cjs",[[4,"bm-radio",{"inputClass":[1,"input-class"],"labelClass":[1,"label-class"],"name":[1],"checked":[4],"disabled":[4]}]]],["bm-section.cjs",[[0,"bm-section",{"size":[1]}]]],["bm-select.cjs",[[4,"bm-select",{"controlClass":[1,"control-class"],"color":[1],"size":[1],"state":[1],"isMultiple":[4,"is-multiple"],"isLoading":[4,"is-loading"],"isRounded":[4,"is-rounded"],"icon":[1]}]]],["bm-slider.cjs",[[0,"bm-slider",{"step":[2],"min":[2],"max":[2],"value":[514],"color":[1],"size":[1],"isCircle":[4,"is-circle"],"disabled":[4]}]]],["bm-switch.cjs",[[4,"bm-switch",{"color":[1],"size":[1],"isThin":[4,"is-thin"],"isRounded":[4,"is-rounded"],"isOutlined":[4,"is-outlined"],"disabled":[4],"checked":[1028]}]]],["bm-table.cjs",[[4,"bm-table",{"isBordered":[4,"is-bordered"],"isStriped":[4,"is-striped"],"isScrollable":[4,"is-scrollable"],"isNarrow":[4,"is-narrow"],"isHoverable":[4,"is-hoverable"],"isFullwidth":[4,"is-fullwidth"]}]]],["bm-tabs.cjs",[[4,"bm-tabs",{"size":[1],"alignment":[1],"tabStyle":[1,"tab-style"],"isRounded":[4,"is-rounded"],"isFullwidth":[4,"is-fullwidth"]}]]],["bm-tag.cjs",[[4,"bm-tag",{"tag":[1],"color":[1],"size":[1],"modifier":[1]}]]],["bm-tags.cjs",[[4,"bm-tags",{"size":[1],"hasAddons":[4,"has-addons"]}]]],["bm-textarea.cjs",[[0,"bm-textarea",{"controlClass":[1,"control-class"],"value":[8],"color":[1],"size":[1],"state":[1],"readonly":[4],"disabled":[4],"isLoading":[4,"is-loading"],"hasFixedSize":[4,"has-fixed-size"],"rows":[2]}]]]], options); });