bootstrap 5.2.3 → 5.3.0.alpha3

Sign up to get free protection for your applications and to get access to all the features.
Files changed (83) hide show
  1. checksums.yaml +4 -4
  2. data/README.md +1 -1
  3. data/assets/javascripts/bootstrap/alert.js +21 -32
  4. data/assets/javascripts/bootstrap/base-component.js +21 -38
  5. data/assets/javascripts/bootstrap/button.js +18 -22
  6. data/assets/javascripts/bootstrap/carousel.js +51 -135
  7. data/assets/javascripts/bootstrap/collapse.js +39 -102
  8. data/assets/javascripts/bootstrap/dom/data.js +8 -12
  9. data/assets/javascripts/bootstrap/dom/event-handler.js +18 -66
  10. data/assets/javascripts/bootstrap/dom/manipulator.js +4 -17
  11. data/assets/javascripts/bootstrap/dom/selector-engine.js +41 -24
  12. data/assets/javascripts/bootstrap/dropdown.js +73 -145
  13. data/assets/javascripts/bootstrap/modal.js +52 -133
  14. data/assets/javascripts/bootstrap/offcanvas.js +49 -102
  15. data/assets/javascripts/bootstrap/popover.js +22 -29
  16. data/assets/javascripts/bootstrap/scrollspy.js +51 -89
  17. data/assets/javascripts/bootstrap/tab.js +51 -109
  18. data/assets/javascripts/bootstrap/toast.js +30 -73
  19. data/assets/javascripts/bootstrap/tooltip.js +74 -177
  20. data/assets/javascripts/bootstrap/util/backdrop.js +27 -54
  21. data/assets/javascripts/bootstrap/util/component-functions.js +13 -19
  22. data/assets/javascripts/bootstrap/util/config.js +14 -27
  23. data/assets/javascripts/bootstrap/util/focustrap.js +19 -36
  24. data/assets/javascripts/bootstrap/util/index.js +42 -111
  25. data/assets/javascripts/bootstrap/util/sanitizer.js +13 -19
  26. data/assets/javascripts/bootstrap/util/scrollbar.js +23 -50
  27. data/assets/javascripts/bootstrap/util/swipe.js +26 -48
  28. data/assets/javascripts/bootstrap/util/template-factory.js +24 -52
  29. data/assets/javascripts/bootstrap-sprockets.js +1 -1
  30. data/assets/javascripts/bootstrap.js +626 -1406
  31. data/assets/javascripts/bootstrap.min.js +3 -3
  32. data/assets/stylesheets/_bootstrap-grid.scss +1 -3
  33. data/assets/stylesheets/_bootstrap-reboot.scss +1 -0
  34. data/assets/stylesheets/_bootstrap.scss +1 -0
  35. data/assets/stylesheets/bootstrap/_accordion.scss +9 -0
  36. data/assets/stylesheets/bootstrap/_alert.scss +8 -11
  37. data/assets/stylesheets/bootstrap/_button-group.scss +2 -2
  38. data/assets/stylesheets/bootstrap/_buttons.scss +3 -3
  39. data/assets/stylesheets/bootstrap/_card.scss +5 -0
  40. data/assets/stylesheets/bootstrap/_carousel.scss +20 -2
  41. data/assets/stylesheets/bootstrap/_close.scss +32 -9
  42. data/assets/stylesheets/bootstrap/_dropdown.scss +1 -0
  43. data/assets/stylesheets/bootstrap/_functions.scss +1 -1
  44. data/assets/stylesheets/bootstrap/_grid.scss +6 -0
  45. data/assets/stylesheets/bootstrap/_helpers.scss +2 -0
  46. data/assets/stylesheets/bootstrap/_list-group.scss +12 -7
  47. data/assets/stylesheets/bootstrap/_maps.scss +120 -0
  48. data/assets/stylesheets/bootstrap/_mixins.scss +1 -2
  49. data/assets/stylesheets/bootstrap/_nav.scss +40 -3
  50. data/assets/stylesheets/bootstrap/_navbar.scss +13 -3
  51. data/assets/stylesheets/bootstrap/_offcanvas.scss +4 -2
  52. data/assets/stylesheets/bootstrap/_pagination.scss +1 -1
  53. data/assets/stylesheets/bootstrap/_progress.scss +10 -1
  54. data/assets/stylesheets/bootstrap/_reboot.scss +3 -3
  55. data/assets/stylesheets/bootstrap/_root.scss +125 -10
  56. data/assets/stylesheets/bootstrap/_tables.scss +1 -1
  57. data/assets/stylesheets/bootstrap/_tooltip.scss +4 -5
  58. data/assets/stylesheets/bootstrap/_utilities.scss +172 -13
  59. data/assets/stylesheets/bootstrap/_variables-dark.scss +85 -0
  60. data/assets/stylesheets/bootstrap/_variables.scss +260 -151
  61. data/assets/stylesheets/bootstrap/bootstrap-utilities.scss +1 -0
  62. data/assets/stylesheets/bootstrap/forms/_floating-labels.scss +21 -3
  63. data/assets/stylesheets/bootstrap/forms/_form-check.scss +24 -11
  64. data/assets/stylesheets/bootstrap/forms/_form-control.scss +23 -3
  65. data/assets/stylesheets/bootstrap/forms/_form-select.scss +11 -2
  66. data/assets/stylesheets/bootstrap/forms/_input-group.scss +1 -1
  67. data/assets/stylesheets/bootstrap/helpers/_colored-links.scss +22 -2
  68. data/assets/stylesheets/bootstrap/helpers/_focus-ring.scss +5 -0
  69. data/assets/stylesheets/bootstrap/helpers/_icon-link.scss +25 -0
  70. data/assets/stylesheets/bootstrap/mixins/_alert.scss +4 -1
  71. data/assets/stylesheets/bootstrap/mixins/_banner.scss +2 -4
  72. data/assets/stylesheets/bootstrap/mixins/_caret.scss +30 -25
  73. data/assets/stylesheets/bootstrap/mixins/_color-mode.scss +21 -0
  74. data/assets/stylesheets/bootstrap/mixins/_forms.scss +8 -7
  75. data/assets/stylesheets/bootstrap/mixins/_list-group.scss +2 -0
  76. data/assets/stylesheets/bootstrap/mixins/_utilities.scss +1 -1
  77. data/assets/stylesheets/bootstrap/mixins/_visually-hidden.scss +5 -1
  78. data/assets/stylesheets/bootstrap/vendor/_rfs.scss +23 -29
  79. data/bootstrap.gemspec +1 -1
  80. data/lib/bootstrap/version.rb +2 -2
  81. data/tasks/updater/js.rb +1 -1
  82. data/tasks/updater/scss.rb +1 -1
  83. metadata +10 -6
