bootstrap 4.6.0 → 5.0.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.travis.yml +2 -1
- data/README.md +7 -4
- data/assets/javascripts/bootstrap/alert.js +181 -109
- data/assets/javascripts/bootstrap/base-component.js +63 -0
- data/assets/javascripts/bootstrap/button.js +85 -173
- data/assets/javascripts/bootstrap/carousel.js +458 -355
- data/assets/javascripts/bootstrap/collapse.js +366 -218
- data/assets/javascripts/bootstrap/dom/data.js +68 -0
- data/assets/javascripts/bootstrap/dom/event-handler.js +322 -0
- data/assets/javascripts/bootstrap/dom/manipulator.js +88 -0
- data/assets/javascripts/bootstrap/dom/selector-engine.js +85 -0
- data/assets/javascripts/bootstrap/dropdown.js +459 -351
- data/assets/javascripts/bootstrap/modal.js +597 -429
- data/assets/javascripts/bootstrap/offcanvas.js +671 -0
- data/assets/javascripts/bootstrap/popover.js +130 -154
- data/assets/javascripts/bootstrap/scrollspy.js +238 -188
- data/assets/javascripts/bootstrap/tab.js +235 -137
- data/assets/javascripts/bootstrap/toast.js +210 -148
- data/assets/javascripts/bootstrap/tooltip.js +627 -466
- 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 +15 -8
- data/assets/javascripts/bootstrap.js +3174 -2563
- data/assets/javascripts/bootstrap.min.js +2 -2
- data/assets/stylesheets/_bootstrap-grid.scss +51 -16
- data/assets/stylesheets/_bootstrap-reboot.scss +4 -1
- data/assets/stylesheets/_bootstrap.scss +16 -8
- data/assets/stylesheets/bootstrap/_accordion.scss +118 -0
- data/assets/stylesheets/bootstrap/_alert.scss +15 -10
- data/assets/stylesheets/bootstrap/_badge.scss +2 -27
- data/assets/stylesheets/bootstrap/_breadcrumb.scss +3 -17
- data/assets/stylesheets/bootstrap/_button-group.scss +21 -45
- data/assets/stylesheets/bootstrap/_buttons.scss +29 -60
- data/assets/stylesheets/bootstrap/_card.scss +20 -91
- data/assets/stylesheets/bootstrap/_carousel.scss +65 -33
- data/assets/stylesheets/bootstrap/_close.scss +30 -30
- data/assets/stylesheets/bootstrap/_containers.scss +41 -0
- data/assets/stylesheets/bootstrap/_dropdown.scss +84 -36
- data/assets/stylesheets/bootstrap/_forms.scss +9 -347
- data/assets/stylesheets/bootstrap/_functions.scss +84 -23
- data/assets/stylesheets/bootstrap/_grid.scss +3 -54
- data/assets/stylesheets/bootstrap/_helpers.scss +7 -0
- data/assets/stylesheets/bootstrap/_list-group.scss +28 -8
- data/assets/stylesheets/bootstrap/_mixins.scss +8 -13
- data/assets/stylesheets/bootstrap/_modal.scss +43 -55
- data/assets/stylesheets/bootstrap/_nav.scss +23 -4
- data/assets/stylesheets/bootstrap/_navbar.scss +45 -71
- data/assets/stylesheets/bootstrap/_offcanvas.scss +77 -0
- data/assets/stylesheets/bootstrap/_pagination.scss +10 -20
- data/assets/stylesheets/bootstrap/_popover.scss +15 -27
- data/assets/stylesheets/bootstrap/_progress.scss +5 -4
- data/assets/stylesheets/bootstrap/_reboot.scss +316 -179
- data/assets/stylesheets/bootstrap/_root.scss +5 -8
- data/assets/stylesheets/bootstrap/_spinners.scss +11 -7
- data/assets/stylesheets/bootstrap/_tables.scss +79 -114
- data/assets/stylesheets/bootstrap/_toasts.scss +20 -15
- data/assets/stylesheets/bootstrap/_tooltip.scss +17 -17
- data/assets/stylesheets/bootstrap/_transitions.scss +2 -1
- data/assets/stylesheets/bootstrap/_type.scss +38 -59
- data/assets/stylesheets/bootstrap/_utilities.scss +594 -18
- data/assets/stylesheets/bootstrap/_variables.scss +800 -482
- data/assets/stylesheets/bootstrap/bootstrap-utilities.scss +18 -0
- data/assets/stylesheets/bootstrap/forms/_floating-labels.scss +61 -0
- data/assets/stylesheets/bootstrap/forms/_form-check.scss +152 -0
- data/assets/stylesheets/bootstrap/forms/_form-control.scss +219 -0
- data/assets/stylesheets/bootstrap/forms/_form-range.scss +91 -0
- data/assets/stylesheets/bootstrap/forms/_form-select.scss +67 -0
- data/assets/stylesheets/bootstrap/forms/_form-text.scss +11 -0
- data/assets/stylesheets/bootstrap/forms/_input-group.scss +121 -0
- data/assets/stylesheets/bootstrap/forms/_labels.scss +36 -0
- data/assets/stylesheets/bootstrap/forms/_validation.scss +12 -0
- data/assets/stylesheets/bootstrap/helpers/_colored-links.scss +12 -0
- data/assets/stylesheets/bootstrap/helpers/_position.scss +30 -0
- data/assets/stylesheets/bootstrap/helpers/_ratio.scss +26 -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/mixins/_alert.scss +3 -5
- 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 +14 -10
- data/assets/stylesheets/bootstrap/mixins/_buttons.scss +71 -48
- data/assets/stylesheets/bootstrap/mixins/_caret.scss +10 -8
- data/assets/stylesheets/bootstrap/mixins/_clearfix.scss +2 -0
- data/assets/stylesheets/bootstrap/mixins/_color-scheme.scss +7 -0
- data/assets/stylesheets/bootstrap/mixins/_container.scss +9 -0
- data/assets/stylesheets/bootstrap/mixins/_forms.scss +38 -86
- data/assets/stylesheets/bootstrap/mixins/_gradients.scss +13 -11
- data/assets/stylesheets/bootstrap/mixins/_grid.scss +89 -33
- data/assets/stylesheets/bootstrap/mixins/_image.scss +1 -21
- data/assets/stylesheets/bootstrap/mixins/_list-group.scss +5 -2
- data/assets/stylesheets/bootstrap/mixins/_lists.scss +1 -1
- data/assets/stylesheets/bootstrap/mixins/_pagination.scss +17 -8
- data/assets/stylesheets/bootstrap/mixins/_reset-text.scss +2 -2
- data/assets/stylesheets/bootstrap/mixins/_table-variants.scss +21 -0
- data/assets/stylesheets/bootstrap/mixins/_transition.scss +1 -1
- data/assets/stylesheets/bootstrap/mixins/_utilities.scss +68 -0
- data/assets/stylesheets/bootstrap/mixins/_visually-hidden.scss +29 -0
- data/assets/stylesheets/bootstrap/utilities/_api.scss +47 -0
- data/assets/stylesheets/bootstrap/vendor/_rfs.scss +234 -126
- data/bootstrap.gemspec +1 -3
- data/lib/bootstrap/version.rb +2 -2
- data/tasks/updater/js.rb +20 -5
- data/tasks/updater/network.rb +7 -1
- 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 -3
- data/test/gemfiles/rails_6_1.gemfile +7 -0
- metadata +45 -73
- data/assets/javascripts/bootstrap/util.js +0 -192
- 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 -208
- data/assets/stylesheets/bootstrap/_jumbotron.scss +0 -17
- data/assets/stylesheets/bootstrap/_media.scss +0 -8
- data/assets/stylesheets/bootstrap/_print.scss +0 -141
- 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,68 @@
|
|
1
|
+
/*!
|
2
|
+
* Bootstrap data.js v5.0.0 (https://getbootstrap.com/)
|
3
|
+
* Copyright 2011-2021 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 (v5.0.0): dom/data.js
|
15
|
+
* Licensed under MIT (https://github.com/twbs/bootstrap/blob/main/LICENSE)
|
16
|
+
* --------------------------------------------------------------------------
|
17
|
+
*/
|
18
|
+
|
19
|
+
/**
|
20
|
+
* ------------------------------------------------------------------------
|
21
|
+
* Constants
|
22
|
+
* ------------------------------------------------------------------------
|
23
|
+
*/
|
24
|
+
const elementMap = new Map();
|
25
|
+
var data = {
|
26
|
+
set(element, key, instance) {
|
27
|
+
if (!elementMap.has(element)) {
|
28
|
+
elementMap.set(element, new Map());
|
29
|
+
}
|
30
|
+
|
31
|
+
const instanceMap = elementMap.get(element); // 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
|
+
|
34
|
+
if (!instanceMap.has(key) && instanceMap.size !== 0) {
|
35
|
+
// eslint-disable-next-line no-console
|
36
|
+
console.error(`Bootstrap doesn't allow more than one instance per element. Bound instance: ${Array.from(instanceMap.keys())[0]}.`);
|
37
|
+
return;
|
38
|
+
}
|
39
|
+
|
40
|
+
instanceMap.set(key, instance);
|
41
|
+
},
|
42
|
+
|
43
|
+
get(element, key) {
|
44
|
+
if (elementMap.has(element)) {
|
45
|
+
return elementMap.get(element).get(key) || null;
|
46
|
+
}
|
47
|
+
|
48
|
+
return null;
|
49
|
+
},
|
50
|
+
|
51
|
+
remove(element, key) {
|
52
|
+
if (!elementMap.has(element)) {
|
53
|
+
return;
|
54
|
+
}
|
55
|
+
|
56
|
+
const instanceMap = elementMap.get(element);
|
57
|
+
instanceMap.delete(key); // free up element references if there are no instances left for an element
|
58
|
+
|
59
|
+
if (instanceMap.size === 0) {
|
60
|
+
elementMap.delete(element);
|
61
|
+
}
|
62
|
+
}
|
63
|
+
|
64
|
+
};
|
65
|
+
|
66
|
+
return data;
|
67
|
+
|
68
|
+
})));
|
@@ -0,0 +1,322 @@
|
|
1
|
+
/*!
|
2
|
+
* Bootstrap event-handler.js v5.0.0 (https://getbootstrap.com/)
|
3
|
+
* Copyright 2011-2021 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.EventHandler = factory());
|
10
|
+
}(this, (function () { 'use strict';
|
11
|
+
|
12
|
+
/**
|
13
|
+
* --------------------------------------------------------------------------
|
14
|
+
* Bootstrap (v5.0.0): util/index.js
|
15
|
+
* Licensed under MIT (https://github.com/twbs/bootstrap/blob/main/LICENSE)
|
16
|
+
* --------------------------------------------------------------------------
|
17
|
+
*/
|
18
|
+
|
19
|
+
const getjQuery = () => {
|
20
|
+
const {
|
21
|
+
jQuery
|
22
|
+
} = window;
|
23
|
+
|
24
|
+
if (jQuery && !document.body.hasAttribute('data-bs-no-jquery')) {
|
25
|
+
return jQuery;
|
26
|
+
}
|
27
|
+
|
28
|
+
return null;
|
29
|
+
};
|
30
|
+
|
31
|
+
/**
|
32
|
+
* --------------------------------------------------------------------------
|
33
|
+
* Bootstrap (v5.0.0): dom/event-handler.js
|
34
|
+
* Licensed under MIT (https://github.com/twbs/bootstrap/blob/main/LICENSE)
|
35
|
+
* --------------------------------------------------------------------------
|
36
|
+
*/
|
37
|
+
/**
|
38
|
+
* ------------------------------------------------------------------------
|
39
|
+
* Constants
|
40
|
+
* ------------------------------------------------------------------------
|
41
|
+
*/
|
42
|
+
|
43
|
+
const namespaceRegex = /[^.]*(?=\..*)\.|.*/;
|
44
|
+
const stripNameRegex = /\..*/;
|
45
|
+
const stripUidRegex = /::\d+$/;
|
46
|
+
const eventRegistry = {}; // Events storage
|
47
|
+
|
48
|
+
let uidEvent = 1;
|
49
|
+
const customEvents = {
|
50
|
+
mouseenter: 'mouseover',
|
51
|
+
mouseleave: 'mouseout'
|
52
|
+
};
|
53
|
+
const customEventsRegex = /^(mouseenter|mouseleave)/i;
|
54
|
+
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']);
|
55
|
+
/**
|
56
|
+
* ------------------------------------------------------------------------
|
57
|
+
* Private methods
|
58
|
+
* ------------------------------------------------------------------------
|
59
|
+
*/
|
60
|
+
|
61
|
+
function getUidEvent(element, uid) {
|
62
|
+
return uid && `${uid}::${uidEvent++}` || element.uidEvent || uidEvent++;
|
63
|
+
}
|
64
|
+
|
65
|
+
function getEvent(element) {
|
66
|
+
const uid = getUidEvent(element);
|
67
|
+
element.uidEvent = uid;
|
68
|
+
eventRegistry[uid] = eventRegistry[uid] || {};
|
69
|
+
return eventRegistry[uid];
|
70
|
+
}
|
71
|
+
|
72
|
+
function bootstrapHandler(element, fn) {
|
73
|
+
return function handler(event) {
|
74
|
+
event.delegateTarget = element;
|
75
|
+
|
76
|
+
if (handler.oneOff) {
|
77
|
+
EventHandler.off(element, event.type, fn);
|
78
|
+
}
|
79
|
+
|
80
|
+
return fn.apply(element, [event]);
|
81
|
+
};
|
82
|
+
}
|
83
|
+
|
84
|
+
function bootstrapDelegationHandler(element, selector, fn) {
|
85
|
+
return function handler(event) {
|
86
|
+
const domElements = element.querySelectorAll(selector);
|
87
|
+
|
88
|
+
for (let {
|
89
|
+
target
|
90
|
+
} = event; target && target !== this; target = target.parentNode) {
|
91
|
+
for (let i = domElements.length; i--;) {
|
92
|
+
if (domElements[i] === target) {
|
93
|
+
event.delegateTarget = target;
|
94
|
+
|
95
|
+
if (handler.oneOff) {
|
96
|
+
// eslint-disable-next-line unicorn/consistent-destructuring
|
97
|
+
EventHandler.off(element, event.type, selector, fn);
|
98
|
+
}
|
99
|
+
|
100
|
+
return fn.apply(target, [event]);
|
101
|
+
}
|
102
|
+
}
|
103
|
+
} // To please ESLint
|
104
|
+
|
105
|
+
|
106
|
+
return null;
|
107
|
+
};
|
108
|
+
}
|
109
|
+
|
110
|
+
function findHandler(events, handler, delegationSelector = null) {
|
111
|
+
const uidEventList = Object.keys(events);
|
112
|
+
|
113
|
+
for (let i = 0, len = uidEventList.length; i < len; i++) {
|
114
|
+
const event = events[uidEventList[i]];
|
115
|
+
|
116
|
+
if (event.originalHandler === handler && event.delegationSelector === delegationSelector) {
|
117
|
+
return event;
|
118
|
+
}
|
119
|
+
}
|
120
|
+
|
121
|
+
return null;
|
122
|
+
}
|
123
|
+
|
124
|
+
function normalizeParams(originalTypeEvent, handler, delegationFn) {
|
125
|
+
const delegation = typeof handler === 'string';
|
126
|
+
const originalHandler = delegation ? delegationFn : handler;
|
127
|
+
let typeEvent = getTypeEvent(originalTypeEvent);
|
128
|
+
const isNative = nativeEvents.has(typeEvent);
|
129
|
+
|
130
|
+
if (!isNative) {
|
131
|
+
typeEvent = originalTypeEvent;
|
132
|
+
}
|
133
|
+
|
134
|
+
return [delegation, originalHandler, typeEvent];
|
135
|
+
}
|
136
|
+
|
137
|
+
function addHandler(element, originalTypeEvent, handler, delegationFn, oneOff) {
|
138
|
+
if (typeof originalTypeEvent !== 'string' || !element) {
|
139
|
+
return;
|
140
|
+
}
|
141
|
+
|
142
|
+
if (!handler) {
|
143
|
+
handler = delegationFn;
|
144
|
+
delegationFn = null;
|
145
|
+
} // in case of mouseenter or mouseleave wrap the handler within a function that checks for its DOM position
|
146
|
+
// this prevents the handler from being dispatched the same way as mouseover or mouseout does
|
147
|
+
|
148
|
+
|
149
|
+
if (customEventsRegex.test(originalTypeEvent)) {
|
150
|
+
const wrapFn = fn => {
|
151
|
+
return function (event) {
|
152
|
+
if (!event.relatedTarget || event.relatedTarget !== event.delegateTarget && !event.delegateTarget.contains(event.relatedTarget)) {
|
153
|
+
return fn.call(this, event);
|
154
|
+
}
|
155
|
+
};
|
156
|
+
};
|
157
|
+
|
158
|
+
if (delegationFn) {
|
159
|
+
delegationFn = wrapFn(delegationFn);
|
160
|
+
} else {
|
161
|
+
handler = wrapFn(handler);
|
162
|
+
}
|
163
|
+
}
|
164
|
+
|
165
|
+
const [delegation, originalHandler, typeEvent] = normalizeParams(originalTypeEvent, handler, delegationFn);
|
166
|
+
const events = getEvent(element);
|
167
|
+
const handlers = events[typeEvent] || (events[typeEvent] = {});
|
168
|
+
const previousFn = findHandler(handlers, originalHandler, delegation ? handler : null);
|
169
|
+
|
170
|
+
if (previousFn) {
|
171
|
+
previousFn.oneOff = previousFn.oneOff && oneOff;
|
172
|
+
return;
|
173
|
+
}
|
174
|
+
|
175
|
+
const uid = getUidEvent(originalHandler, originalTypeEvent.replace(namespaceRegex, ''));
|
176
|
+
const fn = delegation ? bootstrapDelegationHandler(element, handler, delegationFn) : bootstrapHandler(element, handler);
|
177
|
+
fn.delegationSelector = delegation ? handler : null;
|
178
|
+
fn.originalHandler = originalHandler;
|
179
|
+
fn.oneOff = oneOff;
|
180
|
+
fn.uidEvent = uid;
|
181
|
+
handlers[uid] = fn;
|
182
|
+
element.addEventListener(typeEvent, fn, delegation);
|
183
|
+
}
|
184
|
+
|
185
|
+
function removeHandler(element, events, typeEvent, handler, delegationSelector) {
|
186
|
+
const fn = findHandler(events[typeEvent], handler, delegationSelector);
|
187
|
+
|
188
|
+
if (!fn) {
|
189
|
+
return;
|
190
|
+
}
|
191
|
+
|
192
|
+
element.removeEventListener(typeEvent, fn, Boolean(delegationSelector));
|
193
|
+
delete events[typeEvent][fn.uidEvent];
|
194
|
+
}
|
195
|
+
|
196
|
+
function removeNamespacedHandlers(element, events, typeEvent, namespace) {
|
197
|
+
const storeElementEvent = events[typeEvent] || {};
|
198
|
+
Object.keys(storeElementEvent).forEach(handlerKey => {
|
199
|
+
if (handlerKey.includes(namespace)) {
|
200
|
+
const event = storeElementEvent[handlerKey];
|
201
|
+
removeHandler(element, events, typeEvent, event.originalHandler, event.delegationSelector);
|
202
|
+
}
|
203
|
+
});
|
204
|
+
}
|
205
|
+
|
206
|
+
function getTypeEvent(event) {
|
207
|
+
// allow to get the native events from namespaced events ('click.bs.button' --> 'click')
|
208
|
+
event = event.replace(stripNameRegex, '');
|
209
|
+
return customEvents[event] || event;
|
210
|
+
}
|
211
|
+
|
212
|
+
const EventHandler = {
|
213
|
+
on(element, event, handler, delegationFn) {
|
214
|
+
addHandler(element, event, handler, delegationFn, false);
|
215
|
+
},
|
216
|
+
|
217
|
+
one(element, event, handler, delegationFn) {
|
218
|
+
addHandler(element, event, handler, delegationFn, true);
|
219
|
+
},
|
220
|
+
|
221
|
+
off(element, originalTypeEvent, handler, delegationFn) {
|
222
|
+
if (typeof originalTypeEvent !== 'string' || !element) {
|
223
|
+
return;
|
224
|
+
}
|
225
|
+
|
226
|
+
const [delegation, originalHandler, typeEvent] = normalizeParams(originalTypeEvent, handler, delegationFn);
|
227
|
+
const inNamespace = typeEvent !== originalTypeEvent;
|
228
|
+
const events = getEvent(element);
|
229
|
+
const isNamespace = originalTypeEvent.startsWith('.');
|
230
|
+
|
231
|
+
if (typeof originalHandler !== 'undefined') {
|
232
|
+
// Simplest case: handler is passed, remove that listener ONLY.
|
233
|
+
if (!events || !events[typeEvent]) {
|
234
|
+
return;
|
235
|
+
}
|
236
|
+
|
237
|
+
removeHandler(element, events, typeEvent, originalHandler, delegation ? handler : null);
|
238
|
+
return;
|
239
|
+
}
|
240
|
+
|
241
|
+
if (isNamespace) {
|
242
|
+
Object.keys(events).forEach(elementEvent => {
|
243
|
+
removeNamespacedHandlers(element, events, elementEvent, originalTypeEvent.slice(1));
|
244
|
+
});
|
245
|
+
}
|
246
|
+
|
247
|
+
const storeElementEvent = events[typeEvent] || {};
|
248
|
+
Object.keys(storeElementEvent).forEach(keyHandlers => {
|
249
|
+
const handlerKey = keyHandlers.replace(stripUidRegex, '');
|
250
|
+
|
251
|
+
if (!inNamespace || originalTypeEvent.includes(handlerKey)) {
|
252
|
+
const event = storeElementEvent[keyHandlers];
|
253
|
+
removeHandler(element, events, typeEvent, event.originalHandler, event.delegationSelector);
|
254
|
+
}
|
255
|
+
});
|
256
|
+
},
|
257
|
+
|
258
|
+
trigger(element, event, args) {
|
259
|
+
if (typeof event !== 'string' || !element) {
|
260
|
+
return null;
|
261
|
+
}
|
262
|
+
|
263
|
+
const $ = getjQuery();
|
264
|
+
const typeEvent = getTypeEvent(event);
|
265
|
+
const inNamespace = event !== typeEvent;
|
266
|
+
const isNative = nativeEvents.has(typeEvent);
|
267
|
+
let jQueryEvent;
|
268
|
+
let bubbles = true;
|
269
|
+
let nativeDispatch = true;
|
270
|
+
let defaultPrevented = false;
|
271
|
+
let evt = null;
|
272
|
+
|
273
|
+
if (inNamespace && $) {
|
274
|
+
jQueryEvent = $.Event(event, args);
|
275
|
+
$(element).trigger(jQueryEvent);
|
276
|
+
bubbles = !jQueryEvent.isPropagationStopped();
|
277
|
+
nativeDispatch = !jQueryEvent.isImmediatePropagationStopped();
|
278
|
+
defaultPrevented = jQueryEvent.isDefaultPrevented();
|
279
|
+
}
|
280
|
+
|
281
|
+
if (isNative) {
|
282
|
+
evt = document.createEvent('HTMLEvents');
|
283
|
+
evt.initEvent(typeEvent, bubbles, true);
|
284
|
+
} else {
|
285
|
+
evt = new CustomEvent(event, {
|
286
|
+
bubbles,
|
287
|
+
cancelable: true
|
288
|
+
});
|
289
|
+
} // merge custom information in our event
|
290
|
+
|
291
|
+
|
292
|
+
if (typeof args !== 'undefined') {
|
293
|
+
Object.keys(args).forEach(key => {
|
294
|
+
Object.defineProperty(evt, key, {
|
295
|
+
get() {
|
296
|
+
return args[key];
|
297
|
+
}
|
298
|
+
|
299
|
+
});
|
300
|
+
});
|
301
|
+
}
|
302
|
+
|
303
|
+
if (defaultPrevented) {
|
304
|
+
evt.preventDefault();
|
305
|
+
}
|
306
|
+
|
307
|
+
if (nativeDispatch) {
|
308
|
+
element.dispatchEvent(evt);
|
309
|
+
}
|
310
|
+
|
311
|
+
if (evt.defaultPrevented && typeof jQueryEvent !== 'undefined') {
|
312
|
+
jQueryEvent.preventDefault();
|
313
|
+
}
|
314
|
+
|
315
|
+
return evt;
|
316
|
+
}
|
317
|
+
|
318
|
+
};
|
319
|
+
|
320
|
+
return EventHandler;
|
321
|
+
|
322
|
+
})));
|
@@ -0,0 +1,88 @@
|
|
1
|
+
/*!
|
2
|
+
* Bootstrap manipulator.js v5.0.0 (https://getbootstrap.com/)
|
3
|
+
* Copyright 2011-2021 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 (v5.0.0): dom/manipulator.js
|
15
|
+
* Licensed under MIT (https://github.com/twbs/bootstrap/blob/main/LICENSE)
|
16
|
+
* --------------------------------------------------------------------------
|
17
|
+
*/
|
18
|
+
function normalizeData(val) {
|
19
|
+
if (val === 'true') {
|
20
|
+
return true;
|
21
|
+
}
|
22
|
+
|
23
|
+
if (val === 'false') {
|
24
|
+
return false;
|
25
|
+
}
|
26
|
+
|
27
|
+
if (val === Number(val).toString()) {
|
28
|
+
return Number(val);
|
29
|
+
}
|
30
|
+
|
31
|
+
if (val === '' || val === 'null') {
|
32
|
+
return null;
|
33
|
+
}
|
34
|
+
|
35
|
+
return val;
|
36
|
+
}
|
37
|
+
|
38
|
+
function normalizeDataKey(key) {
|
39
|
+
return key.replace(/[A-Z]/g, chr => `-${chr.toLowerCase()}`);
|
40
|
+
}
|
41
|
+
|
42
|
+
const Manipulator = {
|
43
|
+
setDataAttribute(element, key, value) {
|
44
|
+
element.setAttribute(`data-bs-${normalizeDataKey(key)}`, value);
|
45
|
+
},
|
46
|
+
|
47
|
+
removeDataAttribute(element, key) {
|
48
|
+
element.removeAttribute(`data-bs-${normalizeDataKey(key)}`);
|
49
|
+
},
|
50
|
+
|
51
|
+
getDataAttributes(element) {
|
52
|
+
if (!element) {
|
53
|
+
return {};
|
54
|
+
}
|
55
|
+
|
56
|
+
const attributes = {};
|
57
|
+
Object.keys(element.dataset).filter(key => key.startsWith('bs')).forEach(key => {
|
58
|
+
let pureKey = key.replace(/^bs/, '');
|
59
|
+
pureKey = pureKey.charAt(0).toLowerCase() + pureKey.slice(1, pureKey.length);
|
60
|
+
attributes[pureKey] = normalizeData(element.dataset[key]);
|
61
|
+
});
|
62
|
+
return attributes;
|
63
|
+
},
|
64
|
+
|
65
|
+
getDataAttribute(element, key) {
|
66
|
+
return normalizeData(element.getAttribute(`data-bs-${normalizeDataKey(key)}`));
|
67
|
+
},
|
68
|
+
|
69
|
+
offset(element) {
|
70
|
+
const rect = element.getBoundingClientRect();
|
71
|
+
return {
|
72
|
+
top: rect.top + document.body.scrollTop,
|
73
|
+
left: rect.left + document.body.scrollLeft
|
74
|
+
};
|
75
|
+
},
|
76
|
+
|
77
|
+
position(element) {
|
78
|
+
return {
|
79
|
+
top: element.offsetTop,
|
80
|
+
left: element.offsetLeft
|
81
|
+
};
|
82
|
+
}
|
83
|
+
|
84
|
+
};
|
85
|
+
|
86
|
+
return Manipulator;
|
87
|
+
|
88
|
+
})));
|
@@ -0,0 +1,85 @@
|
|
1
|
+
/*!
|
2
|
+
* Bootstrap selector-engine.js v5.0.0 (https://getbootstrap.com/)
|
3
|
+
* Copyright 2011-2021 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.SelectorEngine = factory());
|
10
|
+
}(this, (function () { 'use strict';
|
11
|
+
|
12
|
+
/**
|
13
|
+
* --------------------------------------------------------------------------
|
14
|
+
* Bootstrap (v5.0.0): dom/selector-engine.js
|
15
|
+
* Licensed under MIT (https://github.com/twbs/bootstrap/blob/main/LICENSE)
|
16
|
+
* --------------------------------------------------------------------------
|
17
|
+
*/
|
18
|
+
|
19
|
+
/**
|
20
|
+
* ------------------------------------------------------------------------
|
21
|
+
* Constants
|
22
|
+
* ------------------------------------------------------------------------
|
23
|
+
*/
|
24
|
+
const NODE_TEXT = 3;
|
25
|
+
const SelectorEngine = {
|
26
|
+
find(selector, element = document.documentElement) {
|
27
|
+
return [].concat(...Element.prototype.querySelectorAll.call(element, selector));
|
28
|
+
},
|
29
|
+
|
30
|
+
findOne(selector, element = document.documentElement) {
|
31
|
+
return Element.prototype.querySelector.call(element, selector);
|
32
|
+
},
|
33
|
+
|
34
|
+
children(element, selector) {
|
35
|
+
return [].concat(...element.children).filter(child => child.matches(selector));
|
36
|
+
},
|
37
|
+
|
38
|
+
parents(element, selector) {
|
39
|
+
const parents = [];
|
40
|
+
let ancestor = element.parentNode;
|
41
|
+
|
42
|
+
while (ancestor && ancestor.nodeType === Node.ELEMENT_NODE && ancestor.nodeType !== NODE_TEXT) {
|
43
|
+
if (ancestor.matches(selector)) {
|
44
|
+
parents.push(ancestor);
|
45
|
+
}
|
46
|
+
|
47
|
+
ancestor = ancestor.parentNode;
|
48
|
+
}
|
49
|
+
|
50
|
+
return parents;
|
51
|
+
},
|
52
|
+
|
53
|
+
prev(element, selector) {
|
54
|
+
let previous = element.previousElementSibling;
|
55
|
+
|
56
|
+
while (previous) {
|
57
|
+
if (previous.matches(selector)) {
|
58
|
+
return [previous];
|
59
|
+
}
|
60
|
+
|
61
|
+
previous = previous.previousElementSibling;
|
62
|
+
}
|
63
|
+
|
64
|
+
return [];
|
65
|
+
},
|
66
|
+
|
67
|
+
next(element, selector) {
|
68
|
+
let next = element.nextElementSibling;
|
69
|
+
|
70
|
+
while (next) {
|
71
|
+
if (next.matches(selector)) {
|
72
|
+
return [next];
|
73
|
+
}
|
74
|
+
|
75
|
+
next = next.nextElementSibling;
|
76
|
+
}
|
77
|
+
|
78
|
+
return [];
|
79
|
+
}
|
80
|
+
|
81
|
+
};
|
82
|
+
|
83
|
+
return SelectorEngine;
|
84
|
+
|
85
|
+
})));
|