bootstrap 4.6.2.1 → 5.3.5
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 +4 -4
- data/.github/workflows/ci.yml +61 -0
- data/CHANGELOG.md +7 -2
- data/Gemfile +1 -0
- data/README.md +33 -15
- data/Rakefile +1 -2
- data/assets/javascripts/bootstrap/alert.js +50 -147
- data/assets/javascripts/bootstrap/base-component.js +83 -0
- data/assets/javascripts/bootstrap/button.js +40 -190
- data/assets/javascripts/bootstrap/carousel.js +282 -537
- data/assets/javascripts/bootstrap/collapse.js +166 -314
- data/assets/javascripts/bootstrap/dom/data.js +62 -0
- data/assets/javascripts/bootstrap/dom/event-handler.js +236 -0
- data/assets/javascripts/bootstrap/dom/manipulator.js +71 -0
- data/assets/javascripts/bootstrap/dom/selector-engine.js +103 -0
- data/assets/javascripts/bootstrap/dropdown.js +297 -455
- data/assets/javascripts/bootstrap/modal.js +223 -566
- data/assets/javascripts/bootstrap/offcanvas.js +245 -0
- data/assets/javascripts/bootstrap/popover.js +59 -208
- data/assets/javascripts/bootstrap/scrollspy.js +213 -276
- data/assets/javascripts/bootstrap/tab.js +222 -200
- data/assets/javascripts/bootstrap/toast.js +137 -206
- data/assets/javascripts/bootstrap/tooltip.js +403 -747
- data/assets/javascripts/bootstrap/util/backdrop.js +138 -0
- data/assets/javascripts/bootstrap/util/component-functions.js +41 -0
- data/assets/javascripts/bootstrap/util/config.js +67 -0
- data/assets/javascripts/bootstrap/util/focustrap.js +112 -0
- data/assets/javascripts/bootstrap/util/index.js +280 -0
- data/assets/javascripts/bootstrap/util/sanitizer.js +113 -0
- data/assets/javascripts/bootstrap/util/scrollbar.js +112 -0
- data/assets/javascripts/bootstrap/util/swipe.js +134 -0
- data/assets/javascripts/bootstrap/util/template-factory.js +150 -0
- data/assets/javascripts/bootstrap-global-this-define.js +6 -0
- data/assets/javascripts/bootstrap-global-this-undefine.js +2 -0
- data/assets/javascripts/bootstrap-sprockets.js +21 -5
- data/assets/javascripts/bootstrap.js +3625 -3488
- data/assets/javascripts/bootstrap.min.js +3 -3
- data/assets/stylesheets/_bootstrap-grid.scss +53 -21
- data/assets/stylesheets/_bootstrap-reboot.scss +5 -7
- data/assets/stylesheets/_bootstrap-utilities.scss +19 -0
- data/assets/stylesheets/_bootstrap.scss +21 -13
- data/assets/stylesheets/bootstrap/_accordion.scss +153 -0
- data/assets/stylesheets/bootstrap/_alert.scss +32 -16
- data/assets/stylesheets/bootstrap/_badge.scss +15 -31
- data/assets/stylesheets/bootstrap/_breadcrumb.scss +22 -24
- data/assets/stylesheets/bootstrap/_button-group.scss +32 -48
- data/assets/stylesheets/bootstrap/_buttons.scss +145 -71
- data/assets/stylesheets/bootstrap/_card.scss +67 -115
- data/assets/stylesheets/bootstrap/_carousel.scss +63 -37
- data/assets/stylesheets/bootstrap/_close.scss +53 -27
- data/assets/stylesheets/bootstrap/_containers.scss +41 -0
- data/assets/stylesheets/bootstrap/_dropdown.scss +129 -71
- data/assets/stylesheets/bootstrap/_forms.scss +9 -347
- data/assets/stylesheets/bootstrap/_functions.scss +135 -23
- data/assets/stylesheets/bootstrap/_grid.scss +18 -52
- data/assets/stylesheets/bootstrap/_helpers.scss +12 -0
- data/assets/stylesheets/bootstrap/_list-group.scss +93 -48
- data/assets/stylesheets/bootstrap/_maps.scss +174 -0
- data/assets/stylesheets/bootstrap/_mixins.scss +10 -15
- data/assets/stylesheets/bootstrap/_modal.scss +112 -112
- data/assets/stylesheets/bootstrap/_nav.scss +100 -28
- data/assets/stylesheets/bootstrap/_navbar.scss +130 -173
- data/assets/stylesheets/bootstrap/_offcanvas.scss +147 -0
- data/assets/stylesheets/bootstrap/_pagination.scss +72 -37
- data/assets/stylesheets/bootstrap/_placeholders.scss +51 -0
- data/assets/stylesheets/bootstrap/_popover.scss +99 -73
- data/assets/stylesheets/bootstrap/_progress.scss +35 -14
- data/assets/stylesheets/bootstrap/_reboot.scss +319 -192
- data/assets/stylesheets/bootstrap/_root.scss +177 -9
- data/assets/stylesheets/bootstrap/_spinners.scss +43 -23
- data/assets/stylesheets/bootstrap/_tables.scss +101 -115
- data/assets/stylesheets/bootstrap/_toasts.scss +54 -27
- data/assets/stylesheets/bootstrap/_tooltip.scss +67 -63
- data/assets/stylesheets/bootstrap/_transitions.scss +3 -2
- data/assets/stylesheets/bootstrap/_type.scss +40 -59
- data/assets/stylesheets/bootstrap/_utilities.scss +806 -18
- data/assets/stylesheets/bootstrap/_variables-dark.scss +102 -0
- data/assets/stylesheets/bootstrap/_variables.scss +1210 -606
- data/assets/stylesheets/bootstrap/forms/_floating-labels.scss +97 -0
- data/assets/stylesheets/bootstrap/forms/_form-check.scss +189 -0
- data/assets/stylesheets/bootstrap/forms/_form-control.scss +214 -0
- data/assets/stylesheets/bootstrap/forms/_form-range.scss +91 -0
- data/assets/stylesheets/bootstrap/forms/_form-select.scss +80 -0
- data/assets/stylesheets/bootstrap/forms/_form-text.scss +11 -0
- data/assets/stylesheets/bootstrap/forms/_input-group.scss +132 -0
- data/assets/stylesheets/bootstrap/forms/_labels.scss +36 -0
- data/assets/stylesheets/bootstrap/forms/_validation.scss +12 -0
- data/assets/stylesheets/bootstrap/helpers/_color-bg.scss +7 -0
- data/assets/stylesheets/bootstrap/helpers/_colored-links.scss +30 -0
- data/assets/stylesheets/bootstrap/helpers/_focus-ring.scss +5 -0
- data/assets/stylesheets/bootstrap/helpers/_icon-link.scss +25 -0
- data/assets/stylesheets/bootstrap/helpers/_position.scss +36 -0
- data/assets/stylesheets/bootstrap/helpers/_ratio.scss +26 -0
- data/assets/stylesheets/bootstrap/helpers/_stacks.scss +15 -0
- data/assets/stylesheets/bootstrap/helpers/_stretched-link.scss +15 -0
- data/assets/stylesheets/bootstrap/helpers/_text-truncation.scss +7 -0
- data/assets/stylesheets/bootstrap/helpers/_visually-hidden.scss +8 -0
- data/assets/stylesheets/bootstrap/helpers/_vr.scss +8 -0
- data/assets/stylesheets/bootstrap/mixins/_alert.scss +11 -6
- data/assets/stylesheets/bootstrap/mixins/_backdrop.scss +14 -0
- data/assets/stylesheets/bootstrap/mixins/_banner.scss +7 -0
- data/assets/stylesheets/bootstrap/mixins/_border-radius.scss +10 -8
- data/assets/stylesheets/bootstrap/mixins/_box-shadow.scss +7 -9
- data/assets/stylesheets/bootstrap/mixins/_breakpoints.scss +20 -16
- data/assets/stylesheets/bootstrap/mixins/_buttons.scss +60 -100
- data/assets/stylesheets/bootstrap/mixins/_caret.scss +34 -27
- data/assets/stylesheets/bootstrap/mixins/_clearfix.scss +2 -0
- data/assets/stylesheets/bootstrap/mixins/_color-mode.scss +21 -0
- data/assets/stylesheets/bootstrap/mixins/_color-scheme.scss +7 -0
- data/assets/stylesheets/bootstrap/mixins/_container.scss +11 -0
- data/assets/stylesheets/bootstrap/mixins/_forms.scss +64 -96
- data/assets/stylesheets/bootstrap/mixins/_gradients.scss +13 -11
- data/assets/stylesheets/bootstrap/mixins/_grid.scss +118 -36
- data/assets/stylesheets/bootstrap/mixins/_image.scss +1 -21
- data/assets/stylesheets/bootstrap/mixins/_list-group.scss +7 -2
- data/assets/stylesheets/bootstrap/mixins/_lists.scss +1 -1
- data/assets/stylesheets/bootstrap/mixins/_pagination.scss +7 -19
- data/assets/stylesheets/bootstrap/mixins/_reset-text.scss +2 -2
- data/assets/stylesheets/bootstrap/mixins/_table-variants.scss +24 -0
- data/assets/stylesheets/bootstrap/mixins/_transition.scss +1 -1
- data/assets/stylesheets/bootstrap/mixins/_utilities.scss +97 -0
- data/assets/stylesheets/bootstrap/mixins/_visually-hidden.scss +33 -0
- data/assets/stylesheets/bootstrap/utilities/_api.scss +47 -0
- data/assets/stylesheets/bootstrap/vendor/_rfs.scss +211 -91
- data/bootstrap.gemspec +6 -6
- data/lib/bootstrap/engine.rb +0 -1
- data/lib/bootstrap/version.rb +2 -2
- data/tasks/updater/js.rb +17 -5
- data/tasks/updater/network.rb +2 -2
- data/tasks/updater/scss.rb +2 -2
- data/tasks/updater.rb +2 -2
- data/test/dummy_rails/app/assets/javascripts/application.js +4 -3
- data/test/dummy_rails/app/views/layouts/application.html.erb +3 -1
- data/test/dummy_rails/app/views/pages/root.html +89 -0
- data/test/dummy_rails/config/application.rb +0 -5
- data/test/dummy_rails/public/favicon.ico +0 -0
- data/test/gemfiles/rails_4_2.gemfile +2 -1
- data/test/gemfiles/rails_5_0.gemfile +1 -2
- data/test/gemfiles/rails_5_1.gemfile +1 -2
- data/test/gemfiles/rails_5_2.gemfile +7 -0
- data/test/gemfiles/rails_6_0.gemfile +1 -1
- data/test/gemfiles/rails_6_1.gemfile +7 -0
- data/test/gemfiles/rails_7_0_dartsass.gemfile +0 -1
- data/test/gemfiles/rails_7_0_sassc.gemfile +0 -1
- data/test/rails_test.rb +0 -5
- data/test/test_helper.rb +3 -2
- metadata +92 -86
- data/.travis.yml +0 -31
- data/assets/javascripts/bootstrap/util.js +0 -189
- data/assets/stylesheets/bootstrap/_code.scss +0 -48
- data/assets/stylesheets/bootstrap/_custom-forms.scss +0 -526
- data/assets/stylesheets/bootstrap/_input-group.scss +0 -211
- data/assets/stylesheets/bootstrap/_jumbotron.scss +0 -17
- data/assets/stylesheets/bootstrap/_media.scss +0 -8
- data/assets/stylesheets/bootstrap/_print.scss +0 -132
- data/assets/stylesheets/bootstrap/mixins/_background-variant.scss +0 -23
- data/assets/stylesheets/bootstrap/mixins/_badge.scss +0 -17
- data/assets/stylesheets/bootstrap/mixins/_float.scss +0 -14
- data/assets/stylesheets/bootstrap/mixins/_grid-framework.scss +0 -80
- data/assets/stylesheets/bootstrap/mixins/_hover.scss +0 -37
- data/assets/stylesheets/bootstrap/mixins/_nav-divider.scss +0 -11
- data/assets/stylesheets/bootstrap/mixins/_screen-reader.scss +0 -34
- data/assets/stylesheets/bootstrap/mixins/_size.scss +0 -7
- data/assets/stylesheets/bootstrap/mixins/_table-row.scss +0 -39
- data/assets/stylesheets/bootstrap/mixins/_text-emphasis.scss +0 -17
- data/assets/stylesheets/bootstrap/mixins/_text-hide.scss +0 -11
- data/assets/stylesheets/bootstrap/mixins/_visibility.scss +0 -8
- data/assets/stylesheets/bootstrap/utilities/_align.scss +0 -8
- data/assets/stylesheets/bootstrap/utilities/_background.scss +0 -19
- data/assets/stylesheets/bootstrap/utilities/_borders.scss +0 -75
- data/assets/stylesheets/bootstrap/utilities/_display.scss +0 -26
- data/assets/stylesheets/bootstrap/utilities/_embed.scss +0 -39
- data/assets/stylesheets/bootstrap/utilities/_flex.scss +0 -51
- data/assets/stylesheets/bootstrap/utilities/_float.scss +0 -11
- data/assets/stylesheets/bootstrap/utilities/_interactions.scss +0 -5
- data/assets/stylesheets/bootstrap/utilities/_overflow.scss +0 -5
- data/assets/stylesheets/bootstrap/utilities/_position.scss +0 -32
- data/assets/stylesheets/bootstrap/utilities/_screenreaders.scss +0 -11
- data/assets/stylesheets/bootstrap/utilities/_shadows.scss +0 -6
- data/assets/stylesheets/bootstrap/utilities/_sizing.scss +0 -20
- data/assets/stylesheets/bootstrap/utilities/_spacing.scss +0 -73
- data/assets/stylesheets/bootstrap/utilities/_stretched-link.scss +0 -19
- data/assets/stylesheets/bootstrap/utilities/_text.scss +0 -72
- data/assets/stylesheets/bootstrap/utilities/_visibility.scss +0 -13
- data/test/dummy_rails/app/views/pages/root.html.slim +0 -58
- /data/assets/stylesheets/bootstrap/{utilities → helpers}/_clearfix.scss +0 -0
@@ -0,0 +1,236 @@
|
|
1
|
+
/*!
|
2
|
+
* Bootstrap event-handler.js v5.3.5 (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
|
+
}));
|
@@ -0,0 +1,71 @@
|
|
1
|
+
/*!
|
2
|
+
* Bootstrap manipulator.js v5.3.5 (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.Manipulator = factory());
|
10
|
+
})(this, (function () { 'use strict';
|
11
|
+
|
12
|
+
/**
|
13
|
+
* --------------------------------------------------------------------------
|
14
|
+
* Bootstrap dom/manipulator.js
|
15
|
+
* Licensed under MIT (https://github.com/twbs/bootstrap/blob/main/LICENSE)
|
16
|
+
* --------------------------------------------------------------------------
|
17
|
+
*/
|
18
|
+
|
19
|
+
function normalizeData(value) {
|
20
|
+
if (value === 'true') {
|
21
|
+
return true;
|
22
|
+
}
|
23
|
+
if (value === 'false') {
|
24
|
+
return false;
|
25
|
+
}
|
26
|
+
if (value === Number(value).toString()) {
|
27
|
+
return Number(value);
|
28
|
+
}
|
29
|
+
if (value === '' || value === 'null') {
|
30
|
+
return null;
|
31
|
+
}
|
32
|
+
if (typeof value !== 'string') {
|
33
|
+
return value;
|
34
|
+
}
|
35
|
+
try {
|
36
|
+
return JSON.parse(decodeURIComponent(value));
|
37
|
+
} catch (_unused) {
|
38
|
+
return value;
|
39
|
+
}
|
40
|
+
}
|
41
|
+
function normalizeDataKey(key) {
|
42
|
+
return key.replace(/[A-Z]/g, chr => `-${chr.toLowerCase()}`);
|
43
|
+
}
|
44
|
+
const Manipulator = {
|
45
|
+
setDataAttribute(element, key, value) {
|
46
|
+
element.setAttribute(`data-bs-${normalizeDataKey(key)}`, value);
|
47
|
+
},
|
48
|
+
removeDataAttribute(element, key) {
|
49
|
+
element.removeAttribute(`data-bs-${normalizeDataKey(key)}`);
|
50
|
+
},
|
51
|
+
getDataAttributes(element) {
|
52
|
+
if (!element) {
|
53
|
+
return {};
|
54
|
+
}
|
55
|
+
const attributes = {};
|
56
|
+
const bsKeys = Object.keys(element.dataset).filter(key => key.startsWith('bs') && !key.startsWith('bsConfig'));
|
57
|
+
for (const key of bsKeys) {
|
58
|
+
let pureKey = key.replace(/^bs/, '');
|
59
|
+
pureKey = pureKey.charAt(0).toLowerCase() + pureKey.slice(1);
|
60
|
+
attributes[pureKey] = normalizeData(element.dataset[key]);
|
61
|
+
}
|
62
|
+
return attributes;
|
63
|
+
},
|
64
|
+
getDataAttribute(element, key) {
|
65
|
+
return normalizeData(element.getAttribute(`data-bs-${normalizeDataKey(key)}`));
|
66
|
+
}
|
67
|
+
};
|
68
|
+
|
69
|
+
return Manipulator;
|
70
|
+
|
71
|
+
}));
|
@@ -0,0 +1,103 @@
|
|
1
|
+
/*!
|
2
|
+
* Bootstrap selector-engine.js v5.3.5 (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.SelectorEngine = factory(global.Index));
|
10
|
+
})(this, (function (index_js) { 'use strict';
|
11
|
+
|
12
|
+
/**
|
13
|
+
* --------------------------------------------------------------------------
|
14
|
+
* Bootstrap dom/selector-engine.js
|
15
|
+
* Licensed under MIT (https://github.com/twbs/bootstrap/blob/main/LICENSE)
|
16
|
+
* --------------------------------------------------------------------------
|
17
|
+
*/
|
18
|
+
|
19
|
+
const getSelector = element => {
|
20
|
+
let selector = element.getAttribute('data-bs-target');
|
21
|
+
if (!selector || selector === '#') {
|
22
|
+
let hrefAttribute = element.getAttribute('href');
|
23
|
+
|
24
|
+
// The only valid content that could double as a selector are IDs or classes,
|
25
|
+
// so everything starting with `#` or `.`. If a "real" URL is used as the selector,
|
26
|
+
// `document.querySelector` will rightfully complain it is invalid.
|
27
|
+
// See https://github.com/twbs/bootstrap/issues/32273
|
28
|
+
if (!hrefAttribute || !hrefAttribute.includes('#') && !hrefAttribute.startsWith('.')) {
|
29
|
+
return null;
|
30
|
+
}
|
31
|
+
|
32
|
+
// Just in case some CMS puts out a full URL with the anchor appended
|
33
|
+
if (hrefAttribute.includes('#') && !hrefAttribute.startsWith('#')) {
|
34
|
+
hrefAttribute = `#${hrefAttribute.split('#')[1]}`;
|
35
|
+
}
|
36
|
+
selector = hrefAttribute && hrefAttribute !== '#' ? hrefAttribute.trim() : null;
|
37
|
+
}
|
38
|
+
return selector ? selector.split(',').map(sel => index_js.parseSelector(sel)).join(',') : null;
|
39
|
+
};
|
40
|
+
const SelectorEngine = {
|
41
|
+
find(selector, element = document.documentElement) {
|
42
|
+
return [].concat(...Element.prototype.querySelectorAll.call(element, selector));
|
43
|
+
},
|
44
|
+
findOne(selector, element = document.documentElement) {
|
45
|
+
return Element.prototype.querySelector.call(element, selector);
|
46
|
+
},
|
47
|
+
children(element, selector) {
|
48
|
+
return [].concat(...element.children).filter(child => child.matches(selector));
|
49
|
+
},
|
50
|
+
parents(element, selector) {
|
51
|
+
const parents = [];
|
52
|
+
let ancestor = element.parentNode.closest(selector);
|
53
|
+
while (ancestor) {
|
54
|
+
parents.push(ancestor);
|
55
|
+
ancestor = ancestor.parentNode.closest(selector);
|
56
|
+
}
|
57
|
+
return parents;
|
58
|
+
},
|
59
|
+
prev(element, selector) {
|
60
|
+
let previous = element.previousElementSibling;
|
61
|
+
while (previous) {
|
62
|
+
if (previous.matches(selector)) {
|
63
|
+
return [previous];
|
64
|
+
}
|
65
|
+
previous = previous.previousElementSibling;
|
66
|
+
}
|
67
|
+
return [];
|
68
|
+
},
|
69
|
+
// TODO: this is now unused; remove later along with prev()
|
70
|
+
next(element, selector) {
|
71
|
+
let next = element.nextElementSibling;
|
72
|
+
while (next) {
|
73
|
+
if (next.matches(selector)) {
|
74
|
+
return [next];
|
75
|
+
}
|
76
|
+
next = next.nextElementSibling;
|
77
|
+
}
|
78
|
+
return [];
|
79
|
+
},
|
80
|
+
focusableChildren(element) {
|
81
|
+
const focusables = ['a', 'button', 'input', 'textarea', 'select', 'details', '[tabindex]', '[contenteditable="true"]'].map(selector => `${selector}:not([tabindex^="-"])`).join(',');
|
82
|
+
return this.find(focusables, element).filter(el => !index_js.isDisabled(el) && index_js.isVisible(el));
|
83
|
+
},
|
84
|
+
getSelectorFromElement(element) {
|
85
|
+
const selector = getSelector(element);
|
86
|
+
if (selector) {
|
87
|
+
return SelectorEngine.findOne(selector) ? selector : null;
|
88
|
+
}
|
89
|
+
return null;
|
90
|
+
},
|
91
|
+
getElementFromSelector(element) {
|
92
|
+
const selector = getSelector(element);
|
93
|
+
return selector ? SelectorEngine.findOne(selector) : null;
|
94
|
+
},
|
95
|
+
getMultipleElementsFromSelector(element) {
|
96
|
+
const selector = getSelector(element);
|
97
|
+
return selector ? SelectorEngine.find(selector) : [];
|
98
|
+
}
|
99
|
+
};
|
100
|
+
|
101
|
+
return SelectorEngine;
|
102
|
+
|
103
|
+
}));
|