bootstrap-propshaft 5.3.2

Sign up to get free protection for your applications and to get access to all the features.
Files changed (185) hide show
  1. checksums.yaml +7 -0
  2. data/.gitattributes +14 -0
  3. data/.github/workflows/ci.yml +61 -0
  4. data/.gitignore +19 -0
  5. data/CHANGELOG.md +25 -0
  6. data/Gemfile +12 -0
  7. data/LICENSE +21 -0
  8. data/README.md +138 -0
  9. data/Rakefile +89 -0
  10. data/assets/javascripts/bootstrap/alert.js +89 -0
  11. data/assets/javascripts/bootstrap/base-component.js +83 -0
  12. data/assets/javascripts/bootstrap/button.js +78 -0
  13. data/assets/javascripts/bootstrap/carousel.js +387 -0
  14. data/assets/javascripts/bootstrap/collapse.js +248 -0
  15. data/assets/javascripts/bootstrap/dom/data.js +62 -0
  16. data/assets/javascripts/bootstrap/dom/event-handler.js +236 -0
  17. data/assets/javascripts/bootstrap/dom/manipulator.js +71 -0
  18. data/assets/javascripts/bootstrap/dom/selector-engine.js +103 -0
  19. data/assets/javascripts/bootstrap/dropdown.js +401 -0
  20. data/assets/javascripts/bootstrap/modal.js +319 -0
  21. data/assets/javascripts/bootstrap/offcanvas.js +245 -0
  22. data/assets/javascripts/bootstrap/popover.js +95 -0
  23. data/assets/javascripts/bootstrap/scrollspy.js +274 -0
  24. data/assets/javascripts/bootstrap/tab.js +284 -0
  25. data/assets/javascripts/bootstrap/toast.js +198 -0
  26. data/assets/javascripts/bootstrap/tooltip.js +545 -0
  27. data/assets/javascripts/bootstrap/util/backdrop.js +139 -0
  28. data/assets/javascripts/bootstrap/util/component-functions.js +41 -0
  29. data/assets/javascripts/bootstrap/util/config.js +67 -0
  30. data/assets/javascripts/bootstrap/util/focustrap.js +113 -0
  31. data/assets/javascripts/bootstrap/util/index.js +281 -0
  32. data/assets/javascripts/bootstrap/util/sanitizer.js +110 -0
  33. data/assets/javascripts/bootstrap/util/scrollbar.js +112 -0
  34. data/assets/javascripts/bootstrap/util/swipe.js +134 -0
  35. data/assets/javascripts/bootstrap/util/template-factory.js +150 -0
  36. data/assets/javascripts/bootstrap-global-this-define.js +6 -0
  37. data/assets/javascripts/bootstrap-global-this-undefine.js +2 -0
  38. data/assets/javascripts/bootstrap-sprockets.js +28 -0
  39. data/assets/javascripts/bootstrap.js +4493 -0
  40. data/assets/javascripts/bootstrap.min.js +6 -0
  41. data/assets/stylesheets/_bootstrap-grid.scss +62 -0
  42. data/assets/stylesheets/_bootstrap-reboot.scss +10 -0
  43. data/assets/stylesheets/_bootstrap-utilities.scss +19 -0
  44. data/assets/stylesheets/_bootstrap.scss +52 -0
  45. data/assets/stylesheets/bootstrap/_accordion.scss +158 -0
  46. data/assets/stylesheets/bootstrap/_alert.scss +68 -0
  47. data/assets/stylesheets/bootstrap/_badge.scss +38 -0
  48. data/assets/stylesheets/bootstrap/_breadcrumb.scss +40 -0
  49. data/assets/stylesheets/bootstrap/_button-group.scss +142 -0
  50. data/assets/stylesheets/bootstrap/_buttons.scss +207 -0
  51. data/assets/stylesheets/bootstrap/_card.scss +239 -0
  52. data/assets/stylesheets/bootstrap/_carousel.scss +244 -0
  53. data/assets/stylesheets/bootstrap/_close.scss +63 -0
  54. data/assets/stylesheets/bootstrap/_containers.scss +41 -0
  55. data/assets/stylesheets/bootstrap/_dropdown.scss +250 -0
  56. data/assets/stylesheets/bootstrap/_forms.scss +9 -0
  57. data/assets/stylesheets/bootstrap/_functions.scss +302 -0
  58. data/assets/stylesheets/bootstrap/_grid.scss +39 -0
  59. data/assets/stylesheets/bootstrap/_helpers.scss +12 -0
  60. data/assets/stylesheets/bootstrap/_images.scss +42 -0
  61. data/assets/stylesheets/bootstrap/_list-group.scss +197 -0
  62. data/assets/stylesheets/bootstrap/_maps.scss +174 -0
  63. data/assets/stylesheets/bootstrap/_mixins.scss +42 -0
  64. data/assets/stylesheets/bootstrap/_modal.scss +237 -0
  65. data/assets/stylesheets/bootstrap/_nav.scss +197 -0
  66. data/assets/stylesheets/bootstrap/_navbar.scss +289 -0
  67. data/assets/stylesheets/bootstrap/_offcanvas.scss +146 -0
  68. data/assets/stylesheets/bootstrap/_pagination.scss +109 -0
  69. data/assets/stylesheets/bootstrap/_placeholders.scss +51 -0
  70. data/assets/stylesheets/bootstrap/_popover.scss +196 -0
  71. data/assets/stylesheets/bootstrap/_progress.scss +68 -0
  72. data/assets/stylesheets/bootstrap/_reboot.scss +611 -0
  73. data/assets/stylesheets/bootstrap/_root.scss +187 -0
  74. data/assets/stylesheets/bootstrap/_spinners.scss +85 -0
  75. data/assets/stylesheets/bootstrap/_tables.scss +171 -0
  76. data/assets/stylesheets/bootstrap/_toasts.scss +73 -0
  77. data/assets/stylesheets/bootstrap/_tooltip.scss +119 -0
  78. data/assets/stylesheets/bootstrap/_transitions.scss +27 -0
  79. data/assets/stylesheets/bootstrap/_type.scss +106 -0
  80. data/assets/stylesheets/bootstrap/_utilities.scss +806 -0
  81. data/assets/stylesheets/bootstrap/_variables-dark.scss +87 -0
  82. data/assets/stylesheets/bootstrap/_variables.scss +1747 -0
  83. data/assets/stylesheets/bootstrap/forms/_floating-labels.scss +95 -0
  84. data/assets/stylesheets/bootstrap/forms/_form-check.scss +189 -0
  85. data/assets/stylesheets/bootstrap/forms/_form-control.scss +214 -0
  86. data/assets/stylesheets/bootstrap/forms/_form-range.scss +91 -0
  87. data/assets/stylesheets/bootstrap/forms/_form-select.scss +80 -0
  88. data/assets/stylesheets/bootstrap/forms/_form-text.scss +11 -0
  89. data/assets/stylesheets/bootstrap/forms/_input-group.scss +132 -0
  90. data/assets/stylesheets/bootstrap/forms/_labels.scss +36 -0
  91. data/assets/stylesheets/bootstrap/forms/_validation.scss +12 -0
  92. data/assets/stylesheets/bootstrap/helpers/_clearfix.scss +3 -0
  93. data/assets/stylesheets/bootstrap/helpers/_color-bg.scss +7 -0
  94. data/assets/stylesheets/bootstrap/helpers/_colored-links.scss +30 -0
  95. data/assets/stylesheets/bootstrap/helpers/_focus-ring.scss +5 -0
  96. data/assets/stylesheets/bootstrap/helpers/_icon-link.scss +25 -0
  97. data/assets/stylesheets/bootstrap/helpers/_position.scss +36 -0
  98. data/assets/stylesheets/bootstrap/helpers/_ratio.scss +26 -0
  99. data/assets/stylesheets/bootstrap/helpers/_stacks.scss +15 -0
  100. data/assets/stylesheets/bootstrap/helpers/_stretched-link.scss +15 -0
  101. data/assets/stylesheets/bootstrap/helpers/_text-truncation.scss +7 -0
  102. data/assets/stylesheets/bootstrap/helpers/_visually-hidden.scss +8 -0
  103. data/assets/stylesheets/bootstrap/helpers/_vr.scss +8 -0
  104. data/assets/stylesheets/bootstrap/mixins/_alert.scss +18 -0
  105. data/assets/stylesheets/bootstrap/mixins/_backdrop.scss +14 -0
  106. data/assets/stylesheets/bootstrap/mixins/_banner.scss +7 -0
  107. data/assets/stylesheets/bootstrap/mixins/_border-radius.scss +78 -0
  108. data/assets/stylesheets/bootstrap/mixins/_box-shadow.scss +18 -0
  109. data/assets/stylesheets/bootstrap/mixins/_breakpoints.scss +127 -0
  110. data/assets/stylesheets/bootstrap/mixins/_buttons.scss +70 -0
  111. data/assets/stylesheets/bootstrap/mixins/_caret.scss +69 -0
  112. data/assets/stylesheets/bootstrap/mixins/_clearfix.scss +9 -0
  113. data/assets/stylesheets/bootstrap/mixins/_color-mode.scss +21 -0
  114. data/assets/stylesheets/bootstrap/mixins/_color-scheme.scss +7 -0
  115. data/assets/stylesheets/bootstrap/mixins/_container.scss +11 -0
  116. data/assets/stylesheets/bootstrap/mixins/_deprecate.scss +10 -0
  117. data/assets/stylesheets/bootstrap/mixins/_forms.scss +153 -0
  118. data/assets/stylesheets/bootstrap/mixins/_gradients.scss +47 -0
  119. data/assets/stylesheets/bootstrap/mixins/_grid.scss +151 -0
  120. data/assets/stylesheets/bootstrap/mixins/_image.scss +16 -0
  121. data/assets/stylesheets/bootstrap/mixins/_list-group.scss +26 -0
  122. data/assets/stylesheets/bootstrap/mixins/_lists.scss +7 -0
  123. data/assets/stylesheets/bootstrap/mixins/_pagination.scss +10 -0
  124. data/assets/stylesheets/bootstrap/mixins/_reset-text.scss +17 -0
  125. data/assets/stylesheets/bootstrap/mixins/_resize.scss +6 -0
  126. data/assets/stylesheets/bootstrap/mixins/_table-variants.scss +24 -0
  127. data/assets/stylesheets/bootstrap/mixins/_text-truncate.scss +8 -0
  128. data/assets/stylesheets/bootstrap/mixins/_transition.scss +26 -0
  129. data/assets/stylesheets/bootstrap/mixins/_utilities.scss +97 -0
  130. data/assets/stylesheets/bootstrap/mixins/_visually-hidden.scss +33 -0
  131. data/assets/stylesheets/bootstrap/utilities/_api.scss +47 -0
  132. data/assets/stylesheets/bootstrap/vendor/_rfs.scss +348 -0
  133. data/bootstrap.gemspec +39 -0
  134. data/lib/bootstrap/engine.rb +22 -0
  135. data/lib/bootstrap/version.rb +6 -0
  136. data/lib/bootstrap.rb +75 -0
  137. data/tasks/updater/js.rb +92 -0
  138. data/tasks/updater/logger.rb +57 -0
  139. data/tasks/updater/network.rb +109 -0
  140. data/tasks/updater/scss.rb +26 -0
  141. data/tasks/updater.rb +67 -0
  142. data/test/dummy_rails/README.rdoc +3 -0
  143. data/test/dummy_rails/Rakefile +6 -0
  144. data/test/dummy_rails/app/assets/config/manifest.js +3 -0
  145. data/test/dummy_rails/app/assets/images/.keep +0 -0
  146. data/test/dummy_rails/app/assets/javascripts/application.js +8 -0
  147. data/test/dummy_rails/app/assets/stylesheets/.browserslistrc +1 -0
  148. data/test/dummy_rails/app/assets/stylesheets/application.sass +4 -0
  149. data/test/dummy_rails/app/controllers/application_controller.rb +5 -0
  150. data/test/dummy_rails/app/controllers/pages_controller.rb +4 -0
  151. data/test/dummy_rails/app/helpers/application_helper.rb +2 -0
  152. data/test/dummy_rails/app/views/layouts/application.html.erb +16 -0
  153. data/test/dummy_rails/app/views/pages/root.html +89 -0
  154. data/test/dummy_rails/config/application.rb +32 -0
  155. data/test/dummy_rails/config/boot.rb +5 -0
  156. data/test/dummy_rails/config/environment.rb +5 -0
  157. data/test/dummy_rails/config/environments/development.rb +23 -0
  158. data/test/dummy_rails/config/environments/production.rb +82 -0
  159. data/test/dummy_rails/config/environments/test.rb +38 -0
  160. data/test/dummy_rails/config/initializers/backtrace_silencers.rb +7 -0
  161. data/test/dummy_rails/config/initializers/filter_parameter_logging.rb +4 -0
  162. data/test/dummy_rails/config/initializers/inflections.rb +16 -0
  163. data/test/dummy_rails/config/initializers/mime_types.rb +5 -0
  164. data/test/dummy_rails/config/initializers/secret_token.rb +18 -0
  165. data/test/dummy_rails/config/initializers/session_store.rb +3 -0
  166. data/test/dummy_rails/config/initializers/wrap_parameters.rb +14 -0
  167. data/test/dummy_rails/config/locales/en.yml +3 -0
  168. data/test/dummy_rails/config/locales/es.yml +3 -0
  169. data/test/dummy_rails/config/routes.rb +3 -0
  170. data/test/dummy_rails/config.ru +4 -0
  171. data/test/dummy_rails/log/.keep +0 -0
  172. data/test/gemfiles/rails_4_2.gemfile +7 -0
  173. data/test/gemfiles/rails_5_0.gemfile +8 -0
  174. data/test/gemfiles/rails_5_1.gemfile +8 -0
  175. data/test/gemfiles/rails_5_2.gemfile +8 -0
  176. data/test/gemfiles/rails_6_0.gemfile +8 -0
  177. data/test/gemfiles/rails_6_1.gemfile +8 -0
  178. data/test/gemfiles/rails_7_0_dartsass.gemfile +8 -0
  179. data/test/gemfiles/rails_7_0_sassc.gemfile +8 -0
  180. data/test/rails_test.rb +24 -0
  181. data/test/support/dummy_rails_integration.rb +31 -0
  182. data/test/support/reporting.rb +27 -0
  183. data/test/test_helper.rb +42 -0
  184. data/test/test_helper_rails.rb +6 -0
  185. metadata +471 -0
