1 |
|
2 |
|
3 |
|
4 |
|
5 |
|
6 |
|
7 |
|
8 | (function webpackUniversalModuleDefinition(root, factory) {
|
9 | if(typeof exports === 'object' && typeof module === 'object')
|
10 | module.exports = factory();
|
11 | else if(typeof define === 'function' && define.amd)
|
12 | define("@material/dom", [], factory);
|
13 | else if(typeof exports === 'object')
|
14 | exports["dom"] = factory();
|
15 | else
|
16 | root["mdc"] = root["mdc"] || {}, root["mdc"]["dom"] = factory();
|
17 | })(this, function() {
|
18 | return (function(modules) {
|
19 |
|
20 | var installedModules = {};
|
21 |
|
22 |
|
23 | function __webpack_require__(moduleId) {
|
24 |
|
25 |
|
26 | if(installedModules[moduleId]) {
|
27 | return installedModules[moduleId].exports;
|
28 | }
|
29 |
|
30 | var module = installedModules[moduleId] = {
|
31 | i: moduleId,
|
32 | l: false,
|
33 | exports: {}
|
34 | };
|
35 |
|
36 |
|
37 | modules[moduleId].call(module.exports, module, module.exports, __webpack_require__);
|
38 |
|
39 |
|
40 | module.l = true;
|
41 |
|
42 |
|
43 | return module.exports;
|
44 | }
|
45 |
|
46 |
|
47 |
|
48 | __webpack_require__.m = modules;
|
49 |
|
50 |
|
51 | __webpack_require__.c = installedModules;
|
52 |
|
53 |
|
54 | __webpack_require__.d = function(exports, name, getter) {
|
55 | if(!__webpack_require__.o(exports, name)) {
|
56 | Object.defineProperty(exports, name, { enumerable: true, get: getter });
|
57 | }
|
58 | };
|
59 |
|
60 |
|
61 | __webpack_require__.r = function(exports) {
|
62 | if(typeof Symbol !== 'undefined' && Symbol.toStringTag) {
|
63 | Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });
|
64 | }
|
65 | Object.defineProperty(exports, '__esModule', { value: true });
|
66 | };
|
67 |
|
68 |
|
69 |
|
70 |
|
71 |
|
72 |
|
73 | __webpack_require__.t = function(value, mode) {
|
74 | if(mode & 1) value = __webpack_require__(value);
|
75 | if(mode & 8) return value;
|
76 | if((mode & 4) && typeof value === 'object' && value && value.__esModule) return value;
|
77 | var ns = Object.create(null);
|
78 | __webpack_require__.r(ns);
|
79 | Object.defineProperty(ns, 'default', { enumerable: true, value: value });
|
80 | if(mode & 2 && typeof value != 'string') for(var key in value) __webpack_require__.d(ns, key, function(key) { return value[key]; }.bind(null, key));
|
81 | return ns;
|
82 | };
|
83 |
|
84 |
|
85 | __webpack_require__.n = function(module) {
|
86 | var getter = module && module.__esModule ?
|
87 | function getDefault() { return module['default']; } :
|
88 | function getModuleExports() { return module; };
|
89 | __webpack_require__.d(getter, 'a', getter);
|
90 | return getter;
|
91 | };
|
92 |
|
93 |
|
94 | __webpack_require__.o = function(object, property) { return Object.prototype.hasOwnProperty.call(object, property); };
|
95 |
|
96 |
|
97 | __webpack_require__.p = "";
|
98 |
|
99 |
|
100 |
|
101 | return __webpack_require__(__webpack_require__.s = "./packages/mdc-dom/index.ts");
|
102 | })
|
103 |
|
104 | ({
|
105 |
|
106 | "./packages/mdc-dom/events.ts":
|
107 |
|
108 |
|
109 |
|
110 |
|
111 | (function(module, exports, __webpack_require__) {
|
112 |
|
113 | "use strict";
|
114 |
|
115 |
|
116 |
|
117 |
|
118 |
|
119 |
|
120 |
|
121 |
|
122 |
|
123 |
|
124 |
|
125 |
|
126 |
|
127 |
|
128 |
|
129 |
|
130 |
|
131 |
|
132 |
|
133 |
|
134 |
|
135 |
|
136 |
|
137 |
|
138 | Object.defineProperty(exports, "__esModule", { value: true });
|
139 | exports.applyPassive = void 0;
|
140 |
|
141 |
|
142 |
|
143 |
|
144 | function applyPassive(globalObj) {
|
145 | if (globalObj === void 0) {
|
146 | globalObj = window;
|
147 | }
|
148 | return supportsPassiveOption(globalObj) ? { passive: true } : false;
|
149 | }
|
150 | exports.applyPassive = applyPassive;
|
151 | function supportsPassiveOption(globalObj) {
|
152 | if (globalObj === void 0) {
|
153 | globalObj = window;
|
154 | }
|
155 |
|
156 |
|
157 | var passiveSupported = false;
|
158 | try {
|
159 | var options = {
|
160 |
|
161 |
|
162 | get passive() {
|
163 | passiveSupported = true;
|
164 | return false;
|
165 | }
|
166 | };
|
167 | var handler = function handler() {};
|
168 | globalObj.document.addEventListener('test', handler, options);
|
169 | globalObj.document.removeEventListener('test', handler, options);
|
170 | } catch (err) {
|
171 | passiveSupported = false;
|
172 | }
|
173 | return passiveSupported;
|
174 | }
|
175 |
|
176 | }),
|
177 |
|
178 | "./packages/mdc-dom/focus-trap.ts":
|
179 |
|
180 |
|
181 |
|
182 |
|
183 | (function(module, exports, __webpack_require__) {
|
184 |
|
185 | "use strict";
|
186 |
|
187 |
|
188 |
|
189 |
|
190 |
|
191 |
|
192 |
|
193 |
|
194 |
|
195 |
|
196 |
|
197 |
|
198 |
|
199 |
|
200 |
|
201 |
|
202 |
|
203 |
|
204 |
|
205 |
|
206 |
|
207 |
|
208 |
|
209 |
|
210 | Object.defineProperty(exports, "__esModule", { value: true });
|
211 | exports.FocusTrap = void 0;
|
212 | var FOCUS_SENTINEL_CLASS = 'mdc-dom-focus-sentinel';
|
213 |
|
214 |
|
215 |
|
216 |
|
217 |
|
218 |
|
219 |
|
220 | var FocusTrap = function () {
|
221 | function FocusTrap(root, options) {
|
222 | if (options === void 0) {
|
223 | options = {};
|
224 | }
|
225 | this.root = root;
|
226 | this.options = options;
|
227 |
|
228 | this.elFocusedBeforeTrapFocus = null;
|
229 | }
|
230 | |
231 |
|
232 |
|
233 |
|
234 | FocusTrap.prototype.trapFocus = function () {
|
235 | var focusableEls = this.getFocusableElements(this.root);
|
236 | if (focusableEls.length === 0) {
|
237 | throw new Error('FocusTrap: Element must have at least one focusable child.');
|
238 | }
|
239 | this.elFocusedBeforeTrapFocus = document.activeElement instanceof HTMLElement ? document.activeElement : null;
|
240 | this.wrapTabFocus(this.root);
|
241 | if (!this.options.skipInitialFocus) {
|
242 | this.focusInitialElement(focusableEls, this.options.initialFocusEl);
|
243 | }
|
244 | };
|
245 | |
246 |
|
247 |
|
248 |
|
249 | FocusTrap.prototype.releaseFocus = function () {
|
250 | [].slice.call(this.root.querySelectorAll("." + FOCUS_SENTINEL_CLASS)).forEach(function (sentinelEl) {
|
251 | sentinelEl.parentElement.removeChild(sentinelEl);
|
252 | });
|
253 | if (!this.options.skipRestoreFocus && this.elFocusedBeforeTrapFocus) {
|
254 | this.elFocusedBeforeTrapFocus.focus();
|
255 | }
|
256 | };
|
257 | |
258 |
|
259 |
|
260 |
|
261 |
|
262 |
|
263 |
|
264 | FocusTrap.prototype.wrapTabFocus = function (el) {
|
265 | var _this = this;
|
266 | var sentinelStart = this.createSentinel();
|
267 | var sentinelEnd = this.createSentinel();
|
268 | sentinelStart.addEventListener('focus', function () {
|
269 | var focusableEls = _this.getFocusableElements(el);
|
270 | if (focusableEls.length > 0) {
|
271 | focusableEls[focusableEls.length - 1].focus();
|
272 | }
|
273 | });
|
274 | sentinelEnd.addEventListener('focus', function () {
|
275 | var focusableEls = _this.getFocusableElements(el);
|
276 | if (focusableEls.length > 0) {
|
277 | focusableEls[0].focus();
|
278 | }
|
279 | });
|
280 | el.insertBefore(sentinelStart, el.children[0]);
|
281 | el.appendChild(sentinelEnd);
|
282 | };
|
283 | |
284 |
|
285 |
|
286 |
|
287 | FocusTrap.prototype.focusInitialElement = function (focusableEls, initialFocusEl) {
|
288 | var focusIndex = 0;
|
289 | if (initialFocusEl) {
|
290 | focusIndex = Math.max(focusableEls.indexOf(initialFocusEl), 0);
|
291 | }
|
292 | focusableEls[focusIndex].focus();
|
293 | };
|
294 | FocusTrap.prototype.getFocusableElements = function (root) {
|
295 | var focusableEls = [].slice.call(root.querySelectorAll('[autofocus], [tabindex], a, input, textarea, select, button'));
|
296 | return focusableEls.filter(function (el) {
|
297 | var isDisabledOrHidden = el.getAttribute('aria-disabled') === 'true' || el.getAttribute('disabled') != null || el.getAttribute('hidden') != null || el.getAttribute('aria-hidden') === 'true';
|
298 | var isTabbableAndVisible = el.tabIndex >= 0 && el.getBoundingClientRect().width > 0 && !el.classList.contains(FOCUS_SENTINEL_CLASS) && !isDisabledOrHidden;
|
299 | var isProgrammaticallyHidden = false;
|
300 | if (isTabbableAndVisible) {
|
301 | var style = getComputedStyle(el);
|
302 | isProgrammaticallyHidden = style.display === 'none' || style.visibility === 'hidden';
|
303 | }
|
304 | return isTabbableAndVisible && !isProgrammaticallyHidden;
|
305 | });
|
306 | };
|
307 | FocusTrap.prototype.createSentinel = function () {
|
308 | var sentinel = document.createElement('div');
|
309 | sentinel.setAttribute('tabindex', '0');
|
310 |
|
311 | sentinel.setAttribute('aria-hidden', 'true');
|
312 | sentinel.classList.add(FOCUS_SENTINEL_CLASS);
|
313 | return sentinel;
|
314 | };
|
315 | return FocusTrap;
|
316 | }();
|
317 | exports.FocusTrap = FocusTrap;
|
318 |
|
319 | }),
|
320 |
|
321 | "./packages/mdc-dom/index.ts":
|
322 |
|
323 |
|
324 |
|
325 |
|
326 | (function(module, exports, __webpack_require__) {
|
327 |
|
328 | "use strict";
|
329 |
|
330 |
|
331 |
|
332 |
|
333 |
|
334 |
|
335 |
|
336 |
|
337 |
|
338 |
|
339 |
|
340 |
|
341 |
|
342 |
|
343 |
|
344 |
|
345 |
|
346 |
|
347 |
|
348 |
|
349 |
|
350 |
|
351 |
|
352 |
|
353 | var __createBinding = this && this.__createBinding || (Object.create ? function (o, m, k, k2) {
|
354 | if (k2 === undefined) k2 = k;
|
355 | Object.defineProperty(o, k2, { enumerable: true, get: function get() {
|
356 | return m[k];
|
357 | } });
|
358 | } : function (o, m, k, k2) {
|
359 | if (k2 === undefined) k2 = k;
|
360 | o[k2] = m[k];
|
361 | });
|
362 | var __setModuleDefault = this && this.__setModuleDefault || (Object.create ? function (o, v) {
|
363 | Object.defineProperty(o, "default", { enumerable: true, value: v });
|
364 | } : function (o, v) {
|
365 | o["default"] = v;
|
366 | });
|
367 | var __importStar = this && this.__importStar || function (mod) {
|
368 | if (mod && mod.__esModule) return mod;
|
369 | var result = {};
|
370 | if (mod != null) for (var k in mod) {
|
371 | if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
|
372 | }__setModuleDefault(result, mod);
|
373 | return result;
|
374 | };
|
375 | Object.defineProperty(exports, "__esModule", { value: true });
|
376 | exports.ponyfill = exports.keyboard = exports.focusTrap = exports.events = void 0;
|
377 | var events = __importStar(__webpack_require__( "./packages/mdc-dom/events.ts"));
|
378 | exports.events = events;
|
379 | var focusTrap = __importStar(__webpack_require__( "./packages/mdc-dom/focus-trap.ts"));
|
380 | exports.focusTrap = focusTrap;
|
381 | var keyboard = __importStar(__webpack_require__( "./packages/mdc-dom/keyboard.ts"));
|
382 | exports.keyboard = keyboard;
|
383 | var ponyfill = __importStar(__webpack_require__( "./packages/mdc-dom/ponyfill.ts"));
|
384 | exports.ponyfill = ponyfill;
|
385 |
|
386 | }),
|
387 |
|
388 | "./packages/mdc-dom/keyboard.ts":
|
389 |
|
390 |
|
391 |
|
392 |
|
393 | (function(module, exports, __webpack_require__) {
|
394 |
|
395 | "use strict";
|
396 |
|
397 |
|
398 |
|
399 |
|
400 |
|
401 |
|
402 |
|
403 |
|
404 |
|
405 |
|
406 |
|
407 |
|
408 |
|
409 |
|
410 |
|
411 |
|
412 |
|
413 |
|
414 |
|
415 |
|
416 |
|
417 |
|
418 |
|
419 |
|
420 | Object.defineProperty(exports, "__esModule", { value: true });
|
421 | exports.isNavigationEvent = exports.normalizeKey = exports.KEY = void 0;
|
422 |
|
423 |
|
424 |
|
425 | exports.KEY = {
|
426 | UNKNOWN: 'Unknown',
|
427 | BACKSPACE: 'Backspace',
|
428 | ENTER: 'Enter',
|
429 | SPACEBAR: 'Spacebar',
|
430 | PAGE_UP: 'PageUp',
|
431 | PAGE_DOWN: 'PageDown',
|
432 | END: 'End',
|
433 | HOME: 'Home',
|
434 | ARROW_LEFT: 'ArrowLeft',
|
435 | ARROW_UP: 'ArrowUp',
|
436 | ARROW_RIGHT: 'ArrowRight',
|
437 | ARROW_DOWN: 'ArrowDown',
|
438 | DELETE: 'Delete',
|
439 | ESCAPE: 'Escape',
|
440 | TAB: 'Tab'
|
441 | };
|
442 | var normalizedKeys = new Set();
|
443 |
|
444 |
|
445 | normalizedKeys.add(exports.KEY.BACKSPACE);
|
446 | normalizedKeys.add(exports.KEY.ENTER);
|
447 | normalizedKeys.add(exports.KEY.SPACEBAR);
|
448 | normalizedKeys.add(exports.KEY.PAGE_UP);
|
449 | normalizedKeys.add(exports.KEY.PAGE_DOWN);
|
450 | normalizedKeys.add(exports.KEY.END);
|
451 | normalizedKeys.add(exports.KEY.HOME);
|
452 | normalizedKeys.add(exports.KEY.ARROW_LEFT);
|
453 | normalizedKeys.add(exports.KEY.ARROW_UP);
|
454 | normalizedKeys.add(exports.KEY.ARROW_RIGHT);
|
455 | normalizedKeys.add(exports.KEY.ARROW_DOWN);
|
456 | normalizedKeys.add(exports.KEY.DELETE);
|
457 | normalizedKeys.add(exports.KEY.ESCAPE);
|
458 | normalizedKeys.add(exports.KEY.TAB);
|
459 | var KEY_CODE = {
|
460 | BACKSPACE: 8,
|
461 | ENTER: 13,
|
462 | SPACEBAR: 32,
|
463 | PAGE_UP: 33,
|
464 | PAGE_DOWN: 34,
|
465 | END: 35,
|
466 | HOME: 36,
|
467 | ARROW_LEFT: 37,
|
468 | ARROW_UP: 38,
|
469 | ARROW_RIGHT: 39,
|
470 | ARROW_DOWN: 40,
|
471 | DELETE: 46,
|
472 | ESCAPE: 27,
|
473 | TAB: 9
|
474 | };
|
475 | var mappedKeyCodes = new Map();
|
476 |
|
477 |
|
478 | mappedKeyCodes.set(KEY_CODE.BACKSPACE, exports.KEY.BACKSPACE);
|
479 | mappedKeyCodes.set(KEY_CODE.ENTER, exports.KEY.ENTER);
|
480 | mappedKeyCodes.set(KEY_CODE.SPACEBAR, exports.KEY.SPACEBAR);
|
481 | mappedKeyCodes.set(KEY_CODE.PAGE_UP, exports.KEY.PAGE_UP);
|
482 | mappedKeyCodes.set(KEY_CODE.PAGE_DOWN, exports.KEY.PAGE_DOWN);
|
483 | mappedKeyCodes.set(KEY_CODE.END, exports.KEY.END);
|
484 | mappedKeyCodes.set(KEY_CODE.HOME, exports.KEY.HOME);
|
485 | mappedKeyCodes.set(KEY_CODE.ARROW_LEFT, exports.KEY.ARROW_LEFT);
|
486 | mappedKeyCodes.set(KEY_CODE.ARROW_UP, exports.KEY.ARROW_UP);
|
487 | mappedKeyCodes.set(KEY_CODE.ARROW_RIGHT, exports.KEY.ARROW_RIGHT);
|
488 | mappedKeyCodes.set(KEY_CODE.ARROW_DOWN, exports.KEY.ARROW_DOWN);
|
489 | mappedKeyCodes.set(KEY_CODE.DELETE, exports.KEY.DELETE);
|
490 | mappedKeyCodes.set(KEY_CODE.ESCAPE, exports.KEY.ESCAPE);
|
491 | mappedKeyCodes.set(KEY_CODE.TAB, exports.KEY.TAB);
|
492 | var navigationKeys = new Set();
|
493 |
|
494 |
|
495 | navigationKeys.add(exports.KEY.PAGE_UP);
|
496 | navigationKeys.add(exports.KEY.PAGE_DOWN);
|
497 | navigationKeys.add(exports.KEY.END);
|
498 | navigationKeys.add(exports.KEY.HOME);
|
499 | navigationKeys.add(exports.KEY.ARROW_LEFT);
|
500 | navigationKeys.add(exports.KEY.ARROW_UP);
|
501 | navigationKeys.add(exports.KEY.ARROW_RIGHT);
|
502 | navigationKeys.add(exports.KEY.ARROW_DOWN);
|
503 |
|
504 |
|
505 |
|
506 | function normalizeKey(evt) {
|
507 | var key = evt.key;
|
508 |
|
509 | if (normalizedKeys.has(key)) {
|
510 | return key;
|
511 | }
|
512 |
|
513 | var mappedKey = mappedKeyCodes.get(evt.keyCode);
|
514 | if (mappedKey) {
|
515 | return mappedKey;
|
516 | }
|
517 | return exports.KEY.UNKNOWN;
|
518 | }
|
519 | exports.normalizeKey = normalizeKey;
|
520 |
|
521 |
|
522 |
|
523 | function isNavigationEvent(evt) {
|
524 | return navigationKeys.has(normalizeKey(evt));
|
525 | }
|
526 | exports.isNavigationEvent = isNavigationEvent;
|
527 |
|
528 | }),
|
529 |
|
530 | "./packages/mdc-dom/ponyfill.ts":
|
531 |
|
532 |
|
533 |
|
534 |
|
535 | (function(module, exports, __webpack_require__) {
|
536 |
|
537 | "use strict";
|
538 |
|
539 |
|
540 |
|
541 |
|
542 |
|
543 |
|
544 |
|
545 |
|
546 |
|
547 |
|
548 |
|
549 |
|
550 |
|
551 |
|
552 |
|
553 |
|
554 |
|
555 |
|
556 |
|
557 |
|
558 |
|
559 |
|
560 |
|
561 |
|
562 | Object.defineProperty(exports, "__esModule", { value: true });
|
563 | exports.estimateScrollWidth = exports.matches = exports.closest = void 0;
|
564 |
|
565 |
|
566 |
|
567 |
|
568 | function closest(element, selector) {
|
569 | if (element.closest) {
|
570 | return element.closest(selector);
|
571 | }
|
572 | var el = element;
|
573 | while (el) {
|
574 | if (matches(el, selector)) {
|
575 | return el;
|
576 | }
|
577 | el = el.parentElement;
|
578 | }
|
579 | return null;
|
580 | }
|
581 | exports.closest = closest;
|
582 | function matches(element, selector) {
|
583 | var nativeMatches = element.matches || element.webkitMatchesSelector || element.msMatchesSelector;
|
584 | return nativeMatches.call(element, selector);
|
585 | }
|
586 | exports.matches = matches;
|
587 |
|
588 |
|
589 |
|
590 |
|
591 |
|
592 |
|
593 |
|
594 |
|
595 | function estimateScrollWidth(element) {
|
596 |
|
597 |
|
598 |
|
599 |
|
600 | var htmlEl = element;
|
601 | if (htmlEl.offsetParent !== null) {
|
602 | return htmlEl.scrollWidth;
|
603 | }
|
604 | var clone = htmlEl.cloneNode(true);
|
605 | clone.style.setProperty('position', 'absolute');
|
606 | clone.style.setProperty('transform', 'translate(-9999px, -9999px)');
|
607 | document.documentElement.appendChild(clone);
|
608 | var scrollWidth = clone.scrollWidth;
|
609 | document.documentElement.removeChild(clone);
|
610 | return scrollWidth;
|
611 | }
|
612 | exports.estimateScrollWidth = estimateScrollWidth;
|
613 |
|
614 | })
|
615 |
|
616 | });
|
617 | });
|
618 |
|
\ | No newline at end of file |