bootstrap 4.6.2.1 → 5.0.0.alpha1

Sign up to get free protection for your applications and to get access to all the features.
Files changed (140) hide show
  1. checksums.yaml +4 -4
  2. data/CHANGELOG.md +0 -4
  3. data/README.md +1 -7
  4. data/Rakefile +4 -16
  5. data/assets/javascripts/bootstrap/alert.js +148 -73
  6. data/assets/javascripts/bootstrap/button.js +71 -154
  7. data/assets/javascripts/bootstrap/carousel.js +315 -209
  8. data/assets/javascripts/bootstrap/collapse.js +307 -153
  9. data/assets/javascripts/bootstrap/dom/data.js +81 -0
  10. data/assets/javascripts/bootstrap/dom/event-handler.js +311 -0
  11. data/assets/javascripts/bootstrap/dom/manipulator.js +100 -0
  12. data/assets/javascripts/bootstrap/dom/polyfill.js +110 -0
  13. data/assets/javascripts/bootstrap/dom/selector-engine.js +98 -0
  14. data/assets/javascripts/bootstrap/dropdown.js +257 -205
  15. data/assets/javascripts/bootstrap/modal.js +354 -250
  16. data/assets/javascripts/bootstrap/popover.js +85 -94
  17. data/assets/javascripts/bootstrap/scrollspy.js +179 -107
  18. data/assets/javascripts/bootstrap/tab.js +170 -99
  19. data/assets/javascripts/bootstrap/toast.js +181 -110
  20. data/assets/javascripts/bootstrap/tooltip.js +375 -226
  21. data/assets/javascripts/bootstrap-sprockets.js +5 -1
  22. data/assets/javascripts/bootstrap.js +2260 -1550
  23. data/assets/javascripts/bootstrap.min.js +3 -3
  24. data/assets/stylesheets/_bootstrap-grid.scss +53 -18
  25. data/assets/stylesheets/_bootstrap-reboot.scss +6 -3
  26. data/assets/stylesheets/_bootstrap.scss +16 -10
  27. data/assets/stylesheets/bootstrap/_alert.scss +3 -4
  28. data/assets/stylesheets/bootstrap/_badge.scss +2 -27
  29. data/assets/stylesheets/bootstrap/_breadcrumb.scss +5 -17
  30. data/assets/stylesheets/bootstrap/_button-group.scss +16 -38
  31. data/assets/stylesheets/bootstrap/_buttons.scss +27 -45
  32. data/assets/stylesheets/bootstrap/_card.scss +22 -68
  33. data/assets/stylesheets/bootstrap/_carousel.scss +15 -20
  34. data/assets/stylesheets/bootstrap/_close.scss +9 -13
  35. data/assets/stylesheets/bootstrap/_containers.scss +41 -0
  36. data/assets/stylesheets/bootstrap/_dropdown.scss +12 -9
  37. data/assets/stylesheets/bootstrap/_forms.scss +9 -347
  38. data/assets/stylesheets/bootstrap/_functions.scss +82 -69
  39. data/assets/stylesheets/bootstrap/_grid.scss +3 -54
  40. data/assets/stylesheets/bootstrap/_helpers.scss +7 -0
  41. data/assets/stylesheets/bootstrap/_images.scss +1 -1
  42. data/assets/stylesheets/bootstrap/_list-group.scss +7 -4
  43. data/assets/stylesheets/bootstrap/_mixins.scss +6 -12
  44. data/assets/stylesheets/bootstrap/_modal.scss +36 -41
  45. data/assets/stylesheets/bootstrap/_nav.scss +7 -9
  46. data/assets/stylesheets/bootstrap/_navbar.scss +42 -82
  47. data/assets/stylesheets/bootstrap/_pagination.scss +7 -20
  48. data/assets/stylesheets/bootstrap/_popover.scss +14 -14
  49. data/assets/stylesheets/bootstrap/_progress.scss +3 -5
  50. data/assets/stylesheets/bootstrap/_reboot.scss +304 -172
  51. data/assets/stylesheets/bootstrap/_root.scss +5 -8
  52. data/assets/stylesheets/bootstrap/_spinners.scss +8 -17
  53. data/assets/stylesheets/bootstrap/_tables.scss +80 -114
  54. data/assets/stylesheets/bootstrap/_toasts.scss +2 -4
  55. data/assets/stylesheets/bootstrap/_tooltip.scss +9 -9
  56. data/assets/stylesheets/bootstrap/_transitions.scss +0 -7
  57. data/assets/stylesheets/bootstrap/_type.scss +38 -59
  58. data/assets/stylesheets/bootstrap/_utilities.scss +503 -18
  59. data/assets/stylesheets/bootstrap/_variables.scss +548 -437
  60. data/assets/stylesheets/bootstrap/bootstrap-utilities.scss +18 -0
  61. data/assets/stylesheets/bootstrap/forms/_form-check.scss +142 -0
  62. data/assets/stylesheets/bootstrap/forms/_form-control.scss +116 -0
  63. data/assets/stylesheets/bootstrap/forms/_form-file.scss +91 -0
  64. data/assets/stylesheets/bootstrap/forms/_form-range.scss +136 -0
  65. data/assets/stylesheets/bootstrap/forms/_form-select.scss +82 -0
  66. data/assets/stylesheets/bootstrap/forms/_form-text.scss +11 -0
  67. data/assets/stylesheets/bootstrap/forms/_input-group.scss +140 -0
  68. data/assets/stylesheets/bootstrap/forms/_labels.scss +36 -0
  69. data/assets/stylesheets/bootstrap/forms/_validation.scss +12 -0
  70. data/assets/stylesheets/bootstrap/helpers/_colored-links.scss +12 -0
  71. data/assets/stylesheets/bootstrap/helpers/_embed.scss +31 -0
  72. data/assets/stylesheets/bootstrap/helpers/_position.scss +30 -0
  73. data/assets/stylesheets/bootstrap/helpers/_screenreaders.scss +8 -0
  74. data/assets/stylesheets/bootstrap/helpers/_stretched-link.scss +15 -0
  75. data/assets/stylesheets/bootstrap/helpers/_text-truncation.scss +7 -0
  76. data/assets/stylesheets/bootstrap/mixins/_alert.scss +0 -4
  77. data/assets/stylesheets/bootstrap/mixins/_border-radius.scss +1 -1
  78. data/assets/stylesheets/bootstrap/mixins/_breakpoints.scss +11 -8
  79. data/assets/stylesheets/bootstrap/mixins/_buttons.scss +62 -47
  80. data/assets/stylesheets/bootstrap/mixins/_caret.scss +4 -4
  81. data/assets/stylesheets/bootstrap/mixins/_clearfix.scss +2 -0
  82. data/assets/stylesheets/bootstrap/mixins/_container.scss +9 -0
  83. data/assets/stylesheets/bootstrap/mixins/_forms.scss +23 -85
  84. data/assets/stylesheets/bootstrap/mixins/_gradients.scss +9 -11
  85. data/assets/stylesheets/bootstrap/mixins/_grid.scss +86 -34
  86. data/assets/stylesheets/bootstrap/mixins/_image.scss +1 -21
  87. data/assets/stylesheets/bootstrap/mixins/_list-group.scss +2 -1
  88. data/assets/stylesheets/bootstrap/mixins/_lists.scss +1 -1
  89. data/assets/stylesheets/bootstrap/mixins/_pagination.scss +15 -8
  90. data/assets/stylesheets/bootstrap/mixins/_reset-text.scss +3 -3
  91. data/assets/stylesheets/bootstrap/mixins/_screen-reader.scss +18 -24
  92. data/assets/stylesheets/bootstrap/mixins/_table-variants.scss +21 -0
  93. data/assets/stylesheets/bootstrap/mixins/_transition.scss +2 -2
  94. data/assets/stylesheets/bootstrap/mixins/_utilities.scss +49 -0
  95. data/assets/stylesheets/bootstrap/utilities/_api.scss +47 -0
  96. data/assets/stylesheets/bootstrap/vendor/_rfs.scss +214 -130
  97. data/bootstrap.gemspec +3 -1
  98. data/lib/bootstrap/engine.rb +1 -17
  99. data/lib/bootstrap/version.rb +2 -2
  100. data/tasks/updater/js.rb +6 -18
  101. data/tasks/updater/network.rb +1 -7
  102. metadata +49 -47
  103. data/assets/javascripts/bootstrap/util.js +0 -189
  104. data/assets/stylesheets/bootstrap/_code.scss +0 -48
  105. data/assets/stylesheets/bootstrap/_custom-forms.scss +0 -526
  106. data/assets/stylesheets/bootstrap/_input-group.scss +0 -211
  107. data/assets/stylesheets/bootstrap/_jumbotron.scss +0 -17
  108. data/assets/stylesheets/bootstrap/_media.scss +0 -8
  109. data/assets/stylesheets/bootstrap/_print.scss +0 -132
  110. data/assets/stylesheets/bootstrap/mixins/_background-variant.scss +0 -23
  111. data/assets/stylesheets/bootstrap/mixins/_badge.scss +0 -17
  112. data/assets/stylesheets/bootstrap/mixins/_float.scss +0 -14
  113. data/assets/stylesheets/bootstrap/mixins/_grid-framework.scss +0 -80
  114. data/assets/stylesheets/bootstrap/mixins/_hover.scss +0 -37
  115. data/assets/stylesheets/bootstrap/mixins/_nav-divider.scss +0 -11
  116. data/assets/stylesheets/bootstrap/mixins/_size.scss +0 -7
  117. data/assets/stylesheets/bootstrap/mixins/_table-row.scss +0 -39
  118. data/assets/stylesheets/bootstrap/mixins/_text-emphasis.scss +0 -17
  119. data/assets/stylesheets/bootstrap/mixins/_text-hide.scss +0 -11
  120. data/assets/stylesheets/bootstrap/mixins/_visibility.scss +0 -8
  121. data/assets/stylesheets/bootstrap/utilities/_align.scss +0 -8
  122. data/assets/stylesheets/bootstrap/utilities/_background.scss +0 -19
  123. data/assets/stylesheets/bootstrap/utilities/_borders.scss +0 -75
  124. data/assets/stylesheets/bootstrap/utilities/_display.scss +0 -26
  125. data/assets/stylesheets/bootstrap/utilities/_embed.scss +0 -39
  126. data/assets/stylesheets/bootstrap/utilities/_flex.scss +0 -51
  127. data/assets/stylesheets/bootstrap/utilities/_float.scss +0 -11
  128. data/assets/stylesheets/bootstrap/utilities/_interactions.scss +0 -5
  129. data/assets/stylesheets/bootstrap/utilities/_overflow.scss +0 -5
  130. data/assets/stylesheets/bootstrap/utilities/_position.scss +0 -32
  131. data/assets/stylesheets/bootstrap/utilities/_screenreaders.scss +0 -11
  132. data/assets/stylesheets/bootstrap/utilities/_shadows.scss +0 -6
  133. data/assets/stylesheets/bootstrap/utilities/_sizing.scss +0 -20
  134. data/assets/stylesheets/bootstrap/utilities/_spacing.scss +0 -73
  135. data/assets/stylesheets/bootstrap/utilities/_stretched-link.scss +0 -19
  136. data/assets/stylesheets/bootstrap/utilities/_text.scss +0 -72
  137. data/assets/stylesheets/bootstrap/utilities/_visibility.scss +0 -13
  138. data/test/gemfiles/rails_7_0_dartsass.gemfile +0 -8
  139. data/test/gemfiles/rails_7_0_sassc.gemfile +0 -8
  140. /data/assets/stylesheets/bootstrap/{utilities → helpers}/_clearfix.scss +0 -0
