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.
- checksums.yaml +4 -4
- data/CHANGELOG.md +0 -4
- data/README.md +1 -7
- data/Rakefile +4 -16
- data/assets/javascripts/bootstrap/alert.js +148 -73
- data/assets/javascripts/bootstrap/button.js +71 -154
- data/assets/javascripts/bootstrap/carousel.js +315 -209
- data/assets/javascripts/bootstrap/collapse.js +307 -153
- data/assets/javascripts/bootstrap/dom/data.js +81 -0
- data/assets/javascripts/bootstrap/dom/event-handler.js +311 -0
- data/assets/javascripts/bootstrap/dom/manipulator.js +100 -0
- data/assets/javascripts/bootstrap/dom/polyfill.js +110 -0
- data/assets/javascripts/bootstrap/dom/selector-engine.js +98 -0
- data/assets/javascripts/bootstrap/dropdown.js +257 -205
- data/assets/javascripts/bootstrap/modal.js +354 -250
- data/assets/javascripts/bootstrap/popover.js +85 -94
- data/assets/javascripts/bootstrap/scrollspy.js +179 -107
- data/assets/javascripts/bootstrap/tab.js +170 -99
- data/assets/javascripts/bootstrap/toast.js +181 -110
- data/assets/javascripts/bootstrap/tooltip.js +375 -226
- data/assets/javascripts/bootstrap-sprockets.js +5 -1
- data/assets/javascripts/bootstrap.js +2260 -1550
- data/assets/javascripts/bootstrap.min.js +3 -3
- data/assets/stylesheets/_bootstrap-grid.scss +53 -18
- data/assets/stylesheets/_bootstrap-reboot.scss +6 -3
- data/assets/stylesheets/_bootstrap.scss +16 -10
- data/assets/stylesheets/bootstrap/_alert.scss +3 -4
- data/assets/stylesheets/bootstrap/_badge.scss +2 -27
- data/assets/stylesheets/bootstrap/_breadcrumb.scss +5 -17
- data/assets/stylesheets/bootstrap/_button-group.scss +16 -38
- data/assets/stylesheets/bootstrap/_buttons.scss +27 -45
- data/assets/stylesheets/bootstrap/_card.scss +22 -68
- data/assets/stylesheets/bootstrap/_carousel.scss +15 -20
- data/assets/stylesheets/bootstrap/_close.scss +9 -13
- data/assets/stylesheets/bootstrap/_containers.scss +41 -0
- data/assets/stylesheets/bootstrap/_dropdown.scss +12 -9
- data/assets/stylesheets/bootstrap/_forms.scss +9 -347
- data/assets/stylesheets/bootstrap/_functions.scss +82 -69
- data/assets/stylesheets/bootstrap/_grid.scss +3 -54
- data/assets/stylesheets/bootstrap/_helpers.scss +7 -0
- data/assets/stylesheets/bootstrap/_images.scss +1 -1
- data/assets/stylesheets/bootstrap/_list-group.scss +7 -4
- data/assets/stylesheets/bootstrap/_mixins.scss +6 -12
- data/assets/stylesheets/bootstrap/_modal.scss +36 -41
- data/assets/stylesheets/bootstrap/_nav.scss +7 -9
- data/assets/stylesheets/bootstrap/_navbar.scss +42 -82
- data/assets/stylesheets/bootstrap/_pagination.scss +7 -20
- data/assets/stylesheets/bootstrap/_popover.scss +14 -14
- data/assets/stylesheets/bootstrap/_progress.scss +3 -5
- data/assets/stylesheets/bootstrap/_reboot.scss +304 -172
- data/assets/stylesheets/bootstrap/_root.scss +5 -8
- data/assets/stylesheets/bootstrap/_spinners.scss +8 -17
- data/assets/stylesheets/bootstrap/_tables.scss +80 -114
- data/assets/stylesheets/bootstrap/_toasts.scss +2 -4
- data/assets/stylesheets/bootstrap/_tooltip.scss +9 -9
- data/assets/stylesheets/bootstrap/_transitions.scss +0 -7
- data/assets/stylesheets/bootstrap/_type.scss +38 -59
- data/assets/stylesheets/bootstrap/_utilities.scss +503 -18
- data/assets/stylesheets/bootstrap/_variables.scss +548 -437
- data/assets/stylesheets/bootstrap/bootstrap-utilities.scss +18 -0
- data/assets/stylesheets/bootstrap/forms/_form-check.scss +142 -0
- data/assets/stylesheets/bootstrap/forms/_form-control.scss +116 -0
- data/assets/stylesheets/bootstrap/forms/_form-file.scss +91 -0
- data/assets/stylesheets/bootstrap/forms/_form-range.scss +136 -0
- data/assets/stylesheets/bootstrap/forms/_form-select.scss +82 -0
- data/assets/stylesheets/bootstrap/forms/_form-text.scss +11 -0
- data/assets/stylesheets/bootstrap/forms/_input-group.scss +140 -0
- data/assets/stylesheets/bootstrap/forms/_labels.scss +36 -0
- data/assets/stylesheets/bootstrap/forms/_validation.scss +12 -0
- data/assets/stylesheets/bootstrap/helpers/_colored-links.scss +12 -0
- data/assets/stylesheets/bootstrap/helpers/_embed.scss +31 -0
- data/assets/stylesheets/bootstrap/helpers/_position.scss +30 -0
- data/assets/stylesheets/bootstrap/helpers/_screenreaders.scss +8 -0
- data/assets/stylesheets/bootstrap/helpers/_stretched-link.scss +15 -0
- data/assets/stylesheets/bootstrap/helpers/_text-truncation.scss +7 -0
- data/assets/stylesheets/bootstrap/mixins/_alert.scss +0 -4
- data/assets/stylesheets/bootstrap/mixins/_border-radius.scss +1 -1
- data/assets/stylesheets/bootstrap/mixins/_breakpoints.scss +11 -8
- data/assets/stylesheets/bootstrap/mixins/_buttons.scss +62 -47
- data/assets/stylesheets/bootstrap/mixins/_caret.scss +4 -4
- data/assets/stylesheets/bootstrap/mixins/_clearfix.scss +2 -0
- data/assets/stylesheets/bootstrap/mixins/_container.scss +9 -0
- data/assets/stylesheets/bootstrap/mixins/_forms.scss +23 -85
- data/assets/stylesheets/bootstrap/mixins/_gradients.scss +9 -11
- data/assets/stylesheets/bootstrap/mixins/_grid.scss +86 -34
- data/assets/stylesheets/bootstrap/mixins/_image.scss +1 -21
- data/assets/stylesheets/bootstrap/mixins/_list-group.scss +2 -1
- data/assets/stylesheets/bootstrap/mixins/_lists.scss +1 -1
- data/assets/stylesheets/bootstrap/mixins/_pagination.scss +15 -8
- data/assets/stylesheets/bootstrap/mixins/_reset-text.scss +3 -3
- data/assets/stylesheets/bootstrap/mixins/_screen-reader.scss +18 -24
- data/assets/stylesheets/bootstrap/mixins/_table-variants.scss +21 -0
- data/assets/stylesheets/bootstrap/mixins/_transition.scss +2 -2
- data/assets/stylesheets/bootstrap/mixins/_utilities.scss +49 -0
- data/assets/stylesheets/bootstrap/utilities/_api.scss +47 -0
- data/assets/stylesheets/bootstrap/vendor/_rfs.scss +214 -130
- data/bootstrap.gemspec +3 -1
- data/lib/bootstrap/engine.rb +1 -17
- data/lib/bootstrap/version.rb +2 -2
- data/tasks/updater/js.rb +6 -18
- data/tasks/updater/network.rb +1 -7
- metadata +49 -47
- data/assets/javascripts/bootstrap/util.js +0 -189
- data/assets/stylesheets/bootstrap/_code.scss +0 -48
- data/assets/stylesheets/bootstrap/_custom-forms.scss +0 -526
- data/assets/stylesheets/bootstrap/_input-group.scss +0 -211
- data/assets/stylesheets/bootstrap/_jumbotron.scss +0 -17
- data/assets/stylesheets/bootstrap/_media.scss +0 -8
- data/assets/stylesheets/bootstrap/_print.scss +0 -132
- data/assets/stylesheets/bootstrap/mixins/_background-variant.scss +0 -23
- data/assets/stylesheets/bootstrap/mixins/_badge.scss +0 -17
- data/assets/stylesheets/bootstrap/mixins/_float.scss +0 -14
- data/assets/stylesheets/bootstrap/mixins/_grid-framework.scss +0 -80
- data/assets/stylesheets/bootstrap/mixins/_hover.scss +0 -37
- data/assets/stylesheets/bootstrap/mixins/_nav-divider.scss +0 -11
- data/assets/stylesheets/bootstrap/mixins/_size.scss +0 -7
- data/assets/stylesheets/bootstrap/mixins/_table-row.scss +0 -39
- data/assets/stylesheets/bootstrap/mixins/_text-emphasis.scss +0 -17
- data/assets/stylesheets/bootstrap/mixins/_text-hide.scss +0 -11
- data/assets/stylesheets/bootstrap/mixins/_visibility.scss +0 -8
- data/assets/stylesheets/bootstrap/utilities/_align.scss +0 -8
- data/assets/stylesheets/bootstrap/utilities/_background.scss +0 -19
- data/assets/stylesheets/bootstrap/utilities/_borders.scss +0 -75
- data/assets/stylesheets/bootstrap/utilities/_display.scss +0 -26
- data/assets/stylesheets/bootstrap/utilities/_embed.scss +0 -39
- data/assets/stylesheets/bootstrap/utilities/_flex.scss +0 -51
- data/assets/stylesheets/bootstrap/utilities/_float.scss +0 -11
- data/assets/stylesheets/bootstrap/utilities/_interactions.scss +0 -5
- data/assets/stylesheets/bootstrap/utilities/_overflow.scss +0 -5
- data/assets/stylesheets/bootstrap/utilities/_position.scss +0 -32
- data/assets/stylesheets/bootstrap/utilities/_screenreaders.scss +0 -11
- data/assets/stylesheets/bootstrap/utilities/_shadows.scss +0 -6
- data/assets/stylesheets/bootstrap/utilities/_sizing.scss +0 -20
- data/assets/stylesheets/bootstrap/utilities/_spacing.scss +0 -73
- data/assets/stylesheets/bootstrap/utilities/_stretched-link.scss +0 -19
- data/assets/stylesheets/bootstrap/utilities/_text.scss +0 -72
- data/assets/stylesheets/bootstrap/utilities/_visibility.scss +0 -13
- data/test/gemfiles/rails_7_0_dartsass.gemfile +0 -8
- data/test/gemfiles/rails_7_0_sassc.gemfile +0 -8
- /data/assets/stylesheets/bootstrap/{utilities → helpers}/_clearfix.scss +0 -0
@@ -1,80 +1,117 @@
|
|
1
1
|
/*!
|
2
|
-
* Bootstrap scrollspy.js
|
3
|
-
* Copyright 2011-
|
2
|
+
* Bootstrap scrollspy.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('
|
8
|
-
typeof define === 'function' && define.amd ? define(['
|
9
|
-
(global =
|
10
|
-
}
|
11
|
-
|
12
|
-
|
13
|
-
|
14
|
-
|
15
|
-
|
16
|
-
|
17
|
-
|
18
|
-
|
19
|
-
|
20
|
-
|
21
|
-
|
22
|
-
|
23
|
-
|
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.ScrollSpy = 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 MAX_UID = 1000000;
|
24
|
+
|
25
|
+
var toType = function toType(obj) {
|
26
|
+
if (obj === null || obj === undefined) {
|
27
|
+
return "" + obj;
|
24
28
|
}
|
25
|
-
}
|
26
29
|
|
27
|
-
|
28
|
-
|
29
|
-
|
30
|
-
|
31
|
-
|
32
|
-
|
33
|
-
|
34
|
-
}
|
30
|
+
return {}.toString.call(obj).match(/\s([a-z]+)/i)[1].toLowerCase();
|
31
|
+
};
|
32
|
+
/**
|
33
|
+
* --------------------------------------------------------------------------
|
34
|
+
* Public Util Api
|
35
|
+
* --------------------------------------------------------------------------
|
36
|
+
*/
|
35
37
|
|
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
38
|
|
41
|
-
|
42
|
-
|
43
|
-
|
44
|
-
|
45
|
-
|
39
|
+
var getUID = function getUID(prefix) {
|
40
|
+
do {
|
41
|
+
prefix += Math.floor(Math.random() * MAX_UID);
|
42
|
+
} while (document.getElementById(prefix));
|
43
|
+
|
44
|
+
return prefix;
|
45
|
+
};
|
46
|
+
|
47
|
+
var getSelector = function getSelector(element) {
|
48
|
+
var selector = element.getAttribute('data-target');
|
49
|
+
|
50
|
+
if (!selector || selector === '#') {
|
51
|
+
var hrefAttr = element.getAttribute('href');
|
52
|
+
selector = hrefAttr && hrefAttr !== '#' ? hrefAttr.trim() : null;
|
53
|
+
}
|
54
|
+
|
55
|
+
return selector;
|
56
|
+
};
|
57
|
+
|
58
|
+
var getSelectorFromElement = function getSelectorFromElement(element) {
|
59
|
+
var selector = getSelector(element);
|
60
|
+
|
61
|
+
if (selector) {
|
62
|
+
return document.querySelector(selector) ? selector : null;
|
63
|
+
}
|
64
|
+
|
65
|
+
return null;
|
66
|
+
};
|
67
|
+
|
68
|
+
var isElement = function isElement(obj) {
|
69
|
+
return (obj[0] || obj).nodeType;
|
70
|
+
};
|
71
|
+
|
72
|
+
var typeCheckConfig = function typeCheckConfig(componentName, config, configTypes) {
|
73
|
+
Object.keys(configTypes).forEach(function (property) {
|
74
|
+
var expectedTypes = configTypes[property];
|
75
|
+
var value = config[property];
|
76
|
+
var valueType = value && isElement(value) ? 'element' : toType(value);
|
77
|
+
|
78
|
+
if (!new RegExp(expectedTypes).test(valueType)) {
|
79
|
+
throw new Error(componentName.toUpperCase() + ": " + ("Option \"" + property + "\" provided type \"" + valueType + "\" ") + ("but expected type \"" + expectedTypes + "\"."));
|
46
80
|
}
|
81
|
+
});
|
82
|
+
};
|
47
83
|
|
48
|
-
|
49
|
-
|
50
|
-
|
51
|
-
|
84
|
+
var getjQuery = function getjQuery() {
|
85
|
+
var _window = window,
|
86
|
+
jQuery = _window.jQuery;
|
87
|
+
|
88
|
+
if (jQuery && !document.body.hasAttribute('data-no-jquery')) {
|
89
|
+
return jQuery;
|
90
|
+
}
|
91
|
+
|
92
|
+
return null;
|
93
|
+
};
|
94
|
+
|
95
|
+
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; }
|
96
|
+
|
97
|
+
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; }
|
98
|
+
|
99
|
+
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; }
|
100
|
+
|
101
|
+
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); } }
|
52
102
|
|
103
|
+
function _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); return Constructor; }
|
53
104
|
/**
|
105
|
+
* ------------------------------------------------------------------------
|
54
106
|
* Constants
|
107
|
+
* ------------------------------------------------------------------------
|
55
108
|
*/
|
56
109
|
|
57
110
|
var NAME = 'scrollspy';
|
58
|
-
var VERSION = '
|
111
|
+
var VERSION = '5.0.0-alpha1';
|
59
112
|
var DATA_KEY = 'bs.scrollspy';
|
60
113
|
var EVENT_KEY = "." + DATA_KEY;
|
61
114
|
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
115
|
var Default = {
|
79
116
|
offset: 10,
|
80
117
|
method: 'auto',
|
@@ -85,8 +122,24 @@
|
|
85
122
|
method: 'string',
|
86
123
|
target: '(string|element)'
|
87
124
|
};
|
125
|
+
var EVENT_ACTIVATE = "activate" + EVENT_KEY;
|
126
|
+
var EVENT_SCROLL = "scroll" + EVENT_KEY;
|
127
|
+
var EVENT_LOAD_DATA_API = "load" + EVENT_KEY + DATA_API_KEY;
|
128
|
+
var CLASS_NAME_DROPDOWN_ITEM = 'dropdown-item';
|
129
|
+
var CLASS_NAME_ACTIVE = 'active';
|
130
|
+
var SELECTOR_DATA_SPY = '[data-spy="scroll"]';
|
131
|
+
var SELECTOR_NAV_LIST_GROUP = '.nav, .list-group';
|
132
|
+
var SELECTOR_NAV_LINKS = '.nav-link';
|
133
|
+
var SELECTOR_NAV_ITEMS = '.nav-item';
|
134
|
+
var SELECTOR_LIST_ITEMS = '.list-group-item';
|
135
|
+
var SELECTOR_DROPDOWN = '.dropdown';
|
136
|
+
var SELECTOR_DROPDOWN_TOGGLE = '.dropdown-toggle';
|
137
|
+
var METHOD_OFFSET = 'offset';
|
138
|
+
var METHOD_POSITION = 'position';
|
88
139
|
/**
|
89
|
-
*
|
140
|
+
* ------------------------------------------------------------------------
|
141
|
+
* Class Definition
|
142
|
+
* ------------------------------------------------------------------------
|
90
143
|
*/
|
91
144
|
|
92
145
|
var ScrollSpy = /*#__PURE__*/function () {
|
@@ -96,17 +149,19 @@
|
|
96
149
|
this._element = element;
|
97
150
|
this._scrollElement = element.tagName === 'BODY' ? window : element;
|
98
151
|
this._config = this._getConfig(config);
|
99
|
-
this._selector = this._config.target + " " + SELECTOR_NAV_LINKS + "," + (this._config.target + " " + SELECTOR_LIST_ITEMS + ",") + (this._config.target + " " +
|
152
|
+
this._selector = this._config.target + " " + SELECTOR_NAV_LINKS + "," + (this._config.target + " " + SELECTOR_LIST_ITEMS + ",") + (this._config.target + " ." + CLASS_NAME_DROPDOWN_ITEM);
|
100
153
|
this._offsets = [];
|
101
154
|
this._targets = [];
|
102
155
|
this._activeTarget = null;
|
103
156
|
this._scrollHeight = 0;
|
104
|
-
|
157
|
+
EventHandler.on(this._scrollElement, EVENT_SCROLL, function (event) {
|
105
158
|
return _this._process(event);
|
106
159
|
});
|
107
160
|
this.refresh();
|
108
161
|
|
109
162
|
this._process();
|
163
|
+
|
164
|
+
Data.setData(element, DATA_KEY, this);
|
110
165
|
} // Getters
|
111
166
|
|
112
167
|
|
@@ -122,26 +177,27 @@
|
|
122
177
|
this._offsets = [];
|
123
178
|
this._targets = [];
|
124
179
|
this._scrollHeight = this._getScrollHeight();
|
125
|
-
var targets =
|
180
|
+
var targets = SelectorEngine.find(this._selector);
|
126
181
|
targets.map(function (element) {
|
127
182
|
var target;
|
128
|
-
var targetSelector =
|
183
|
+
var targetSelector = getSelectorFromElement(element);
|
129
184
|
|
130
185
|
if (targetSelector) {
|
131
|
-
target =
|
186
|
+
target = SelectorEngine.findOne(targetSelector);
|
132
187
|
}
|
133
188
|
|
134
189
|
if (target) {
|
135
190
|
var targetBCR = target.getBoundingClientRect();
|
136
191
|
|
137
192
|
if (targetBCR.width || targetBCR.height) {
|
138
|
-
|
139
|
-
return [$__default["default"](target)[offsetMethod]().top + offsetBase, targetSelector];
|
193
|
+
return [Manipulator[offsetMethod](target).top + offsetBase, targetSelector];
|
140
194
|
}
|
141
195
|
}
|
142
196
|
|
143
197
|
return null;
|
144
|
-
}).filter(
|
198
|
+
}).filter(function (item) {
|
199
|
+
return item;
|
200
|
+
}).sort(function (a, b) {
|
145
201
|
return a[0] - b[0];
|
146
202
|
}).forEach(function (item) {
|
147
203
|
_this2._offsets.push(item[0]);
|
@@ -151,8 +207,8 @@
|
|
151
207
|
};
|
152
208
|
|
153
209
|
_proto.dispose = function dispose() {
|
154
|
-
|
155
|
-
|
210
|
+
Data.removeData(this._element, DATA_KEY);
|
211
|
+
EventHandler.off(this._scrollElement, EVENT_KEY);
|
156
212
|
this._element = null;
|
157
213
|
this._scrollElement = null;
|
158
214
|
this._config = null;
|
@@ -165,20 +221,20 @@
|
|
165
221
|
;
|
166
222
|
|
167
223
|
_proto._getConfig = function _getConfig(config) {
|
168
|
-
config =
|
224
|
+
config = _objectSpread(_objectSpread({}, Default), typeof config === 'object' && config ? config : {});
|
169
225
|
|
170
|
-
if (typeof config.target !== 'string' &&
|
171
|
-
var id =
|
226
|
+
if (typeof config.target !== 'string' && isElement(config.target)) {
|
227
|
+
var id = config.target.id;
|
172
228
|
|
173
229
|
if (!id) {
|
174
|
-
id =
|
175
|
-
|
230
|
+
id = getUID(NAME);
|
231
|
+
config.target.id = id;
|
176
232
|
}
|
177
233
|
|
178
234
|
config.target = "#" + id;
|
179
235
|
}
|
180
236
|
|
181
|
-
|
237
|
+
typeCheckConfig(NAME, config, DefaultType);
|
182
238
|
return config;
|
183
239
|
};
|
184
240
|
|
@@ -241,28 +297,36 @@
|
|
241
297
|
return selector + "[data-target=\"" + target + "\"]," + selector + "[href=\"" + target + "\"]";
|
242
298
|
});
|
243
299
|
|
244
|
-
var
|
300
|
+
var link = SelectorEngine.findOne(queries.join(','));
|
245
301
|
|
246
|
-
if (
|
247
|
-
|
248
|
-
|
302
|
+
if (link.classList.contains(CLASS_NAME_DROPDOWN_ITEM)) {
|
303
|
+
SelectorEngine.findOne(SELECTOR_DROPDOWN_TOGGLE, link.closest(SELECTOR_DROPDOWN)).classList.add(CLASS_NAME_ACTIVE);
|
304
|
+
link.classList.add(CLASS_NAME_ACTIVE);
|
249
305
|
} else {
|
250
306
|
// Set triggered link as active
|
251
|
-
|
252
|
-
|
253
|
-
|
254
|
-
|
255
|
-
|
256
|
-
|
307
|
+
link.classList.add(CLASS_NAME_ACTIVE);
|
308
|
+
SelectorEngine.parents(link, SELECTOR_NAV_LIST_GROUP).forEach(function (listGroup) {
|
309
|
+
// Set triggered links parents as active
|
310
|
+
// With both <ul> and <nav> markup a parent is the previous sibling of any nav ancestor
|
311
|
+
SelectorEngine.prev(listGroup, SELECTOR_NAV_LINKS + ", " + SELECTOR_LIST_ITEMS).forEach(function (item) {
|
312
|
+
return item.classList.add(CLASS_NAME_ACTIVE);
|
313
|
+
}); // Handle special case when .nav-link is inside .nav-item
|
314
|
+
|
315
|
+
SelectorEngine.prev(listGroup, SELECTOR_NAV_ITEMS).forEach(function (navItem) {
|
316
|
+
SelectorEngine.children(navItem, SELECTOR_NAV_LINKS).forEach(function (item) {
|
317
|
+
return item.classList.add(CLASS_NAME_ACTIVE);
|
318
|
+
});
|
319
|
+
});
|
320
|
+
});
|
257
321
|
}
|
258
322
|
|
259
|
-
|
323
|
+
EventHandler.trigger(this._scrollElement, EVENT_ACTIVATE, {
|
260
324
|
relatedTarget: target
|
261
325
|
});
|
262
326
|
};
|
263
327
|
|
264
328
|
_proto._clear = function _clear() {
|
265
|
-
|
329
|
+
SelectorEngine.find(this._selector).filter(function (node) {
|
266
330
|
return node.classList.contains(CLASS_NAME_ACTIVE);
|
267
331
|
}).forEach(function (node) {
|
268
332
|
return node.classList.remove(CLASS_NAME_ACTIVE);
|
@@ -270,15 +334,14 @@
|
|
270
334
|
} // Static
|
271
335
|
;
|
272
336
|
|
273
|
-
ScrollSpy.
|
337
|
+
ScrollSpy.jQueryInterface = function jQueryInterface(config) {
|
274
338
|
return this.each(function () {
|
275
|
-
var data =
|
339
|
+
var data = Data.getData(this, DATA_KEY);
|
276
340
|
|
277
341
|
var _config = typeof config === 'object' && config;
|
278
342
|
|
279
343
|
if (!data) {
|
280
344
|
data = new ScrollSpy(this, _config);
|
281
|
-
$__default["default"](this).data(DATA_KEY, data);
|
282
345
|
}
|
283
346
|
|
284
347
|
if (typeof config === 'string') {
|
@@ -291,6 +354,10 @@
|
|
291
354
|
});
|
292
355
|
};
|
293
356
|
|
357
|
+
ScrollSpy.getInstance = function getInstance(element) {
|
358
|
+
return Data.getData(element, DATA_KEY);
|
359
|
+
};
|
360
|
+
|
294
361
|
_createClass(ScrollSpy, null, [{
|
295
362
|
key: "VERSION",
|
296
363
|
get: function get() {
|
@@ -306,32 +373,37 @@
|
|
306
373
|
return ScrollSpy;
|
307
374
|
}();
|
308
375
|
/**
|
309
|
-
*
|
376
|
+
* ------------------------------------------------------------------------
|
377
|
+
* Data Api implementation
|
378
|
+
* ------------------------------------------------------------------------
|
310
379
|
*/
|
311
380
|
|
312
381
|
|
313
|
-
|
314
|
-
|
315
|
-
|
316
|
-
|
317
|
-
for (var i = scrollSpysLength; i--;) {
|
318
|
-
var $spy = $__default["default"](scrollSpys[i]);
|
319
|
-
|
320
|
-
ScrollSpy._jQueryInterface.call($spy, $spy.data());
|
321
|
-
}
|
382
|
+
EventHandler.on(window, EVENT_LOAD_DATA_API, function () {
|
383
|
+
SelectorEngine.find(SELECTOR_DATA_SPY).forEach(function (spy) {
|
384
|
+
return new ScrollSpy(spy, Manipulator.getDataAttributes(spy));
|
385
|
+
});
|
322
386
|
});
|
387
|
+
var $ = getjQuery();
|
323
388
|
/**
|
389
|
+
* ------------------------------------------------------------------------
|
324
390
|
* jQuery
|
391
|
+
* ------------------------------------------------------------------------
|
325
392
|
*/
|
326
393
|
|
327
|
-
|
328
|
-
$__default["default"].fn[NAME].Constructor = ScrollSpy;
|
394
|
+
/* istanbul ignore if */
|
329
395
|
|
330
|
-
|
331
|
-
|
332
|
-
|
333
|
-
|
396
|
+
if ($) {
|
397
|
+
var JQUERY_NO_CONFLICT = $.fn[NAME];
|
398
|
+
$.fn[NAME] = ScrollSpy.jQueryInterface;
|
399
|
+
$.fn[NAME].Constructor = ScrollSpy;
|
400
|
+
|
401
|
+
$.fn[NAME].noConflict = function () {
|
402
|
+
$.fn[NAME] = JQUERY_NO_CONFLICT;
|
403
|
+
return ScrollSpy.jQueryInterface;
|
404
|
+
};
|
405
|
+
}
|
334
406
|
|
335
407
|
return ScrollSpy;
|
336
408
|
|
337
|
-
}));
|
409
|
+
})));
|