bootstrap 4.3.0 → 5.1.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (158) hide show
  1. checksums.yaml +4 -4
  2. data/.travis.yml +17 -2
  3. data/CHANGELOG.md +2 -14
  4. data/README.md +7 -4
  5. data/assets/javascripts/bootstrap/alert.js +173 -137
  6. data/assets/javascripts/bootstrap/base-component.js +182 -0
  7. data/assets/javascripts/bootstrap/button.js +102 -143
  8. data/assets/javascripts/bootstrap/carousel.js +481 -410
  9. data/assets/javascripts/bootstrap/collapse.js +340 -274
  10. data/assets/javascripts/bootstrap/dom/data.js +68 -0
  11. data/assets/javascripts/bootstrap/dom/event-handler.js +322 -0
  12. data/assets/javascripts/bootstrap/dom/manipulator.js +88 -0
  13. data/assets/javascripts/bootstrap/dom/selector-engine.js +127 -0
  14. data/assets/javascripts/bootstrap/dropdown.js +494 -400
  15. data/assets/javascripts/bootstrap/modal.js +834 -450
  16. data/assets/javascripts/bootstrap/offcanvas.js +866 -0
  17. data/assets/javascripts/bootstrap/popover.js +122 -199
  18. data/assets/javascripts/bootstrap/scrollspy.js +257 -241
  19. data/assets/javascripts/bootstrap/tab.js +219 -155
  20. data/assets/javascripts/bootstrap/toast.js +330 -190
  21. data/assets/javascripts/bootstrap/tooltip.js +710 -472
  22. data/assets/javascripts/bootstrap-global-this-define.js +6 -0
  23. data/assets/javascripts/bootstrap-global-this-undefine.js +2 -0
  24. data/assets/javascripts/bootstrap-sprockets.js +8 -1
  25. data/assets/javascripts/bootstrap.js +3547 -2809
  26. data/assets/javascripts/bootstrap.min.js +4 -4
  27. data/assets/stylesheets/_bootstrap-grid.scss +54 -18
  28. data/assets/stylesheets/_bootstrap-reboot.scss +7 -4
  29. data/assets/stylesheets/_bootstrap.scss +20 -11
  30. data/assets/stylesheets/bootstrap/_accordion.scss +118 -0
  31. data/assets/stylesheets/bootstrap/_alert.scss +15 -9
  32. data/assets/stylesheets/bootstrap/_badge.scss +2 -27
  33. data/assets/stylesheets/bootstrap/_breadcrumb.scss +5 -18
  34. data/assets/stylesheets/bootstrap/_button-group.scss +21 -45
  35. data/assets/stylesheets/bootstrap/_buttons.scss +28 -54
  36. data/assets/stylesheets/bootstrap/_card.scss +52 -125
  37. data/assets/stylesheets/bootstrap/_carousel.scss +70 -38
  38. data/assets/stylesheets/bootstrap/_close.scss +30 -31
  39. data/assets/stylesheets/bootstrap/_containers.scss +41 -0
  40. data/assets/stylesheets/bootstrap/_dropdown.scss +88 -39
  41. data/assets/stylesheets/bootstrap/_forms.scss +9 -330
  42. data/assets/stylesheets/bootstrap/_functions.scss +237 -27
  43. data/assets/stylesheets/bootstrap/_grid.scss +14 -33
  44. data/assets/stylesheets/bootstrap/_helpers.scss +9 -0
  45. data/assets/stylesheets/bootstrap/_images.scss +3 -3
  46. data/assets/stylesheets/bootstrap/_list-group.scss +61 -36
  47. data/assets/stylesheets/bootstrap/_mixins.scss +12 -16
  48. data/assets/stylesheets/bootstrap/_modal.scss +64 -84
  49. data/assets/stylesheets/bootstrap/_nav.scss +29 -10
  50. data/assets/stylesheets/bootstrap/_navbar.scss +93 -52
  51. data/assets/stylesheets/bootstrap/_offcanvas.scss +83 -0
  52. data/assets/stylesheets/bootstrap/_pagination.scss +13 -22
  53. data/assets/stylesheets/bootstrap/_placeholders.scss +51 -0
  54. data/assets/stylesheets/bootstrap/_popover.scss +29 -42
  55. data/assets/stylesheets/bootstrap/_progress.scss +10 -5
  56. data/assets/stylesheets/bootstrap/_reboot.scss +350 -208
  57. data/assets/stylesheets/bootstrap/_root.scss +42 -8
  58. data/assets/stylesheets/bootstrap/_spinners.scss +21 -7
  59. data/assets/stylesheets/bootstrap/_tables.scss +80 -114
  60. data/assets/stylesheets/bootstrap/_toasts.scss +21 -14
  61. data/assets/stylesheets/bootstrap/_tooltip.scss +21 -21
  62. data/assets/stylesheets/bootstrap/_transitions.scss +8 -1
  63. data/assets/stylesheets/bootstrap/_type.scss +40 -61
  64. data/assets/stylesheets/bootstrap/_utilities.scss +630 -17
  65. data/assets/stylesheets/bootstrap/_variables.scss +993 -487
  66. data/assets/stylesheets/bootstrap/bootstrap-utilities.scss +18 -0
  67. data/assets/stylesheets/bootstrap/forms/_floating-labels.scss +63 -0
  68. data/assets/stylesheets/bootstrap/forms/_form-check.scss +152 -0
  69. data/assets/stylesheets/bootstrap/forms/_form-control.scss +219 -0
  70. data/assets/stylesheets/bootstrap/forms/_form-range.scss +91 -0
  71. data/assets/stylesheets/bootstrap/forms/_form-select.scss +70 -0
  72. data/assets/stylesheets/bootstrap/forms/_form-text.scss +11 -0
  73. data/assets/stylesheets/bootstrap/forms/_input-group.scss +121 -0
  74. data/assets/stylesheets/bootstrap/forms/_labels.scss +36 -0
  75. data/assets/stylesheets/bootstrap/forms/_validation.scss +12 -0
  76. data/assets/stylesheets/bootstrap/{utilities → helpers}/_clearfix.scss +0 -0
  77. data/assets/stylesheets/bootstrap/helpers/_colored-links.scss +12 -0
  78. data/assets/stylesheets/bootstrap/helpers/_position.scss +30 -0
  79. data/assets/stylesheets/bootstrap/helpers/_ratio.scss +26 -0
  80. data/assets/stylesheets/bootstrap/helpers/_stacks.scss +15 -0
  81. data/assets/stylesheets/bootstrap/helpers/_stretched-link.scss +15 -0
  82. data/assets/stylesheets/bootstrap/helpers/_text-truncation.scss +7 -0
  83. data/assets/stylesheets/bootstrap/helpers/_visually-hidden.scss +8 -0
  84. data/assets/stylesheets/bootstrap/helpers/_vr.scss +8 -0
  85. data/assets/stylesheets/bootstrap/mixins/_alert.scss +3 -5
  86. data/assets/stylesheets/bootstrap/mixins/_backdrop.scss +14 -0
  87. data/assets/stylesheets/bootstrap/mixins/_border-radius.scss +37 -22
  88. data/assets/stylesheets/bootstrap/mixins/_box-shadow.scss +7 -9
  89. data/assets/stylesheets/bootstrap/mixins/_breakpoints.scss +14 -10
  90. data/assets/stylesheets/bootstrap/mixins/_buttons.scss +77 -51
  91. data/assets/stylesheets/bootstrap/mixins/_caret.scss +10 -8
  92. data/assets/stylesheets/bootstrap/mixins/_clearfix.scss +2 -0
  93. data/assets/stylesheets/bootstrap/mixins/_color-scheme.scss +7 -0
  94. data/assets/stylesheets/bootstrap/mixins/_container.scss +9 -0
  95. data/assets/stylesheets/bootstrap/mixins/_forms.scss +67 -115
  96. data/assets/stylesheets/bootstrap/mixins/_gradients.scss +13 -11
  97. data/assets/stylesheets/bootstrap/mixins/_grid.scss +131 -32
  98. data/assets/stylesheets/bootstrap/mixins/_image.scss +0 -20
  99. data/assets/stylesheets/bootstrap/mixins/_list-group.scss +5 -2
  100. data/assets/stylesheets/bootstrap/mixins/_pagination.scss +17 -8
  101. data/assets/stylesheets/bootstrap/mixins/_reset-text.scss +1 -1
  102. data/assets/stylesheets/bootstrap/mixins/_table-variants.scss +21 -0
  103. data/assets/stylesheets/bootstrap/mixins/_transition.scss +18 -8
  104. data/assets/stylesheets/bootstrap/mixins/_utilities.scss +89 -0
  105. data/assets/stylesheets/bootstrap/mixins/_visually-hidden.scss +29 -0
  106. data/assets/stylesheets/bootstrap/utilities/_api.scss +47 -0
  107. data/assets/stylesheets/bootstrap/vendor/_rfs.scss +274 -132
  108. data/bootstrap.gemspec +4 -6
  109. data/lib/bootstrap/version.rb +2 -2
  110. data/tasks/updater/js.rb +25 -6
  111. data/tasks/updater/network.rb +8 -2
  112. data/test/dummy_rails/app/assets/config/manifest.js +3 -0
  113. data/test/dummy_rails/app/assets/javascripts/application.js +4 -3
  114. data/test/dummy_rails/app/assets/stylesheets/.browserslistrc +1 -0
  115. data/test/dummy_rails/app/views/layouts/application.html.erb +3 -1
  116. data/test/dummy_rails/app/views/pages/root.html +89 -0
  117. data/test/dummy_rails/config/application.rb +0 -3
  118. data/test/gemfiles/rails_6_0.gemfile +7 -0
  119. data/test/gemfiles/rails_6_1.gemfile +7 -0
  120. data/test/support/dummy_rails_integration.rb +3 -1
  121. data/test/test_helper.rb +18 -13
  122. metadata +61 -79
  123. data/assets/javascripts/bootstrap/util.js +0 -171
  124. data/assets/stylesheets/bootstrap/_code.scss +0 -48
  125. data/assets/stylesheets/bootstrap/_custom-forms.scss +0 -507
  126. data/assets/stylesheets/bootstrap/_input-group.scss +0 -193
  127. data/assets/stylesheets/bootstrap/_jumbotron.scss +0 -17
  128. data/assets/stylesheets/bootstrap/_media.scss +0 -8
  129. data/assets/stylesheets/bootstrap/_print.scss +0 -141
  130. data/assets/stylesheets/bootstrap/mixins/_background-variant.scss +0 -21
  131. data/assets/stylesheets/bootstrap/mixins/_badge.scss +0 -17
  132. data/assets/stylesheets/bootstrap/mixins/_float.scss +0 -14
  133. data/assets/stylesheets/bootstrap/mixins/_grid-framework.scss +0 -66
  134. data/assets/stylesheets/bootstrap/mixins/_hover.scss +0 -37
  135. data/assets/stylesheets/bootstrap/mixins/_nav-divider.scss +0 -10
  136. data/assets/stylesheets/bootstrap/mixins/_screen-reader.scss +0 -33
  137. data/assets/stylesheets/bootstrap/mixins/_size.scss +0 -7
  138. data/assets/stylesheets/bootstrap/mixins/_table-row.scss +0 -39
  139. data/assets/stylesheets/bootstrap/mixins/_text-emphasis.scss +0 -16
  140. data/assets/stylesheets/bootstrap/mixins/_text-hide.scss +0 -11
  141. data/assets/stylesheets/bootstrap/mixins/_visibility.scss +0 -8
  142. data/assets/stylesheets/bootstrap/utilities/_align.scss +0 -8
  143. data/assets/stylesheets/bootstrap/utilities/_background.scss +0 -19
  144. data/assets/stylesheets/bootstrap/utilities/_borders.scss +0 -75
  145. data/assets/stylesheets/bootstrap/utilities/_display.scss +0 -26
  146. data/assets/stylesheets/bootstrap/utilities/_embed.scss +0 -39
  147. data/assets/stylesheets/bootstrap/utilities/_flex.scss +0 -51
  148. data/assets/stylesheets/bootstrap/utilities/_float.scss +0 -11
  149. data/assets/stylesheets/bootstrap/utilities/_overflow.scss +0 -5
  150. data/assets/stylesheets/bootstrap/utilities/_position.scss +0 -32
  151. data/assets/stylesheets/bootstrap/utilities/_screenreaders.scss +0 -11
  152. data/assets/stylesheets/bootstrap/utilities/_shadows.scss +0 -6
  153. data/assets/stylesheets/bootstrap/utilities/_sizing.scss +0 -20
  154. data/assets/stylesheets/bootstrap/utilities/_spacing.scss +0 -73
  155. data/assets/stylesheets/bootstrap/utilities/_stretched-link.scss +0 -19
  156. data/assets/stylesheets/bootstrap/utilities/_text.scss +0 -72
  157. data/assets/stylesheets/bootstrap/utilities/_visibility.scss +0 -13
  158. data/test/dummy_rails/app/views/pages/root.html.slim +0 -58
@@ -0,0 +1,68 @@
1
+ /*!
2
+ * Bootstrap data.js v5.1.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.1.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.1.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.1.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.1.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.1.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.1.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 + window.pageYOffset,
73
+ left: rect.left + window.pageXOffset
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
+ })));