bootstrap-propshaft 5.3.2
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +7 -0
- data/.gitattributes +14 -0
- data/.github/workflows/ci.yml +61 -0
- data/.gitignore +19 -0
- data/CHANGELOG.md +25 -0
- data/Gemfile +12 -0
- data/LICENSE +21 -0
- data/README.md +138 -0
- data/Rakefile +89 -0
- data/assets/javascripts/bootstrap/alert.js +89 -0
- data/assets/javascripts/bootstrap/base-component.js +83 -0
- data/assets/javascripts/bootstrap/button.js +78 -0
- data/assets/javascripts/bootstrap/carousel.js +387 -0
- data/assets/javascripts/bootstrap/collapse.js +248 -0
- 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 +401 -0
- data/assets/javascripts/bootstrap/modal.js +319 -0
- data/assets/javascripts/bootstrap/offcanvas.js +245 -0
- data/assets/javascripts/bootstrap/popover.js +95 -0
- data/assets/javascripts/bootstrap/scrollspy.js +274 -0
- data/assets/javascripts/bootstrap/tab.js +284 -0
- data/assets/javascripts/bootstrap/toast.js +198 -0
- data/assets/javascripts/bootstrap/tooltip.js +545 -0
- 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 +28 -0
- data/assets/javascripts/bootstrap.js +4493 -0
- data/assets/javascripts/bootstrap.min.js +6 -0
- data/assets/stylesheets/_bootstrap-grid.scss +62 -0
- data/assets/stylesheets/_bootstrap-reboot.scss +10 -0
- data/assets/stylesheets/_bootstrap-utilities.scss +19 -0
- data/assets/stylesheets/_bootstrap.scss +52 -0
- data/assets/stylesheets/bootstrap/_accordion.scss +158 -0
- data/assets/stylesheets/bootstrap/_alert.scss +68 -0
- data/assets/stylesheets/bootstrap/_badge.scss +38 -0
- data/assets/stylesheets/bootstrap/_breadcrumb.scss +40 -0
- data/assets/stylesheets/bootstrap/_button-group.scss +142 -0
- data/assets/stylesheets/bootstrap/_buttons.scss +207 -0
- data/assets/stylesheets/bootstrap/_card.scss +239 -0
- data/assets/stylesheets/bootstrap/_carousel.scss +244 -0
- data/assets/stylesheets/bootstrap/_close.scss +63 -0
- data/assets/stylesheets/bootstrap/_containers.scss +41 -0
- data/assets/stylesheets/bootstrap/_dropdown.scss +250 -0
- data/assets/stylesheets/bootstrap/_forms.scss +9 -0
- data/assets/stylesheets/bootstrap/_functions.scss +302 -0
- data/assets/stylesheets/bootstrap/_grid.scss +39 -0
- data/assets/stylesheets/bootstrap/_helpers.scss +12 -0
- data/assets/stylesheets/bootstrap/_images.scss +42 -0
- data/assets/stylesheets/bootstrap/_list-group.scss +197 -0
- data/assets/stylesheets/bootstrap/_maps.scss +174 -0
- data/assets/stylesheets/bootstrap/_mixins.scss +42 -0
- data/assets/stylesheets/bootstrap/_modal.scss +237 -0
- data/assets/stylesheets/bootstrap/_nav.scss +197 -0
- data/assets/stylesheets/bootstrap/_navbar.scss +289 -0
- data/assets/stylesheets/bootstrap/_offcanvas.scss +146 -0
- data/assets/stylesheets/bootstrap/_pagination.scss +109 -0
- data/assets/stylesheets/bootstrap/_placeholders.scss +51 -0
- data/assets/stylesheets/bootstrap/_popover.scss +196 -0
- data/assets/stylesheets/bootstrap/_progress.scss +68 -0
- data/assets/stylesheets/bootstrap/_reboot.scss +611 -0
- data/assets/stylesheets/bootstrap/_root.scss +187 -0
- data/assets/stylesheets/bootstrap/_spinners.scss +85 -0
- data/assets/stylesheets/bootstrap/_tables.scss +171 -0
- data/assets/stylesheets/bootstrap/_toasts.scss +73 -0
- data/assets/stylesheets/bootstrap/_tooltip.scss +119 -0
- data/assets/stylesheets/bootstrap/_transitions.scss +27 -0
- data/assets/stylesheets/bootstrap/_type.scss +106 -0
- data/assets/stylesheets/bootstrap/_utilities.scss +806 -0
- data/assets/stylesheets/bootstrap/_variables-dark.scss +87 -0
- data/assets/stylesheets/bootstrap/_variables.scss +1747 -0
- data/assets/stylesheets/bootstrap/forms/_floating-labels.scss +95 -0
- data/assets/stylesheets/bootstrap/forms/_form-check.scss +189 -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/_clearfix.scss +3 -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 +18 -0
- 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 +78 -0
- data/assets/stylesheets/bootstrap/mixins/_box-shadow.scss +18 -0
- data/assets/stylesheets/bootstrap/mixins/_breakpoints.scss +127 -0
- data/assets/stylesheets/bootstrap/mixins/_buttons.scss +70 -0
- data/assets/stylesheets/bootstrap/mixins/_caret.scss +69 -0
- data/assets/stylesheets/bootstrap/mixins/_clearfix.scss +9 -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/_deprecate.scss +10 -0
- data/assets/stylesheets/bootstrap/mixins/_forms.scss +153 -0
- data/assets/stylesheets/bootstrap/mixins/_gradients.scss +47 -0
- data/assets/stylesheets/bootstrap/mixins/_grid.scss +151 -0
- data/assets/stylesheets/bootstrap/mixins/_image.scss +16 -0
- data/assets/stylesheets/bootstrap/mixins/_list-group.scss +26 -0
- data/assets/stylesheets/bootstrap/mixins/_lists.scss +7 -0
- data/assets/stylesheets/bootstrap/mixins/_pagination.scss +10 -0
- data/assets/stylesheets/bootstrap/mixins/_reset-text.scss +17 -0
- data/assets/stylesheets/bootstrap/mixins/_resize.scss +6 -0
- data/assets/stylesheets/bootstrap/mixins/_table-variants.scss +24 -0
- data/assets/stylesheets/bootstrap/mixins/_text-truncate.scss +8 -0
- data/assets/stylesheets/bootstrap/mixins/_transition.scss +26 -0
- 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 +348 -0
- data/bootstrap.gemspec +39 -0
- data/lib/bootstrap/engine.rb +22 -0
- data/lib/bootstrap/version.rb +6 -0
- data/lib/bootstrap.rb +75 -0
- data/tasks/updater/js.rb +92 -0
- data/tasks/updater/logger.rb +57 -0
- data/tasks/updater/network.rb +109 -0
- data/tasks/updater/scss.rb +26 -0
- data/tasks/updater.rb +67 -0
- data/test/dummy_rails/README.rdoc +3 -0
- data/test/dummy_rails/Rakefile +6 -0
- data/test/dummy_rails/app/assets/config/manifest.js +3 -0
- data/test/dummy_rails/app/assets/images/.keep +0 -0
- data/test/dummy_rails/app/assets/javascripts/application.js +8 -0
- data/test/dummy_rails/app/assets/stylesheets/.browserslistrc +1 -0
- data/test/dummy_rails/app/assets/stylesheets/application.sass +4 -0
- data/test/dummy_rails/app/controllers/application_controller.rb +5 -0
- data/test/dummy_rails/app/controllers/pages_controller.rb +4 -0
- data/test/dummy_rails/app/helpers/application_helper.rb +2 -0
- data/test/dummy_rails/app/views/layouts/application.html.erb +16 -0
- data/test/dummy_rails/app/views/pages/root.html +89 -0
- data/test/dummy_rails/config/application.rb +32 -0
- data/test/dummy_rails/config/boot.rb +5 -0
- data/test/dummy_rails/config/environment.rb +5 -0
- data/test/dummy_rails/config/environments/development.rb +23 -0
- data/test/dummy_rails/config/environments/production.rb +82 -0
- data/test/dummy_rails/config/environments/test.rb +38 -0
- data/test/dummy_rails/config/initializers/backtrace_silencers.rb +7 -0
- data/test/dummy_rails/config/initializers/filter_parameter_logging.rb +4 -0
- data/test/dummy_rails/config/initializers/inflections.rb +16 -0
- data/test/dummy_rails/config/initializers/mime_types.rb +5 -0
- data/test/dummy_rails/config/initializers/secret_token.rb +18 -0
- data/test/dummy_rails/config/initializers/session_store.rb +3 -0
- data/test/dummy_rails/config/initializers/wrap_parameters.rb +14 -0
- data/test/dummy_rails/config/locales/en.yml +3 -0
- data/test/dummy_rails/config/locales/es.yml +3 -0
- data/test/dummy_rails/config/routes.rb +3 -0
- data/test/dummy_rails/config.ru +4 -0
- data/test/dummy_rails/log/.keep +0 -0
- data/test/gemfiles/rails_4_2.gemfile +7 -0
- data/test/gemfiles/rails_5_0.gemfile +8 -0
- data/test/gemfiles/rails_5_1.gemfile +8 -0
- data/test/gemfiles/rails_5_2.gemfile +8 -0
- data/test/gemfiles/rails_6_0.gemfile +8 -0
- data/test/gemfiles/rails_6_1.gemfile +8 -0
- data/test/gemfiles/rails_7_0_dartsass.gemfile +8 -0
- data/test/gemfiles/rails_7_0_sassc.gemfile +8 -0
- data/test/rails_test.rb +24 -0
- data/test/support/dummy_rails_integration.rb +31 -0
- data/test/support/reporting.rb +27 -0
- data/test/test_helper.rb +42 -0
- data/test/test_helper_rails.rb +6 -0
- metadata +471 -0
@@ -0,0 +1,387 @@
|
|
1
|
+
/*!
|
2
|
+
* Bootstrap carousel.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('./base-component.js'), require('./dom/event-handler.js'), require('./dom/manipulator.js'), require('./dom/selector-engine.js'), require('./util/index.js'), require('./util/swipe.js')) :
|
8
|
+
typeof define === 'function' && define.amd ? define(['./base-component', './dom/event-handler', './dom/manipulator', './dom/selector-engine', './util/index', './util/swipe'], factory) :
|
9
|
+
(global = typeof globalThis !== 'undefined' ? globalThis : global || self, global.Carousel = factory(global.BaseComponent, global.EventHandler, global.Manipulator, global.SelectorEngine, global.Index, global.Swipe));
|
10
|
+
})(this, (function (BaseComponent, EventHandler, Manipulator, SelectorEngine, index_js, Swipe) { 'use strict';
|
11
|
+
|
12
|
+
/**
|
13
|
+
* --------------------------------------------------------------------------
|
14
|
+
* Bootstrap carousel.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 = 'carousel';
|
25
|
+
const DATA_KEY = 'bs.carousel';
|
26
|
+
const EVENT_KEY = `.${DATA_KEY}`;
|
27
|
+
const DATA_API_KEY = '.data-api';
|
28
|
+
const ARROW_LEFT_KEY = 'ArrowLeft';
|
29
|
+
const ARROW_RIGHT_KEY = 'ArrowRight';
|
30
|
+
const TOUCHEVENT_COMPAT_WAIT = 500; // Time for mouse compat events to fire after touch
|
31
|
+
|
32
|
+
const ORDER_NEXT = 'next';
|
33
|
+
const ORDER_PREV = 'prev';
|
34
|
+
const DIRECTION_LEFT = 'left';
|
35
|
+
const DIRECTION_RIGHT = 'right';
|
36
|
+
const EVENT_SLIDE = `slide${EVENT_KEY}`;
|
37
|
+
const EVENT_SLID = `slid${EVENT_KEY}`;
|
38
|
+
const EVENT_KEYDOWN = `keydown${EVENT_KEY}`;
|
39
|
+
const EVENT_MOUSEENTER = `mouseenter${EVENT_KEY}`;
|
40
|
+
const EVENT_MOUSELEAVE = `mouseleave${EVENT_KEY}`;
|
41
|
+
const EVENT_DRAG_START = `dragstart${EVENT_KEY}`;
|
42
|
+
const EVENT_LOAD_DATA_API = `load${EVENT_KEY}${DATA_API_KEY}`;
|
43
|
+
const EVENT_CLICK_DATA_API = `click${EVENT_KEY}${DATA_API_KEY}`;
|
44
|
+
const CLASS_NAME_CAROUSEL = 'carousel';
|
45
|
+
const CLASS_NAME_ACTIVE = 'active';
|
46
|
+
const CLASS_NAME_SLIDE = 'slide';
|
47
|
+
const CLASS_NAME_END = 'carousel-item-end';
|
48
|
+
const CLASS_NAME_START = 'carousel-item-start';
|
49
|
+
const CLASS_NAME_NEXT = 'carousel-item-next';
|
50
|
+
const CLASS_NAME_PREV = 'carousel-item-prev';
|
51
|
+
const SELECTOR_ACTIVE = '.active';
|
52
|
+
const SELECTOR_ITEM = '.carousel-item';
|
53
|
+
const SELECTOR_ACTIVE_ITEM = SELECTOR_ACTIVE + SELECTOR_ITEM;
|
54
|
+
const SELECTOR_ITEM_IMG = '.carousel-item img';
|
55
|
+
const SELECTOR_INDICATORS = '.carousel-indicators';
|
56
|
+
const SELECTOR_DATA_SLIDE = '[data-bs-slide], [data-bs-slide-to]';
|
57
|
+
const SELECTOR_DATA_RIDE = '[data-bs-ride="carousel"]';
|
58
|
+
const KEY_TO_DIRECTION = {
|
59
|
+
[ARROW_LEFT_KEY]: DIRECTION_RIGHT,
|
60
|
+
[ARROW_RIGHT_KEY]: DIRECTION_LEFT
|
61
|
+
};
|
62
|
+
const Default = {
|
63
|
+
interval: 5000,
|
64
|
+
keyboard: true,
|
65
|
+
pause: 'hover',
|
66
|
+
ride: false,
|
67
|
+
touch: true,
|
68
|
+
wrap: true
|
69
|
+
};
|
70
|
+
const DefaultType = {
|
71
|
+
interval: '(number|boolean)',
|
72
|
+
// TODO:v6 remove boolean support
|
73
|
+
keyboard: 'boolean',
|
74
|
+
pause: '(string|boolean)',
|
75
|
+
ride: '(boolean|string)',
|
76
|
+
touch: 'boolean',
|
77
|
+
wrap: 'boolean'
|
78
|
+
};
|
79
|
+
|
80
|
+
/**
|
81
|
+
* Class definition
|
82
|
+
*/
|
83
|
+
|
84
|
+
class Carousel extends BaseComponent {
|
85
|
+
constructor(element, config) {
|
86
|
+
super(element, config);
|
87
|
+
this._interval = null;
|
88
|
+
this._activeElement = null;
|
89
|
+
this._isSliding = false;
|
90
|
+
this.touchTimeout = null;
|
91
|
+
this._swipeHelper = null;
|
92
|
+
this._indicatorsElement = SelectorEngine.findOne(SELECTOR_INDICATORS, this._element);
|
93
|
+
this._addEventListeners();
|
94
|
+
if (this._config.ride === CLASS_NAME_CAROUSEL) {
|
95
|
+
this.cycle();
|
96
|
+
}
|
97
|
+
}
|
98
|
+
|
99
|
+
// Getters
|
100
|
+
static get Default() {
|
101
|
+
return Default;
|
102
|
+
}
|
103
|
+
static get DefaultType() {
|
104
|
+
return DefaultType;
|
105
|
+
}
|
106
|
+
static get NAME() {
|
107
|
+
return NAME;
|
108
|
+
}
|
109
|
+
|
110
|
+
// Public
|
111
|
+
next() {
|
112
|
+
this._slide(ORDER_NEXT);
|
113
|
+
}
|
114
|
+
nextWhenVisible() {
|
115
|
+
// FIXME TODO use `document.visibilityState`
|
116
|
+
// Don't call next when the page isn't visible
|
117
|
+
// or the carousel or its parent isn't visible
|
118
|
+
if (!document.hidden && index_js.isVisible(this._element)) {
|
119
|
+
this.next();
|
120
|
+
}
|
121
|
+
}
|
122
|
+
prev() {
|
123
|
+
this._slide(ORDER_PREV);
|
124
|
+
}
|
125
|
+
pause() {
|
126
|
+
if (this._isSliding) {
|
127
|
+
index_js.triggerTransitionEnd(this._element);
|
128
|
+
}
|
129
|
+
this._clearInterval();
|
130
|
+
}
|
131
|
+
cycle() {
|
132
|
+
this._clearInterval();
|
133
|
+
this._updateInterval();
|
134
|
+
this._interval = setInterval(() => this.nextWhenVisible(), this._config.interval);
|
135
|
+
}
|
136
|
+
_maybeEnableCycle() {
|
137
|
+
if (!this._config.ride) {
|
138
|
+
return;
|
139
|
+
}
|
140
|
+
if (this._isSliding) {
|
141
|
+
EventHandler.one(this._element, EVENT_SLID, () => this.cycle());
|
142
|
+
return;
|
143
|
+
}
|
144
|
+
this.cycle();
|
145
|
+
}
|
146
|
+
to(index) {
|
147
|
+
const items = this._getItems();
|
148
|
+
if (index > items.length - 1 || index < 0) {
|
149
|
+
return;
|
150
|
+
}
|
151
|
+
if (this._isSliding) {
|
152
|
+
EventHandler.one(this._element, EVENT_SLID, () => this.to(index));
|
153
|
+
return;
|
154
|
+
}
|
155
|
+
const activeIndex = this._getItemIndex(this._getActive());
|
156
|
+
if (activeIndex === index) {
|
157
|
+
return;
|
158
|
+
}
|
159
|
+
const order = index > activeIndex ? ORDER_NEXT : ORDER_PREV;
|
160
|
+
this._slide(order, items[index]);
|
161
|
+
}
|
162
|
+
dispose() {
|
163
|
+
if (this._swipeHelper) {
|
164
|
+
this._swipeHelper.dispose();
|
165
|
+
}
|
166
|
+
super.dispose();
|
167
|
+
}
|
168
|
+
|
169
|
+
// Private
|
170
|
+
_configAfterMerge(config) {
|
171
|
+
config.defaultInterval = config.interval;
|
172
|
+
return config;
|
173
|
+
}
|
174
|
+
_addEventListeners() {
|
175
|
+
if (this._config.keyboard) {
|
176
|
+
EventHandler.on(this._element, EVENT_KEYDOWN, event => this._keydown(event));
|
177
|
+
}
|
178
|
+
if (this._config.pause === 'hover') {
|
179
|
+
EventHandler.on(this._element, EVENT_MOUSEENTER, () => this.pause());
|
180
|
+
EventHandler.on(this._element, EVENT_MOUSELEAVE, () => this._maybeEnableCycle());
|
181
|
+
}
|
182
|
+
if (this._config.touch && Swipe.isSupported()) {
|
183
|
+
this._addTouchEventListeners();
|
184
|
+
}
|
185
|
+
}
|
186
|
+
_addTouchEventListeners() {
|
187
|
+
for (const img of SelectorEngine.find(SELECTOR_ITEM_IMG, this._element)) {
|
188
|
+
EventHandler.on(img, EVENT_DRAG_START, event => event.preventDefault());
|
189
|
+
}
|
190
|
+
const endCallBack = () => {
|
191
|
+
if (this._config.pause !== 'hover') {
|
192
|
+
return;
|
193
|
+
}
|
194
|
+
|
195
|
+
// If it's a touch-enabled device, mouseenter/leave are fired as
|
196
|
+
// part of the mouse compatibility events on first tap - the carousel
|
197
|
+
// would stop cycling until user tapped out of it;
|
198
|
+
// here, we listen for touchend, explicitly pause the carousel
|
199
|
+
// (as if it's the second time we tap on it, mouseenter compat event
|
200
|
+
// is NOT fired) and after a timeout (to allow for mouse compatibility
|
201
|
+
// events to fire) we explicitly restart cycling
|
202
|
+
|
203
|
+
this.pause();
|
204
|
+
if (this.touchTimeout) {
|
205
|
+
clearTimeout(this.touchTimeout);
|
206
|
+
}
|
207
|
+
this.touchTimeout = setTimeout(() => this._maybeEnableCycle(), TOUCHEVENT_COMPAT_WAIT + this._config.interval);
|
208
|
+
};
|
209
|
+
const swipeConfig = {
|
210
|
+
leftCallback: () => this._slide(this._directionToOrder(DIRECTION_LEFT)),
|
211
|
+
rightCallback: () => this._slide(this._directionToOrder(DIRECTION_RIGHT)),
|
212
|
+
endCallback: endCallBack
|
213
|
+
};
|
214
|
+
this._swipeHelper = new Swipe(this._element, swipeConfig);
|
215
|
+
}
|
216
|
+
_keydown(event) {
|
217
|
+
if (/input|textarea/i.test(event.target.tagName)) {
|
218
|
+
return;
|
219
|
+
}
|
220
|
+
const direction = KEY_TO_DIRECTION[event.key];
|
221
|
+
if (direction) {
|
222
|
+
event.preventDefault();
|
223
|
+
this._slide(this._directionToOrder(direction));
|
224
|
+
}
|
225
|
+
}
|
226
|
+
_getItemIndex(element) {
|
227
|
+
return this._getItems().indexOf(element);
|
228
|
+
}
|
229
|
+
_setActiveIndicatorElement(index) {
|
230
|
+
if (!this._indicatorsElement) {
|
231
|
+
return;
|
232
|
+
}
|
233
|
+
const activeIndicator = SelectorEngine.findOne(SELECTOR_ACTIVE, this._indicatorsElement);
|
234
|
+
activeIndicator.classList.remove(CLASS_NAME_ACTIVE);
|
235
|
+
activeIndicator.removeAttribute('aria-current');
|
236
|
+
const newActiveIndicator = SelectorEngine.findOne(`[data-bs-slide-to="${index}"]`, this._indicatorsElement);
|
237
|
+
if (newActiveIndicator) {
|
238
|
+
newActiveIndicator.classList.add(CLASS_NAME_ACTIVE);
|
239
|
+
newActiveIndicator.setAttribute('aria-current', 'true');
|
240
|
+
}
|
241
|
+
}
|
242
|
+
_updateInterval() {
|
243
|
+
const element = this._activeElement || this._getActive();
|
244
|
+
if (!element) {
|
245
|
+
return;
|
246
|
+
}
|
247
|
+
const elementInterval = Number.parseInt(element.getAttribute('data-bs-interval'), 10);
|
248
|
+
this._config.interval = elementInterval || this._config.defaultInterval;
|
249
|
+
}
|
250
|
+
_slide(order, element = null) {
|
251
|
+
if (this._isSliding) {
|
252
|
+
return;
|
253
|
+
}
|
254
|
+
const activeElement = this._getActive();
|
255
|
+
const isNext = order === ORDER_NEXT;
|
256
|
+
const nextElement = element || index_js.getNextActiveElement(this._getItems(), activeElement, isNext, this._config.wrap);
|
257
|
+
if (nextElement === activeElement) {
|
258
|
+
return;
|
259
|
+
}
|
260
|
+
const nextElementIndex = this._getItemIndex(nextElement);
|
261
|
+
const triggerEvent = eventName => {
|
262
|
+
return EventHandler.trigger(this._element, eventName, {
|
263
|
+
relatedTarget: nextElement,
|
264
|
+
direction: this._orderToDirection(order),
|
265
|
+
from: this._getItemIndex(activeElement),
|
266
|
+
to: nextElementIndex
|
267
|
+
});
|
268
|
+
};
|
269
|
+
const slideEvent = triggerEvent(EVENT_SLIDE);
|
270
|
+
if (slideEvent.defaultPrevented) {
|
271
|
+
return;
|
272
|
+
}
|
273
|
+
if (!activeElement || !nextElement) {
|
274
|
+
// Some weirdness is happening, so we bail
|
275
|
+
// TODO: change tests that use empty divs to avoid this check
|
276
|
+
return;
|
277
|
+
}
|
278
|
+
const isCycling = Boolean(this._interval);
|
279
|
+
this.pause();
|
280
|
+
this._isSliding = true;
|
281
|
+
this._setActiveIndicatorElement(nextElementIndex);
|
282
|
+
this._activeElement = nextElement;
|
283
|
+
const directionalClassName = isNext ? CLASS_NAME_START : CLASS_NAME_END;
|
284
|
+
const orderClassName = isNext ? CLASS_NAME_NEXT : CLASS_NAME_PREV;
|
285
|
+
nextElement.classList.add(orderClassName);
|
286
|
+
index_js.reflow(nextElement);
|
287
|
+
activeElement.classList.add(directionalClassName);
|
288
|
+
nextElement.classList.add(directionalClassName);
|
289
|
+
const completeCallBack = () => {
|
290
|
+
nextElement.classList.remove(directionalClassName, orderClassName);
|
291
|
+
nextElement.classList.add(CLASS_NAME_ACTIVE);
|
292
|
+
activeElement.classList.remove(CLASS_NAME_ACTIVE, orderClassName, directionalClassName);
|
293
|
+
this._isSliding = false;
|
294
|
+
triggerEvent(EVENT_SLID);
|
295
|
+
};
|
296
|
+
this._queueCallback(completeCallBack, activeElement, this._isAnimated());
|
297
|
+
if (isCycling) {
|
298
|
+
this.cycle();
|
299
|
+
}
|
300
|
+
}
|
301
|
+
_isAnimated() {
|
302
|
+
return this._element.classList.contains(CLASS_NAME_SLIDE);
|
303
|
+
}
|
304
|
+
_getActive() {
|
305
|
+
return SelectorEngine.findOne(SELECTOR_ACTIVE_ITEM, this._element);
|
306
|
+
}
|
307
|
+
_getItems() {
|
308
|
+
return SelectorEngine.find(SELECTOR_ITEM, this._element);
|
309
|
+
}
|
310
|
+
_clearInterval() {
|
311
|
+
if (this._interval) {
|
312
|
+
clearInterval(this._interval);
|
313
|
+
this._interval = null;
|
314
|
+
}
|
315
|
+
}
|
316
|
+
_directionToOrder(direction) {
|
317
|
+
if (index_js.isRTL()) {
|
318
|
+
return direction === DIRECTION_LEFT ? ORDER_PREV : ORDER_NEXT;
|
319
|
+
}
|
320
|
+
return direction === DIRECTION_LEFT ? ORDER_NEXT : ORDER_PREV;
|
321
|
+
}
|
322
|
+
_orderToDirection(order) {
|
323
|
+
if (index_js.isRTL()) {
|
324
|
+
return order === ORDER_PREV ? DIRECTION_LEFT : DIRECTION_RIGHT;
|
325
|
+
}
|
326
|
+
return order === ORDER_PREV ? DIRECTION_RIGHT : DIRECTION_LEFT;
|
327
|
+
}
|
328
|
+
|
329
|
+
// Static
|
330
|
+
static jQueryInterface(config) {
|
331
|
+
return this.each(function () {
|
332
|
+
const data = Carousel.getOrCreateInstance(this, config);
|
333
|
+
if (typeof config === 'number') {
|
334
|
+
data.to(config);
|
335
|
+
return;
|
336
|
+
}
|
337
|
+
if (typeof config === 'string') {
|
338
|
+
if (data[config] === undefined || config.startsWith('_') || config === 'constructor') {
|
339
|
+
throw new TypeError(`No method named "${config}"`);
|
340
|
+
}
|
341
|
+
data[config]();
|
342
|
+
}
|
343
|
+
});
|
344
|
+
}
|
345
|
+
}
|
346
|
+
|
347
|
+
/**
|
348
|
+
* Data API implementation
|
349
|
+
*/
|
350
|
+
|
351
|
+
EventHandler.on(document, EVENT_CLICK_DATA_API, SELECTOR_DATA_SLIDE, function (event) {
|
352
|
+
const target = SelectorEngine.getElementFromSelector(this);
|
353
|
+
if (!target || !target.classList.contains(CLASS_NAME_CAROUSEL)) {
|
354
|
+
return;
|
355
|
+
}
|
356
|
+
event.preventDefault();
|
357
|
+
const carousel = Carousel.getOrCreateInstance(target);
|
358
|
+
const slideIndex = this.getAttribute('data-bs-slide-to');
|
359
|
+
if (slideIndex) {
|
360
|
+
carousel.to(slideIndex);
|
361
|
+
carousel._maybeEnableCycle();
|
362
|
+
return;
|
363
|
+
}
|
364
|
+
if (Manipulator.getDataAttribute(this, 'slide') === 'next') {
|
365
|
+
carousel.next();
|
366
|
+
carousel._maybeEnableCycle();
|
367
|
+
return;
|
368
|
+
}
|
369
|
+
carousel.prev();
|
370
|
+
carousel._maybeEnableCycle();
|
371
|
+
});
|
372
|
+
EventHandler.on(window, EVENT_LOAD_DATA_API, () => {
|
373
|
+
const carousels = SelectorEngine.find(SELECTOR_DATA_RIDE);
|
374
|
+
for (const carousel of carousels) {
|
375
|
+
Carousel.getOrCreateInstance(carousel);
|
376
|
+
}
|
377
|
+
});
|
378
|
+
|
379
|
+
/**
|
380
|
+
* jQuery
|
381
|
+
*/
|
382
|
+
|
383
|
+
index_js.defineJQueryPlugin(Carousel);
|
384
|
+
|
385
|
+
return Carousel;
|
386
|
+
|
387
|
+
}));
|
@@ -0,0 +1,248 @@
|
|
1
|
+
/*!
|
2
|
+
* Bootstrap collapse.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('./base-component.js'), require('./dom/event-handler.js'), require('./dom/selector-engine.js'), require('./util/index.js')) :
|
8
|
+
typeof define === 'function' && define.amd ? define(['./base-component', './dom/event-handler', './dom/selector-engine', './util/index'], factory) :
|
9
|
+
(global = typeof globalThis !== 'undefined' ? globalThis : global || self, global.Collapse = factory(global.BaseComponent, global.EventHandler, global.SelectorEngine, global.Index));
|
10
|
+
})(this, (function (BaseComponent, EventHandler, SelectorEngine, index_js) { 'use strict';
|
11
|
+
|
12
|
+
/**
|
13
|
+
* --------------------------------------------------------------------------
|
14
|
+
* Bootstrap collapse.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 = 'collapse';
|
25
|
+
const DATA_KEY = 'bs.collapse';
|
26
|
+
const EVENT_KEY = `.${DATA_KEY}`;
|
27
|
+
const DATA_API_KEY = '.data-api';
|
28
|
+
const EVENT_SHOW = `show${EVENT_KEY}`;
|
29
|
+
const EVENT_SHOWN = `shown${EVENT_KEY}`;
|
30
|
+
const EVENT_HIDE = `hide${EVENT_KEY}`;
|
31
|
+
const EVENT_HIDDEN = `hidden${EVENT_KEY}`;
|
32
|
+
const EVENT_CLICK_DATA_API = `click${EVENT_KEY}${DATA_API_KEY}`;
|
33
|
+
const CLASS_NAME_SHOW = 'show';
|
34
|
+
const CLASS_NAME_COLLAPSE = 'collapse';
|
35
|
+
const CLASS_NAME_COLLAPSING = 'collapsing';
|
36
|
+
const CLASS_NAME_COLLAPSED = 'collapsed';
|
37
|
+
const CLASS_NAME_DEEPER_CHILDREN = `:scope .${CLASS_NAME_COLLAPSE} .${CLASS_NAME_COLLAPSE}`;
|
38
|
+
const CLASS_NAME_HORIZONTAL = 'collapse-horizontal';
|
39
|
+
const WIDTH = 'width';
|
40
|
+
const HEIGHT = 'height';
|
41
|
+
const SELECTOR_ACTIVES = '.collapse.show, .collapse.collapsing';
|
42
|
+
const SELECTOR_DATA_TOGGLE = '[data-bs-toggle="collapse"]';
|
43
|
+
const Default = {
|
44
|
+
parent: null,
|
45
|
+
toggle: true
|
46
|
+
};
|
47
|
+
const DefaultType = {
|
48
|
+
parent: '(null|element)',
|
49
|
+
toggle: 'boolean'
|
50
|
+
};
|
51
|
+
|
52
|
+
/**
|
53
|
+
* Class definition
|
54
|
+
*/
|
55
|
+
|
56
|
+
class Collapse extends BaseComponent {
|
57
|
+
constructor(element, config) {
|
58
|
+
super(element, config);
|
59
|
+
this._isTransitioning = false;
|
60
|
+
this._triggerArray = [];
|
61
|
+
const toggleList = SelectorEngine.find(SELECTOR_DATA_TOGGLE);
|
62
|
+
for (const elem of toggleList) {
|
63
|
+
const selector = SelectorEngine.getSelectorFromElement(elem);
|
64
|
+
const filterElement = SelectorEngine.find(selector).filter(foundElement => foundElement === this._element);
|
65
|
+
if (selector !== null && filterElement.length) {
|
66
|
+
this._triggerArray.push(elem);
|
67
|
+
}
|
68
|
+
}
|
69
|
+
this._initializeChildren();
|
70
|
+
if (!this._config.parent) {
|
71
|
+
this._addAriaAndCollapsedClass(this._triggerArray, this._isShown());
|
72
|
+
}
|
73
|
+
if (this._config.toggle) {
|
74
|
+
this.toggle();
|
75
|
+
}
|
76
|
+
}
|
77
|
+
|
78
|
+
// Getters
|
79
|
+
static get Default() {
|
80
|
+
return Default;
|
81
|
+
}
|
82
|
+
static get DefaultType() {
|
83
|
+
return DefaultType;
|
84
|
+
}
|
85
|
+
static get NAME() {
|
86
|
+
return NAME;
|
87
|
+
}
|
88
|
+
|
89
|
+
// Public
|
90
|
+
toggle() {
|
91
|
+
if (this._isShown()) {
|
92
|
+
this.hide();
|
93
|
+
} else {
|
94
|
+
this.show();
|
95
|
+
}
|
96
|
+
}
|
97
|
+
show() {
|
98
|
+
if (this._isTransitioning || this._isShown()) {
|
99
|
+
return;
|
100
|
+
}
|
101
|
+
let activeChildren = [];
|
102
|
+
|
103
|
+
// find active children
|
104
|
+
if (this._config.parent) {
|
105
|
+
activeChildren = this._getFirstLevelChildren(SELECTOR_ACTIVES).filter(element => element !== this._element).map(element => Collapse.getOrCreateInstance(element, {
|
106
|
+
toggle: false
|
107
|
+
}));
|
108
|
+
}
|
109
|
+
if (activeChildren.length && activeChildren[0]._isTransitioning) {
|
110
|
+
return;
|
111
|
+
}
|
112
|
+
const startEvent = EventHandler.trigger(this._element, EVENT_SHOW);
|
113
|
+
if (startEvent.defaultPrevented) {
|
114
|
+
return;
|
115
|
+
}
|
116
|
+
for (const activeInstance of activeChildren) {
|
117
|
+
activeInstance.hide();
|
118
|
+
}
|
119
|
+
const dimension = this._getDimension();
|
120
|
+
this._element.classList.remove(CLASS_NAME_COLLAPSE);
|
121
|
+
this._element.classList.add(CLASS_NAME_COLLAPSING);
|
122
|
+
this._element.style[dimension] = 0;
|
123
|
+
this._addAriaAndCollapsedClass(this._triggerArray, true);
|
124
|
+
this._isTransitioning = true;
|
125
|
+
const complete = () => {
|
126
|
+
this._isTransitioning = false;
|
127
|
+
this._element.classList.remove(CLASS_NAME_COLLAPSING);
|
128
|
+
this._element.classList.add(CLASS_NAME_COLLAPSE, CLASS_NAME_SHOW);
|
129
|
+
this._element.style[dimension] = '';
|
130
|
+
EventHandler.trigger(this._element, EVENT_SHOWN);
|
131
|
+
};
|
132
|
+
const capitalizedDimension = dimension[0].toUpperCase() + dimension.slice(1);
|
133
|
+
const scrollSize = `scroll${capitalizedDimension}`;
|
134
|
+
this._queueCallback(complete, this._element, true);
|
135
|
+
this._element.style[dimension] = `${this._element[scrollSize]}px`;
|
136
|
+
}
|
137
|
+
hide() {
|
138
|
+
if (this._isTransitioning || !this._isShown()) {
|
139
|
+
return;
|
140
|
+
}
|
141
|
+
const startEvent = EventHandler.trigger(this._element, EVENT_HIDE);
|
142
|
+
if (startEvent.defaultPrevented) {
|
143
|
+
return;
|
144
|
+
}
|
145
|
+
const dimension = this._getDimension();
|
146
|
+
this._element.style[dimension] = `${this._element.getBoundingClientRect()[dimension]}px`;
|
147
|
+
index_js.reflow(this._element);
|
148
|
+
this._element.classList.add(CLASS_NAME_COLLAPSING);
|
149
|
+
this._element.classList.remove(CLASS_NAME_COLLAPSE, CLASS_NAME_SHOW);
|
150
|
+
for (const trigger of this._triggerArray) {
|
151
|
+
const element = SelectorEngine.getElementFromSelector(trigger);
|
152
|
+
if (element && !this._isShown(element)) {
|
153
|
+
this._addAriaAndCollapsedClass([trigger], false);
|
154
|
+
}
|
155
|
+
}
|
156
|
+
this._isTransitioning = true;
|
157
|
+
const complete = () => {
|
158
|
+
this._isTransitioning = false;
|
159
|
+
this._element.classList.remove(CLASS_NAME_COLLAPSING);
|
160
|
+
this._element.classList.add(CLASS_NAME_COLLAPSE);
|
161
|
+
EventHandler.trigger(this._element, EVENT_HIDDEN);
|
162
|
+
};
|
163
|
+
this._element.style[dimension] = '';
|
164
|
+
this._queueCallback(complete, this._element, true);
|
165
|
+
}
|
166
|
+
_isShown(element = this._element) {
|
167
|
+
return element.classList.contains(CLASS_NAME_SHOW);
|
168
|
+
}
|
169
|
+
|
170
|
+
// Private
|
171
|
+
_configAfterMerge(config) {
|
172
|
+
config.toggle = Boolean(config.toggle); // Coerce string values
|
173
|
+
config.parent = index_js.getElement(config.parent);
|
174
|
+
return config;
|
175
|
+
}
|
176
|
+
_getDimension() {
|
177
|
+
return this._element.classList.contains(CLASS_NAME_HORIZONTAL) ? WIDTH : HEIGHT;
|
178
|
+
}
|
179
|
+
_initializeChildren() {
|
180
|
+
if (!this._config.parent) {
|
181
|
+
return;
|
182
|
+
}
|
183
|
+
const children = this._getFirstLevelChildren(SELECTOR_DATA_TOGGLE);
|
184
|
+
for (const element of children) {
|
185
|
+
const selected = SelectorEngine.getElementFromSelector(element);
|
186
|
+
if (selected) {
|
187
|
+
this._addAriaAndCollapsedClass([element], this._isShown(selected));
|
188
|
+
}
|
189
|
+
}
|
190
|
+
}
|
191
|
+
_getFirstLevelChildren(selector) {
|
192
|
+
const children = SelectorEngine.find(CLASS_NAME_DEEPER_CHILDREN, this._config.parent);
|
193
|
+
// remove children if greater depth
|
194
|
+
return SelectorEngine.find(selector, this._config.parent).filter(element => !children.includes(element));
|
195
|
+
}
|
196
|
+
_addAriaAndCollapsedClass(triggerArray, isOpen) {
|
197
|
+
if (!triggerArray.length) {
|
198
|
+
return;
|
199
|
+
}
|
200
|
+
for (const element of triggerArray) {
|
201
|
+
element.classList.toggle(CLASS_NAME_COLLAPSED, !isOpen);
|
202
|
+
element.setAttribute('aria-expanded', isOpen);
|
203
|
+
}
|
204
|
+
}
|
205
|
+
|
206
|
+
// Static
|
207
|
+
static jQueryInterface(config) {
|
208
|
+
const _config = {};
|
209
|
+
if (typeof config === 'string' && /show|hide/.test(config)) {
|
210
|
+
_config.toggle = false;
|
211
|
+
}
|
212
|
+
return this.each(function () {
|
213
|
+
const data = Collapse.getOrCreateInstance(this, _config);
|
214
|
+
if (typeof config === 'string') {
|
215
|
+
if (typeof data[config] === 'undefined') {
|
216
|
+
throw new TypeError(`No method named "${config}"`);
|
217
|
+
}
|
218
|
+
data[config]();
|
219
|
+
}
|
220
|
+
});
|
221
|
+
}
|
222
|
+
}
|
223
|
+
|
224
|
+
/**
|
225
|
+
* Data API implementation
|
226
|
+
*/
|
227
|
+
|
228
|
+
EventHandler.on(document, EVENT_CLICK_DATA_API, SELECTOR_DATA_TOGGLE, function (event) {
|
229
|
+
// preventDefault only for <a> elements (which change the URL) not inside the collapsible element
|
230
|
+
if (event.target.tagName === 'A' || event.delegateTarget && event.delegateTarget.tagName === 'A') {
|
231
|
+
event.preventDefault();
|
232
|
+
}
|
233
|
+
for (const element of SelectorEngine.getMultipleElementsFromSelector(this)) {
|
234
|
+
Collapse.getOrCreateInstance(element, {
|
235
|
+
toggle: false
|
236
|
+
}).toggle();
|
237
|
+
}
|
238
|
+
});
|
239
|
+
|
240
|
+
/**
|
241
|
+
* jQuery
|
242
|
+
*/
|
243
|
+
|
244
|
+
index_js.defineJQueryPlugin(Collapse);
|
245
|
+
|
246
|
+
return Collapse;
|
247
|
+
|
248
|
+
}));
|
@@ -0,0 +1,62 @@
|
|
1
|
+
/*!
|
2
|
+
* Bootstrap data.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() :
|
8
|
+
typeof define === 'function' && define.amd ? define(factory) :
|
9
|
+
(global = typeof globalThis !== 'undefined' ? globalThis : global || self, global.Data = factory());
|
10
|
+
})(this, (function () { 'use strict';
|
11
|
+
|
12
|
+
/**
|
13
|
+
* --------------------------------------------------------------------------
|
14
|
+
* Bootstrap dom/data.js
|
15
|
+
* Licensed under MIT (https://github.com/twbs/bootstrap/blob/main/LICENSE)
|
16
|
+
* --------------------------------------------------------------------------
|
17
|
+
*/
|
18
|
+
|
19
|
+
/**
|
20
|
+
* Constants
|
21
|
+
*/
|
22
|
+
|
23
|
+
const elementMap = new Map();
|
24
|
+
const data = {
|
25
|
+
set(element, key, instance) {
|
26
|
+
if (!elementMap.has(element)) {
|
27
|
+
elementMap.set(element, new Map());
|
28
|
+
}
|
29
|
+
const instanceMap = elementMap.get(element);
|
30
|
+
|
31
|
+
// make it clear we only want one instance per element
|
32
|
+
// can be removed later when multiple key/instances are fine to be used
|
33
|
+
if (!instanceMap.has(key) && instanceMap.size !== 0) {
|
34
|
+
// eslint-disable-next-line no-console
|
35
|
+
console.error(`Bootstrap doesn't allow more than one instance per element. Bound instance: ${Array.from(instanceMap.keys())[0]}.`);
|
36
|
+
return;
|
37
|
+
}
|
38
|
+
instanceMap.set(key, instance);
|
39
|
+
},
|
40
|
+
get(element, key) {
|
41
|
+
if (elementMap.has(element)) {
|
42
|
+
return elementMap.get(element).get(key) || null;
|
43
|
+
}
|
44
|
+
return null;
|
45
|
+
},
|
46
|
+
remove(element, key) {
|
47
|
+
if (!elementMap.has(element)) {
|
48
|
+
return;
|
49
|
+
}
|
50
|
+
const instanceMap = elementMap.get(element);
|
51
|
+
instanceMap.delete(key);
|
52
|
+
|
53
|
+
// free up element references if there are no instances left for an element
|
54
|
+
if (instanceMap.size === 0) {
|
55
|
+
elementMap.delete(element);
|
56
|
+
}
|
57
|
+
}
|
58
|
+
};
|
59
|
+
|
60
|
+
return data;
|
61
|
+
|
62
|
+
}));
|