@@ -1,26 +1,21 @@
1
1
  /*!
2
- * Bootstrap scrollspy.js v5.2.3 (https://getbootstrap.com/)
3
- * Copyright 2011-2022 The Bootstrap Authors (https://github.com/twbs/bootstrap/graphs/contributors)
2
+ * Bootstrap scrollspy.js v5.3.0-alpha3 (https://getbootstrap.com/)
3
+ * Copyright 2011-2023 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('./util/index'), require('./dom/event-handler'), require('./dom/selector-engine'), require('./base-component')) :
8
- typeof define === 'function' && define.amd ? define(['./util/index', './dom/event-handler', './dom/selector-engine', './base-component'], factory) :
9
- (global = typeof globalThis !== 'undefined' ? globalThis : global || self, global.Scrollspy = factory(global.Index, global.EventHandler, global.SelectorEngine, global.BaseComponent));
10
- })(this, (function (index, EventHandler, SelectorEngine, BaseComponent) { 'use strict';
11
-
12
- const _interopDefaultLegacy = e => e && typeof e === 'object' && 'default' in e ? e : { default: e };
13
-
14
- const EventHandler__default = /*#__PURE__*/_interopDefaultLegacy(EventHandler);
15
- const SelectorEngine__default = /*#__PURE__*/_interopDefaultLegacy(SelectorEngine);
16
- const BaseComponent__default = /*#__PURE__*/_interopDefaultLegacy(BaseComponent);
7
+ typeof exports === 'object' && typeof module !== 'undefined' ? module.exports = factory(require('./base-component.js'), require('./dom/event-handler.js'), require('./dom/selector-engine.js'), require('./util/index.js')) :
8
+ typeof define === 'function' && define.amd ? define(['./base-component', './dom/event-handler', './dom/selector-engine', './util/index'], factory) :
9
+ (global = typeof globalThis !== 'undefined' ? globalThis : global || self, global.Scrollspy = factory(global.BaseComponent, global.EventHandler, global.SelectorEngine, global.Index));
10
+ })(this, (function (BaseComponent, EventHandler, SelectorEngine, index_js) { 'use strict';
17
11
 
18
12
  /**
19
13
  * --------------------------------------------------------------------------
20
- * Bootstrap (v5.2.3): scrollspy.js
14
+ * Bootstrap scrollspy.js
21
15
  * Licensed under MIT (https://github.com/twbs/bootstrap/blob/main/LICENSE)
22
16
  * --------------------------------------------------------------------------
23
17
  */
18
+
24
19
  /**
25
20
  * Constants
26
21
  */
@@ -59,14 +54,16 @@
59
54
  target: 'element',
60
55
  threshold: 'array'
61
56
  };
57
+
62
58
  /**
63
59
  * Class definition
64
60
  */
65
61
 
66
- class ScrollSpy extends BaseComponent__default.default {
62
+ class ScrollSpy extends BaseComponent {
67
63
  constructor(element, config) {
68
- super(element, config); // this._element is the observablesContainer and config.target the menu links wrapper
64
+ super(element, config);
69
65
 
66
+ // this._element is the observablesContainer and config.target the menu links wrapper
70
67
  this._targetLinks = new Map();
71
68
  this._observableSections = new Map();
72
69
  this._rootElement = getComputedStyle(this._element).overflowY === 'visible' ? null : this._element;
@@ -77,87 +74,75 @@
77
74
  parentScrollTop: 0
78
75
  };
79
76
  this.refresh(); // initialize
80
- } // Getters
81
-
77
+ }
82
78
 
79
+ // Getters
83
80
  static get Default() {
84
81
  return Default;
85
82
  }
86
-
87
83
  static get DefaultType() {
88
84
  return DefaultType;
89
85
  }
90
-
91
86
  static get NAME() {
92
87
  return NAME;
93
- } // Public
94
-
88
+ }
95
89
 
90
+ // Public
96
91
  refresh() {
97
92
  this._initializeTargetsAndObservables();
98
-
99
93
  this._maybeEnableSmoothScroll();
100
-
101
94
  if (this._observer) {
102
95
  this._observer.disconnect();
103
96
  } else {
104
97
  this._observer = this._getNewObserver();
105
98
  }
106
-
107
99
  for (const section of this._observableSections.values()) {
108
100
  this._observer.observe(section);
109
101
  }
110
102
  }
111
-
112
103
  dispose() {
113
104
  this._observer.disconnect();
114
-
115
105
  super.dispose();
116
- } // Private
117
-
106
+ }
118
107
 