@@ -1,80 +1,183 @@
1
1
  /*!
2
- * Bootstrap carousel.js v4.6.2 (https://getbootstrap.com/)
3
- * Copyright 2011-2022 The Bootstrap Authors (https://github.com/twbs/bootstrap/graphs/contributors)
2
+ * Bootstrap carousel.js v5.0.0-alpha1 (https://getbootstrap.com/)
3
+ * Copyright 2011-2020 The Bootstrap Authors (https://github.com/twbs/bootstrap/graphs/contributors)
4
4
  * Licensed under MIT (https://github.com/twbs/bootstrap/blob/main/LICENSE)
5
5
  */
6
6
  (function (global, factory) {
7
- typeof exports === 'object' && typeof module !== 'undefined' ? module.exports = factory(require('jquery'), require('./util.js')) :
8
- typeof define === 'function' && define.amd ? define(['jquery', './util'], factory) :
9
- (global = typeof globalThis !== 'undefined' ? globalThis : global || self, global.Carousel = factory(global.jQuery, global.Util));
10
- })(this, (function ($, Util) { 'use strict';
11
-
12
- function _interopDefaultLegacy (e) { return e && typeof e === 'object' && 'default' in e ? e : { 'default': e }; }
13
-
14
- var $__default = /*#__PURE__*/_interopDefaultLegacy($);
15
- var Util__default = /*#__PURE__*/_interopDefaultLegacy(Util);
16
-
17
- function _defineProperties(target, props) {
18
- for (var i = 0; i < props.length; i++) {
19
- var descriptor = props[i];
20
- descriptor.enumerable = descriptor.enumerable || false;
21
- descriptor.configurable = true;
22
- if ("value" in descriptor) descriptor.writable = true;
23
- Object.defineProperty(target, descriptor.key, descriptor);
7
+ typeof exports === 'object' && typeof module !== 'undefined' ? module.exports = factory(require('./dom/data.js'), require('./dom/event-handler.js'), require('./dom/manipulator.js'), require('./dom/selector-engine.js')) :
8
+ typeof define === 'function' && define.amd ? define(['./dom/data.js', './dom/event-handler.js', './dom/manipulator.js', './dom/selector-engine.js'], factory) :
9
+ (global = global || self, global.Carousel = factory(global.Data, global.EventHandler, global.Manipulator, global.SelectorEngine));
10
+ }(this, (function (Data, EventHandler, Manipulator, SelectorEngine) { 'use strict';
11
+
12
+ Data = Data && Object.prototype.hasOwnProperty.call(Data, 'default') ? Data['default'] : Data;
13
+ EventHandler = EventHandler && Object.prototype.hasOwnProperty.call(EventHandler, 'default') ? EventHandler['default'] : EventHandler;
14
+ Manipulator = Manipulator && Object.prototype.hasOwnProperty.call(Manipulator, 'default') ? Manipulator['default'] : Manipulator;
15
+ SelectorEngine = SelectorEngine && Object.prototype.hasOwnProperty.call(SelectorEngine, 'default') ? SelectorEngine['default'] : SelectorEngine;
16
+
17
+ /**
18
+ * --------------------------------------------------------------------------
19
+ * Bootstrap (v5.0.0-alpha1): util/index.js
20
+ * Licensed under MIT (https://github.com/twbs/bootstrap/blob/main/LICENSE)
21
+ * --------------------------------------------------------------------------
22
+ */
23
+ var MILLISECONDS_MULTIPLIER = 1000;
24
+ var TRANSITION_END = 'transitionend'; // Shoutout AngusCroll (https://goo.gl/pxwQGp)
25
+
26
+ var toType = function toType(obj) {
27
+ if (obj === null || obj === undefined) {
28
+ return "" + obj;
24
29
  }
25
- }
26
30
 
27
- function _createClass(Constructor, protoProps, staticProps) {
28
- if (protoProps) _defineProperties(Constructor.prototype, protoProps);
29
- if (staticProps) _defineProperties(Constructor, staticProps);
30
- Object.defineProperty(Constructor, "prototype", {
31
- writable: false
32
- });
33
- return Constructor;
34
- }
31
+ return {}.toString.call(obj).match(/\s([a-z]+)/i)[1].toLowerCase();
32
+ };
35
33
 
36
- function _extends() {
37
- _extends = Object.assign ? Object.assign.bind() : function (target) {
38
- for (var i = 1; i < arguments.length; i++) {
39
- var source = arguments[i];
34
+ var getSelector = function getSelector(element) {
35
+ var selector = element.getAttribute('data-target');
40
36
 
41
- for (var key in source) {
42
- if (Object.prototype.hasOwnProperty.call(source, key)) {
43
- target[key] = source[key];
44
- }
45
- }
37
+ if (!selector || selector === '#') {
38
+ var hrefAttr = element.getAttribute('href');
39
+ selector = hrefAttr && hrefAttr !== '#' ? hrefAttr.trim() : null;
40
+ }
41
+
42
+ return selector;
43
+ };
44
+
45
+ var getElementFromSelector = function getElementFromSelector(element) {
46
+ var selector = getSelector(element);
47
+ return selector ? document.querySelector(selector) : null;
48
+ };
49
+
50
+ var getTransitionDurationFromElement = function getTransitionDurationFromElement(element) {
51
+ if (!element) {
52
+ return 0;
53
+ } // Get transition-duration of the element
54
+
55
+
56
+ var _window$getComputedSt = window.getComputedStyle(element),
57
+ transitionDuration = _window$getComputedSt.transitionDuration,
58
+ transitionDelay = _window$getComputedSt.transitionDelay;
59
+
60
+ var floatTransitionDuration = parseFloat(transitionDuration);
61
+ var floatTransitionDelay = parseFloat(transitionDelay); // Return 0 if element or transition duration is not found
62
+
63
+ if (!floatTransitionDuration && !floatTransitionDelay) {
64
+ return 0;
65
+ } // If multiple durations are defined, take the first
66
+
67
+
68
+ transitionDuration = transitionDuration.split(',')[0];
69
+ transitionDelay = transitionDelay.split(',')[0];
70
+ return (parseFloat(transitionDuration) + parseFloat(transitionDelay)) * MILLISECONDS_MULTIPLIER;
71
+ };
72
+
73
+ var triggerTransitionEnd = function triggerTransitionEnd(element) {
74
+ element.dispatchEvent(new Event(TRANSITION_END));
75
+ };
76
+
77
+ var isElement = function isElement(obj) {
78
+ return (obj[0] || obj).nodeType;
79
+ };
80
+
81
+ var emulateTransitionEnd = function emulateTransitionEnd(element, duration) {
82
+ var called = false;
83
+ var durationPadding = 5;
84
+ var emulatedDuration = duration + durationPadding;
85
+
86
+ function listener() {
87
+ called = true;
88
+ element.removeEventListener(TRANSITION_END, listener);
89
+ }
90
+
91
+ element.addEventListener(TRANSITION_END, listener);
92
+ setTimeout(function () {
93
+ if (!called) {
94
+ triggerTransitionEnd(element);
46
95
  }
96
+ }, emulatedDuration);
97
+ };
47
98
 
48
- return target;
49
- };
50
- return _extends.apply(this, arguments);
51
- }
99
+ var typeCheckConfig = function typeCheckConfig(componentName, config, configTypes) {
100
+ Object.keys(configTypes).forEach(function (property) {
101
+ var expectedTypes = configTypes[property];
102
+ var value = config[property];
103
+ var valueType = value && isElement(value) ? 'element' : toType(value);
104
+
105
+ if (!new RegExp(expectedTypes).test(valueType)) {
106
+ throw new Error(componentName.toUpperCase() + ": " + ("Option \"" + property + "\" provided type \"" + valueType + "\" ") + ("but expected type \"" + expectedTypes + "\"."));
107
+ }
108
+ });
109
+ };
110
+
111
+ var isVisible = function isVisible(element) {
112
+ if (!element) {
113
+ return false;
114
+ }
115
+
116
+ if (element.style && element.parentNode && element.parentNode.style) {
117
+ var elementStyle = getComputedStyle(element);
118
+ var parentNodeStyle = getComputedStyle(element.parentNode);
119
+ return elementStyle.display !== 'none' && parentNodeStyle.display !== 'none' && elementStyle.visibility !== 'hidden';
120
+ }
121
+
122
+ return false;
123
+ };
124
+
125
+ var reflow = function reflow(element) {
126
+ return element.offsetHeight;
127
+ };
128
+
129
+ var getjQuery = function getjQuery() {
130
+ var _window = window,
131
+ jQuery = _window.jQuery;
52
132
 
133
+ if (jQuery && !document.body.hasAttribute('data-no-jquery')) {
134
+ return jQuery;
135
+ }
136
+
137
+ return null;
138
+ };
139
+
140
+ function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); if (enumerableOnly) symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; }); keys.push.apply(keys, symbols); } return keys; }
141
+
142
+ function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i] != null ? arguments[i] : {}; if (i % 2) { ownKeys(Object(source), true).forEach(function (key) { _defineProperty(target, key, source[key]); }); } else if (Object.getOwnPropertyDescriptors) { Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)); } else { ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } } return target; }
143
+
144
+ function _defineProperty(obj, key, value) { if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
145
+
146
+ function _defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } }
147
+
148
+ function _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); return Constructor; }
53
149
  /**
150
+ * ------------------------------------------------------------------------
54
151
  * Constants
152
+ * ------------------------------------------------------------------------
55
153
  */
