PluginProbe
Booking Calendar / 11.8.4
Booking Calendar v11.8.4
11.8.4 11.8.3 11.8.2 11.8.1 11.8 11.7 11.6.1 11.6 11.5 11.4.3 11.4.2 11.4.1 11.4 11.3 11.2.1 11.2 11.1 11.0 10.15.7 10.15.6 10.1.3 10.10 10.10.1 10.10.2 10.11 All 204 releases
booking / vendors / simplebar / dist / index.cjs

index.cjs in Booking Calendar 11.8.4, at vendors/simplebar/dist/index.cjs

207 lines 10.7 KB
No matching file
Up and down to move Enter to open Esc to close
Raw Download Zip
1 /**
2 * simplebar - v6.3.1
3 * Scrollbars, simpler.
4 * https://grsmto.github.io/simplebar/
5 *
6 * Made by Adrien Denat from a fork by Jonathan Nicol
7 * Under MIT License
8 */
9
10 (function (global, factory) {
11 typeof exports === 'object' && typeof module !== 'undefined' ? factory(exports, require('simplebar-core')) :
12 typeof define === 'function' && define.amd ? define(['exports', 'simplebar-core'], factory) :
13 (global = typeof globalThis !== 'undefined' ? globalThis : global || self, factory(global.SimpleBar = {}, global.SimpleBar));
14 })(this, (function (exports, SimpleBarCore) { 'use strict';
15
16 /******************************************************************************
17 Copyright (c) Microsoft Corporation.
18
19 Permission to use, copy, modify, and/or distribute this software for any
20 purpose with or without fee is hereby granted.
21
22 THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH
23 REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY
24 AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT,
25 INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM
26 LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR
27 OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
28 PERFORMANCE OF THIS SOFTWARE.
29 ***************************************************************************** */
30 /* global Reflect, Promise */
31
32 var extendStatics = function(d, b) {
33 extendStatics = Object.setPrototypeOf ||
34 ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
35 function (d, b) { for (var p in b) if (Object.prototype.hasOwnProperty.call(b, p)) d[p] = b[p]; };
36 return extendStatics(d, b);
37 };
38
39 function __extends(d, b) {
40 if (typeof b !== "function" && b !== null)
41 throw new TypeError("Class extends value " + String(b) + " is not a constructor or null");
42 extendStatics(d, b);
43 function __() { this.constructor = d; }
44 d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
45 }
46
47 var _a = SimpleBarCore.helpers, getOptions = _a.getOptions, addClasses = _a.addClasses, canUseDOM = _a.canUseDOM;
48 var SimpleBar = /** @class */ (function (_super) {
49 __extends(SimpleBar, _super);
50 function SimpleBar() {
51 var args = [];
52 for (var _i = 0; _i < arguments.length; _i++) {
53 args[_i] = arguments[_i];
54 }
55 var _this = _super.apply(this, args) || this;
56 // // Save a reference to the instance, so we know this DOM node has already been instancied
57 SimpleBar.instances.set(args[0], _this);
58 return _this;
59 }
60 SimpleBar.initDOMLoadedElements = function () {
61 document.removeEventListener('DOMContentLoaded', this.initDOMLoadedElements);
62 window.removeEventListener('load', this.initDOMLoadedElements);
63 Array.prototype.forEach.call(document.querySelectorAll('[data-simplebar]'), function (el) {
64 if (el.getAttribute('data-simplebar') !== 'init' &&
65 !SimpleBar.instances.has(el))
66 new SimpleBar(el, getOptions(el.attributes));
67 });
68 };
69 SimpleBar.removeObserver = function () {
70 var _a;
71 (_a = SimpleBar.globalObserver) === null || _a === void 0 ? void 0 : _a.disconnect();
72 };
73 SimpleBar.prototype.initDOM = function () {
74 var _this = this;
75 var _a, _b, _c;
76 // make sure this element doesn't have the elements yet
77 if (!Array.prototype.filter.call(this.el.children, function (child) {
78 return child.classList.contains(_this.classNames.wrapper);
79 }).length) {
80 // Prepare DOM
81 this.wrapperEl = document.createElement('div');
82 this.contentWrapperEl = document.createElement('div');
83 this.offsetEl = document.createElement('div');
84 this.maskEl = document.createElement('div');
85 this.contentEl = document.createElement('div');
86 this.placeholderEl = document.createElement('div');
87 this.heightAutoObserverWrapperEl = document.createElement('div');
88 this.heightAutoObserverEl = document.createElement('div');
89 addClasses(this.wrapperEl, this.classNames.wrapper);
90 addClasses(this.contentWrapperEl, this.classNames.contentWrapper);
91 addClasses(this.offsetEl, this.classNames.offset);
92 addClasses(this.maskEl, this.classNames.mask);
93 addClasses(this.contentEl, this.classNames.contentEl);
94 addClasses(this.placeholderEl, this.classNames.placeholder);
95 addClasses(this.heightAutoObserverWrapperEl, this.classNames.heightAutoObserverWrapperEl);
96 addClasses(this.heightAutoObserverEl, this.classNames.heightAutoObserverEl);
97 while (this.el.firstChild) {
98 this.contentEl.appendChild(this.el.firstChild);
99 }
100 this.contentWrapperEl.appendChild(this.contentEl);
101 this.offsetEl.appendChild(this.contentWrapperEl);
102 this.maskEl.appendChild(this.offsetEl);
103 this.heightAutoObserverWrapperEl.appendChild(this.heightAutoObserverEl);
104 this.wrapperEl.appendChild(this.heightAutoObserverWrapperEl);
105 this.wrapperEl.appendChild(this.maskEl);
106 this.wrapperEl.appendChild(this.placeholderEl);
107 this.el.appendChild(this.wrapperEl);
108 (_a = this.contentWrapperEl) === null || _a === void 0 ? void 0 : _a.setAttribute('tabindex', this.options.tabIndex.toString());
109 (_b = this.contentWrapperEl) === null || _b === void 0 ? void 0 : _b.setAttribute('role', 'region');
110 (_c = this.contentWrapperEl) === null || _c === void 0 ? void 0 : _c.setAttribute('aria-label', this.options.ariaLabel);
111 }
112 if (!this.axis.x.track.el || !this.axis.y.track.el) {
113 var track = document.createElement('div');
114 var scrollbar = document.createElement('div');
115 addClasses(track, this.classNames.track);
116 addClasses(scrollbar, this.classNames.scrollbar);
117 track.appendChild(scrollbar);
118 this.axis.x.track.el = track.cloneNode(true);
119 addClasses(this.axis.x.track.el, this.classNames.horizontal);
120 this.axis.y.track.el = track.cloneNode(true);
121 addClasses(this.axis.y.track.el, this.classNames.vertical);
122 this.el.appendChild(this.axis.x.track.el);
123 this.el.appendChild(this.axis.y.track.el);
124 }
125 SimpleBarCore.prototype.initDOM.call(this);
126 this.el.setAttribute('data-simplebar', 'init');
127 };
128 SimpleBar.prototype.unMount = function () {
129 SimpleBarCore.prototype.unMount.call(this);
130 SimpleBar.instances["delete"](this.el);
131 };
132 SimpleBar.initHtmlApi = function () {
133 this.initDOMLoadedElements = this.initDOMLoadedElements.bind(this);
134 // MutationObserver is IE11+
135 if (typeof MutationObserver !== 'undefined') {
136 // Mutation observer to observe dynamically added elements
137 this.globalObserver = new MutationObserver(SimpleBar.handleMutations);
138 this.globalObserver.observe(document, { childList: true, subtree: true });
139 }
140 // Taken from jQuery `ready` function
141 // Instantiate elements already present on the page
142 if (document.readyState === 'complete' || // @ts-ignore: IE specific
143 (document.readyState !== 'loading' && !document.documentElement.doScroll)) {
144 // Handle it asynchronously to allow scripts the opportunity to delay init
145 window.setTimeout(this.initDOMLoadedElements);
146 }
147 else {
148 document.addEventListener('DOMContentLoaded', this.initDOMLoadedElements);
149 window.addEventListener('load', this.initDOMLoadedElements);
150 }
151 };
152 SimpleBar.handleMutations = function (mutations) {
153 mutations.forEach(function (mutation) {
154 mutation.addedNodes.forEach(function (addedNode) {
155 if (addedNode.nodeType === 1) {
156 if (addedNode.hasAttribute('data-simplebar')) {
157 !SimpleBar.instances.has(addedNode) &&
158 document.documentElement.contains(addedNode) &&
159 new SimpleBar(addedNode, getOptions(addedNode.attributes));
160 }
161 else {
162 addedNode
163 .querySelectorAll('[data-simplebar]')
164 .forEach(function (el) {
165 if (el.getAttribute('data-simplebar') !== 'init' &&
166 !SimpleBar.instances.has(el) &&
167 document.documentElement.contains(el))
168 new SimpleBar(el, getOptions(el.attributes));
169 });
170 }
171 }
172 });
173 mutation.removedNodes.forEach(function (removedNode) {
174 var _a;
175 if (removedNode.nodeType === 1) {
176 if (removedNode.getAttribute('data-simplebar') === 'init') {
177 !document.documentElement.contains(removedNode) &&
178 ((_a = SimpleBar.instances.get(removedNode)) === null || _a === void 0 ? void 0 : _a.unMount());
179 }
180 else {
181 Array.prototype.forEach.call(removedNode.querySelectorAll('[data-simplebar="init"]'), function (el) {
182 var _a;
183 !document.documentElement.contains(el) &&
184 ((_a = SimpleBar.instances.get(el)) === null || _a === void 0 ? void 0 : _a.unMount());
185 });
186 }
187 }
188 });
189 });
190 };
191 SimpleBar.instances = new WeakMap();
192 return SimpleBar;
193 }(SimpleBarCore));
194 /**
195 * HTML API
196 * Called only in a browser env.
197 */
198 if (canUseDOM) {
199 SimpleBar.initHtmlApi();
200 }
201
202 exports.default = SimpleBar;
203
204 Object.defineProperty(exports, '__esModule', { value: true });
205
206 }));
207