bootstrap 4.6.2 → 5.0.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (149) hide show
  1. checksums.yaml +4 -4
  2. data/.travis.yml +2 -1
  3. data/README.md +7 -4
  4. data/assets/javascripts/bootstrap/alert.js +192 -115
  5. data/assets/javascripts/bootstrap/base-component.js +63 -0
  6. data/assets/javascripts/bootstrap/button.js +96 -179
  7. data/assets/javascripts/bootstrap/carousel.js +472 -359
  8. data/assets/javascripts/bootstrap/collapse.js +379 -225
  9. data/assets/javascripts/bootstrap/dom/data.js +68 -0
  10. data/assets/javascripts/bootstrap/dom/event-handler.js +322 -0
  11. data/assets/javascripts/bootstrap/dom/manipulator.js +88 -0
  12. data/assets/javascripts/bootstrap/dom/selector-engine.js +85 -0
  13. data/assets/javascripts/bootstrap/dropdown.js +472 -355
  14. data/assets/javascripts/bootstrap/modal.js +612 -438
  15. data/assets/javascripts/bootstrap/offcanvas.js +671 -0
  16. data/assets/javascripts/bootstrap/popover.js +138 -167
  17. data/assets/javascripts/bootstrap/scrollspy.js +250 -192
  18. data/assets/javascripts/bootstrap/tab.js +241 -144
  19. data/assets/javascripts/bootstrap/toast.js +223 -157
  20. data/assets/javascripts/bootstrap/tooltip.js +651 -487
  21. data/assets/javascripts/bootstrap-global-this-define.js +6 -0
  22. data/assets/javascripts/bootstrap-global-this-undefine.js +2 -0
  23. data/assets/javascripts/bootstrap-sprockets.js +8 -1
  24. data/assets/javascripts/bootstrap.js +3277 -2590
  25. data/assets/javascripts/bootstrap.min.js +3 -3
  26. data/assets/stylesheets/_bootstrap-grid.scss +53 -18
  27. data/assets/stylesheets/_bootstrap-reboot.scss +6 -3
  28. data/assets/stylesheets/_bootstrap.scss +18 -10
  29. data/assets/stylesheets/bootstrap/_accordion.scss +118 -0
  30. data/assets/stylesheets/bootstrap/_alert.scss +15 -10
  31. data/assets/stylesheets/bootstrap/_badge.scss +2 -27
  32. data/assets/stylesheets/bootstrap/_breadcrumb.scss +3 -17
  33. data/assets/stylesheets/bootstrap/_button-group.scss +21 -45
  34. data/assets/stylesheets/bootstrap/_buttons.scss +29 -60
  35. data/assets/stylesheets/bootstrap/_card.scss +20 -91
  36. data/assets/stylesheets/bootstrap/_carousel.scss +64 -35
  37. data/assets/stylesheets/bootstrap/_close.scss +30 -30
  38. data/assets/stylesheets/bootstrap/_containers.scss +41 -0
  39. data/assets/stylesheets/bootstrap/_dropdown.scss +84 -36
  40. data/assets/stylesheets/bootstrap/_forms.scss +9 -347
  41. data/assets/stylesheets/bootstrap/_functions.scss +84 -69
  42. data/assets/stylesheets/bootstrap/_grid.scss +3 -54
  43. data/assets/stylesheets/bootstrap/_helpers.scss +7 -0
  44. data/assets/stylesheets/bootstrap/_images.scss +1 -1
  45. data/assets/stylesheets/bootstrap/_list-group.scss +28 -8
  46. data/assets/stylesheets/bootstrap/_mixins.scss +8 -13
  47. data/assets/stylesheets/bootstrap/_modal.scss +45 -57
  48. data/assets/stylesheets/bootstrap/_nav.scss +20 -6
  49. data/assets/stylesheets/bootstrap/_navbar.scss +45 -71
  50. data/assets/stylesheets/bootstrap/_offcanvas.scss +77 -0
  51. data/assets/stylesheets/bootstrap/_pagination.scss +10 -20
  52. data/assets/stylesheets/bootstrap/_popover.scss +24 -36
  53. data/assets/stylesheets/bootstrap/_progress.scss +5 -4
  54. data/assets/stylesheets/bootstrap/_reboot.scss +316 -179
  55. data/assets/stylesheets/bootstrap/_root.scss +5 -8
  56. data/assets/stylesheets/bootstrap/_spinners.scss +11 -7
  57. data/assets/stylesheets/bootstrap/_tables.scss +79 -114
  58. data/assets/stylesheets/bootstrap/_toasts.scss +20 -15
  59. data/assets/stylesheets/bootstrap/_tooltip.scss +21 -21
  60. data/assets/stylesheets/bootstrap/_transitions.scss +2 -7
  61. data/assets/stylesheets/bootstrap/_type.scss +38 -59
  62. data/assets/stylesheets/bootstrap/_utilities.scss +594 -18
  63. data/assets/stylesheets/bootstrap/_variables.scss +800 -485
  64. data/assets/stylesheets/bootstrap/bootstrap-utilities.scss +18 -0
  65. data/assets/stylesheets/bootstrap/forms/_floating-labels.scss +61 -0
  66. data/assets/stylesheets/bootstrap/forms/_form-check.scss +152 -0
  67. data/assets/stylesheets/bootstrap/forms/_form-control.scss +219 -0
  68. data/assets/stylesheets/bootstrap/forms/_form-range.scss +91 -0
  69. data/assets/stylesheets/bootstrap/forms/_form-select.scss +67 -0
  70. data/assets/stylesheets/bootstrap/forms/_form-text.scss +11 -0
  71. data/assets/stylesheets/bootstrap/forms/_input-group.scss +121 -0
  72. data/assets/stylesheets/bootstrap/forms/_labels.scss +36 -0
  73. data/assets/stylesheets/bootstrap/forms/_validation.scss +12 -0
  74. data/assets/stylesheets/bootstrap/helpers/_colored-links.scss +12 -0
  75. data/assets/stylesheets/bootstrap/helpers/_position.scss +30 -0
  76. data/assets/stylesheets/bootstrap/helpers/_ratio.scss +26 -0
  77. data/assets/stylesheets/bootstrap/helpers/_stretched-link.scss +15 -0
  78. data/assets/stylesheets/bootstrap/helpers/_text-truncation.scss +7 -0
  79. data/assets/stylesheets/bootstrap/helpers/_visually-hidden.scss +8 -0
  80. data/assets/stylesheets/bootstrap/mixins/_alert.scss +3 -5
  81. data/assets/stylesheets/bootstrap/mixins/_border-radius.scss +10 -8
  82. data/assets/stylesheets/bootstrap/mixins/_box-shadow.scss +7 -9
  83. data/assets/stylesheets/bootstrap/mixins/_breakpoints.scss +14 -10
  84. data/assets/stylesheets/bootstrap/mixins/_buttons.scss +71 -48
  85. data/assets/stylesheets/bootstrap/mixins/_caret.scss +10 -8
  86. data/assets/stylesheets/bootstrap/mixins/_clearfix.scss +2 -0
  87. data/assets/stylesheets/bootstrap/mixins/_color-scheme.scss +7 -0
  88. data/assets/stylesheets/bootstrap/mixins/_container.scss +9 -0
  89. data/assets/stylesheets/bootstrap/mixins/_forms.scss +39 -97
  90. data/assets/stylesheets/bootstrap/mixins/_gradients.scss +13 -11
  91. data/assets/stylesheets/bootstrap/mixins/_grid.scss +90 -34
  92. data/assets/stylesheets/bootstrap/mixins/_image.scss +1 -21
  93. data/assets/stylesheets/bootstrap/mixins/_list-group.scss +5 -2
  94. data/assets/stylesheets/bootstrap/mixins/_lists.scss +1 -1
  95. data/assets/stylesheets/bootstrap/mixins/_pagination.scss +17 -8
  96. data/assets/stylesheets/bootstrap/mixins/_reset-text.scss +3 -3
  97. data/assets/stylesheets/bootstrap/mixins/_table-variants.scss +21 -0
  98. data/assets/stylesheets/bootstrap/mixins/_transition.scss +1 -1
  99. data/assets/stylesheets/bootstrap/mixins/_utilities.scss +68 -0
  100. data/assets/stylesheets/bootstrap/mixins/_visually-hidden.scss +29 -0
  101. data/assets/stylesheets/bootstrap/utilities/_api.scss +47 -0
  102. data/assets/stylesheets/bootstrap/vendor/_rfs.scss +214 -130
  103. data/bootstrap.gemspec +1 -3
  104. data/lib/bootstrap/version.rb +2 -2
  105. data/tasks/updater/js.rb +19 -16
  106. data/test/dummy_rails/app/assets/javascripts/application.js +4 -3
  107. data/test/dummy_rails/app/views/layouts/application.html.erb +3 -1
  108. data/test/dummy_rails/app/views/pages/root.html +89 -0
  109. data/test/dummy_rails/config/application.rb +0 -3
  110. data/test/gemfiles/rails_6_1.gemfile +7 -0
  111. metadata +45 -73
  112. data/assets/javascripts/bootstrap/util.js +0 -189
  113. data/assets/stylesheets/bootstrap/_code.scss +0 -48
  114. data/assets/stylesheets/bootstrap/_custom-forms.scss +0 -526
  115. data/assets/stylesheets/bootstrap/_input-group.scss +0 -211
  116. data/assets/stylesheets/bootstrap/_jumbotron.scss +0 -17
  117. data/assets/stylesheets/bootstrap/_media.scss +0 -8
  118. data/assets/stylesheets/bootstrap/_print.scss +0 -132
  119. data/assets/stylesheets/bootstrap/mixins/_background-variant.scss +0 -23
  120. data/assets/stylesheets/bootstrap/mixins/_badge.scss +0 -17
  121. data/assets/stylesheets/bootstrap/mixins/_float.scss +0 -14
  122. data/assets/stylesheets/bootstrap/mixins/_grid-framework.scss +0 -80
  123. data/assets/stylesheets/bootstrap/mixins/_hover.scss +0 -37
  124. data/assets/stylesheets/bootstrap/mixins/_nav-divider.scss +0 -11
  125. data/assets/stylesheets/bootstrap/mixins/_screen-reader.scss +0 -34
  126. data/assets/stylesheets/bootstrap/mixins/_size.scss +0 -7
  127. data/assets/stylesheets/bootstrap/mixins/_table-row.scss +0 -39
  128. data/assets/stylesheets/bootstrap/mixins/_text-emphasis.scss +0 -17
  129. data/assets/stylesheets/bootstrap/mixins/_text-hide.scss +0 -11
  130. data/assets/stylesheets/bootstrap/mixins/_visibility.scss +0 -8
  131. data/assets/stylesheets/bootstrap/utilities/_align.scss +0 -8
  132. data/assets/stylesheets/bootstrap/utilities/_background.scss +0 -19
  133. data/assets/stylesheets/bootstrap/utilities/_borders.scss +0 -75
  134. data/assets/stylesheets/bootstrap/utilities/_display.scss +0 -26
  135. data/assets/stylesheets/bootstrap/utilities/_embed.scss +0 -39
  136. data/assets/stylesheets/bootstrap/utilities/_flex.scss +0 -51
  137. data/assets/stylesheets/bootstrap/utilities/_float.scss +0 -11
  138. data/assets/stylesheets/bootstrap/utilities/_interactions.scss +0 -5
  139. data/assets/stylesheets/bootstrap/utilities/_overflow.scss +0 -5
  140. data/assets/stylesheets/bootstrap/utilities/_position.scss +0 -32
  141. data/assets/stylesheets/bootstrap/utilities/_screenreaders.scss +0 -11
  142. data/assets/stylesheets/bootstrap/utilities/_shadows.scss +0 -6
  143. data/assets/stylesheets/bootstrap/utilities/_sizing.scss +0 -20
  144. data/assets/stylesheets/bootstrap/utilities/_spacing.scss +0 -73
  145. data/assets/stylesheets/bootstrap/utilities/_stretched-link.scss +0 -19
  146. data/assets/stylesheets/bootstrap/utilities/_text.scss +0 -72
  147. data/assets/stylesheets/bootstrap/utilities/_visibility.scss +0 -13
  148. data/test/dummy_rails/app/views/pages/root.html.slim +0 -58
  149. /data/assets/stylesheets/bootstrap/{utilities → helpers}/_clearfix.scss +0 -0