56
154
 
57
155
  var NAME = 'carousel';
58
- var VERSION = '4.6.2';
156
+ var VERSION = '5.0.0-alpha1';
59
157
  var DATA_KEY = 'bs.carousel';
60
158
  var EVENT_KEY = "." + DATA_KEY;
61
159
  var DATA_API_KEY = '.data-api';
62
- var JQUERY_NO_CONFLICT = $__default["default"].fn[NAME];
63
- var ARROW_LEFT_KEYCODE = 37; // KeyboardEvent.which value for left arrow key
64
-
65
- var ARROW_RIGHT_KEYCODE = 39; // KeyboardEvent.which value for right arrow key
66
-
160
+ var ARROW_LEFT_KEY = 'ArrowLeft';
161
+ var ARROW_RIGHT_KEY = 'ArrowRight';
67
162
  var TOUCHEVENT_COMPAT_WAIT = 500; // Time for mouse compat events to fire after touch
68
163
 
69
164
  var SWIPE_THRESHOLD = 40;
70
- var CLASS_NAME_CAROUSEL = 'carousel';
71
- var CLASS_NAME_ACTIVE = 'active';
72
- var CLASS_NAME_SLIDE = 'slide';
73
- var CLASS_NAME_RIGHT = 'carousel-item-right';
74
- var CLASS_NAME_LEFT = 'carousel-item-left';
75
- var CLASS_NAME_NEXT = 'carousel-item-next';
76
- var CLASS_NAME_PREV = 'carousel-item-prev';
77
- var CLASS_NAME_POINTER_EVENT = 'pointer-event';
165
+ var Default = {
166
+ interval: 5000,
167
+ keyboard: true,
168
+ slide: false,
169
+ pause: 'hover',
170
+ wrap: true,
171
+ touch: true
172
+ };
173
+ var DefaultType = {
174
+ interval: '(number|boolean)',
175
+ keyboard: 'boolean',
176
+ slide: '(boolean|string)',
177
+ pause: '(string|boolean)',
178
+ wrap: 'boolean',
179
+ touch: 'boolean'
180
+ };
78
181
  var DIRECTION_NEXT = 'next';
