diff --git a/build/build-plugins.js b/build/build-plugins.js index 742c56211ad2..f1880f62fc01 100644 --- a/build/build-plugins.js +++ b/build/build-plugins.js @@ -62,7 +62,6 @@ const getConfigByPluginKey = pluginKey => { pluginKey === 'Data' || pluginKey === 'Manipulator' || pluginKey === 'EventHandler' || - pluginKey === 'Polyfill' || pluginKey === 'SelectorEngine' || pluginKey === 'Util' || pluginKey === 'Sanitizer' diff --git a/build/rollup.config.js b/build/rollup.config.js index 1ee67455232f..05579d165a8f 100644 --- a/build/rollup.config.js +++ b/build/rollup.config.js @@ -12,7 +12,7 @@ let fileDest = `bootstrap${ESM ? '.esm' : ''}` const external = ['popper.js'] const plugins = [ babel({ - // Only transpile our source code + // Only transpile our source code exclude: 'node_modules/**', // Include the helpers in the bundle, at most one copy of each babelHelpers: 'bundled' diff --git a/js/dist/dom/polyfill.js b/js/dist/dom/polyfill.js deleted file mode 100644 index 533f7cb97ab7..000000000000 --- a/js/dist/dom/polyfill.js +++ /dev/null @@ -1,111 +0,0 @@ -/*! - * Bootstrap polyfill.js v5.0.0-alpha2 (https://getbootstrap.com/) - * Copyright 2011-2020 The Bootstrap Authors (https://github.com/twbs/bootstrap/graphs/contributors) - * Licensed under MIT (https://github.com/twbs/bootstrap/blob/main/LICENSE) - */ -(function (global, factory) { - typeof exports === 'object' && typeof module !== 'undefined' ? factory(exports) : - typeof define === 'function' && define.amd ? define(['exports'], factory) : - (global = typeof globalThis !== 'undefined' ? globalThis : global || self, factory(global.Polyfill = {})); -}(this, (function (exports) { 'use strict'; - - /** - * -------------------------------------------------------------------------- - * Bootstrap (v5.0.0-alpha2): util/index.js - * Licensed under MIT (https://github.com/twbs/bootstrap/blob/main/LICENSE) - * -------------------------------------------------------------------------- - */ - var MAX_UID = 1000000; - /** - * -------------------------------------------------------------------------- - * Public Util Api - * -------------------------------------------------------------------------- - */ - - - var getUID = function getUID(prefix) { - do { - prefix += Math.floor(Math.random() * MAX_UID); - } while (document.getElementById(prefix)); - - return prefix; - }; - - /* istanbul ignore file */ - exports.find = Element.prototype.querySelectorAll; - exports.findOne = Element.prototype.querySelector; // MSEdge resets defaultPrevented flag upon dispatchEvent call if at least one listener is attached - - var defaultPreventedPreservedOnDispatch = function () { - var e = new CustomEvent('Bootstrap', { - cancelable: true - }); - var element = document.createElement('div'); - element.addEventListener('Bootstrap', function () { - return null; - }); - e.preventDefault(); - element.dispatchEvent(e); - return e.defaultPrevented; - }(); - - var scopeSelectorRegex = /:scope\b/; - - var supportScopeQuery = function () { - var element = document.createElement('div'); - - try { - element.querySelectorAll(':scope *'); - } catch (_) { - return false; - } - - return true; - }(); - - if (!supportScopeQuery) { - exports.find = function find(selector) { - if (!scopeSelectorRegex.test(selector)) { - return this.querySelectorAll(selector); - } - - var hasId = Boolean(this.id); - - if (!hasId) { - this.id = getUID('scope'); - } - - var nodeList = null; - - try { - selector = selector.replace(scopeSelectorRegex, "#" + this.id); - nodeList = this.querySelectorAll(selector); - } finally { - if (!hasId) { - this.removeAttribute('id'); - } - } - - return nodeList; - }; - - exports.findOne = function findOne(selector) { - if (!scopeSelectorRegex.test(selector)) { - return this.querySelector(selector); - } - - var matches = exports.find.call(this, selector); - - if (typeof matches[0] !== 'undefined') { - return matches[0]; - } - - return null; - }; - } - - exports.defaultPreventedPreservedOnDispatch = defaultPreventedPreservedOnDispatch; - - Object.defineProperty(exports, '__esModule', { value: true }); - -}))); -//# sourceMappingURL=polyfill.js.map diff --git a/js/dist/dom/polyfill.js.map b/js/dist/dom/polyfill.js.map deleted file mode 100644 index 01b0b4ac12b4..000000000000 --- a/js/dist/dom/polyfill.js.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"file":"polyfill.js","sources":["../../src/util/index.js","../../src/dom/polyfill.js"],"sourcesContent":["/**\n * --------------------------------------------------------------------------\n * Bootstrap (v5.0.0-alpha2): util/index.js\n * Licensed under MIT (https://github.com/twbs/bootstrap/blob/main/LICENSE)\n * --------------------------------------------------------------------------\n */\n\nconst MAX_UID = 1000000\nconst MILLISECONDS_MULTIPLIER = 1000\nconst TRANSITION_END = 'transitionend'\n\n// Shoutout AngusCroll (https://goo.gl/pxwQGp)\nconst toType = obj => {\n if (obj === null || obj === undefined) {\n return `${obj}`\n }\n\n return {}.toString.call(obj).match(/\\s([a-z]+)/i)[1].toLowerCase()\n}\n\n/**\n * --------------------------------------------------------------------------\n * Public Util Api\n * --------------------------------------------------------------------------\n */\n\nconst getUID = prefix => {\n do {\n prefix += Math.floor(Math.random() * MAX_UID)\n } while (document.getElementById(prefix))\n\n return prefix\n}\n\nconst getSelector = element => {\n let selector = element.getAttribute('data-target')\n\n if (!selector || selector === '#') {\n const hrefAttr = element.getAttribute('href')\n\n selector = hrefAttr && hrefAttr !== '#' ? hrefAttr.trim() : null\n }\n\n return selector\n}\n\nconst getSelectorFromElement = element => {\n const selector = getSelector(element)\n\n if (selector) {\n return document.querySelector(selector) ? selector : null\n }\n\n return null\n}\n\nconst getElementFromSelector = element => {\n const selector = getSelector(element)\n\n return selector ? document.querySelector(selector) : null\n}\n\nconst getTransitionDurationFromElement = element => {\n if (!element) {\n return 0\n }\n\n // Get transition-duration of the element\n let {\n transitionDuration,\n transitionDelay\n } = window.getComputedStyle(element)\n\n const floatTransitionDuration = parseFloat(transitionDuration)\n const floatTransitionDelay = parseFloat(transitionDelay)\n\n // Return 0 if element or transition duration is not found\n if (!floatTransitionDuration && !floatTransitionDelay) {\n return 0\n }\n\n // If multiple durations are defined, take the first\n transitionDuration = transitionDuration.split(',')[0]\n transitionDelay = transitionDelay.split(',')[0]\n\n return (parseFloat(transitionDuration) + parseFloat(transitionDelay)) * MILLISECONDS_MULTIPLIER\n}\n\nconst triggerTransitionEnd = element => {\n element.dispatchEvent(new Event(TRANSITION_END))\n}\n\nconst isElement = obj => (obj[0] || obj).nodeType\n\nconst emulateTransitionEnd = (element, duration) => {\n let called = false\n const durationPadding = 5\n const emulatedDuration = duration + durationPadding\n function listener() {\n called = true\n element.removeEventListener(TRANSITION_END, listener)\n }\n\n element.addEventListener(TRANSITION_END, listener)\n setTimeout(() => {\n if (!called) {\n triggerTransitionEnd(element)\n }\n }, emulatedDuration)\n}\n\nconst typeCheckConfig = (componentName, config, configTypes) => {\n Object.keys(configTypes).forEach(property => {\n const expectedTypes = configTypes[property]\n const value = config[property]\n const valueType = value && isElement(value) ?\n 'element' :\n toType(value)\n\n if (!new RegExp(expectedTypes).test(valueType)) {\n throw new Error(\n `${componentName.toUpperCase()}: ` +\n `Option \"${property}\" provided type \"${valueType}\" ` +\n `but expected type \"${expectedTypes}\".`)\n }\n })\n}\n\nconst isVisible = element => {\n if (!element) {\n return false\n }\n\n if (element.style && element.parentNode && element.parentNode.style) {\n const elementStyle = getComputedStyle(element)\n const parentNodeStyle = getComputedStyle(element.parentNode)\n\n return elementStyle.display !== 'none' &&\n parentNodeStyle.display !== 'none' &&\n elementStyle.visibility !== 'hidden'\n }\n\n return false\n}\n\nconst findShadowRoot = element => {\n if (!document.documentElement.attachShadow) {\n return null\n }\n\n // Can find the shadow root otherwise it'll return the document\n if (typeof element.getRootNode === 'function') {\n const root = element.getRootNode()\n return root instanceof ShadowRoot ? root : null\n }\n\n if (element instanceof ShadowRoot) {\n return element\n }\n\n // when we don't find a shadow root\n if (!element.parentNode) {\n return null\n }\n\n return findShadowRoot(element.parentNode)\n}\n\nconst noop = () => function () {}\n\nconst reflow = element => element.offsetHeight\n\nconst getjQuery = () => {\n const { jQuery } = window\n\n if (jQuery && !document.body.hasAttribute('data-no-jquery')) {\n return jQuery\n }\n\n return null\n}\n\nexport {\n getjQuery,\n TRANSITION_END,\n getUID,\n getSelectorFromElement,\n getElementFromSelector,\n getTransitionDurationFromElement,\n triggerTransitionEnd,\n isElement,\n emulateTransitionEnd,\n typeCheckConfig,\n isVisible,\n findShadowRoot,\n noop,\n reflow\n}\n","/* istanbul ignore file */\n\n/**\n * --------------------------------------------------------------------------\n * Bootstrap (v5.0.0-alpha2): dom/polyfill.js\n * Licensed under MIT (https://github.com/twbs/bootstrap/blob/main/LICENSE)\n * --------------------------------------------------------------------------\n */\n\nimport { getUID } from '../util/index'\n\nlet find = Element.prototype.querySelectorAll\nlet findOne = Element.prototype.querySelector\n\n// MSEdge resets defaultPrevented flag upon dispatchEvent call if at least one listener is attached\nconst defaultPreventedPreservedOnDispatch = (() => {\n const e = new CustomEvent('Bootstrap', {\n cancelable: true\n })\n\n const element = document.createElement('div')\n element.addEventListener('Bootstrap', () => null)\n\n e.preventDefault()\n element.dispatchEvent(e)\n return e.defaultPrevented\n})()\n\nconst scopeSelectorRegex = /:scope\\b/\nconst supportScopeQuery = (() => {\n const element = document.createElement('div')\n\n try {\n element.querySelectorAll(':scope *')\n } catch (_) {\n return false\n }\n\n return true\n})()\n\nif (!supportScopeQuery) {\n find = function (selector) {\n if (!scopeSelectorRegex.test(selector)) {\n return this.querySelectorAll(selector)\n }\n\n const hasId = Boolean(this.id)\n\n if (!hasId) {\n this.id = getUID('scope')\n }\n\n let nodeList = null\n try {\n selector = selector.replace(scopeSelectorRegex, `#${this.id}`)\n nodeList = this.querySelectorAll(selector)\n } finally {\n if (!hasId) {\n this.removeAttribute('id')\n }\n }\n\n return nodeList\n }\n\n findOne = function (selector) {\n if (!scopeSelectorRegex.test(selector)) {\n return this.querySelector(selector)\n }\n\n const matches = find.call(this, selector)\n\n if (typeof matches[0] !== 'undefined') {\n return matches[0]\n }\n\n return null\n }\n}\n\nexport {\n find,\n findOne,\n defaultPreventedPreservedOnDispatch\n}\n"],"names":["MAX_UID","getUID","prefix","Math","floor","random","document","getElementById","find","Element","prototype","querySelectorAll","findOne","querySelector","defaultPreventedPreservedOnDispatch","e","CustomEvent","cancelable","element","createElement","addEventListener","preventDefault","dispatchEvent","defaultPrevented","scopeSelectorRegex","supportScopeQuery","_","selector","test","hasId","Boolean","id","nodeList","replace","removeAttribute","matches","call"],"mappings":";;;;;;;;;;;EAAA;EACA;EACA;EACA;EACA;EACA;EAEA,IAAMA,OAAO,GAAG,OAAhB;EAaA;EACA;EACA;EACA;E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