bootstrap 5.0.0.beta2 → 5.0.0.beta3
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/README.md +1 -1
- data/assets/javascripts/bootstrap-sprockets.js +1 -0
- data/assets/javascripts/bootstrap.js +2051 -2009
- data/assets/javascripts/bootstrap.min.js +2 -2
- data/assets/javascripts/bootstrap/alert.js +75 -118
- data/assets/javascripts/bootstrap/base-component.js +23 -37
- data/assets/javascripts/bootstrap/button.js +39 -78
- data/assets/javascripts/bootstrap/carousel.js +284 -364
- data/assets/javascripts/bootstrap/collapse.js +178 -247
- data/assets/javascripts/bootstrap/dom/data.js +34 -47
- data/assets/javascripts/bootstrap/dom/event-handler.js +71 -77
- data/assets/javascripts/bootstrap/dom/manipulator.js +23 -21
- data/assets/javascripts/bootstrap/dom/selector-engine.js +20 -28
- data/assets/javascripts/bootstrap/dropdown.js +195 -265
- data/assets/javascripts/bootstrap/modal.js +256 -344
- data/assets/javascripts/bootstrap/offcanvas.js +508 -0
- data/assets/javascripts/bootstrap/popover.js +88 -157
- data/assets/javascripts/bootstrap/scrollspy.js +134 -212
- data/assets/javascripts/bootstrap/tab.js +108 -142
- data/assets/javascripts/bootstrap/toast.js +113 -183
- data/assets/javascripts/bootstrap/tooltip.js +297 -392
- data/assets/stylesheets/_bootstrap-grid.scss +1 -1
- data/assets/stylesheets/_bootstrap-reboot.scss +1 -1
- data/assets/stylesheets/_bootstrap.scss +2 -1
- data/assets/stylesheets/bootstrap/_accordion.scss +22 -32
- data/assets/stylesheets/bootstrap/_buttons.scss +2 -0
- data/assets/stylesheets/bootstrap/_card.scss +1 -1
- data/assets/stylesheets/bootstrap/_dropdown.scss +3 -6
- data/assets/stylesheets/bootstrap/_list-group.scss +11 -0
- data/assets/stylesheets/bootstrap/_modal.scss +2 -0
- data/assets/stylesheets/bootstrap/_nav.scss +7 -0
- data/assets/stylesheets/bootstrap/_navbar.scss +2 -0
- data/assets/stylesheets/bootstrap/_offcanvas.scss +77 -0
- data/assets/stylesheets/bootstrap/_progress.scss +3 -0
- data/assets/stylesheets/bootstrap/_reboot.scss +7 -21
- data/assets/stylesheets/bootstrap/_spinners.scss +4 -0
- data/assets/stylesheets/bootstrap/_transitions.scss +2 -0
- data/assets/stylesheets/bootstrap/_utilities.scss +65 -37
- data/assets/stylesheets/bootstrap/_variables.scss +138 -30
- data/assets/stylesheets/bootstrap/bootstrap-utilities.scss +1 -1
- data/assets/stylesheets/bootstrap/forms/_form-control.scss +0 -4
- data/assets/stylesheets/bootstrap/mixins/_alert.scss +2 -0
- data/assets/stylesheets/bootstrap/mixins/_border-radius.scss +2 -0
- data/assets/stylesheets/bootstrap/mixins/_buttons.scss +6 -1
- data/assets/stylesheets/bootstrap/mixins/_caret.scss +2 -0
- data/assets/stylesheets/bootstrap/mixins/_forms.scss +11 -1
- data/assets/stylesheets/bootstrap/mixins/_list-group.scss +2 -0
- data/assets/stylesheets/bootstrap/mixins/_pagination.scss +2 -0
- data/bootstrap.gemspec +1 -1
- data/lib/bootstrap/version.rb +2 -2
- data/tasks/updater/js.rb +1 -1
- data/tasks/updater/network.rb +7 -1
- metadata +6 -4
@@ -1,5 +1,5 @@
|
|
1
1
|
/*!
|
2
|
-
* Bootstrap popover.js v5.0.0-
|
2
|
+
* Bootstrap popover.js v5.0.0-beta3 (https://getbootstrap.com/)
|
3
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
|
*/
|
@@ -15,66 +15,17 @@
|
|
15
15
|
var SelectorEngine__default = /*#__PURE__*/_interopDefaultLegacy(SelectorEngine);
|
16
16
|
var Tooltip__default = /*#__PURE__*/_interopDefaultLegacy(Tooltip);
|
17
17
|
|
18
|
-
function _defineProperties(target, props) {
|
19
|
-
for (var i = 0; i < props.length; i++) {
|
20
|
-
var descriptor = props[i];
|
21
|
-
descriptor.enumerable = descriptor.enumerable || false;
|
22
|
-
descriptor.configurable = true;
|
23
|
-
if ("value" in descriptor) descriptor.writable = true;
|
24
|
-
Object.defineProperty(target, descriptor.key, descriptor);
|
25
|
-
}
|
26
|
-
}
|
27
|
-
|
28
|
-
function _createClass(Constructor, protoProps, staticProps) {
|
29
|
-
if (protoProps) _defineProperties(Constructor.prototype, protoProps);
|
30
|
-
if (staticProps) _defineProperties(Constructor, staticProps);
|
31
|
-
return Constructor;
|
32
|
-
}
|
33
|
-
|
34
|
-
function _extends() {
|
35
|
-
_extends = Object.assign || function (target) {
|
36
|
-
for (var i = 1; i < arguments.length; i++) {
|
37
|
-
var source = arguments[i];
|
38
|
-
|
39
|
-
for (var key in source) {
|
40
|
-
if (Object.prototype.hasOwnProperty.call(source, key)) {
|
41
|
-
target[key] = source[key];
|
42
|
-
}
|
43
|
-
}
|
44
|
-
}
|
45
|
-
|
46
|
-
return target;
|
47
|
-
};
|
48
|
-
|
49
|
-
return _extends.apply(this, arguments);
|
50
|
-
}
|
51
|
-
|
52
|
-
function _inheritsLoose(subClass, superClass) {
|
53
|
-
subClass.prototype = Object.create(superClass.prototype);
|
54
|
-
subClass.prototype.constructor = subClass;
|
55
|
-
|
56
|
-
_setPrototypeOf(subClass, superClass);
|
57
|
-
}
|
58
|
-
|
59
|
-
function _setPrototypeOf(o, p) {
|
60
|
-
_setPrototypeOf = Object.setPrototypeOf || function _setPrototypeOf(o, p) {
|
61
|
-
o.__proto__ = p;
|
62
|
-
return o;
|
63
|
-
};
|
64
|
-
|
65
|
-
return _setPrototypeOf(o, p);
|
66
|
-
}
|
67
|
-
|
68
18
|
/**
|
69
19
|
* --------------------------------------------------------------------------
|
70
|
-
* Bootstrap (v5.0.0-
|
20
|
+
* Bootstrap (v5.0.0-beta3): util/index.js
|
71
21
|
* Licensed under MIT (https://github.com/twbs/bootstrap/blob/main/LICENSE)
|
72
22
|
* --------------------------------------------------------------------------
|
73
23
|
*/
|
74
24
|
|
75
|
-
|
76
|
-
|
77
|
-
|
25
|
+
const getjQuery = () => {
|
26
|
+
const {
|
27
|
+
jQuery
|
28
|
+
} = window;
|
78
29
|
|
79
30
|
if (jQuery && !document.body.hasAttribute('data-bs-no-jquery')) {
|
80
31
|
return jQuery;
|
@@ -83,7 +34,7 @@
|
|
83
34
|
return null;
|
84
35
|
};
|
85
36
|
|
86
|
-
|
37
|
+
const onDOMContentLoaded = callback => {
|
87
38
|
if (document.readyState === 'loading') {
|
88
39
|
document.addEventListener('DOMContentLoaded', callback);
|
89
40
|
} else {
|
@@ -91,19 +42,17 @@
|
|
91
42
|
}
|
92
43
|
};
|
93
44
|
|
94
|
-
|
95
|
-
|
96
|
-
|
97
|
-
onDOMContentLoaded(function () {
|
98
|
-
var $ = getjQuery();
|
45
|
+
const defineJQueryPlugin = (name, plugin) => {
|
46
|
+
onDOMContentLoaded(() => {
|
47
|
+
const $ = getjQuery();
|
99
48
|
/* istanbul ignore if */
|
100
49
|
|
101
50
|
if ($) {
|
102
|
-
|
51
|
+
const JQUERY_NO_CONFLICT = $.fn[name];
|
103
52
|
$.fn[name] = plugin.jQueryInterface;
|
104
53
|
$.fn[name].Constructor = plugin;
|
105
54
|
|
106
|
-
$.fn[name].noConflict =
|
55
|
+
$.fn[name].noConflict = () => {
|
107
56
|
$.fn[name] = JQUERY_NO_CONFLICT;
|
108
57
|
return plugin.jQueryInterface;
|
109
58
|
};
|
@@ -111,72 +60,92 @@
|
|
111
60
|
});
|
112
61
|
};
|
113
62
|
|
63
|
+
/**
|
64
|
+
* --------------------------------------------------------------------------
|
65
|
+
* Bootstrap (v5.0.0-beta3): popover.js
|
66
|
+
* Licensed under MIT (https://github.com/twbs/bootstrap/blob/main/LICENSE)
|
67
|
+
* --------------------------------------------------------------------------
|
68
|
+
*/
|
114
69
|
/**
|
115
70
|
* ------------------------------------------------------------------------
|
116
71
|
* Constants
|
117
72
|
* ------------------------------------------------------------------------
|
118
73
|
*/
|
119
74
|
|
120
|
-
|
121
|
-
|
122
|
-
|
123
|
-
|
124
|
-
|
125
|
-
|
126
|
-
var Default = _extends({}, Tooltip__default['default'].Default, {
|
75
|
+
const NAME = 'popover';
|
76
|
+
const DATA_KEY = 'bs.popover';
|
77
|
+
const EVENT_KEY = `.${DATA_KEY}`;
|
78
|
+
const CLASS_PREFIX = 'bs-popover';
|
79
|
+
const BSCLS_PREFIX_REGEX = new RegExp(`(^|\\s)${CLASS_PREFIX}\\S+`, 'g');
|
80
|
+
const Default = { ...Tooltip__default['default'].Default,
|
127
81
|
placement: 'right',
|
128
82
|
offset: [0, 8],
|
129
83
|
trigger: 'click',
|
130
84
|
content: '',
|
131
85
|
template: '<div class="popover" role="tooltip">' + '<div class="popover-arrow"></div>' + '<h3 class="popover-header"></h3>' + '<div class="popover-body"></div>' + '</div>'
|
132
|
-
}
|
133
|
-
|
134
|
-
var DefaultType = _extends({}, Tooltip__default['default'].DefaultType, {
|
86
|
+
};
|
87
|
+
const DefaultType = { ...Tooltip__default['default'].DefaultType,
|
135
88
|
content: '(string|element|function)'
|
136
|
-
});
|
137
|
-
|
138
|
-
var Event = {
|
139
|
-
HIDE: "hide" + EVENT_KEY,
|
140
|
-
HIDDEN: "hidden" + EVENT_KEY,
|
141
|
-
SHOW: "show" + EVENT_KEY,
|
142
|
-
SHOWN: "shown" + EVENT_KEY,
|
143
|
-
INSERTED: "inserted" + EVENT_KEY,
|
144
|
-
CLICK: "click" + EVENT_KEY,
|
145
|
-
FOCUSIN: "focusin" + EVENT_KEY,
|
146
|
-
FOCUSOUT: "focusout" + EVENT_KEY,
|
147
|
-
MOUSEENTER: "mouseenter" + EVENT_KEY,
|
148
|
-
MOUSELEAVE: "mouseleave" + EVENT_KEY
|
149
89
|
};
|
150
|
-
|
151
|
-
|
152
|
-
|
153
|
-
|
90
|
+
const Event = {
|
91
|
+
HIDE: `hide${EVENT_KEY}`,
|
92
|
+
HIDDEN: `hidden${EVENT_KEY}`,
|
93
|
+
SHOW: `show${EVENT_KEY}`,
|
94
|
+
SHOWN: `shown${EVENT_KEY}`,
|
95
|
+
INSERTED: `inserted${EVENT_KEY}`,
|
96
|
+
CLICK: `click${EVENT_KEY}`,
|
97
|
+
FOCUSIN: `focusin${EVENT_KEY}`,
|
98
|
+
FOCUSOUT: `focusout${EVENT_KEY}`,
|
99
|
+
MOUSEENTER: `mouseenter${EVENT_KEY}`,
|
100
|
+
MOUSELEAVE: `mouseleave${EVENT_KEY}`
|
101
|
+
};
|
102
|
+
const CLASS_NAME_FADE = 'fade';
|
103
|
+
const CLASS_NAME_SHOW = 'show';
|
104
|
+
const SELECTOR_TITLE = '.popover-header';
|
105
|
+
const SELECTOR_CONTENT = '.popover-body';
|
154
106
|
/**
|
155
107
|
* ------------------------------------------------------------------------
|
156
108
|
* Class Definition
|
157
109
|
* ------------------------------------------------------------------------
|
158
110
|
*/
|
159
111
|
|
160
|
-
|
161
|
-
|
112
|
+
class Popover extends Tooltip__default['default'] {
|
113
|
+
// Getters
|
114
|
+
static get Default() {
|
115
|
+
return Default;
|
116
|
+
}
|
162
117
|
|
163
|
-
|
164
|
-
return
|
118
|
+
static get NAME() {
|
119
|
+
return NAME;
|
165
120
|
}
|
166
121
|
|
167
|
-
|
122
|
+
static get DATA_KEY() {
|
123
|
+
return DATA_KEY;
|
124
|
+
}
|
125
|
+
|
126
|
+
static get Event() {
|
127
|
+
return Event;
|
128
|
+
}
|
168
129
|
|
169
|
-
|
170
|
-
|
130
|
+
static get EVENT_KEY() {
|
131
|
+
return EVENT_KEY;
|
132
|
+
}
|
133
|
+
|
134
|
+
static get DefaultType() {
|
135
|
+
return DefaultType;
|
136
|
+
} // Overrides
|
137
|
+
|
138
|
+
|
139
|
+
isWithContent() {
|
171
140
|
return this.getTitle() || this._getContent();
|
172
|
-
}
|
141
|
+
}
|
173
142
|
|
174
|
-
|
175
|
-
|
143
|
+
setContent() {
|
144
|
+
const tip = this.getTipElement(); // we use append for html objects to maintain js events
|
176
145
|
|
177
146
|
this.setElementContent(SelectorEngine__default['default'].findOne(SELECTOR_TITLE, tip), this.getTitle());
|
178
147
|
|
179
|
-
|
148
|
+
let content = this._getContent();
|
180
149
|
|
181
150
|
if (typeof content === 'function') {
|
182
151
|
content = content.call(this._element);
|
@@ -185,35 +154,31 @@
|
|
185
154
|
this.setElementContent(SelectorEngine__default['default'].findOne(SELECTOR_CONTENT, tip), content);
|
186
155
|
tip.classList.remove(CLASS_NAME_FADE, CLASS_NAME_SHOW);
|
187
156
|
} // Private
|
188
|
-
;
|
189
157
|
|
190
|
-
_proto._addAttachmentClass = function _addAttachmentClass(attachment) {
|
191
|
-
this.getTipElement().classList.add(CLASS_PREFIX + "-" + this.updateAttachment(attachment));
|
192
|
-
};
|
193
158
|
|
194
|
-
|
159
|
+
_addAttachmentClass(attachment) {
|
160
|
+
this.getTipElement().classList.add(`${CLASS_PREFIX}-${this.updateAttachment(attachment)}`);
|
161
|
+
}
|
162
|
+
|
163
|
+
_getContent() {
|
195
164
|
return this._element.getAttribute('data-bs-content') || this.config.content;
|
196
|
-
}
|
165
|
+
}
|
197
166
|
|
198
|
-
|
199
|
-
|
200
|
-
|
167
|
+
_cleanTipClass() {
|
168
|
+
const tip = this.getTipElement();
|
169
|
+
const tabClass = tip.getAttribute('class').match(BSCLS_PREFIX_REGEX);
|
201
170
|
|
202
171
|
if (tabClass !== null && tabClass.length > 0) {
|
203
|
-
tabClass.map(
|
204
|
-
return token.trim();
|
205
|
-
}).forEach(function (tClass) {
|
206
|
-
return tip.classList.remove(tClass);
|
207
|
-
});
|
172
|
+
tabClass.map(token => token.trim()).forEach(tClass => tip.classList.remove(tClass));
|
208
173
|
}
|
209
174
|
} // Static
|
210
|
-
;
|
211
175
|
|
212
|
-
|
176
|
+
|
177
|
+
static jQueryInterface(config) {
|
213
178
|
return this.each(function () {
|
214
|
-
|
179
|
+
let data = Data__default['default'].get(this, DATA_KEY);
|
215
180
|
|
216
|
-
|
181
|
+
const _config = typeof config === 'object' ? config : null;
|
217
182
|
|
218
183
|
if (!data && /dispose|hide/.test(config)) {
|
219
184
|
return;
|
@@ -221,54 +186,20 @@
|
|
221
186
|
|
222
187
|
if (!data) {
|
223
188
|
data = new Popover(this, _config);
|
224
|
-
Data__default['default'].
|
189
|
+
Data__default['default'].set(this, DATA_KEY, data);
|
225
190
|
}
|
226
191
|
|
227
192
|
if (typeof config === 'string') {
|
228
193
|
if (typeof data[config] === 'undefined') {
|
229
|
-
throw new TypeError(
|
194
|
+
throw new TypeError(`No method named "${config}"`);
|
230
195
|
}
|
231
196
|
|
232
197
|
data[config]();
|
233
198
|
}
|
234
199
|
});
|
235
|
-
}
|
236
|
-
|
237
|
-
_createClass(Popover, null, [{
|
238
|
-
key: "Default",
|
239
|
-
get: // Getters
|
240
|
-
function get() {
|
241
|
-
return Default;
|
242
|
-
}
|
243
|
-
}, {
|
244
|
-
key: "NAME",
|
245
|
-
get: function get() {
|
246
|
-
return NAME;
|
247
|
-
}
|
248
|
-
}, {
|
249
|
-
key: "DATA_KEY",
|
250
|
-
get: function get() {
|
251
|
-
return DATA_KEY;
|
252
|
-
}
|
253
|
-
}, {
|
254
|
-
key: "Event",
|
255
|
-
get: function get() {
|
256
|
-
return Event;
|
257
|
-
}
|
258
|
-
}, {
|
259
|
-
key: "EVENT_KEY",
|
260
|
-
get: function get() {
|
261
|
-
return EVENT_KEY;
|
262
|
-
}
|
263
|
-
}, {
|
264
|
-
key: "DefaultType",
|
265
|
-
get: function get() {
|
266
|
-
return DefaultType;
|
267
|
-
}
|
268
|
-
}]);
|
200
|
+
}
|
269
201
|
|
270
|
-
|
271
|
-
}(Tooltip__default['default']);
|
202
|
+
}
|
272
203
|
/**
|
273
204
|
* ------------------------------------------------------------------------
|
274
205
|
* jQuery
|
@@ -1,5 +1,5 @@
|
|
1
1
|
/*!
|
2
|
-
* Bootstrap scrollspy.js v5.0.0-
|
2
|
+
* Bootstrap scrollspy.js v5.0.0-beta3 (https://getbootstrap.com/)
|
3
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
|
*/
|
@@ -17,67 +17,17 @@
|
|
17
17
|
var SelectorEngine__default = /*#__PURE__*/_interopDefaultLegacy(SelectorEngine);
|
18
18
|
var BaseComponent__default = /*#__PURE__*/_interopDefaultLegacy(BaseComponent);
|
19
19
|
|
20
|
-
function _defineProperties(target, props) {
|
21
|
-
for (var i = 0; i < props.length; i++) {
|
22
|
-
var descriptor = props[i];
|
23
|
-
descriptor.enumerable = descriptor.enumerable || false;
|
24
|
-
descriptor.configurable = true;
|
25
|
-
if ("value" in descriptor) descriptor.writable = true;
|
26
|
-
Object.defineProperty(target, descriptor.key, descriptor);
|
27
|
-
}
|
28
|
-
}
|
29
|
-
|
30
|
-
function _createClass(Constructor, protoProps, staticProps) {
|
31
|
-
if (protoProps) _defineProperties(Constructor.prototype, protoProps);
|
32
|
-
if (staticProps) _defineProperties(Constructor, staticProps);
|
33
|
-
return Constructor;
|
34
|
-
}
|
35
|
-
|
36
|
-
function _extends() {
|
37
|
-
_extends = Object.assign || function (target) {
|
38
|
-
for (var i = 1; i < arguments.length; i++) {
|
39
|
-
var source = arguments[i];
|
40
|
-
|
41
|
-
for (var key in source) {
|
42
|
-
if (Object.prototype.hasOwnProperty.call(source, key)) {
|
43
|
-
target[key] = source[key];
|
44
|
-
}
|
45
|
-
}
|
46
|
-
}
|
47
|
-
|
48
|
-
return target;
|
49
|
-
};
|
50
|
-
|
51
|
-
return _extends.apply(this, arguments);
|
52
|
-
}
|
53
|
-
|
54
|
-
function _inheritsLoose(subClass, superClass) {
|
55
|
-
subClass.prototype = Object.create(superClass.prototype);
|
56
|
-
subClass.prototype.constructor = subClass;
|
57
|
-
|
58
|
-
_setPrototypeOf(subClass, superClass);
|
59
|
-
}
|
60
|
-
|
61
|
-
function _setPrototypeOf(o, p) {
|
62
|
-
_setPrototypeOf = Object.setPrototypeOf || function _setPrototypeOf(o, p) {
|
63
|
-
o.__proto__ = p;
|
64
|
-
return o;
|
65
|
-
};
|
66
|
-
|
67
|
-
return _setPrototypeOf(o, p);
|
68
|
-
}
|
69
|
-
|
70
20
|
/**
|
71
21
|
* --------------------------------------------------------------------------
|
72
|
-
* Bootstrap (v5.0.0-
|
22
|
+
* Bootstrap (v5.0.0-beta3): util/index.js
|
73
23
|
* Licensed under MIT (https://github.com/twbs/bootstrap/blob/main/LICENSE)
|
74
24
|
* --------------------------------------------------------------------------
|
75
25
|
*/
|
76
|
-
|
26
|
+
const MAX_UID = 1000000;
|
77
27
|
|
78
|
-
|
28
|
+
const toType = obj => {
|
79
29
|
if (obj === null || obj === undefined) {
|
80
|
-
return
|
30
|
+
return `${obj}`;
|
81
31
|
}
|
82
32
|
|
83
33
|
return {}.toString.call(obj).match(/\s([a-z]+)/i)[1].toLowerCase();
|
@@ -89,7 +39,7 @@
|
|
89
39
|
*/
|
90
40
|
|
91
41
|
|
92
|
-
|
42
|
+
const getUID = prefix => {
|
93
43
|
do {
|
94
44
|
prefix += Math.floor(Math.random() * MAX_UID);
|
95
45
|
} while (document.getElementById(prefix));
|
@@ -97,11 +47,11 @@
|
|
97
47
|
return prefix;
|
98
48
|
};
|
99
49
|
|
100
|
-
|
101
|
-
|
50
|
+
const getSelector = element => {
|
51
|
+
let selector = element.getAttribute('data-bs-target');
|
102
52
|
|
103
53
|
if (!selector || selector === '#') {
|
104
|
-
|
54
|
+
let hrefAttr = element.getAttribute('href'); // The only valid content that could double as a selector are IDs or classes,
|
105
55
|
// so everything starting with `#` or `.`. If a "real" URL is used as the selector,
|
106
56
|
// `document.querySelector` will rightfully complain it is invalid.
|
107
57
|
// See https://github.com/twbs/bootstrap/issues/32273
|
@@ -121,8 +71,8 @@
|
|
121
71
|
return selector;
|
122
72
|
};
|
123
73
|
|
124
|
-
|
125
|
-
|
74
|
+
const getSelectorFromElement = element => {
|
75
|
+
const selector = getSelector(element);
|
126
76
|
|
127
77
|
if (selector) {
|
128
78
|
return document.querySelector(selector) ? selector : null;
|
@@ -131,25 +81,24 @@
|
|
131
81
|
return null;
|
132
82
|
};
|
133
83
|
|
134
|
-
|
135
|
-
return (obj[0] || obj).nodeType;
|
136
|
-
};
|
84
|
+
const isElement = obj => (obj[0] || obj).nodeType;
|
137
85
|
|
138
|
-
|
139
|
-
Object.keys(configTypes).forEach(
|
140
|
-
|
141
|
-
|
142
|
-
|
86
|
+
const typeCheckConfig = (componentName, config, configTypes) => {
|
87
|
+
Object.keys(configTypes).forEach(property => {
|
88
|
+
const expectedTypes = configTypes[property];
|
89
|
+
const value = config[property];
|
90
|
+
const valueType = value && isElement(value) ? 'element' : toType(value);
|
143
91
|
|
144
92
|
if (!new RegExp(expectedTypes).test(valueType)) {
|
145
|
-
throw new TypeError(componentName.toUpperCase()
|
93
|
+
throw new TypeError(`${componentName.toUpperCase()}: ` + `Option "${property}" provided type "${valueType}" ` + `but expected type "${expectedTypes}".`);
|
146
94
|
}
|
147
95
|
});
|
148
96
|
};
|
149
97
|
|
150
|
-
|
151
|
-
|
152
|
-
|
98
|
+
const getjQuery = () => {
|
99
|
+
const {
|
100
|
+
jQuery
|
101
|
+
} = window;
|
153
102
|
|
154
103
|
if (jQuery && !document.body.hasAttribute('data-bs-no-jquery')) {
|
155
104
|
return jQuery;
|
@@ -158,7 +107,7 @@
|
|
158
107
|
return null;
|
159
108
|
};
|
160
109
|
|
161
|
-
|
110
|
+
const onDOMContentLoaded = callback => {
|
162
111
|
if (document.readyState === 'loading') {
|
163
112
|
document.addEventListener('DOMContentLoaded', callback);
|
164
113
|
} else {
|
@@ -166,19 +115,17 @@
|
|
166
115
|
}
|
167
116
|
};
|
168
117
|
|
169
|
-
|
170
|
-
|
171
|
-
|
172
|
-
onDOMContentLoaded(function () {
|
173
|
-
var $ = getjQuery();
|
118
|
+
const defineJQueryPlugin = (name, plugin) => {
|
119
|
+
onDOMContentLoaded(() => {
|
120
|
+
const $ = getjQuery();
|
174
121
|
/* istanbul ignore if */
|
175
122
|
|
176
123
|
if ($) {
|
177
|
-
|
124
|
+
const JQUERY_NO_CONFLICT = $.fn[name];
|
178
125
|
$.fn[name] = plugin.jQueryInterface;
|
179
126
|
$.fn[name].Constructor = plugin;
|
180
127
|
|
181
|
-
$.fn[name].noConflict =
|
128
|
+
$.fn[name].noConflict = () => {
|
182
129
|
$.fn[name] = JQUERY_NO_CONFLICT;
|
183
130
|
return plugin.jQueryInterface;
|
184
131
|
};
|
@@ -186,91 +133,92 @@
|
|
186
133
|
});
|
187
134
|
};
|
188
135
|
|
136
|
+
/**
|
137
|
+
* --------------------------------------------------------------------------
|
138
|
+
* Bootstrap (v5.0.0-beta3): scrollspy.js
|
139
|
+
* Licensed under MIT (https://github.com/twbs/bootstrap/blob/main/LICENSE)
|
140
|
+
* --------------------------------------------------------------------------
|
141
|
+
*/
|
189
142
|
/**
|
190
143
|
* ------------------------------------------------------------------------
|
191
144
|
* Constants
|
192
145
|
* ------------------------------------------------------------------------
|
193
146
|
*/
|
194
147
|
|
195
|
-
|
196
|
-
|
197
|
-
|
198
|
-
|
199
|
-
|
148
|
+
const NAME = 'scrollspy';
|
149
|
+
const DATA_KEY = 'bs.scrollspy';
|
150
|
+
const EVENT_KEY = `.${DATA_KEY}`;
|
151
|
+
const DATA_API_KEY = '.data-api';
|
152
|
+
const Default = {
|
200
153
|
offset: 10,
|
201
154
|
method: 'auto',
|
202
155
|
target: ''
|
203
156
|
};
|
204
|
-
|
157
|
+
const DefaultType = {
|
205
158
|
offset: 'number',
|
206
159
|
method: 'string',
|
207
160
|
target: '(string|element)'
|
208
161
|
};
|
209
|
-
|
210
|
-
|
211
|
-
|
212
|
-
|
213
|
-
|
214
|
-
|
215
|
-
|
216
|
-
|
217
|
-
|
218
|
-
|
219
|
-
|
220
|
-
|
221
|
-
|
222
|
-
|
162
|
+
const EVENT_ACTIVATE = `activate${EVENT_KEY}`;
|
163
|
+
const EVENT_SCROLL = `scroll${EVENT_KEY}`;
|
164
|
+
const EVENT_LOAD_DATA_API = `load${EVENT_KEY}${DATA_API_KEY}`;
|
165
|
+
const CLASS_NAME_DROPDOWN_ITEM = 'dropdown-item';
|
166
|
+
const CLASS_NAME_ACTIVE = 'active';
|
167
|
+
const SELECTOR_DATA_SPY = '[data-bs-spy="scroll"]';
|
168
|
+
const SELECTOR_NAV_LIST_GROUP = '.nav, .list-group';
|
169
|
+
const SELECTOR_NAV_LINKS = '.nav-link';
|
170
|
+
const SELECTOR_NAV_ITEMS = '.nav-item';
|
171
|
+
const SELECTOR_LIST_ITEMS = '.list-group-item';
|
172
|
+
const SELECTOR_DROPDOWN = '.dropdown';
|
173
|
+
const SELECTOR_DROPDOWN_TOGGLE = '.dropdown-toggle';
|
174
|
+
const METHOD_OFFSET = 'offset';
|
175
|
+
const METHOD_POSITION = 'position';
|
223
176
|
/**
|
224
177
|
* ------------------------------------------------------------------------
|
225
178
|
* Class Definition
|
226
179
|
* ------------------------------------------------------------------------
|
227
180
|
*/
|
228
181
|
|
229
|
-
|
230
|
-
|
231
|
-
|
232
|
-
|
233
|
-
|
234
|
-
|
235
|
-
|
236
|
-
|
237
|
-
|
238
|
-
|
239
|
-
|
240
|
-
|
241
|
-
_this._activeTarget = null;
|
242
|
-
_this._scrollHeight = 0;
|
243
|
-
EventHandler__default['default'].on(_this._scrollElement, EVENT_SCROLL, function () {
|
244
|
-
return _this._process();
|
245
|
-
});
|
246
|
-
|
247
|
-
_this.refresh();
|
248
|
-
|
249
|
-
_this._process();
|
182
|
+
class ScrollSpy extends BaseComponent__default['default'] {
|
183
|
+
constructor(element, config) {
|
184
|
+
super(element);
|
185
|
+
this._scrollElement = this._element.tagName === 'BODY' ? window : this._element;
|
186
|
+
this._config = this._getConfig(config);
|
187
|
+
this._selector = `${this._config.target} ${SELECTOR_NAV_LINKS}, ${this._config.target} ${SELECTOR_LIST_ITEMS}, ${this._config.target} .${CLASS_NAME_DROPDOWN_ITEM}`;
|
188
|
+
this._offsets = [];
|
189
|
+
this._targets = [];
|
190
|
+
this._activeTarget = null;
|
191
|
+
this._scrollHeight = 0;
|
192
|
+
EventHandler__default['default'].on(this._scrollElement, EVENT_SCROLL, () => this._process());
|
193
|
+
this.refresh();
|
250
194
|
|
251
|
-
|
195
|
+
this._process();
|
252
196
|
} // Getters
|
253
197
|
|
254
198
|
|
255
|
-
|
199
|
+
static get Default() {
|
200
|
+
return Default;
|
201
|
+
}
|
202
|
+
|
203
|
+
static get DATA_KEY() {
|
204
|
+
return DATA_KEY;
|
205
|
+
} // Public
|
256
206
|
|
257
|
-
// Public
|
258
|
-
_proto.refresh = function refresh() {
|
259
|
-
var _this2 = this;
|
260
207
|
|
261
|
-
|
262
|
-
|
263
|
-
|
208
|
+
refresh() {
|
209
|
+
const autoMethod = this._scrollElement === this._scrollElement.window ? METHOD_OFFSET : METHOD_POSITION;
|
210
|
+
const offsetMethod = this._config.method === 'auto' ? autoMethod : this._config.method;
|
211
|
+
const offsetBase = offsetMethod === METHOD_POSITION ? this._getScrollTop() : 0;
|
264
212
|
this._offsets = [];
|
265
213
|
this._targets = [];
|
266
214
|
this._scrollHeight = this._getScrollHeight();
|
267
|
-
|
268
|
-
targets.map(
|
269
|
-
|
270
|
-
|
215
|
+
const targets = SelectorEngine__default['default'].find(this._selector);
|
216
|
+
targets.map(element => {
|
217
|
+
const targetSelector = getSelectorFromElement(element);
|
218
|
+
const target = targetSelector ? SelectorEngine__default['default'].findOne(targetSelector) : null;
|
271
219
|
|
272
220
|
if (target) {
|
273
|
-
|
221
|
+
const targetBCR = target.getBoundingClientRect();
|
274
222
|
|
275
223
|
if (targetBCR.width || targetBCR.height) {
|
276
224
|
return [Manipulator__default['default'][offsetMethod](target).top + offsetBase, targetSelector];
|
@@ -278,20 +226,15 @@
|
|
278
226
|
}
|
279
227
|
|
280
228
|
return null;
|
281
|
-
}).filter(
|
282
|
-
|
283
|
-
}).sort(function (a, b) {
|
284
|
-
return a[0] - b[0];
|
285
|
-
}).forEach(function (item) {
|
286
|
-
_this2._offsets.push(item[0]);
|
287
|
-
|
288
|
-
_this2._targets.push(item[1]);
|
289
|
-
});
|
290
|
-
};
|
229
|
+
}).filter(item => item).sort((a, b) => a[0] - b[0]).forEach(item => {
|
230
|
+
this._offsets.push(item[0]);
|
291
231
|
|
292
|
-
|
293
|
-
|
232
|
+
this._targets.push(item[1]);
|
233
|
+
});
|
234
|
+
}
|
294
235
|
|
236
|
+
dispose() {
|
237
|
+
super.dispose();
|
295
238
|
EventHandler__default['default'].off(this._scrollElement, EVENT_KEY);
|
296
239
|
this._scrollElement = null;
|
297
240
|
this._config = null;
|
@@ -301,51 +244,55 @@
|
|
301
244
|
this._activeTarget = null;
|
302
245
|
this._scrollHeight = null;
|
303
246
|
} // Private
|
304
|
-
;
|
305
247
|
|
306
|
-
|
307
|
-
|
248
|
+
|
249
|
+
_getConfig(config) {
|
250
|
+
config = { ...Default,
|
251
|
+
...(typeof config === 'object' && config ? config : {})
|
252
|
+
};
|
308
253
|
|
309
254
|
if (typeof config.target !== 'string' && isElement(config.target)) {
|
310
|
-
|
255
|
+
let {
|
256
|
+
id
|
257
|
+
} = config.target;
|
311
258
|
|
312
259
|
if (!id) {
|
313
260
|
id = getUID(NAME);
|
314
261
|
config.target.id = id;
|
315
262
|
}
|
316
263
|
|
317
|
-
config.target =
|
264
|
+
config.target = `#${id}`;
|
318
265
|
}
|
319
266
|
|
320
267
|
typeCheckConfig(NAME, config, DefaultType);
|
321
268
|
return config;
|
322
|
-
}
|
269
|
+
}
|
323
270
|
|
324
|
-
|
271
|
+
_getScrollTop() {
|
325
272
|
return this._scrollElement === window ? this._scrollElement.pageYOffset : this._scrollElement.scrollTop;
|
326
|
-
}
|
273
|
+
}
|
327
274
|
|
328
|
-
|
275
|
+
_getScrollHeight() {
|
329
276
|
return this._scrollElement.scrollHeight || Math.max(document.body.scrollHeight, document.documentElement.scrollHeight);
|
330
|
-
}
|
277
|
+
}
|
331
278
|
|
332
|
-
|
279
|
+
_getOffsetHeight() {
|
333
280
|
return this._scrollElement === window ? window.innerHeight : this._scrollElement.getBoundingClientRect().height;
|
334
|
-
}
|
281
|
+
}
|
335
282
|
|
336
|
-
|
337
|
-
|
283
|
+
_process() {
|
284
|
+
const scrollTop = this._getScrollTop() + this._config.offset;
|
338
285
|
|
339
|
-
|
286
|
+
const scrollHeight = this._getScrollHeight();
|
340
287
|
|
341
|
-
|
288
|
+
const maxScroll = this._config.offset + scrollHeight - this._getOffsetHeight();
|
342
289
|
|
343
290
|
if (this._scrollHeight !== scrollHeight) {
|
344
291
|
this.refresh();
|
345
292
|
}
|
346
293
|
|
347
294
|
if (scrollTop >= maxScroll) {
|
348
|
-
|
295
|
+
const target = this._targets[this._targets.length - 1];
|
349
296
|
|
350
297
|
if (this._activeTarget !== target) {
|
351
298
|
this._activate(target);
|
@@ -362,25 +309,23 @@
|
|
362
309
|
return;
|
363
310
|
}
|
364
311
|
|
365
|
-
for (
|
366
|
-
|
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]);
|
367
314
|
|
368
315
|
if (isActiveTarget) {
|
369
316
|
this._activate(this._targets[i]);
|
370
317
|
}
|
371
318
|
}
|
372
|
-
}
|
319
|
+
}
|
373
320
|
|
374
|
-
|
321
|
+
_activate(target) {
|
375
322
|
this._activeTarget = target;
|
376
323
|
|
377
324
|
this._clear();
|
378
325
|
|
379
|
-
|
380
|
-
return selector + "[data-bs-target=\"" + target + "\"]," + selector + "[href=\"" + target + "\"]";
|
381
|
-
});
|
326
|
+
const queries = this._selector.split(',').map(selector => `${selector}[data-bs-target="${target}"],${selector}[href="${target}"]`);
|
382
327
|
|
383
|
-
|
328
|
+
const link = SelectorEngine__default['default'].findOne(queries.join(','));
|
384
329
|
|
385
330
|
if (link.classList.contains(CLASS_NAME_DROPDOWN_ITEM)) {
|
386
331
|
SelectorEngine__default['default'].findOne(SELECTOR_DROPDOWN_TOGGLE, link.closest(SELECTOR_DROPDOWN)).classList.add(CLASS_NAME_ACTIVE);
|
@@ -388,17 +333,13 @@
|
|
388
333
|
} else {
|
389
334
|
// Set triggered link as active
|
390
335
|
link.classList.add(CLASS_NAME_ACTIVE);
|
391
|
-
SelectorEngine__default['default'].parents(link, SELECTOR_NAV_LIST_GROUP).forEach(
|
336
|
+
SelectorEngine__default['default'].parents(link, SELECTOR_NAV_LIST_GROUP).forEach(listGroup => {
|
392
337
|
// Set triggered links parents as active
|
393
338
|
// With both <ul> and <nav> markup a parent is the previous sibling of any nav ancestor
|
394
|
-
SelectorEngine__default['default'].prev(listGroup, SELECTOR_NAV_LINKS
|
395
|
-
|
396
|
-
|
397
|
-
|
398
|
-
SelectorEngine__default['default'].prev(listGroup, SELECTOR_NAV_ITEMS).forEach(function (navItem) {
|
399
|
-
SelectorEngine__default['default'].children(navItem, SELECTOR_NAV_LINKS).forEach(function (item) {
|
400
|
-
return item.classList.add(CLASS_NAME_ACTIVE);
|
401
|
-
});
|
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));
|
402
343
|
});
|
403
344
|
});
|
404
345
|
}
|
@@ -406,22 +347,18 @@
|
|
406
347
|
EventHandler__default['default'].trigger(this._scrollElement, EVENT_ACTIVATE, {
|
407
348
|
relatedTarget: target
|
408
349
|
});
|
409
|
-
}
|
350
|
+
}
|
410
351
|
|
411
|
-
|
412
|
-
SelectorEngine__default['default'].find(this._selector).filter(
|
413
|
-
return node.classList.contains(CLASS_NAME_ACTIVE);
|
414
|
-
}).forEach(function (node) {
|
415
|
-
return node.classList.remove(CLASS_NAME_ACTIVE);
|
416
|
-
});
|
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));
|
417
354
|
} // Static
|
418
|
-
;
|
419
355
|
|
420
|
-
|
356
|
+
|
357
|
+
static jQueryInterface(config) {
|
421
358
|
return this.each(function () {
|
422
|
-
|
359
|
+
let data = Data__default['default'].get(this, DATA_KEY);
|
423
360
|
|
424
|
-
|
361
|
+
const _config = typeof config === 'object' && config;
|
425
362
|
|
426
363
|
if (!data) {
|
427
364
|
data = new ScrollSpy(this, _config);
|
@@ -429,28 +366,15 @@
|
|
429
366
|
|
430
367
|
if (typeof config === 'string') {
|
431
368
|
if (typeof data[config] === 'undefined') {
|
432
|
-
throw new TypeError(
|
369
|
+
throw new TypeError(`No method named "${config}"`);
|
433
370
|
}
|
434
371
|
|
435
372
|
data[config]();
|
436
373
|
}
|
437
374
|
});
|
438
|
-
}
|
439
|
-
|
440
|
-
_createClass(ScrollSpy, null, [{
|
441
|
-
key: "Default",
|
442
|
-
get: function get() {
|
443
|
-
return Default;
|
444
|
-
}
|
445
|
-
}, {
|
446
|
-
key: "DATA_KEY",
|
447
|
-
get: function get() {
|
448
|
-
return DATA_KEY;
|
449
|
-
}
|
450
|
-
}]);
|
375
|
+
}
|
451
376
|
|
452
|
-
|
453
|
-
}(BaseComponent__default['default']);
|
377
|
+
}
|
454
378
|
/**
|
455
379
|
* ------------------------------------------------------------------------
|
456
380
|
* Data Api implementation
|
@@ -458,10 +382,8 @@
|
|
458
382
|
*/
|
459
383
|
|
460
384
|
|
461
|
-
EventHandler__default['default'].on(window, EVENT_LOAD_DATA_API,
|
462
|
-
SelectorEngine__default['default'].find(SELECTOR_DATA_SPY).forEach(
|
463
|
-
return new ScrollSpy(spy, Manipulator__default['default'].getDataAttributes(spy));
|
464
|
-
});
|
385
|
+
EventHandler__default['default'].on(window, EVENT_LOAD_DATA_API, () => {
|
386
|
+
SelectorEngine__default['default'].find(SELECTOR_DATA_SPY).forEach(spy => new ScrollSpy(spy, Manipulator__default['default'].getDataAttributes(spy)));
|
465
387
|
});
|
466
388
|
/**
|
467
389
|
* ------------------------------------------------------------------------
|