79
182
  var DIRECTION_PREV = 'prev';
80
183
  var DIRECTION_LEFT = 'left';
@@ -92,6 +195,14 @@
92
195
  var EVENT_DRAG_START = "dragstart" + EVENT_KEY;
93
196
  var EVENT_LOAD_DATA_API = "load" + EVENT_KEY + DATA_API_KEY;
94
197
  var EVENT_CLICK_DATA_API = "click" + EVENT_KEY + DATA_API_KEY;
198
+ var CLASS_NAME_CAROUSEL = 'carousel';
199
+ var CLASS_NAME_ACTIVE = 'active';
200
+ var CLASS_NAME_SLIDE = 'slide';
201
+ var CLASS_NAME_RIGHT = 'carousel-item-right';
202
+ var CLASS_NAME_LEFT = 'carousel-item-left';
203
+ var CLASS_NAME_NEXT = 'carousel-item-next';
204
+ var CLASS_NAME_PREV = 'carousel-item-prev';
205
+ var CLASS_NAME_POINTER_EVENT = 'pointer-event';
95
206
  var SELECTOR_ACTIVE = '.active';
96
207
  var SELECTOR_ACTIVE_ITEM = '.active.carousel-item';
97
208
  var SELECTOR_ITEM = '.carousel-item';
@@ -100,28 +211,14 @@
100
211
  var SELECTOR_INDICATORS = '.carousel-indicators';
101
212
  var SELECTOR_DATA_SLIDE = '[data-slide], [data-slide-to]';
