administrate-bootstrap-theme 0.1.9 → 1.0.1

Sign up to get free protection for your applications and to get access to all the features.
Files changed (136) hide show
  1. checksums.yaml +4 -4
  2. data/README.md +72 -31
  3. data/app/assets/javascripts/administrate-bootstrap-theme/bootstrap.bundle.js +6780 -0
  4. data/app/assets/stylesheets/administrate-bootstrap-theme/_base.scss +2 -10
  5. data/app/assets/stylesheets/administrate-bootstrap-theme/_variables.scss +8 -1
  6. data/{node_modules/bootstrap/scss → app/assets/stylesheets/administrate-bootstrap-theme/bootstrap}/_accordion.scss +4 -2
  7. data/{node_modules/bootstrap/scss → app/assets/stylesheets/administrate-bootstrap-theme/bootstrap}/_alert.scss +0 -0
  8. data/{node_modules/bootstrap/scss → app/assets/stylesheets/administrate-bootstrap-theme/bootstrap}/_badge.scss +0 -0
  9. data/{node_modules/bootstrap/scss → app/assets/stylesheets/administrate-bootstrap-theme/bootstrap}/_breadcrumb.scss +0 -0
  10. data/{node_modules/bootstrap/scss → app/assets/stylesheets/administrate-bootstrap-theme/bootstrap}/_button-group.scss +0 -0
  11. data/{node_modules/bootstrap/scss → app/assets/stylesheets/administrate-bootstrap-theme/bootstrap}/_buttons.scss +0 -0
  12. data/{node_modules/bootstrap/scss → app/assets/stylesheets/administrate-bootstrap-theme/bootstrap}/_card.scss +7 -6
  13. data/{node_modules/bootstrap/scss → app/assets/stylesheets/administrate-bootstrap-theme/bootstrap}/_carousel.scss +2 -2
  14. data/{node_modules/bootstrap/scss → app/assets/stylesheets/administrate-bootstrap-theme/bootstrap}/_close.scss +0 -0
  15. data/{node_modules/bootstrap/scss → app/assets/stylesheets/administrate-bootstrap-theme/bootstrap}/_containers.scss +0 -0
  16. data/{node_modules/bootstrap/scss → app/assets/stylesheets/administrate-bootstrap-theme/bootstrap}/_dropdown.scss +11 -17
  17. data/{node_modules/bootstrap/scss → app/assets/stylesheets/administrate-bootstrap-theme/bootstrap}/_forms.scss +0 -0
  18. data/{node_modules/bootstrap/scss → app/assets/stylesheets/administrate-bootstrap-theme/bootstrap}/_functions.scss +94 -3
  19. data/app/assets/stylesheets/administrate-bootstrap-theme/bootstrap/_grid.scss +33 -0
  20. data/{node_modules/bootstrap/scss → app/assets/stylesheets/administrate-bootstrap-theme/bootstrap}/_helpers.scss +2 -0
  21. data/{node_modules/bootstrap/scss → app/assets/stylesheets/administrate-bootstrap-theme/bootstrap}/_images.scss +1 -1
  22. data/{node_modules/bootstrap/scss → app/assets/stylesheets/administrate-bootstrap-theme/bootstrap}/_list-group.scss +5 -5
  23. data/{node_modules/bootstrap/scss → app/assets/stylesheets/administrate-bootstrap-theme/bootstrap}/_mixins.scss +2 -0
  24. data/{node_modules/bootstrap/scss → app/assets/stylesheets/administrate-bootstrap-theme/bootstrap}/_modal.scss +7 -35
  25. data/{node_modules/bootstrap/scss → app/assets/stylesheets/administrate-bootstrap-theme/bootstrap}/_nav.scss +0 -0
  26. data/{node_modules/bootstrap/scss → app/assets/stylesheets/administrate-bootstrap-theme/bootstrap}/_navbar.scss +30 -1
  27. data/{node_modules/bootstrap/scss → app/assets/stylesheets/administrate-bootstrap-theme/bootstrap}/_offcanvas.scss +19 -13
  28. data/{node_modules/bootstrap/scss → app/assets/stylesheets/administrate-bootstrap-theme/bootstrap}/_pagination.scss +0 -0
  29. data/app/assets/stylesheets/administrate-bootstrap-theme/bootstrap/_placeholders.scss +51 -0
  30. data/{node_modules/bootstrap/scss → app/assets/stylesheets/administrate-bootstrap-theme/bootstrap}/_popover.scss +10 -10
  31. data/{node_modules/bootstrap/scss → app/assets/stylesheets/administrate-bootstrap-theme/bootstrap}/_progress.scss +0 -0
  32. data/{node_modules/bootstrap/scss → app/assets/stylesheets/administrate-bootstrap-theme/bootstrap}/_reboot.scss +12 -8
  33. data/app/assets/stylesheets/administrate-bootstrap-theme/bootstrap/_root.scss +53 -0
  34. data/{node_modules/bootstrap/scss → app/assets/stylesheets/administrate-bootstrap-theme/bootstrap}/_spinners.scss +2 -2
  35. data/{node_modules/bootstrap/scss → app/assets/stylesheets/administrate-bootstrap-theme/bootstrap}/_tables.scss +1 -0
  36. data/{node_modules/bootstrap/scss → app/assets/stylesheets/administrate-bootstrap-theme/bootstrap}/_toasts.scss +3 -3
  37. data/{node_modules/bootstrap/scss → app/assets/stylesheets/administrate-bootstrap-theme/bootstrap}/_tooltip.scss +4 -4
  38. data/{node_modules/bootstrap/scss → app/assets/stylesheets/administrate-bootstrap-theme/bootstrap}/_transitions.scss +6 -0
  39. data/{node_modules/bootstrap/scss → app/assets/stylesheets/administrate-bootstrap-theme/bootstrap}/_type.scss +0 -0
  40. data/{node_modules/bootstrap/scss → app/assets/stylesheets/administrate-bootstrap-theme/bootstrap}/_utilities.scss +44 -8
  41. data/{node_modules/bootstrap/scss → app/assets/stylesheets/administrate-bootstrap-theme/bootstrap}/_variables.scss +193 -28
  42. data/{node_modules/bootstrap/scss → app/assets/stylesheets/administrate-bootstrap-theme/bootstrap}/bootstrap-grid.scss +1 -1
  43. data/{node_modules/bootstrap/scss → app/assets/stylesheets/administrate-bootstrap-theme/bootstrap}/bootstrap-reboot.scss +1 -1
  44. data/{node_modules/bootstrap/scss → app/assets/stylesheets/administrate-bootstrap-theme/bootstrap}/bootstrap-utilities.scss +1 -1
  45. data/{node_modules/bootstrap/scss → app/assets/stylesheets/administrate-bootstrap-theme/bootstrap}/bootstrap.scss +2 -1
  46. data/{node_modules/bootstrap/scss → app/assets/stylesheets/administrate-bootstrap-theme/bootstrap}/forms/_floating-labels.scss +3 -1
  47. data/{node_modules/bootstrap/scss → app/assets/stylesheets/administrate-bootstrap-theme/bootstrap}/forms/_form-check.scss +1 -1
  48. data/{node_modules/bootstrap/scss → app/assets/stylesheets/administrate-bootstrap-theme/bootstrap}/forms/_form-control.scss +1 -1
  49. data/{node_modules/bootstrap/scss → app/assets/stylesheets/administrate-bootstrap-theme/bootstrap}/forms/_form-range.scss +1 -1
  50. data/{node_modules/bootstrap/scss → app/assets/stylesheets/administrate-bootstrap-theme/bootstrap}/forms/_form-select.scss +3 -0
  51. data/{node_modules/bootstrap/scss → app/assets/stylesheets/administrate-bootstrap-theme/bootstrap}/forms/_form-text.scss +0 -0
  52. data/{node_modules/bootstrap/scss → app/assets/stylesheets/administrate-bootstrap-theme/bootstrap}/forms/_input-group.scss +0 -0
  53. data/{node_modules/bootstrap/scss → app/assets/stylesheets/administrate-bootstrap-theme/bootstrap}/forms/_labels.scss +0 -0
  54. data/{node_modules/bootstrap/scss → app/assets/stylesheets/administrate-bootstrap-theme/bootstrap}/forms/_validation.scss +0 -0
  55. data/{node_modules/bootstrap/scss → app/assets/stylesheets/administrate-bootstrap-theme/bootstrap}/helpers/_clearfix.scss +0 -0
  56. data/{node_modules/bootstrap/scss → app/assets/stylesheets/administrate-bootstrap-theme/bootstrap}/helpers/_colored-links.scss +0 -0
  57. data/{node_modules/bootstrap/scss → app/assets/stylesheets/administrate-bootstrap-theme/bootstrap}/helpers/_position.scss +0 -0
  58. data/{node_modules/bootstrap/scss → app/assets/stylesheets/administrate-bootstrap-theme/bootstrap}/helpers/_ratio.scss +0 -0
  59. data/app/assets/stylesheets/administrate-bootstrap-theme/bootstrap/helpers/_stacks.scss +15 -0
  60. data/{node_modules/bootstrap/scss → app/assets/stylesheets/administrate-bootstrap-theme/bootstrap}/helpers/_stretched-link.scss +0 -0
  61. data/{node_modules/bootstrap/scss → app/assets/stylesheets/administrate-bootstrap-theme/bootstrap}/helpers/_text-truncation.scss +0 -0
  62. data/{node_modules/bootstrap/scss → app/assets/stylesheets/administrate-bootstrap-theme/bootstrap}/helpers/_visually-hidden.scss +0 -0
  63. data/app/assets/stylesheets/administrate-bootstrap-theme/bootstrap/helpers/_vr.scss +8 -0
  64. data/{node_modules/bootstrap/scss → app/assets/stylesheets/administrate-bootstrap-theme/bootstrap}/mixins/_alert.scss +0 -0
  65. data/app/assets/stylesheets/administrate-bootstrap-theme/bootstrap/mixins/_backdrop.scss +14 -0
  66. data/{node_modules/bootstrap/scss → app/assets/stylesheets/administrate-bootstrap-theme/bootstrap}/mixins/_border-radius.scss +0 -0
  67. data/{node_modules/bootstrap/scss → app/assets/stylesheets/administrate-bootstrap-theme/bootstrap}/mixins/_box-shadow.scss +0 -0
  68. data/{node_modules/bootstrap/scss → app/assets/stylesheets/administrate-bootstrap-theme/bootstrap}/mixins/_breakpoints.scss +0 -0
  69. data/{node_modules/bootstrap/scss → app/assets/stylesheets/administrate-bootstrap-theme/bootstrap}/mixins/_buttons.scss +1 -1
  70. data/{node_modules/bootstrap/scss → app/assets/stylesheets/administrate-bootstrap-theme/bootstrap}/mixins/_caret.scss +0 -0
  71. data/{node_modules/bootstrap/scss → app/assets/stylesheets/administrate-bootstrap-theme/bootstrap}/mixins/_clearfix.scss +0 -0
  72. data/app/assets/stylesheets/administrate-bootstrap-theme/bootstrap/mixins/_color-scheme.scss +7 -0
  73. data/{node_modules/bootstrap/scss → app/assets/stylesheets/administrate-bootstrap-theme/bootstrap}/mixins/_container.scss +0 -0
  74. data/{node_modules/bootstrap/scss → app/assets/stylesheets/administrate-bootstrap-theme/bootstrap}/mixins/_deprecate.scss +0 -0
  75. data/{node_modules/bootstrap/scss → app/assets/stylesheets/administrate-bootstrap-theme/bootstrap}/mixins/_forms.scss +15 -5
  76. data/{node_modules/bootstrap/scss → app/assets/stylesheets/administrate-bootstrap-theme/bootstrap}/mixins/_gradients.scss +0 -0
  77. data/{node_modules/bootstrap/scss → app/assets/stylesheets/administrate-bootstrap-theme/bootstrap}/mixins/_grid.scss +40 -10
  78. data/{node_modules/bootstrap/scss → app/assets/stylesheets/administrate-bootstrap-theme/bootstrap}/mixins/_image.scss +0 -0
  79. data/{node_modules/bootstrap/scss → app/assets/stylesheets/administrate-bootstrap-theme/bootstrap}/mixins/_list-group.scss +0 -0
  80. data/{node_modules/bootstrap/scss → app/assets/stylesheets/administrate-bootstrap-theme/bootstrap}/mixins/_lists.scss +0 -0
  81. data/{node_modules/bootstrap/scss → app/assets/stylesheets/administrate-bootstrap-theme/bootstrap}/mixins/_pagination.scss +0 -0
  82. data/{node_modules/bootstrap/scss → app/assets/stylesheets/administrate-bootstrap-theme/bootstrap}/mixins/_reset-text.scss +0 -0
  83. data/{node_modules/bootstrap/scss → app/assets/stylesheets/administrate-bootstrap-theme/bootstrap}/mixins/_resize.scss +0 -0
  84. data/{node_modules/bootstrap/scss → app/assets/stylesheets/administrate-bootstrap-theme/bootstrap}/mixins/_table-variants.scss +0 -0
  85. data/{node_modules/bootstrap/scss → app/assets/stylesheets/administrate-bootstrap-theme/bootstrap}/mixins/_text-truncate.scss +0 -0
  86. data/{node_modules/bootstrap/scss → app/assets/stylesheets/administrate-bootstrap-theme/bootstrap}/mixins/_transition.scss +0 -0
  87. data/{node_modules/bootstrap/scss → app/assets/stylesheets/administrate-bootstrap-theme/bootstrap}/mixins/_utilities.scss +27 -6
  88. data/{node_modules/bootstrap/scss → app/assets/stylesheets/administrate-bootstrap-theme/bootstrap}/mixins/_visually-hidden.scss +0 -0
  89. data/{node_modules/bootstrap/scss → app/assets/stylesheets/administrate-bootstrap-theme/bootstrap}/utilities/_api.scss +0 -0
  90. data/{node_modules/bootstrap/scss → app/assets/stylesheets/administrate-bootstrap-theme/bootstrap}/vendor/_rfs.scss +55 -13
  91. data/app/assets/stylesheets/administrate-bootstrap-theme/colors/_autumn.scss +8 -0
  92. data/app/assets/stylesheets/administrate-bootstrap-theme/colors/_default.scss +8 -0
  93. data/app/assets/stylesheets/administrate-bootstrap-theme/colors/_forest.scss +9 -0
  94. data/app/assets/stylesheets/administrate-bootstrap-theme/colors/_industrial.scss +8 -0
  95. data/app/assets/stylesheets/administrate-bootstrap-theme/colors/_water.scss +8 -0
  96. data/app/assets/stylesheets/administrate-bootstrap-theme/components/_content_body.scss +21 -1
  97. data/app/assets/stylesheets/administrate-bootstrap-theme/components/_content_header.scss +1 -1
  98. data/app/assets/stylesheets/administrate-bootstrap-theme/components/_form.scss +2 -0
  99. data/app/assets/stylesheets/administrate-bootstrap-theme/components/_navigation.scss +22 -3
  100. data/app/assets/stylesheets/administrate-bootstrap-theme/components/_pagination.scss +1 -1
  101. data/app/assets/stylesheets/administrate-bootstrap-theme/fonts/_lato.scss +5 -0
  102. data/app/assets/stylesheets/administrate-bootstrap-theme/fonts/_montserrat.scss +5 -0
  103. data/app/assets/stylesheets/administrate-bootstrap-theme/fonts/_open_sans.scss +5 -0
  104. data/app/assets/stylesheets/administrate-bootstrap-theme/fonts/_roboto.scss +5 -0
  105. data/app/assets/stylesheets/administrate-bootstrap-theme/fonts/_source_sans_pro.scss +5 -0
  106. data/app/assets/stylesheets/administrate-bootstrap-theme/theme.scss +10 -51
  107. data/lib/administrate-bootstrap-theme/engine.rb +0 -2
  108. data/lib/administrate-bootstrap-theme/version.rb +2 -1
  109. data/lib/generators/administrate_bootstrap_theme/install/USAGE +10 -0
  110. data/lib/generators/administrate_bootstrap_theme/install/install_generator.rb +33 -0
  111. data/package.json +10 -0
  112. metadata +123 -111
  113. data/Rakefile +0 -16
  114. data/app/assets/javascripts/administrate-bootstrap-theme/theme.js +0 -2
  115. data/node_modules/bootstrap/js/src/alert.js +0 -141
  116. data/node_modules/bootstrap/js/src/base-component.js +0 -46
  117. data/node_modules/bootstrap/js/src/button.js +0 -95
  118. data/node_modules/bootstrap/js/src/carousel.js +0 -624
  119. data/node_modules/bootstrap/js/src/collapse.js +0 -410
  120. data/node_modules/bootstrap/js/src/dom/data.js +0 -57
  121. data/node_modules/bootstrap/js/src/dom/event-handler.js +0 -331
  122. data/node_modules/bootstrap/js/src/dom/manipulator.js +0 -80
  123. data/node_modules/bootstrap/js/src/dom/selector-engine.js +0 -75
  124. data/node_modules/bootstrap/js/src/dropdown.js +0 -543
  125. data/node_modules/bootstrap/js/src/modal.js +0 -582
  126. data/node_modules/bootstrap/js/src/offcanvas.js +0 -279
  127. data/node_modules/bootstrap/js/src/popover.js +0 -171
  128. data/node_modules/bootstrap/js/src/scrollspy.js +0 -319
  129. data/node_modules/bootstrap/js/src/tab.js +0 -220
  130. data/node_modules/bootstrap/js/src/toast.js +0 -219
  131. data/node_modules/bootstrap/js/src/tooltip.js +0 -802
  132. data/node_modules/bootstrap/js/src/util/index.js +0 -253
  133. data/node_modules/bootstrap/js/src/util/sanitizer.js +0 -127
  134. data/node_modules/bootstrap/js/src/util/scrollbar.js +0 -70
  135. data/node_modules/bootstrap/scss/_grid.scss +0 -22
  136. data/node_modules/bootstrap/scss/_root.scss +0 -16
