UNPKG

144 kBJavaScriptView Raw
1/**
2 * @license
3 * Copyright Google LLC All Rights Reserved.
4 *
5 * Use of this source code is governed by an MIT-style license that can be
6 * found in the LICENSE file at https://github.com/material-components/material-components-web/blob/master/LICENSE
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() {
18return /******/ (function(modules) { // webpackBootstrap
19/******/ // The module cache
20/******/ var installedModules = {};
21/******/
22/******/ // The require function
23/******/ function __webpack_require__(moduleId) {
24/******/
25/******/ // Check if module is in cache
26/******/ if(installedModules[moduleId]) {
27/******/ return installedModules[moduleId].exports;
28/******/ }
29/******/ // Create a new module (and put it into the cache)
30/******/ var module = installedModules[moduleId] = {
31/******/ i: moduleId,
32/******/ l: false,
33/******/ exports: {}
34/******/ };
35/******/
36/******/ // Execute the module function
37/******/ modules[moduleId].call(module.exports, module, module.exports, __webpack_require__);
38/******/
39/******/ // Flag the module as loaded
40/******/ module.l = true;
41/******/
42/******/ // Return the exports of the module
43/******/ return module.exports;
44/******/ }
45/******/
46/******/
47/******/ // expose the modules object (__webpack_modules__)
48/******/ __webpack_require__.m = modules;
49/******/
50/******/ // expose the module cache
51/******/ __webpack_require__.c = installedModules;
52/******/
53/******/ // define getter function for harmony exports
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/******/ // define __esModule on exports
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/******/ // create a fake namespace object
69/******/ // mode & 1: value is a module id, require it
70/******/ // mode & 2: merge all properties of value into the ns
71/******/ // mode & 4: return value when already ns object
72/******/ // mode & 8|1: behave like require
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/******/ // getDefaultExport function for compatibility with non-harmony modules
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/******/ // Object.prototype.hasOwnProperty.call
94/******/ __webpack_require__.o = function(object, property) { return Object.prototype.hasOwnProperty.call(object, property); };
95/******/
96/******/ // __webpack_public_path__
97/******/ __webpack_require__.p = "";
98/******/
99/******/
100/******/ // Load entry module and return exports
101/******/ return __webpack_require__(__webpack_require__.s = "./packages/mdc-slider/index.ts");
102/******/ })
103/************************************************************************/
104/******/ ({
105
106/***/ "./packages/mdc-animation/animationframe.ts":
107/*!**************************************************!*\
108 !*** ./packages/mdc-animation/animationframe.ts ***!
109 \**************************************************/
110/*! no static exports found */
111/***/ (function(module, exports, __webpack_require__) {
112
113"use strict";
114
115/**
116 * @license
117 * Copyright 2020 Google Inc.
118 *
119 * Permission is hereby granted, free of charge, to any person obtaining a copy
120 * of this software and associated documentation files (the "Software"), to deal
121 * in the Software without restriction, including without limitation the rights
122 * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
123 * copies of the Software, and to permit persons to whom the Software is
124 * furnished to do so, subject to the following conditions:
125 *
126 * The above copyright notice and this permission notice shall be included in
127 * all copies or substantial portions of the Software.
128 *
129 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
130 * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
131 * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
132 * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
133 * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
134 * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
135 * THE SOFTWARE.
136 */
137
138Object.defineProperty(exports, "__esModule", { value: true });
139exports.AnimationFrame = void 0;
140/**
141 * AnimationFrame provides a user-friendly abstraction around requesting
142 * and canceling animation frames.
143 */
144var AnimationFrame = /** @class */function () {
145 function AnimationFrame() {
146 this.rafIDs = new Map();
147 }
148 /**
149 * Requests an animation frame. Cancels any existing frame with the same key.
150 * @param {string} key The key for this callback.
151 * @param {FrameRequestCallback} callback The callback to be executed.
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 // Callback must come *after* the key is deleted so that nested calls to
159 // request with the same key are not deleted.
160 callback(frame);
161 });
162 this.rafIDs.set(key, frameID);
163 };
164 /**
165 * Cancels a queued callback with the given key.
166 * @param {string} key The key for this callback.
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 * Cancels all queued callback.
177 */
178 AnimationFrame.prototype.cancelAll = function () {
179 var _this = this;
180 // Need to use forEach because it's the only iteration method supported
181 // by IE11. Suppress the underscore because we don't need it.
182 // tslint:disable-next-line:enforce-name-casing
183 this.rafIDs.forEach(function (_, key) {
184 _this.cancel(key);
185 });
186 };
187 /**
188 * Returns the queue of unexecuted callback keys.
189 */
190 AnimationFrame.prototype.getQueue = function () {
191 var queue = [];
192 // Need to use forEach because it's the only iteration method supported
193 // by IE11. Suppress the underscore because we don't need it.
194 // tslint:disable-next-line:enforce-name-casing
195 this.rafIDs.forEach(function (_, key) {
196 queue.push(key);
197 });
198 return queue;
199 };
200 return AnimationFrame;
201}();
202exports.AnimationFrame = AnimationFrame;
203
204/***/ }),
205
206/***/ "./packages/mdc-animation/util.ts":
207/*!****************************************!*\
208 !*** ./packages/mdc-animation/util.ts ***!
209 \****************************************/
210/*! no static exports found */
211/***/ (function(module, exports, __webpack_require__) {
212
213"use strict";
214
215/**
216 * @license
217 * Copyright 2016 Google Inc.
218 *
219 * Permission is hereby granted, free of charge, to any person obtaining a copy
220 * of this software and associated documentation files (the "Software"), to deal
221 * in the Software without restriction, including without limitation the rights
222 * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
223 * copies of the Software, and to permit persons to whom the Software is
224 * furnished to do so, subject to the following conditions:
225 *
226 * The above copyright notice and this permission notice shall be included in
227 * all copies or substantial portions of the Software.
228 *
229 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
230 * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
231 * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
232 * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
233 * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
234 * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
235 * THE SOFTWARE.
236 */
237
238Object.defineProperty(exports, "__esModule", { value: true });
239exports.getCorrectEventName = exports.getCorrectPropertyName = void 0;
240var 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};
254var 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};
276function isWindow(windowObj) {
277 return Boolean(windowObj.document) && typeof windowObj.document.createElement === 'function';
278}
279function 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}
290exports.getCorrectPropertyName = getCorrectPropertyName;
291function 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}
303exports.getCorrectEventName = getCorrectEventName;
304
305/***/ }),
306
307/***/ "./packages/mdc-base/component.ts":
308/*!****************************************!*\
309 !*** ./packages/mdc-base/component.ts ***!
310 \****************************************/
311/*! no static exports found */
312/***/ (function(module, exports, __webpack_require__) {
313
314"use strict";
315
316/**
317 * @license
318 * Copyright 2016 Google Inc.
319 *
320 * Permission is hereby granted, free of charge, to any person obtaining a copy
321 * of this software and associated documentation files (the "Software"), to deal
322 * in the Software without restriction, including without limitation the rights
323 * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
324 * copies of the Software, and to permit persons to whom the Software is
325 * furnished to do so, subject to the following conditions:
326 *
327 * The above copyright notice and this permission notice shall be included in
328 * all copies or substantial portions of the Software.
329 *
330 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
331 * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
332 * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
333 * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
334 * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
335 * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
336 * THE SOFTWARE.
337 */
338
339var __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};
361var __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};
366Object.defineProperty(exports, "__esModule", { value: true });
367exports.MDCComponent = void 0;
368var foundation_1 = __webpack_require__(/*! ./foundation */ "./packages/mdc-base/foundation.ts");
369var MDCComponent = /** @class */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 // Note that we initialize foundation here and not within the constructor's default param so that
378 // this.root_ is defined and can be used within the foundation class.
379 this.foundation = foundation === undefined ? this.getDefaultFoundation() : foundation;
380 this.foundation.init();
381 this.initialSyncWithDOM();
382 }
383 MDCComponent.attachTo = function (root) {
384 // Subclasses which extend MDCBase should provide an attachTo() method that takes a root element and
385 // returns an instantiated component with its root set to that element. Also note that in the cases of
386 // subclasses, an explicit foundation class will not have to be passed in; it will simply be initialized
387 // from getDefaultFoundation().
388 return new MDCComponent(root, new foundation_1.MDCFoundation({}));
389 };
390 /* istanbul ignore next: method param only exists for typing purposes; it does not need to be unit tested */
391 MDCComponent.prototype.initialize = function () {
392 var _args = [];
393 for (var _i = 0; _i < arguments.length; _i++) {
394 _args[_i] = arguments[_i];
395 }
396 // Subclasses can override this to do any additional setup work that would be considered part of a
397 // "constructor". Essentially, it is a hook into the parent constructor before the foundation is
398 // initialized. Any additional arguments besides root and foundation will be passed in here.
399 };
400 MDCComponent.prototype.getDefaultFoundation = function () {
401 // Subclasses must override this method to return a properly configured foundation class for the
402 // component.
403 throw new Error('Subclasses must override getDefaultFoundation to return a properly configured ' + 'foundation class');
404 };
405 MDCComponent.prototype.initialSyncWithDOM = function () {
406 // Subclasses should override this method if they need to perform work to synchronize with a host DOM
407 // object. An example of this would be a form control wrapper that needs to synchronize its internal state
408 // to some property or attribute of the host DOM. Please note: this is *not* the place to perform DOM
409 // reads/writes that would cause layout / paint, as this is called synchronously from within the constructor.
410 };
411 MDCComponent.prototype.destroy = function () {
412 // Subclasses may implement this method to release any resources / deregister any listeners they have
413 // attached. An example of this might be deregistering a resize event from the window object.
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 * Fires a cross-browser-compatible custom event from the component root of the given type, with the given data.
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}();
443exports.MDCComponent = MDCComponent;
444// tslint:disable-next-line:no-default-export Needed for backward compatibility with MDC Web v0.44.0 and earlier.
445exports.default = MDCComponent;
446
447/***/ }),
448
449/***/ "./packages/mdc-base/foundation.ts":
450/*!*****************************************!*\
451 !*** ./packages/mdc-base/foundation.ts ***!
452 \*****************************************/
453/*! no static exports found */
454/***/ (function(module, exports, __webpack_require__) {
455
456"use strict";
457
458/**
459 * @license
460 * Copyright 2016 Google Inc.
461 *
462 * Permission is hereby granted, free of charge, to any person obtaining a copy
463 * of this software and associated documentation files (the "Software"), to deal
464 * in the Software without restriction, including without limitation the rights
465 * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
466 * copies of the Software, and to permit persons to whom the Software is
467 * furnished to do so, subject to the following conditions:
468 *
469 * The above copyright notice and this permission notice shall be included in
470 * all copies or substantial portions of the Software.
471 *
472 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
473 * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
474 * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
475 * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
476 * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
477 * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
478 * THE SOFTWARE.
479 */
480
481Object.defineProperty(exports, "__esModule", { value: true });
482exports.MDCFoundation = void 0;
483var MDCFoundation = /** @class */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 // Classes extending MDCFoundation should implement this method to return an object which exports every
493 // CSS class the foundation class needs as a property. e.g. {ACTIVE: 'mdc-component--active'}
494 return {};
495 },
496 enumerable: false,
497 configurable: true
498 });
499 Object.defineProperty(MDCFoundation, "strings", {
500 get: function get() {
501 // Classes extending MDCFoundation should implement this method to return an object which exports all
502 // semantic strings as constants. e.g. {ARIA_ROLE: 'tablist'}
503 return {};
504 },
505 enumerable: false,
506 configurable: true
507 });
508 Object.defineProperty(MDCFoundation, "numbers", {
509 get: function get() {
510 // Classes extending MDCFoundation should implement this method to return an object which exports all
511 // of its semantic numbers as constants. e.g. {ANIMATION_DELAY_MS: 350}
512 return {};
513 },
514 enumerable: false,
515 configurable: true
516 });
517 Object.defineProperty(MDCFoundation, "defaultAdapter", {
518 get: function get() {
519 // Classes extending MDCFoundation may choose to implement this getter in order to provide a convenient
520 // way of viewing the necessary methods of an adapter. In the future, this could also be used for adapter
521 // validation.
522 return {};
523 },
524 enumerable: false,
525 configurable: true
526 });
527 MDCFoundation.prototype.init = function () {
528 // Subclasses should override this method to perform initialization routines (registering events, etc.)
529 };
530 MDCFoundation.prototype.destroy = function () {
531 // Subclasses should override this method to perform de-initialization routines (de-registering events, etc.)
532 };
533 return MDCFoundation;
534}();
535exports.MDCFoundation = MDCFoundation;
536// tslint:disable-next-line:no-default-export Needed for backward compatibility with MDC Web v0.44.0 and earlier.
537exports.default = MDCFoundation;
538
539/***/ }),
540
541/***/ "./packages/mdc-dom/events.ts":
542/*!************************************!*\
543 !*** ./packages/mdc-dom/events.ts ***!
544 \************************************/
545/*! no static exports found */
546/***/ (function(module, exports, __webpack_require__) {
547
548"use strict";
549
550/**
551 * @license
552 * Copyright 2019 Google Inc.
553 *
554 * Permission is hereby granted, free of charge, to any person obtaining a copy
555 * of this software and associated documentation files (the "Software"), to deal
556 * in the Software without restriction, including without limitation the rights
557 * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
558 * copies of the Software, and to permit persons to whom the Software is
559 * furnished to do so, subject to the following conditions:
560 *
561 * The above copyright notice and this permission notice shall be included in
562 * all copies or substantial portions of the Software.
563 *
564 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
565 * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
566 * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
567 * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
568 * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
569 * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
570 * THE SOFTWARE.
571 */
572
573Object.defineProperty(exports, "__esModule", { value: true });
574exports.applyPassive = void 0;
575/**
576 * Determine whether the current browser supports passive event listeners, and
577 * if so, use them.
578 */
579function applyPassive(globalObj) {
580 if (globalObj === void 0) {
581 globalObj = window;
582 }
583 return supportsPassiveOption(globalObj) ? { passive: true } : false;
584}
585exports.applyPassive = applyPassive;
586function supportsPassiveOption(globalObj) {
587 if (globalObj === void 0) {
588 globalObj = window;
589 }
590 // See
591 // https://developer.mozilla.org/en-US/docs/Web/API/EventTarget/addEventListener
592 var passiveSupported = false;
593 try {
594 var options = {
595 // This function will be called when the browser
596 // attempts to access the passive property.
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 !*** ./packages/mdc-dom/ponyfill.ts ***!
616 \**************************************/
617/*! no static exports found */
618/***/ (function(module, exports, __webpack_require__) {
619
620"use strict";
621
622/**
623 * @license
624 * Copyright 2018 Google Inc.
625 *
626 * Permission is hereby granted, free of charge, to any person obtaining a copy
627 * of this software and associated documentation files (the "Software"), to deal
628 * in the Software without restriction, including without limitation the rights
629 * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
630 * copies of the Software, and to permit persons to whom the Software is
631 * furnished to do so, subject to the following conditions:
632 *
633 * The above copyright notice and this permission notice shall be included in
634 * all copies or substantial portions of the Software.
635 *
636 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
637 * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
638 * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
639 * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
640 * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
641 * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
642 * THE SOFTWARE.
643 */
644
645Object.defineProperty(exports, "__esModule", { value: true });
646exports.estimateScrollWidth = exports.matches = exports.closest = void 0;
647/**
648 * @fileoverview A "ponyfill" is a polyfill that doesn't modify the global prototype chain.
649 * This makes ponyfills safer than traditional polyfills, especially for libraries like MDC.
650 */
651function 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}
664exports.closest = closest;
665function matches(element, selector) {
666 var nativeMatches = element.matches || element.webkitMatchesSelector || element.msMatchesSelector;
667 return nativeMatches.call(element, selector);
668}
669exports.matches = matches;
670/**
671 * Used to compute the estimated scroll width of elements. When an element is
672 * hidden due to display: none; being applied to a parent element, the width is
673 * returned as 0. However, the element will have a true width once no longer
674 * inside a display: none context. This method computes an estimated width when
675 * the element is hidden or returns the true width when the element is visble.
676 * @param {Element} element the element whose width to estimate
677 */
678function estimateScrollWidth(element) {
679 // Check the offsetParent. If the element inherits display: none from any
680 // parent, the offsetParent property will be null (see
681 // https://developer.mozilla.org/en-US/docs/Web/API/HTMLElement/offsetParent).
682 // This check ensures we only clone the node when necessary.
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}
695exports.estimateScrollWidth = estimateScrollWidth;
696
697/***/ }),
698
699/***/ "./packages/mdc-ripple/component.ts":
700/*!******************************************!*\
701 !*** ./packages/mdc-ripple/component.ts ***!
702 \******************************************/
703/*! no static exports found */
704/***/ (function(module, exports, __webpack_require__) {
705
706"use strict";
707
708/**
709 * @license
710 * Copyright 2016 Google Inc.
711 *
712 * Permission is hereby granted, free of charge, to any person obtaining a copy
713 * of this software and associated documentation files (the "Software"), to deal
714 * in the Software without restriction, including without limitation the rights
715 * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
716 * copies of the Software, and to permit persons to whom the Software is
717 * furnished to do so, subject to the following conditions:
718 *
719 * The above copyright notice and this permission notice shall be included in
720 * all copies or substantial portions of the Software.
721 *
722 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
723 * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
724 * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
725 * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
726 * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
727 * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
728 * THE SOFTWARE.
729 */
730
731var __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}();
751var __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});
760var __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});
765var __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};
773Object.defineProperty(exports, "__esModule", { value: true });
774exports.MDCRipple = void 0;
775var component_1 = __webpack_require__(/*! @material/base/component */ "./packages/mdc-base/component.ts");
776var events_1 = __webpack_require__(/*! @material/dom/events */ "./packages/mdc-dom/events.ts");
777var ponyfill_1 = __webpack_require__(/*! @material/dom/ponyfill */ "./packages/mdc-dom/ponyfill.ts");
778var foundation_1 = __webpack_require__(/*! ./foundation */ "./packages/mdc-ripple/foundation.ts");
779var util = __importStar(__webpack_require__(/*! ./util */ "./packages/mdc-ripple/util.ts"));
780var MDCRipple = /** @class */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 // Only override unbounded behavior if option is explicitly specified
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 * Closure Compiler throws an access control error when directly accessing a
879 * protected or private property inside a getter/setter, like unbounded above.
880 * By accessing the protected property inside a method, we solve that problem.
881 * That's why this function exists.
882 */
883 MDCRipple.prototype.setUnbounded_ = function () {
884 this.foundation.setUnbounded(Boolean(this.unbounded_));
885 };
886 return MDCRipple;
887}(component_1.MDCComponent);
888exports.MDCRipple = MDCRipple;
889
890/***/ }),
891
892/***/ "./packages/mdc-ripple/constants.ts":
893/*!******************************************!*\
894 !*** ./packages/mdc-ripple/constants.ts ***!
895 \******************************************/
896/*! no static exports found */
897/***/ (function(module, exports, __webpack_require__) {
898
899"use strict";
900
901/**
902 * @license
903 * Copyright 2016 Google Inc.
904 *
905 * Permission is hereby granted, free of charge, to any person obtaining a copy
906 * of this software and associated documentation files (the "Software"), to deal
907 * in the Software without restriction, including without limitation the rights
908 * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
909 * copies of the Software, and to permit persons to whom the Software is
910 * furnished to do so, subject to the following conditions:
911 *
912 * The above copyright notice and this permission notice shall be included in
913 * all copies or substantial portions of the Software.
914 *
915 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
916 * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
917 * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
918 * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
919 * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
920 * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
921 * THE SOFTWARE.
922 */
923
924Object.defineProperty(exports, "__esModule", { value: true });
925exports.numbers = exports.strings = exports.cssClasses = void 0;
926exports.cssClasses = {
927 // Ripple is a special case where the "root" component is really a "mixin" of sorts,
928 // given that it's an 'upgrade' to an existing component. That being said it is the root
929 // CSS class that all other CSS classes derive from.
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};
936exports.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};
944exports.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 !*** ./packages/mdc-ripple/foundation.ts ***!
956 \*******************************************/
957/*! no static exports found */
958/***/ (function(module, exports, __webpack_require__) {
959
960"use strict";
961
962/**
963 * @license
964 * Copyright 2016 Google Inc.
965 *
966 * Permission is hereby granted, free of charge, to any person obtaining a copy
967 * of this software and associated documentation files (the "Software"), to deal
968 * in the Software without restriction, including without limitation the rights
969 * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
970 * copies of the Software, and to permit persons to whom the Software is
971 * furnished to do so, subject to the following conditions:
972 *
973 * The above copyright notice and this permission notice shall be included in
974 * all copies or substantial portions of the Software.
975 *
976 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
977 * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
978 * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
979 * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
980 * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
981 * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
982 * THE SOFTWARE.
983 */
984
985var __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}();
1005var __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};
1017Object.defineProperty(exports, "__esModule", { value: true });
1018exports.MDCRippleFoundation = void 0;
1019var foundation_1 = __webpack_require__(/*! @material/base/foundation */ "./packages/mdc-base/foundation.ts");
1020var constants_1 = __webpack_require__(/*! ./constants */ "./packages/mdc-ripple/constants.ts");
1021var util_1 = __webpack_require__(/*! ./util */ "./packages/mdc-ripple/util.ts");
1022// Activation events registered on the root element of each instance for activation
1023var ACTIVATION_EVENT_TYPES = ['touchstart', 'pointerdown', 'mousedown', 'keydown'];
1024// Deactivation events registered on documentElement when a pointer-related down event occurs
1025var POINTER_DEACTIVATION_EVENT_TYPES = ['touchend', 'pointerup', 'mouseup', 'contextmenu'];
1026// simultaneous nested activations
1027var activatedTargets = [];
1028var MDCRippleFoundation = /** @class */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 // Unbounded ripples need layout logic applied immediately to set coordinates for both shade and ripple
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 * @param evt Optional event containing position information.
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 * We compute this property so that we are not querying information about the client
1224 * until the point in time where the foundation requests it. This prevents scenarios where
1225 * client-side feature-detection may happen too early, such as when components are rendered on the server
1226 * and then initialized at mount time on the client.
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 * supportsPressRipple Passed from init to save a redundant function call
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 // Avoid reacting to follow-on events fired by touch device after an already-processed user interaction
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 // Immediately reset activation state, while preserving logic that prevents touch follow-on events
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 // Reset array on next frame after the current event has had a chance to bubble to prevent ancestor ripples
1332 activatedTargets = [];
1333 if (!activationState.wasElementMadeActive && evt !== undefined && (evt.key === ' ' || evt.keyCode === 32)) {
1334 // If space was pressed, try again within an rAF call to detect :active, because different UAs report
1335 // active states inconsistently when they're called within event handling code:
1336 // - https://bugs.chromium.org/p/chromium/issues/detail?id=635971
1337 // - https://bugzilla.mozilla.org/show_bug.cgi?id=1293741
1338 // We try first outside rAF to support Edge, which does not exhibit this problem, but will crash if a CSS
1339 // variable is set within a rAF callback for a submit button interaction (#2241).
1340 activationState.wasElementMadeActive = _this.checkElementMadeActive_(evt);
1341 if (activationState.wasElementMadeActive) {
1342 _this.animateActivation_();
1343 }
1344 }
1345 if (!activationState.wasElementMadeActive) {
1346 // Reset activation state immediately if element was not made active.
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 // Cancel any ongoing activation/deactivation animations
1376 clearTimeout(this.activationTimer_);
1377 clearTimeout(this.fgDeactivationRemovalTimer_);
1378 this.rmBoundedActivationClasses_();
1379 this.adapter.removeClass(FG_DEACTIVATION);
1380 // Force layout in order to re-trigger the animation.
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 // Center the element around the start point.
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 // This method is called both when a pointing device is released, and when the activation animation ends.
1414 // The deactivation animation should only run after both of those occur.
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 // Touch devices may fire additional events for the same interaction within a short time.
1439 // Store the previous event until it's safe to assume that subsequent events are for new interactions.
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 // This can happen in scenarios such as when you have a keyup event that blurs the element.
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 // Surface diameter is treated differently for unbounded vs. bounded ripples.
1478 // Unbounded ripple diameter is calculated smaller since the surface is expected to already be padded appropriately
1479 // to extend the hitbox, and the ripple is expected to meet the edges of the padded hitbox (which is typically
1480 // square). Bounded ripples, on the other hand, are fully expected to expand beyond the surface's longest diameter
1481 // (calculated based on the diagonal plus a constant padding), and are clipped at the surface's border via
1482 // `overflow: hidden`.
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 // Ripple is sized as a fraction of the largest dimension of the surface, then scales up using a CSS scale transform
1489 var initialSize = Math.floor(maxDim * MDCRippleFoundation.numbers.INITIAL_ORIGIN_SCALE);
1490 // Unbounded ripple size should always be even number to equally center align.
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);
1518exports.MDCRippleFoundation = MDCRippleFoundation;
1519// tslint:disable-next-line:no-default-export Needed for backward compatibility with MDC Web v0.44.0 and earlier.
1520exports.default = MDCRippleFoundation;
1521
1522/***/ }),
1523
1524/***/ "./packages/mdc-ripple/util.ts":
1525/*!*************************************!*\
1526 !*** ./packages/mdc-ripple/util.ts ***!
1527 \*************************************/
1528/*! no static exports found */
1529/***/ (function(module, exports, __webpack_require__) {
1530
1531"use strict";
1532
1533
1534Object.defineProperty(exports, "__esModule", { value: true });
1535exports.getNormalizedEventCoords = exports.supportsCssVariables = void 0;
1536/**
1537 * Stores result from supportsCssVariables to avoid redundant processing to
1538 * detect CSS custom variable support.
1539 */
1540var supportsCssVariables_;
1541function 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 // See: https://bugs.webkit.org/show_bug.cgi?id=154669
1556 // See: README section on Safari
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}
1564exports.supportsCssVariables = supportsCssVariables;
1565function 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 // Determine touch point relative to the ripple container.
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}
1587exports.getNormalizedEventCoords = getNormalizedEventCoords;
1588
1589/***/ }),
1590
1591/***/ "./packages/mdc-slider/adapter.ts":
1592/*!****************************************!*\
1593 !*** ./packages/mdc-slider/adapter.ts ***!
1594 \****************************************/
1595/*! no static exports found */
1596/***/ (function(module, exports, __webpack_require__) {
1597
1598"use strict";
1599
1600/**
1601 * @license
1602 * Copyright 2020 Google Inc.
1603 *
1604 * Permission is hereby granted, free of charge, to any person obtaining a copy
1605 * of this software and associated documentation files (the "Software"), to deal
1606 * in the Software without restriction, including without limitation the rights
1607 * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
1608 * copies of the Software, and to permit persons to whom the Software is
1609 * furnished to do so, subject to the following conditions:
1610 *
1611 * The above copyright notice and this permission notice shall be included in
1612 * all copies or substantial portions of the Software.
1613 *
1614 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
1615 * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
1616 * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
1617 * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
1618 * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
1619 * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
1620 * THE SOFTWARE.
1621 */
1622
1623Object.defineProperty(exports, "__esModule", { value: true });
1624
1625/***/ }),
1626
1627/***/ "./packages/mdc-slider/component.ts":
1628/*!******************************************!*\
1629 !*** ./packages/mdc-slider/component.ts ***!
1630 \******************************************/
1631/*! no static exports found */
1632/***/ (function(module, exports, __webpack_require__) {
1633
1634"use strict";
1635
1636/**
1637 * @license
1638 * Copyright 2020 Google Inc.
1639 *
1640 * Permission is hereby granted, free of charge, to any person obtaining a copy
1641 * of this software and associated documentation files (the "Software"), to deal
1642 * in the Software without restriction, including without limitation the rights
1643 * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
1644 * copies of the Software, and to permit persons to whom the Software is
1645 * furnished to do so, subject to the following conditions:
1646 *
1647 * The above copyright notice and this permission notice shall be included in
1648 * all copies or substantial portions of the Software.
1649 *
1650 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
1651 * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
1652 * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
1653 * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
1654 * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
1655 * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
1656 * THE SOFTWARE.
1657 */
1658
1659var __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}();
1679var __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};
1691Object.defineProperty(exports, "__esModule", { value: true });
1692exports.MDCSlider = void 0;
1693var component_1 = __webpack_require__(/*! @material/base/component */ "./packages/mdc-base/component.ts");
1694var events_1 = __webpack_require__(/*! @material/dom/events */ "./packages/mdc-dom/events.ts");
1695var ponyfill_1 = __webpack_require__(/*! @material/dom/ponyfill */ "./packages/mdc-dom/ponyfill.ts");
1696var component_2 = __webpack_require__(/*! @material/ripple/component */ "./packages/mdc-ripple/component.ts");
1697var foundation_1 = __webpack_require__(/*! @material/ripple/foundation */ "./packages/mdc-ripple/foundation.ts");
1698var constants_1 = __webpack_require__(/*! ./constants */ "./packages/mdc-slider/constants.ts");
1699var foundation_2 = __webpack_require__(/*! ./foundation */ "./packages/mdc-slider/foundation.ts");
1700var types_1 = __webpack_require__(/*! ./types */ "./packages/mdc-slider/types.ts");
1701/** Vanilla JS implementation of slider component. */
1702var MDCSlider = /** @class */function (_super) {
1703 __extends(MDCSlider, _super);
1704 function MDCSlider() {
1705 var _this = _super !== null && _super.apply(this, arguments) || this;
1706 _this.skipInitialUIUpdate = false;
1707 // Function that maps a slider value to the value of the `aria-valuetext`
1708 // attribute on the thumb element.
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 // tslint:disable:object-literal-sort-keys Methods should be in the same
1721 // order as the adapter interface.
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 // Emitting event is not yet implemented. See issue:
1819 // https://github.com/material-components/material-components-web/issues/6448
1820 _this.getRipple(thumb).activate();
1821 },
1822 emitDragEndEvent: function emitDragEndEvent(_, thumb) {
1823 // Emitting event is not yet implemented. See issue:
1824 // https://github.com/material-components/material-components-web/issues/6448
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 * Initializes component, with the following options:
1862 * - `skipInitialUIUpdate`: Whether to skip updating the UI when initially
1863 * syncing with the DOM. This should be enabled when the slider position
1864 * is set before component initialization.
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 /** Redraws UI based on DOM (e.g. element dimensions, RTL). */
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 /** @return Slider disabled state. */
1897 MDCSlider.prototype.getDisabled = function () {
1898 return this.foundation.getDisabled();
1899 };
1900 /** Sets slider disabled state. */
1901 MDCSlider.prototype.setDisabled = function (disabled) {
1902 this.foundation.setDisabled(disabled);
1903 };
1904 /**
1905 * Sets a function that maps the slider value to the value of the
1906 * `aria-valuetext` attribute on the thumb element.
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 /** Adds tick mark elements to the given container. */
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 /** Updates tick mark elements' classes in the given container. */
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 /** Initializes thumb ripples. */
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 // Use the corresponding input as the focus source for the ripple (i.e.
1951 // when the input is focused, the ripple is in the focused state).
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);
1982exports.MDCSlider = MDCSlider;
1983
1984/***/ }),
1985
1986/***/ "./packages/mdc-slider/constants.ts":
1987/*!******************************************!*\
1988 !*** ./packages/mdc-slider/constants.ts ***!
1989 \******************************************/
1990/*! no static exports found */
1991/***/ (function(module, exports, __webpack_require__) {
1992
1993"use strict";
1994
1995/**
1996 * @license
1997 * Copyright 2020 Google Inc.
1998 *
1999 * Permission is hereby granted, free of charge, to any person obtaining a copy
2000 * of this software and associated documentation files (the "Software"), to deal
2001 * in the Software without restriction, including without limitation the rights
2002 * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
2003 * copies of the Software, and to permit persons to whom the Software is
2004 * furnished to do so, subject to the following conditions:
2005 *
2006 * The above copyright notice and this permission notice shall be included in
2007 * all copies or substantial portions of the Software.
2008 *
2009 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
2010 * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
2011 * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
2012 * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
2013 * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
2014 * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
2015 * THE SOFTWARE.
2016 */
2017
2018Object.defineProperty(exports, "__esModule", { value: true });
2019exports.events = exports.attributes = exports.numbers = exports.cssClasses = void 0;
2020/** Slider element classes. */
2021exports.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 // Applied when thumb is in the focused state.
2028 THUMB_FOCUSED: 'mdc-slider__thumb--focused',
2029 THUMB_KNOB: 'mdc-slider__thumb-knob',
2030 // Class added to the top thumb (for overlapping thumbs in range slider).
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 // The active track fill element that will be scaled as the value changes.
2039 TRACK_ACTIVE: 'mdc-slider__track--active_fill',
2040 VALUE_INDICATOR_TEXT: 'mdc-slider__value-indicator-text'
2041};
2042/** Slider numbers. */
2043exports.numbers = {
2044 // Default step size.
2045 STEP_SIZE: 1,
2046 // Minimum absolute difference between clientX of move event / down event
2047 // for which to update thumb, in the case of overlapping thumbs.
2048 // This is needed to reduce chances of choosing the thumb based on
2049 // pointer jitter.
2050 THUMB_UPDATE_MIN_PX: 5
2051};
2052/** Slider attributes. */
2053exports.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/** Slider events. */
2062exports.events = {
2063 CHANGE: 'MDCSlider:change',
2064 INPUT: 'MDCSlider:input'
2065};
2066
2067/***/ }),
2068
2069/***/ "./packages/mdc-slider/foundation.ts":
2070/*!*******************************************!*\
2071 !*** ./packages/mdc-slider/foundation.ts ***!
2072 \*******************************************/
2073/*! no static exports found */
2074/***/ (function(module, exports, __webpack_require__) {
2075
2076"use strict";
2077
2078/**
2079 * @license
2080 * Copyright 2020 Google Inc.
2081 *
2082 * Permission is hereby granted, free of charge, to any person obtaining a copy
2083 * of this software and associated documentation files (the "Software"), to deal
2084 * in the Software without restriction, including without limitation the rights
2085 * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
2086 * copies of the Software, and to permit persons to whom the Software is
2087 * furnished to do so, subject to the following conditions:
2088 *
2089 * The above copyright notice and this permission notice shall be included in
2090 * all copies or substantial portions of the Software.
2091 *
2092 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
2093 * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
2094 * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
2095 * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
2096 * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
2097 * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
2098 * THE SOFTWARE.
2099 */
2100
2101var __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}();
2121var __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};
2133Object.defineProperty(exports, "__esModule", { value: true });
2134exports.MDCSliderFoundation = void 0;
2135var animationframe_1 = __webpack_require__(/*! @material/animation/animationframe */ "./packages/mdc-animation/animationframe.ts");
2136var util_1 = __webpack_require__(/*! @material/animation/util */ "./packages/mdc-animation/util.ts");
2137var foundation_1 = __webpack_require__(/*! @material/base/foundation */ "./packages/mdc-base/foundation.ts");
2138var constants_1 = __webpack_require__(/*! ./constants */ "./packages/mdc-slider/constants.ts");
2139var types_1 = __webpack_require__(/*! ./types */ "./packages/mdc-slider/types.ts");
2140var AnimationKeys;
2141(function (AnimationKeys) {
2142 AnimationKeys["SLIDER_UPDATE"] = "slider_update";
2143})(AnimationKeys || (AnimationKeys = {}));
2144// Accessing `window` without a `typeof` check will throw on Node environments.
2145var HAS_WINDOW = typeof window !== 'undefined';
2146/**
2147 * Foundation class for slider. Responsibilities include:
2148 * - Updating slider values (internal state and DOM updates) based on client
2149 * 'x' position.
2150 * - Updating DOM after slider property updates (e.g. min, max).
2151 */
2152var MDCSliderFoundation = /** @class */function (_super) {
2153 __extends(MDCSliderFoundation, _super);
2154 function MDCSliderFoundation(adapter) {
2155 var _this = _super.call(this, __assign(__assign({}, MDCSliderFoundation.defaultAdapter), adapter)) || this;
2156 // Whether the initial styles (to position the thumb, before component
2157 // initialization) have been removed.
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 // The following properties are only set for range sliders.
2164 _this.isRange = false;
2165 // Tracks the thumb being moved across a slider pointer interaction (down,
2166 // move event).
2167 _this.thumb = null;
2168 // `clientX` from the most recent down event. Used in subsequent move
2169 // events to determine which thumb to move (in the case of
2170 // overlapping thumbs).
2171 _this.downEventClientX = null;
2172 // Width of the start thumb knob.
2173 _this.startThumbKnobWidth = 0;
2174 // Width of the end thumb knob.
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 // tslint:disable:object-literal-sort-keys Methods should be in the same
2182 // order as the adapter interface.
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 // tslint:enable:object-literal-sort-keys
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 * - For single point sliders, returns the thumb value.
2366 * - For range (two-thumb) sliders, returns the end thumb's value.
2367 */
2368 MDCSliderFoundation.prototype.getValue = function () {
2369 return this.value;
2370 };
2371 /**
2372 * - For single point sliders, sets the thumb value.
2373 * - For range (two-thumb) sliders, sets the end thumb's value.
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 * Only applicable for range sliders.
2383 * @return The start thumb's value.
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 * Only applicable for range sliders. Sets the start thumb's value.
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 * Sets disabled state, including updating styles and thumb tabindex.
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 /** @return Whether the slider is a range slider. */
2429 MDCSliderFoundation.prototype.getIsRange = function () {
2430 return this.isRange;
2431 };
2432 /**
2433 * - Syncs slider boundingClientRect with the current DOM.
2434 * - Updates UI based on internal state.
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 /** Handles resize events on the window. */
2449 MDCSliderFoundation.prototype.handleResize = function () {
2450 this.layout();
2451 };
2452 /**
2453 * Handles pointer down events on the slider root element.
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 * Handles pointer move events on the slider root element.
2469 */
2470 MDCSliderFoundation.prototype.handleMove = function (event) {
2471 if (this.isDisabled) return;
2472 // Prevent scrolling.
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 * Handles pointer up events on the slider root element.
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 * For range, discrete slider, shows the value indicator on both thumbs.
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 * For range, discrete slider, hides the value indicator on both thumbs.
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 // Leave value indicator shown if either input is focused.
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 // After a down event on the slider root, listen for move events on
2522 // body (so the slider value is updated for events outside of the
2523 // slider root).
2524 this.adapter.registerBodyEventHandler(moveEventType, this.moveListener);
2525 var upHandler = function upHandler() {
2526 _this.handleUp();
2527 // Once the drag is finished (up event on body), remove the move
2528 // handler.
2529 _this.adapter.deregisterBodyEventHandler(moveEventType, _this.moveListener);
2530 // Also stop listening for subsequent up events.
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 * Handles input `change` event by setting internal slider value to match
2545 * input's new value.
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 /** Shows activated state and value indicator on thumb(s). */
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 /** Removes activated state and value indicator from thumb(s). */
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 * Emits custom dragStart event, along with focusing the underlying input.
2579 */
2580 MDCSliderFoundation.prototype.handleDragStart = function (event, value, thumb) {
2581 this.adapter.focusInput(thumb);
2582 // Prevent the input (that we just focused) from losing focus.
2583 event.preventDefault();
2584 this.adapter.emitDragStartEvent(value, thumb);
2585 };
2586 /**
2587 * @return The thumb to be moved based on initial down event.
2588 */
2589 MDCSliderFoundation.prototype.getThumbFromDownEvent = function (clientX, value) {
2590 // For single point slider, thumb to be moved is always the END (only)
2591 // thumb.
2592 if (!this.isRange) return types_1.Thumb.END;
2593 // Check if event press point is in the bounds of any thumb.
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 // Thumbs overlapping. Thumb to be moved cannot be determined yet.
2600 return null;
2601 }
2602 // If press is in bounds for either thumb on down event, that's the thumb
2603 // to be moved.
2604 if (inThumbStartBounds) {
2605 return types_1.Thumb.START;
2606 }
2607 if (inThumbEndBounds) {
2608 return types_1.Thumb.END;
2609 }
2610 // For presses outside the range, return whichever thumb is closer.
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 // For presses inside the range, return whichever thumb is closer.
2618 return value - this.valueStart <= this.value - value ? types_1.Thumb.START : types_1.Thumb.END;
2619 };
2620 /**
2621 * @return The thumb to be moved based on move event (based on drag
2622 * direction from original down event). Only applicable if thumbs
2623 * were overlapping in the down event.
2624 */
2625 MDCSliderFoundation.prototype.getThumbFromMoveEvent = function (clientX) {
2626 // Thumb has already been chosen.
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 * Updates UI based on internal state.
2642 * @param thumb Thumb whose value is being updated. If undefined, UI is
2643 * updated for both thumbs based on current internal state.
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 * Updates thumb and input attributes based on current value.
2653 * @param thumb Thumb whose aria attributes to update.
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 // Sync attribute with property.
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 * Updates value indicator UI based on current value.
2676 * @param thumb Thumb whose value indicator to update. If undefined, all
2677 * thumbs' value indicators are updated.
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 * Updates tick marks UI within slider, based on current min, max, and step.
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 /** Maps clientX to a value on the slider scale. */
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 // Fit the percentage complete between the range [min,max]
2708 // by remapping from [0, 1] to [min, min+(max-min)].
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 /** Calculates the quantized value based on step value. */
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 * Updates slider value (internal state and UI) based on the given value.
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 // Exit early if current value is the same as the new value.
2729 if (this.valueStart === value) return;
2730 this.valueStart = value;
2731 } else {
2732 // Exit early if current value is the same as the new value.
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 * Clamps the given value for the given thumb based on slider properties:
2743 * - Restricts value within [min, max].
2744 * - If range slider, clamp start value <= end value, and
2745 * end value >= start value.
2746 */
2747 MDCSliderFoundation.prototype.clampValue = function (value, thumb) {
2748 // Clamp value to [min, max] range.
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 * Updates the active track and thumb style properties to reflect current
2762 * value.
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 // Set active track styles, accounting for animation direction by
2778 // setting `transform-origin`.
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 // Set thumb styles.
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 * Removes initial inline styles if not already removed. `left:<...>%`
2813 * inline styles can be added to position the thumb correctly before JS
2814 * initialization. However, they need to be removed before the JS starts
2815 * positioning the thumb. This is because the JS uses
2816 * `transform:translateX(<...>)px` (for performance reasons) to position
2817 * the thumb (which is not possible for initial styles since we need the
2818 * bounding rect measurements).
2819 */
2820 MDCSliderFoundation.prototype.removeInitialStyles = function (isRtl) {
2821 if (this.initialStylesRemoved) return;
2822 // Remove thumb position properties that were added for initial render.
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 * Resets track/thumb animation to prevent animation when adding
2833 * `transform` styles to thumb initially.
2834 */
2835 MDCSliderFoundation.prototype.resetTrackAndThumbAnimation = function () {
2836 var _this = this;
2837 if (!this.isDiscrete) return;
2838 // Set transition properties to default (no animation), so that the
2839 // newly added `transform` styles do not animate thumb/track from
2840 // their default positions.
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 // In the next frame, remove the transition inline styles we just
2849 // added, such that any animations added in the CSS can now take effect.
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 * Adds THUMB_TOP class to active thumb if thumb knobs overlap; otherwise
2860 * removes THUMB_TOP class from both thumbs.
2861 * @param thumb Thumb that is active (being moved).
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 // If no thumb was dragged (in the case of initial layout), end
2877 // thumb is on top by default.
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 * Converts attribute value to a number, e.g. '100' => 100. Throws errors
2887 * for invalid values.
2888 * @param attributeValue Attribute value, e.g. 100.
2889 * @param attributeName Attribute name, e.g. `aria-valuemax`.
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 /** Checks that the given properties are valid slider values. */
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 // Single point slider.
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 // If supported, use pointer events API with #setPointerCapture.
2941 this.adapter.registerEventHandler('pointerdown', this.pointerdownListener);
2942 this.adapter.registerEventHandler('pointerup', this.pointerupListener);
2943 } else {
2944 // Otherwise, fall back to mousedown/touchstart events.
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 // #setPointerCapture is buggy on iOS, so we can't use pointer events
2989 // until the following bug is fixed:
2990 // https://bugs.webkit.org/show_bug.cgi?id=220196
2991 !isIOS();
2992 return MDCSliderFoundation;
2993}(foundation_1.MDCFoundation);
2994exports.MDCSliderFoundation = MDCSliderFoundation;
2995function isIOS() {
2996 // Source:
2997 // https://stackoverflow.com/questions/9038625/detect-if-device-is-ios
2998 return ['iPad Simulator', 'iPhone Simulator', 'iPod Simulator', 'iPad', 'iPhone', 'iPod'].includes(navigator.platform)
2999 // iPad on iOS 13 detection
3000 || navigator.userAgent.includes('Mac') && 'ontouchend' in document;
3001}
3002/**
3003 * Given a number, returns the number of digits that appear after the
3004 * decimal point.
3005 * See
3006 * https://stackoverflow.com/questions/9539513/is-there-a-reliable-way-in-javascript-to-obtain-the-number-of-decimal-places-of
3007 */
3008function getNumDecimalPlaces(n) {
3009 // Pull out the fraction and the exponent.
3010 var match = /(?:\.(\d+))?(?:[eE]([+\-]?\d+))?$/.exec(String(n));
3011 // NaN or Infinity or integer.
3012 // We arbitrarily decide that Infinity is integral.
3013 if (!match) return 0;
3014 var fraction = match[1] || ''; // E.g. 1.234e-2 => 234
3015 var exponent = match[2] || 0; // E.g. 1.234e-2 => -2
3016 // Count the number of digits in the fraction and subtract the
3017 // exponent to simulate moving the decimal point left by exponent places.
3018 // 1.234e+2 has 1 fraction digit and '234'.length - 2 == 1
3019 // 1.234e-2 has 5 fraction digit and '234'.length - -2 == 5
3020 return Math.max(0, // lower limit
3021 (fraction === '0' ? 0 : fraction.length) - Number(exponent));
3022}
3023
3024/***/ }),
3025
3026/***/ "./packages/mdc-slider/index.ts":
3027/*!**************************************!*\
3028 !*** ./packages/mdc-slider/index.ts ***!
3029 \**************************************/
3030/*! no static exports found */
3031/***/ (function(module, exports, __webpack_require__) {
3032
3033"use strict";
3034
3035/**
3036 * @license
3037 * Copyright 2020 Google Inc.
3038 *
3039 * Permission is hereby granted, free of charge, to any person obtaining a copy
3040 * of this software and associated documentation files (the "Software"), to deal
3041 * in the Software without restriction, including without limitation the rights
3042 * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
3043 * copies of the Software, and to permit persons to whom the Software is
3044 * furnished to do so, subject to the following conditions:
3045 *
3046 * The above copyright notice and this permission notice shall be included in
3047 * all copies or substantial portions of the Software.
3048 *
3049 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
3050 * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
3051 * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
3052 * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
3053 * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
3054 * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
3055 * THE SOFTWARE.
3056 */
3057
3058var __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});
3067var __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};
3072Object.defineProperty(exports, "__esModule", { value: true });
3073__exportStar(__webpack_require__(/*! ./adapter */ "./packages/mdc-slider/adapter.ts"), exports);
3074__exportStar(__webpack_require__(/*! ./component */ "./packages/mdc-slider/component.ts"), exports);
3075__exportStar(__webpack_require__(/*! ./constants */ "./packages/mdc-slider/constants.ts"), exports);
3076__exportStar(__webpack_require__(/*! ./foundation */ "./packages/mdc-slider/foundation.ts"), exports);
3077__exportStar(__webpack_require__(/*! ./types */ "./packages/mdc-slider/types.ts"), exports);
3078
3079/***/ }),
3080
3081/***/ "./packages/mdc-slider/types.ts":
3082/*!**************************************!*\
3083 !*** ./packages/mdc-slider/types.ts ***!
3084 \**************************************/
3085/*! no static exports found */
3086/***/ (function(module, exports, __webpack_require__) {
3087
3088"use strict";
3089
3090/**
3091 * @license
3092 * Copyright 2020 Google Inc.
3093 *
3094 * Permission is hereby granted, free of charge, to any person obtaining a copy
3095 * of this software and associated documentation files (the "Software"), to deal
3096 * in the Software without restriction, including without limitation the rights
3097 * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
3098 * copies of the Software, and to permit persons to whom the Software is
3099 * furnished to do so, subject to the following conditions:
3100 *
3101 * The above copyright notice and this permission notice shall be included in
3102 * all copies or substantial portions of the Software.
3103 *
3104 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
3105 * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
3106 * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
3107 * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
3108 * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
3109 * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
3110 * THE SOFTWARE.
3111 */
3112
3113Object.defineProperty(exports, "__esModule", { value: true });
3114exports.Thumb = exports.TickMark = void 0;
3115/** Tick mark enum, for discrete sliders. */
3116var TickMark;
3117(function (TickMark) {
3118 TickMark[TickMark["ACTIVE"] = 0] = "ACTIVE";
3119 TickMark[TickMark["INACTIVE"] = 1] = "INACTIVE";
3120})(TickMark = exports.TickMark || (exports.TickMark = {}));
3121/**
3122 * Thumb types: range slider has two thumbs (START, END) whereas single point
3123 * slider only has one thumb (END).
3124 */
3125var Thumb;
3126(function (Thumb) {
3127 // Thumb at start of slider (e.g. in LTR mode, left thumb on range slider).
3128 Thumb[Thumb["START"] = 1] = "START";
3129 // Thumb at end of slider (e.g. in LTR mode, right thumb on range slider,
3130 // or only thumb on single point slider).
3131 Thumb[Thumb["END"] = 2] = "END";
3132})(Thumb = exports.Thumb || (exports.Thumb = {}));
3133
3134/***/ })
3135
3136/******/ });
3137});
3138//# sourceMappingURL=mdc.slider.js.map
\No newline at end of file