102
213
  var SELECTOR_DATA_RIDE = '[data-ride="carousel"]';
103
- var Default = {
104
- interval: 5000,
105
- keyboard: true,
106
- slide: false,
107
- pause: 'hover',
108
- wrap: true,
109
- touch: true
110
- };
111
- var DefaultType = {
112
- interval: '(number|boolean)',
113
- keyboard: 'boolean',
114
- slide: '(boolean|string)',
115
- pause: '(string|boolean)',
116
- wrap: 'boolean',
117
- touch: 'boolean'
118
- };
119
214
  var PointerType = {
120
215
  TOUCH: 'touch',
121
216
  PEN: 'pen'
122
217
  };
123
218
  /**
124
- * Class definition
219
+ * ------------------------------------------------------------------------
220
+ * Class Definition
221
+ * ------------------------------------------------------------------------
125
222
  */
126
223
 
127
224
  var Carousel = /*#__PURE__*/function () {
@@ -136,11 +233,13 @@
136
233
  this.touchDeltaX = 0;
137
234
  this._config = this._getConfig(config);
138
235
  this._element = element;
139
- this._indicatorsElement = this._element.querySelector(SELECTOR_INDICATORS);
236
+ this._indicatorsElement = SelectorEngine.findOne(SELECTOR_INDICATORS, this._element);
140
237
  this._touchSupported = 'ontouchstart' in document.documentElement || navigator.maxTouchPoints > 0;
141
- this._pointerEvent = Boolean(window.PointerEvent || window.MSPointerEvent);
238
+ this._pointerEvent = Boolean(window.PointerEvent);
142
239
 
143
240
  this._addEventListeners();
241
+
242
+ Data.setData(element, DATA_KEY, this);
144
243
  } // Getters
145
244
 
146
245
 
@@ -154,10 +253,9 @@
154
253
  };
155
254
 
156
255
  _proto.nextWhenVisible = function nextWhenVisible() {
157
- var $element = $__default["default"](this._element); // Don't call next when the page isn't visible
256
+ // Don't call next when the page isn't visible
158
257
  // or the carousel or its parent isn't visible
159
-
160
- if (!document.hidden && $element.is(':visible') && $element.css('visibility') !== 'hidden') {
258
+ if (!document.hidden && isVisible(this._element)) {
161
259
  this.next();
162
260
  }
163
261
  };
@@ -173,8 +271,8 @@
173
271
  this._isPaused = true;
174
272
  }
175
273
 
176
- if (this._element.querySelector(SELECTOR_NEXT_PREV)) {
177
- Util__default["default"].triggerTransitionEnd(this._element);
274
+ if (SelectorEngine.findOne(SELECTOR_NEXT_PREV, this._element)) {
275
+ triggerTransitionEnd(this._element);
178
276
  this.cycle(true);
179
277
  }
180
278
 
@@ -192,9 +290,7 @@
192
290
  this._interval = null;
193
291
  }
194
292
 
195
- if (this._config.interval && !this._isPaused) {
196
- this._updateInterval();
197
-
293
+ if (this._config && this._config.interval && !this._isPaused) {
198
294
  this._interval = setInterval((document.visibilityState ? this.nextWhenVisible : this.next).bind(this), this._config.interval);
199
295
  }
200
296
  };
@@ -202,7 +298,7 @@
202
298
  _proto.to = function to(index) {
203
299
  var _this = this;
204
300
 
205
- this._activeElement = this._element.querySelector(SELECTOR_ACTIVE_ITEM);
301
+ this._activeElement = SelectorEngine.findOne(SELECTOR_ACTIVE_ITEM, this._element);
206
302
 
207
303
  var activeIndex = this._getItemIndex(this._activeElement);
208
304
 
@@ -211,7 +307,7 @@
211
307
  }
212
308
 