@@ -1,331 +0,0 @@
1
- /**
2
- * --------------------------------------------------------------------------
3
- * Bootstrap (v5.0.0-beta3): dom/event-handler.js
4
- * Licensed under MIT (https://github.com/twbs/bootstrap/blob/main/LICENSE)
5
- * --------------------------------------------------------------------------
6
- */
7
-
8
- import { getjQuery } from '../util/index'
9
-
10
- /**
11
- * ------------------------------------------------------------------------
12
- * Constants
13
- * ------------------------------------------------------------------------
14
- */
15
-
16
- const namespaceRegex = /[^.]*(?=\..*)\.|.*/
17
- const stripNameRegex = /\..*/
18
- const stripUidRegex = /::\d+$/
19
- const eventRegistry = {} // Events storage
20
- let uidEvent = 1
21
- const customEvents = {
22
- mouseenter: 'mouseover',
23
- mouseleave: 'mouseout'
24
- }
25
- const nativeEvents = new Set([
26
- 'click',
27
- 'dblclick',
28
- 'mouseup',
29
- 'mousedown',
30
- 'contextmenu',
31
- 'mousewheel',
32
- 'DOMMouseScroll',
33
- 'mouseover',
34
- 'mouseout',
35
- 'mousemove',
36
- 'selectstart',
37
- 'selectend',
38
- 'keydown',
39
- 'keypress',
40
- 'keyup',
41
- 'orientationchange',
42
- 'touchstart',
43
- 'touchmove',
44
- 'touchend',
45
- 'touchcancel',
46
- 'pointerdown',
47
- 'pointermove',
48
- 'pointerup',
49
- 'pointerleave',
50
- 'pointercancel',
51
- 'gesturestart',
52
- 'gesturechange',
53
- 'gestureend',
54
- 'focus',
55
- 'blur',
56
- 'change',
57
- 'reset',
58
- 'select',
59
- 'submit',
60
- 'focusin',
61
- 'focusout',
62
- 'load',
63
- 'unload',
64
- 'beforeunload',
65
- 'resize',
66
- 'move',
67
- 'DOMContentLoaded',
68
- 'readystatechange',
69
- 'error',
70
- 'abort',
71
- 'scroll'
72
- ])
73
-
74
- /**
75
- * ------------------------------------------------------------------------
76
- * Private methods
77
- * ------------------------------------------------------------------------
78
- */
79
-
80
- function getUidEvent(element, uid) {
81
- return (uid && `${uid}::${uidEvent++}`) || element.uidEvent || uidEvent++
82
- }
83
-
84
- function getEvent(element) {
85
- const uid = getUidEvent(element)
86
-
87
- element.uidEvent = uid
88
- eventRegistry[uid] = eventRegistry[uid] || {}
89
-
90
- return eventRegistry[uid]
91
- }
92
-
93
- function bootstrapHandler(element, fn) {
94
- return function handler(event) {
95
- event.delegateTarget = element
96
-
97
- if (handler.oneOff) {
98
- EventHandler.off(element, event.type, fn)
99
- }
100
-
101
- return fn.apply(element, [event])
102
- }
103
- }
104
-
105
- function bootstrapDelegationHandler(element, selector, fn) {
106
- return function handler(event) {
107
- const domElements = element.querySelectorAll(selector)
108
-
109
- for (let { target } = event; target && target !== this; target = target.parentNode) {
110
- for (let i = domElements.length; i--;) {
111
- if (domElements[i] === target) {
112
- event.delegateTarget = target
113
-
114
- if (handler.oneOff) {
115
- // eslint-disable-next-line unicorn/consistent-destructuring
116
- EventHandler.off(element, event.type, fn)
117
- }
118
-
119
- return fn.apply(target, [event])
120
- }
121
- }
122
- }
123
-
124
- // To please ESLint
125
- return null
126
- }
127
- }
128
-
129
- function findHandler(events, handler, delegationSelector = null) {
130
- const uidEventList = Object.keys(events)
131
-
132
- for (let i = 0, len = uidEventList.length; i < len; i++) {
133
- const event = events[uidEventList[i]]
134
-
135
- if (event.originalHandler === handler && event.delegationSelector === delegationSelector) {
136
- return event
137
- }
138
- }
139
-
140
- return null
141
- }
142
-
143
- function normalizeParams(originalTypeEvent, handler, delegationFn) {
144
- const delegation = typeof handler === 'string'
145
- const originalHandler = delegation ? delegationFn : handler
146
-
147
- // allow to get the native events from namespaced events ('click.bs.button' --> 'click')
148
- let typeEvent = originalTypeEvent.replace(stripNameRegex, '')
149
- const custom = customEvents[typeEvent]
150
-
151
- if (custom) {
152
- typeEvent = custom
153
- }
154
-
155
- const isNative = nativeEvents.has(typeEvent)
156
-
157
- if (!isNative) {
158
- typeEvent = originalTypeEvent
159
- }
160
-
161
- return [delegation, originalHandler, typeEvent]
162
- }
163
-
164
- function addHandler(element, originalTypeEvent, handler, delegationFn, oneOff) {
165
- if (typeof originalTypeEvent !== 'string' || !element) {
166
- return
167
- }
168
-
169
- if (!handler) {
170
- handler = delegationFn
171
- delegationFn = null
172
- }
173
-
174
- const [delegation, originalHandler, typeEvent] = normalizeParams(originalTypeEvent, handler, delegationFn)
175
- const events = getEvent(element)
176
- const handlers = events[typeEvent] || (events[typeEvent] = {})
177
- const previousFn = findHandler(handlers, originalHandler, delegation ? handler : null)
178
-
179
- if (previousFn) {
180
- previousFn.oneOff = previousFn.oneOff && oneOff
181
-
182
- return
183
- }
184
-
185
- const uid = getUidEvent(originalHandler, originalTypeEvent.replace(namespaceRegex, ''))
186
- const fn = delegation ?
187
- bootstrapDelegationHandler(element, handler, delegationFn) :
188
- bootstrapHandler(element, handler)
189
-
190
- fn.delegationSelector = delegation ? handler : null
191
- fn.originalHandler = originalHandler
192
- fn.oneOff = oneOff
193
- fn.uidEvent = uid
194
- handlers[uid] = fn
195
-
196
- element.addEventListener(typeEvent, fn, delegation)
197
- }
198
-
199
- function removeHandler(element, events, typeEvent, handler, delegationSelector) {
200
- const fn = findHandler(events[typeEvent], handler, delegationSelector)
201
-
202
- if (!fn) {
203
- return
204
- }
205
-
206
- element.removeEventListener(typeEvent, fn, Boolean(delegationSelector))
207
- delete events[typeEvent][fn.uidEvent]
208
- }
209
-
210
- function removeNamespacedHandlers(element, events, typeEvent, namespace) {
211
- const storeElementEvent = events[typeEvent] || {}
212
-
213
- Object.keys(storeElementEvent).forEach(handlerKey => {
214
- if (handlerKey.includes(namespace)) {
215
- const event = storeElementEvent[handlerKey]
216
-
217
- removeHandler(element, events, typeEvent, event.originalHandler, event.delegationSelector)
218
- }
219
- })
220
- }
221
-
222
- const EventHandler = {
223
- on(element, event, handler, delegationFn) {
224
- addHandler(element, event, handler, delegationFn, false)
225
- },
226
-
227
- one(element, event, handler, delegationFn) {
228
- addHandler(element, event, handler, delegationFn, true)
229
- },
230
-
231
- off(element, originalTypeEvent, handler, delegationFn) {
232
- if (typeof originalTypeEvent !== 'string' || !element) {
233
- return
234
- }
235
-
236
- const [delegation, originalHandler, typeEvent] = normalizeParams(originalTypeEvent, handler, delegationFn)
237
- const inNamespace = typeEvent !== originalTypeEvent
238
- const events = getEvent(element)
239
- const isNamespace = originalTypeEvent.startsWith('.')
240
-
241
- if (typeof originalHandler !== 'undefined') {
242
- // Simplest case: handler is passed, remove that listener ONLY.
243
- if (!events || !events[typeEvent]) {
244
- return
245
- }
246
-
247
- removeHandler(element, events, typeEvent, originalHandler, delegation ? handler : null)
248
- return
249
- }
250
-
251
- if (isNamespace) {
252
- Object.keys(events).forEach(elementEvent => {
253
- removeNamespacedHandlers(element, events, elementEvent, originalTypeEvent.slice(1))
254
- })
255
- }
256
-
257
- const storeElementEvent = events[typeEvent] || {}
258
- Object.keys(storeElementEvent).forEach(keyHandlers => {
259
- const handlerKey = keyHandlers.replace(stripUidRegex, '')
260
-
261
- if (!inNamespace || originalTypeEvent.includes(handlerKey)) {
262
- const event = storeElementEvent[keyHandlers]
263
-
264
- removeHandler(element, events, typeEvent, event.originalHandler, event.delegationSelector)
265
- }
266
- })
267
- },
268
-
269
- trigger(element, event, args) {
270
- if (typeof event !== 'string' || !element) {
271
- return null
272
- }
273
-
274
- const $ = getjQuery()
275
- const typeEvent = event.replace(stripNameRegex, '')
276
- const inNamespace = event !== typeEvent
277
- const isNative = nativeEvents.has(typeEvent)
278
-
279
- let jQueryEvent
280
- let bubbles = true
281
- let nativeDispatch = true
282
- let defaultPrevented = false
283
- let evt = null
284
-
285
- if (inNamespace && $) {
286
- jQueryEvent = $.Event(event, args)
287
-
288
- $(element).trigger(jQueryEvent)
289
- bubbles = !jQueryEvent.isPropagationStopped()
290
- nativeDispatch = !jQueryEvent.isImmediatePropagationStopped()
291
- defaultPrevented = jQueryEvent.isDefaultPrevented()
292
- }
293
-
294
- if (isNative) {
295
- evt = document.createEvent('HTMLEvents')
296
- evt.initEvent(typeEvent, bubbles, true)
297
- } else {
298
- evt = new CustomEvent(event, {
299
- bubbles,
300
- cancelable: true
301
- })
302
- }
303
-
304
- // merge custom information in our event
305
- if (typeof args !== 'undefined') {
306
- Object.keys(args).forEach(key => {
307
- Object.defineProperty(evt, key, {
308
- get() {
309
- return args[key]
310
- }
311
- })
312
- })
313
- }
314
-
315
- if (defaultPrevented) {
316
- evt.preventDefault()
317
- }
318
-
319
- if (nativeDispatch) {
320
- element.dispatchEvent(evt)
321
- }
322
-
323
- if (evt.defaultPrevented && typeof jQueryEvent !== 'undefined') {
324
- jQueryEvent.preventDefault()
325
- }
326
-
327
- return evt
328
- }
329
- }
330
-
331
- export default EventHandler
@@ -1,80 +0,0 @@
1
- /**
2
- * --------------------------------------------------------------------------
3
- * Bootstrap (v5.0.0-beta3): dom/manipulator.js
4
- * Licensed under MIT (https://github.com/twbs/bootstrap/blob/main/LICENSE)
5
- * --------------------------------------------------------------------------
6
- */
7
-
8
- function normalizeData(val) {
9
- if (val === 'true') {
10
- return true
11
- }
12
-
13
- if (val === 'false') {
14
- return false
15
- }
16
-
17
- if (val === Number(val).toString()) {
18
- return Number(val)
19
- }
20
-
21
- if (val === '' || val === 'null') {
22
- return null
23
- }
24
-
25
- return val
26
- }
27
-
28
- function normalizeDataKey(key) {
29
- return key.replace(/[A-Z]/g, chr => `-${chr.toLowerCase()}`)
30
- }
31
-
32
- const Manipulator = {
33
- setDataAttribute(element, key, value) {
34
- element.setAttribute(`data-bs-${normalizeDataKey(key)}`, value)
35
- },
36
-
37
- removeDataAttribute(element, key) {
38
- element.removeAttribute(`data-bs-${normalizeDataKey(key)}`)
39
- },
40
-
41
- getDataAttributes(element) {
42
- if (!element) {
43
- return {}
44
- }
45
-
46
- const attributes = {}
47
-
48
- Object.keys(element.dataset)
49
- .filter(key => key.startsWith('bs'))
50
- .forEach(key => {
51
- let pureKey = key.replace(/^bs/, '')
52
- pureKey = pureKey.charAt(0).toLowerCase() + pureKey.slice(1, pureKey.length)
53
- attributes[pureKey] = normalizeData(element.dataset[key])
54
- })
55
-
56
- return attributes
57
- },
58
-
59
- getDataAttribute(element, key) {
60
- return normalizeData(element.getAttribute(`data-bs-${normalizeDataKey(key)}`))
61
- },
62
-
63
- offset(element) {
64
- const rect = element.getBoundingClientRect()
65
-
66
- return {
67
- top: rect.top + document.body.scrollTop,
68
- left: rect.left + document.body.scrollLeft
69
- }
70
- },
71
-
72
- position(element) {
73
- return {
74
- top: element.offsetTop,
75
- left: element.offsetLeft
76
- }
77
- }
78
- }
79
-
80
- export default Manipulator
@@ -1,75 +0,0 @@
1
- /**
2
- * --------------------------------------------------------------------------
3
- * Bootstrap (v5.0.0-beta3): dom/selector-engine.js
4
- * Licensed under MIT (https://github.com/twbs/bootstrap/blob/main/LICENSE)
5
- * --------------------------------------------------------------------------
6
- */
7
-
8
- /**
9
- * ------------------------------------------------------------------------
10
- * Constants
11
- * ------------------------------------------------------------------------
12
- */
13
-
14
- const NODE_TEXT = 3
15
-
16
- const SelectorEngine = {
17
- find(selector, element = document.documentElement) {
18
- return [].concat(...Element.prototype.querySelectorAll.call(element, selector))
19
- },
20
-
21
- findOne(selector, element = document.documentElement) {
22
- return Element.prototype.querySelector.call(element, selector)
23
- },
24
-
25
- children(element, selector) {
26
- return [].concat(...element.children)
27
- .filter(child => child.matches(selector))
28
- },
29
-
30
- parents(element, selector) {
31
- const parents = []
32
-
33
- let ancestor = element.parentNode
34
-
35
- while (ancestor && ancestor.nodeType === Node.ELEMENT_NODE && ancestor.nodeType !== NODE_TEXT) {
36
- if (ancestor.matches(selector)) {
37
- parents.push(ancestor)
38
- }
39
-
40
- ancestor = ancestor.parentNode
41
- }
42
-
43
- return parents
44
- },
45
-
46
- prev(element, selector) {
47
- let previous = element.previousElementSibling
48
-
49
- while (previous) {
50
- if (previous.matches(selector)) {
51
- return [previous]
52
- }
53
-
54
- previous = previous.previousElementSibling
55
- }
56
-
57
- return []
58
- },
59
-
60
- next(element, selector) {
61
- let next = element.nextElementSibling
62
-
63
- while (next) {
64
- if (next.matches(selector)) {
65
- return [next]
66
- }
67
-
68
- next = next.nextElementSibling
69
- }
70
-
71
- return []
72
- }
73
- }
74
-
75
- export default SelectorEngine