@@ -1,159 +1,240 @@
1
1
  /*!
2
- * Bootstrap scrollspy.js v4.6.2 (https://getbootstrap.com/)
3
- * Copyright 2011-2022 The Bootstrap Authors (https://github.com/twbs/bootstrap/graphs/contributors)
2
+ * Bootstrap scrollspy.js v5.0.0 (https://getbootstrap.com/)
3
+ * Copyright 2011-2021 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.ScrollSpy = factory(global.jQuery, global.Util));
10
- })(this, (function ($, Util) { 'use strict';
7
+ typeof exports === 'object' && typeof module !== 'undefined' ? module.exports = factory(require('./dom/event-handler.js'), require('./dom/manipulator.js'), require('./dom/selector-engine.js'), require('./base-component.js')) :
8
+ typeof define === 'function' && define.amd ? define(['./dom/event-handler', './dom/manipulator', './dom/selector-engine', './base-component'], factory) :
9
+ (global = typeof globalThis !== 'undefined' ? globalThis : global || self, global.ScrollSpy = factory(global.EventHandler, global.Manipulator, global.SelectorEngine, global.Base));
10
+ }(this, (function (EventHandler, Manipulator, SelectorEngine, BaseComponent) { 'use strict';
11
11
 
12
12
  function _interopDefaultLegacy (e) { return e && typeof e === 'object' && 'default' in e ? e : { 'default': e }; }
13
13
 
14
- var $__default = /*#__PURE__*/_interopDefaultLegacy($);
15
- var Util__default = /*#__PURE__*/_interopDefaultLegacy(Util);
14
+ var EventHandler__default = /*#__PURE__*/_interopDefaultLegacy(EventHandler);
15
+ var Manipulator__default = /*#__PURE__*/_interopDefaultLegacy(Manipulator);
16
+ var SelectorEngine__default = /*#__PURE__*/_interopDefaultLegacy(SelectorEngine);
17
+ var BaseComponent__default = /*#__PURE__*/_interopDefaultLegacy(BaseComponent);
16
18
 
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);
19
+ /**
20
+ * --------------------------------------------------------------------------
21
+ * Bootstrap (v5.0.0): util/index.js
22
+ * Licensed under MIT (https://github.com/twbs/bootstrap/blob/main/LICENSE)
23
+ * --------------------------------------------------------------------------
24
+ */
25
+ const MAX_UID = 1000000;
26
+
27
+ const toType = obj => {
28
+ if (obj === null || obj === undefined) {
29
+ return `${obj}`;
24
30
  }
25
- }
26
31
 
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
- }
32
+ return {}.toString.call(obj).match(/\s([a-z]+)/i)[1].toLowerCase();
33
+ };
34
+ /**
35
+ * --------------------------------------------------------------------------
36
+ * Public Util Api
37
+ * --------------------------------------------------------------------------
38
+ */
35
39
 
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];
40
40
 