213
309
  if (this._isSliding) {
214
- $__default["default"](this._element).one(EVENT_SLID, function () {
310
+ EventHandler.one(this._element, EVENT_SLID, function () {
215
311
  return _this.to(index);
216
312
  });
217
313
  return;
@@ -229,8 +325,8 @@
229
325
  };
230
326
 
231
327
  _proto.dispose = function dispose() {
232
- $__default["default"](this._element).off(EVENT_KEY);
233
- $__default["default"].removeData(this._element, DATA_KEY);
328
+ EventHandler.off(this._element, EVENT_KEY);
329
+ Data.removeData(this._element, DATA_KEY);
234
330
  this._items = null;
235
331
  this._config = null;
236
332
  this._element = null;
@@ -243,8 +339,8 @@
243
339
  ;
244
340
 
245
341
  _proto._getConfig = function _getConfig(config) {
246
- config = _extends({}, Default, config);
247
- Util__default["default"].typeCheckConfig(NAME, config, DefaultType);
342
+ config = _objectSpread(_objectSpread({}, Default), config);
343
+ typeCheckConfig(NAME, config, DefaultType);
248
344
  return config;
249
345
  };
250
346
 
@@ -272,20 +368,21 @@
272
368
  var _this2 = this;
273
369
 
274
370
  if (this._config.keyboard) {
275
- $__default["default"](this._element).on(EVENT_KEYDOWN, function (event) {
371
+ EventHandler.on(this._element, EVENT_KEYDOWN, function (event) {
276
372
  return _this2._keydown(event);
277
373
  });
278
374
  }
279
375
 
280
376
  if (this._config.pause === 'hover') {
281
- $__default["default"](this._element).on(EVENT_MOUSEENTER, function (event) {
377
+ EventHandler.on(this._element, EVENT_MOUSEENTER, function (event) {
282
378
  return _this2.pause(event);
283
- }).on(EVENT_MOUSELEAVE, function (event) {
379
+ });
380
+ EventHandler.on(this._element, EVENT_MOUSELEAVE, function (event) {
284
381
  return _this2.cycle(event);
285
382
  });
286
383
  }
287
384
 
288
- if (this._config.touch) {
385
+ if (this._config.touch && this._touchSupported) {
289
386
  this._addTouchEventListeners();
290
387
  }
291
388
  };
@@ -293,26 +390,26 @@
293
390
  _proto._addTouchEventListeners = function _addTouchEventListeners() {
294
391
  var _this3 = this;
295
392
 
296
- if (!this._touchSupported) {
297
- return;
298
- }
299
-
300
393
  var start = function start(event) {
301
- if (_this3._pointerEvent && PointerType[event.originalEvent.pointerType.toUpperCase()]) {
302
- _this3.touchStartX = event.originalEvent.clientX;
394
+ if (_this3._pointerEvent && PointerType[event.pointerType.toUpperCase()]) {
395
+ _this3.touchStartX = event.clientX;
303
396
  } else if (!_this3._pointerEvent) {
304
- _this3.touchStartX = event.originalEvent.touches[0].clientX;
397
+ _this3.touchStartX = event.touches[0].clientX;
305
398
  }
306
399
  };
307
400
 
308
401
  var move = function move(event) {
309
402
  // ensure swiping with one touch and not pinching
310
- _this3.touchDeltaX = event.originalEvent.touches && event.originalEvent.touches.length > 1 ? 0 : event.originalEvent.touches[0].clientX - _this3.touchStartX;
403
+ if (event.touches && event.touches.length > 1) {
404
+ _this3.touchDeltaX = 0;
405
+ } else {
406
+ _this3.touchDeltaX = event.touches[0].clientX - _this3.touchStartX;
407
+ }
311
408
  };
312
409
 
313
410
  var end = function end(event) {
314
- if (_this3._pointerEvent && PointerType[event.originalEvent.pointerType.toUpperCase()]) {
315
- _this3.touchDeltaX = event.originalEvent.clientX - _this3.touchStartX;
411
+ if (_this3._pointerEvent && PointerType[event.pointerType.toUpperCase()]) {
412
+ _this3.touchDeltaX = event.clientX - _this3.touchStartX;
316
413
  }
317
414
 
318
415
  _this3._handleSwipe();
@@ -337,27 +434,29 @@
337
434
  }
338
435
  };
339
436
 
340
- $__default["default"](this._element.querySelectorAll(SELECTOR_ITEM_IMG)).on(EVENT_DRAG_START, function (e) {
341
- return e.preventDefault();
437
+ SelectorEngine.find(SELECTOR_ITEM_IMG, this._element).forEach(function (itemImg) {
438
+ EventHandler.on(itemImg, EVENT_DRAG_START, function (e) {
439
+ return e.preventDefault();
440
+ });
342
441
  });
343
442
 
344
443
  if (this._pointerEvent) {
345
- $__default["default"](this._element).on(EVENT_POINTERDOWN, function (event) {
444
+ EventHandler.on(this._element, EVENT_POINTERDOWN, function (event) {
346
445
  return start(event);
347
446
  });
348
- $__default["default"](this._element).on(EVENT_POINTERUP, function (event) {
447
+ EventHandler.on(this._element, EVENT_POINTERUP, function (event) {
349
448
  return end(event);
350
449
  });
351
450
 
352
451
  this._element.classList.add(CLASS_NAME_POINTER_EVENT);
353
452
  } else {
354
- $__default["default"](this._element).on(EVENT_TOUCHSTART, function (event) {
453
+ EventHandler.on(this._element, EVENT_TOUCHSTART, function (event) {
355
454
  return start(event);
356
455
  });
357
- $__default["default"](this._element).on(EVENT_TOUCHMOVE, function (event) {
456
+ EventHandler.on(this._element, EVENT_TOUCHMOVE, function (event) {
358
457
  return move(event);
359
458
  });
360
- $__default["default"](this._element).on(EVENT_TOUCHEND, function (event) {
459
+ EventHandler.on(this._element, EVENT_TOUCHEND, function (event) {
361
460
  return end(event);
362
461
  });
363
462
  }
@@ -368,13 +467,13 @@
368
467
  return;
369
468
  }
370
469
 
371
- switch (event.which) {
372
- case ARROW_LEFT_KEYCODE:
470
+ switch (event.key) {
471
+ case ARROW_LEFT_KEY:
373
472
  event.preventDefault();
374
473
  this.prev();
375
474
  break;
376
475
 
377
- case ARROW_RIGHT_KEYCODE:
476
+ case ARROW_RIGHT_KEY:
378
477
  event.preventDefault();
379
478
  this.next();
380
479
  break;
@@ -382,7 +481,7 @@
382
481
  };
383
482
 
384
483
  _proto._getItemIndex = function _getItemIndex(element) {
385
- this._items = element && element.parentNode ? [].slice.call(element.parentNode.querySelectorAll(SELECTOR_ITEM)) : [];
484
+ this._items = element && element.parentNode ? SelectorEngine.find(SELECTOR_ITEM, element.parentNode) : [];
386
485
  return this._items.indexOf(element);
387
486
  };
388
487
 
@@ -407,52 +506,36 @@
407
506
  _proto._triggerSlideEvent = function _triggerSlideEvent(relatedTarget, eventDirectionName) {
408
507
  var targetIndex = this._getItemIndex(relatedTarget);
409
508
 
410
- var fromIndex = this._getItemIndex(this._element.querySelector(SELECTOR_ACTIVE_ITEM));
509
+ var fromIndex = this._getItemIndex(SelectorEngine.findOne(SELECTOR_ACTIVE_ITEM, this._element));
411
510
 
412
- var slideEvent = $__default["default"].Event(EVENT_SLIDE, {
511
+ return EventHandler.trigger(this._element, EVENT_SLIDE, {
413
512
  relatedTarget: relatedTarget,
414
513
  direction: eventDirectionName,
415
514
  from: fromIndex,
416
515
  to: targetIndex
417
516
  });
418
- $__default["default"](this._element).trigger(slideEvent);
419
- return slideEvent;
420
517
  };
421
518
 
422
519
  _proto._setActiveIndicatorElement = function _setActiveIndicatorElement(element) {
423
520
  if (this._indicatorsElement) {
424
- var indicators = [].slice.call(this._indicatorsElement.querySelectorAll(SELECTOR_ACTIVE));
425
- $__default["default"](indicators).removeClass(CLASS_NAME_ACTIVE);
521
+ var indicators = SelectorEngine.find(SELECTOR_ACTIVE, this._indicatorsElement);
522
+
523
+ for (var i = 0; i < indicators.length; i++) {
524
+ indicators[i].classList.remove(CLASS_NAME_ACTIVE);
525
+ }
426
526
 
427
527
  var nextIndicator = this._indicatorsElement.children[this._getItemIndex(element)];
428
528
 
429
529
  if (nextIndicator) {
430
- $__default["default"](nextIndicator).addClass(CLASS_NAME_ACTIVE);
530
+ nextIndicator.classList.add(CLASS_NAME_ACTIVE);
431
531
  }
432
532
  }
433
533
  };
434
534
 
435
- _proto._updateInterval = function _updateInterval() {
436
- var element = this._activeElement || this._element.querySelector(SELECTOR_ACTIVE_ITEM);
437
-
438
- if (!element) {
439
- return;
440
- }
441
-
442
- var elementInterval = parseInt(element.getAttribute('data-interval'), 10);
443
-
444
- if (elementInterval) {
445
- this._config.defaultInterval = this._config.defaultInterval || this._config.interval;
446
- this._config.interval = elementInterval;
447
- } else {
448
- this._config.interval = this._config.defaultInterval || this._config.interval;
449
- }
450
- };
451
-
452
535
  _proto._slide = function _slide(direction, element) {
453
536
  var _this4 = this;
454
537
 
455
- var activeElement = this._element.querySelector(SELECTOR_ACTIVE_ITEM);
538
+ var activeElement = SelectorEngine.findOne(SELECTOR_ACTIVE_ITEM, this._element);
456
539
 
457
540
  var activeElementIndex = this._getItemIndex(activeElement);
458
541
 
@@ -475,14 +558,14 @@
475
558
  eventDirectionName = DIRECTION_RIGHT;
476
559
  }
477
560
 
478
- if (nextElement && $__default["default"](nextElement).hasClass(CLASS_NAME_ACTIVE)) {
561
+ if (nextElement && nextElement.classList.contains(CLASS_NAME_ACTIVE)) {
479
562
  this._isSliding = false;
480
563
  return;
481
564
  }
482
565
 
483
566
  var slideEvent = this._triggerSlideEvent(nextElement, eventDirectionName);
484
567
 
485
- if (slideEvent.isDefaultPrevented()) {
568
+ if (slideEvent.defaultPrevented) {
486
569
  return;
487
570
  }
488
571
 
@@ -499,33 +582,46 @@
499
582
 
500
583
  this._setActiveIndicatorElement(nextElement);
501
584
 
502
- this._activeElement = nextElement;
503
- var slidEvent = $__default["default"].Event(EVENT_SLID, {
504
- relatedTarget: nextElement,
505
- direction: eventDirectionName,
506
- from: activeElementIndex,
507
- to: nextElementIndex
508
- });
585
+ if (this._element.classList.contains(CLASS_NAME_SLIDE)) {
586
+ nextElement.classList.add(orderClassName);
587
+ reflow(nextElement);
588
+ activeElement.classList.add(directionalClassName);
589
+ nextElement.classList.add(directionalClassName);
590
+ var nextElementInterval = parseInt(nextElement.getAttribute('data-interval'), 10);
591
+
592
+ if (nextElementInterval) {
593
+ this._config.defaultInterval = this._config.defaultInterval || this._config.interval;
594
+ this._config.interval = nextElementInterval;
595
+ } else {
596
+ this._config.interval = this._config.defaultInterval || this._config.interval;
597
+ }
509
598
 
510
- if ($__default["default"](this._element).hasClass(CLASS_NAME_SLIDE)) {
511
- $__default["default"](nextElement).addClass(orderClassName);
512
- Util__default["default"].reflow(nextElement);
513
- $__default["default"](activeElement).addClass(directionalClassName);
514
- $__default["default"](nextElement).addClass(directionalClassName);
515
- var transitionDuration = Util__default["default"].getTransitionDurationFromElement(activeElement);
516
- $__default["default"](activeElement).one(Util__default["default"].TRANSITION_END, function () {
517
- $__default["default"](nextElement).removeClass(directionalClassName + " " + orderClassName).addClass(CLASS_NAME_ACTIVE);
518
- $__default["default"](activeElement).removeClass(CLASS_NAME_ACTIVE + " " + orderClassName + " " + directionalClassName);
599
+ var transitionDuration = getTransitionDurationFromElement(activeElement);
600
+ EventHandler.one(activeElement, TRANSITION_END, function () {
601
+ nextElement.classList.remove(directionalClassName, orderClassName);
602
+ nextElement.classList.add(CLASS_NAME_ACTIVE);
603
+ activeElement.classList.remove(CLASS_NAME_ACTIVE, orderClassName, directionalClassName);
519
604
  _this4._isSliding = false;
520
605
  setTimeout(function () {
521
- return $__default["default"](_this4._element).trigger(slidEvent);
606
+ EventHandler.trigger(_this4._element, EVENT_SLID, {
607
+ relatedTarget: nextElement,
608
+ direction: eventDirectionName,
609
+ from: activeElementIndex,
610
+ to: nextElementIndex
611
+ });
522
612
  }, 0);
523
- }).emulateTransitionEnd(transitionDuration);
613
+ });
614
+ emulateTransitionEnd(activeElement, transitionDuration);
524
615
  } else {
525
- $__default["default"](activeElement).removeClass(CLASS_NAME_ACTIVE);
526
- $__default["default"](nextElement).addClass(CLASS_NAME_ACTIVE);
616
+ activeElement.classList.remove(CLASS_NAME_ACTIVE);
617
+ nextElement.classList.add(CLASS_NAME_ACTIVE);
527
618
  this._isSliding = false;
528
- $__default["default"](this._element).trigger(slidEvent);
619
+ EventHandler.trigger(this._element, EVENT_SLID, {
620
+ relatedTarget: nextElement,
621
+ direction: eventDirectionName,
622
+ from: activeElementIndex,
623
+ to: nextElementIndex
624
+ });
529
625
  }
530
626
 
531
627
  if (isCycling) {
@@ -534,52 +630,49 @@
534
630
  } // Static
535
631
  ;
536
632
 
537
- Carousel._jQueryInterface = function _jQueryInterface(config) {
538
- return this.each(function () {
539
- var data = $__default["default"](this).data(DATA_KEY);
633
+ Carousel.carouselInterface = function carouselInterface(element, config) {
634
+ var data = Data.getData(element, DATA_KEY);
540
635
 
541
- var _config = _extends({}, Default, $__default["default"](this).data());
636
+ var _config = _objectSpread(_objectSpread({}, Default), Manipulator.getDataAttributes(element));
542
637
 
543
- if (typeof config === 'object') {
544
- _config = _extends({}, _config, config);
545
- }
638
+ if (typeof config === 'object') {
639
+ _config = _objectSpread(_objectSpread({}, _config), config);
640
+ }
641
+
642
+ var action = typeof config === 'string' ? config : _config.slide;
546
643
 
547
- var action = typeof config === 'string' ? config : _config.slide;
644
+ if (!data) {
645
+ data = new Carousel(element, _config);
646
+ }
548
647
 
549
- if (!data) {
550
- data = new Carousel(this, _config);
551
- $__default["default"](this).data(DATA_KEY, data);
648
+ if (typeof config === 'number') {
649
+ data.to(config);
650
+ } else if (typeof action === 'string') {
651
+ if (typeof data[action] === 'undefined') {
652
+ throw new TypeError("No method named \"" + action + "\"");
552
653
  }
553
654
 
554
- if (typeof config === 'number') {
555
- data.to(config);
556
- } else if (typeof action === 'string') {
557
- if (typeof data[action] === 'undefined') {
558
- throw new TypeError("No method named \"" + action + "\"");
559
- }
655
+ data[action]();
656
+ } else if (_config.interval && _config.ride) {
657
+ data.pause();
658
+ data.cycle();
659
+ }
660
+ };
560
661
 
561
- data[action]();
562
- } else if (_config.interval && _config.ride) {
563
- data.pause();
564
- data.cycle();
565
- }
662
+ Carousel.jQueryInterface = function jQueryInterface(config) {
663
+ return this.each(function () {
664
+ Carousel.carouselInterface(this, config);
566
665
  });
567
666
  };
568
667
 
569
- Carousel._dataApiClickHandler = function _dataApiClickHandler(event) {
570
- var selector = Util__default["default"].getSelectorFromElement(this);
668
+ Carousel.dataApiClickHandler = function dataApiClickHandler(event) {
669
+ var target = getElementFromSelector(this);
571
670
 
572
- if (!selector) {
671
+ if (!target || !target.classList.contains(CLASS_NAME_CAROUSEL)) {
573
672
  return;
574
673
  }
575
674
 
576
- var target = $__default["default"](selector)[0];
577
-
578
- if (!target || !$__default["default"](target).hasClass(CLASS_NAME_CAROUSEL)) {
579
- return;
580
- }
581
-
582
- var config = _extends({}, $__default["default"](target).data(), $__default["default"](this).data());
675
+ var config = _objectSpread(_objectSpread({}, Manipulator.getDataAttributes(target)), Manipulator.getDataAttributes(this));
583
676
 
584
677
  var slideIndex = this.getAttribute('data-slide-to');
585
678
 
@@ -587,15 +680,19 @@
587
680
  config.interval = false;
588
681
  }
589
682
 
590
- Carousel._jQueryInterface.call($__default["default"](target), config);
683
+ Carousel.carouselInterface(target, config);
591
684
 
592
685
  if (slideIndex) {
593
- $__default["default"](target).data(DATA_KEY).to(slideIndex);
686
+ Data.getData(target, DATA_KEY).to(slideIndex);
594
687
  }
595
688
 
596
689
  event.preventDefault();
597
690
  };
598
691
 
692
+ Carousel.getInstance = function getInstance(element) {
693
+ return Data.getData(element, DATA_KEY);
694
+ };
695
+
599
696
  _createClass(Carousel, null, [{
600
697
  key: "VERSION",
601
698
  get: function get() {
@@ -611,32 +708,41 @@
611
708
  return Carousel;
612
709
  }();
613
710
  /**
614
- * Data API implementation
711
+ * ------------------------------------------------------------------------
712
+ * Data Api implementation
713
+ * ------------------------------------------------------------------------
615
714
  */
616
715
 
617
716
 
618
- $__default["default"](document).on(EVENT_CLICK_DATA_API, SELECTOR_DATA_SLIDE, Carousel._dataApiClickHandler);
619
- $__default["default"](window).on(EVENT_LOAD_DATA_API, function () {
620
- var carousels = [].slice.call(document.querySelectorAll(SELECTOR_DATA_RIDE));
717
+ EventHandler.on(document, EVENT_CLICK_DATA_API, SELECTOR_DATA_SLIDE, Carousel.dataApiClickHandler);
718
+ EventHandler.on(window, EVENT_LOAD_DATA_API, function () {
719
+ var carousels = SelectorEngine.find(SELECTOR_DATA_RIDE);
621
720
 
622
721
  for (var i = 0, len = carousels.length; i < len; i++) {
623
- var $carousel = $__default["default"](carousels[i]);
624
-
625
- Carousel._jQueryInterface.call($carousel, $carousel.data());
722
+ Carousel.carouselInterface(carousels[i], Data.getData(carousels[i], DATA_KEY));
626
723
  }
627
724
  });
725
+ var $ = getjQuery();
628
726
  /**
727
+ * ------------------------------------------------------------------------
629
728
  * jQuery
729
+ * ------------------------------------------------------------------------
730
+ * add .carousel to jQuery only if jQuery is present
630
731
  */
631
732
 
632
- $__default["default"].fn[NAME] = Carousel._jQueryInterface;
633
- $__default["default"].fn[NAME].Constructor = Carousel;
733
+ /* istanbul ignore if */
634
734
 
635
- $__default["default"].fn[NAME].noConflict = function () {
636
- $__default["default"].fn[NAME] = JQUERY_NO_CONFLICT;
637
- return Carousel._jQueryInterface;
638
- };
735
+ if ($) {
736
+ var JQUERY_NO_CONFLICT = $.fn[NAME];
737
+ $.fn[NAME] = Carousel.jQueryInterface;
738
+ $.fn[NAME].Constructor = Carousel;
739
+
740
+ $.fn[NAME].noConflict = function () {
741
+ $.fn[NAME] = JQUERY_NO_CONFLICT;
742
+ return Carousel.jQueryInterface;
743
+ };
744
+ }
639
745
 
640
746
  return Carousel;
641
747
 
642
- }));
748
+ })));