bootstrap 4.6.2 → 5.3.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.github/workflows/ci.yml +55 -0
- data/README.md +28 -5
- data/assets/javascripts/bootstrap/alert.js +50 -147
- data/assets/javascripts/bootstrap/base-component.js +83 -0
- data/assets/javascripts/bootstrap/button.js +40 -190
- data/assets/javascripts/bootstrap/carousel.js +282 -537
- data/assets/javascripts/bootstrap/collapse.js +166 -314
- data/assets/javascripts/bootstrap/dom/data.js +62 -0
- data/assets/javascripts/bootstrap/dom/event-handler.js +236 -0
- data/assets/javascripts/bootstrap/dom/manipulator.js +71 -0
- data/assets/javascripts/bootstrap/dom/selector-engine.js +103 -0
- data/assets/javascripts/bootstrap/dropdown.js +297 -455
- data/assets/javascripts/bootstrap/modal.js +223 -566
- data/assets/javascripts/bootstrap/offcanvas.js +245 -0
- data/assets/javascripts/bootstrap/popover.js +59 -208
- data/assets/javascripts/bootstrap/scrollspy.js +213 -276
- data/assets/javascripts/bootstrap/tab.js +222 -200
- data/assets/javascripts/bootstrap/toast.js +137 -206
- data/assets/javascripts/bootstrap/tooltip.js +403 -746
- data/assets/javascripts/bootstrap/util/backdrop.js +139 -0
- data/assets/javascripts/bootstrap/util/component-functions.js +41 -0
- data/assets/javascripts/bootstrap/util/config.js +67 -0
- data/assets/javascripts/bootstrap/util/focustrap.js +113 -0
- data/assets/javascripts/bootstrap/util/index.js +281 -0
- data/assets/javascripts/bootstrap/util/sanitizer.js +110 -0
- data/assets/javascripts/bootstrap/util/scrollbar.js +112 -0
- data/assets/javascripts/bootstrap/util/swipe.js +134 -0
- data/assets/javascripts/bootstrap/util/template-factory.js +150 -0
- data/assets/javascripts/bootstrap-global-this-define.js +6 -0
- data/assets/javascripts/bootstrap-global-this-undefine.js +2 -0
- data/assets/javascripts/bootstrap-sprockets.js +21 -5
- data/assets/javascripts/bootstrap.js +3623 -3485
- data/assets/javascripts/bootstrap.min.js +3 -3
- data/assets/stylesheets/_bootstrap-grid.scss +53 -21
- data/assets/stylesheets/_bootstrap-reboot.scss +5 -7
- data/assets/stylesheets/_bootstrap.scss +21 -13
- data/assets/stylesheets/bootstrap/_accordion.scss +158 -0
- data/assets/stylesheets/bootstrap/_alert.scss +32 -16
- data/assets/stylesheets/bootstrap/_badge.scss +15 -31
- data/assets/stylesheets/bootstrap/_breadcrumb.scss +22 -24
- data/assets/stylesheets/bootstrap/_button-group.scss +27 -48
- data/assets/stylesheets/bootstrap/_buttons.scss +136 -71
- data/assets/stylesheets/bootstrap/_card.scss +66 -113
- data/assets/stylesheets/bootstrap/_carousel.scss +78 -34
- data/assets/stylesheets/bootstrap/_close.scss +51 -28
- data/assets/stylesheets/bootstrap/_containers.scss +41 -0
- data/assets/stylesheets/bootstrap/_dropdown.scss +129 -71
- data/assets/stylesheets/bootstrap/_forms.scss +9 -347
- data/assets/stylesheets/bootstrap/_functions.scss +135 -23
- data/assets/stylesheets/bootstrap/_grid.scss +18 -52
- data/assets/stylesheets/bootstrap/_helpers.scss +12 -0
- data/assets/stylesheets/bootstrap/_list-group.scss +77 -34
- data/assets/stylesheets/bootstrap/_maps.scss +174 -0
- data/assets/stylesheets/bootstrap/_mixins.scss +10 -15
- data/assets/stylesheets/bootstrap/_modal.scss +107 -110
- data/assets/stylesheets/bootstrap/_nav.scss +99 -27
- data/assets/stylesheets/bootstrap/_navbar.scss +129 -172
- data/assets/stylesheets/bootstrap/_offcanvas.scss +146 -0
- data/assets/stylesheets/bootstrap/_pagination.scss +72 -37
- data/assets/stylesheets/bootstrap/_placeholders.scss +51 -0
- data/assets/stylesheets/bootstrap/_popover.scss +99 -73
- data/assets/stylesheets/bootstrap/_progress.scss +35 -14
- data/assets/stylesheets/bootstrap/_reboot.scss +318 -192
- data/assets/stylesheets/bootstrap/_root.scss +174 -9
- data/assets/stylesheets/bootstrap/_spinners.scss +43 -23
- data/assets/stylesheets/bootstrap/_tables.scss +101 -115
- data/assets/stylesheets/bootstrap/_toasts.scss +54 -27
- data/assets/stylesheets/bootstrap/_tooltip.scss +67 -63
- data/assets/stylesheets/bootstrap/_transitions.scss +3 -2
- data/assets/stylesheets/bootstrap/_type.scss +40 -59
- data/assets/stylesheets/bootstrap/_utilities.scss +806 -18
- data/assets/stylesheets/bootstrap/_variables-dark.scss +85 -0
- data/assets/stylesheets/bootstrap/_variables.scss +1202 -606
- data/assets/stylesheets/bootstrap/bootstrap-utilities.scss +19 -0
- data/assets/stylesheets/bootstrap/forms/_floating-labels.scss +95 -0
- data/assets/stylesheets/bootstrap/forms/_form-check.scss +188 -0
- data/assets/stylesheets/bootstrap/forms/_form-control.scss +214 -0
- data/assets/stylesheets/bootstrap/forms/_form-range.scss +91 -0
- data/assets/stylesheets/bootstrap/forms/_form-select.scss +80 -0
- data/assets/stylesheets/bootstrap/forms/_form-text.scss +11 -0
- data/assets/stylesheets/bootstrap/forms/_input-group.scss +132 -0
- data/assets/stylesheets/bootstrap/forms/_labels.scss +36 -0
- data/assets/stylesheets/bootstrap/forms/_validation.scss +12 -0
- data/assets/stylesheets/bootstrap/helpers/_color-bg.scss +7 -0
- data/assets/stylesheets/bootstrap/helpers/_colored-links.scss +30 -0
- data/assets/stylesheets/bootstrap/helpers/_focus-ring.scss +5 -0
- data/assets/stylesheets/bootstrap/helpers/_icon-link.scss +25 -0
- data/assets/stylesheets/bootstrap/helpers/_position.scss +36 -0
- data/assets/stylesheets/bootstrap/helpers/_ratio.scss +26 -0
- data/assets/stylesheets/bootstrap/helpers/_stacks.scss +15 -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/helpers/_visually-hidden.scss +8 -0
- data/assets/stylesheets/bootstrap/helpers/_vr.scss +8 -0
- data/assets/stylesheets/bootstrap/mixins/_alert.scss +11 -6
- data/assets/stylesheets/bootstrap/mixins/_backdrop.scss +14 -0
- data/assets/stylesheets/bootstrap/mixins/_banner.scss +7 -0
- data/assets/stylesheets/bootstrap/mixins/_border-radius.scss +10 -8
- data/assets/stylesheets/bootstrap/mixins/_box-shadow.scss +7 -9
- data/assets/stylesheets/bootstrap/mixins/_breakpoints.scss +20 -16
- data/assets/stylesheets/bootstrap/mixins/_buttons.scss +60 -100
- data/assets/stylesheets/bootstrap/mixins/_caret.scss +34 -27
- data/assets/stylesheets/bootstrap/mixins/_clearfix.scss +2 -0
- data/assets/stylesheets/bootstrap/mixins/_color-mode.scss +21 -0
- data/assets/stylesheets/bootstrap/mixins/_color-scheme.scss +7 -0
- data/assets/stylesheets/bootstrap/mixins/_container.scss +11 -0
- data/assets/stylesheets/bootstrap/mixins/_forms.scss +54 -96
- data/assets/stylesheets/bootstrap/mixins/_gradients.scss +13 -11
- data/assets/stylesheets/bootstrap/mixins/_grid.scss +118 -36
- data/assets/stylesheets/bootstrap/mixins/_image.scss +1 -21
- data/assets/stylesheets/bootstrap/mixins/_list-group.scss +7 -2
- data/assets/stylesheets/bootstrap/mixins/_lists.scss +1 -1
- data/assets/stylesheets/bootstrap/mixins/_pagination.scss +7 -19
- data/assets/stylesheets/bootstrap/mixins/_reset-text.scss +2 -2
- data/assets/stylesheets/bootstrap/mixins/_table-variants.scss +24 -0
- data/assets/stylesheets/bootstrap/mixins/_transition.scss +1 -1
- data/assets/stylesheets/bootstrap/mixins/_utilities.scss +97 -0
- data/assets/stylesheets/bootstrap/mixins/_visually-hidden.scss +33 -0
- data/assets/stylesheets/bootstrap/utilities/_api.scss +47 -0
- data/assets/stylesheets/bootstrap/vendor/_rfs.scss +211 -91
- data/bootstrap.gemspec +3 -5
- data/lib/bootstrap/version.rb +2 -2
- data/tasks/updater/js.rb +17 -5
- data/tasks/updater/network.rb +2 -2
- data/tasks/updater/scss.rb +1 -1
- data/tasks/updater.rb +2 -2
- data/test/dummy_rails/app/assets/javascripts/application.js +4 -3
- data/test/dummy_rails/app/views/layouts/application.html.erb +3 -1
- data/test/dummy_rails/app/views/pages/root.html +89 -0
- data/test/dummy_rails/config/application.rb +0 -3
- data/test/gemfiles/rails_5_2.gemfile +8 -0
- data/test/gemfiles/rails_6_1.gemfile +7 -0
- data/test/gemfiles/rails_7_0.gemfile +7 -0
- data/test/test_helper.rb +3 -2
- metadata +78 -82
- data/.travis.yml +0 -31
- 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/_screen-reader.scss +0 -34
- 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/dummy_rails/app/views/pages/root.html.slim +0 -58
- /data/assets/stylesheets/bootstrap/{utilities → helpers}/_clearfix.scss +0 -0
@@ -0,0 +1,110 @@
|
|
1
|
+
/*!
|
2
|
+
* Bootstrap sanitizer.js v5.3.1 (https://getbootstrap.com/)
|
3
|
+
* Copyright 2011-2023 The Bootstrap Authors (https://github.com/twbs/bootstrap/graphs/contributors)
|
4
|
+
* Licensed under MIT (https://github.com/twbs/bootstrap/blob/main/LICENSE)
|
5
|
+
*/
|
6
|
+
(function (global, factory) {
|
7
|
+
typeof exports === 'object' && typeof module !== 'undefined' ? factory(exports) :
|
8
|
+
typeof define === 'function' && define.amd ? define(['exports'], factory) :
|
9
|
+
(global = typeof globalThis !== 'undefined' ? globalThis : global || self, factory(global.Sanitizer = {}));
|
10
|
+
})(this, (function (exports) { 'use strict';
|
11
|
+
|
12
|
+
/**
|
13
|
+
* --------------------------------------------------------------------------
|
14
|
+
* Bootstrap util/sanitizer.js
|
15
|
+
* Licensed under MIT (https://github.com/twbs/bootstrap/blob/main/LICENSE)
|
16
|
+
* --------------------------------------------------------------------------
|
17
|
+
*/
|
18
|
+
|
19
|
+
// js-docs-start allow-list
|
20
|
+
const ARIA_ATTRIBUTE_PATTERN = /^aria-[\w-]*$/i;
|
21
|
+
const DefaultAllowlist = {
|
22
|
+
// Global attributes allowed on any supplied element below.
|
23
|
+
'*': ['class', 'dir', 'id', 'lang', 'role', ARIA_ATTRIBUTE_PATTERN],
|
24
|
+
a: ['target', 'href', 'title', 'rel'],
|
25
|
+
area: [],
|
26
|
+
b: [],
|
27
|
+
br: [],
|
28
|
+
col: [],
|
29
|
+
code: [],
|
30
|
+
div: [],
|
31
|
+
em: [],
|
32
|
+
hr: [],
|
33
|
+
h1: [],
|
34
|
+
h2: [],
|
35
|
+
h3: [],
|
36
|
+
h4: [],
|
37
|
+
h5: [],
|
38
|
+
h6: [],
|
39
|
+
i: [],
|
40
|
+
img: ['src', 'srcset', 'alt', 'title', 'width', 'height'],
|
41
|
+
li: [],
|
42
|
+
ol: [],
|
43
|
+
p: [],
|
44
|
+
pre: [],
|
45
|
+
s: [],
|
46
|
+
small: [],
|
47
|
+
span: [],
|
48
|
+
sub: [],
|
49
|
+
sup: [],
|
50
|
+
strong: [],
|
51
|
+
u: [],
|
52
|
+
ul: []
|
53
|
+
};
|
54
|
+
// js-docs-end allow-list
|
55
|
+
|
56
|
+
const uriAttributes = new Set(['background', 'cite', 'href', 'itemtype', 'longdesc', 'poster', 'src', 'xlink:href']);
|
57
|
+
|
58
|
+
/**
|
59
|
+
* A pattern that recognizes URLs that are safe wrt. XSS in URL navigation
|
60
|
+
* contexts.
|
61
|
+
*
|
62
|
+
* Shout-out to Angular https://github.com/angular/angular/blob/15.2.8/packages/core/src/sanitization/url_sanitizer.ts#L38
|
63
|
+
*/
|
64
|
+
// eslint-disable-next-line unicorn/better-regex
|
65
|
+
const SAFE_URL_PATTERN = /^(?!javascript:)(?:[a-z0-9+.-]+:|[^&:/?#]*(?:[/?#]|$))/i;
|
66
|
+
const allowedAttribute = (attribute, allowedAttributeList) => {
|
67
|
+
const attributeName = attribute.nodeName.toLowerCase();
|
68
|
+
if (allowedAttributeList.includes(attributeName)) {
|
69
|
+
if (uriAttributes.has(attributeName)) {
|
70
|
+
return Boolean(SAFE_URL_PATTERN.test(attribute.nodeValue));
|
71
|
+
}
|
72
|
+
return true;
|
73
|
+
}
|
74
|
+
|
75
|
+
// Check if a regular expression validates the attribute.
|
76
|
+
return allowedAttributeList.filter(attributeRegex => attributeRegex instanceof RegExp).some(regex => regex.test(attributeName));
|
77
|
+
};
|
78
|
+
function sanitizeHtml(unsafeHtml, allowList, sanitizeFunction) {
|
79
|
+
if (!unsafeHtml.length) {
|
80
|
+
return unsafeHtml;
|
81
|
+
}
|
82
|
+
if (sanitizeFunction && typeof sanitizeFunction === 'function') {
|
83
|
+
return sanitizeFunction(unsafeHtml);
|
84
|
+
}
|
85
|
+
const domParser = new window.DOMParser();
|
86
|
+
const createdDocument = domParser.parseFromString(unsafeHtml, 'text/html');
|
87
|
+
const elements = [].concat(...createdDocument.body.querySelectorAll('*'));
|
88
|
+
for (const element of elements) {
|
89
|
+
const elementName = element.nodeName.toLowerCase();
|
90
|
+
if (!Object.keys(allowList).includes(elementName)) {
|
91
|
+
element.remove();
|
92
|
+
continue;
|
93
|
+
}
|
94
|
+
const attributeList = [].concat(...element.attributes);
|
95
|
+
const allowedAttributes = [].concat(allowList['*'] || [], allowList[elementName] || []);
|
96
|
+
for (const attribute of attributeList) {
|
97
|
+
if (!allowedAttribute(attribute, allowedAttributes)) {
|
98
|
+
element.removeAttribute(attribute.nodeName);
|
99
|
+
}
|
100
|
+
}
|
101
|
+
}
|
102
|
+
return createdDocument.body.innerHTML;
|
103
|
+
}
|
104
|
+
|
105
|
+
exports.DefaultAllowlist = DefaultAllowlist;
|
106
|
+
exports.sanitizeHtml = sanitizeHtml;
|
107
|
+
|
108
|
+
Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });
|
109
|
+
|
110
|
+
}));
|
@@ -0,0 +1,112 @@
|
|
1
|
+
/*!
|
2
|
+
* Bootstrap scrollbar.js v5.3.1 (https://getbootstrap.com/)
|
3
|
+
* Copyright 2011-2023 The Bootstrap Authors (https://github.com/twbs/bootstrap/graphs/contributors)
|
4
|
+
* Licensed under MIT (https://github.com/twbs/bootstrap/blob/main/LICENSE)
|
5
|
+
*/
|
6
|
+
(function (global, factory) {
|
7
|
+
typeof exports === 'object' && typeof module !== 'undefined' ? module.exports = factory(require('../dom/manipulator.js'), require('../dom/selector-engine.js'), require('./index.js')) :
|
8
|
+
typeof define === 'function' && define.amd ? define(['../dom/manipulator', '../dom/selector-engine', './index'], factory) :
|
9
|
+
(global = typeof globalThis !== 'undefined' ? globalThis : global || self, global.Scrollbar = factory(global.Manipulator, global.SelectorEngine, global.Index));
|
10
|
+
})(this, (function (Manipulator, SelectorEngine, index_js) { 'use strict';
|
11
|
+
|
12
|
+
/**
|
13
|
+
* --------------------------------------------------------------------------
|
14
|
+
* Bootstrap util/scrollBar.js
|
15
|
+
* Licensed under MIT (https://github.com/twbs/bootstrap/blob/main/LICENSE)
|
16
|
+
* --------------------------------------------------------------------------
|
17
|
+
*/
|
18
|
+
|
19
|
+
|
20
|
+
/**
|
21
|
+
* Constants
|
22
|
+
*/
|
23
|
+
|
24
|
+
const SELECTOR_FIXED_CONTENT = '.fixed-top, .fixed-bottom, .is-fixed, .sticky-top';
|
25
|
+
const SELECTOR_STICKY_CONTENT = '.sticky-top';
|
26
|
+
const PROPERTY_PADDING = 'padding-right';
|
27
|
+
const PROPERTY_MARGIN = 'margin-right';
|
28
|
+
|
29
|
+
/**
|
30
|
+
* Class definition
|
31
|
+
*/
|
32
|
+
|
33
|
+
class ScrollBarHelper {
|
34
|
+
constructor() {
|
35
|
+
this._element = document.body;
|
36
|
+
}
|
37
|
+
|
38
|
+
// Public
|
39
|
+
getWidth() {
|
40
|
+
// https://developer.mozilla.org/en-US/docs/Web/API/Window/innerWidth#usage_notes
|
41
|
+
const documentWidth = document.documentElement.clientWidth;
|
42
|
+
return Math.abs(window.innerWidth - documentWidth);
|
43
|
+
}
|
44
|
+
hide() {
|
45
|
+
const width = this.getWidth();
|
46
|
+
this._disableOverFlow();
|
47
|
+
// give padding to element to balance the hidden scrollbar width
|
48
|
+
this._setElementAttributes(this._element, PROPERTY_PADDING, calculatedValue => calculatedValue + width);
|
49
|
+
// trick: We adjust positive paddingRight and negative marginRight to sticky-top elements to keep showing fullwidth
|
50
|
+
this._setElementAttributes(SELECTOR_FIXED_CONTENT, PROPERTY_PADDING, calculatedValue => calculatedValue + width);
|
51
|
+
this._setElementAttributes(SELECTOR_STICKY_CONTENT, PROPERTY_MARGIN, calculatedValue => calculatedValue - width);
|
52
|
+
}
|
53
|
+
reset() {
|
54
|
+
this._resetElementAttributes(this._element, 'overflow');
|
55
|
+
this._resetElementAttributes(this._element, PROPERTY_PADDING);
|
56
|
+
this._resetElementAttributes(SELECTOR_FIXED_CONTENT, PROPERTY_PADDING);
|
57
|
+
this._resetElementAttributes(SELECTOR_STICKY_CONTENT, PROPERTY_MARGIN);
|
58
|
+
}
|
59
|
+
isOverflowing() {
|
60
|
+
return this.getWidth() > 0;
|
61
|
+
}
|
62
|
+
|
63
|
+
// Private
|
64
|
+
_disableOverFlow() {
|
65
|
+
this._saveInitialAttribute(this._element, 'overflow');
|
66
|
+
this._element.style.overflow = 'hidden';
|
67
|
+
}
|
68
|
+
_setElementAttributes(selector, styleProperty, callback) {
|
69
|
+
const scrollbarWidth = this.getWidth();
|
70
|
+
const manipulationCallBack = element => {
|
71
|
+
if (element !== this._element && window.innerWidth > element.clientWidth + scrollbarWidth) {
|
72
|
+
return;
|
73
|
+
}
|
74
|
+
this._saveInitialAttribute(element, styleProperty);
|
75
|
+
const calculatedValue = window.getComputedStyle(element).getPropertyValue(styleProperty);
|
76
|
+
element.style.setProperty(styleProperty, `${callback(Number.parseFloat(calculatedValue))}px`);
|
77
|
+
};
|
78
|
+
this._applyManipulationCallback(selector, manipulationCallBack);
|
79
|
+
}
|
80
|
+
_saveInitialAttribute(element, styleProperty) {
|
81
|
+
const actualValue = element.style.getPropertyValue(styleProperty);
|
82
|
+
if (actualValue) {
|
83
|
+
Manipulator.setDataAttribute(element, styleProperty, actualValue);
|
84
|
+
}
|
85
|
+
}
|
86
|
+
_resetElementAttributes(selector, styleProperty) {
|
87
|
+
const manipulationCallBack = element => {
|
88
|
+
const value = Manipulator.getDataAttribute(element, styleProperty);
|
89
|
+
// We only want to remove the property if the value is `null`; the value can also be zero
|
90
|
+
if (value === null) {
|
91
|
+
element.style.removeProperty(styleProperty);
|
92
|
+
return;
|
93
|
+
}
|
94
|
+
Manipulator.removeDataAttribute(element, styleProperty);
|
95
|
+
element.style.setProperty(styleProperty, value);
|
96
|
+
};
|
97
|
+
this._applyManipulationCallback(selector, manipulationCallBack);
|
98
|
+
}
|
99
|
+
_applyManipulationCallback(selector, callBack) {
|
100
|
+
if (index_js.isElement(selector)) {
|
101
|
+
callBack(selector);
|
102
|
+
return;
|
103
|
+
}
|
104
|
+
for (const sel of SelectorEngine.find(selector, this._element)) {
|
105
|
+
callBack(sel);
|
106
|
+
}
|
107
|
+
}
|
108
|
+
}
|
109
|
+
|
110
|
+
return ScrollBarHelper;
|
111
|
+
|
112
|
+
}));
|
@@ -0,0 +1,134 @@
|
|
1
|
+
/*!
|
2
|
+
* Bootstrap swipe.js v5.3.1 (https://getbootstrap.com/)
|
3
|
+
* Copyright 2011-2023 The Bootstrap Authors (https://github.com/twbs/bootstrap/graphs/contributors)
|
4
|
+
* Licensed under MIT (https://github.com/twbs/bootstrap/blob/main/LICENSE)
|
5
|
+
*/
|
6
|
+
(function (global, factory) {
|
7
|
+
typeof exports === 'object' && typeof module !== 'undefined' ? module.exports = factory(require('../dom/event-handler.js'), require('./config.js'), require('./index.js')) :
|
8
|
+
typeof define === 'function' && define.amd ? define(['../dom/event-handler', './config', './index'], factory) :
|
9
|
+
(global = typeof globalThis !== 'undefined' ? globalThis : global || self, global.Swipe = factory(global.EventHandler, global.Config, global.Index));
|
10
|
+
})(this, (function (EventHandler, Config, index_js) { 'use strict';
|
11
|
+
|
12
|
+
/**
|
13
|
+
* --------------------------------------------------------------------------
|
14
|
+
* Bootstrap util/swipe.js
|
15
|
+
* Licensed under MIT (https://github.com/twbs/bootstrap/blob/main/LICENSE)
|
16
|
+
* --------------------------------------------------------------------------
|
17
|
+
*/
|
18
|
+
|
19
|
+
|
20
|
+
/**
|
21
|
+
* Constants
|
22
|
+
*/
|
23
|
+
|
24
|
+
const NAME = 'swipe';
|
25
|
+
const EVENT_KEY = '.bs.swipe';
|
26
|
+
const EVENT_TOUCHSTART = `touchstart${EVENT_KEY}`;
|
27
|
+
const EVENT_TOUCHMOVE = `touchmove${EVENT_KEY}`;
|
28
|
+
const EVENT_TOUCHEND = `touchend${EVENT_KEY}`;
|
29
|
+
const EVENT_POINTERDOWN = `pointerdown${EVENT_KEY}`;
|
30
|
+
const EVENT_POINTERUP = `pointerup${EVENT_KEY}`;
|
31
|
+
const POINTER_TYPE_TOUCH = 'touch';
|
32
|
+
const POINTER_TYPE_PEN = 'pen';
|
33
|
+
const CLASS_NAME_POINTER_EVENT = 'pointer-event';
|
34
|
+
const SWIPE_THRESHOLD = 40;
|
35
|
+
const Default = {
|
36
|
+
endCallback: null,
|
37
|
+
leftCallback: null,
|
38
|
+
rightCallback: null
|
39
|
+
};
|
40
|
+
const DefaultType = {
|
41
|
+
endCallback: '(function|null)',
|
42
|
+
leftCallback: '(function|null)',
|
43
|
+
rightCallback: '(function|null)'
|
44
|
+
};
|
45
|
+
|
46
|
+
/**
|
47
|
+
* Class definition
|
48
|
+
*/
|
49
|
+
|
50
|
+
class Swipe extends Config {
|
51
|
+
constructor(element, config) {
|
52
|
+
super();
|
53
|
+
this._element = element;
|
54
|
+
if (!element || !Swipe.isSupported()) {
|
55
|
+
return;
|
56
|
+
}
|
57
|
+
this._config = this._getConfig(config);
|
58
|
+
this._deltaX = 0;
|
59
|
+
this._supportPointerEvents = Boolean(window.PointerEvent);
|
60
|
+
this._initEvents();
|
61
|
+
}
|
62
|
+
|
63
|
+
// Getters
|
64
|
+
static get Default() {
|
65
|
+
return Default;
|
66
|
+
}
|
67
|
+
static get DefaultType() {
|
68
|
+
return DefaultType;
|
69
|
+
}
|
70
|
+
static get NAME() {
|
71
|
+
return NAME;
|
72
|
+
}
|
73
|
+
|
74
|
+
// Public
|
75
|
+
dispose() {
|
76
|
+
EventHandler.off(this._element, EVENT_KEY);
|
77
|
+
}
|
78
|
+
|
79
|
+
// Private
|
80
|
+
_start(event) {
|
81
|
+
if (!this._supportPointerEvents) {
|
82
|
+
this._deltaX = event.touches[0].clientX;
|
83
|
+
return;
|
84
|
+
}
|
85
|
+
if (this._eventIsPointerPenTouch(event)) {
|
86
|
+
this._deltaX = event.clientX;
|
87
|
+
}
|
88
|
+
}
|
89
|
+
_end(event) {
|
90
|
+
if (this._eventIsPointerPenTouch(event)) {
|
91
|
+
this._deltaX = event.clientX - this._deltaX;
|
92
|
+
}
|
93
|
+
this._handleSwipe();
|
94
|
+
index_js.execute(this._config.endCallback);
|
95
|
+
}
|
96
|
+
_move(event) {
|
97
|
+
this._deltaX = event.touches && event.touches.length > 1 ? 0 : event.touches[0].clientX - this._deltaX;
|
98
|
+
}
|
99
|
+
_handleSwipe() {
|
100
|
+
const absDeltaX = Math.abs(this._deltaX);
|
101
|
+
if (absDeltaX <= SWIPE_THRESHOLD) {
|
102
|
+
return;
|
103
|
+
}
|
104
|
+
const direction = absDeltaX / this._deltaX;
|
105
|
+
this._deltaX = 0;
|
106
|
+
if (!direction) {
|
107
|
+
return;
|
108
|
+
}
|
109
|
+
index_js.execute(direction > 0 ? this._config.rightCallback : this._config.leftCallback);
|
110
|
+
}
|
111
|
+
_initEvents() {
|
112
|
+
if (this._supportPointerEvents) {
|
113
|
+
EventHandler.on(this._element, EVENT_POINTERDOWN, event => this._start(event));
|
114
|
+
EventHandler.on(this._element, EVENT_POINTERUP, event => this._end(event));
|
115
|
+
this._element.classList.add(CLASS_NAME_POINTER_EVENT);
|
116
|
+
} else {
|
117
|
+
EventHandler.on(this._element, EVENT_TOUCHSTART, event => this._start(event));
|
118
|
+
EventHandler.on(this._element, EVENT_TOUCHMOVE, event => this._move(event));
|
119
|
+
EventHandler.on(this._element, EVENT_TOUCHEND, event => this._end(event));
|
120
|
+
}
|
121
|
+
}
|
122
|
+
_eventIsPointerPenTouch(event) {
|
123
|
+
return this._supportPointerEvents && (event.pointerType === POINTER_TYPE_PEN || event.pointerType === POINTER_TYPE_TOUCH);
|
124
|
+
}
|
125
|
+
|
126
|
+
// Static
|
127
|
+
static isSupported() {
|
128
|
+
return 'ontouchstart' in document.documentElement || navigator.maxTouchPoints > 0;
|
129
|
+
}
|
130
|
+
}
|
131
|
+
|
132
|
+
return Swipe;
|
133
|
+
|
134
|
+
}));
|
@@ -0,0 +1,150 @@
|
|
1
|
+
/*!
|
2
|
+
* Bootstrap template-factory.js v5.3.1 (https://getbootstrap.com/)
|
3
|
+
* Copyright 2011-2023 The Bootstrap Authors (https://github.com/twbs/bootstrap/graphs/contributors)
|
4
|
+
* Licensed under MIT (https://github.com/twbs/bootstrap/blob/main/LICENSE)
|
5
|
+
*/
|
6
|
+
(function (global, factory) {
|
7
|
+
typeof exports === 'object' && typeof module !== 'undefined' ? module.exports = factory(require('../dom/selector-engine.js'), require('./config.js'), require('./sanitizer.js'), require('./index.js')) :
|
8
|
+
typeof define === 'function' && define.amd ? define(['../dom/selector-engine', './config', './sanitizer', './index'], factory) :
|
9
|
+
(global = typeof globalThis !== 'undefined' ? globalThis : global || self, global.TemplateFactory = factory(global.SelectorEngine, global.Config, global.Sanitizer, global.Index));
|
10
|
+
})(this, (function (SelectorEngine, Config, sanitizer_js, index_js) { 'use strict';
|
11
|
+
|
12
|
+
/**
|
13
|
+
* --------------------------------------------------------------------------
|
14
|
+
* Bootstrap util/template-factory.js
|
15
|
+
* Licensed under MIT (https://github.com/twbs/bootstrap/blob/main/LICENSE)
|
16
|
+
* --------------------------------------------------------------------------
|
17
|
+
*/
|
18
|
+
|
19
|
+
|
20
|
+
/**
|
21
|
+
* Constants
|
22
|
+
*/
|
23
|
+
|
24
|
+
const NAME = 'TemplateFactory';
|
25
|
+
const Default = {
|
26
|
+
allowList: sanitizer_js.DefaultAllowlist,
|
27
|
+
content: {},
|
28
|
+
// { selector : text , selector2 : text2 , }
|
29
|
+
extraClass: '',
|
30
|
+
html: false,
|
31
|
+
sanitize: true,
|
32
|
+
sanitizeFn: null,
|
33
|
+
template: '<div></div>'
|
34
|
+
};
|
35
|
+
const DefaultType = {
|
36
|
+
allowList: 'object',
|
37
|
+
content: 'object',
|
38
|
+
extraClass: '(string|function)',
|
39
|
+
html: 'boolean',
|
40
|
+
sanitize: 'boolean',
|
41
|
+
sanitizeFn: '(null|function)',
|
42
|
+
template: 'string'
|
43
|
+
};
|
44
|
+
const DefaultContentType = {
|
45
|
+
entry: '(string|element|function|null)',
|
46
|
+
selector: '(string|element)'
|
47
|
+
};
|
48
|
+
|
49
|
+
/**
|
50
|
+
* Class definition
|
51
|
+
*/
|
52
|
+
|
53
|
+
class TemplateFactory extends Config {
|
54
|
+
constructor(config) {
|
55
|
+
super();
|
56
|
+
this._config = this._getConfig(config);
|
57
|
+
}
|
58
|
+
|
59
|
+
// Getters
|
60
|
+
static get Default() {
|
61
|
+
return Default;
|
62
|
+
}
|
63
|
+
static get DefaultType() {
|
64
|
+
return DefaultType;
|
65
|
+
}
|
66
|
+
static get NAME() {
|
67
|
+
return NAME;
|
68
|
+
}
|
69
|
+
|
70
|
+
// Public
|
71
|
+
getContent() {
|
72
|
+
return Object.values(this._config.content).map(config => this._resolvePossibleFunction(config)).filter(Boolean);
|
73
|
+
}
|
74
|
+
hasContent() {
|
75
|
+
return this.getContent().length > 0;
|
76
|
+
}
|
77
|
+
changeContent(content) {
|
78
|
+
this._checkContent(content);
|
79
|
+
this._config.content = {
|
80
|
+
...this._config.content,
|
81
|
+
...content
|
82
|
+
};
|
83
|
+
return this;
|
84
|
+
}
|
85
|
+
toHtml() {
|
86
|
+
const templateWrapper = document.createElement('div');
|
87
|
+
templateWrapper.innerHTML = this._maybeSanitize(this._config.template);
|
88
|
+
for (const [selector, text] of Object.entries(this._config.content)) {
|
89
|
+
this._setContent(templateWrapper, text, selector);
|
90
|
+
}
|
91
|
+
const template = templateWrapper.children[0];
|
92
|
+
const extraClass = this._resolvePossibleFunction(this._config.extraClass);
|
93
|
+
if (extraClass) {
|
94
|
+
template.classList.add(...extraClass.split(' '));
|
95
|
+
}
|
96
|
+
return template;
|
97
|
+
}
|
98
|
+
|
99
|
+
// Private
|
100
|
+
_typeCheckConfig(config) {
|
101
|
+
super._typeCheckConfig(config);
|
102
|
+
this._checkContent(config.content);
|
103
|
+
}
|
104
|
+
_checkContent(arg) {
|
105
|
+
for (const [selector, content] of Object.entries(arg)) {
|
106
|
+
super._typeCheckConfig({
|
107
|
+
selector,
|
108
|
+
entry: content
|
109
|
+
}, DefaultContentType);
|
110
|
+
}
|
111
|
+
}
|
112
|
+
_setContent(template, content, selector) {
|
113
|
+
const templateElement = SelectorEngine.findOne(selector, template);
|
114
|
+
if (!templateElement) {
|
115
|
+
return;
|
116
|
+
}
|
117
|
+
content = this._resolvePossibleFunction(content);
|
118
|
+
if (!content) {
|
119
|
+
templateElement.remove();
|
120
|
+
return;
|
121
|
+
}
|
122
|
+
if (index_js.isElement(content)) {
|
123
|
+
this._putElementInTemplate(index_js.getElement(content), templateElement);
|
124
|
+
return;
|
125
|
+
}
|
126
|
+
if (this._config.html) {
|
127
|
+
templateElement.innerHTML = this._maybeSanitize(content);
|
128
|
+
return;
|
129
|
+
}
|
130
|
+
templateElement.textContent = content;
|
131
|
+
}
|
132
|
+
_maybeSanitize(arg) {
|
133
|
+
return this._config.sanitize ? sanitizer_js.sanitizeHtml(arg, this._config.allowList, this._config.sanitizeFn) : arg;
|
134
|
+
}
|
135
|
+
_resolvePossibleFunction(arg) {
|
136
|
+
return index_js.execute(arg, [this]);
|
137
|
+
}
|
138
|
+
_putElementInTemplate(element, templateElement) {
|
139
|
+
if (this._config.html) {
|
140
|
+
templateElement.innerHTML = '';
|
141
|
+
templateElement.append(element);
|
142
|
+
return;
|
143
|
+
}
|
144
|
+
templateElement.textContent = element.textContent;
|
145
|
+
}
|
146
|
+
}
|
147
|
+
|
148
|
+
return TemplateFactory;
|
149
|
+
|
150
|
+
}));
|
@@ -1,12 +1,28 @@
|
|
1
|
-
//= require ./bootstrap
|
2
|
-
//= require ./bootstrap/
|
1
|
+
//= require ./bootstrap-global-this-define
|
2
|
+
//= require ./bootstrap/dom/data
|
3
|
+
//= require ./bootstrap/util/index
|
4
|
+
//= require ./bootstrap/dom/event-handler
|
5
|
+
//= require ./bootstrap/dom/manipulator
|
6
|
+
//= require ./bootstrap/util/config
|
7
|
+
//= require ./bootstrap/base-component
|
8
|
+
//= require ./bootstrap/util/swipe
|
9
|
+
//= require ./bootstrap/dom/selector-engine
|
10
|
+
//= require ./bootstrap/util/sanitizer
|
11
|
+
//= require ./bootstrap/util/template-factory
|
3
12
|
//= require ./bootstrap/button
|
4
|
-
//= require ./bootstrap/carousel
|
5
13
|
//= require ./bootstrap/collapse
|
14
|
+
//= require ./bootstrap/util/backdrop
|
6
15
|
//= require ./bootstrap/dropdown
|
16
|
+
//= require ./bootstrap/util/component-functions
|
17
|
+
//= require ./bootstrap/alert
|
18
|
+
//= require ./bootstrap/util/focustrap
|
19
|
+
//= require ./bootstrap/util/scrollbar
|
7
20
|
//= require ./bootstrap/modal
|
21
|
+
//= require ./bootstrap/carousel
|
22
|
+
//= require ./bootstrap/scrollspy
|
23
|
+
//= require ./bootstrap/offcanvas
|
8
24
|
//= require ./bootstrap/tooltip
|
9
25
|
//= require ./bootstrap/popover
|
10
|
-
//= require ./bootstrap/scrollspy
|
11
|
-
//= require ./bootstrap/tab
|
12
26
|
//= require ./bootstrap/toast
|
27
|
+
//= require ./bootstrap/tab
|
28
|
+
//= require ./bootstrap-global-this-undefine
|