@@ -0,0 +1,41 @@
1
+ /*!
2
+ * Bootstrap component-functions.js v5.3.2 (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, require('../dom/event-handler.js'), require('../dom/selector-engine.js'), require('./index.js')) :
8
+ typeof define === 'function' && define.amd ? define(['exports', '../dom/event-handler', '../dom/selector-engine', './index'], factory) :
9
+ (global = typeof globalThis !== 'undefined' ? globalThis : global || self, factory(global.ComponentFunctions = {}, global.EventHandler, global.SelectorEngine, global.Index));
10
+ })(this, (function (exports, EventHandler, SelectorEngine, index_js) { 'use strict';
11
+
12
+ /**
13
+ * --------------------------------------------------------------------------
14
+ * Bootstrap util/component-functions.js
15
+ * Licensed under MIT (https://github.com/twbs/bootstrap/blob/main/LICENSE)
16
+ * --------------------------------------------------------------------------
17
+ */
18
+
19
+ const enableDismissTrigger = (component, method = 'hide') => {
20
+ const clickEvent = `click.dismiss${component.EVENT_KEY}`;
21
+ const name = component.NAME;
22
+ EventHandler.on(document, clickEvent, `[data-bs-dismiss="${name}"]`, function (event) {
23
+ if (['A', 'AREA'].includes(this.tagName)) {
24
+ event.preventDefault();
25
+ }
26
+ if (index_js.isDisabled(this)) {
27
+ return;
28
+ }
29
+ const target = SelectorEngine.getElementFromSelector(this) || this.closest(`.${name}`);
30
+ const instance = component.getOrCreateInstance(target);
31
+
32
+ // Method argument is left, for Alert and only, as it doesn't implement the 'hide' method
33
+ instance[method]();
34
+ });
35
+ };
36
+
37
+ exports.enableDismissTrigger = enableDismissTrigger;
38
+
39
+ Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });
40
+
41
+ }));
@@ -0,0 +1,67 @@
1
+ /*!
2
+ * Bootstrap config.js v5.3.2 (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('./index.js')) :
8
+ typeof define === 'function' && define.amd ? define(['../dom/manipulator', './index'], factory) :
9
+ (global = typeof globalThis !== 'undefined' ? globalThis : global || self, global.Config = factory(global.Manipulator, global.Index));
10
+ })(this, (function (Manipulator, index_js) { 'use strict';
11
+
12
+ /**
13
+ * --------------------------------------------------------------------------
14
+ * Bootstrap util/config.js
15
+ * Licensed under MIT (https://github.com/twbs/bootstrap/blob/main/LICENSE)
16
+ * --------------------------------------------------------------------------
17
+ */
18
+
19
+
20
+ /**
21
+ * Class definition
22
+ */
23
+
24
+ class Config {
25
+ // Getters
26
+ static get Default() {
27
+ return {};
28
+ }
29
+ static get DefaultType() {
30
+ return {};
31
+ }
32
+ static get NAME() {
33
+ throw new Error('You have to implement the static method "NAME", for each component!');
34
+ }
35
+ _getConfig(config) {
36
+ config = this._mergeConfigObj(config);
37
+ config = this._configAfterMerge(config);
38
+ this._typeCheckConfig(config);
39
+ return config;
40
+ }
41
+ _configAfterMerge(config) {
42
+ return config;
43
+ }
44
+ _mergeConfigObj(config, element) {
45
+ const jsonConfig = index_js.isElement(element) ? Manipulator.getDataAttribute(element, 'config') : {}; // try to parse
46
+
47
+ return {
48
+ ...this.constructor.Default,
49
+ ...(typeof jsonConfig === 'object' ? jsonConfig : {}),
50
+ ...(index_js.isElement(element) ? Manipulator.getDataAttributes(element) : {}),
51
+ ...(typeof config === 'object' ? config : {})
52
+ };
53
+ }
54
+ _typeCheckConfig(config, configTypes = this.constructor.DefaultType) {
55
+ for (const [property, expectedTypes] of Object.entries(configTypes)) {
56
+ const value = config[property];
57
+ const valueType = index_js.isElement(value) ? 'element' : index_js.toType(value);
58
+ if (!new RegExp(expectedTypes).test(valueType)) {
59
+ throw new TypeError(`${this.constructor.NAME.toUpperCase()}: Option "${property}" provided type "${valueType}" but expected type "${expectedTypes}".`);
60
+ }
61
+ }
62
+ }
63
+ }
64
+
65
+ return Config;
66
+
67
+ }));
@@ -0,0 +1,113 @@
1
+ /*!
2
+ * Bootstrap focustrap.js v5.3.2 (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('../dom/selector-engine.js'), require('./config.js')) :
8
+ typeof define === 'function' && define.amd ? define(['../dom/event-handler', '../dom/selector-engine', './config'], factory) :
9
+ (global = typeof globalThis !== 'undefined' ? globalThis : global || self, global.Focustrap = factory(global.EventHandler, global.SelectorEngine, global.Config));
10
+ })(this, (function (EventHandler, SelectorEngine, Config) { 'use strict';
11
+
12
+ /**
13
+ * --------------------------------------------------------------------------
14
+ * Bootstrap util/focustrap.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 = 'focustrap';
25
+ const DATA_KEY = 'bs.focustrap';
26
+ const EVENT_KEY = `.${DATA_KEY}`;
27
+ const EVENT_FOCUSIN = `focusin${EVENT_KEY}`;
28
+ const EVENT_KEYDOWN_TAB = `keydown.tab${EVENT_KEY}`;
29
+ const TAB_KEY = 'Tab';
30
+ const TAB_NAV_FORWARD = 'forward';
31
+ const TAB_NAV_BACKWARD = 'backward';
32
+ const Default = {
33
+ autofocus: true,
34
+ trapElement: null // The element to trap focus inside of
35
+ };
36
+
37
+ const DefaultType = {
38
+ autofocus: 'boolean',
39
+ trapElement: 'element'
40
+ };
41
+
42
+ /**
43
+ * Class definition
44
+ */
45
+
46
+ class FocusTrap extends Config {
47
+ constructor(config) {
48
+ super();
49
+ this._config = this._getConfig(config);
50
+ this._isActive = false;
51
+ this._lastTabNavDirection = null;
52
+ }
53
+
54
+ // Getters
55
+ static get Default() {
56
+ return Default;
57
+ }
58
+ static get DefaultType() {
59
+ return DefaultType;
60
+ }
61
+ static get NAME() {
62
+ return NAME;
63
+ }
64
+
65
+ // Public
66
+ activate() {
67
+ if (this._isActive) {
68
+ return;
69
+ }
70
+ if (this._config.autofocus) {
71
+ this._config.trapElement.focus();
72
+ }
73
+ EventHandler.off(document, EVENT_KEY); // guard against infinite focus loop
74
+ EventHandler.on(document, EVENT_FOCUSIN, event => this._handleFocusin(event));
75
+ EventHandler.on(document, EVENT_KEYDOWN_TAB, event => this._handleKeydown(event));
76
+ this._isActive = true;
77
+ }
78
+ deactivate() {
79
+ if (!this._isActive) {
80
+ return;
81
+ }
82
+ this._isActive = false;
83
+ EventHandler.off(document, EVENT_KEY);
84
+ }
85
+
86
+ // Private
87
+ _handleFocusin(event) {
88
+ const {
89
+ trapElement
90
+ } = this._config;
91
+ if (event.target === document || event.target === trapElement || trapElement.contains(event.target)) {
92
+ return;
93
+ }
94
+ const elements = SelectorEngine.focusableChildren(trapElement);
95
+ if (elements.length === 0) {
96
+ trapElement.focus();
97
+ } else if (this._lastTabNavDirection === TAB_NAV_BACKWARD) {
98
+ elements[elements.length - 1].focus();
99
+ } else {
100
+ elements[0].focus();
101
+ }
102
+ }
103
+ _handleKeydown(event) {
104
+ if (event.key !== TAB_KEY) {
105
+ return;
106
+ }
107
+ this._lastTabNavDirection = event.shiftKey ? TAB_NAV_BACKWARD : TAB_NAV_FORWARD;
108
+ }
109
+ }
110
+
111
+ return FocusTrap;
112
+
113
+ }));
@@ -0,0 +1,281 @@
1
+ /*!
2
+ * Bootstrap index.js v5.3.2 (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.Index = {}));
10
+ })(this, (function (exports) { 'use strict';
11
+
12
+ /**
13
+ * --------------------------------------------------------------------------
14
+ * Bootstrap util/index.js
15
+ * Licensed under MIT (https://github.com/twbs/bootstrap/blob/main/LICENSE)
16
+ * --------------------------------------------------------------------------
17
+ */
18
+
19
+ const MAX_UID = 1000000;
20
+ const MILLISECONDS_MULTIPLIER = 1000;
21
+ const TRANSITION_END = 'transitionend';
22
+
23
+ /**
24
+ * Properly escape IDs selectors to handle weird IDs
25
+ * @param {string} selector
26
+ * @returns {string}
27
+ */
28
+ const parseSelector = selector => {
29
+ if (selector && window.CSS && window.CSS.escape) {
30
+ // document.querySelector needs escaping to handle IDs (html5+) containing for instance /
31
+ selector = selector.replace(/#([^\s"#']+)/g, (match, id) => `#${CSS.escape(id)}`);
32
+ }
33
+ return selector;
34
+ };
35
+
36
+ // Shout-out Angus Croll (https://goo.gl/pxwQGp)
37
+ const toType = object => {
38
+ if (object === null || object === undefined) {
39
+ return `${object}`;
40
+ }
41
+ return Object.prototype.toString.call(object).match(/\s([a-z]+)/i)[1].toLowerCase();
42
+ };
43
+
44
+ /**
45
+ * Public Util API
46
+ */
47
+
48
+ const getUID = prefix => {
49
+ do {
50
+ prefix += Math.floor(Math.random() * MAX_UID);
51
+ } while (document.getElementById(prefix));
52
+ return prefix;
53
+ };
54
+ const getTransitionDurationFromElement = element => {
55
+ if (!element) {
56
+ return 0;
57
+ }
58
+
59
+ // Get transition-duration of the element
60
+ let {
61
+ transitionDuration,
62
+ transitionDelay
63
+ } = window.getComputedStyle(element);
64
+ const floatTransitionDuration = Number.parseFloat(transitionDuration);
65
+ const floatTransitionDelay = Number.parseFloat(transitionDelay);
66
+
67
+ // Return 0 if element or transition duration is not found
68
+ if (!floatTransitionDuration && !floatTransitionDelay) {
69
+ return 0;
70
+ }
71
+
72
+ // If multiple durations are defined, take the first
73
+ transitionDuration = transitionDuration.split(',')[0];
74
+ transitionDelay = transitionDelay.split(',')[0];
75
+ return (Number.parseFloat(transitionDuration) + Number.parseFloat(transitionDelay)) * MILLISECONDS_MULTIPLIER;
76
+ };
77
+ const triggerTransitionEnd = element => {
78
+ element.dispatchEvent(new Event(TRANSITION_END));
79
+ };
80
+ const isElement = object => {
81
+ if (!object || typeof object !== 'object') {
82
+ return false;
83
+ }
84
+ if (typeof object.jquery !== 'undefined') {
85
+ object = object[0];
86
+ }
87
+ return typeof object.nodeType !== 'undefined';
88
+ };
89
+ const getElement = object => {
90
+ // it's a jQuery object or a node element
91
+ if (isElement(object)) {
92
+ return object.jquery ? object[0] : object;
93
+ }
94
+ if (typeof object === 'string' && object.length > 0) {
95
+ return document.querySelector(parseSelector(object));
96
+ }
97
+ return null;
98
+ };
99
+ const isVisible = element => {
100
+ if (!isElement(element) || element.getClientRects().length === 0) {
101
+ return false;
102
+ }
103
+ const elementIsVisible = getComputedStyle(element).getPropertyValue('visibility') === 'visible';
104
+ // Handle `details` element as its content may falsie appear visible when it is closed
105
+ const closedDetails = element.closest('details:not([open])');
106
+ if (!closedDetails) {
107
+ return elementIsVisible;
108
+ }
109
+ if (closedDetails !== element) {
110
+ const summary = element.closest('summary');
111
+ if (summary && summary.parentNode !== closedDetails) {
112
+ return false;
113
+ }
114
+ if (summary === null) {
115
+ return false;
116
+ }
117
+ }
118
+ return elementIsVisible;
119
+ };
120
+ const isDisabled = element => {
121
+ if (!element || element.nodeType !== Node.ELEMENT_NODE) {
122
+ return true;
123
+ }
124
+ if (element.classList.contains('disabled')) {
125
+ return true;
126
+ }
127
+ if (typeof element.disabled !== 'undefined') {
128
+ return element.disabled;
129
+ }
130
+ return element.hasAttribute('disabled') && element.getAttribute('disabled') !== 'false';
131
+ };
132
+ const findShadowRoot = element => {
133
+ if (!document.documentElement.attachShadow) {
134
+ return null;
135
+ }
136
+
137
+ // Can find the shadow root otherwise it'll return the document
138
+ if (typeof element.getRootNode === 'function') {
139
+ const root = element.getRootNode();
140
+ return root instanceof ShadowRoot ? root : null;
141
+ }
142
+ if (element instanceof ShadowRoot) {
143
+ return element;
144
+ }
145
+
146
+ // when we don't find a shadow root
147
+ if (!element.parentNode) {
148
+ return null;
149
+ }
150
+ return findShadowRoot(element.parentNode);
151
+ };
152
+ const noop = () => {};
153
+
154
+ /**
155
+ * Trick to restart an element's animation
156
+ *
157
+ * @param {HTMLElement} element
158
+ * @return void
159
+ *
160
+ * @see https://www.charistheo.io/blog/2021/02/restart-a-css-animation-with-javascript/#restarting-a-css-animation
161
+ */
162
+ const reflow = element => {
163
+ element.offsetHeight; // eslint-disable-line no-unused-expressions
164
+ };
165
+
166
+ const getjQuery = () => {
167
+ if (window.jQuery && !document.body.hasAttribute('data-bs-no-jquery')) {
168
+ return window.jQuery;
169
+ }
170
+ return null;
171
+ };
172
+ const DOMContentLoadedCallbacks = [];
173
+ const onDOMContentLoaded = callback => {
174
+ if (document.readyState === 'loading') {
175
+ // add listener on the first call when the document is in loading state
176
+ if (!DOMContentLoadedCallbacks.length) {
177
+ document.addEventListener('DOMContentLoaded', () => {
178
+ for (const callback of DOMContentLoadedCallbacks) {
179
+ callback();
180
+ }
181
+ });
182
+ }
183
+ DOMContentLoadedCallbacks.push(callback);
184
+ } else {
185
+ callback();
186
+ }
187
+ };
188
+ const isRTL = () => document.documentElement.dir === 'rtl';
189
+ const defineJQueryPlugin = plugin => {
190
+ onDOMContentLoaded(() => {
191
+ const $ = getjQuery();
192
+ /* istanbul ignore if */
193
+ if ($) {
194
+ const name = plugin.NAME;
195
+ const JQUERY_NO_CONFLICT = $.fn[name];
196
+ $.fn[name] = plugin.jQueryInterface;
197
+ $.fn[name].Constructor = plugin;
198
+ $.fn[name].noConflict = () => {
199
+ $.fn[name] = JQUERY_NO_CONFLICT;
200
+ return plugin.jQueryInterface;
201
+ };
202
+ }
203
+ });
204
+ };
205
+ const execute = (possibleCallback, args = [], defaultValue = possibleCallback) => {
206
+ return typeof possibleCallback === 'function' ? possibleCallback(...args) : defaultValue;
207
+ };
208
+ const executeAfterTransition = (callback, transitionElement, waitForTransition = true) => {
209
+ if (!waitForTransition) {
210
+ execute(callback);
211
+ return;
212
+ }
213
+ const durationPadding = 5;
214
+ const emulatedDuration = getTransitionDurationFromElement(transitionElement) + durationPadding;
215
+ let called = false;
216
+ const handler = ({
217
+ target
218
+ }) => {
219
+ if (target !== transitionElement) {
220
+ return;
221
+ }
222
+ called = true;
223
+ transitionElement.removeEventListener(TRANSITION_END, handler);
224
+ execute(callback);
225
+ };
226
+ transitionElement.addEventListener(TRANSITION_END, handler);
227
+ setTimeout(() => {
228
+ if (!called) {
229
+ triggerTransitionEnd(transitionElement);
230
+ }
231
+ }, emulatedDuration);
232
+ };
233
+
234
+ /**
235
+ * Return the previous/next element of a list.
236
+ *
237
+ * @param {array} list The list of elements
238
+ * @param activeElement The active element
239
+ * @param shouldGetNext Choose to get next or previous element
240
+ * @param isCycleAllowed
241
+ * @return {Element|elem} The proper element
242
+ */
243
+ const getNextActiveElement = (list, activeElement, shouldGetNext, isCycleAllowed) => {
244
+ const listLength = list.length;
245
+ let index = list.indexOf(activeElement);
246
+
247
+ // if the element does not exist in the list return an element
248
+ // depending on the direction and if cycle is allowed
249
+ if (index === -1) {
250
+ return !shouldGetNext && isCycleAllowed ? list[listLength - 1] : list[0];
251
+ }
252
+ index += shouldGetNext ? 1 : -1;
253
+ if (isCycleAllowed) {
254
+ index = (index + listLength) % listLength;
255
+ }
256
+ return list[Math.max(0, Math.min(index, listLength - 1))];
257
+ };
258
+
259
+ exports.defineJQueryPlugin = defineJQueryPlugin;
260
+ exports.execute = execute;
261
+ exports.executeAfterTransition = executeAfterTransition;
262
+ exports.findShadowRoot = findShadowRoot;
263
+ exports.getElement = getElement;
264
+ exports.getNextActiveElement = getNextActiveElement;
265
+ exports.getTransitionDurationFromElement = getTransitionDurationFromElement;
266
+ exports.getUID = getUID;
267
+ exports.getjQuery = getjQuery;
268
+ exports.isDisabled = isDisabled;
269
+ exports.isElement = isElement;
270
+ exports.isRTL = isRTL;
271
+ exports.isVisible = isVisible;
272
+ exports.noop = noop;
273
+ exports.onDOMContentLoaded = onDOMContentLoaded;
274
+ exports.parseSelector = parseSelector;
275
+ exports.reflow = reflow;
276
+ exports.toType = toType;
277
+ exports.triggerTransitionEnd = triggerTransitionEnd;
278
+
279
+ Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });
280
+
281
+ }));
@@ -0,0 +1,110 @@
1
+ /*!
2
+ * Bootstrap sanitizer.js v5.3.2 (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
+ }));