41
- for (var key in source) {
42
- if (Object.prototype.hasOwnProperty.call(source, key)) {
43
- target[key] = source[key];
44
- }
45
- }
41
+ const getUID = prefix => {
42
+ do {
43
+ prefix += Math.floor(Math.random() * MAX_UID);
44
+ } while (document.getElementById(prefix));
45
+
46
+ return prefix;
47
+ };
48
+
49
+ const getSelector = element => {
50
+ let selector = element.getAttribute('data-bs-target');
51
+
52
+ if (!selector || selector === '#') {
53
+ let hrefAttr = element.getAttribute('href'); // The only valid content that could double as a selector are IDs or classes,
54
+ // so everything starting with `#` or `.`. If a "real" URL is used as the selector,
55
+ // `document.querySelector` will rightfully complain it is invalid.
56
+ // See https://github.com/twbs/bootstrap/issues/32273
57
+
58
+ if (!hrefAttr || !hrefAttr.includes('#') && !hrefAttr.startsWith('.')) {
59
+ return null;
60
+ } // Just in case some CMS puts out a full URL with the anchor appended
61
+
62
+
63
+ if (hrefAttr.includes('#') && !hrefAttr.startsWith('#')) {
64
+ hrefAttr = `#${hrefAttr.split('#')[1]}`;
46
65
  }
47
66
 
48
- return target;
49
- };
50
- return _extends.apply(this, arguments);
51
- }
67
+ selector = hrefAttr && hrefAttr !== '#' ? hrefAttr.trim() : null;
68
+ }
69
+
70
+ return selector;
71
+ };
72
+
73
+ const getSelectorFromElement = element => {
74
+ const selector = getSelector(element);
75
+
76
+ if (selector) {
77
+ return document.querySelector(selector) ? selector : null;
78
+ }
79
+
80
+ return null;
81
+ };
82
+
83
+ const isElement = obj => (obj[0] || obj).nodeType;
84
+
85
+ const typeCheckConfig = (componentName, config, configTypes) => {
86
+ Object.keys(configTypes).forEach(property => {
87
+ const expectedTypes = configTypes[property];
88
+ const value = config[property];
89
+ const valueType = value && isElement(value) ? 'element' : toType(value);
90
+
91
+ if (!new RegExp(expectedTypes).test(valueType)) {
92
+ throw new TypeError(`${componentName.toUpperCase()}: Option "${property}" provided type "${valueType}" but expected type "${expectedTypes}".`);
93
+ }
94
+ });
95
+ };
96
+
97
+ const getjQuery = () => {
98
+ const {
99
+ jQuery
100
+ } = window;
101
+
102
+ if (jQuery && !document.body.hasAttribute('data-bs-no-jquery')) {
103
+ return jQuery;
104
+ }
105
+
106
+ return null;
107
+ };
108
+
109
+ const onDOMContentLoaded = callback => {
110
+ if (document.readyState === 'loading') {
111
+ document.addEventListener('DOMContentLoaded', callback);
112
+ } else {
113
+ callback();
114
+ }
115
+ };
116
+
117
+ const defineJQueryPlugin = (name, plugin) => {
118
+ onDOMContentLoaded(() => {
119
+ const $ = getjQuery();
120
+ /* istanbul ignore if */
121
+
122
+ if ($) {
123
+ const JQUERY_NO_CONFLICT = $.fn[name];
124
+ $.fn[name] = plugin.jQueryInterface;
125
+ $.fn[name].Constructor = plugin;
126
+
127
+ $.fn[name].noConflict = () => {
128
+ $.fn[name] = JQUERY_NO_CONFLICT;
129
+ return plugin.jQueryInterface;
130
+ };
131
+ }
132
+ });
133
+ };
52
134
 