108
+ // Private
119
109
  _configAfterMerge(config) {
120
110
  // TODO: on v6 target should be given explicitly & remove the {target: 'ss-target'} case
121
- config.target = index.getElement(config.target) || document.body; // TODO: v6 Only for backwards compatibility reasons. Use rootMargin only
111
+ config.target = index_js.getElement(config.target) || document.body;
122
112
 
113
+ // TODO: v6 Only for backwards compatibility reasons. Use rootMargin only
123
114
  config.rootMargin = config.offset ? `${config.offset}px 0px -30%` : config.rootMargin;
124
-
125
115
  if (typeof config.threshold === 'string') {
126
116
  config.threshold = config.threshold.split(',').map(value => Number.parseFloat(value));
127
117
  }
128
-
129
118
  return config;
130
119
  }
131
-
132
120
  _maybeEnableSmoothScroll() {
133
121
  if (!this._config.smoothScroll) {
134
122
  return;
135
- } // unregister any previous listeners
136
-
123
+ }
137
124
 
138
- EventHandler__default.default.off(this._config.target, EVENT_CLICK);
139
- EventHandler__default.default.on(this._config.target, EVENT_CLICK, SELECTOR_TARGET_LINKS, event => {
125
+ // unregister any previous listeners
126
+ EventHandler.off(this._config.target, EVENT_CLICK);
127
+ EventHandler.on(this._config.target, EVENT_CLICK, SELECTOR_TARGET_LINKS, event => {
140
128
  const observableSection = this._observableSections.get(event.target.hash);
141
-
142
129
  if (observableSection) {
143
130
  event.preventDefault();
144
131
  const root = this._rootElement || window;
145
132
  const height = observableSection.offsetTop - this._element.offsetTop;
146
-
147
133
  if (root.scrollTo) {
148
134
  root.scrollTo({
149
135
  top: height,
150
136
  behavior: 'smooth'
151
137
  });
152
138
  return;
153
- } // Chrome 60 doesn't support `scrollTo`
154
-
139
+ }
155
140
 
141
+ // Chrome 60 doesn't support `scrollTo`
156
142
  root.scrollTop = height;
157
143
  }
158
144
  });
159
145
  }
