publishing_platform_publishing_components 0.1.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.
- checksums.yaml +7 -0
- data/LICENSE +22 -0
- data/README.md +2 -0
- data/Rakefile +41 -0
- data/app/assets/builds/gemkeep +0 -0
- data/app/assets/config/publishing_platform_publishing_components_manifest.js +2 -0
- data/app/assets/images/publishing_platform_publishing_components/gemkeep +0 -0
- data/app/assets/stylesheets/publishing_platform_publishing_components/_all_components.scss +3 -0
- data/app/assets/stylesheets/publishing_platform_publishing_components/components/_attachment.scss +117 -0
- data/app/assets/stylesheets/publishing_platform_publishing_components/components/_summary-list.scss +169 -0
- data/app/controllers/publishing_platform_publishing_components/application_controller.rb +4 -0
- data/app/helpers/publishing_platform_publishing_components/application_helper.rb +4 -0
- data/app/models/publishing_platform_publishing_components/component_doc.rb +90 -0
- data/app/models/publishing_platform_publishing_components/component_docs.rb +57 -0
- data/app/models/publishing_platform_publishing_components/component_example.rb +104 -0
- data/app/models/publishing_platform_publishing_components/shared_accessibility_criteria.rb +37 -0
- data/app/views/publishing_platform_publishing_components/component_doc/_component_output.html.erb +15 -0
- data/app/views/publishing_platform_publishing_components/components/_attachment.html.erb +91 -0
- data/app/views/publishing_platform_publishing_components/components/_error_summary.html.erb +38 -0
- data/app/views/publishing_platform_publishing_components/components/_summary_list.html.erb +135 -0
- data/app/views/publishing_platform_publishing_components/components/attachment/_thumbnail_document.html.erb +3 -0
- data/app/views/publishing_platform_publishing_components/components/attachment/_thumbnail_external.html.erb +3 -0
- data/app/views/publishing_platform_publishing_components/components/attachment/_thumbnail_generic.html.erb +4 -0
- data/app/views/publishing_platform_publishing_components/components/attachment/_thumbnail_html.html.erb +3 -0
- data/app/views/publishing_platform_publishing_components/components/attachment/_thumbnail_pdf.html.erb +3 -0
- data/app/views/publishing_platform_publishing_components/components/attachment/_thumbnail_spreadsheet.html.erb +5 -0
- data/app/views/publishing_platform_publishing_components/components/docs/attachment.yml +104 -0
- data/app/views/publishing_platform_publishing_components/components/docs/error_summary.yml +51 -0
- data/app/views/publishing_platform_publishing_components/components/docs/summary_list.yml +137 -0
- data/config/initializers/assets.rb +24 -0
- data/config/routes.rb +2 -0
- data/lib/publishing_platform_publishing_components/config.rb +25 -0
- data/lib/publishing_platform_publishing_components/engine.rb +5 -0
- data/lib/publishing_platform_publishing_components/presenters/attachment_helper.rb +176 -0
- data/lib/publishing_platform_publishing_components/presenters/component_wrapper_helper.rb +290 -0
- data/lib/publishing_platform_publishing_components/presenters/shared_helper.rb +24 -0
- data/lib/publishing_platform_publishing_components/version.rb +3 -0
- data/lib/publishing_platform_publishing_components.rb +10 -0
- data/lib/tasks/publishing_platform_publishing_components_tasks.rake +4 -0
- data/node_modules/bootstrap/LICENSE +21 -0
- data/node_modules/bootstrap/README.md +246 -0
- data/node_modules/bootstrap/dist/css/bootstrap-grid.css +4085 -0
- data/node_modules/bootstrap/dist/css/bootstrap-grid.css.map +1 -0
- data/node_modules/bootstrap/dist/css/bootstrap-grid.min.css +6 -0
- data/node_modules/bootstrap/dist/css/bootstrap-grid.min.css.map +1 -0
- data/node_modules/bootstrap/dist/css/bootstrap-grid.rtl.css +4084 -0
- data/node_modules/bootstrap/dist/css/bootstrap-grid.rtl.css.map +1 -0
- data/node_modules/bootstrap/dist/css/bootstrap-grid.rtl.min.css +6 -0
- data/node_modules/bootstrap/dist/css/bootstrap-grid.rtl.min.css.map +1 -0
- data/node_modules/bootstrap/dist/css/bootstrap-reboot.css +601 -0
- data/node_modules/bootstrap/dist/css/bootstrap-reboot.css.map +1 -0
- data/node_modules/bootstrap/dist/css/bootstrap-reboot.min.css +6 -0
- data/node_modules/bootstrap/dist/css/bootstrap-reboot.min.css.map +1 -0
- data/node_modules/bootstrap/dist/css/bootstrap-reboot.rtl.css +598 -0
- data/node_modules/bootstrap/dist/css/bootstrap-reboot.rtl.css.map +1 -0
- data/node_modules/bootstrap/dist/css/bootstrap-reboot.rtl.min.css +6 -0
- data/node_modules/bootstrap/dist/css/bootstrap-reboot.rtl.min.css.map +1 -0
- data/node_modules/bootstrap/dist/css/bootstrap-utilities.css +5406 -0
- data/node_modules/bootstrap/dist/css/bootstrap-utilities.css.map +1 -0
- data/node_modules/bootstrap/dist/css/bootstrap-utilities.min.css +6 -0
- data/node_modules/bootstrap/dist/css/bootstrap-utilities.min.css.map +1 -0
- data/node_modules/bootstrap/dist/css/bootstrap-utilities.rtl.css +5397 -0
- data/node_modules/bootstrap/dist/css/bootstrap-utilities.rtl.css.map +1 -0
- data/node_modules/bootstrap/dist/css/bootstrap-utilities.rtl.min.css +6 -0
- data/node_modules/bootstrap/dist/css/bootstrap-utilities.rtl.min.css.map +1 -0
- data/node_modules/bootstrap/dist/css/bootstrap.css +12048 -0
- data/node_modules/bootstrap/dist/css/bootstrap.css.map +1 -0
- data/node_modules/bootstrap/dist/css/bootstrap.min.css +6 -0
- data/node_modules/bootstrap/dist/css/bootstrap.min.css.map +1 -0
- data/node_modules/bootstrap/dist/css/bootstrap.rtl.css +12021 -0
- data/node_modules/bootstrap/dist/css/bootstrap.rtl.css.map +1 -0
- data/node_modules/bootstrap/dist/css/bootstrap.rtl.min.css +6 -0
- data/node_modules/bootstrap/dist/css/bootstrap.rtl.min.css.map +1 -0
- data/node_modules/bootstrap/dist/js/bootstrap.bundle.js +6312 -0
- data/node_modules/bootstrap/dist/js/bootstrap.bundle.js.map +1 -0
- data/node_modules/bootstrap/dist/js/bootstrap.bundle.min.js +7 -0
- data/node_modules/bootstrap/dist/js/bootstrap.bundle.min.js.map +1 -0
- data/node_modules/bootstrap/dist/js/bootstrap.esm.js +4447 -0
- data/node_modules/bootstrap/dist/js/bootstrap.esm.js.map +1 -0
- data/node_modules/bootstrap/dist/js/bootstrap.esm.min.js +7 -0
- data/node_modules/bootstrap/dist/js/bootstrap.esm.min.js.map +1 -0
- data/node_modules/bootstrap/dist/js/bootstrap.js +4494 -0
- data/node_modules/bootstrap/dist/js/bootstrap.js.map +1 -0
- data/node_modules/bootstrap/dist/js/bootstrap.min.js +7 -0
- data/node_modules/bootstrap/dist/js/bootstrap.min.js.map +1 -0
- data/node_modules/bootstrap/js/dist/alert.js +90 -0
- data/node_modules/bootstrap/js/dist/alert.js.map +1 -0
- data/node_modules/bootstrap/js/dist/base-component.js +86 -0
- data/node_modules/bootstrap/js/dist/base-component.js.map +1 -0
- data/node_modules/bootstrap/js/dist/button.js +79 -0
- data/node_modules/bootstrap/js/dist/button.js.map +1 -0
- data/node_modules/bootstrap/js/dist/carousel.js +388 -0
- data/node_modules/bootstrap/js/dist/carousel.js.map +1 -0
- data/node_modules/bootstrap/js/dist/collapse.js +249 -0
- data/node_modules/bootstrap/js/dist/collapse.js.map +1 -0
- data/node_modules/bootstrap/js/dist/dom/data.js +63 -0
- data/node_modules/bootstrap/js/dist/dom/data.js.map +1 -0
- data/node_modules/bootstrap/js/dist/dom/event-handler.js +237 -0
- data/node_modules/bootstrap/js/dist/dom/event-handler.js.map +1 -0
- data/node_modules/bootstrap/js/dist/dom/manipulator.js +72 -0
- data/node_modules/bootstrap/js/dist/dom/manipulator.js.map +1 -0
- data/node_modules/bootstrap/js/dist/dom/selector-engine.js +104 -0
- data/node_modules/bootstrap/js/dist/dom/selector-engine.js.map +1 -0
- data/node_modules/bootstrap/js/dist/dropdown.js +402 -0
- data/node_modules/bootstrap/js/dist/dropdown.js.map +1 -0
- data/node_modules/bootstrap/js/dist/modal.js +320 -0
- data/node_modules/bootstrap/js/dist/modal.js.map +1 -0
- data/node_modules/bootstrap/js/dist/offcanvas.js +246 -0
- data/node_modules/bootstrap/js/dist/offcanvas.js.map +1 -0
- data/node_modules/bootstrap/js/dist/popover.js +96 -0
- data/node_modules/bootstrap/js/dist/popover.js.map +1 -0
- data/node_modules/bootstrap/js/dist/scrollspy.js +275 -0
- data/node_modules/bootstrap/js/dist/scrollspy.js.map +1 -0
- data/node_modules/bootstrap/js/dist/tab.js +285 -0
- data/node_modules/bootstrap/js/dist/tab.js.map +1 -0
- data/node_modules/bootstrap/js/dist/toast.js +198 -0
- data/node_modules/bootstrap/js/dist/toast.js.map +1 -0
- data/node_modules/bootstrap/js/dist/tooltip.js +546 -0
- data/node_modules/bootstrap/js/dist/tooltip.js.map +1 -0
- data/node_modules/bootstrap/js/dist/util/backdrop.js +139 -0
- data/node_modules/bootstrap/js/dist/util/backdrop.js.map +1 -0
- data/node_modules/bootstrap/js/dist/util/component-functions.js +42 -0
- data/node_modules/bootstrap/js/dist/util/component-functions.js.map +1 -0
- data/node_modules/bootstrap/js/dist/util/config.js +68 -0
- data/node_modules/bootstrap/js/dist/util/config.js.map +1 -0
- data/node_modules/bootstrap/js/dist/util/focustrap.js +113 -0
- data/node_modules/bootstrap/js/dist/util/focustrap.js.map +1 -0
- data/node_modules/bootstrap/js/dist/util/index.js +281 -0
- data/node_modules/bootstrap/js/dist/util/index.js.map +1 -0
- data/node_modules/bootstrap/js/dist/util/sanitizer.js +113 -0
- data/node_modules/bootstrap/js/dist/util/sanitizer.js.map +1 -0
- data/node_modules/bootstrap/js/dist/util/scrollbar.js +113 -0
- data/node_modules/bootstrap/js/dist/util/scrollbar.js.map +1 -0
- data/node_modules/bootstrap/js/dist/util/swipe.js +135 -0
- data/node_modules/bootstrap/js/dist/util/swipe.js.map +1 -0
- data/node_modules/bootstrap/js/dist/util/template-factory.js +151 -0
- data/node_modules/bootstrap/js/dist/util/template-factory.js.map +1 -0
- data/node_modules/bootstrap/js/index.esm.js +19 -0
- data/node_modules/bootstrap/js/index.umd.js +34 -0
- data/node_modules/bootstrap/js/src/alert.js +87 -0
- data/node_modules/bootstrap/js/src/base-component.js +86 -0
- data/node_modules/bootstrap/js/src/button.js +72 -0
- data/node_modules/bootstrap/js/src/carousel.js +474 -0
- data/node_modules/bootstrap/js/src/collapse.js +297 -0
- data/node_modules/bootstrap/js/src/dom/data.js +55 -0
- data/node_modules/bootstrap/js/src/dom/event-handler.js +317 -0
- data/node_modules/bootstrap/js/src/dom/manipulator.js +71 -0
- data/node_modules/bootstrap/js/src/dom/selector-engine.js +126 -0
- data/node_modules/bootstrap/js/src/dropdown.js +455 -0
- data/node_modules/bootstrap/js/src/modal.js +378 -0
- data/node_modules/bootstrap/js/src/offcanvas.js +282 -0
- data/node_modules/bootstrap/js/src/popover.js +97 -0
- data/node_modules/bootstrap/js/src/scrollspy.js +296 -0
- data/node_modules/bootstrap/js/src/tab.js +315 -0
- data/node_modules/bootstrap/js/src/toast.js +224 -0
- data/node_modules/bootstrap/js/src/tooltip.js +633 -0
- data/node_modules/bootstrap/js/src/util/backdrop.js +151 -0
- data/node_modules/bootstrap/js/src/util/component-functions.js +35 -0
- data/node_modules/bootstrap/js/src/util/config.js +65 -0
- data/node_modules/bootstrap/js/src/util/focustrap.js +115 -0
- data/node_modules/bootstrap/js/src/util/index.js +306 -0
- data/node_modules/bootstrap/js/src/util/sanitizer.js +116 -0
- data/node_modules/bootstrap/js/src/util/scrollbar.js +114 -0
- data/node_modules/bootstrap/js/src/util/swipe.js +146 -0
- data/node_modules/bootstrap/js/src/util/template-factory.js +160 -0
- data/node_modules/bootstrap/package.json +210 -0
- data/node_modules/bootstrap/scss/_accordion.scss +153 -0
- data/node_modules/bootstrap/scss/_alert.scss +68 -0
- data/node_modules/bootstrap/scss/_badge.scss +38 -0
- data/node_modules/bootstrap/scss/_breadcrumb.scss +40 -0
- data/node_modules/bootstrap/scss/_button-group.scss +147 -0
- data/node_modules/bootstrap/scss/_buttons.scss +216 -0
- data/node_modules/bootstrap/scss/_card.scss +238 -0
- data/node_modules/bootstrap/scss/_carousel.scss +226 -0
- data/node_modules/bootstrap/scss/_close.scss +66 -0
- data/node_modules/bootstrap/scss/_containers.scss +41 -0
- data/node_modules/bootstrap/scss/_dropdown.scss +250 -0
- data/node_modules/bootstrap/scss/_forms.scss +9 -0
- data/node_modules/bootstrap/scss/_functions.scss +302 -0
- data/node_modules/bootstrap/scss/_grid.scss +39 -0
- data/node_modules/bootstrap/scss/_helpers.scss +12 -0
- data/node_modules/bootstrap/scss/_images.scss +42 -0
- data/node_modules/bootstrap/scss/_list-group.scss +199 -0
- data/node_modules/bootstrap/scss/_maps.scss +174 -0
- data/node_modules/bootstrap/scss/_mixins.scss +42 -0
- data/node_modules/bootstrap/scss/_modal.scss +240 -0
- data/node_modules/bootstrap/scss/_nav.scss +197 -0
- data/node_modules/bootstrap/scss/_navbar.scss +289 -0
- data/node_modules/bootstrap/scss/_offcanvas.scss +147 -0
- data/node_modules/bootstrap/scss/_pagination.scss +109 -0
- data/node_modules/bootstrap/scss/_placeholders.scss +51 -0
- data/node_modules/bootstrap/scss/_popover.scss +196 -0
- data/node_modules/bootstrap/scss/_progress.scss +68 -0
- data/node_modules/bootstrap/scss/_reboot.scss +617 -0
- data/node_modules/bootstrap/scss/_root.scss +187 -0
- data/node_modules/bootstrap/scss/_spinners.scss +86 -0
- data/node_modules/bootstrap/scss/_tables.scss +171 -0
- data/node_modules/bootstrap/scss/_toasts.scss +73 -0
- data/node_modules/bootstrap/scss/_tooltip.scss +119 -0
- data/node_modules/bootstrap/scss/_transitions.scss +27 -0
- data/node_modules/bootstrap/scss/_type.scss +106 -0
- data/node_modules/bootstrap/scss/_utilities.scss +806 -0
- data/node_modules/bootstrap/scss/_variables-dark.scss +102 -0
- data/node_modules/bootstrap/scss/_variables.scss +1753 -0
- data/node_modules/bootstrap/scss/bootstrap-grid.scss +62 -0
- data/node_modules/bootstrap/scss/bootstrap-reboot.scss +10 -0
- data/node_modules/bootstrap/scss/bootstrap-utilities.scss +19 -0
- data/node_modules/bootstrap/scss/bootstrap.scss +52 -0
- data/node_modules/bootstrap/scss/forms/_floating-labels.scss +97 -0
- data/node_modules/bootstrap/scss/forms/_form-check.scss +189 -0
- data/node_modules/bootstrap/scss/forms/_form-control.scss +214 -0
- data/node_modules/bootstrap/scss/forms/_form-range.scss +91 -0
- data/node_modules/bootstrap/scss/forms/_form-select.scss +80 -0
- data/node_modules/bootstrap/scss/forms/_form-text.scss +11 -0
- data/node_modules/bootstrap/scss/forms/_input-group.scss +132 -0
- data/node_modules/bootstrap/scss/forms/_labels.scss +36 -0
- data/node_modules/bootstrap/scss/forms/_validation.scss +12 -0
- data/node_modules/bootstrap/scss/helpers/_clearfix.scss +3 -0
- data/node_modules/bootstrap/scss/helpers/_color-bg.scss +7 -0
- data/node_modules/bootstrap/scss/helpers/_colored-links.scss +30 -0
- data/node_modules/bootstrap/scss/helpers/_focus-ring.scss +5 -0
- data/node_modules/bootstrap/scss/helpers/_icon-link.scss +25 -0
- data/node_modules/bootstrap/scss/helpers/_position.scss +36 -0
- data/node_modules/bootstrap/scss/helpers/_ratio.scss +26 -0
- data/node_modules/bootstrap/scss/helpers/_stacks.scss +15 -0
- data/node_modules/bootstrap/scss/helpers/_stretched-link.scss +15 -0
- data/node_modules/bootstrap/scss/helpers/_text-truncation.scss +7 -0
- data/node_modules/bootstrap/scss/helpers/_visually-hidden.scss +8 -0
- data/node_modules/bootstrap/scss/helpers/_vr.scss +8 -0
- data/node_modules/bootstrap/scss/mixins/_alert.scss +18 -0
- data/node_modules/bootstrap/scss/mixins/_backdrop.scss +14 -0
- data/node_modules/bootstrap/scss/mixins/_banner.scss +7 -0
- data/node_modules/bootstrap/scss/mixins/_border-radius.scss +78 -0
- data/node_modules/bootstrap/scss/mixins/_box-shadow.scss +24 -0
- data/node_modules/bootstrap/scss/mixins/_breakpoints.scss +127 -0
- data/node_modules/bootstrap/scss/mixins/_buttons.scss +70 -0
- data/node_modules/bootstrap/scss/mixins/_caret.scss +69 -0
- data/node_modules/bootstrap/scss/mixins/_clearfix.scss +9 -0
- data/node_modules/bootstrap/scss/mixins/_color-mode.scss +21 -0
- data/node_modules/bootstrap/scss/mixins/_color-scheme.scss +7 -0
- data/node_modules/bootstrap/scss/mixins/_container.scss +11 -0
- data/node_modules/bootstrap/scss/mixins/_deprecate.scss +10 -0
- data/node_modules/bootstrap/scss/mixins/_forms.scss +163 -0
- data/node_modules/bootstrap/scss/mixins/_gradients.scss +47 -0
- data/node_modules/bootstrap/scss/mixins/_grid.scss +151 -0
- data/node_modules/bootstrap/scss/mixins/_image.scss +16 -0
- data/node_modules/bootstrap/scss/mixins/_list-group.scss +26 -0
- data/node_modules/bootstrap/scss/mixins/_lists.scss +7 -0
- data/node_modules/bootstrap/scss/mixins/_pagination.scss +10 -0
- data/node_modules/bootstrap/scss/mixins/_reset-text.scss +17 -0
- data/node_modules/bootstrap/scss/mixins/_resize.scss +6 -0
- data/node_modules/bootstrap/scss/mixins/_table-variants.scss +24 -0
- data/node_modules/bootstrap/scss/mixins/_text-truncate.scss +8 -0
- data/node_modules/bootstrap/scss/mixins/_transition.scss +26 -0
- data/node_modules/bootstrap/scss/mixins/_utilities.scss +97 -0
- data/node_modules/bootstrap/scss/mixins/_visually-hidden.scss +38 -0
- data/node_modules/bootstrap/scss/utilities/_api.scss +47 -0
- data/node_modules/bootstrap/scss/vendor/_rfs.scss +348 -0
- metadata +448 -0
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"carousel.js","sources":["../src/carousel.js"],"sourcesContent":["/**\n * --------------------------------------------------------------------------\n * Bootstrap carousel.js\n * Licensed under MIT (https://github.com/twbs/bootstrap/blob/main/LICENSE)\n * --------------------------------------------------------------------------\n */\n\nimport BaseComponent from './base-component.js'\nimport EventHandler from './dom/event-handler.js'\nimport Manipulator from './dom/manipulator.js'\nimport SelectorEngine from './dom/selector-engine.js'\nimport {\n defineJQueryPlugin,\n getNextActiveElement,\n isRTL,\n isVisible,\n reflow,\n triggerTransitionEnd\n} from './util/index.js'\nimport Swipe from './util/swipe.js'\n\n/**\n * Constants\n */\n\nconst NAME = 'carousel'\nconst DATA_KEY = 'bs.carousel'\nconst EVENT_KEY = `.${DATA_KEY}`\nconst DATA_API_KEY = '.data-api'\n\nconst ARROW_LEFT_KEY = 'ArrowLeft'\nconst ARROW_RIGHT_KEY = 'ArrowRight'\nconst TOUCHEVENT_COMPAT_WAIT = 500 // Time for mouse compat events to fire after touch\n\nconst ORDER_NEXT = 'next'\nconst ORDER_PREV = 'prev'\nconst DIRECTION_LEFT = 'left'\nconst DIRECTION_RIGHT = 'right'\n\nconst EVENT_SLIDE = `slide${EVENT_KEY}`\nconst EVENT_SLID = `slid${EVENT_KEY}`\nconst EVENT_KEYDOWN = `keydown${EVENT_KEY}`\nconst EVENT_MOUSEENTER = `mouseenter${EVENT_KEY}`\nconst EVENT_MOUSELEAVE = `mouseleave${EVENT_KEY}`\nconst EVENT_DRAG_START = `dragstart${EVENT_KEY}`\nconst EVENT_LOAD_DATA_API = `load${EVENT_KEY}${DATA_API_KEY}`\nconst EVENT_CLICK_DATA_API = `click${EVENT_KEY}${DATA_API_KEY}`\n\nconst CLASS_NAME_CAROUSEL = 'carousel'\nconst CLASS_NAME_ACTIVE = 'active'\nconst CLASS_NAME_SLIDE = 'slide'\nconst CLASS_NAME_END = 'carousel-item-end'\nconst CLASS_NAME_START = 'carousel-item-start'\nconst CLASS_NAME_NEXT = 'carousel-item-next'\nconst CLASS_NAME_PREV = 'carousel-item-prev'\n\nconst SELECTOR_ACTIVE = '.active'\nconst SELECTOR_ITEM = '.carousel-item'\nconst SELECTOR_ACTIVE_ITEM = SELECTOR_ACTIVE + SELECTOR_ITEM\nconst SELECTOR_ITEM_IMG = '.carousel-item img'\nconst SELECTOR_INDICATORS = '.carousel-indicators'\nconst SELECTOR_DATA_SLIDE = '[data-bs-slide], [data-bs-slide-to]'\nconst SELECTOR_DATA_RIDE = '[data-bs-ride=\"carousel\"]'\n\nconst KEY_TO_DIRECTION = {\n [ARROW_LEFT_KEY]: DIRECTION_RIGHT,\n [ARROW_RIGHT_KEY]: DIRECTION_LEFT\n}\n\nconst Default = {\n interval: 5000,\n keyboard: true,\n pause: 'hover',\n ride: false,\n touch: true,\n wrap: true\n}\n\nconst DefaultType = {\n interval: '(number|boolean)', // TODO:v6 remove boolean support\n keyboard: 'boolean',\n pause: '(string|boolean)',\n ride: '(boolean|string)',\n touch: 'boolean',\n wrap: 'boolean'\n}\n\n/**\n * Class definition\n */\n\nclass Carousel extends BaseComponent {\n constructor(element, config) {\n super(element, config)\n\n this._interval = null\n this._activeElement = null\n this._isSliding = false\n this.touchTimeout = null\n this._swipeHelper = null\n\n this._indicatorsElement = SelectorEngine.findOne(SELECTOR_INDICATORS, this._element)\n this._addEventListeners()\n\n if (this._config.ride === CLASS_NAME_CAROUSEL) {\n this.cycle()\n }\n }\n\n // Getters\n static get Default() {\n return Default\n }\n\n static get DefaultType() {\n return DefaultType\n }\n\n static get NAME() {\n return NAME\n }\n\n // Public\n next() {\n this._slide(ORDER_NEXT)\n }\n\n nextWhenVisible() {\n // FIXME TODO use `document.visibilityState`\n // Don't call next when the page isn't visible\n // or the carousel or its parent isn't visible\n if (!document.hidden && isVisible(this._element)) {\n this.next()\n }\n }\n\n prev() {\n this._slide(ORDER_PREV)\n }\n\n pause() {\n if (this._isSliding) {\n triggerTransitionEnd(this._element)\n }\n\n this._clearInterval()\n }\n\n cycle() {\n this._clearInterval()\n this._updateInterval()\n\n this._interval = setInterval(() => this.nextWhenVisible(), this._config.interval)\n }\n\n _maybeEnableCycle() {\n if (!this._config.ride) {\n return\n }\n\n if (this._isSliding) {\n EventHandler.one(this._element, EVENT_SLID, () => this.cycle())\n return\n }\n\n this.cycle()\n }\n\n to(index) {\n const items = this._getItems()\n if (index > items.length - 1 || index < 0) {\n return\n }\n\n if (this._isSliding) {\n EventHandler.one(this._element, EVENT_SLID, () => this.to(index))\n return\n }\n\n const activeIndex = this._getItemIndex(this._getActive())\n if (activeIndex === index) {\n return\n }\n\n const order = index > activeIndex ? ORDER_NEXT : ORDER_PREV\n\n this._slide(order, items[index])\n }\n\n dispose() {\n if (this._swipeHelper) {\n this._swipeHelper.dispose()\n }\n\n super.dispose()\n }\n\n // Private\n _configAfterMerge(config) {\n config.defaultInterval = config.interval\n return config\n }\n\n _addEventListeners() {\n if (this._config.keyboard) {\n EventHandler.on(this._element, EVENT_KEYDOWN, event => this._keydown(event))\n }\n\n if (this._config.pause === 'hover') {\n EventHandler.on(this._element, EVENT_MOUSEENTER, () => this.pause())\n EventHandler.on(this._element, EVENT_MOUSELEAVE, () => this._maybeEnableCycle())\n }\n\n if (this._config.touch && Swipe.isSupported()) {\n this._addTouchEventListeners()\n }\n }\n\n _addTouchEventListeners() {\n for (const img of SelectorEngine.find(SELECTOR_ITEM_IMG, this._element)) {\n EventHandler.on(img, EVENT_DRAG_START, event => event.preventDefault())\n }\n\n const endCallBack = () => {\n if (this._config.pause !== 'hover') {\n return\n }\n\n // If it's a touch-enabled device, mouseenter/leave are fired as\n // part of the mouse compatibility events on first tap - the carousel\n // would stop cycling until user tapped out of it;\n // here, we listen for touchend, explicitly pause the carousel\n // (as if it's the second time we tap on it, mouseenter compat event\n // is NOT fired) and after a timeout (to allow for mouse compatibility\n // events to fire) we explicitly restart cycling\n\n this.pause()\n if (this.touchTimeout) {\n clearTimeout(this.touchTimeout)\n }\n\n this.touchTimeout = setTimeout(() => this._maybeEnableCycle(), TOUCHEVENT_COMPAT_WAIT + this._config.interval)\n }\n\n const swipeConfig = {\n leftCallback: () => this._slide(this._directionToOrder(DIRECTION_LEFT)),\n rightCallback: () => this._slide(this._directionToOrder(DIRECTION_RIGHT)),\n endCallback: endCallBack\n }\n\n this._swipeHelper = new Swipe(this._element, swipeConfig)\n }\n\n _keydown(event) {\n if (/input|textarea/i.test(event.target.tagName)) {\n return\n }\n\n const direction = KEY_TO_DIRECTION[event.key]\n if (direction) {\n event.preventDefault()\n this._slide(this._directionToOrder(direction))\n }\n }\n\n _getItemIndex(element) {\n return this._getItems().indexOf(element)\n }\n\n _setActiveIndicatorElement(index) {\n if (!this._indicatorsElement) {\n return\n }\n\n const activeIndicator = SelectorEngine.findOne(SELECTOR_ACTIVE, this._indicatorsElement)\n\n activeIndicator.classList.remove(CLASS_NAME_ACTIVE)\n activeIndicator.removeAttribute('aria-current')\n\n const newActiveIndicator = SelectorEngine.findOne(`[data-bs-slide-to=\"${index}\"]`, this._indicatorsElement)\n\n if (newActiveIndicator) {\n newActiveIndicator.classList.add(CLASS_NAME_ACTIVE)\n newActiveIndicator.setAttribute('aria-current', 'true')\n }\n }\n\n _updateInterval() {\n const element = this._activeElement || this._getActive()\n\n if (!element) {\n return\n }\n\n const elementInterval = Number.parseInt(element.getAttribute('data-bs-interval'), 10)\n\n this._config.interval = elementInterval || this._config.defaultInterval\n }\n\n _slide(order, element = null) {\n if (this._isSliding) {\n return\n }\n\n const activeElement = this._getActive()\n const isNext = order === ORDER_NEXT\n const nextElement = element || getNextActiveElement(this._getItems(), activeElement, isNext, this._config.wrap)\n\n if (nextElement === activeElement) {\n return\n }\n\n const nextElementIndex = this._getItemIndex(nextElement)\n\n const triggerEvent = eventName => {\n return EventHandler.trigger(this._element, eventName, {\n relatedTarget: nextElement,\n direction: this._orderToDirection(order),\n from: this._getItemIndex(activeElement),\n to: nextElementIndex\n })\n }\n\n const slideEvent = triggerEvent(EVENT_SLIDE)\n\n if (slideEvent.defaultPrevented) {\n return\n }\n\n if (!activeElement || !nextElement) {\n // Some weirdness is happening, so we bail\n // TODO: change tests that use empty divs to avoid this check\n return\n }\n\n const isCycling = Boolean(this._interval)\n this.pause()\n\n this._isSliding = true\n\n this._setActiveIndicatorElement(nextElementIndex)\n this._activeElement = nextElement\n\n const directionalClassName = isNext ? CLASS_NAME_START : CLASS_NAME_END\n const orderClassName = isNext ? CLASS_NAME_NEXT : CLASS_NAME_PREV\n\n nextElement.classList.add(orderClassName)\n\n reflow(nextElement)\n\n activeElement.classList.add(directionalClassName)\n nextElement.classList.add(directionalClassName)\n\n const completeCallBack = () => {\n nextElement.classList.remove(directionalClassName, orderClassName)\n nextElement.classList.add(CLASS_NAME_ACTIVE)\n\n activeElement.classList.remove(CLASS_NAME_ACTIVE, orderClassName, directionalClassName)\n\n this._isSliding = false\n\n triggerEvent(EVENT_SLID)\n }\n\n this._queueCallback(completeCallBack, activeElement, this._isAnimated())\n\n if (isCycling) {\n this.cycle()\n }\n }\n\n _isAnimated() {\n return this._element.classList.contains(CLASS_NAME_SLIDE)\n }\n\n _getActive() {\n return SelectorEngine.findOne(SELECTOR_ACTIVE_ITEM, this._element)\n }\n\n _getItems() {\n return SelectorEngine.find(SELECTOR_ITEM, this._element)\n }\n\n _clearInterval() {\n if (this._interval) {\n clearInterval(this._interval)\n this._interval = null\n }\n }\n\n _directionToOrder(direction) {\n if (isRTL()) {\n return direction === DIRECTION_LEFT ? ORDER_PREV : ORDER_NEXT\n }\n\n return direction === DIRECTION_LEFT ? ORDER_NEXT : ORDER_PREV\n }\n\n _orderToDirection(order) {\n if (isRTL()) {\n return order === ORDER_PREV ? DIRECTION_LEFT : DIRECTION_RIGHT\n }\n\n return order === ORDER_PREV ? DIRECTION_RIGHT : DIRECTION_LEFT\n }\n\n // Static\n static jQueryInterface(config) {\n return this.each(function () {\n const data = Carousel.getOrCreateInstance(this, config)\n\n if (typeof config === 'number') {\n data.to(config)\n return\n }\n\n if (typeof config === 'string') {\n if (data[config] === undefined || config.startsWith('_') || config === 'constructor') {\n throw new TypeError(`No method named \"${config}\"`)\n }\n\n data[config]()\n }\n })\n }\n}\n\n/**\n * Data API implementation\n */\n\nEventHandler.on(document, EVENT_CLICK_DATA_API, SELECTOR_DATA_SLIDE, function (event) {\n const target = SelectorEngine.getElementFromSelector(this)\n\n if (!target || !target.classList.contains(CLASS_NAME_CAROUSEL)) {\n return\n }\n\n event.preventDefault()\n\n const carousel = Carousel.getOrCreateInstance(target)\n const slideIndex = this.getAttribute('data-bs-slide-to')\n\n if (slideIndex) {\n carousel.to(slideIndex)\n carousel._maybeEnableCycle()\n return\n }\n\n if (Manipulator.getDataAttribute(this, 'slide') === 'next') {\n carousel.next()\n carousel._maybeEnableCycle()\n return\n }\n\n carousel.prev()\n carousel._maybeEnableCycle()\n})\n\nEventHandler.on(window, EVENT_LOAD_DATA_API, () => {\n const carousels = SelectorEngine.find(SELECTOR_DATA_RIDE)\n\n for (const carousel of carousels) {\n Carousel.getOrCreateInstance(carousel)\n }\n})\n\n/**\n * jQuery\n */\n\ndefineJQueryPlugin(Carousel)\n\nexport default Carousel\n"],"names":["NAME","DATA_KEY","EVENT_KEY","DATA_API_KEY","ARROW_LEFT_KEY","ARROW_RIGHT_KEY","TOUCHEVENT_COMPAT_WAIT","ORDER_NEXT","ORDER_PREV","DIRECTION_LEFT","DIRECTION_RIGHT","EVENT_SLIDE","EVENT_SLID","EVENT_KEYDOWN","EVENT_MOUSEENTER","EVENT_MOUSELEAVE","EVENT_DRAG_START","EVENT_LOAD_DATA_API","EVENT_CLICK_DATA_API","CLASS_NAME_CAROUSEL","CLASS_NAME_ACTIVE","CLASS_NAME_SLIDE","CLASS_NAME_END","CLASS_NAME_START","CLASS_NAME_NEXT","CLASS_NAME_PREV","SELECTOR_ACTIVE","SELECTOR_ITEM","SELECTOR_ACTIVE_ITEM","SELECTOR_ITEM_IMG","SELECTOR_INDICATORS","SELECTOR_DATA_SLIDE","SELECTOR_DATA_RIDE","KEY_TO_DIRECTION","Default","interval","keyboard","pause","ride","touch","wrap","DefaultType","Carousel","BaseComponent","constructor","element","config","_interval","_activeElement","_isSliding","touchTimeout","_swipeHelper","_indicatorsElement","SelectorEngine","findOne","_element","_addEventListeners","_config","cycle","next","_slide","nextWhenVisible","document","hidden","isVisible","prev","triggerTransitionEnd","_clearInterval","_updateInterval","setInterval","_maybeEnableCycle","EventHandler","one","to","index","items","_getItems","length","activeIndex","_getItemIndex","_getActive","order","dispose","_configAfterMerge","defaultInterval","on","event","_keydown","Swipe","isSupported","_addTouchEventListeners","img","find","preventDefault","endCallBack","clearTimeout","setTimeout","swipeConfig","leftCallback","_directionToOrder","rightCallback","endCallback","test","target","tagName","direction","key","indexOf","_setActiveIndicatorElement","activeIndicator","classList","remove","removeAttribute","newActiveIndicator","add","setAttribute","elementInterval","Number","parseInt","getAttribute","activeElement","isNext","nextElement","getNextActiveElement","nextElementIndex","triggerEvent","eventName","trigger","relatedTarget","_orderToDirection","from","slideEvent","defaultPrevented","isCycling","Boolean","directionalClassName","orderClassName","reflow","completeCallBack","_queueCallback","_isAnimated","contains","clearInterval","isRTL","jQueryInterface","each","data","getOrCreateInstance","undefined","startsWith","TypeError","getElementFromSelector","carousel","slideIndex","Manipulator","getDataAttribute","window","carousels","defineJQueryPlugin"],"mappings":";;;;;;;;;;;EAAA;EACA;EACA;EACA;EACA;EACA;;;EAgBA;EACA;EACA;;EAEA,MAAMA,IAAI,GAAG,UAAU;EACvB,MAAMC,QAAQ,GAAG,aAAa;EAC9B,MAAMC,SAAS,GAAG,CAAA,CAAA,EAAID,QAAQ,CAAA,CAAE;EAChC,MAAME,YAAY,GAAG,WAAW;EAEhC,MAAMC,cAAc,GAAG,WAAW;EAClC,MAAMC,eAAe,GAAG,YAAY;EACpC,MAAMC,sBAAsB,GAAG,GAAG,CAAA;;EAElC,MAAMC,UAAU,GAAG,MAAM;EACzB,MAAMC,UAAU,GAAG,MAAM;EACzB,MAAMC,cAAc,GAAG,MAAM;EAC7B,MAAMC,eAAe,GAAG,OAAO;EAE/B,MAAMC,WAAW,GAAG,CAAA,KAAA,EAAQT,SAAS,CAAA,CAAE;EACvC,MAAMU,UAAU,GAAG,CAAA,IAAA,EAAOV,SAAS,CAAA,CAAE;EACrC,MAAMW,aAAa,GAAG,CAAA,OAAA,EAAUX,SAAS,CAAA,CAAE;EAC3C,MAAMY,gBAAgB,GAAG,CAAA,UAAA,EAAaZ,SAAS,CAAA,CAAE;EACjD,MAAMa,gBAAgB,GAAG,CAAA,UAAA,EAAab,SAAS,CAAA,CAAE;EACjD,MAAMc,gBAAgB,GAAG,CAAA,SAAA,EAAYd,SAAS,CAAA,CAAE;EAChD,MAAMe,mBAAmB,GAAG,CAAA,IAAA,EAAOf,SAAS,CAAA,EAAGC,YAAY,CAAA,CAAE;EAC7D,MAAMe,oBAAoB,GAAG,CAAA,KAAA,EAAQhB,SAAS,CAAA,EAAGC,YAAY,CAAA,CAAE;EAE/D,MAAMgB,mBAAmB,GAAG,UAAU;EACtC,MAAMC,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AAK,MAAMwH,QAAQ,IAAIK,SAAS,EAAE;EAChCnH,IAAAA,QAAQ,CAACyG,mBAAmB,CAACK,QAAQ,CAAC;EACxC,EAAA;EACF,CAAC,CAAC;;EAEF;EACA;EACA;;AAEAM,6BAAkB,CAACpH,QAAQ,CAAC;;;;;;;;"}
|
|
@@ -0,0 +1,249 @@
|
|
|
1
|
+
/*!
|
|
2
|
+
* Bootstrap collapse.js v5.3.8 (https://getbootstrap.com/)
|
|
3
|
+
* Copyright 2011-2025 The Bootstrap Authors (https://github.com/twbs/bootstrap/graphs/contributors)
|
|
4
|
+
* Licensed under MIT (https://github.com/twbs/bootstrap/blob/main/LICENSE)
|
|
5
|
+
*/
|
|
6
|
+
(function (global, factory) {
|
|
7
|
+
typeof exports === 'object' && typeof module !== 'undefined' ? module.exports = factory(require('./base-component.js'), require('./dom/event-handler.js'), require('./dom/selector-engine.js'), require('./util/index.js')) :
|
|
8
|
+
typeof define === 'function' && define.amd ? define(['./base-component', './dom/event-handler', './dom/selector-engine', './util/index'], factory) :
|
|
9
|
+
(global = typeof globalThis !== 'undefined' ? globalThis : global || self, global.Collapse = factory(global.BaseComponent, global.EventHandler, global.SelectorEngine, global.Index));
|
|
10
|
+
})(this, (function (BaseComponent, EventHandler, SelectorEngine, index_js) { 'use strict';
|
|
11
|
+
|
|
12
|
+
/**
|
|
13
|
+
* --------------------------------------------------------------------------
|
|
14
|
+
* Bootstrap collapse.js
|
|
15
|
+
* Licensed under MIT (https://github.com/twbs/bootstrap/blob/main/LICENSE)
|
|
16
|
+
* --------------------------------------------------------------------------
|
|
17
|
+
*/
|
|
18
|
+
|
|
19
|
+
|
|
20
|
+
/**
|
|
21
|
+
* Constants
|
|
22
|
+
*/
|
|
23
|
+
|
|
24
|
+
const NAME = 'collapse';
|
|
25
|
+
const DATA_KEY = 'bs.collapse';
|
|
26
|
+
const EVENT_KEY = `.${DATA_KEY}`;
|
|
27
|
+
const DATA_API_KEY = '.data-api';
|
|
28
|
+
const EVENT_SHOW = `show${EVENT_KEY}`;
|
|
29
|
+
const EVENT_SHOWN = `shown${EVENT_KEY}`;
|
|
30
|
+
const EVENT_HIDE = `hide${EVENT_KEY}`;
|
|
31
|
+
const EVENT_HIDDEN = `hidden${EVENT_KEY}`;
|
|
32
|
+
const EVENT_CLICK_DATA_API = `click${EVENT_KEY}${DATA_API_KEY}`;
|
|
33
|
+
const CLASS_NAME_SHOW = 'show';
|
|
34
|
+
const CLASS_NAME_COLLAPSE = 'collapse';
|
|
35
|
+
const CLASS_NAME_COLLAPSING = 'collapsing';
|
|
36
|
+
const CLASS_NAME_COLLAPSED = 'collapsed';
|
|
37
|
+
const CLASS_NAME_DEEPER_CHILDREN = `:scope .${CLASS_NAME_COLLAPSE} .${CLASS_NAME_COLLAPSE}`;
|
|
38
|
+
const CLASS_NAME_HORIZONTAL = 'collapse-horizontal';
|
|
39
|
+
const WIDTH = 'width';
|
|
40
|
+
const HEIGHT = 'height';
|
|
41
|
+
const SELECTOR_ACTIVES = '.collapse.show, .collapse.collapsing';
|
|
42
|
+
const SELECTOR_DATA_TOGGLE = '[data-bs-toggle="collapse"]';
|
|
43
|
+
const Default = {
|
|
44
|
+
parent: null,
|
|
45
|
+
toggle: true
|
|
46
|
+
};
|
|
47
|
+
const DefaultType = {
|
|
48
|
+
parent: '(null|element)',
|
|
49
|
+
toggle: 'boolean'
|
|
50
|
+
};
|
|
51
|
+
|
|
52
|
+
/**
|
|
53
|
+
* Class definition
|
|
54
|
+
*/
|
|
55
|
+
|
|
56
|
+
class Collapse extends BaseComponent {
|
|
57
|
+
constructor(element, config) {
|
|
58
|
+
super(element, config);
|
|
59
|
+
this._isTransitioning = false;
|
|
60
|
+
this._triggerArray = [];
|
|
61
|
+
const toggleList = SelectorEngine.find(SELECTOR_DATA_TOGGLE);
|
|
62
|
+
for (const elem of toggleList) {
|
|
63
|
+
const selector = SelectorEngine.getSelectorFromElement(elem);
|
|
64
|
+
const filterElement = SelectorEngine.find(selector).filter(foundElement => foundElement === this._element);
|
|
65
|
+
if (selector !== null && filterElement.length) {
|
|
66
|
+
this._triggerArray.push(elem);
|
|
67
|
+
}
|
|
68
|
+
}
|
|
69
|
+
this._initializeChildren();
|
|
70
|
+
if (!this._config.parent) {
|
|
71
|
+
this._addAriaAndCollapsedClass(this._triggerArray, this._isShown());
|
|
72
|
+
}
|
|
73
|
+
if (this._config.toggle) {
|
|
74
|
+
this.toggle();
|
|
75
|
+
}
|
|
76
|
+
}
|
|
77
|
+
|
|
78
|
+
// Getters
|
|
79
|
+
static get Default() {
|
|
80
|
+
return Default;
|
|
81
|
+
}
|
|
82
|
+
static get DefaultType() {
|
|
83
|
+
return DefaultType;
|
|
84
|
+
}
|
|
85
|
+
static get NAME() {
|
|
86
|
+
return NAME;
|
|
87
|
+
}
|
|
88
|
+
|
|
89
|
+
// Public
|
|
90
|
+
toggle() {
|
|
91
|
+
if (this._isShown()) {
|
|
92
|
+
this.hide();
|
|
93
|
+
} else {
|
|
94
|
+
this.show();
|
|
95
|
+
}
|
|
96
|
+
}
|
|
97
|
+
show() {
|
|
98
|
+
if (this._isTransitioning || this._isShown()) {
|
|
99
|
+
return;
|
|
100
|
+
}
|
|
101
|
+
let activeChildren = [];
|
|
102
|
+
|
|
103
|
+
// find active children
|
|
104
|
+
if (this._config.parent) {
|
|
105
|
+
activeChildren = this._getFirstLevelChildren(SELECTOR_ACTIVES).filter(element => element !== this._element).map(element => Collapse.getOrCreateInstance(element, {
|
|
106
|
+
toggle: false
|
|
107
|
+
}));
|
|
108
|
+
}
|
|
109
|
+
if (activeChildren.length && activeChildren[0]._isTransitioning) {
|
|
110
|
+
return;
|
|
111
|
+
}
|
|
112
|
+
const startEvent = EventHandler.trigger(this._element, EVENT_SHOW);
|
|
113
|
+
if (startEvent.defaultPrevented) {
|
|
114
|
+
return;
|
|
115
|
+
}
|
|
116
|
+
for (const activeInstance of activeChildren) {
|
|
117
|
+
activeInstance.hide();
|
|
118
|
+
}
|
|
119
|
+
const dimension = this._getDimension();
|
|
120
|
+
this._element.classList.remove(CLASS_NAME_COLLAPSE);
|
|
121
|
+
this._element.classList.add(CLASS_NAME_COLLAPSING);
|
|
122
|
+
this._element.style[dimension] = 0;
|
|
123
|
+
this._addAriaAndCollapsedClass(this._triggerArray, true);
|
|
124
|
+
this._isTransitioning = true;
|
|
125
|
+
const complete = () => {
|
|
126
|
+
this._isTransitioning = false;
|
|
127
|
+
this._element.classList.remove(CLASS_NAME_COLLAPSING);
|
|
128
|
+
this._element.classList.add(CLASS_NAME_COLLAPSE, CLASS_NAME_SHOW);
|
|
129
|
+
this._element.style[dimension] = '';
|
|
130
|
+
EventHandler.trigger(this._element, EVENT_SHOWN);
|
|
131
|
+
};
|
|
132
|
+
const capitalizedDimension = dimension[0].toUpperCase() + dimension.slice(1);
|
|
133
|
+
const scrollSize = `scroll${capitalizedDimension}`;
|
|
134
|
+
this._queueCallback(complete, this._element, true);
|
|
135
|
+
this._element.style[dimension] = `${this._element[scrollSize]}px`;
|
|
136
|
+
}
|
|
137
|
+
hide() {
|
|
138
|
+
if (this._isTransitioning || !this._isShown()) {
|
|
139
|
+
return;
|
|
140
|
+
}
|
|
141
|
+
const startEvent = EventHandler.trigger(this._element, EVENT_HIDE);
|
|
142
|
+
if (startEvent.defaultPrevented) {
|
|
143
|
+
return;
|
|
144
|
+
}
|
|
145
|
+
const dimension = this._getDimension();
|
|
146
|
+
this._element.style[dimension] = `${this._element.getBoundingClientRect()[dimension]}px`;
|
|
147
|
+
index_js.reflow(this._element);
|
|
148
|
+
this._element.classList.add(CLASS_NAME_COLLAPSING);
|
|
149
|
+
this._element.classList.remove(CLASS_NAME_COLLAPSE, CLASS_NAME_SHOW);
|
|
150
|
+
for (const trigger of this._triggerArray) {
|
|
151
|
+
const element = SelectorEngine.getElementFromSelector(trigger);
|
|
152
|
+
if (element && !this._isShown(element)) {
|
|
153
|
+
this._addAriaAndCollapsedClass([trigger], false);
|
|
154
|
+
}
|
|
155
|
+
}
|
|
156
|
+
this._isTransitioning = true;
|
|
157
|
+
const complete = () => {
|
|
158
|
+
this._isTransitioning = false;
|
|
159
|
+
this._element.classList.remove(CLASS_NAME_COLLAPSING);
|
|
160
|
+
this._element.classList.add(CLASS_NAME_COLLAPSE);
|
|
161
|
+
EventHandler.trigger(this._element, EVENT_HIDDEN);
|
|
162
|
+
};
|
|
163
|
+
this._element.style[dimension] = '';
|
|
164
|
+
this._queueCallback(complete, this._element, true);
|
|
165
|
+
}
|
|
166
|
+
|
|
167
|
+
// Private
|
|
168
|
+
_isShown(element = this._element) {
|
|
169
|
+
return element.classList.contains(CLASS_NAME_SHOW);
|
|
170
|
+
}
|
|
171
|
+
_configAfterMerge(config) {
|
|
172
|
+
config.toggle = Boolean(config.toggle); // Coerce string values
|
|
173
|
+
config.parent = index_js.getElement(config.parent);
|
|
174
|
+
return config;
|
|
175
|
+
}
|
|
176
|
+
_getDimension() {
|
|
177
|
+
return this._element.classList.contains(CLASS_NAME_HORIZONTAL) ? WIDTH : HEIGHT;
|
|
178
|
+
}
|
|
179
|
+
_initializeChildren() {
|
|
180
|
+
if (!this._config.parent) {
|
|
181
|
+
return;
|
|
182
|
+
}
|
|
183
|
+
const children = this._getFirstLevelChildren(SELECTOR_DATA_TOGGLE);
|
|
184
|
+
for (const element of children) {
|
|
185
|
+
const selected = SelectorEngine.getElementFromSelector(element);
|
|
186
|
+
if (selected) {
|
|
187
|
+
this._addAriaAndCollapsedClass([element], this._isShown(selected));
|
|
188
|
+
}
|
|
189
|
+
}
|
|
190
|
+
}
|
|
191
|
+
_getFirstLevelChildren(selector) {
|
|
192
|
+
const children = SelectorEngine.find(CLASS_NAME_DEEPER_CHILDREN, this._config.parent);
|
|
193
|
+
// remove children if greater depth
|
|
194
|
+
return SelectorEngine.find(selector, this._config.parent).filter(element => !children.includes(element));
|
|
195
|
+
}
|
|
196
|
+
_addAriaAndCollapsedClass(triggerArray, isOpen) {
|
|
197
|
+
if (!triggerArray.length) {
|
|
198
|
+
return;
|
|
199
|
+
}
|
|
200
|
+
for (const element of triggerArray) {
|
|
201
|
+
element.classList.toggle(CLASS_NAME_COLLAPSED, !isOpen);
|
|
202
|
+
element.setAttribute('aria-expanded', isOpen);
|
|
203
|
+
}
|
|
204
|
+
}
|
|
205
|
+
|
|
206
|
+
// Static
|
|
207
|
+
static jQueryInterface(config) {
|
|
208
|
+
const _config = {};
|
|
209
|
+
if (typeof config === 'string' && /show|hide/.test(config)) {
|
|
210
|
+
_config.toggle = false;
|
|
211
|
+
}
|
|
212
|
+
return this.each(function () {
|
|
213
|
+
const data = Collapse.getOrCreateInstance(this, _config);
|
|
214
|
+
if (typeof config === 'string') {
|
|
215
|
+
if (typeof data[config] === 'undefined') {
|
|
216
|
+
throw new TypeError(`No method named "${config}"`);
|
|
217
|
+
}
|
|
218
|
+
data[config]();
|
|
219
|
+
}
|
|
220
|
+
});
|
|
221
|
+
}
|
|
222
|
+
}
|
|
223
|
+
|
|
224
|
+
/**
|
|
225
|
+
* Data API implementation
|
|
226
|
+
*/
|
|
227
|
+
|
|
228
|
+
EventHandler.on(document, EVENT_CLICK_DATA_API, SELECTOR_DATA_TOGGLE, function (event) {
|
|
229
|
+
// preventDefault only for <a> elements (which change the URL) not inside the collapsible element
|
|
230
|
+
if (event.target.tagName === 'A' || event.delegateTarget && event.delegateTarget.tagName === 'A') {
|
|
231
|
+
event.preventDefault();
|
|
232
|
+
}
|
|
233
|
+
for (const element of SelectorEngine.getMultipleElementsFromSelector(this)) {
|
|
234
|
+
Collapse.getOrCreateInstance(element, {
|
|
235
|
+
toggle: false
|
|
236
|
+
}).toggle();
|
|
237
|
+
}
|
|
238
|
+
});
|
|
239
|
+
|
|
240
|
+
/**
|
|
241
|
+
* jQuery
|
|
242
|
+
*/
|
|
243
|
+
|
|
244
|
+
index_js.defineJQueryPlugin(Collapse);
|
|
245
|
+
|
|
246
|
+
return Collapse;
|
|
247
|
+
|
|
248
|
+
}));
|
|
249
|
+
//# sourceMappingURL=collapse.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"collapse.js","sources":["../src/collapse.js"],"sourcesContent":["/**\n * --------------------------------------------------------------------------\n * Bootstrap collapse.js\n * Licensed under MIT (https://github.com/twbs/bootstrap/blob/main/LICENSE)\n * --------------------------------------------------------------------------\n */\n\nimport BaseComponent from './base-component.js'\nimport EventHandler from './dom/event-handler.js'\nimport SelectorEngine from './dom/selector-engine.js'\nimport {\n defineJQueryPlugin,\n getElement,\n reflow\n} from './util/index.js'\n\n/**\n * Constants\n */\n\nconst NAME = 'collapse'\nconst DATA_KEY = 'bs.collapse'\nconst EVENT_KEY = `.${DATA_KEY}`\nconst DATA_API_KEY = '.data-api'\n\nconst EVENT_SHOW = `show${EVENT_KEY}`\nconst EVENT_SHOWN = `shown${EVENT_KEY}`\nconst EVENT_HIDE = `hide${EVENT_KEY}`\nconst EVENT_HIDDEN = `hidden${EVENT_KEY}`\nconst EVENT_CLICK_DATA_API = `click${EVENT_KEY}${DATA_API_KEY}`\n\nconst CLASS_NAME_SHOW = 'show'\nconst CLASS_NAME_COLLAPSE = 'collapse'\nconst CLASS_NAME_COLLAPSING = 'collapsing'\nconst CLASS_NAME_COLLAPSED = 'collapsed'\nconst CLASS_NAME_DEEPER_CHILDREN = `:scope .${CLASS_NAME_COLLAPSE} .${CLASS_NAME_COLLAPSE}`\nconst CLASS_NAME_HORIZONTAL = 'collapse-horizontal'\n\nconst WIDTH = 'width'\nconst HEIGHT = 'height'\n\nconst SELECTOR_ACTIVES = '.collapse.show, .collapse.collapsing'\nconst SELECTOR_DATA_TOGGLE = '[data-bs-toggle=\"collapse\"]'\n\nconst Default = {\n parent: null,\n toggle: true\n}\n\nconst DefaultType = {\n parent: '(null|element)',\n toggle: 'boolean'\n}\n\n/**\n * Class definition\n */\n\nclass Collapse extends BaseComponent {\n constructor(element, config) {\n super(element, config)\n\n this._isTransitioning = false\n this._triggerArray = []\n\n const toggleList = SelectorEngine.find(SELECTOR_DATA_TOGGLE)\n\n for (const elem of toggleList) {\n const selector = SelectorEngine.getSelectorFromElement(elem)\n const filterElement = SelectorEngine.find(selector)\n .filter(foundElement => foundElement === this._element)\n\n if (selector !== null && filterElement.length) {\n this._triggerArray.push(elem)\n }\n }\n\n this._initializeChildren()\n\n if (!this._config.parent) {\n this._addAriaAndCollapsedClass(this._triggerArray, this._isShown())\n }\n\n if (this._config.toggle) {\n this.toggle()\n }\n }\n\n // Getters\n static get Default() {\n return Default\n }\n\n static get DefaultType() {\n return DefaultType\n }\n\n static get NAME() {\n return NAME\n }\n\n // Public\n toggle() {\n if (this._isShown()) {\n this.hide()\n } else {\n this.show()\n }\n }\n\n show() {\n if (this._isTransitioning || this._isShown()) {\n return\n }\n\n let activeChildren = []\n\n // find active children\n if (this._config.parent) {\n activeChildren = this._getFirstLevelChildren(SELECTOR_ACTIVES)\n .filter(element => element !== this._element)\n .map(element => Collapse.getOrCreateInstance(element, { toggle: false }))\n }\n\n if (activeChildren.length && activeChildren[0]._isTransitioning) {\n return\n }\n\n const startEvent = EventHandler.trigger(this._element, EVENT_SHOW)\n if (startEvent.defaultPrevented) {\n return\n }\n\n for (const activeInstance of activeChildren) {\n activeInstance.hide()\n }\n\n const dimension = this._getDimension()\n\n this._element.classList.remove(CLASS_NAME_COLLAPSE)\n this._element.classList.add(CLASS_NAME_COLLAPSING)\n\n this._element.style[dimension] = 0\n\n this._addAriaAndCollapsedClass(this._triggerArray, true)\n this._isTransitioning = true\n\n const complete = () => {\n this._isTransitioning = false\n\n this._element.classList.remove(CLASS_NAME_COLLAPSING)\n this._element.classList.add(CLASS_NAME_COLLAPSE, CLASS_NAME_SHOW)\n\n this._element.style[dimension] = ''\n\n EventHandler.trigger(this._element, EVENT_SHOWN)\n }\n\n const capitalizedDimension = dimension[0].toUpperCase() + dimension.slice(1)\n const scrollSize = `scroll${capitalizedDimension}`\n\n this._queueCallback(complete, this._element, true)\n this._element.style[dimension] = `${this._element[scrollSize]}px`\n }\n\n hide() {\n if (this._isTransitioning || !this._isShown()) {\n return\n }\n\n const startEvent = EventHandler.trigger(this._element, EVENT_HIDE)\n if (startEvent.defaultPrevented) {\n return\n }\n\n const dimension = this._getDimension()\n\n this._element.style[dimension] = `${this._element.getBoundingClientRect()[dimension]}px`\n\n reflow(this._element)\n\n this._element.classList.add(CLASS_NAME_COLLAPSING)\n this._element.classList.remove(CLASS_NAME_COLLAPSE, CLASS_NAME_SHOW)\n\n for (const trigger of this._triggerArray) {\n const element = SelectorEngine.getElementFromSelector(trigger)\n\n if (element && !this._isShown(element)) {\n this._addAriaAndCollapsedClass([trigger], false)\n }\n }\n\n this._isTransitioning = true\n\n const complete = () => {\n this._isTransitioning = false\n this._element.classList.remove(CLASS_NAME_COLLAPSING)\n this._element.classList.add(CLASS_NAME_COLLAPSE)\n EventHandler.trigger(this._element, EVENT_HIDDEN)\n }\n\n this._element.style[dimension] = ''\n\n this._queueCallback(complete, this._element, true)\n }\n\n // Private\n _isShown(element = this._element) {\n return element.classList.contains(CLASS_NAME_SHOW)\n }\n\n _configAfterMerge(config) {\n config.toggle = Boolean(config.toggle) // Coerce string values\n config.parent = getElement(config.parent)\n return config\n }\n\n _getDimension() {\n return this._element.classList.contains(CLASS_NAME_HORIZONTAL) ? WIDTH : HEIGHT\n }\n\n _initializeChildren() {\n if (!this._config.parent) {\n return\n }\n\n const children = this._getFirstLevelChildren(SELECTOR_DATA_TOGGLE)\n\n for (const element of children) {\n const selected = SelectorEngine.getElementFromSelector(element)\n\n if (selected) {\n this._addAriaAndCollapsedClass([element], this._isShown(selected))\n }\n }\n }\n\n _getFirstLevelChildren(selector) {\n const children = SelectorEngine.find(CLASS_NAME_DEEPER_CHILDREN, this._config.parent)\n // remove children if greater depth\n return SelectorEngine.find(selector, this._config.parent).filter(element => !children.includes(element))\n }\n\n _addAriaAndCollapsedClass(triggerArray, isOpen) {\n if (!triggerArray.length) {\n return\n }\n\n for (const element of triggerArray) {\n element.classList.toggle(CLASS_NAME_COLLAPSED, !isOpen)\n element.setAttribute('aria-expanded', isOpen)\n }\n }\n\n // Static\n static jQueryInterface(config) {\n const _config = {}\n if (typeof config === 'string' && /show|hide/.test(config)) {\n _config.toggle = false\n }\n\n return this.each(function () {\n const data = Collapse.getOrCreateInstance(this, _config)\n\n if (typeof config === 'string') {\n if (typeof data[config] === 'undefined') {\n throw new TypeError(`No method named \"${config}\"`)\n }\n\n data[config]()\n }\n })\n }\n}\n\n/**\n * Data API implementation\n */\n\nEventHandler.on(document, EVENT_CLICK_DATA_API, SELECTOR_DATA_TOGGLE, function (event) {\n // preventDefault only for <a> elements (which change the URL) not inside the collapsible element\n if (event.target.tagName === 'A' || (event.delegateTarget && event.delegateTarget.tagName === 'A')) {\n event.preventDefault()\n }\n\n for (const element of SelectorEngine.getMultipleElementsFromSelector(this)) {\n Collapse.getOrCreateInstance(element, { toggle: false }).toggle()\n }\n})\n\n/**\n * jQuery\n */\n\ndefineJQueryPlugin(Collapse)\n\nexport default Collapse\n"],"names":["NAME","DATA_KEY","EVENT_KEY","DATA_API_KEY","EVENT_SHOW","EVENT_SHOWN","EVENT_HIDE","EVENT_HIDDEN","EVENT_CLICK_DATA_API","CLASS_NAME_SHOW","CLASS_NAME_COLLAPSE","CLASS_NAME_COLLAPSING","CLASS_NAME_COLLAPSED","CLASS_NAME_DEEPER_CHILDREN","CLASS_NAME_HORIZONTAL","WIDTH","HEIGHT","SELECTOR_ACTIVES","SELECTOR_DATA_TOGGLE","Default","parent","toggle","DefaultType","Collapse","BaseComponent","constructor","element","config","_isTransitioning","_triggerArray","toggleList","SelectorEngine","find","elem","selector","getSelectorFromElement","filterElement","filter","foundElement","_element","length","push","_initializeChildren","_config","_addAriaAndCollapsedClass","_isShown","hide","show","activeChildren","_getFirstLevelChildren","map","getOrCreateInstance","startEvent","EventHandler","trigger","defaultPrevented","activeInstance","dimension","_getDimension","classList","remove","add","style","complete","capitalizedDimension","toUpperCase","slice","scrollSize","_queueCallback","getBoundingClientRect","reflow","getElementFromSelector","contains","_configAfterMerge","Boolean","getElement","children","selected","includes","triggerArray","isOpen","setAttribute","jQueryInterface","test","each","data","TypeError","on","document","event","target","tagName","delegateTarget","preventDefault","getMultipleElementsFromSelector","defineJQueryPlugin"],"mappings":";;;;;;;;;;;EAAA;EACA;EACA;EACA;EACA;EACA;;;EAWA;EACA;EACA;;EAEA,MAAMA,IAAI,GAAG,UAAU;EACvB,MAAMC,QAAQ,GAAG,aAAa;EAC9B,MAAMC,SAAS,GAAG,CAAA,CAAA,EAAID,QAAQ,CAAA,CAAE;EAChC,MAAME,YAAY,GAAG,WAAW;EAEhC,MAAMC,UAAU,GAAG,CAAA,IAAA,EAAOF,SAAS,CAAA,CAAE;EACrC,MAAMG,WAAW,GAAG,CAAA,KAAA,EAAQH,SAAS,CAAA,CAAE;EACvC,MAAMI,UAAU,GAAG,CAAA,IAAA,EAAOJ,SAAS,CAAA,CAAE;EACrC,MAAMK,YAAY,GAAG,CAAA,MAAA,EAASL,SAAS,CAAA,CAAE;EACzC,MAAMM,oBAAoB,GAAG,CAAA,KAAA,EAAQN,SAAS,CAAA,EAAGC,YAAY,CAAA,CAAE;EAE/D,MAAMM,eAAe,GAAG,MAAM;EAC9B,MAAMC,mBAAmB,GAAG,UAAU;EACtC,MAAMC,qBAAqB,GAAG,YAAY;EAC1C,MAAMC,oBAAoB,GAAG,WAAW;EACxC,MAAMC,0BAA0B,GAAG,CAAA,QAAA,EAAWH,mBAAmB,CAAA,EAAA,EAAKA,mBAAmB,CAAA,CAAE;EAC3F,MAAMI,qBAAqB,GAAG,qBAAqB;EAEnD,MAAMC,KAAK,GAAG,OAAO;EACrB,MAAMC,MAAM,GAAG,QAAQ;EAEvB,MAAMC,gBAAgB,GAAG,sCAAsC;EAC/D,MAAMC,oBAAoB,GAAG,6BAA6B;EAE1D,MAAMC,OAAO,GAAG;EACdC,EAAAA,MAAM,EAAE,IAAI;EACZC,EAAAA,MAAM,EAAE;EACV,CAAC;EAED,MAAMC,WAAW,GAAG;EAClBF,EAAAA,MAAM,EA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D,QAAAA,IAAI,CAAC1D,MAAM,CAAC,EAAE;EAChB,MAAA;EACF,IAAA,CAAC,CAAC;EACJ,EAAA;EACF;;EAEA;EACA;EACA;;EAEA0B,YAAY,CAACkC,EAAE,CAACC,QAAQ,EAAEhF,oBAAoB,EAAEU,oBAAoB,EAAE,UAAUuE,KAAK,EAAE;EACrF;EACA,EAAA,IAAIA,KAAK,CAACC,MAAM,CAACC,OAAO,KAAK,GAAG,IAAKF,KAAK,CAACG,cAAc,IAAIH,KAAK,CAACG,cAAc,CAACD,OAAO,KAAK,GAAI,EAAE;MAClGF,KAAK,CAACI,cAAc,EAAE;EACxB,EAAA;IAEA,KAAK,MAAMnE,OAAO,IAAIK,cAAc,CAAC+D,+BAA+B,CAAC,IAAI,CAAC,EAAE;EAC1EvE,IAAAA,QAAQ,CAAC4B,mBAAmB,CAACzB,OAAO,EAAE;EAAEL,MAAAA,MAAM,EAAE;EAAM,KAAC,CAAC,CAACA,MAAM,EAAE;EACnE,EAAA;EACF,CAAC,CAAC;;EAEF;EACA;EACA;;AAEA0E,6BAAkB,CAACxE,QAAQ,CAAC;;;;;;;;"}
|
|
@@ -0,0 +1,63 @@
|
|
|
1
|
+
/*!
|
|
2
|
+
* Bootstrap data.js v5.3.8 (https://getbootstrap.com/)
|
|
3
|
+
* Copyright 2011-2025 The Bootstrap Authors (https://github.com/twbs/bootstrap/graphs/contributors)
|
|
4
|
+
* Licensed under MIT (https://github.com/twbs/bootstrap/blob/main/LICENSE)
|
|
5
|
+
*/
|
|
6
|
+
(function (global, factory) {
|
|
7
|
+
typeof exports === 'object' && typeof module !== 'undefined' ? module.exports = factory() :
|
|
8
|
+
typeof define === 'function' && define.amd ? define(factory) :
|
|
9
|
+
(global = typeof globalThis !== 'undefined' ? globalThis : global || self, global.Data = factory());
|
|
10
|
+
})(this, (function () { 'use strict';
|
|
11
|
+
|
|
12
|
+
/**
|
|
13
|
+
* --------------------------------------------------------------------------
|
|
14
|
+
* Bootstrap dom/data.js
|
|
15
|
+
* Licensed under MIT (https://github.com/twbs/bootstrap/blob/main/LICENSE)
|
|
16
|
+
* --------------------------------------------------------------------------
|
|
17
|
+
*/
|
|
18
|
+
|
|
19
|
+
/**
|
|
20
|
+
* Constants
|
|
21
|
+
*/
|
|
22
|
+
|
|
23
|
+
const elementMap = new Map();
|
|
24
|
+
const data = {
|
|
25
|
+
set(element, key, instance) {
|
|
26
|
+
if (!elementMap.has(element)) {
|
|
27
|
+
elementMap.set(element, new Map());
|
|
28
|
+
}
|
|
29
|
+
const instanceMap = elementMap.get(element);
|
|
30
|
+
|
|
31
|
+
// make it clear we only want one instance per element
|
|
32
|
+
// can be removed later when multiple key/instances are fine to be used
|
|
33
|
+
if (!instanceMap.has(key) && instanceMap.size !== 0) {
|
|
34
|
+
// eslint-disable-next-line no-console
|
|
35
|
+
console.error(`Bootstrap doesn't allow more than one instance per element. Bound instance: ${Array.from(instanceMap.keys())[0]}.`);
|
|
36
|
+
return;
|
|
37
|
+
}
|
|
38
|
+
instanceMap.set(key, instance);
|
|
39
|
+
},
|
|
40
|
+
get(element, key) {
|
|
41
|
+
if (elementMap.has(element)) {
|
|
42
|
+
return elementMap.get(element).get(key) || null;
|
|
43
|
+
}
|
|
44
|
+
return null;
|
|
45
|
+
},
|
|
46
|
+
remove(element, key) {
|
|
47
|
+
if (!elementMap.has(element)) {
|
|
48
|
+
return;
|
|
49
|
+
}
|
|
50
|
+
const instanceMap = elementMap.get(element);
|
|
51
|
+
instanceMap.delete(key);
|
|
52
|
+
|
|
53
|
+
// free up element references if there are no instances left for an element
|
|
54
|
+
if (instanceMap.size === 0) {
|
|
55
|
+
elementMap.delete(element);
|
|
56
|
+
}
|
|
57
|
+
}
|
|
58
|
+
};
|
|
59
|
+
|
|
60
|
+
return data;
|
|
61
|
+
|
|
62
|
+
}));
|
|
63
|
+
//# sourceMappingURL=data.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"data.js","sources":["../../src/dom/data.js"],"sourcesContent":["/**\n * --------------------------------------------------------------------------\n * Bootstrap dom/data.js\n * Licensed under MIT (https://github.com/twbs/bootstrap/blob/main/LICENSE)\n * --------------------------------------------------------------------------\n */\n\n/**\n * Constants\n */\n\nconst elementMap = new Map()\n\nexport default {\n set(element, key, instance) {\n if (!elementMap.has(element)) {\n elementMap.set(element, new Map())\n }\n\n const instanceMap = elementMap.get(element)\n\n // make it clear we only want one instance per element\n // can be removed later when multiple key/instances are fine to be used\n if (!instanceMap.has(key) && instanceMap.size !== 0) {\n // eslint-disable-next-line no-console\n console.error(`Bootstrap doesn't allow more than one instance per element. Bound instance: ${Array.from(instanceMap.keys())[0]}.`)\n return\n }\n\n instanceMap.set(key, instance)\n },\n\n get(element, key) {\n if (elementMap.has(element)) {\n return elementMap.get(element).get(key) || null\n }\n\n return null\n },\n\n remove(element, key) {\n if (!elementMap.has(element)) {\n return\n }\n\n const instanceMap = elementMap.get(element)\n\n instanceMap.delete(key)\n\n // free up element references if there are no instances left for an element\n if (instanceMap.size === 0) {\n elementMap.delete(element)\n }\n }\n}\n"],"names":["elementMap","Map","set","element","key","instance","has","instanceMap","get","size","console","error","Array","from","keys","remove","delete"],"mappings":";;;;;;;;;;;EAAA;EACA;EACA;EACA;EACA;EACA;;EAEA;EACA;EACA;;EAEA,MAAMA,UAAU,GAAG,IAAIC,GAAG,EAAE;AAE5B,eAAe;EACbC,EAAAA,GAAGA,CAACC,OAAO,EAAEC,GAAG,EAAEC,QAAQ,EAAE;EAC1B,IAAA,IAAI,CAACL,UAAU,CAACM,GAAG,CAACH,OAAO,CAAC,EAAE;QAC5BH,UAAU,CAACE,GAAG,CAACC,OAAO,EAAE,IAAIF,GAAG,EAAE,CAAC;EACpC,IAAA;EAEA,IAAA,MAAMM,WAAW,GAAGP,UAAU,CAACQ,GAAG,CAACL,OAAO,CAAC;;EAE3C;EACA;EACA,IAAA,IAAI,CAACI,WAAW,CAACD,GAAG,CAACF,GAAG,CAAC,IAAIG,WAAW,CAACE,IAAI,KAAK,CAAC,EAAE;EACnD;EACAC,MAAAA,OAAO,CAACC,KAAK,CAAC,+EAA+EC,KAAK,CAACC,IAAI,CAACN,WAAW,CAACO,IAAI,EAAE,CAAC,CAAC,CAAC,CAAC,GAAG,CAAC;EAClI,MAAA;EACF,IAAA;EAEAP,IAAAA,WAAW,CAACL,GAAG,CAACE,GAAG,EAAEC,QAAQ,CAAC;IAChC,CAAC;EAEDG,EAAAA,GAAGA,CAACL,OAAO,EAAEC,GAAG,EAAE;EAChB,IAAA,IAAIJ,UAAU,CAACM,GAAG,CAACH,OAAO,CAAC,EAAE;EAC3B,MAAA,OAAOH,UAAU,CAACQ,GAAG,CAACL,OAAO,CAAC,CAACK,GAAG,CAACJ,GAAG,CAAC,IAAI,IAAI;EACjD,IAAA;EAEA,IAAA,OAAO,IAAI;IACb,CAAC;EAEDW,EAAAA,MAAMA,CAACZ,OAAO,EAAEC,GAAG,EAAE;EACnB,IAAA,IAAI,CAACJ,UAAU,CAACM,GAAG,CAACH,OAAO,CAAC,EAAE;EAC5B,MAAA;EACF,IAAA;EAEA,IAAA,MAAMI,WAAW,GAAGP,UAAU,CAACQ,GAAG,CAACL,OAAO,CAAC;EAE3CI,IAAAA,WAAW,CAACS,MAAM,CAACZ,GAAG,CAAC;;EAEvB;EACA,IAAA,IAAIG,WAAW,CAACE,IAAI,KAAK,CAAC,EAAE;EAC1BT,MAAAA,UAAU,CAACgB,MAAM,CAACb,OAAO,CAAC;EAC5B,IAAA;EACF,EAAA;EACF,CAAC;;;;;;;;"}
|
|
@@ -0,0 +1,237 @@
|
|
|
1
|
+
/*!
|
|
2
|
+
* Bootstrap event-handler.js v5.3.8 (https://getbootstrap.com/)
|
|
3
|
+
* Copyright 2011-2025 The Bootstrap Authors (https://github.com/twbs/bootstrap/graphs/contributors)
|
|
4
|
+
* Licensed under MIT (https://github.com/twbs/bootstrap/blob/main/LICENSE)
|
|
5
|
+
*/
|
|
6
|
+
(function (global, factory) {
|
|
7
|
+
typeof exports === 'object' && typeof module !== 'undefined' ? module.exports = factory(require('../util/index.js')) :
|
|
8
|
+
typeof define === 'function' && define.amd ? define(['../util/index'], factory) :
|
|
9
|
+
(global = typeof globalThis !== 'undefined' ? globalThis : global || self, global.EventHandler = factory(global.Index));
|
|
10
|
+
})(this, (function (index_js) { 'use strict';
|
|
11
|
+
|
|
12
|
+
/**
|
|
13
|
+
* --------------------------------------------------------------------------
|
|
14
|
+
* Bootstrap dom/event-handler.js
|
|
15
|
+
* Licensed under MIT (https://github.com/twbs/bootstrap/blob/main/LICENSE)
|
|
16
|
+
* --------------------------------------------------------------------------
|
|
17
|
+
*/
|
|
18
|
+
|
|
19
|
+
|
|
20
|
+
/**
|
|
21
|
+
* Constants
|
|
22
|
+
*/
|
|
23
|
+
|
|
24
|
+
const namespaceRegex = /[^.]*(?=\..*)\.|.*/;
|
|
25
|
+
const stripNameRegex = /\..*/;
|
|
26
|
+
const stripUidRegex = /::\d+$/;
|
|
27
|
+
const eventRegistry = {}; // Events storage
|
|
28
|
+
let uidEvent = 1;
|
|
29
|
+
const customEvents = {
|
|
30
|
+
mouseenter: 'mouseover',
|
|
31
|
+
mouseleave: 'mouseout'
|
|
32
|
+
};
|
|
33
|
+
const nativeEvents = new Set(['click', 'dblclick', 'mouseup', 'mousedown', 'contextmenu', 'mousewheel', 'DOMMouseScroll', 'mouseover', 'mouseout', 'mousemove', 'selectstart', 'selectend', 'keydown', 'keypress', 'keyup', 'orientationchange', 'touchstart', 'touchmove', 'touchend', 'touchcancel', 'pointerdown', 'pointermove', 'pointerup', 'pointerleave', 'pointercancel', 'gesturestart', 'gesturechange', 'gestureend', 'focus', 'blur', 'change', 'reset', 'select', 'submit', 'focusin', 'focusout', 'load', 'unload', 'beforeunload', 'resize', 'move', 'DOMContentLoaded', 'readystatechange', 'error', 'abort', 'scroll']);
|
|
34
|
+
|
|
35
|
+
/**
|
|
36
|
+
* Private methods
|
|
37
|
+
*/
|
|
38
|
+
|
|
39
|
+
function makeEventUid(element, uid) {
|
|
40
|
+
return uid && `${uid}::${uidEvent++}` || element.uidEvent || uidEvent++;
|
|
41
|
+
}
|
|
42
|
+
function getElementEvents(element) {
|
|
43
|
+
const uid = makeEventUid(element);
|
|
44
|
+
element.uidEvent = uid;
|
|
45
|
+
eventRegistry[uid] = eventRegistry[uid] || {};
|
|
46
|
+
return eventRegistry[uid];
|
|
47
|
+
}
|
|
48
|
+
function bootstrapHandler(element, fn) {
|
|
49
|
+
return function handler(event) {
|
|
50
|
+
hydrateObj(event, {
|
|
51
|
+
delegateTarget: element
|
|
52
|
+
});
|
|
53
|
+
if (handler.oneOff) {
|
|
54
|
+
EventHandler.off(element, event.type, fn);
|
|
55
|
+
}
|
|
56
|
+
return fn.apply(element, [event]);
|
|
57
|
+
};
|
|
58
|
+
}
|
|
59
|
+
function bootstrapDelegationHandler(element, selector, fn) {
|
|
60
|
+
return function handler(event) {
|
|
61
|
+
const domElements = element.querySelectorAll(selector);
|
|
62
|
+
for (let {
|
|
63
|
+
target
|
|
64
|
+
} = event; target && target !== this; target = target.parentNode) {
|
|
65
|
+
for (const domElement of domElements) {
|
|
66
|
+
if (domElement !== target) {
|
|
67
|
+
continue;
|
|
68
|
+
}
|
|
69
|
+
hydrateObj(event, {
|
|
70
|
+
delegateTarget: target
|
|
71
|
+
});
|
|
72
|
+
if (handler.oneOff) {
|
|
73
|
+
EventHandler.off(element, event.type, selector, fn);
|
|
74
|
+
}
|
|
75
|
+
return fn.apply(target, [event]);
|
|
76
|
+
}
|
|
77
|
+
}
|
|
78
|
+
};
|
|
79
|
+
}
|
|
80
|
+
function findHandler(events, callable, delegationSelector = null) {
|
|
81
|
+
return Object.values(events).find(event => event.callable === callable && event.delegationSelector === delegationSelector);
|
|
82
|
+
}
|
|
83
|
+
function normalizeParameters(originalTypeEvent, handler, delegationFunction) {
|
|
84
|
+
const isDelegated = typeof handler === 'string';
|
|
85
|
+
// TODO: tooltip passes `false` instead of selector, so we need to check
|
|
86
|
+
const callable = isDelegated ? delegationFunction : handler || delegationFunction;
|
|
87
|
+
let typeEvent = getTypeEvent(originalTypeEvent);
|
|
88
|
+
if (!nativeEvents.has(typeEvent)) {
|
|
89
|
+
typeEvent = originalTypeEvent;
|
|
90
|
+
}
|
|
91
|
+
return [isDelegated, callable, typeEvent];
|
|
92
|
+
}
|
|
93
|
+
function addHandler(element, originalTypeEvent, handler, delegationFunction, oneOff) {
|
|
94
|
+
if (typeof originalTypeEvent !== 'string' || !element) {
|
|
95
|
+
return;
|
|
96
|
+
}
|
|
97
|
+
let [isDelegated, callable, typeEvent] = normalizeParameters(originalTypeEvent, handler, delegationFunction);
|
|
98
|
+
|
|
99
|
+
// in case of mouseenter or mouseleave wrap the handler within a function that checks for its DOM position
|
|
100
|
+
// this prevents the handler from being dispatched the same way as mouseover or mouseout does
|
|
101
|
+
if (originalTypeEvent in customEvents) {
|
|
102
|
+
const wrapFunction = fn => {
|
|
103
|
+
return function (event) {
|
|
104
|
+
if (!event.relatedTarget || event.relatedTarget !== event.delegateTarget && !event.delegateTarget.contains(event.relatedTarget)) {
|
|
105
|
+
return fn.call(this, event);
|
|
106
|
+
}
|
|
107
|
+
};
|
|
108
|
+
};
|
|
109
|
+
callable = wrapFunction(callable);
|
|
110
|
+
}
|
|
111
|
+
const events = getElementEvents(element);
|
|
112
|
+
const handlers = events[typeEvent] || (events[typeEvent] = {});
|
|
113
|
+
const previousFunction = findHandler(handlers, callable, isDelegated ? handler : null);
|
|
114
|
+
if (previousFunction) {
|
|
115
|
+
previousFunction.oneOff = previousFunction.oneOff && oneOff;
|
|
116
|
+
return;
|
|
117
|
+
}
|
|
118
|
+
const uid = makeEventUid(callable, originalTypeEvent.replace(namespaceRegex, ''));
|
|
119
|
+
const fn = isDelegated ? bootstrapDelegationHandler(element, handler, callable) : bootstrapHandler(element, callable);
|
|
120
|
+
fn.delegationSelector = isDelegated ? handler : null;
|
|
121
|
+
fn.callable = callable;
|
|
122
|
+
fn.oneOff = oneOff;
|
|
123
|
+
fn.uidEvent = uid;
|
|
124
|
+
handlers[uid] = fn;
|
|
125
|
+
element.addEventListener(typeEvent, fn, isDelegated);
|
|
126
|
+
}
|
|
127
|
+
function removeHandler(element, events, typeEvent, handler, delegationSelector) {
|
|
128
|
+
const fn = findHandler(events[typeEvent], handler, delegationSelector);
|
|
129
|
+
if (!fn) {
|
|
130
|
+
return;
|
|
131
|
+
}
|
|
132
|
+
element.removeEventListener(typeEvent, fn, Boolean(delegationSelector));
|
|
133
|
+
delete events[typeEvent][fn.uidEvent];
|
|
134
|
+
}
|
|
135
|
+
function removeNamespacedHandlers(element, events, typeEvent, namespace) {
|
|
136
|
+
const storeElementEvent = events[typeEvent] || {};
|
|
137
|
+
for (const [handlerKey, event] of Object.entries(storeElementEvent)) {
|
|
138
|
+
if (handlerKey.includes(namespace)) {
|
|
139
|
+
removeHandler(element, events, typeEvent, event.callable, event.delegationSelector);
|
|
140
|
+
}
|
|
141
|
+
}
|
|
142
|
+
}
|
|
143
|
+
function getTypeEvent(event) {
|
|
144
|
+
// allow to get the native events from namespaced events ('click.bs.button' --> 'click')
|
|
145
|
+
event = event.replace(stripNameRegex, '');
|
|
146
|
+
return customEvents[event] || event;
|
|
147
|
+
}
|
|
148
|
+
const EventHandler = {
|
|
149
|
+
on(element, event, handler, delegationFunction) {
|
|
150
|
+
addHandler(element, event, handler, delegationFunction, false);
|
|
151
|
+
},
|
|
152
|
+
one(element, event, handler, delegationFunction) {
|
|
153
|
+
addHandler(element, event, handler, delegationFunction, true);
|
|
154
|
+
},
|
|
155
|
+
off(element, originalTypeEvent, handler, delegationFunction) {
|
|
156
|
+
if (typeof originalTypeEvent !== 'string' || !element) {
|
|
157
|
+
return;
|
|
158
|
+
}
|
|
159
|
+
const [isDelegated, callable, typeEvent] = normalizeParameters(originalTypeEvent, handler, delegationFunction);
|
|
160
|
+
const inNamespace = typeEvent !== originalTypeEvent;
|
|
161
|
+
const events = getElementEvents(element);
|
|
162
|
+
const storeElementEvent = events[typeEvent] || {};
|
|
163
|
+
const isNamespace = originalTypeEvent.startsWith('.');
|
|
164
|
+
if (typeof callable !== 'undefined') {
|
|
165
|
+
// Simplest case: handler is passed, remove that listener ONLY.
|
|
166
|
+
if (!Object.keys(storeElementEvent).length) {
|
|
167
|
+
return;
|
|
168
|
+
}
|
|
169
|
+
removeHandler(element, events, typeEvent, callable, isDelegated ? handler : null);
|
|
170
|
+
return;
|
|
171
|
+
}
|
|
172
|
+
if (isNamespace) {
|
|
173
|
+
for (const elementEvent of Object.keys(events)) {
|
|
174
|
+
removeNamespacedHandlers(element, events, elementEvent, originalTypeEvent.slice(1));
|
|
175
|
+
}
|
|
176
|
+
}
|
|
177
|
+
for (const [keyHandlers, event] of Object.entries(storeElementEvent)) {
|
|
178
|
+
const handlerKey = keyHandlers.replace(stripUidRegex, '');
|
|
179
|
+
if (!inNamespace || originalTypeEvent.includes(handlerKey)) {
|
|
180
|
+
removeHandler(element, events, typeEvent, event.callable, event.delegationSelector);
|
|
181
|
+
}
|
|
182
|
+
}
|
|
183
|
+
},
|
|
184
|
+
trigger(element, event, args) {
|
|
185
|
+
if (typeof event !== 'string' || !element) {
|
|
186
|
+
return null;
|
|
187
|
+
}
|
|
188
|
+
const $ = index_js.getjQuery();
|
|
189
|
+
const typeEvent = getTypeEvent(event);
|
|
190
|
+
const inNamespace = event !== typeEvent;
|
|
191
|
+
let jQueryEvent = null;
|
|
192
|
+
let bubbles = true;
|
|
193
|
+
let nativeDispatch = true;
|
|
194
|
+
let defaultPrevented = false;
|
|
195
|
+
if (inNamespace && $) {
|
|
196
|
+
jQueryEvent = $.Event(event, args);
|
|
197
|
+
$(element).trigger(jQueryEvent);
|
|
198
|
+
bubbles = !jQueryEvent.isPropagationStopped();
|
|
199
|
+
nativeDispatch = !jQueryEvent.isImmediatePropagationStopped();
|
|
200
|
+
defaultPrevented = jQueryEvent.isDefaultPrevented();
|
|
201
|
+
}
|
|
202
|
+
const evt = hydrateObj(new Event(event, {
|
|
203
|
+
bubbles,
|
|
204
|
+
cancelable: true
|
|
205
|
+
}), args);
|
|
206
|
+
if (defaultPrevented) {
|
|
207
|
+
evt.preventDefault();
|
|
208
|
+
}
|
|
209
|
+
if (nativeDispatch) {
|
|
210
|
+
element.dispatchEvent(evt);
|
|
211
|
+
}
|
|
212
|
+
if (evt.defaultPrevented && jQueryEvent) {
|
|
213
|
+
jQueryEvent.preventDefault();
|
|
214
|
+
}
|
|
215
|
+
return evt;
|
|
216
|
+
}
|
|
217
|
+
};
|
|
218
|
+
function hydrateObj(obj, meta = {}) {
|
|
219
|
+
for (const [key, value] of Object.entries(meta)) {
|
|
220
|
+
try {
|
|
221
|
+
obj[key] = value;
|
|
222
|
+
} catch (_unused) {
|
|
223
|
+
Object.defineProperty(obj, key, {
|
|
224
|
+
configurable: true,
|
|
225
|
+
get() {
|
|
226
|
+
return value;
|
|
227
|
+
}
|
|
228
|
+
});
|
|
229
|
+
}
|
|
230
|
+
}
|
|
231
|
+
return obj;
|
|
232
|
+
}
|
|
233
|
+
|
|
234
|
+
return EventHandler;
|
|
235
|
+
|
|
236
|
+
}));
|
|
237
|
+
//# sourceMappingURL=event-handler.js.map
|