53
135
  /**
136
+ * --------------------------------------------------------------------------
137
+ * Bootstrap (v5.0.0): scrollspy.js
138
+ * Licensed under MIT (https://github.com/twbs/bootstrap/blob/main/LICENSE)
139
+ * --------------------------------------------------------------------------
140
+ */
141
+ /**
142
+ * ------------------------------------------------------------------------
54
143
  * Constants
144
+ * ------------------------------------------------------------------------
55
145
  */
56
146
 
57
- var NAME = 'scrollspy';
58
- var VERSION = '4.6.2';
59
- var DATA_KEY = 'bs.scrollspy';
60
- var EVENT_KEY = "." + DATA_KEY;
61
- var DATA_API_KEY = '.data-api';
62
- var JQUERY_NO_CONFLICT = $__default["default"].fn[NAME];
63
- var CLASS_NAME_DROPDOWN_ITEM = 'dropdown-item';
64
- var CLASS_NAME_ACTIVE = 'active';
65
- var EVENT_ACTIVATE = "activate" + EVENT_KEY;
66
- var EVENT_SCROLL = "scroll" + EVENT_KEY;
67
- var EVENT_LOAD_DATA_API = "load" + EVENT_KEY + DATA_API_KEY;
68
- var METHOD_OFFSET = 'offset';
69
- var METHOD_POSITION = 'position';
70
- var SELECTOR_DATA_SPY = '[data-spy="scroll"]';
71
- var SELECTOR_NAV_LIST_GROUP = '.nav, .list-group';
72
- var SELECTOR_NAV_LINKS = '.nav-link';
73
- var SELECTOR_NAV_ITEMS = '.nav-item';
74
- var SELECTOR_LIST_ITEMS = '.list-group-item';
75
- var SELECTOR_DROPDOWN = '.dropdown';
76
- var SELECTOR_DROPDOWN_ITEMS = '.dropdown-item';
77
- var SELECTOR_DROPDOWN_TOGGLE = '.dropdown-toggle';
78
- var Default = {
147
+ const NAME = 'scrollspy';
148
+ const DATA_KEY = 'bs.scrollspy';
149
+ const EVENT_KEY = `.${DATA_KEY}`;
150
+ const DATA_API_KEY = '.data-api';
151
+ const Default = {
79
152
  offset: 10,
80
153
  method: 'auto',
81
154
  target: ''
82
155
  };
83
- var DefaultType = {
156
+ const DefaultType = {
84
157
  offset: 'number',
85
158
  method: 'string',
86
159
  target: '(string|element)'
87
160
  };
161
+ const EVENT_ACTIVATE = `activate${EVENT_KEY}`;
162
+ const EVENT_SCROLL = `scroll${EVENT_KEY}`;
163
+ const EVENT_LOAD_DATA_API = `load${EVENT_KEY}${DATA_API_KEY}`;
164
+ const CLASS_NAME_DROPDOWN_ITEM = 'dropdown-item';
165
+ const CLASS_NAME_ACTIVE = 'active';
166
+ const SELECTOR_DATA_SPY = '[data-bs-spy="scroll"]';
167
+ const SELECTOR_NAV_LIST_GROUP = '.nav, .list-group';
168
+ const SELECTOR_NAV_LINKS = '.nav-link';
169
+ const SELECTOR_NAV_ITEMS = '.nav-item';
170
+ const SELECTOR_LIST_ITEMS = '.list-group-item';
171
+ const SELECTOR_DROPDOWN = '.dropdown';
172
+ const SELECTOR_DROPDOWN_TOGGLE = '.dropdown-toggle';
173
+ const METHOD_OFFSET = 'offset';
174
+ const METHOD_POSITION = 'position';
88
175
  /**
89
- * Class definition
176
+ * ------------------------------------------------------------------------
177
+ * Class Definition
178
+ * ------------------------------------------------------------------------
90
179
  */
91
180
 
92
- var ScrollSpy = /*#__PURE__*/function () {
93
- function ScrollSpy(element, config) {
94
- var _this = this;
95
-
96
- this._element = element;
97
- this._scrollElement = element.tagName === 'BODY' ? window : element;
181
+ class ScrollSpy extends BaseComponent__default['default'] {
182
+ constructor(element, config) {
183
+ super(element);
184
+ this._scrollElement = this._element.tagName === 'BODY' ? window : this._element;
98
185
  this._config = this._getConfig(config);
99
- this._selector = this._config.target + " " + SELECTOR_NAV_LINKS + "," + (this._config.target + " " + SELECTOR_LIST_ITEMS + ",") + (this._config.target + " " + SELECTOR_DROPDOWN_ITEMS);
186
+ this._selector = `${this._config.target} ${SELECTOR_NAV_LINKS}, ${this._config.target} ${SELECTOR_LIST_ITEMS}, ${this._config.target} .${CLASS_NAME_DROPDOWN_ITEM}`;
100
187
  this._offsets = [];
101
188
  this._targets = [];
102
189
  this._activeTarget = null;
103
190
  this._scrollHeight = 0;
104
- $__default["default"](this._scrollElement).on(EVENT_SCROLL, function (event) {
105
- return _this._process(event);
106
- });
191
+ EventHandler__default['default'].on(this._scrollElement, EVENT_SCROLL, () => this._process());
107
192
  this.refresh();
108
193
 
109
194
  this._process();
110
195
  } // Getters
111
196
 
112
197
 
113
- var _proto = ScrollSpy.prototype;
198
+ static get Default() {
199
+ return Default;
200
+ }
114
201
 
115
- // Public
116
- _proto.refresh = function refresh() {
117
- var _this2 = this;
202
+ static get DATA_KEY() {
203
+ return DATA_KEY;
204
+ } // Public
118
205
 
119
- var autoMethod = this._scrollElement === this._scrollElement.window ? METHOD_OFFSET : METHOD_POSITION;
120
- var offsetMethod = this._config.method === 'auto' ? autoMethod : this._config.method;
121
- var offsetBase = offsetMethod === METHOD_POSITION ? this._getScrollTop() : 0;
206
+
207
+ refresh() {
208
+ const autoMethod = this._scrollElement === this._scrollElement.window ? METHOD_OFFSET : METHOD_POSITION;
209
+ const offsetMethod = this._config.method === 'auto' ? autoMethod : this._config.method;
210
+ const offsetBase = offsetMethod === METHOD_POSITION ? this._getScrollTop() : 0;
122
211
  this._offsets = [];
123
212
  this._targets = [];
124
213
  this._scrollHeight = this._getScrollHeight();
125
- var targets = [].slice.call(document.querySelectorAll(this._selector));
126
- targets.map(function (element) {
127
- var target;
128
- var targetSelector = Util__default["default"].getSelectorFromElement(element);
129
-
130
- if (targetSelector) {
131
- target = document.querySelector(targetSelector);
132
- }
214
+ const targets = SelectorEngine__default['default'].find(this._selector);
215
+ targets.map(element => {
216
+ const targetSelector = getSelectorFromElement(element);
217
+ const target = targetSelector ? SelectorEngine__default['default'].findOne(targetSelector) : null;
133
218
 
134
219
  if (target) {
135
- var targetBCR = target.getBoundingClientRect();
220
+ const targetBCR = target.getBoundingClientRect();
136
221
 
137
222
  if (targetBCR.width || targetBCR.height) {
138
- // TODO (fat): remove sketch reliance on jQuery position/offset
139
- return [$__default["default"](target)[offsetMethod]().top + offsetBase, targetSelector];
223
+ return [Manipulator__default['default'][offsetMethod](target).top + offsetBase, targetSelector];
140
224
  }
141
225
  }
142
226
 
143
227
  return null;
144
- }).filter(Boolean).sort(function (a, b) {
145
- return a[0] - b[0];
146
- }).forEach(function (item) {
147
- _this2._offsets.push(item[0]);
228
+ }).filter(item => item).sort((a, b) => a[0] - b[0]).forEach(item => {
229
+ this._offsets.push(item[0]);
148
230
 
149
- _this2._targets.push(item[1]);
231
+ this._targets.push(item[1]);
150
232
  });
151
- };
233
+ }
152
234
 
153
- _proto.dispose = function dispose() {
154
- $__default["default"].removeData(this._element, DATA_KEY);
155
- $__default["default"](this._scrollElement).off(EVENT_KEY);
156
- this._element = null;
235
+ dispose() {
236
+ super.dispose();
237
+ EventHandler__default['default'].off(this._scrollElement, EVENT_KEY);
157
238
  this._scrollElement = null;
158
239
  this._config = null;
159
240
  this._selector = null;
@@ -162,51 +243,56 @@
162
243
  this._activeTarget = null;
163
244
  this._scrollHeight = null;
164
245
  } // Private
165
- ;
166
246
 
167
- _proto._getConfig = function _getConfig(config) {
168
- config = _extends({}, Default, typeof config === 'object' && config ? config : {});
169
247
 
170
- if (typeof config.target !== 'string' && Util__default["default"].isElement(config.target)) {
171
- var id = $__default["default"](config.target).attr('id');
248
+ _getConfig(config) {
249
+ config = { ...Default,
250
+ ...Manipulator__default['default'].getDataAttributes(this._element),
251
+ ...(typeof config === 'object' && config ? config : {})
252
+ };
253
+
254
+ if (typeof config.target !== 'string' && isElement(config.target)) {
255
+ let {
256
+ id
257
+ } = config.target;
172
258
 
173
259
  if (!id) {
174
- id = Util__default["default"].getUID(NAME);
175
- $__default["default"](config.target).attr('id', id);
260
+ id = getUID(NAME);
261
+ config.target.id = id;
176
262
  }
177
263
 
178
- config.target = "#" + id;
264
+ config.target = `#${id}`;
179
265
  }
180
266
 
181
- Util__default["default"].typeCheckConfig(NAME, config, DefaultType);
267
+ typeCheckConfig(NAME, config, DefaultType);
182
268
  return config;
183
- };
269
+ }
184
270
 
185
- _proto._getScrollTop = function _getScrollTop() {
271
+ _getScrollTop() {
186
272
  return this._scrollElement === window ? this._scrollElement.pageYOffset : this._scrollElement.scrollTop;
187
- };
273
+ }
188
274
 
189
- _proto._getScrollHeight = function _getScrollHeight() {
275
+ _getScrollHeight() {
190
276
  return this._scrollElement.scrollHeight || Math.max(document.body.scrollHeight, document.documentElement.scrollHeight);
191
- };
277
+ }
192
278
 
193
- _proto._getOffsetHeight = function _getOffsetHeight() {
279
+ _getOffsetHeight() {
194
280
  return this._scrollElement === window ? window.innerHeight : this._scrollElement.getBoundingClientRect().height;
195
- };
281
+ }
196
282
 
197
- _proto._process = function _process() {
198
- var scrollTop = this._getScrollTop() + this._config.offset;
283
+ _process() {
284
+ const scrollTop = this._getScrollTop() + this._config.offset;
199
285
 
200
- var scrollHeight = this._getScrollHeight();
286
+ const scrollHeight = this._getScrollHeight();
201
287
 
202
- var maxScroll = this._config.offset + scrollHeight - this._getOffsetHeight();
288
+ const maxScroll = this._config.offset + scrollHeight - this._getOffsetHeight();
203
289
 
204
290
  if (this._scrollHeight !== scrollHeight) {
205
291
  this.refresh();
206
292
  }
207
293
 
208
294
  if (scrollTop >= maxScroll) {
209
- var target = this._targets[this._targets.length - 1];
295
+ const target = this._targets[this._targets.length - 1];
210
296
 
211
297
  if (this._activeTarget !== target) {
212
298
  this._activate(target);
@@ -223,115 +309,87 @@
223
309
  return;
224
310
  }
225
311
 
226
- for (var i = this._offsets.length; i--;) {
227
- var isActiveTarget = this._activeTarget !== this._targets[i] && scrollTop >= this._offsets[i] && (typeof this._offsets[i + 1] === 'undefined' || scrollTop < this._offsets[i + 1]);
312
+ for (let i = this._offsets.length; i--;) {
313
+ const isActiveTarget = this._activeTarget !== this._targets[i] && scrollTop >= this._offsets[i] && (typeof this._offsets[i + 1] === 'undefined' || scrollTop < this._offsets[i + 1]);
228
314
 
229
315
  if (isActiveTarget) {
230
316
  this._activate(this._targets[i]);
231
317
  }
232
318
  }
233
- };
319
+ }
234
320
 
235
- _proto._activate = function _activate(target) {
321
+ _activate(target) {
236
322
  this._activeTarget = target;
237
323
 
238
324
  this._clear();
239
325
 
240
- var queries = this._selector.split(',').map(function (selector) {
241
- return selector + "[data-target=\"" + target + "\"]," + selector + "[href=\"" + target + "\"]";
242
- });
326
+ const queries = this._selector.split(',').map(selector => `${selector}[data-bs-target="${target}"],${selector}[href="${target}"]`);
243
327
 
244
- var $link = $__default["default"]([].slice.call(document.querySelectorAll(queries.join(','))));
328
+ const link = SelectorEngine__default['default'].findOne(queries.join(','));
245
329
 
246
- if ($link.hasClass(CLASS_NAME_DROPDOWN_ITEM)) {
247
- $link.closest(SELECTOR_DROPDOWN).find(SELECTOR_DROPDOWN_TOGGLE).addClass(CLASS_NAME_ACTIVE);
248
- $link.addClass(CLASS_NAME_ACTIVE);
330
+ if (link.classList.contains(CLASS_NAME_DROPDOWN_ITEM)) {
331
+ SelectorEngine__default['default'].findOne(SELECTOR_DROPDOWN_TOGGLE, link.closest(SELECTOR_DROPDOWN)).classList.add(CLASS_NAME_ACTIVE);
332
+ link.classList.add(CLASS_NAME_ACTIVE);
249
333
  } else {
250
334
  // Set triggered link as active
251
- $link.addClass(CLASS_NAME_ACTIVE); // Set triggered links parents as active
252
- // With both <ul> and <nav> markup a parent is the previous sibling of any nav ancestor
253
-
254
- $link.parents(SELECTOR_NAV_LIST_GROUP).prev(SELECTOR_NAV_LINKS + ", " + SELECTOR_LIST_ITEMS).addClass(CLASS_NAME_ACTIVE); // Handle special case when .nav-link is inside .nav-item
255
-
256
- $link.parents(SELECTOR_NAV_LIST_GROUP).prev(SELECTOR_NAV_ITEMS).children(SELECTOR_NAV_LINKS).addClass(CLASS_NAME_ACTIVE);
335
+ link.classList.add(CLASS_NAME_ACTIVE);
336
+ SelectorEngine__default['default'].parents(link, SELECTOR_NAV_LIST_GROUP).forEach(listGroup => {
337
+ // Set triggered links parents as active
338
+ // With both <ul> and <nav> markup a parent is the previous sibling of any nav ancestor
339
+ SelectorEngine__default['default'].prev(listGroup, `${SELECTOR_NAV_LINKS}, ${SELECTOR_LIST_ITEMS}`).forEach(item => item.classList.add(CLASS_NAME_ACTIVE)); // Handle special case when .nav-link is inside .nav-item
340
+
341
+ SelectorEngine__default['default'].prev(listGroup, SELECTOR_NAV_ITEMS).forEach(navItem => {
342
+ SelectorEngine__default['default'].children(navItem, SELECTOR_NAV_LINKS).forEach(item => item.classList.add(CLASS_NAME_ACTIVE));
343
+ });
344
+ });
257
345
  }
258
346
 
259
- $__default["default"](this._scrollElement).trigger(EVENT_ACTIVATE, {
347
+ EventHandler__default['default'].trigger(this._scrollElement, EVENT_ACTIVATE, {
260
348
  relatedTarget: target
261
349
  });
262
- };
350
+ }
263
351
 
264
- _proto._clear = function _clear() {
265
- [].slice.call(document.querySelectorAll(this._selector)).filter(function (node) {
266
- return node.classList.contains(CLASS_NAME_ACTIVE);
267
- }).forEach(function (node) {
268
- return node.classList.remove(CLASS_NAME_ACTIVE);
269
- });
352
+ _clear() {
353
+ SelectorEngine__default['default'].find(this._selector).filter(node => node.classList.contains(CLASS_NAME_ACTIVE)).forEach(node => node.classList.remove(CLASS_NAME_ACTIVE));
270
354
  } // Static
271
- ;
272
355
 
273
- ScrollSpy._jQueryInterface = function _jQueryInterface(config) {
274
- return this.each(function () {
275
- var data = $__default["default"](this).data(DATA_KEY);
276
356
 
277
- var _config = typeof config === 'object' && config;
357
+ static jQueryInterface(config) {
358
+ return this.each(function () {
359
+ const data = ScrollSpy.getInstance(this) || new ScrollSpy(this, typeof config === 'object' ? config : {});
278
360
 
279
- if (!data) {
280
- data = new ScrollSpy(this, _config);
281
- $__default["default"](this).data(DATA_KEY, data);
361
+ if (typeof config !== 'string') {
362
+ return;
282
363
  }
283
364
 
284
- if (typeof config === 'string') {
285
- if (typeof data[config] === 'undefined') {
286
- throw new TypeError("No method named \"" + config + "\"");
287
- }
288
-
289
- data[config]();
365
+ if (typeof data[config] === 'undefined') {
366
+ throw new TypeError(`No method named "${config}"`);
290
367
  }
291
- });
292
- };
293
368
 
294
- _createClass(ScrollSpy, null, [{
295
- key: "VERSION",
296
- get: function get() {
297
- return VERSION;
298
- }
299
- }, {
300
- key: "Default",
301
- get: function get() {
302
- return Default;
303
- }
304
- }]);
369
+ data[config]();
370
+ });
371
+ }
305
372
 
306
- return ScrollSpy;
307
- }();
373
+ }
308
374
  /**
309
- * Data API implementation
375
+ * ------------------------------------------------------------------------
376
+ * Data Api implementation
377
+ * ------------------------------------------------------------------------
310
378
  */
311
379
 
312
380
 
313
- $__default["default"](window).on(EVENT_LOAD_DATA_API, function () {
314
- var scrollSpys = [].slice.call(document.querySelectorAll(SELECTOR_DATA_SPY));
315
- var scrollSpysLength = scrollSpys.length;
316
-
317
- for (var i = scrollSpysLength; i--;) {
318
- var $spy = $__default["default"](scrollSpys[i]);
319
-
320
- ScrollSpy._jQueryInterface.call($spy, $spy.data());
321
- }
381
+ EventHandler__default['default'].on(window, EVENT_LOAD_DATA_API, () => {
382
+ SelectorEngine__default['default'].find(SELECTOR_DATA_SPY).forEach(spy => new ScrollSpy(spy));
322
383
  });
323
384
  /**
385
+ * ------------------------------------------------------------------------
324
386
  * jQuery
387
+ * ------------------------------------------------------------------------
388
+ * add .ScrollSpy to jQuery only if jQuery is present
325
389
  */
326
390
 
327
- $__default["default"].fn[NAME] = ScrollSpy._jQueryInterface;
328
- $__default["default"].fn[NAME].Constructor = ScrollSpy;
329
-
330
- $__default["default"].fn[NAME].noConflict = function () {
331
- $__default["default"].fn[NAME] = JQUERY_NO_CONFLICT;
332
- return ScrollSpy._jQueryInterface;
333
- };
391
+ defineJQueryPlugin(NAME, ScrollSpy);
334
392
 
335
393
  return ScrollSpy;
336
394
 
337
- }));
395
+ })));