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([], factory);
|
13 | else if(typeof exports === 'object')
|
14 | exports["slider"] = factory();
|
15 | else
|
16 | root["mdc"] = root["mdc"] || {}, root["mdc"]["slider"] = 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-slider/index.ts");
|
102 | })
|
103 |
|
104 | ({
|
105 |
|
106 | "./packages/mdc-animation/animationframe.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.AnimationFrame = void 0;
|
140 |
|
141 |
|
142 |
|
143 |
|
144 | var AnimationFrame = function () {
|
145 | function AnimationFrame() {
|
146 | this.rafIDs = new Map();
|
147 | }
|
148 | |
149 |
|
150 |
|
151 |
|
152 |
|
153 | AnimationFrame.prototype.request = function (key, callback) {
|
154 | var _this = this;
|
155 | this.cancel(key);
|
156 | var frameID = requestAnimationFrame(function (frame) {
|
157 | _this.rafIDs.delete(key);
|
158 |
|
159 |
|
160 | callback(frame);
|
161 | });
|
162 | this.rafIDs.set(key, frameID);
|
163 | };
|
164 | |
165 |
|
166 |
|
167 |
|
168 | AnimationFrame.prototype.cancel = function (key) {
|
169 | var rafID = this.rafIDs.get(key);
|
170 | if (rafID) {
|
171 | cancelAnimationFrame(rafID);
|
172 | this.rafIDs.delete(key);
|
173 | }
|
174 | };
|
175 | |
176 |
|
177 |
|
178 | AnimationFrame.prototype.cancelAll = function () {
|
179 | var _this = this;
|
180 |
|
181 |
|
182 |
|
183 | this.rafIDs.forEach(function (_, key) {
|
184 | _this.cancel(key);
|
185 | });
|
186 | };
|
187 | |
188 |
|
189 |
|
190 | AnimationFrame.prototype.getQueue = function () {
|
191 | var queue = [];
|
192 |
|
193 |
|
194 |
|
195 | this.rafIDs.forEach(function (_, key) {
|
196 | queue.push(key);
|
197 | });
|
198 | return queue;
|
199 | };
|
200 | return AnimationFrame;
|
201 | }();
|
202 | exports.AnimationFrame = AnimationFrame;
|
203 |
|
204 | }),
|
205 |
|
206 | "./packages/mdc-animation/util.ts":
|
207 |
|
208 |
|
209 |
|
210 |
|
211 | (function(module, exports, __webpack_require__) {
|
212 |
|
213 | "use strict";
|
214 |
|
215 |
|
216 |
|
217 |
|
218 |
|
219 |
|
220 |
|
221 |
|
222 |
|
223 |
|
224 |
|
225 |
|
226 |
|
227 |
|
228 |
|
229 |
|
230 |
|
231 |
|
232 |
|
233 |
|
234 |
|
235 |
|
236 |
|
237 |
|
238 | Object.defineProperty(exports, "__esModule", { value: true });
|
239 | exports.getCorrectEventName = exports.getCorrectPropertyName = void 0;
|
240 | var cssPropertyNameMap = {
|
241 | animation: {
|
242 | prefixed: '-webkit-animation',
|
243 | standard: 'animation'
|
244 | },
|
245 | transform: {
|
246 | prefixed: '-webkit-transform',
|
247 | standard: 'transform'
|
248 | },
|
249 | transition: {
|
250 | prefixed: '-webkit-transition',
|
251 | standard: 'transition'
|
252 | }
|
253 | };
|
254 | var jsEventTypeMap = {
|
255 | animationend: {
|
256 | cssProperty: 'animation',
|
257 | prefixed: 'webkitAnimationEnd',
|
258 | standard: 'animationend'
|
259 | },
|
260 | animationiteration: {
|
261 | cssProperty: 'animation',
|
262 | prefixed: 'webkitAnimationIteration',
|
263 | standard: 'animationiteration'
|
264 | },
|
265 | animationstart: {
|
266 | cssProperty: 'animation',
|
267 | prefixed: 'webkitAnimationStart',
|
268 | standard: 'animationstart'
|
269 | },
|
270 | transitionend: {
|
271 | cssProperty: 'transition',
|
272 | prefixed: 'webkitTransitionEnd',
|
273 | standard: 'transitionend'
|
274 | }
|
275 | };
|
276 | function isWindow(windowObj) {
|
277 | return Boolean(windowObj.document) && typeof windowObj.document.createElement === 'function';
|
278 | }
|
279 | function getCorrectPropertyName(windowObj, cssProperty) {
|
280 | if (isWindow(windowObj) && cssProperty in cssPropertyNameMap) {
|
281 | var el = windowObj.document.createElement('div');
|
282 | var _a = cssPropertyNameMap[cssProperty],
|
283 | standard = _a.standard,
|
284 | prefixed = _a.prefixed;
|
285 | var isStandard = standard in el.style;
|
286 | return isStandard ? standard : prefixed;
|
287 | }
|
288 | return cssProperty;
|
289 | }
|
290 | exports.getCorrectPropertyName = getCorrectPropertyName;
|
291 | function getCorrectEventName(windowObj, eventType) {
|
292 | if (isWindow(windowObj) && eventType in jsEventTypeMap) {
|
293 | var el = windowObj.document.createElement('div');
|
294 | var _a = jsEventTypeMap[eventType],
|
295 | standard = _a.standard,
|
296 | prefixed = _a.prefixed,
|
297 | cssProperty = _a.cssProperty;
|
298 | var isStandard = cssProperty in el.style;
|
299 | return isStandard ? standard : prefixed;
|
300 | }
|
301 | return eventType;
|
302 | }
|
303 | exports.getCorrectEventName = getCorrectEventName;
|
304 |
|
305 | }),
|
306 |
|
307 | "./packages/mdc-base/component.ts":
|
308 |
|
309 |
|
310 |
|
311 |
|
312 | (function(module, exports, __webpack_require__) {
|
313 |
|
314 | "use strict";
|
315 |
|
316 |
|
317 |
|
318 |
|
319 |
|
320 |
|
321 |
|
322 |
|
323 |
|
324 |
|
325 |
|
326 |
|
327 |
|
328 |
|
329 |
|
330 |
|
331 |
|
332 |
|
333 |
|
334 |
|
335 |
|
336 |
|
337 |
|
338 |
|
339 | var __read = this && this.__read || function (o, n) {
|
340 | var m = typeof Symbol === "function" && o[Symbol.iterator];
|
341 | if (!m) return o;
|
342 | var i = m.call(o),
|
343 | r,
|
344 | ar = [],
|
345 | e;
|
346 | try {
|
347 | while ((n === void 0 || n-- > 0) && !(r = i.next()).done) {
|
348 | ar.push(r.value);
|
349 | }
|
350 | } catch (error) {
|
351 | e = { error: error };
|
352 | } finally {
|
353 | try {
|
354 | if (r && !r.done && (m = i["return"])) m.call(i);
|
355 | } finally {
|
356 | if (e) throw e.error;
|
357 | }
|
358 | }
|
359 | return ar;
|
360 | };
|
361 | var __spreadArray = this && this.__spreadArray || function (to, from) {
|
362 | for (var i = 0, il = from.length, j = to.length; i < il; i++, j++) {
|
363 | to[j] = from[i];
|
364 | }return to;
|
365 | };
|
366 | Object.defineProperty(exports, "__esModule", { value: true });
|
367 | exports.MDCComponent = void 0;
|
368 | var foundation_1 = __webpack_require__( "./packages/mdc-base/foundation.ts");
|
369 | var MDCComponent = function () {
|
370 | function MDCComponent(root, foundation) {
|
371 | var args = [];
|
372 | for (var _i = 2; _i < arguments.length; _i++) {
|
373 | args[_i - 2] = arguments[_i];
|
374 | }
|
375 | this.root = root;
|
376 | this.initialize.apply(this, __spreadArray([], __read(args)));
|
377 |
|
378 |
|
379 | this.foundation = foundation === undefined ? this.getDefaultFoundation() : foundation;
|
380 | this.foundation.init();
|
381 | this.initialSyncWithDOM();
|
382 | }
|
383 | MDCComponent.attachTo = function (root) {
|
384 |
|
385 |
|
386 |
|
387 |
|
388 | return new MDCComponent(root, new foundation_1.MDCFoundation({}));
|
389 | };
|
390 |
|
391 | MDCComponent.prototype.initialize = function () {
|
392 | var _args = [];
|
393 | for (var _i = 0; _i < arguments.length; _i++) {
|
394 | _args[_i] = arguments[_i];
|
395 | }
|
396 |
|
397 |
|
398 |
|
399 | };
|
400 | MDCComponent.prototype.getDefaultFoundation = function () {
|
401 |
|
402 |
|
403 | throw new Error('Subclasses must override getDefaultFoundation to return a properly configured ' + 'foundation class');
|
404 | };
|
405 | MDCComponent.prototype.initialSyncWithDOM = function () {
|
406 |
|
407 |
|
408 |
|
409 |
|
410 | };
|
411 | MDCComponent.prototype.destroy = function () {
|
412 |
|
413 |
|
414 | this.foundation.destroy();
|
415 | };
|
416 | MDCComponent.prototype.listen = function (evtType, handler, options) {
|
417 | this.root.addEventListener(evtType, handler, options);
|
418 | };
|
419 | MDCComponent.prototype.unlisten = function (evtType, handler, options) {
|
420 | this.root.removeEventListener(evtType, handler, options);
|
421 | };
|
422 | |
423 |
|
424 |
|
425 | MDCComponent.prototype.emit = function (evtType, evtData, shouldBubble) {
|
426 | if (shouldBubble === void 0) {
|
427 | shouldBubble = false;
|
428 | }
|
429 | var evt;
|
430 | if (typeof CustomEvent === 'function') {
|
431 | evt = new CustomEvent(evtType, {
|
432 | bubbles: shouldBubble,
|
433 | detail: evtData
|
434 | });
|
435 | } else {
|
436 | evt = document.createEvent('CustomEvent');
|
437 | evt.initCustomEvent(evtType, shouldBubble, false, evtData);
|
438 | }
|
439 | this.root.dispatchEvent(evt);
|
440 | };
|
441 | return MDCComponent;
|
442 | }();
|
443 | exports.MDCComponent = MDCComponent;
|
444 |
|
445 | exports.default = MDCComponent;
|
446 |
|
447 | }),
|
448 |
|
449 | "./packages/mdc-base/foundation.ts":
|
450 |
|
451 |
|
452 |
|
453 |
|
454 | (function(module, exports, __webpack_require__) {
|
455 |
|
456 | "use strict";
|
457 |
|
458 |
|
459 |
|
460 |
|
461 |
|
462 |
|
463 |
|
464 |
|
465 |
|
466 |
|
467 |
|
468 |
|
469 |
|
470 |
|
471 |
|
472 |
|
473 |
|
474 |
|
475 |
|
476 |
|
477 |
|
478 |
|
479 |
|
480 |
|
481 | Object.defineProperty(exports, "__esModule", { value: true });
|
482 | exports.MDCFoundation = void 0;
|
483 | var MDCFoundation = function () {
|
484 | function MDCFoundation(adapter) {
|
485 | if (adapter === void 0) {
|
486 | adapter = {};
|
487 | }
|
488 | this.adapter = adapter;
|
489 | }
|
490 | Object.defineProperty(MDCFoundation, "cssClasses", {
|
491 | get: function get() {
|
492 |
|
493 |
|
494 | return {};
|
495 | },
|
496 | enumerable: false,
|
497 | configurable: true
|
498 | });
|
499 | Object.defineProperty(MDCFoundation, "strings", {
|
500 | get: function get() {
|
501 |
|
502 |
|
503 | return {};
|
504 | },
|
505 | enumerable: false,
|
506 | configurable: true
|
507 | });
|
508 | Object.defineProperty(MDCFoundation, "numbers", {
|
509 | get: function get() {
|
510 |
|
511 |
|
512 | return {};
|
513 | },
|
514 | enumerable: false,
|
515 | configurable: true
|
516 | });
|
517 | Object.defineProperty(MDCFoundation, "defaultAdapter", {
|
518 | get: function get() {
|
519 |
|
520 |
|
521 |
|
522 | return {};
|
523 | },
|
524 | enumerable: false,
|
525 | configurable: true
|
526 | });
|
527 | MDCFoundation.prototype.init = function () {
|
528 |
|
529 | };
|
530 | MDCFoundation.prototype.destroy = function () {
|
531 |
|
532 | };
|
533 | return MDCFoundation;
|
534 | }();
|
535 | exports.MDCFoundation = MDCFoundation;
|
536 |
|
537 | exports.default = MDCFoundation;
|
538 |
|
539 | }),
|
540 |
|
541 | "./packages/mdc-dom/events.ts":
|
542 |
|
543 |
|
544 |
|
545 |
|
546 | (function(module, exports, __webpack_require__) {
|
547 |
|
548 | "use strict";
|
549 |
|
550 |
|
551 |
|
552 |
|
553 |
|
554 |
|
555 |
|
556 |
|
557 |
|
558 |
|
559 |
|
560 |
|
561 |
|
562 |
|
563 |
|
564 |
|
565 |
|
566 |
|
567 |
|
568 |
|
569 |
|
570 |
|
571 |
|
572 |
|
573 | Object.defineProperty(exports, "__esModule", { value: true });
|
574 | exports.applyPassive = void 0;
|
575 |
|
576 |
|
577 |
|
578 |
|
579 | function applyPassive(globalObj) {
|
580 | if (globalObj === void 0) {
|
581 | globalObj = window;
|
582 | }
|
583 | return supportsPassiveOption(globalObj) ? { passive: true } : false;
|
584 | }
|
585 | exports.applyPassive = applyPassive;
|
586 | function supportsPassiveOption(globalObj) {
|
587 | if (globalObj === void 0) {
|
588 | globalObj = window;
|
589 | }
|
590 |
|
591 |
|
592 | var passiveSupported = false;
|
593 | try {
|
594 | var options = {
|
595 |
|
596 |
|
597 | get passive() {
|
598 | passiveSupported = true;
|
599 | return false;
|
600 | }
|
601 | };
|
602 | var handler = function handler() {};
|
603 | globalObj.document.addEventListener('test', handler, options);
|
604 | globalObj.document.removeEventListener('test', handler, options);
|
605 | } catch (err) {
|
606 | passiveSupported = false;
|
607 | }
|
608 | return passiveSupported;
|
609 | }
|
610 |
|
611 | }),
|
612 |
|
613 | "./packages/mdc-dom/ponyfill.ts":
|
614 |
|
615 |
|
616 |
|
617 |
|
618 | (function(module, exports, __webpack_require__) {
|
619 |
|
620 | "use strict";
|
621 |
|
622 |
|
623 |
|
624 |
|
625 |
|
626 |
|
627 |
|
628 |
|
629 |
|
630 |
|
631 |
|
632 |
|
633 |
|
634 |
|
635 |
|
636 |
|
637 |
|
638 |
|
639 |
|
640 |
|
641 |
|
642 |
|
643 |
|
644 |
|
645 | Object.defineProperty(exports, "__esModule", { value: true });
|
646 | exports.estimateScrollWidth = exports.matches = exports.closest = void 0;
|
647 |
|
648 |
|
649 |
|
650 |
|
651 | function closest(element, selector) {
|
652 | if (element.closest) {
|
653 | return element.closest(selector);
|
654 | }
|
655 | var el = element;
|
656 | while (el) {
|
657 | if (matches(el, selector)) {
|
658 | return el;
|
659 | }
|
660 | el = el.parentElement;
|
661 | }
|
662 | return null;
|
663 | }
|
664 | exports.closest = closest;
|
665 | function matches(element, selector) {
|
666 | var nativeMatches = element.matches || element.webkitMatchesSelector || element.msMatchesSelector;
|
667 | return nativeMatches.call(element, selector);
|
668 | }
|
669 | exports.matches = matches;
|
670 |
|
671 |
|
672 |
|
673 |
|
674 |
|
675 |
|
676 |
|
677 |
|
678 | function estimateScrollWidth(element) {
|
679 |
|
680 |
|
681 |
|
682 |
|
683 | var htmlEl = element;
|
684 | if (htmlEl.offsetParent !== null) {
|
685 | return htmlEl.scrollWidth;
|
686 | }
|
687 | var clone = htmlEl.cloneNode(true);
|
688 | clone.style.setProperty('position', 'absolute');
|
689 | clone.style.setProperty('transform', 'translate(-9999px, -9999px)');
|
690 | document.documentElement.appendChild(clone);
|
691 | var scrollWidth = clone.scrollWidth;
|
692 | document.documentElement.removeChild(clone);
|
693 | return scrollWidth;
|
694 | }
|
695 | exports.estimateScrollWidth = estimateScrollWidth;
|
696 |
|
697 | }),
|
698 |
|
699 | "./packages/mdc-ripple/component.ts":
|
700 |
|
701 |
|
702 |
|
703 |
|
704 | (function(module, exports, __webpack_require__) {
|
705 |
|
706 | "use strict";
|
707 |
|
708 |
|
709 |
|
710 |
|
711 |
|
712 |
|
713 |
|
714 |
|
715 |
|
716 |
|
717 |
|
718 |
|
719 |
|
720 |
|
721 |
|
722 |
|
723 |
|
724 |
|
725 |
|
726 |
|
727 |
|
728 |
|
729 |
|
730 |
|
731 | var __extends = this && this.__extends || function () {
|
732 | var _extendStatics = function extendStatics(d, b) {
|
733 | _extendStatics = Object.setPrototypeOf || { __proto__: [] } instanceof Array && function (d, b) {
|
734 | d.__proto__ = b;
|
735 | } || function (d, b) {
|
736 | for (var p in b) {
|
737 | if (Object.prototype.hasOwnProperty.call(b, p)) d[p] = b[p];
|
738 | }
|
739 | };
|
740 | return _extendStatics(d, b);
|
741 | };
|
742 | return function (d, b) {
|
743 | if (typeof b !== "function" && b !== null) throw new TypeError("Class extends value " + String(b) + " is not a constructor or null");
|
744 | _extendStatics(d, b);
|
745 | function __() {
|
746 | this.constructor = d;
|
747 | }
|
748 | d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
|
749 | };
|
750 | }();
|
751 | var __createBinding = this && this.__createBinding || (Object.create ? function (o, m, k, k2) {
|
752 | if (k2 === undefined) k2 = k;
|
753 | Object.defineProperty(o, k2, { enumerable: true, get: function get() {
|
754 | return m[k];
|
755 | } });
|
756 | } : function (o, m, k, k2) {
|
757 | if (k2 === undefined) k2 = k;
|
758 | o[k2] = m[k];
|
759 | });
|
760 | var __setModuleDefault = this && this.__setModuleDefault || (Object.create ? function (o, v) {
|
761 | Object.defineProperty(o, "default", { enumerable: true, value: v });
|
762 | } : function (o, v) {
|
763 | o["default"] = v;
|
764 | });
|
765 | var __importStar = this && this.__importStar || function (mod) {
|
766 | if (mod && mod.__esModule) return mod;
|
767 | var result = {};
|
768 | if (mod != null) for (var k in mod) {
|
769 | if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
|
770 | }__setModuleDefault(result, mod);
|
771 | return result;
|
772 | };
|
773 | Object.defineProperty(exports, "__esModule", { value: true });
|
774 | exports.MDCRipple = void 0;
|
775 | var component_1 = __webpack_require__( "./packages/mdc-base/component.ts");
|
776 | var events_1 = __webpack_require__( "./packages/mdc-dom/events.ts");
|
777 | var ponyfill_1 = __webpack_require__( "./packages/mdc-dom/ponyfill.ts");
|
778 | var foundation_1 = __webpack_require__( "./packages/mdc-ripple/foundation.ts");
|
779 | var util = __importStar(__webpack_require__( "./packages/mdc-ripple/util.ts"));
|
780 | var MDCRipple = function (_super) {
|
781 | __extends(MDCRipple, _super);
|
782 | function MDCRipple() {
|
783 | var _this = _super !== null && _super.apply(this, arguments) || this;
|
784 | _this.disabled = false;
|
785 | return _this;
|
786 | }
|
787 | MDCRipple.attachTo = function (root, opts) {
|
788 | if (opts === void 0) {
|
789 | opts = { isUnbounded: undefined };
|
790 | }
|
791 | var ripple = new MDCRipple(root);
|
792 |
|
793 | if (opts.isUnbounded !== undefined) {
|
794 | ripple.unbounded = opts.isUnbounded;
|
795 | }
|
796 | return ripple;
|
797 | };
|
798 | MDCRipple.createAdapter = function (instance) {
|
799 | return {
|
800 | addClass: function addClass(className) {
|
801 | return instance.root.classList.add(className);
|
802 | },
|
803 | browserSupportsCssVars: function browserSupportsCssVars() {
|
804 | return util.supportsCssVariables(window);
|
805 | },
|
806 | computeBoundingRect: function computeBoundingRect() {
|
807 | return instance.root.getBoundingClientRect();
|
808 | },
|
809 | containsEventTarget: function containsEventTarget(target) {
|
810 | return instance.root.contains(target);
|
811 | },
|
812 | deregisterDocumentInteractionHandler: function deregisterDocumentInteractionHandler(evtType, handler) {
|
813 | return document.documentElement.removeEventListener(evtType, handler, events_1.applyPassive());
|
814 | },
|
815 | deregisterInteractionHandler: function deregisterInteractionHandler(evtType, handler) {
|
816 | return instance.root.removeEventListener(evtType, handler, events_1.applyPassive());
|
817 | },
|
818 | deregisterResizeHandler: function deregisterResizeHandler(handler) {
|
819 | return window.removeEventListener('resize', handler);
|
820 | },
|
821 | getWindowPageOffset: function getWindowPageOffset() {
|
822 | return { x: window.pageXOffset, y: window.pageYOffset };
|
823 | },
|
824 | isSurfaceActive: function isSurfaceActive() {
|
825 | return ponyfill_1.matches(instance.root, ':active');
|
826 | },
|
827 | isSurfaceDisabled: function isSurfaceDisabled() {
|
828 | return Boolean(instance.disabled);
|
829 | },
|
830 | isUnbounded: function isUnbounded() {
|
831 | return Boolean(instance.unbounded);
|
832 | },
|
833 | registerDocumentInteractionHandler: function registerDocumentInteractionHandler(evtType, handler) {
|
834 | return document.documentElement.addEventListener(evtType, handler, events_1.applyPassive());
|
835 | },
|
836 | registerInteractionHandler: function registerInteractionHandler(evtType, handler) {
|
837 | return instance.root.addEventListener(evtType, handler, events_1.applyPassive());
|
838 | },
|
839 | registerResizeHandler: function registerResizeHandler(handler) {
|
840 | return window.addEventListener('resize', handler);
|
841 | },
|
842 | removeClass: function removeClass(className) {
|
843 | return instance.root.classList.remove(className);
|
844 | },
|
845 | updateCssVariable: function updateCssVariable(varName, value) {
|
846 | return instance.root.style.setProperty(varName, value);
|
847 | }
|
848 | };
|
849 | };
|
850 | Object.defineProperty(MDCRipple.prototype, "unbounded", {
|
851 | get: function get() {
|
852 | return Boolean(this.unbounded_);
|
853 | },
|
854 | set: function set(unbounded) {
|
855 | this.unbounded_ = Boolean(unbounded);
|
856 | this.setUnbounded_();
|
857 | },
|
858 | enumerable: false,
|
859 | configurable: true
|
860 | });
|
861 | MDCRipple.prototype.activate = function () {
|
862 | this.foundation.activate();
|
863 | };
|
864 | MDCRipple.prototype.deactivate = function () {
|
865 | this.foundation.deactivate();
|
866 | };
|
867 | MDCRipple.prototype.layout = function () {
|
868 | this.foundation.layout();
|
869 | };
|
870 | MDCRipple.prototype.getDefaultFoundation = function () {
|
871 | return new foundation_1.MDCRippleFoundation(MDCRipple.createAdapter(this));
|
872 | };
|
873 | MDCRipple.prototype.initialSyncWithDOM = function () {
|
874 | var root = this.root;
|
875 | this.unbounded = 'mdcRippleIsUnbounded' in root.dataset;
|
876 | };
|
877 | |
878 |
|
879 |
|
880 |
|
881 |
|
882 |
|
883 | MDCRipple.prototype.setUnbounded_ = function () {
|
884 | this.foundation.setUnbounded(Boolean(this.unbounded_));
|
885 | };
|
886 | return MDCRipple;
|
887 | }(component_1.MDCComponent);
|
888 | exports.MDCRipple = MDCRipple;
|
889 |
|
890 | }),
|
891 |
|
892 | "./packages/mdc-ripple/constants.ts":
|
893 |
|
894 |
|
895 |
|
896 |
|
897 | (function(module, exports, __webpack_require__) {
|
898 |
|
899 | "use strict";
|
900 |
|
901 |
|
902 |
|
903 |
|
904 |
|
905 |
|
906 |
|
907 |
|
908 |
|
909 |
|
910 |
|
911 |
|
912 |
|
913 |
|
914 |
|
915 |
|
916 |
|
917 |
|
918 |
|
919 |
|
920 |
|
921 |
|
922 |
|
923 |
|
924 | Object.defineProperty(exports, "__esModule", { value: true });
|
925 | exports.numbers = exports.strings = exports.cssClasses = void 0;
|
926 | exports.cssClasses = {
|
927 |
|
928 |
|
929 |
|
930 | BG_FOCUSED: 'mdc-ripple-upgraded--background-focused',
|
931 | FG_ACTIVATION: 'mdc-ripple-upgraded--foreground-activation',
|
932 | FG_DEACTIVATION: 'mdc-ripple-upgraded--foreground-deactivation',
|
933 | ROOT: 'mdc-ripple-upgraded',
|
934 | UNBOUNDED: 'mdc-ripple-upgraded--unbounded'
|
935 | };
|
936 | exports.strings = {
|
937 | VAR_FG_SCALE: '--mdc-ripple-fg-scale',
|
938 | VAR_FG_SIZE: '--mdc-ripple-fg-size',
|
939 | VAR_FG_TRANSLATE_END: '--mdc-ripple-fg-translate-end',
|
940 | VAR_FG_TRANSLATE_START: '--mdc-ripple-fg-translate-start',
|
941 | VAR_LEFT: '--mdc-ripple-left',
|
942 | VAR_TOP: '--mdc-ripple-top'
|
943 | };
|
944 | exports.numbers = {
|
945 | DEACTIVATION_TIMEOUT_MS: 225,
|
946 | FG_DEACTIVATION_MS: 150,
|
947 | INITIAL_ORIGIN_SCALE: 0.6,
|
948 | PADDING: 10,
|
949 | TAP_DELAY_MS: 300 };
|
950 |
|
951 | }),
|
952 |
|
953 | "./packages/mdc-ripple/foundation.ts":
|
954 |
|
955 |
|
956 |
|
957 |
|
958 | (function(module, exports, __webpack_require__) {
|
959 |
|
960 | "use strict";
|
961 |
|
962 |
|
963 |
|
964 |
|
965 |
|
966 |
|
967 |
|
968 |
|
969 |
|
970 |
|
971 |
|
972 |
|
973 |
|
974 |
|
975 |
|
976 |
|
977 |
|
978 |
|
979 |
|
980 |
|
981 |
|
982 |
|
983 |
|
984 |
|
985 | var __extends = this && this.__extends || function () {
|
986 | var _extendStatics = function extendStatics(d, b) {
|
987 | _extendStatics = Object.setPrototypeOf || { __proto__: [] } instanceof Array && function (d, b) {
|
988 | d.__proto__ = b;
|
989 | } || function (d, b) {
|
990 | for (var p in b) {
|
991 | if (Object.prototype.hasOwnProperty.call(b, p)) d[p] = b[p];
|
992 | }
|
993 | };
|
994 | return _extendStatics(d, b);
|
995 | };
|
996 | return function (d, b) {
|
997 | if (typeof b !== "function" && b !== null) throw new TypeError("Class extends value " + String(b) + " is not a constructor or null");
|
998 | _extendStatics(d, b);
|
999 | function __() {
|
1000 | this.constructor = d;
|
1001 | }
|
1002 | d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
|
1003 | };
|
1004 | }();
|
1005 | var __assign = this && this.__assign || function () {
|
1006 | __assign = Object.assign || function (t) {
|
1007 | for (var s, i = 1, n = arguments.length; i < n; i++) {
|
1008 | s = arguments[i];
|
1009 | for (var p in s) {
|
1010 | if (Object.prototype.hasOwnProperty.call(s, p)) t[p] = s[p];
|
1011 | }
|
1012 | }
|
1013 | return t;
|
1014 | };
|
1015 | return __assign.apply(this, arguments);
|
1016 | };
|
1017 | Object.defineProperty(exports, "__esModule", { value: true });
|
1018 | exports.MDCRippleFoundation = void 0;
|
1019 | var foundation_1 = __webpack_require__( "./packages/mdc-base/foundation.ts");
|
1020 | var constants_1 = __webpack_require__( "./packages/mdc-ripple/constants.ts");
|
1021 | var util_1 = __webpack_require__( "./packages/mdc-ripple/util.ts");
|
1022 |
|
1023 | var ACTIVATION_EVENT_TYPES = ['touchstart', 'pointerdown', 'mousedown', 'keydown'];
|
1024 |
|
1025 | var POINTER_DEACTIVATION_EVENT_TYPES = ['touchend', 'pointerup', 'mouseup', 'contextmenu'];
|
1026 |
|
1027 | var activatedTargets = [];
|
1028 | var MDCRippleFoundation = function (_super) {
|
1029 | __extends(MDCRippleFoundation, _super);
|
1030 | function MDCRippleFoundation(adapter) {
|
1031 | var _this = _super.call(this, __assign(__assign({}, MDCRippleFoundation.defaultAdapter), adapter)) || this;
|
1032 | _this.activationAnimationHasEnded_ = false;
|
1033 | _this.activationTimer_ = 0;
|
1034 | _this.fgDeactivationRemovalTimer_ = 0;
|
1035 | _this.fgScale_ = '0';
|
1036 | _this.frame_ = { width: 0, height: 0 };
|
1037 | _this.initialSize_ = 0;
|
1038 | _this.layoutFrame_ = 0;
|
1039 | _this.maxRadius_ = 0;
|
1040 | _this.unboundedCoords_ = { left: 0, top: 0 };
|
1041 | _this.activationState_ = _this.defaultActivationState_();
|
1042 | _this.activationTimerCallback_ = function () {
|
1043 | _this.activationAnimationHasEnded_ = true;
|
1044 | _this.runDeactivationUXLogicIfReady_();
|
1045 | };
|
1046 | _this.activateHandler_ = function (e) {
|
1047 | return _this.activate_(e);
|
1048 | };
|
1049 | _this.deactivateHandler_ = function () {
|
1050 | return _this.deactivate_();
|
1051 | };
|
1052 | _this.focusHandler_ = function () {
|
1053 | return _this.handleFocus();
|
1054 | };
|
1055 | _this.blurHandler_ = function () {
|
1056 | return _this.handleBlur();
|
1057 | };
|
1058 | _this.resizeHandler_ = function () {
|
1059 | return _this.layout();
|
1060 | };
|
1061 | return _this;
|
1062 | }
|
1063 | Object.defineProperty(MDCRippleFoundation, "cssClasses", {
|
1064 | get: function get() {
|
1065 | return constants_1.cssClasses;
|
1066 | },
|
1067 | enumerable: false,
|
1068 | configurable: true
|
1069 | });
|
1070 | Object.defineProperty(MDCRippleFoundation, "strings", {
|
1071 | get: function get() {
|
1072 | return constants_1.strings;
|
1073 | },
|
1074 | enumerable: false,
|
1075 | configurable: true
|
1076 | });
|
1077 | Object.defineProperty(MDCRippleFoundation, "numbers", {
|
1078 | get: function get() {
|
1079 | return constants_1.numbers;
|
1080 | },
|
1081 | enumerable: false,
|
1082 | configurable: true
|
1083 | });
|
1084 | Object.defineProperty(MDCRippleFoundation, "defaultAdapter", {
|
1085 | get: function get() {
|
1086 | return {
|
1087 | addClass: function addClass() {
|
1088 | return undefined;
|
1089 | },
|
1090 | browserSupportsCssVars: function browserSupportsCssVars() {
|
1091 | return true;
|
1092 | },
|
1093 | computeBoundingRect: function computeBoundingRect() {
|
1094 | return { top: 0, right: 0, bottom: 0, left: 0, width: 0, height: 0 };
|
1095 | },
|
1096 | containsEventTarget: function containsEventTarget() {
|
1097 | return true;
|
1098 | },
|
1099 | deregisterDocumentInteractionHandler: function deregisterDocumentInteractionHandler() {
|
1100 | return undefined;
|
1101 | },
|
1102 | deregisterInteractionHandler: function deregisterInteractionHandler() {
|
1103 | return undefined;
|
1104 | },
|
1105 | deregisterResizeHandler: function deregisterResizeHandler() {
|
1106 | return undefined;
|
1107 | },
|
1108 | getWindowPageOffset: function getWindowPageOffset() {
|
1109 | return { x: 0, y: 0 };
|
1110 | },
|
1111 | isSurfaceActive: function isSurfaceActive() {
|
1112 | return true;
|
1113 | },
|
1114 | isSurfaceDisabled: function isSurfaceDisabled() {
|
1115 | return true;
|
1116 | },
|
1117 | isUnbounded: function isUnbounded() {
|
1118 | return true;
|
1119 | },
|
1120 | registerDocumentInteractionHandler: function registerDocumentInteractionHandler() {
|
1121 | return undefined;
|
1122 | },
|
1123 | registerInteractionHandler: function registerInteractionHandler() {
|
1124 | return undefined;
|
1125 | },
|
1126 | registerResizeHandler: function registerResizeHandler() {
|
1127 | return undefined;
|
1128 | },
|
1129 | removeClass: function removeClass() {
|
1130 | return undefined;
|
1131 | },
|
1132 | updateCssVariable: function updateCssVariable() {
|
1133 | return undefined;
|
1134 | }
|
1135 | };
|
1136 | },
|
1137 | enumerable: false,
|
1138 | configurable: true
|
1139 | });
|
1140 | MDCRippleFoundation.prototype.init = function () {
|
1141 | var _this = this;
|
1142 | var supportsPressRipple = this.supportsPressRipple_();
|
1143 | this.registerRootHandlers_(supportsPressRipple);
|
1144 | if (supportsPressRipple) {
|
1145 | var _a = MDCRippleFoundation.cssClasses,
|
1146 | ROOT_1 = _a.ROOT,
|
1147 | UNBOUNDED_1 = _a.UNBOUNDED;
|
1148 | requestAnimationFrame(function () {
|
1149 | _this.adapter.addClass(ROOT_1);
|
1150 | if (_this.adapter.isUnbounded()) {
|
1151 | _this.adapter.addClass(UNBOUNDED_1);
|
1152 |
|
1153 | _this.layoutInternal_();
|
1154 | }
|
1155 | });
|
1156 | }
|
1157 | };
|
1158 | MDCRippleFoundation.prototype.destroy = function () {
|
1159 | var _this = this;
|
1160 | if (this.supportsPressRipple_()) {
|
1161 | if (this.activationTimer_) {
|
1162 | clearTimeout(this.activationTimer_);
|
1163 | this.activationTimer_ = 0;
|
1164 | this.adapter.removeClass(MDCRippleFoundation.cssClasses.FG_ACTIVATION);
|
1165 | }
|
1166 | if (this.fgDeactivationRemovalTimer_) {
|
1167 | clearTimeout(this.fgDeactivationRemovalTimer_);
|
1168 | this.fgDeactivationRemovalTimer_ = 0;
|
1169 | this.adapter.removeClass(MDCRippleFoundation.cssClasses.FG_DEACTIVATION);
|
1170 | }
|
1171 | var _a = MDCRippleFoundation.cssClasses,
|
1172 | ROOT_2 = _a.ROOT,
|
1173 | UNBOUNDED_2 = _a.UNBOUNDED;
|
1174 | requestAnimationFrame(function () {
|
1175 | _this.adapter.removeClass(ROOT_2);
|
1176 | _this.adapter.removeClass(UNBOUNDED_2);
|
1177 | _this.removeCssVars_();
|
1178 | });
|
1179 | }
|
1180 | this.deregisterRootHandlers_();
|
1181 | this.deregisterDeactivationHandlers_();
|
1182 | };
|
1183 | |
1184 |
|
1185 |
|
1186 | MDCRippleFoundation.prototype.activate = function (evt) {
|
1187 | this.activate_(evt);
|
1188 | };
|
1189 | MDCRippleFoundation.prototype.deactivate = function () {
|
1190 | this.deactivate_();
|
1191 | };
|
1192 | MDCRippleFoundation.prototype.layout = function () {
|
1193 | var _this = this;
|
1194 | if (this.layoutFrame_) {
|
1195 | cancelAnimationFrame(this.layoutFrame_);
|
1196 | }
|
1197 | this.layoutFrame_ = requestAnimationFrame(function () {
|
1198 | _this.layoutInternal_();
|
1199 | _this.layoutFrame_ = 0;
|
1200 | });
|
1201 | };
|
1202 | MDCRippleFoundation.prototype.setUnbounded = function (unbounded) {
|
1203 | var UNBOUNDED = MDCRippleFoundation.cssClasses.UNBOUNDED;
|
1204 | if (unbounded) {
|
1205 | this.adapter.addClass(UNBOUNDED);
|
1206 | } else {
|
1207 | this.adapter.removeClass(UNBOUNDED);
|
1208 | }
|
1209 | };
|
1210 | MDCRippleFoundation.prototype.handleFocus = function () {
|
1211 | var _this = this;
|
1212 | requestAnimationFrame(function () {
|
1213 | return _this.adapter.addClass(MDCRippleFoundation.cssClasses.BG_FOCUSED);
|
1214 | });
|
1215 | };
|
1216 | MDCRippleFoundation.prototype.handleBlur = function () {
|
1217 | var _this = this;
|
1218 | requestAnimationFrame(function () {
|
1219 | return _this.adapter.removeClass(MDCRippleFoundation.cssClasses.BG_FOCUSED);
|
1220 | });
|
1221 | };
|
1222 | |
1223 |
|
1224 |
|
1225 |
|
1226 |
|
1227 |
|
1228 | MDCRippleFoundation.prototype.supportsPressRipple_ = function () {
|
1229 | return this.adapter.browserSupportsCssVars();
|
1230 | };
|
1231 | MDCRippleFoundation.prototype.defaultActivationState_ = function () {
|
1232 | return {
|
1233 | activationEvent: undefined,
|
1234 | hasDeactivationUXRun: false,
|
1235 | isActivated: false,
|
1236 | isProgrammatic: false,
|
1237 | wasActivatedByPointer: false,
|
1238 | wasElementMadeActive: false
|
1239 | };
|
1240 | };
|
1241 | |
1242 |
|
1243 |
|
1244 | MDCRippleFoundation.prototype.registerRootHandlers_ = function (supportsPressRipple) {
|
1245 | var _this = this;
|
1246 | if (supportsPressRipple) {
|
1247 | ACTIVATION_EVENT_TYPES.forEach(function (evtType) {
|
1248 | _this.adapter.registerInteractionHandler(evtType, _this.activateHandler_);
|
1249 | });
|
1250 | if (this.adapter.isUnbounded()) {
|
1251 | this.adapter.registerResizeHandler(this.resizeHandler_);
|
1252 | }
|
1253 | }
|
1254 | this.adapter.registerInteractionHandler('focus', this.focusHandler_);
|
1255 | this.adapter.registerInteractionHandler('blur', this.blurHandler_);
|
1256 | };
|
1257 | MDCRippleFoundation.prototype.registerDeactivationHandlers_ = function (evt) {
|
1258 | var _this = this;
|
1259 | if (evt.type === 'keydown') {
|
1260 | this.adapter.registerInteractionHandler('keyup', this.deactivateHandler_);
|
1261 | } else {
|
1262 | POINTER_DEACTIVATION_EVENT_TYPES.forEach(function (evtType) {
|
1263 | _this.adapter.registerDocumentInteractionHandler(evtType, _this.deactivateHandler_);
|
1264 | });
|
1265 | }
|
1266 | };
|
1267 | MDCRippleFoundation.prototype.deregisterRootHandlers_ = function () {
|
1268 | var _this = this;
|
1269 | ACTIVATION_EVENT_TYPES.forEach(function (evtType) {
|
1270 | _this.adapter.deregisterInteractionHandler(evtType, _this.activateHandler_);
|
1271 | });
|
1272 | this.adapter.deregisterInteractionHandler('focus', this.focusHandler_);
|
1273 | this.adapter.deregisterInteractionHandler('blur', this.blurHandler_);
|
1274 | if (this.adapter.isUnbounded()) {
|
1275 | this.adapter.deregisterResizeHandler(this.resizeHandler_);
|
1276 | }
|
1277 | };
|
1278 | MDCRippleFoundation.prototype.deregisterDeactivationHandlers_ = function () {
|
1279 | var _this = this;
|
1280 | this.adapter.deregisterInteractionHandler('keyup', this.deactivateHandler_);
|
1281 | POINTER_DEACTIVATION_EVENT_TYPES.forEach(function (evtType) {
|
1282 | _this.adapter.deregisterDocumentInteractionHandler(evtType, _this.deactivateHandler_);
|
1283 | });
|
1284 | };
|
1285 | MDCRippleFoundation.prototype.removeCssVars_ = function () {
|
1286 | var _this = this;
|
1287 | var rippleStrings = MDCRippleFoundation.strings;
|
1288 | var keys = Object.keys(rippleStrings);
|
1289 | keys.forEach(function (key) {
|
1290 | if (key.indexOf('VAR_') === 0) {
|
1291 | _this.adapter.updateCssVariable(rippleStrings[key], null);
|
1292 | }
|
1293 | });
|
1294 | };
|
1295 | MDCRippleFoundation.prototype.activate_ = function (evt) {
|
1296 | var _this = this;
|
1297 | if (this.adapter.isSurfaceDisabled()) {
|
1298 | return;
|
1299 | }
|
1300 | var activationState = this.activationState_;
|
1301 | if (activationState.isActivated) {
|
1302 | return;
|
1303 | }
|
1304 |
|
1305 | var previousActivationEvent = this.previousActivationEvent_;
|
1306 | var isSameInteraction = previousActivationEvent && evt !== undefined && previousActivationEvent.type !== evt.type;
|
1307 | if (isSameInteraction) {
|
1308 | return;
|
1309 | }
|
1310 | activationState.isActivated = true;
|
1311 | activationState.isProgrammatic = evt === undefined;
|
1312 | activationState.activationEvent = evt;
|
1313 | activationState.wasActivatedByPointer = activationState.isProgrammatic ? false : evt !== undefined && (evt.type === 'mousedown' || evt.type === 'touchstart' || evt.type === 'pointerdown');
|
1314 | var hasActivatedChild = evt !== undefined && activatedTargets.length > 0 && activatedTargets.some(function (target) {
|
1315 | return _this.adapter.containsEventTarget(target);
|
1316 | });
|
1317 | if (hasActivatedChild) {
|
1318 |
|
1319 | this.resetActivationState_();
|
1320 | return;
|
1321 | }
|
1322 | if (evt !== undefined) {
|
1323 | activatedTargets.push(evt.target);
|
1324 | this.registerDeactivationHandlers_(evt);
|
1325 | }
|
1326 | activationState.wasElementMadeActive = this.checkElementMadeActive_(evt);
|
1327 | if (activationState.wasElementMadeActive) {
|
1328 | this.animateActivation_();
|
1329 | }
|
1330 | requestAnimationFrame(function () {
|
1331 |
|
1332 | activatedTargets = [];
|
1333 | if (!activationState.wasElementMadeActive && evt !== undefined && (evt.key === ' ' || evt.keyCode === 32)) {
|
1334 |
|
1335 |
|
1336 |
|
1337 |
|
1338 |
|
1339 |
|
1340 | activationState.wasElementMadeActive = _this.checkElementMadeActive_(evt);
|
1341 | if (activationState.wasElementMadeActive) {
|
1342 | _this.animateActivation_();
|
1343 | }
|
1344 | }
|
1345 | if (!activationState.wasElementMadeActive) {
|
1346 |
|
1347 | _this.activationState_ = _this.defaultActivationState_();
|
1348 | }
|
1349 | });
|
1350 | };
|
1351 | MDCRippleFoundation.prototype.checkElementMadeActive_ = function (evt) {
|
1352 | return evt !== undefined && evt.type === 'keydown' ? this.adapter.isSurfaceActive() : true;
|
1353 | };
|
1354 | MDCRippleFoundation.prototype.animateActivation_ = function () {
|
1355 | var _this = this;
|
1356 | var _a = MDCRippleFoundation.strings,
|
1357 | VAR_FG_TRANSLATE_START = _a.VAR_FG_TRANSLATE_START,
|
1358 | VAR_FG_TRANSLATE_END = _a.VAR_FG_TRANSLATE_END;
|
1359 | var _b = MDCRippleFoundation.cssClasses,
|
1360 | FG_DEACTIVATION = _b.FG_DEACTIVATION,
|
1361 | FG_ACTIVATION = _b.FG_ACTIVATION;
|
1362 | var DEACTIVATION_TIMEOUT_MS = MDCRippleFoundation.numbers.DEACTIVATION_TIMEOUT_MS;
|
1363 | this.layoutInternal_();
|
1364 | var translateStart = '';
|
1365 | var translateEnd = '';
|
1366 | if (!this.adapter.isUnbounded()) {
|
1367 | var _c = this.getFgTranslationCoordinates_(),
|
1368 | startPoint = _c.startPoint,
|
1369 | endPoint = _c.endPoint;
|
1370 | translateStart = startPoint.x + "px, " + startPoint.y + "px";
|
1371 | translateEnd = endPoint.x + "px, " + endPoint.y + "px";
|
1372 | }
|
1373 | this.adapter.updateCssVariable(VAR_FG_TRANSLATE_START, translateStart);
|
1374 | this.adapter.updateCssVariable(VAR_FG_TRANSLATE_END, translateEnd);
|
1375 |
|
1376 | clearTimeout(this.activationTimer_);
|
1377 | clearTimeout(this.fgDeactivationRemovalTimer_);
|
1378 | this.rmBoundedActivationClasses_();
|
1379 | this.adapter.removeClass(FG_DEACTIVATION);
|
1380 |
|
1381 | this.adapter.computeBoundingRect();
|
1382 | this.adapter.addClass(FG_ACTIVATION);
|
1383 | this.activationTimer_ = setTimeout(function () {
|
1384 | return _this.activationTimerCallback_();
|
1385 | }, DEACTIVATION_TIMEOUT_MS);
|
1386 | };
|
1387 | MDCRippleFoundation.prototype.getFgTranslationCoordinates_ = function () {
|
1388 | var _a = this.activationState_,
|
1389 | activationEvent = _a.activationEvent,
|
1390 | wasActivatedByPointer = _a.wasActivatedByPointer;
|
1391 | var startPoint;
|
1392 | if (wasActivatedByPointer) {
|
1393 | startPoint = util_1.getNormalizedEventCoords(activationEvent, this.adapter.getWindowPageOffset(), this.adapter.computeBoundingRect());
|
1394 | } else {
|
1395 | startPoint = {
|
1396 | x: this.frame_.width / 2,
|
1397 | y: this.frame_.height / 2
|
1398 | };
|
1399 | }
|
1400 |
|
1401 | startPoint = {
|
1402 | x: startPoint.x - this.initialSize_ / 2,
|
1403 | y: startPoint.y - this.initialSize_ / 2
|
1404 | };
|
1405 | var endPoint = {
|
1406 | x: this.frame_.width / 2 - this.initialSize_ / 2,
|
1407 | y: this.frame_.height / 2 - this.initialSize_ / 2
|
1408 | };
|
1409 | return { startPoint: startPoint, endPoint: endPoint };
|
1410 | };
|
1411 | MDCRippleFoundation.prototype.runDeactivationUXLogicIfReady_ = function () {
|
1412 | var _this = this;
|
1413 |
|
1414 |
|
1415 | var FG_DEACTIVATION = MDCRippleFoundation.cssClasses.FG_DEACTIVATION;
|
1416 | var _a = this.activationState_,
|
1417 | hasDeactivationUXRun = _a.hasDeactivationUXRun,
|
1418 | isActivated = _a.isActivated;
|
1419 | var activationHasEnded = hasDeactivationUXRun || !isActivated;
|
1420 | if (activationHasEnded && this.activationAnimationHasEnded_) {
|
1421 | this.rmBoundedActivationClasses_();
|
1422 | this.adapter.addClass(FG_DEACTIVATION);
|
1423 | this.fgDeactivationRemovalTimer_ = setTimeout(function () {
|
1424 | _this.adapter.removeClass(FG_DEACTIVATION);
|
1425 | }, constants_1.numbers.FG_DEACTIVATION_MS);
|
1426 | }
|
1427 | };
|
1428 | MDCRippleFoundation.prototype.rmBoundedActivationClasses_ = function () {
|
1429 | var FG_ACTIVATION = MDCRippleFoundation.cssClasses.FG_ACTIVATION;
|
1430 | this.adapter.removeClass(FG_ACTIVATION);
|
1431 | this.activationAnimationHasEnded_ = false;
|
1432 | this.adapter.computeBoundingRect();
|
1433 | };
|
1434 | MDCRippleFoundation.prototype.resetActivationState_ = function () {
|
1435 | var _this = this;
|
1436 | this.previousActivationEvent_ = this.activationState_.activationEvent;
|
1437 | this.activationState_ = this.defaultActivationState_();
|
1438 |
|
1439 |
|
1440 | setTimeout(function () {
|
1441 | return _this.previousActivationEvent_ = undefined;
|
1442 | }, MDCRippleFoundation.numbers.TAP_DELAY_MS);
|
1443 | };
|
1444 | MDCRippleFoundation.prototype.deactivate_ = function () {
|
1445 | var _this = this;
|
1446 | var activationState = this.activationState_;
|
1447 |
|
1448 | if (!activationState.isActivated) {
|
1449 | return;
|
1450 | }
|
1451 | var state = __assign({}, activationState);
|
1452 | if (activationState.isProgrammatic) {
|
1453 | requestAnimationFrame(function () {
|
1454 | return _this.animateDeactivation_(state);
|
1455 | });
|
1456 | this.resetActivationState_();
|
1457 | } else {
|
1458 | this.deregisterDeactivationHandlers_();
|
1459 | requestAnimationFrame(function () {
|
1460 | _this.activationState_.hasDeactivationUXRun = true;
|
1461 | _this.animateDeactivation_(state);
|
1462 | _this.resetActivationState_();
|
1463 | });
|
1464 | }
|
1465 | };
|
1466 | MDCRippleFoundation.prototype.animateDeactivation_ = function (_a) {
|
1467 | var wasActivatedByPointer = _a.wasActivatedByPointer,
|
1468 | wasElementMadeActive = _a.wasElementMadeActive;
|
1469 | if (wasActivatedByPointer || wasElementMadeActive) {
|
1470 | this.runDeactivationUXLogicIfReady_();
|
1471 | }
|
1472 | };
|
1473 | MDCRippleFoundation.prototype.layoutInternal_ = function () {
|
1474 | var _this = this;
|
1475 | this.frame_ = this.adapter.computeBoundingRect();
|
1476 | var maxDim = Math.max(this.frame_.height, this.frame_.width);
|
1477 |
|
1478 |
|
1479 |
|
1480 |
|
1481 |
|
1482 |
|
1483 | var getBoundedRadius = function getBoundedRadius() {
|
1484 | var hypotenuse = Math.sqrt(Math.pow(_this.frame_.width, 2) + Math.pow(_this.frame_.height, 2));
|
1485 | return hypotenuse + MDCRippleFoundation.numbers.PADDING;
|
1486 | };
|
1487 | this.maxRadius_ = this.adapter.isUnbounded() ? maxDim : getBoundedRadius();
|
1488 |
|
1489 | var initialSize = Math.floor(maxDim * MDCRippleFoundation.numbers.INITIAL_ORIGIN_SCALE);
|
1490 |
|
1491 | if (this.adapter.isUnbounded() && initialSize % 2 !== 0) {
|
1492 | this.initialSize_ = initialSize - 1;
|
1493 | } else {
|
1494 | this.initialSize_ = initialSize;
|
1495 | }
|
1496 | this.fgScale_ = "" + this.maxRadius_ / this.initialSize_;
|
1497 | this.updateLayoutCssVars_();
|
1498 | };
|
1499 | MDCRippleFoundation.prototype.updateLayoutCssVars_ = function () {
|
1500 | var _a = MDCRippleFoundation.strings,
|
1501 | VAR_FG_SIZE = _a.VAR_FG_SIZE,
|
1502 | VAR_LEFT = _a.VAR_LEFT,
|
1503 | VAR_TOP = _a.VAR_TOP,
|
1504 | VAR_FG_SCALE = _a.VAR_FG_SCALE;
|
1505 | this.adapter.updateCssVariable(VAR_FG_SIZE, this.initialSize_ + "px");
|
1506 | this.adapter.updateCssVariable(VAR_FG_SCALE, this.fgScale_);
|
1507 | if (this.adapter.isUnbounded()) {
|
1508 | this.unboundedCoords_ = {
|
1509 | left: Math.round(this.frame_.width / 2 - this.initialSize_ / 2),
|
1510 | top: Math.round(this.frame_.height / 2 - this.initialSize_ / 2)
|
1511 | };
|
1512 | this.adapter.updateCssVariable(VAR_LEFT, this.unboundedCoords_.left + "px");
|
1513 | this.adapter.updateCssVariable(VAR_TOP, this.unboundedCoords_.top + "px");
|
1514 | }
|
1515 | };
|
1516 | return MDCRippleFoundation;
|
1517 | }(foundation_1.MDCFoundation);
|
1518 | exports.MDCRippleFoundation = MDCRippleFoundation;
|
1519 |
|
1520 | exports.default = MDCRippleFoundation;
|
1521 |
|
1522 | }),
|
1523 |
|
1524 | "./packages/mdc-ripple/util.ts":
|
1525 |
|
1526 |
|
1527 |
|
1528 |
|
1529 | (function(module, exports, __webpack_require__) {
|
1530 |
|
1531 | "use strict";
|
1532 |
|
1533 |
|
1534 | Object.defineProperty(exports, "__esModule", { value: true });
|
1535 | exports.getNormalizedEventCoords = exports.supportsCssVariables = void 0;
|
1536 |
|
1537 |
|
1538 |
|
1539 |
|
1540 | var supportsCssVariables_;
|
1541 | function supportsCssVariables(windowObj, forceRefresh) {
|
1542 | if (forceRefresh === void 0) {
|
1543 | forceRefresh = false;
|
1544 | }
|
1545 | var CSS = windowObj.CSS;
|
1546 | var supportsCssVars = supportsCssVariables_;
|
1547 | if (typeof supportsCssVariables_ === 'boolean' && !forceRefresh) {
|
1548 | return supportsCssVariables_;
|
1549 | }
|
1550 | var supportsFunctionPresent = CSS && typeof CSS.supports === 'function';
|
1551 | if (!supportsFunctionPresent) {
|
1552 | return false;
|
1553 | }
|
1554 | var explicitlySupportsCssVars = CSS.supports('--css-vars', 'yes');
|
1555 |
|
1556 |
|
1557 | var weAreFeatureDetectingSafari10plus = CSS.supports('(--css-vars: yes)') && CSS.supports('color', '#00000000');
|
1558 | supportsCssVars = explicitlySupportsCssVars || weAreFeatureDetectingSafari10plus;
|
1559 | if (!forceRefresh) {
|
1560 | supportsCssVariables_ = supportsCssVars;
|
1561 | }
|
1562 | return supportsCssVars;
|
1563 | }
|
1564 | exports.supportsCssVariables = supportsCssVariables;
|
1565 | function getNormalizedEventCoords(evt, pageOffset, clientRect) {
|
1566 | if (!evt) {
|
1567 | return { x: 0, y: 0 };
|
1568 | }
|
1569 | var x = pageOffset.x,
|
1570 | y = pageOffset.y;
|
1571 | var documentX = x + clientRect.left;
|
1572 | var documentY = y + clientRect.top;
|
1573 | var normalizedX;
|
1574 | var normalizedY;
|
1575 |
|
1576 | if (evt.type === 'touchstart') {
|
1577 | var touchEvent = evt;
|
1578 | normalizedX = touchEvent.changedTouches[0].pageX - documentX;
|
1579 | normalizedY = touchEvent.changedTouches[0].pageY - documentY;
|
1580 | } else {
|
1581 | var mouseEvent = evt;
|
1582 | normalizedX = mouseEvent.pageX - documentX;
|
1583 | normalizedY = mouseEvent.pageY - documentY;
|
1584 | }
|
1585 | return { x: normalizedX, y: normalizedY };
|
1586 | }
|
1587 | exports.getNormalizedEventCoords = getNormalizedEventCoords;
|
1588 |
|
1589 | }),
|
1590 |
|
1591 | "./packages/mdc-slider/adapter.ts":
|
1592 |
|
1593 |
|
1594 |
|
1595 |
|
1596 | (function(module, exports, __webpack_require__) {
|
1597 |
|
1598 | "use strict";
|
1599 |
|
1600 |
|
1601 |
|
1602 |
|
1603 |
|
1604 |
|
1605 |
|
1606 |
|
1607 |
|
1608 |
|
1609 |
|
1610 |
|
1611 |
|
1612 |
|
1613 |
|
1614 |
|
1615 |
|
1616 |
|
1617 |
|
1618 |
|
1619 |
|
1620 |
|
1621 |
|
1622 |
|
1623 | Object.defineProperty(exports, "__esModule", { value: true });
|
1624 |
|
1625 | }),
|
1626 |
|
1627 | "./packages/mdc-slider/component.ts":
|
1628 |
|
1629 |
|
1630 |
|
1631 |
|
1632 | (function(module, exports, __webpack_require__) {
|
1633 |
|
1634 | "use strict";
|
1635 |
|
1636 |
|
1637 |
|
1638 |
|
1639 |
|
1640 |
|
1641 |
|
1642 |
|
1643 |
|
1644 |
|
1645 |
|
1646 |
|
1647 |
|
1648 |
|
1649 |
|
1650 |
|
1651 |
|
1652 |
|
1653 |
|
1654 |
|
1655 |
|
1656 |
|
1657 |
|
1658 |
|
1659 | var __extends = this && this.__extends || function () {
|
1660 | var _extendStatics = function extendStatics(d, b) {
|
1661 | _extendStatics = Object.setPrototypeOf || { __proto__: [] } instanceof Array && function (d, b) {
|
1662 | d.__proto__ = b;
|
1663 | } || function (d, b) {
|
1664 | for (var p in b) {
|
1665 | if (Object.prototype.hasOwnProperty.call(b, p)) d[p] = b[p];
|
1666 | }
|
1667 | };
|
1668 | return _extendStatics(d, b);
|
1669 | };
|
1670 | return function (d, b) {
|
1671 | if (typeof b !== "function" && b !== null) throw new TypeError("Class extends value " + String(b) + " is not a constructor or null");
|
1672 | _extendStatics(d, b);
|
1673 | function __() {
|
1674 | this.constructor = d;
|
1675 | }
|
1676 | d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
|
1677 | };
|
1678 | }();
|
1679 | var __assign = this && this.__assign || function () {
|
1680 | __assign = Object.assign || function (t) {
|
1681 | for (var s, i = 1, n = arguments.length; i < n; i++) {
|
1682 | s = arguments[i];
|
1683 | for (var p in s) {
|
1684 | if (Object.prototype.hasOwnProperty.call(s, p)) t[p] = s[p];
|
1685 | }
|
1686 | }
|
1687 | return t;
|
1688 | };
|
1689 | return __assign.apply(this, arguments);
|
1690 | };
|
1691 | Object.defineProperty(exports, "__esModule", { value: true });
|
1692 | exports.MDCSlider = void 0;
|
1693 | var component_1 = __webpack_require__( "./packages/mdc-base/component.ts");
|
1694 | var events_1 = __webpack_require__( "./packages/mdc-dom/events.ts");
|
1695 | var ponyfill_1 = __webpack_require__( "./packages/mdc-dom/ponyfill.ts");
|
1696 | var component_2 = __webpack_require__( "./packages/mdc-ripple/component.ts");
|
1697 | var foundation_1 = __webpack_require__( "./packages/mdc-ripple/foundation.ts");
|
1698 | var constants_1 = __webpack_require__( "./packages/mdc-slider/constants.ts");
|
1699 | var foundation_2 = __webpack_require__( "./packages/mdc-slider/foundation.ts");
|
1700 | var types_1 = __webpack_require__( "./packages/mdc-slider/types.ts");
|
1701 |
|
1702 | var MDCSlider = function (_super) {
|
1703 | __extends(MDCSlider, _super);
|
1704 | function MDCSlider() {
|
1705 | var _this = _super !== null && _super.apply(this, arguments) || this;
|
1706 | _this.skipInitialUIUpdate = false;
|
1707 |
|
1708 |
|
1709 | _this.valueToAriaValueTextFn = null;
|
1710 | return _this;
|
1711 | }
|
1712 | MDCSlider.attachTo = function (root, options) {
|
1713 | if (options === void 0) {
|
1714 | options = {};
|
1715 | }
|
1716 | return new MDCSlider(root, undefined, options);
|
1717 | };
|
1718 | MDCSlider.prototype.getDefaultFoundation = function () {
|
1719 | var _this = this;
|
1720 |
|
1721 |
|
1722 | var adapter = {
|
1723 | hasClass: function hasClass(className) {
|
1724 | return _this.root.classList.contains(className);
|
1725 | },
|
1726 | addClass: function addClass(className) {
|
1727 | _this.root.classList.add(className);
|
1728 | },
|
1729 | removeClass: function removeClass(className) {
|
1730 | _this.root.classList.remove(className);
|
1731 | },
|
1732 | addThumbClass: function addThumbClass(className, thumb) {
|
1733 | _this.getThumbEl(thumb).classList.add(className);
|
1734 | },
|
1735 | removeThumbClass: function removeThumbClass(className, thumb) {
|
1736 | _this.getThumbEl(thumb).classList.remove(className);
|
1737 | },
|
1738 | getAttribute: function getAttribute(attribute) {
|
1739 | return _this.root.getAttribute(attribute);
|
1740 | },
|
1741 | getInputValue: function getInputValue(thumb) {
|
1742 | return _this.getInput(thumb).value;
|
1743 | },
|
1744 | setInputValue: function setInputValue(value, thumb) {
|
1745 | _this.getInput(thumb).value = value;
|
1746 | },
|
1747 | getInputAttribute: function getInputAttribute(attribute, thumb) {
|
1748 | return _this.getInput(thumb).getAttribute(attribute);
|
1749 | },
|
1750 | setInputAttribute: function setInputAttribute(attribute, value, thumb) {
|
1751 | _this.getInput(thumb).setAttribute(attribute, value);
|
1752 | },
|
1753 | removeInputAttribute: function removeInputAttribute(attribute, thumb) {
|
1754 | _this.getInput(thumb).removeAttribute(attribute);
|
1755 | },
|
1756 | focusInput: function focusInput(thumb) {
|
1757 | _this.getInput(thumb).focus();
|
1758 | },
|
1759 | isInputFocused: function isInputFocused(thumb) {
|
1760 | return _this.getInput(thumb) === document.activeElement;
|
1761 | },
|
1762 | getThumbKnobWidth: function getThumbKnobWidth(thumb) {
|
1763 | return _this.getThumbEl(thumb).querySelector("." + constants_1.cssClasses.THUMB_KNOB).getBoundingClientRect().width;
|
1764 | },
|
1765 | getThumbBoundingClientRect: function getThumbBoundingClientRect(thumb) {
|
1766 | return _this.getThumbEl(thumb).getBoundingClientRect();
|
1767 | },
|
1768 | getBoundingClientRect: function getBoundingClientRect() {
|
1769 | return _this.root.getBoundingClientRect();
|
1770 | },
|
1771 | isRTL: function isRTL() {
|
1772 | return getComputedStyle(_this.root).direction === 'rtl';
|
1773 | },
|
1774 | setThumbStyleProperty: function setThumbStyleProperty(propertyName, value, thumb) {
|
1775 | _this.getThumbEl(thumb).style.setProperty(propertyName, value);
|
1776 | },
|
1777 | removeThumbStyleProperty: function removeThumbStyleProperty(propertyName, thumb) {
|
1778 | _this.getThumbEl(thumb).style.removeProperty(propertyName);
|
1779 | },
|
1780 | setTrackActiveStyleProperty: function setTrackActiveStyleProperty(propertyName, value) {
|
1781 | _this.trackActive.style.setProperty(propertyName, value);
|
1782 | },
|
1783 | removeTrackActiveStyleProperty: function removeTrackActiveStyleProperty(propertyName) {
|
1784 | _this.trackActive.style.removeProperty(propertyName);
|
1785 | },
|
1786 | setValueIndicatorText: function setValueIndicatorText(value, thumb) {
|
1787 | var valueIndicatorEl = _this.getThumbEl(thumb).querySelector("." + constants_1.cssClasses.VALUE_INDICATOR_TEXT);
|
1788 | valueIndicatorEl.textContent = String(value);
|
1789 | },
|
1790 | getValueToAriaValueTextFn: function getValueToAriaValueTextFn() {
|
1791 | return _this.valueToAriaValueTextFn;
|
1792 | },
|
1793 | updateTickMarks: function updateTickMarks(tickMarks) {
|
1794 | var tickMarksContainer = _this.root.querySelector("." + constants_1.cssClasses.TICK_MARKS_CONTAINER);
|
1795 | if (!tickMarksContainer) {
|
1796 | tickMarksContainer = document.createElement('div');
|
1797 | tickMarksContainer.classList.add(constants_1.cssClasses.TICK_MARKS_CONTAINER);
|
1798 | var track = _this.root.querySelector("." + constants_1.cssClasses.TRACK);
|
1799 | track.appendChild(tickMarksContainer);
|
1800 | }
|
1801 | if (tickMarks.length !== tickMarksContainer.children.length) {
|
1802 | tickMarksContainer.innerHTML = '';
|
1803 | _this.addTickMarks(tickMarksContainer, tickMarks);
|
1804 | } else {
|
1805 | _this.updateTickMarks(tickMarksContainer, tickMarks);
|
1806 | }
|
1807 | },
|
1808 | setPointerCapture: function setPointerCapture(pointerId) {
|
1809 | _this.root.setPointerCapture(pointerId);
|
1810 | },
|
1811 | emitChangeEvent: function emitChangeEvent(value, thumb) {
|
1812 | _this.emit(constants_1.events.CHANGE, { value: value, thumb: thumb });
|
1813 | },
|
1814 | emitInputEvent: function emitInputEvent(value, thumb) {
|
1815 | _this.emit(constants_1.events.INPUT, { value: value, thumb: thumb });
|
1816 | },
|
1817 | emitDragStartEvent: function emitDragStartEvent(_, thumb) {
|
1818 |
|
1819 |
|
1820 | _this.getRipple(thumb).activate();
|
1821 | },
|
1822 | emitDragEndEvent: function emitDragEndEvent(_, thumb) {
|
1823 |
|
1824 |
|
1825 | _this.getRipple(thumb).deactivate();
|
1826 | },
|
1827 | registerEventHandler: function registerEventHandler(evtType, handler) {
|
1828 | _this.listen(evtType, handler);
|
1829 | },
|
1830 | deregisterEventHandler: function deregisterEventHandler(evtType, handler) {
|
1831 | _this.unlisten(evtType, handler);
|
1832 | },
|
1833 | registerThumbEventHandler: function registerThumbEventHandler(thumb, evtType, handler) {
|
1834 | _this.getThumbEl(thumb).addEventListener(evtType, handler);
|
1835 | },
|
1836 | deregisterThumbEventHandler: function deregisterThumbEventHandler(thumb, evtType, handler) {
|
1837 | _this.getThumbEl(thumb).removeEventListener(evtType, handler);
|
1838 | },
|
1839 | registerInputEventHandler: function registerInputEventHandler(thumb, evtType, handler) {
|
1840 | _this.getInput(thumb).addEventListener(evtType, handler);
|
1841 | },
|
1842 | deregisterInputEventHandler: function deregisterInputEventHandler(thumb, evtType, handler) {
|
1843 | _this.getInput(thumb).removeEventListener(evtType, handler);
|
1844 | },
|
1845 | registerBodyEventHandler: function registerBodyEventHandler(evtType, handler) {
|
1846 | document.body.addEventListener(evtType, handler);
|
1847 | },
|
1848 | deregisterBodyEventHandler: function deregisterBodyEventHandler(evtType, handler) {
|
1849 | document.body.removeEventListener(evtType, handler);
|
1850 | },
|
1851 | registerWindowEventHandler: function registerWindowEventHandler(evtType, handler) {
|
1852 | window.addEventListener(evtType, handler);
|
1853 | },
|
1854 | deregisterWindowEventHandler: function deregisterWindowEventHandler(evtType, handler) {
|
1855 | window.removeEventListener(evtType, handler);
|
1856 | }
|
1857 | };
|
1858 | return new foundation_2.MDCSliderFoundation(adapter);
|
1859 | };
|
1860 | |
1861 |
|
1862 |
|
1863 |
|
1864 |
|
1865 |
|
1866 | MDCSlider.prototype.initialize = function (_a) {
|
1867 | var _b = _a === void 0 ? {} : _a,
|
1868 | skipInitialUIUpdate = _b.skipInitialUIUpdate;
|
1869 | this.inputs = [].slice.call(this.root.querySelectorAll("." + constants_1.cssClasses.INPUT));
|
1870 | this.thumbs = [].slice.call(this.root.querySelectorAll("." + constants_1.cssClasses.THUMB));
|
1871 | this.trackActive = this.root.querySelector("." + constants_1.cssClasses.TRACK_ACTIVE);
|
1872 | this.ripples = this.createRipples();
|
1873 | if (skipInitialUIUpdate) {
|
1874 | this.skipInitialUIUpdate = true;
|
1875 | }
|
1876 | };
|
1877 | MDCSlider.prototype.initialSyncWithDOM = function () {
|
1878 | this.foundation.layout({ skipUpdateUI: this.skipInitialUIUpdate });
|
1879 | };
|
1880 |
|
1881 | MDCSlider.prototype.layout = function () {
|
1882 | this.foundation.layout();
|
1883 | };
|
1884 | MDCSlider.prototype.getValueStart = function () {
|
1885 | return this.foundation.getValueStart();
|
1886 | };
|
1887 | MDCSlider.prototype.setValueStart = function (valueStart) {
|
1888 | this.foundation.setValueStart(valueStart);
|
1889 | };
|
1890 | MDCSlider.prototype.getValue = function () {
|
1891 | return this.foundation.getValue();
|
1892 | };
|
1893 | MDCSlider.prototype.setValue = function (value) {
|
1894 | this.foundation.setValue(value);
|
1895 | };
|
1896 |
|
1897 | MDCSlider.prototype.getDisabled = function () {
|
1898 | return this.foundation.getDisabled();
|
1899 | };
|
1900 |
|
1901 | MDCSlider.prototype.setDisabled = function (disabled) {
|
1902 | this.foundation.setDisabled(disabled);
|
1903 | };
|
1904 | |
1905 |
|
1906 |
|
1907 |
|
1908 | MDCSlider.prototype.setValueToAriaValueTextFn = function (mapFn) {
|
1909 | this.valueToAriaValueTextFn = mapFn;
|
1910 | };
|
1911 | MDCSlider.prototype.getThumbEl = function (thumb) {
|
1912 | return thumb === types_1.Thumb.END ? this.thumbs[this.thumbs.length - 1] : this.thumbs[0];
|
1913 | };
|
1914 | MDCSlider.prototype.getInput = function (thumb) {
|
1915 | return thumb === types_1.Thumb.END ? this.inputs[this.inputs.length - 1] : this.inputs[0];
|
1916 | };
|
1917 | MDCSlider.prototype.getRipple = function (thumb) {
|
1918 | return thumb === types_1.Thumb.END ? this.ripples[this.ripples.length - 1] : this.ripples[0];
|
1919 | };
|
1920 |
|
1921 | MDCSlider.prototype.addTickMarks = function (tickMarkContainer, tickMarks) {
|
1922 | var fragment = document.createDocumentFragment();
|
1923 | for (var i = 0; i < tickMarks.length; i++) {
|
1924 | var div = document.createElement('div');
|
1925 | var tickMarkClass = tickMarks[i] === types_1.TickMark.ACTIVE ? constants_1.cssClasses.TICK_MARK_ACTIVE : constants_1.cssClasses.TICK_MARK_INACTIVE;
|
1926 | div.classList.add(tickMarkClass);
|
1927 | fragment.appendChild(div);
|
1928 | }
|
1929 | tickMarkContainer.appendChild(fragment);
|
1930 | };
|
1931 |
|
1932 | MDCSlider.prototype.updateTickMarks = function (tickMarkContainer, tickMarks) {
|
1933 | var tickMarkEls = Array.from(tickMarkContainer.children);
|
1934 | for (var i = 0; i < tickMarkEls.length; i++) {
|
1935 | if (tickMarks[i] === types_1.TickMark.ACTIVE) {
|
1936 | tickMarkEls[i].classList.add(constants_1.cssClasses.TICK_MARK_ACTIVE);
|
1937 | tickMarkEls[i].classList.remove(constants_1.cssClasses.TICK_MARK_INACTIVE);
|
1938 | } else {
|
1939 | tickMarkEls[i].classList.add(constants_1.cssClasses.TICK_MARK_INACTIVE);
|
1940 | tickMarkEls[i].classList.remove(constants_1.cssClasses.TICK_MARK_ACTIVE);
|
1941 | }
|
1942 | }
|
1943 | };
|
1944 |
|
1945 | MDCSlider.prototype.createRipples = function () {
|
1946 | var ripples = [];
|
1947 | var rippleSurfaces = [].slice.call(this.root.querySelectorAll("." + constants_1.cssClasses.THUMB));
|
1948 | var _loop_1 = function _loop_1(i) {
|
1949 | var rippleSurface = rippleSurfaces[i];
|
1950 |
|
1951 |
|
1952 | var input = this_1.inputs[i];
|
1953 | var adapter = __assign(__assign({}, component_2.MDCRipple.createAdapter(this_1)), { addClass: function addClass(className) {
|
1954 | rippleSurface.classList.add(className);
|
1955 | }, computeBoundingRect: function computeBoundingRect() {
|
1956 | return rippleSurface.getBoundingClientRect();
|
1957 | }, deregisterInteractionHandler: function deregisterInteractionHandler(evtType, handler) {
|
1958 | input.removeEventListener(evtType, handler);
|
1959 | }, isSurfaceActive: function isSurfaceActive() {
|
1960 | return ponyfill_1.matches(input, ':active');
|
1961 | }, isUnbounded: function isUnbounded() {
|
1962 | return true;
|
1963 | }, registerInteractionHandler: function registerInteractionHandler(evtType, handler) {
|
1964 | input.addEventListener(evtType, handler, events_1.applyPassive());
|
1965 | }, removeClass: function removeClass(className) {
|
1966 | rippleSurface.classList.remove(className);
|
1967 | }, updateCssVariable: function updateCssVariable(varName, value) {
|
1968 | rippleSurface.style.setProperty(varName, value);
|
1969 | } });
|
1970 | var ripple = new component_2.MDCRipple(rippleSurface, new foundation_1.MDCRippleFoundation(adapter));
|
1971 | ripple.unbounded = true;
|
1972 | ripples.push(ripple);
|
1973 | };
|
1974 | var this_1 = this;
|
1975 | for (var i = 0; i < rippleSurfaces.length; i++) {
|
1976 | _loop_1(i);
|
1977 | }
|
1978 | return ripples;
|
1979 | };
|
1980 | return MDCSlider;
|
1981 | }(component_1.MDCComponent);
|
1982 | exports.MDCSlider = MDCSlider;
|
1983 |
|
1984 | }),
|
1985 |
|
1986 | "./packages/mdc-slider/constants.ts":
|
1987 |
|
1988 |
|
1989 |
|
1990 |
|
1991 | (function(module, exports, __webpack_require__) {
|
1992 |
|
1993 | "use strict";
|
1994 |
|
1995 |
|
1996 |
|
1997 |
|
1998 |
|
1999 |
|
2000 |
|
2001 |
|
2002 |
|
2003 |
|
2004 |
|
2005 |
|
2006 |
|
2007 |
|
2008 |
|
2009 |
|
2010 |
|
2011 |
|
2012 |
|
2013 |
|
2014 |
|
2015 |
|
2016 |
|
2017 |
|
2018 | Object.defineProperty(exports, "__esModule", { value: true });
|
2019 | exports.events = exports.attributes = exports.numbers = exports.cssClasses = void 0;
|
2020 |
|
2021 | exports.cssClasses = {
|
2022 | DISABLED: 'mdc-slider--disabled',
|
2023 | DISCRETE: 'mdc-slider--discrete',
|
2024 | INPUT: 'mdc-slider__input',
|
2025 | RANGE: 'mdc-slider--range',
|
2026 | THUMB: 'mdc-slider__thumb',
|
2027 |
|
2028 | THUMB_FOCUSED: 'mdc-slider__thumb--focused',
|
2029 | THUMB_KNOB: 'mdc-slider__thumb-knob',
|
2030 |
|
2031 | THUMB_TOP: 'mdc-slider__thumb--top',
|
2032 | THUMB_WITH_INDICATOR: 'mdc-slider__thumb--with-indicator',
|
2033 | TICK_MARKS: 'mdc-slider--tick-marks',
|
2034 | TICK_MARKS_CONTAINER: 'mdc-slider__tick-marks',
|
2035 | TICK_MARK_ACTIVE: 'mdc-slider__tick-mark--active',
|
2036 | TICK_MARK_INACTIVE: 'mdc-slider__tick-mark--inactive',
|
2037 | TRACK: 'mdc-slider__track',
|
2038 |
|
2039 | TRACK_ACTIVE: 'mdc-slider__track--active_fill',
|
2040 | VALUE_INDICATOR_TEXT: 'mdc-slider__value-indicator-text'
|
2041 | };
|
2042 |
|
2043 | exports.numbers = {
|
2044 |
|
2045 | STEP_SIZE: 1,
|
2046 |
|
2047 |
|
2048 |
|
2049 |
|
2050 | THUMB_UPDATE_MIN_PX: 5
|
2051 | };
|
2052 |
|
2053 | exports.attributes = {
|
2054 | ARIA_VALUETEXT: 'aria-valuetext',
|
2055 | INPUT_DISABLED: 'disabled',
|
2056 | INPUT_MIN: 'min',
|
2057 | INPUT_MAX: 'max',
|
2058 | INPUT_VALUE: 'value',
|
2059 | INPUT_STEP: 'step'
|
2060 | };
|
2061 |
|
2062 | exports.events = {
|
2063 | CHANGE: 'MDCSlider:change',
|
2064 | INPUT: 'MDCSlider:input'
|
2065 | };
|
2066 |
|
2067 | }),
|
2068 |
|
2069 | "./packages/mdc-slider/foundation.ts":
|
2070 |
|
2071 |
|
2072 |
|
2073 |
|
2074 | (function(module, exports, __webpack_require__) {
|
2075 |
|
2076 | "use strict";
|
2077 |
|
2078 |
|
2079 |
|
2080 |
|
2081 |
|
2082 |
|
2083 |
|
2084 |
|
2085 |
|
2086 |
|
2087 |
|
2088 |
|
2089 |
|
2090 |
|
2091 |
|
2092 |
|
2093 |
|
2094 |
|
2095 |
|
2096 |
|
2097 |
|
2098 |
|
2099 |
|
2100 |
|
2101 | var __extends = this && this.__extends || function () {
|
2102 | var _extendStatics = function extendStatics(d, b) {
|
2103 | _extendStatics = Object.setPrototypeOf || { __proto__: [] } instanceof Array && function (d, b) {
|
2104 | d.__proto__ = b;
|
2105 | } || function (d, b) {
|
2106 | for (var p in b) {
|
2107 | if (Object.prototype.hasOwnProperty.call(b, p)) d[p] = b[p];
|
2108 | }
|
2109 | };
|
2110 | return _extendStatics(d, b);
|
2111 | };
|
2112 | return function (d, b) {
|
2113 | if (typeof b !== "function" && b !== null) throw new TypeError("Class extends value " + String(b) + " is not a constructor or null");
|
2114 | _extendStatics(d, b);
|
2115 | function __() {
|
2116 | this.constructor = d;
|
2117 | }
|
2118 | d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
|
2119 | };
|
2120 | }();
|
2121 | var __assign = this && this.__assign || function () {
|
2122 | __assign = Object.assign || function (t) {
|
2123 | for (var s, i = 1, n = arguments.length; i < n; i++) {
|
2124 | s = arguments[i];
|
2125 | for (var p in s) {
|
2126 | if (Object.prototype.hasOwnProperty.call(s, p)) t[p] = s[p];
|
2127 | }
|
2128 | }
|
2129 | return t;
|
2130 | };
|
2131 | return __assign.apply(this, arguments);
|
2132 | };
|
2133 | Object.defineProperty(exports, "__esModule", { value: true });
|
2134 | exports.MDCSliderFoundation = void 0;
|
2135 | var animationframe_1 = __webpack_require__( "./packages/mdc-animation/animationframe.ts");
|
2136 | var util_1 = __webpack_require__( "./packages/mdc-animation/util.ts");
|
2137 | var foundation_1 = __webpack_require__( "./packages/mdc-base/foundation.ts");
|
2138 | var constants_1 = __webpack_require__( "./packages/mdc-slider/constants.ts");
|
2139 | var types_1 = __webpack_require__( "./packages/mdc-slider/types.ts");
|
2140 | var AnimationKeys;
|
2141 | (function (AnimationKeys) {
|
2142 | AnimationKeys["SLIDER_UPDATE"] = "slider_update";
|
2143 | })(AnimationKeys || (AnimationKeys = {}));
|
2144 |
|
2145 | var HAS_WINDOW = typeof window !== 'undefined';
|
2146 |
|
2147 |
|
2148 |
|
2149 |
|
2150 |
|
2151 |
|
2152 | var MDCSliderFoundation = function (_super) {
|
2153 | __extends(MDCSliderFoundation, _super);
|
2154 | function MDCSliderFoundation(adapter) {
|
2155 | var _this = _super.call(this, __assign(__assign({}, MDCSliderFoundation.defaultAdapter), adapter)) || this;
|
2156 |
|
2157 |
|
2158 | _this.initialStylesRemoved = false;
|
2159 | _this.isDisabled = false;
|
2160 | _this.isDiscrete = false;
|
2161 | _this.step = constants_1.numbers.STEP_SIZE;
|
2162 | _this.hasTickMarks = false;
|
2163 |
|
2164 | _this.isRange = false;
|
2165 |
|
2166 |
|
2167 | _this.thumb = null;
|
2168 |
|
2169 |
|
2170 |
|
2171 | _this.downEventClientX = null;
|
2172 |
|
2173 | _this.startThumbKnobWidth = 0;
|
2174 |
|
2175 | _this.endThumbKnobWidth = 0;
|
2176 | _this.animFrame = new animationframe_1.AnimationFrame();
|
2177 | return _this;
|
2178 | }
|
2179 | Object.defineProperty(MDCSliderFoundation, "defaultAdapter", {
|
2180 | get: function get() {
|
2181 |
|
2182 |
|
2183 | return {
|
2184 | hasClass: function hasClass() {
|
2185 | return false;
|
2186 | },
|
2187 | addClass: function addClass() {
|
2188 | return undefined;
|
2189 | },
|
2190 | removeClass: function removeClass() {
|
2191 | return undefined;
|
2192 | },
|
2193 | addThumbClass: function addThumbClass() {
|
2194 | return undefined;
|
2195 | },
|
2196 | removeThumbClass: function removeThumbClass() {
|
2197 | return undefined;
|
2198 | },
|
2199 | getAttribute: function getAttribute() {
|
2200 | return null;
|
2201 | },
|
2202 | getInputValue: function getInputValue() {
|
2203 | return '';
|
2204 | },
|
2205 | setInputValue: function setInputValue() {
|
2206 | return undefined;
|
2207 | },
|
2208 | getInputAttribute: function getInputAttribute() {
|
2209 | return null;
|
2210 | },
|
2211 | setInputAttribute: function setInputAttribute() {
|
2212 | return null;
|
2213 | },
|
2214 | removeInputAttribute: function removeInputAttribute() {
|
2215 | return null;
|
2216 | },
|
2217 | focusInput: function focusInput() {
|
2218 | return undefined;
|
2219 | },
|
2220 | isInputFocused: function isInputFocused() {
|
2221 | return false;
|
2222 | },
|
2223 | getThumbKnobWidth: function getThumbKnobWidth() {
|
2224 | return 0;
|
2225 | },
|
2226 | getThumbBoundingClientRect: function getThumbBoundingClientRect() {
|
2227 | return { top: 0, right: 0, bottom: 0, left: 0, width: 0, height: 0 };
|
2228 | },
|
2229 | getBoundingClientRect: function getBoundingClientRect() {
|
2230 | return { top: 0, right: 0, bottom: 0, left: 0, width: 0, height: 0 };
|
2231 | },
|
2232 | isRTL: function isRTL() {
|
2233 | return false;
|
2234 | },
|
2235 | setThumbStyleProperty: function setThumbStyleProperty() {
|
2236 | return undefined;
|
2237 | },
|
2238 | removeThumbStyleProperty: function removeThumbStyleProperty() {
|
2239 | return undefined;
|
2240 | },
|
2241 | setTrackActiveStyleProperty: function setTrackActiveStyleProperty() {
|
2242 | return undefined;
|
2243 | },
|
2244 | removeTrackActiveStyleProperty: function removeTrackActiveStyleProperty() {
|
2245 | return undefined;
|
2246 | },
|
2247 | setValueIndicatorText: function setValueIndicatorText() {
|
2248 | return undefined;
|
2249 | },
|
2250 | getValueToAriaValueTextFn: function getValueToAriaValueTextFn() {
|
2251 | return null;
|
2252 | },
|
2253 | updateTickMarks: function updateTickMarks() {
|
2254 | return undefined;
|
2255 | },
|
2256 | setPointerCapture: function setPointerCapture() {
|
2257 | return undefined;
|
2258 | },
|
2259 | emitChangeEvent: function emitChangeEvent() {
|
2260 | return undefined;
|
2261 | },
|
2262 | emitInputEvent: function emitInputEvent() {
|
2263 | return undefined;
|
2264 | },
|
2265 | emitDragStartEvent: function emitDragStartEvent() {
|
2266 | return undefined;
|
2267 | },
|
2268 | emitDragEndEvent: function emitDragEndEvent() {
|
2269 | return undefined;
|
2270 | },
|
2271 | registerEventHandler: function registerEventHandler() {
|
2272 | return undefined;
|
2273 | },
|
2274 | deregisterEventHandler: function deregisterEventHandler() {
|
2275 | return undefined;
|
2276 | },
|
2277 | registerThumbEventHandler: function registerThumbEventHandler() {
|
2278 | return undefined;
|
2279 | },
|
2280 | deregisterThumbEventHandler: function deregisterThumbEventHandler() {
|
2281 | return undefined;
|
2282 | },
|
2283 | registerInputEventHandler: function registerInputEventHandler() {
|
2284 | return undefined;
|
2285 | },
|
2286 | deregisterInputEventHandler: function deregisterInputEventHandler() {
|
2287 | return undefined;
|
2288 | },
|
2289 | registerBodyEventHandler: function registerBodyEventHandler() {
|
2290 | return undefined;
|
2291 | },
|
2292 | deregisterBodyEventHandler: function deregisterBodyEventHandler() {
|
2293 | return undefined;
|
2294 | },
|
2295 | registerWindowEventHandler: function registerWindowEventHandler() {
|
2296 | return undefined;
|
2297 | },
|
2298 | deregisterWindowEventHandler: function deregisterWindowEventHandler() {
|
2299 | return undefined;
|
2300 | }
|
2301 | };
|
2302 |
|
2303 | },
|
2304 | enumerable: false,
|
2305 | configurable: true
|
2306 | });
|
2307 | MDCSliderFoundation.prototype.init = function () {
|
2308 | var _this = this;
|
2309 | this.isDisabled = this.adapter.hasClass(constants_1.cssClasses.DISABLED);
|
2310 | this.isDiscrete = this.adapter.hasClass(constants_1.cssClasses.DISCRETE);
|
2311 | this.hasTickMarks = this.adapter.hasClass(constants_1.cssClasses.TICK_MARKS);
|
2312 | this.isRange = this.adapter.hasClass(constants_1.cssClasses.RANGE);
|
2313 | var min = this.convertAttributeValueToNumber(this.adapter.getInputAttribute(constants_1.attributes.INPUT_MIN, this.isRange ? types_1.Thumb.START : types_1.Thumb.END), constants_1.attributes.INPUT_MIN);
|
2314 | var max = this.convertAttributeValueToNumber(this.adapter.getInputAttribute(constants_1.attributes.INPUT_MAX, types_1.Thumb.END), constants_1.attributes.INPUT_MAX);
|
2315 | var value = this.convertAttributeValueToNumber(this.adapter.getInputAttribute(constants_1.attributes.INPUT_VALUE, types_1.Thumb.END), constants_1.attributes.INPUT_VALUE);
|
2316 | var valueStart = this.isRange ? this.convertAttributeValueToNumber(this.adapter.getInputAttribute(constants_1.attributes.INPUT_VALUE, types_1.Thumb.START), constants_1.attributes.INPUT_VALUE) : min;
|
2317 | var stepAttr = this.adapter.getInputAttribute(constants_1.attributes.INPUT_STEP, types_1.Thumb.END);
|
2318 | var step = stepAttr ? this.convertAttributeValueToNumber(stepAttr, constants_1.attributes.INPUT_STEP) : this.step;
|
2319 | this.validateProperties({ min: min, max: max, value: value, valueStart: valueStart, step: step });
|
2320 | this.min = min;
|
2321 | this.max = max;
|
2322 | this.value = value;
|
2323 | this.valueStart = valueStart;
|
2324 | this.step = step;
|
2325 | this.numDecimalPlaces = getNumDecimalPlaces(this.step);
|
2326 | this.valueBeforeDownEvent = value;
|
2327 | this.valueStartBeforeDownEvent = valueStart;
|
2328 | this.mousedownOrTouchstartListener = this.handleMousedownOrTouchstart.bind(this);
|
2329 | this.moveListener = this.handleMove.bind(this);
|
2330 | this.pointerdownListener = this.handlePointerdown.bind(this);
|
2331 | this.pointerupListener = this.handlePointerup.bind(this);
|
2332 | this.thumbMouseenterListener = this.handleThumbMouseenter.bind(this);
|
2333 | this.thumbMouseleaveListener = this.handleThumbMouseleave.bind(this);
|
2334 | this.inputStartChangeListener = function () {
|
2335 | _this.handleInputChange(types_1.Thumb.START);
|
2336 | };
|
2337 | this.inputEndChangeListener = function () {
|
2338 | _this.handleInputChange(types_1.Thumb.END);
|
2339 | };
|
2340 | this.inputStartFocusListener = function () {
|
2341 | _this.handleInputFocus(types_1.Thumb.START);
|
2342 | };
|
2343 | this.inputEndFocusListener = function () {
|
2344 | _this.handleInputFocus(types_1.Thumb.END);
|
2345 | };
|
2346 | this.inputStartBlurListener = function () {
|
2347 | _this.handleInputBlur(types_1.Thumb.START);
|
2348 | };
|
2349 | this.inputEndBlurListener = function () {
|
2350 | _this.handleInputBlur(types_1.Thumb.END);
|
2351 | };
|
2352 | this.resizeListener = this.handleResize.bind(this);
|
2353 | this.registerEventHandlers();
|
2354 | };
|
2355 | MDCSliderFoundation.prototype.destroy = function () {
|
2356 | this.deregisterEventHandlers();
|
2357 | };
|
2358 | MDCSliderFoundation.prototype.getMin = function () {
|
2359 | return this.min;
|
2360 | };
|
2361 | MDCSliderFoundation.prototype.getMax = function () {
|
2362 | return this.max;
|
2363 | };
|
2364 | |
2365 |
|
2366 |
|
2367 |
|
2368 | MDCSliderFoundation.prototype.getValue = function () {
|
2369 | return this.value;
|
2370 | };
|
2371 | |
2372 |
|
2373 |
|
2374 |
|
2375 | MDCSliderFoundation.prototype.setValue = function (value) {
|
2376 | if (this.isRange && value < this.valueStart) {
|
2377 | throw new Error("end thumb value (" + value + ") must be >= start thumb " + ("value (" + this.valueStart + ")"));
|
2378 | }
|
2379 | this.updateValue(value, types_1.Thumb.END);
|
2380 | };
|
2381 | |
2382 |
|
2383 |
|
2384 |
|
2385 | MDCSliderFoundation.prototype.getValueStart = function () {
|
2386 | if (!this.isRange) {
|
2387 | throw new Error('`valueStart` is only applicable for range sliders.');
|
2388 | }
|
2389 | return this.valueStart;
|
2390 | };
|
2391 | |
2392 |
|
2393 |
|
2394 | MDCSliderFoundation.prototype.setValueStart = function (valueStart) {
|
2395 | if (!this.isRange) {
|
2396 | throw new Error('`valueStart` is only applicable for range sliders.');
|
2397 | }
|
2398 | if (this.isRange && valueStart > this.value) {
|
2399 | throw new Error("start thumb value (" + valueStart + ") must be <= end thumb " + ("value (" + this.value + ")"));
|
2400 | }
|
2401 | this.updateValue(valueStart, types_1.Thumb.START);
|
2402 | };
|
2403 | MDCSliderFoundation.prototype.getStep = function () {
|
2404 | return this.step;
|
2405 | };
|
2406 | MDCSliderFoundation.prototype.getDisabled = function () {
|
2407 | return this.isDisabled;
|
2408 | };
|
2409 | |
2410 |
|
2411 |
|
2412 | MDCSliderFoundation.prototype.setDisabled = function (disabled) {
|
2413 | this.isDisabled = disabled;
|
2414 | if (disabled) {
|
2415 | this.adapter.addClass(constants_1.cssClasses.DISABLED);
|
2416 | if (this.isRange) {
|
2417 | this.adapter.setInputAttribute(constants_1.attributes.INPUT_DISABLED, '', types_1.Thumb.START);
|
2418 | }
|
2419 | this.adapter.setInputAttribute(constants_1.attributes.INPUT_DISABLED, '', types_1.Thumb.END);
|
2420 | } else {
|
2421 | this.adapter.removeClass(constants_1.cssClasses.DISABLED);
|
2422 | if (this.isRange) {
|
2423 | this.adapter.removeInputAttribute(constants_1.attributes.INPUT_DISABLED, types_1.Thumb.START);
|
2424 | }
|
2425 | this.adapter.removeInputAttribute(constants_1.attributes.INPUT_DISABLED, types_1.Thumb.END);
|
2426 | }
|
2427 | };
|
2428 |
|
2429 | MDCSliderFoundation.prototype.getIsRange = function () {
|
2430 | return this.isRange;
|
2431 | };
|
2432 | |
2433 |
|
2434 |
|
2435 |
|
2436 | MDCSliderFoundation.prototype.layout = function (_a) {
|
2437 | var _b = _a === void 0 ? {} : _a,
|
2438 | skipUpdateUI = _b.skipUpdateUI;
|
2439 | this.rect = this.adapter.getBoundingClientRect();
|
2440 | if (this.isRange) {
|
2441 | this.startThumbKnobWidth = this.adapter.getThumbKnobWidth(types_1.Thumb.START);
|
2442 | this.endThumbKnobWidth = this.adapter.getThumbKnobWidth(types_1.Thumb.END);
|
2443 | }
|
2444 | if (!skipUpdateUI) {
|
2445 | this.updateUI();
|
2446 | }
|
2447 | };
|
2448 |
|
2449 | MDCSliderFoundation.prototype.handleResize = function () {
|
2450 | this.layout();
|
2451 | };
|
2452 | |
2453 |
|
2454 |
|
2455 | MDCSliderFoundation.prototype.handleDown = function (event) {
|
2456 | if (this.isDisabled) return;
|
2457 | this.valueStartBeforeDownEvent = this.valueStart;
|
2458 | this.valueBeforeDownEvent = this.value;
|
2459 | var clientX = event.clientX != null ? event.clientX : event.targetTouches[0].clientX;
|
2460 | this.downEventClientX = clientX;
|
2461 | var value = this.mapClientXOnSliderScale(clientX);
|
2462 | this.thumb = this.getThumbFromDownEvent(clientX, value);
|
2463 | if (this.thumb === null) return;
|
2464 | this.handleDragStart(event, value, this.thumb);
|
2465 | this.updateValue(value, this.thumb, { emitInputEvent: true });
|
2466 | };
|
2467 | |
2468 |
|
2469 |
|
2470 | MDCSliderFoundation.prototype.handleMove = function (event) {
|
2471 | if (this.isDisabled) return;
|
2472 |
|
2473 | event.preventDefault();
|
2474 | var clientX = event.clientX != null ? event.clientX : event.targetTouches[0].clientX;
|
2475 | var dragAlreadyStarted = this.thumb != null;
|
2476 | this.thumb = this.getThumbFromMoveEvent(clientX);
|
2477 | if (this.thumb === null) return;
|
2478 | var value = this.mapClientXOnSliderScale(clientX);
|
2479 | if (!dragAlreadyStarted) {
|
2480 | this.handleDragStart(event, value, this.thumb);
|
2481 | this.adapter.emitDragStartEvent(value, this.thumb);
|
2482 | }
|
2483 | this.updateValue(value, this.thumb, { emitInputEvent: true });
|
2484 | };
|
2485 | |
2486 |
|
2487 |
|
2488 | MDCSliderFoundation.prototype.handleUp = function () {
|
2489 | if (this.isDisabled || this.thumb === null) return;
|
2490 | var oldValue = this.thumb === types_1.Thumb.START ? this.valueStartBeforeDownEvent : this.valueBeforeDownEvent;
|
2491 | var newValue = this.thumb === types_1.Thumb.START ? this.valueStart : this.value;
|
2492 | if (oldValue !== newValue) {
|
2493 | this.adapter.emitChangeEvent(newValue, this.thumb);
|
2494 | }
|
2495 | this.adapter.emitDragEndEvent(newValue, this.thumb);
|
2496 | this.thumb = null;
|
2497 | };
|
2498 | |
2499 |
|
2500 |
|
2501 | MDCSliderFoundation.prototype.handleThumbMouseenter = function () {
|
2502 | if (!this.isDiscrete || !this.isRange) return;
|
2503 | this.adapter.addThumbClass(constants_1.cssClasses.THUMB_WITH_INDICATOR, types_1.Thumb.START);
|
2504 | this.adapter.addThumbClass(constants_1.cssClasses.THUMB_WITH_INDICATOR, types_1.Thumb.END);
|
2505 | };
|
2506 | |
2507 |
|
2508 |
|
2509 | MDCSliderFoundation.prototype.handleThumbMouseleave = function () {
|
2510 | if (!this.isDiscrete || !this.isRange) return;
|
2511 | if (this.adapter.isInputFocused(types_1.Thumb.START) || this.adapter.isInputFocused(types_1.Thumb.END)) {
|
2512 |
|
2513 | return;
|
2514 | }
|
2515 | this.adapter.removeThumbClass(constants_1.cssClasses.THUMB_WITH_INDICATOR, types_1.Thumb.START);
|
2516 | this.adapter.removeThumbClass(constants_1.cssClasses.THUMB_WITH_INDICATOR, types_1.Thumb.END);
|
2517 | };
|
2518 | MDCSliderFoundation.prototype.handleMousedownOrTouchstart = function (event) {
|
2519 | var _this = this;
|
2520 | var moveEventType = event.type === 'mousedown' ? 'mousemove' : 'touchmove';
|
2521 |
|
2522 |
|
2523 |
|
2524 | this.adapter.registerBodyEventHandler(moveEventType, this.moveListener);
|
2525 | var upHandler = function upHandler() {
|
2526 | _this.handleUp();
|
2527 |
|
2528 |
|
2529 | _this.adapter.deregisterBodyEventHandler(moveEventType, _this.moveListener);
|
2530 |
|
2531 | _this.adapter.deregisterEventHandler('mouseup', upHandler);
|
2532 | _this.adapter.deregisterEventHandler('touchend', upHandler);
|
2533 | };
|
2534 | this.adapter.registerBodyEventHandler('mouseup', upHandler);
|
2535 | this.adapter.registerBodyEventHandler('touchend', upHandler);
|
2536 | this.handleDown(event);
|
2537 | };
|
2538 | MDCSliderFoundation.prototype.handlePointerdown = function (event) {
|
2539 | this.adapter.setPointerCapture(event.pointerId);
|
2540 | this.adapter.registerEventHandler('pointermove', this.moveListener);
|
2541 | this.handleDown(event);
|
2542 | };
|
2543 | |
2544 |
|
2545 |
|
2546 |
|
2547 | MDCSliderFoundation.prototype.handleInputChange = function (thumb) {
|
2548 | var value = Number(this.adapter.getInputValue(thumb));
|
2549 | if (thumb === types_1.Thumb.START) {
|
2550 | this.setValueStart(value);
|
2551 | } else {
|
2552 | this.setValue(value);
|
2553 | }
|
2554 | this.adapter.emitChangeEvent(thumb === types_1.Thumb.START ? this.valueStart : this.value, thumb);
|
2555 | this.adapter.emitInputEvent(thumb === types_1.Thumb.START ? this.valueStart : this.value, thumb);
|
2556 | };
|
2557 |
|
2558 | MDCSliderFoundation.prototype.handleInputFocus = function (thumb) {
|
2559 | this.adapter.addThumbClass(constants_1.cssClasses.THUMB_FOCUSED, thumb);
|
2560 | if (!this.isDiscrete) return;
|
2561 | this.adapter.addThumbClass(constants_1.cssClasses.THUMB_WITH_INDICATOR, thumb);
|
2562 | if (this.isRange) {
|
2563 | var otherThumb = thumb === types_1.Thumb.START ? types_1.Thumb.END : types_1.Thumb.START;
|
2564 | this.adapter.addThumbClass(constants_1.cssClasses.THUMB_WITH_INDICATOR, otherThumb);
|
2565 | }
|
2566 | };
|
2567 |
|
2568 | MDCSliderFoundation.prototype.handleInputBlur = function (thumb) {
|
2569 | this.adapter.removeThumbClass(constants_1.cssClasses.THUMB_FOCUSED, thumb);
|
2570 | if (!this.isDiscrete) return;
|
2571 | this.adapter.removeThumbClass(constants_1.cssClasses.THUMB_WITH_INDICATOR, thumb);
|
2572 | if (this.isRange) {
|
2573 | var otherThumb = thumb === types_1.Thumb.START ? types_1.Thumb.END : types_1.Thumb.START;
|
2574 | this.adapter.removeThumbClass(constants_1.cssClasses.THUMB_WITH_INDICATOR, otherThumb);
|
2575 | }
|
2576 | };
|
2577 | |
2578 |
|
2579 |
|
2580 | MDCSliderFoundation.prototype.handleDragStart = function (event, value, thumb) {
|
2581 | this.adapter.focusInput(thumb);
|
2582 |
|
2583 | event.preventDefault();
|
2584 | this.adapter.emitDragStartEvent(value, thumb);
|
2585 | };
|
2586 | |
2587 |
|
2588 |
|
2589 | MDCSliderFoundation.prototype.getThumbFromDownEvent = function (clientX, value) {
|
2590 |
|
2591 |
|
2592 | if (!this.isRange) return types_1.Thumb.END;
|
2593 |
|
2594 | var thumbStartRect = this.adapter.getThumbBoundingClientRect(types_1.Thumb.START);
|
2595 | var thumbEndRect = this.adapter.getThumbBoundingClientRect(types_1.Thumb.END);
|
2596 | var inThumbStartBounds = clientX >= thumbStartRect.left && clientX <= thumbStartRect.right;
|
2597 | var inThumbEndBounds = clientX >= thumbEndRect.left && clientX <= thumbEndRect.right;
|
2598 | if (inThumbStartBounds && inThumbEndBounds) {
|
2599 |
|
2600 | return null;
|
2601 | }
|
2602 |
|
2603 |
|
2604 | if (inThumbStartBounds) {
|
2605 | return types_1.Thumb.START;
|
2606 | }
|
2607 | if (inThumbEndBounds) {
|
2608 | return types_1.Thumb.END;
|
2609 | }
|
2610 |
|
2611 | if (value < this.valueStart) {
|
2612 | return types_1.Thumb.START;
|
2613 | }
|
2614 | if (value > this.value) {
|
2615 | return types_1.Thumb.END;
|
2616 | }
|
2617 |
|
2618 | return value - this.valueStart <= this.value - value ? types_1.Thumb.START : types_1.Thumb.END;
|
2619 | };
|
2620 | |
2621 |
|
2622 |
|
2623 |
|
2624 |
|
2625 | MDCSliderFoundation.prototype.getThumbFromMoveEvent = function (clientX) {
|
2626 |
|
2627 | if (this.thumb !== null) return this.thumb;
|
2628 | if (this.downEventClientX === null) {
|
2629 | throw new Error('`downEventClientX` is null after move event.');
|
2630 | }
|
2631 | var moveDistanceUnderThreshold = Math.abs(this.downEventClientX - clientX) < constants_1.numbers.THUMB_UPDATE_MIN_PX;
|
2632 | if (moveDistanceUnderThreshold) return this.thumb;
|
2633 | var draggedThumbToLeft = clientX < this.downEventClientX;
|
2634 | if (draggedThumbToLeft) {
|
2635 | return this.adapter.isRTL() ? types_1.Thumb.END : types_1.Thumb.START;
|
2636 | } else {
|
2637 | return this.adapter.isRTL() ? types_1.Thumb.START : types_1.Thumb.END;
|
2638 | }
|
2639 | };
|
2640 | |
2641 |
|
2642 |
|
2643 |
|
2644 |
|
2645 | MDCSliderFoundation.prototype.updateUI = function (thumb) {
|
2646 | this.updateThumbAndInputAttributes(thumb);
|
2647 | this.updateThumbAndTrackUI(thumb);
|
2648 | this.updateValueIndicatorUI(thumb);
|
2649 | this.updateTickMarksUI();
|
2650 | };
|
2651 | |
2652 |
|
2653 |
|
2654 |
|
2655 | MDCSliderFoundation.prototype.updateThumbAndInputAttributes = function (thumb) {
|
2656 | if (!thumb) return;
|
2657 | var value = this.isRange && thumb === types_1.Thumb.START ? this.valueStart : this.value;
|
2658 | var valueStr = String(value);
|
2659 | this.adapter.setInputAttribute(constants_1.attributes.INPUT_VALUE, valueStr, thumb);
|
2660 | if (this.isRange && thumb === types_1.Thumb.START) {
|
2661 | this.adapter.setInputAttribute(constants_1.attributes.INPUT_MIN, valueStr, types_1.Thumb.END);
|
2662 | } else if (this.isRange && thumb === types_1.Thumb.END) {
|
2663 | this.adapter.setInputAttribute(constants_1.attributes.INPUT_MAX, valueStr, types_1.Thumb.START);
|
2664 | }
|
2665 |
|
2666 | if (this.adapter.getInputValue(thumb) !== valueStr) {
|
2667 | this.adapter.setInputValue(valueStr, thumb);
|
2668 | }
|
2669 | var valueToAriaValueTextFn = this.adapter.getValueToAriaValueTextFn();
|
2670 | if (valueToAriaValueTextFn) {
|
2671 | this.adapter.setInputAttribute(constants_1.attributes.ARIA_VALUETEXT, valueToAriaValueTextFn(value), thumb);
|
2672 | }
|
2673 | };
|
2674 | |
2675 |
|
2676 |
|
2677 |
|
2678 |
|
2679 | MDCSliderFoundation.prototype.updateValueIndicatorUI = function (thumb) {
|
2680 | if (!this.isDiscrete) return;
|
2681 | var value = this.isRange && thumb === types_1.Thumb.START ? this.valueStart : this.value;
|
2682 | this.adapter.setValueIndicatorText(value, thumb === types_1.Thumb.START ? types_1.Thumb.START : types_1.Thumb.END);
|
2683 | if (!thumb && this.isRange) {
|
2684 | this.adapter.setValueIndicatorText(this.valueStart, types_1.Thumb.START);
|
2685 | }
|
2686 | };
|
2687 | |
2688 |
|
2689 |
|
2690 | MDCSliderFoundation.prototype.updateTickMarksUI = function () {
|
2691 | if (!this.isDiscrete || !this.hasTickMarks) return;
|
2692 | var numTickMarksInactiveStart = (this.valueStart - this.min) / this.step;
|
2693 | var numTickMarksActive = (this.value - this.valueStart) / this.step + 1;
|
2694 | var numTickMarksInactiveEnd = (this.max - this.value) / this.step;
|
2695 | var tickMarksInactiveStart = Array.from({ length: numTickMarksInactiveStart }).fill(types_1.TickMark.INACTIVE);
|
2696 | var tickMarksActive = Array.from({ length: numTickMarksActive }).fill(types_1.TickMark.ACTIVE);
|
2697 | var tickMarksInactiveEnd = Array.from({ length: numTickMarksInactiveEnd }).fill(types_1.TickMark.INACTIVE);
|
2698 | this.adapter.updateTickMarks(tickMarksInactiveStart.concat(tickMarksActive).concat(tickMarksInactiveEnd));
|
2699 | };
|
2700 |
|
2701 | MDCSliderFoundation.prototype.mapClientXOnSliderScale = function (clientX) {
|
2702 | var xPos = clientX - this.rect.left;
|
2703 | var pctComplete = xPos / this.rect.width;
|
2704 | if (this.adapter.isRTL()) {
|
2705 | pctComplete = 1 - pctComplete;
|
2706 | }
|
2707 |
|
2708 |
|
2709 | var value = this.min + pctComplete * (this.max - this.min);
|
2710 | if (value === this.max || value === this.min) {
|
2711 | return value;
|
2712 | }
|
2713 | return Number(this.quantize(value).toFixed(this.numDecimalPlaces));
|
2714 | };
|
2715 |
|
2716 | MDCSliderFoundation.prototype.quantize = function (value) {
|
2717 | var numSteps = Math.round((value - this.min) / this.step);
|
2718 | return this.min + numSteps * this.step;
|
2719 | };
|
2720 | |
2721 |
|
2722 |
|
2723 | MDCSliderFoundation.prototype.updateValue = function (value, thumb, _a) {
|
2724 | var _b = _a === void 0 ? {} : _a,
|
2725 | emitInputEvent = _b.emitInputEvent;
|
2726 | value = this.clampValue(value, thumb);
|
2727 | if (this.isRange && thumb === types_1.Thumb.START) {
|
2728 |
|
2729 | if (this.valueStart === value) return;
|
2730 | this.valueStart = value;
|
2731 | } else {
|
2732 |
|
2733 | if (this.value === value) return;
|
2734 | this.value = value;
|
2735 | }
|
2736 | this.updateUI(thumb);
|
2737 | if (emitInputEvent) {
|
2738 | this.adapter.emitInputEvent(thumb === types_1.Thumb.START ? this.valueStart : this.value, thumb);
|
2739 | }
|
2740 | };
|
2741 | |
2742 |
|
2743 |
|
2744 |
|
2745 |
|
2746 |
|
2747 | MDCSliderFoundation.prototype.clampValue = function (value, thumb) {
|
2748 |
|
2749 | value = Math.min(Math.max(value, this.min), this.max);
|
2750 | var thumbStartMovedPastThumbEnd = this.isRange && thumb === types_1.Thumb.START && value > this.value;
|
2751 | if (thumbStartMovedPastThumbEnd) {
|
2752 | return this.value;
|
2753 | }
|
2754 | var thumbEndMovedPastThumbStart = this.isRange && thumb === types_1.Thumb.END && value < this.valueStart;
|
2755 | if (thumbEndMovedPastThumbStart) {
|
2756 | return this.valueStart;
|
2757 | }
|
2758 | return value;
|
2759 | };
|
2760 | |
2761 |
|
2762 |
|
2763 |
|
2764 | MDCSliderFoundation.prototype.updateThumbAndTrackUI = function (thumb) {
|
2765 | var _this = this;
|
2766 | var _a = this,
|
2767 | max = _a.max,
|
2768 | min = _a.min;
|
2769 | var pctComplete = (this.value - this.valueStart) / (max - min);
|
2770 | var rangePx = pctComplete * this.rect.width;
|
2771 | var isRtl = this.adapter.isRTL();
|
2772 | var transformProp = HAS_WINDOW ? util_1.getCorrectPropertyName(window, 'transform') : 'transform';
|
2773 | if (this.isRange) {
|
2774 | var thumbLeftPos_1 = this.adapter.isRTL() ? (max - this.value) / (max - min) * this.rect.width : (this.valueStart - min) / (max - min) * this.rect.width;
|
2775 | var thumbRightPos_1 = thumbLeftPos_1 + rangePx;
|
2776 | this.animFrame.request(AnimationKeys.SLIDER_UPDATE, function () {
|
2777 |
|
2778 |
|
2779 | var trackAnimatesFromRight = !isRtl && thumb === types_1.Thumb.START || isRtl && thumb !== types_1.Thumb.START;
|
2780 | if (trackAnimatesFromRight) {
|
2781 | _this.adapter.setTrackActiveStyleProperty('transform-origin', 'right');
|
2782 | _this.adapter.setTrackActiveStyleProperty('left', 'unset');
|
2783 | _this.adapter.setTrackActiveStyleProperty('right', _this.rect.width - thumbRightPos_1 + "px");
|
2784 | } else {
|
2785 | _this.adapter.setTrackActiveStyleProperty('transform-origin', 'left');
|
2786 | _this.adapter.setTrackActiveStyleProperty('right', 'unset');
|
2787 | _this.adapter.setTrackActiveStyleProperty('left', thumbLeftPos_1 + "px");
|
2788 | }
|
2789 | _this.adapter.setTrackActiveStyleProperty(transformProp, "scaleX(" + pctComplete + ")");
|
2790 |
|
2791 | var thumbStartPos = isRtl ? thumbRightPos_1 : thumbLeftPos_1;
|
2792 | var thumbEndPos = _this.adapter.isRTL() ? thumbLeftPos_1 : thumbRightPos_1;
|
2793 | if (thumb === types_1.Thumb.START || !thumb || !_this.initialStylesRemoved) {
|
2794 | _this.adapter.setThumbStyleProperty(transformProp, "translateX(" + thumbStartPos + "px)", types_1.Thumb.START);
|
2795 | }
|
2796 | if (thumb === types_1.Thumb.END || !thumb || !_this.initialStylesRemoved) {
|
2797 | _this.adapter.setThumbStyleProperty(transformProp, "translateX(" + thumbEndPos + "px)", types_1.Thumb.END);
|
2798 | }
|
2799 | _this.removeInitialStyles(isRtl);
|
2800 | _this.updateOverlappingThumbsUI(thumbStartPos, thumbEndPos, thumb);
|
2801 | });
|
2802 | } else {
|
2803 | this.animFrame.request(AnimationKeys.SLIDER_UPDATE, function () {
|
2804 | var thumbStartPos = isRtl ? _this.rect.width - rangePx : rangePx;
|
2805 | _this.adapter.setThumbStyleProperty(transformProp, "translateX(" + thumbStartPos + "px)", types_1.Thumb.END);
|
2806 | _this.adapter.setTrackActiveStyleProperty(transformProp, "scaleX(" + pctComplete + ")");
|
2807 | _this.removeInitialStyles(isRtl);
|
2808 | });
|
2809 | }
|
2810 | };
|
2811 | |
2812 |
|
2813 |
|
2814 |
|
2815 |
|
2816 |
|
2817 |
|
2818 |
|
2819 |
|
2820 | MDCSliderFoundation.prototype.removeInitialStyles = function (isRtl) {
|
2821 | if (this.initialStylesRemoved) return;
|
2822 |
|
2823 | var position = isRtl ? 'right' : 'left';
|
2824 | this.adapter.removeThumbStyleProperty(position, types_1.Thumb.END);
|
2825 | if (this.isRange) {
|
2826 | this.adapter.removeThumbStyleProperty(position, types_1.Thumb.START);
|
2827 | }
|
2828 | this.initialStylesRemoved = true;
|
2829 | this.resetTrackAndThumbAnimation();
|
2830 | };
|
2831 | |
2832 |
|
2833 |
|
2834 |
|
2835 | MDCSliderFoundation.prototype.resetTrackAndThumbAnimation = function () {
|
2836 | var _this = this;
|
2837 | if (!this.isDiscrete) return;
|
2838 |
|
2839 |
|
2840 |
|
2841 | var transitionProp = HAS_WINDOW ? util_1.getCorrectPropertyName(window, 'transition') : 'transition';
|
2842 | var transitionDefault = 'all 0s ease 0s';
|
2843 | this.adapter.setThumbStyleProperty(transitionProp, transitionDefault, types_1.Thumb.END);
|
2844 | if (this.isRange) {
|
2845 | this.adapter.setThumbStyleProperty(transitionProp, transitionDefault, types_1.Thumb.START);
|
2846 | }
|
2847 | this.adapter.setTrackActiveStyleProperty(transitionProp, transitionDefault);
|
2848 |
|
2849 |
|
2850 | requestAnimationFrame(function () {
|
2851 | _this.adapter.removeThumbStyleProperty(transitionProp, types_1.Thumb.END);
|
2852 | _this.adapter.removeTrackActiveStyleProperty(transitionProp);
|
2853 | if (_this.isRange) {
|
2854 | _this.adapter.removeThumbStyleProperty(transitionProp, types_1.Thumb.START);
|
2855 | }
|
2856 | });
|
2857 | };
|
2858 | |
2859 |
|
2860 |
|
2861 |
|
2862 |
|
2863 | MDCSliderFoundation.prototype.updateOverlappingThumbsUI = function (thumbStartPos, thumbEndPos, thumb) {
|
2864 | var thumbsOverlap = false;
|
2865 | if (this.adapter.isRTL()) {
|
2866 | var startThumbLeftEdge = thumbStartPos - this.startThumbKnobWidth / 2;
|
2867 | var endThumbRightEdge = thumbEndPos + this.endThumbKnobWidth / 2;
|
2868 | thumbsOverlap = endThumbRightEdge >= startThumbLeftEdge;
|
2869 | } else {
|
2870 | var startThumbRightEdge = thumbStartPos + this.startThumbKnobWidth / 2;
|
2871 | var endThumbLeftEdge = thumbEndPos - this.endThumbKnobWidth / 2;
|
2872 | thumbsOverlap = startThumbRightEdge >= endThumbLeftEdge;
|
2873 | }
|
2874 | if (thumbsOverlap) {
|
2875 | this.adapter.addThumbClass(constants_1.cssClasses.THUMB_TOP,
|
2876 |
|
2877 |
|
2878 | thumb || types_1.Thumb.END);
|
2879 | this.adapter.removeThumbClass(constants_1.cssClasses.THUMB_TOP, thumb === types_1.Thumb.START ? types_1.Thumb.END : types_1.Thumb.START);
|
2880 | } else {
|
2881 | this.adapter.removeThumbClass(constants_1.cssClasses.THUMB_TOP, types_1.Thumb.START);
|
2882 | this.adapter.removeThumbClass(constants_1.cssClasses.THUMB_TOP, types_1.Thumb.END);
|
2883 | }
|
2884 | };
|
2885 | |
2886 |
|
2887 |
|
2888 |
|
2889 |
|
2890 |
|
2891 | MDCSliderFoundation.prototype.convertAttributeValueToNumber = function (attributeValue, attributeName) {
|
2892 | if (attributeValue === null) {
|
2893 | throw new Error("MDCSliderFoundation: `" + attributeName + "` must be non-null.");
|
2894 | }
|
2895 | var value = Number(attributeValue);
|
2896 | if (isNaN(value)) {
|
2897 | throw new Error("MDCSliderFoundation: `" + attributeName + "` value is " + ("`" + attributeValue + "`, but must be a number."));
|
2898 | }
|
2899 | return value;
|
2900 | };
|
2901 |
|
2902 | MDCSliderFoundation.prototype.validateProperties = function (_a) {
|
2903 | var min = _a.min,
|
2904 | max = _a.max,
|
2905 | value = _a.value,
|
2906 | valueStart = _a.valueStart,
|
2907 | step = _a.step;
|
2908 | if (min >= max) {
|
2909 | throw new Error("MDCSliderFoundation: min must be strictly less than max. " + ("Current: [min: " + min + ", max: " + max + "]"));
|
2910 | }
|
2911 | if (step <= 0) {
|
2912 | throw new Error("MDCSliderFoundation: step must be a positive number. " + ("Current step: " + this.step));
|
2913 | }
|
2914 | if (this.isRange) {
|
2915 | if (value < min || value > max || valueStart < min || valueStart > max) {
|
2916 | throw new Error("MDCSliderFoundation: values must be in [min, max] range. " + ("Current values: [start value: " + valueStart + ", end value: " + value + "]"));
|
2917 | }
|
2918 | if (valueStart > value) {
|
2919 | throw new Error("MDCSliderFoundation: start value must be <= end value. " + ("Current values: [start value: " + valueStart + ", end value: " + value + "]"));
|
2920 | }
|
2921 | var numStepsValueStartFromMin = (valueStart - min) / step;
|
2922 | var numStepsValueFromMin = (value - min) / step;
|
2923 | if (numStepsValueStartFromMin % 1 !== 0 || numStepsValueFromMin % 1 !== 0) {
|
2924 | throw new Error("MDCSliderFoundation: Slider values must be valid based on the " + ("step value. Current values: [start value: " + valueStart + ", ") + ("end value: " + value + "]"));
|
2925 | }
|
2926 | } else {
|
2927 |
|
2928 | if (value < min || value > max) {
|
2929 | throw new Error("MDCSliderFoundation: value must be in [min, max] range. " + ("Current value: " + value));
|
2930 | }
|
2931 | var numStepsValueFromMin = (value - min) / step;
|
2932 | if (numStepsValueFromMin % 1 !== 0) {
|
2933 | throw new Error("MDCSliderFoundation: Slider value must be valid based on the " + ("step value. Current value: " + value));
|
2934 | }
|
2935 | }
|
2936 | };
|
2937 | MDCSliderFoundation.prototype.registerEventHandlers = function () {
|
2938 | this.adapter.registerWindowEventHandler('resize', this.resizeListener);
|
2939 | if (MDCSliderFoundation.SUPPORTS_POINTER_EVENTS) {
|
2940 |
|
2941 | this.adapter.registerEventHandler('pointerdown', this.pointerdownListener);
|
2942 | this.adapter.registerEventHandler('pointerup', this.pointerupListener);
|
2943 | } else {
|
2944 |
|
2945 | this.adapter.registerEventHandler('mousedown', this.mousedownOrTouchstartListener);
|
2946 | this.adapter.registerEventHandler('touchstart', this.mousedownOrTouchstartListener);
|
2947 | }
|
2948 | if (this.isRange) {
|
2949 | this.adapter.registerThumbEventHandler(types_1.Thumb.START, 'mouseenter', this.thumbMouseenterListener);
|
2950 | this.adapter.registerThumbEventHandler(types_1.Thumb.START, 'mouseleave', this.thumbMouseleaveListener);
|
2951 | this.adapter.registerInputEventHandler(types_1.Thumb.START, 'change', this.inputStartChangeListener);
|
2952 | this.adapter.registerInputEventHandler(types_1.Thumb.START, 'focus', this.inputStartFocusListener);
|
2953 | this.adapter.registerInputEventHandler(types_1.Thumb.START, 'blur', this.inputStartBlurListener);
|
2954 | }
|
2955 | this.adapter.registerThumbEventHandler(types_1.Thumb.END, 'mouseenter', this.thumbMouseenterListener);
|
2956 | this.adapter.registerThumbEventHandler(types_1.Thumb.END, 'mouseleave', this.thumbMouseleaveListener);
|
2957 | this.adapter.registerInputEventHandler(types_1.Thumb.END, 'change', this.inputEndChangeListener);
|
2958 | this.adapter.registerInputEventHandler(types_1.Thumb.END, 'focus', this.inputEndFocusListener);
|
2959 | this.adapter.registerInputEventHandler(types_1.Thumb.END, 'blur', this.inputEndBlurListener);
|
2960 | };
|
2961 | MDCSliderFoundation.prototype.deregisterEventHandlers = function () {
|
2962 | this.adapter.deregisterWindowEventHandler('resize', this.resizeListener);
|
2963 | if (MDCSliderFoundation.SUPPORTS_POINTER_EVENTS) {
|
2964 | this.adapter.deregisterEventHandler('pointerdown', this.pointerdownListener);
|
2965 | this.adapter.deregisterEventHandler('pointerup', this.pointerupListener);
|
2966 | } else {
|
2967 | this.adapter.deregisterEventHandler('mousedown', this.mousedownOrTouchstartListener);
|
2968 | this.adapter.deregisterEventHandler('touchstart', this.mousedownOrTouchstartListener);
|
2969 | }
|
2970 | if (this.isRange) {
|
2971 | this.adapter.deregisterThumbEventHandler(types_1.Thumb.START, 'mouseenter', this.thumbMouseenterListener);
|
2972 | this.adapter.deregisterThumbEventHandler(types_1.Thumb.START, 'mouseleave', this.thumbMouseleaveListener);
|
2973 | this.adapter.deregisterInputEventHandler(types_1.Thumb.START, 'change', this.inputStartChangeListener);
|
2974 | this.adapter.deregisterInputEventHandler(types_1.Thumb.START, 'focus', this.inputStartFocusListener);
|
2975 | this.adapter.deregisterInputEventHandler(types_1.Thumb.START, 'blur', this.inputStartBlurListener);
|
2976 | }
|
2977 | this.adapter.deregisterThumbEventHandler(types_1.Thumb.END, 'mouseenter', this.thumbMouseenterListener);
|
2978 | this.adapter.deregisterThumbEventHandler(types_1.Thumb.END, 'mouseleave', this.thumbMouseleaveListener);
|
2979 | this.adapter.deregisterInputEventHandler(types_1.Thumb.END, 'change', this.inputEndChangeListener);
|
2980 | this.adapter.deregisterInputEventHandler(types_1.Thumb.END, 'focus', this.inputEndFocusListener);
|
2981 | this.adapter.deregisterInputEventHandler(types_1.Thumb.END, 'blur', this.inputEndBlurListener);
|
2982 | };
|
2983 | MDCSliderFoundation.prototype.handlePointerup = function () {
|
2984 | this.handleUp();
|
2985 | this.adapter.deregisterEventHandler('pointermove', this.moveListener);
|
2986 | };
|
2987 | MDCSliderFoundation.SUPPORTS_POINTER_EVENTS = HAS_WINDOW && Boolean(window.PointerEvent) &&
|
2988 |
|
2989 |
|
2990 |
|
2991 | !isIOS();
|
2992 | return MDCSliderFoundation;
|
2993 | }(foundation_1.MDCFoundation);
|
2994 | exports.MDCSliderFoundation = MDCSliderFoundation;
|
2995 | function isIOS() {
|
2996 |
|
2997 |
|
2998 | return ['iPad Simulator', 'iPhone Simulator', 'iPod Simulator', 'iPad', 'iPhone', 'iPod'].includes(navigator.platform)
|
2999 |
|
3000 | || navigator.userAgent.includes('Mac') && 'ontouchend' in document;
|
3001 | }
|
3002 |
|
3003 |
|
3004 |
|
3005 |
|
3006 |
|
3007 |
|
3008 | function getNumDecimalPlaces(n) {
|
3009 |
|
3010 | var match = /(?:\.(\d+))?(?:[eE]([+\-]?\d+))?$/.exec(String(n));
|
3011 |
|
3012 |
|
3013 | if (!match) return 0;
|
3014 | var fraction = match[1] || '';
|
3015 | var exponent = match[2] || 0;
|
3016 |
|
3017 |
|
3018 |
|
3019 |
|
3020 | return Math.max(0,
|
3021 | (fraction === '0' ? 0 : fraction.length) - Number(exponent));
|
3022 | }
|
3023 |
|
3024 | }),
|
3025 |
|
3026 | "./packages/mdc-slider/index.ts":
|
3027 |
|
3028 |
|
3029 |
|
3030 |
|
3031 | (function(module, exports, __webpack_require__) {
|
3032 |
|
3033 | "use strict";
|
3034 |
|
3035 |
|
3036 |
|
3037 |
|
3038 |
|
3039 |
|
3040 |
|
3041 |
|
3042 |
|
3043 |
|
3044 |
|
3045 |
|
3046 |
|
3047 |
|
3048 |
|
3049 |
|
3050 |
|
3051 |
|
3052 |
|
3053 |
|
3054 |
|
3055 |
|
3056 |
|
3057 |
|
3058 | var __createBinding = this && this.__createBinding || (Object.create ? function (o, m, k, k2) {
|
3059 | if (k2 === undefined) k2 = k;
|
3060 | Object.defineProperty(o, k2, { enumerable: true, get: function get() {
|
3061 | return m[k];
|
3062 | } });
|
3063 | } : function (o, m, k, k2) {
|
3064 | if (k2 === undefined) k2 = k;
|
3065 | o[k2] = m[k];
|
3066 | });
|
3067 | var __exportStar = this && this.__exportStar || function (m, exports) {
|
3068 | for (var p in m) {
|
3069 | if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
|
3070 | }
|
3071 | };
|
3072 | Object.defineProperty(exports, "__esModule", { value: true });
|
3073 | __exportStar(__webpack_require__( "./packages/mdc-slider/adapter.ts"), exports);
|
3074 | __exportStar(__webpack_require__( "./packages/mdc-slider/component.ts"), exports);
|
3075 | __exportStar(__webpack_require__( "./packages/mdc-slider/constants.ts"), exports);
|
3076 | __exportStar(__webpack_require__( "./packages/mdc-slider/foundation.ts"), exports);
|
3077 | __exportStar(__webpack_require__( "./packages/mdc-slider/types.ts"), exports);
|
3078 |
|
3079 | }),
|
3080 |
|
3081 | "./packages/mdc-slider/types.ts":
|
3082 |
|
3083 |
|
3084 |
|
3085 |
|
3086 | (function(module, exports, __webpack_require__) {
|
3087 |
|
3088 | "use strict";
|
3089 |
|
3090 |
|
3091 |
|
3092 |
|
3093 |
|
3094 |
|
3095 |
|
3096 |
|
3097 |
|
3098 |
|
3099 |
|
3100 |
|
3101 |
|
3102 |
|
3103 |
|
3104 |
|
3105 |
|
3106 |
|
3107 |
|
3108 |
|
3109 |
|
3110 |
|
3111 |
|
3112 |
|
3113 | Object.defineProperty(exports, "__esModule", { value: true });
|
3114 | exports.Thumb = exports.TickMark = void 0;
|
3115 |
|
3116 | var TickMark;
|
3117 | (function (TickMark) {
|
3118 | TickMark[TickMark["ACTIVE"] = 0] = "ACTIVE";
|
3119 | TickMark[TickMark["INACTIVE"] = 1] = "INACTIVE";
|
3120 | })(TickMark = exports.TickMark || (exports.TickMark = {}));
|
3121 |
|
3122 |
|
3123 |
|
3124 |
|
3125 | var Thumb;
|
3126 | (function (Thumb) {
|
3127 |
|
3128 | Thumb[Thumb["START"] = 1] = "START";
|
3129 |
|
3130 |
|
3131 | Thumb[Thumb["END"] = 2] = "END";
|
3132 | })(Thumb = exports.Thumb || (exports.Thumb = {}));
|
3133 |
|
3134 | })
|
3135 |
|
3136 | });
|
3137 | });
|
3138 |
|
\ | No newline at end of file |