160
-
161
146
  _getNewObserver() {
162
147
  const options = {
163
148
  root: this._rootElement,
@@ -165,146 +150,123 @@
165
150
  rootMargin: this._config.rootMargin
166
151
  };
167
152
  return new IntersectionObserver(entries => this._observerCallback(entries), options);
168
- } // The logic of selection
169
-
153
+ }
170
154
 
155
+ // The logic of selection
171
156
  _observerCallback(entries) {
172
157
  const targetElement = entry => this._targetLinks.get(`#${entry.target.id}`);
173
-
174
158
  const activate = entry => {
175
159
  this._previousScrollData.visibleEntryTop = entry.target.offsetTop;
176
-
177
160
  this._process(targetElement(entry));
178
161
  };
179
-
180
162
  const parentScrollTop = (this._rootElement || document.documentElement).scrollTop;
181
163
  const userScrollsDown = parentScrollTop >= this._previousScrollData.parentScrollTop;
182
164
  this._previousScrollData.parentScrollTop = parentScrollTop;
183
-
184
165
  for (const entry of entries) {
185
166
  if (!entry.isIntersecting) {
186
167
  this._activeTarget = null;
187
-
188
168
  this._clearActiveClass(targetElement(entry));
189
-
190
169
  continue;
191
170
  }
192
-
193
- const entryIsLowerThanPrevious = entry.target.offsetTop >= this._previousScrollData.visibleEntryTop; // if we are scrolling down, pick the bigger offsetTop
194
-
171
+ const entryIsLowerThanPrevious = entry.target.offsetTop >= this._previousScrollData.visibleEntryTop;
172
+ // if we are scrolling down, pick the bigger offsetTop
195
173
  if (userScrollsDown && entryIsLowerThanPrevious) {
196
- activate(entry); // if parent isn't scrolled, let's keep the first visible item, breaking the iteration
197
-
174
+ activate(entry);
175
+ // if parent isn't scrolled, let's keep the first visible item, breaking the iteration
198
176
  if (!parentScrollTop) {
199
177
  return;
200
178
  }
201
-
202
179
  continue;
203
- } // if we are scrolling up, pick the smallest offsetTop
204
-
180
+ }
205
181
 
182
+ // if we are scrolling up, pick the smallest offsetTop
206
183
  if (!userScrollsDown && !entryIsLowerThanPrevious) {
207
184
  activate(entry);
208
185
  }
209
186
  }
210
187
  }
211
-
212
188
  _initializeTargetsAndObservables() {
213
189
  this._targetLinks = new Map();
214
190
  this._observableSections = new Map();
215
- const targetLinks = SelectorEngine__default.default.find(SELECTOR_TARGET_LINKS, this._config.target);
216
-
191
+ const targetLinks = SelectorEngine.find(SELECTOR_TARGET_LINKS, this._config.target);
217
192
  for (const anchor of targetLinks) {
218
193
  // ensure that the anchor has an id and is not disabled
219
- if (!anchor.hash || index.isDisabled(anchor)) {
194
+ if (!anchor.hash || index_js.isDisabled(anchor)) {
220
195
  continue;
221
196
  }
197
+ const observableSection = SelectorEngine.findOne(anchor.hash, this._element);
222
198
 
223
- const observableSection = SelectorEngine__default.default.findOne(anchor.hash, this._element); // ensure that the observableSection exists & is visible
224
-
225
- if (index.isVisible(observableSection)) {
199
+ // ensure that the observableSection exists & is visible
200
+ if (index_js.isVisible(observableSection)) {
226
201
  this._targetLinks.set(anchor.hash, anchor);
227
-
228
202
  this._observableSections.set(anchor.hash, observableSection);
229
203
  }
230
204
  }
231
205
  }
232
-
233
206
  _process(target) {
234
207
  if (this._activeTarget === target) {
235
208
  return;
236
209
  }
237
-
238
210
  this._clearActiveClass(this._config.target);
239
-
240
211
  this._activeTarget = target;
241
212
  target.classList.add(CLASS_NAME_ACTIVE);
242
-
243
213
  this._activateParents(target);
244
-
245
- EventHandler__default.default.trigger(this._element, EVENT_ACTIVATE, {
214
+ EventHandler.trigger(this._element, EVENT_ACTIVATE, {
246
215
  relatedTarget: target
247
216
  });
248
217
  }
249
-
250
218
  _activateParents(target) {
251
219
  // Activate dropdown parents
252
220
  if (target.classList.contains(CLASS_NAME_DROPDOWN_ITEM)) {
253
- SelectorEngine__default.default.findOne(SELECTOR_DROPDOWN_TOGGLE, target.closest(SELECTOR_DROPDOWN)).classList.add(CLASS_NAME_ACTIVE);
221
+ SelectorEngine.findOne(SELECTOR_DROPDOWN_TOGGLE, target.closest(SELECTOR_DROPDOWN)).classList.add(CLASS_NAME_ACTIVE);
254
222
  return;
255
223
  }
256
-
257
- for (const listGroup of SelectorEngine__default.default.parents(target, SELECTOR_NAV_LIST_GROUP)) {
224
+ for (const listGroup of SelectorEngine.parents(target, SELECTOR_NAV_LIST_GROUP)) {
258
225
  // Set triggered links parents as active
259
226
  // With both <ul> and <nav> markup a parent is the previous sibling of any nav ancestor
260
- for (const item of SelectorEngine__default.default.prev(listGroup, SELECTOR_LINK_ITEMS)) {
227
+ for (const item of SelectorEngine.prev(listGroup, SELECTOR_LINK_ITEMS)) {
261
228
  item.classList.add(CLASS_NAME_ACTIVE);
262
229
  }
263
230
  }
264
231
  }
265
-
266
232
  _clearActiveClass(parent) {
267
233
  parent.classList.remove(CLASS_NAME_ACTIVE);
268
- const activeNodes = SelectorEngine__default.default.find(`${SELECTOR_TARGET_LINKS}.${CLASS_NAME_ACTIVE}`, parent);
269
-
234
+ const activeNodes = SelectorEngine.find(`${SELECTOR_TARGET_LINKS}.${CLASS_NAME_ACTIVE}`, parent);
270
235
  for (const node of activeNodes) {
271
236
  node.classList.remove(CLASS_NAME_ACTIVE);
272
237
  }
273
- } // Static
274
-
238
+ }
275
239
 
240
+ // Static
276
241
  static jQueryInterface(config) {
277
242
  return this.each(function () {
278
243
  const data = ScrollSpy.getOrCreateInstance(this, config);
279
-
280
244
  if (typeof config !== 'string') {
281
245
  return;
282
246
  }
283
-
284
247
  if (data[config] === undefined || config.startsWith('_') || config === 'constructor') {
285
248
  throw new TypeError(`No method named "${config}"`);
286
249
  }
287
-
288
250
  data[config]();
289
251
  });
290
252
  }
291
-
292
253
  }
254
+
293
255
  /**
294
256
  * Data API implementation
295
257
  */
296
258
 
297
-
298
- EventHandler__default.default.on(window, EVENT_LOAD_DATA_API, () => {
299
- for (const spy of SelectorEngine__default.default.find(SELECTOR_DATA_SPY)) {
259
+ EventHandler.on(window, EVENT_LOAD_DATA_API, () => {
260
+ for (const spy of SelectorEngine.find(SELECTOR_DATA_SPY)) {
300
261
  ScrollSpy.getOrCreateInstance(spy);
301
262
  }
302
263
  });
264
+
303
265
  /**
304
266
  * jQuery
305
267
  */
306
268
 
307
- index.defineJQueryPlugin(ScrollSpy);
269
+ index_js.defineJQueryPlugin(ScrollSpy);
308
270
 
309
271
  return ScrollSpy;
310
272