@material/slider
Advanced tools
Comparing version 1.1.0 to 2.3.0
@@ -32,2 +32,3 @@ // Generated by dts-bundle v0.7.3 | ||
export * from '@material/slider/component'; | ||
export * from '@material/slider/constants'; | ||
export * from '@material/slider/foundation'; | ||
@@ -213,2 +214,54 @@ } | ||
declare module '@material/slider/constants' { | ||
/** | ||
* @license | ||
* Copyright 2017 Google Inc. | ||
* | ||
* Permission is hereby granted, free of charge, to any person obtaining a copy | ||
* of this software and associated documentation files (the "Software"), to deal | ||
* in the Software without restriction, including without limitation the rights | ||
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell | ||
* copies of the Software, and to permit persons to whom the Software is | ||
* furnished to do so, subject to the following conditions: | ||
* | ||
* The above copyright notice and this permission notice shall be included in | ||
* all copies or substantial portions of the Software. | ||
* | ||
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR | ||
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, | ||
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE | ||
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER | ||
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, | ||
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN | ||
* THE SOFTWARE. | ||
*/ | ||
const cssClasses: { | ||
ACTIVE: string; | ||
DISABLED: string; | ||
DISCRETE: string; | ||
FOCUS: string; | ||
HAS_TRACK_MARKER: string; | ||
IN_TRANSIT: string; | ||
IS_DISCRETE: string; | ||
}; | ||
const strings: { | ||
ARIA_DISABLED: string; | ||
ARIA_VALUEMAX: string; | ||
ARIA_VALUEMIN: string; | ||
ARIA_VALUENOW: string; | ||
CHANGE_EVENT: string; | ||
INPUT_EVENT: string; | ||
LAST_TRACK_MARKER_SELECTOR: string; | ||
PIN_VALUE_MARKER_SELECTOR: string; | ||
STEP_DATA_ATTR: string; | ||
THUMB_CONTAINER_SELECTOR: string; | ||
TRACK_MARKER_CONTAINER_SELECTOR: string; | ||
TRACK_SELECTOR: string; | ||
}; | ||
const numbers: { | ||
PAGE_FACTOR: number; | ||
}; | ||
export { cssClasses, strings, numbers }; | ||
} | ||
declare module '@material/slider/foundation' { | ||
@@ -215,0 +268,0 @@ /** |
@@ -1,1366 +0,1050 @@ | ||
/*! | ||
Material Components for the Web | ||
Copyright (c) 2019 Google Inc. | ||
License: MIT | ||
*/ | ||
(function webpackUniversalModuleDefinition(root, factory) { | ||
if(typeof exports === 'object' && typeof module === 'object') | ||
module.exports = factory(); | ||
else if(typeof define === 'function' && define.amd) | ||
define([], factory); | ||
else if(typeof exports === 'object') | ||
exports["slider"] = factory(); | ||
else | ||
root["mdc"] = root["mdc"] || {}, root["mdc"]["slider"] = factory(); | ||
})(this, function() { | ||
return /******/ (function(modules) { // webpackBootstrap | ||
/******/ // The module cache | ||
/******/ var installedModules = {}; | ||
/******/ | ||
/******/ // The require function | ||
/******/ function __webpack_require__(moduleId) { | ||
/******/ | ||
/******/ // Check if module is in cache | ||
/******/ if(installedModules[moduleId]) { | ||
/******/ return installedModules[moduleId].exports; | ||
/******/ } | ||
/******/ // Create a new module (and put it into the cache) | ||
/******/ var module = installedModules[moduleId] = { | ||
/******/ i: moduleId, | ||
/******/ l: false, | ||
/******/ exports: {} | ||
/******/ }; | ||
/******/ | ||
/******/ // Execute the module function | ||
/******/ modules[moduleId].call(module.exports, module, module.exports, __webpack_require__); | ||
/******/ | ||
/******/ // Flag the module as loaded | ||
/******/ module.l = true; | ||
/******/ | ||
/******/ // Return the exports of the module | ||
/******/ return module.exports; | ||
/******/ } | ||
/******/ | ||
/******/ | ||
/******/ // expose the modules object (__webpack_modules__) | ||
/******/ __webpack_require__.m = modules; | ||
/******/ | ||
/******/ // expose the module cache | ||
/******/ __webpack_require__.c = installedModules; | ||
/******/ | ||
/******/ // define getter function for harmony exports | ||
/******/ __webpack_require__.d = function(exports, name, getter) { | ||
/******/ if(!__webpack_require__.o(exports, name)) { | ||
/******/ Object.defineProperty(exports, name, { | ||
/******/ configurable: false, | ||
/******/ enumerable: true, | ||
/******/ get: getter | ||
/******/ }); | ||
/******/ } | ||
/******/ }; | ||
/******/ | ||
/******/ // getDefaultExport function for compatibility with non-harmony modules | ||
/******/ __webpack_require__.n = function(module) { | ||
/******/ var getter = module && module.__esModule ? | ||
/******/ function getDefault() { return module['default']; } : | ||
/******/ function getModuleExports() { return module; }; | ||
/******/ __webpack_require__.d(getter, 'a', getter); | ||
/******/ return getter; | ||
/******/ }; | ||
/******/ | ||
/******/ // Object.prototype.hasOwnProperty.call | ||
/******/ __webpack_require__.o = function(object, property) { return Object.prototype.hasOwnProperty.call(object, property); }; | ||
/******/ | ||
/******/ // __webpack_public_path__ | ||
/******/ __webpack_require__.p = ""; | ||
/******/ | ||
/******/ // Load entry module and return exports | ||
/******/ return __webpack_require__(__webpack_require__.s = 146); | ||
/******/ }) | ||
/************************************************************************/ | ||
/******/ ({ | ||
/***/ 0: | ||
/***/ (function(module, exports, __webpack_require__) { | ||
"use strict"; | ||
/** | ||
* @license | ||
* Copyright 2016 Google Inc. | ||
* Copyright Google LLC All Rights Reserved. | ||
* | ||
* Permission is hereby granted, free of charge, to any person obtaining a copy | ||
* of this software and associated documentation files (the "Software"), to deal | ||
* in the Software without restriction, including without limitation the rights | ||
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell | ||
* copies of the Software, and to permit persons to whom the Software is | ||
* furnished to do so, subject to the following conditions: | ||
* | ||
* The above copyright notice and this permission notice shall be included in | ||
* all copies or substantial portions of the Software. | ||
* | ||
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR | ||
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, | ||
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE | ||
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER | ||
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, | ||
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN | ||
* THE SOFTWARE. | ||
* Use of this source code is governed by an MIT-style license that can be | ||
* found in the LICENSE file at https://github.com/material-components/material-components-web/blob/master/LICENSE | ||
*/ | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
var MDCFoundation = /** @class */function () { | ||
function MDCFoundation(adapter) { | ||
if (adapter === void 0) { | ||
adapter = {}; | ||
} | ||
this.adapter_ = adapter; | ||
} | ||
Object.defineProperty(MDCFoundation, "cssClasses", { | ||
get: function get() { | ||
// Classes extending MDCFoundation should implement this method to return an object which exports every | ||
// CSS class the foundation class needs as a property. e.g. {ACTIVE: 'mdc-component--active'} | ||
return {}; | ||
}, | ||
enumerable: true, | ||
configurable: true | ||
}); | ||
Object.defineProperty(MDCFoundation, "strings", { | ||
get: function get() { | ||
// Classes extending MDCFoundation should implement this method to return an object which exports all | ||
// semantic strings as constants. e.g. {ARIA_ROLE: 'tablist'} | ||
return {}; | ||
}, | ||
enumerable: true, | ||
configurable: true | ||
}); | ||
Object.defineProperty(MDCFoundation, "numbers", { | ||
get: function get() { | ||
// Classes extending MDCFoundation should implement this method to return an object which exports all | ||
// of its semantic numbers as constants. e.g. {ANIMATION_DELAY_MS: 350} | ||
return {}; | ||
}, | ||
enumerable: true, | ||
configurable: true | ||
}); | ||
Object.defineProperty(MDCFoundation, "defaultAdapter", { | ||
get: function get() { | ||
// Classes extending MDCFoundation may choose to implement this getter in order to provide a convenient | ||
// way of viewing the necessary methods of an adapter. In the future, this could also be used for adapter | ||
// validation. | ||
return {}; | ||
}, | ||
enumerable: true, | ||
configurable: true | ||
}); | ||
MDCFoundation.prototype.init = function () { | ||
// Subclasses should override this method to perform initialization routines (registering events, etc.) | ||
}; | ||
MDCFoundation.prototype.destroy = function () { | ||
// Subclasses should override this method to perform de-initialization routines (de-registering events, etc.) | ||
}; | ||
return MDCFoundation; | ||
}(); | ||
exports.MDCFoundation = MDCFoundation; | ||
// tslint:disable-next-line:no-default-export Needed for backward compatibility with MDC Web v0.44.0 and earlier. | ||
exports.default = MDCFoundation; | ||
/***/ }), | ||
/***/ 1: | ||
/***/ (function(module, exports, __webpack_require__) { | ||
"use strict"; | ||
/** | ||
* @license | ||
* Copyright 2016 Google Inc. | ||
* | ||
* Permission is hereby granted, free of charge, to any person obtaining a copy | ||
* of this software and associated documentation files (the "Software"), to deal | ||
* in the Software without restriction, including without limitation the rights | ||
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell | ||
* copies of the Software, and to permit persons to whom the Software is | ||
* furnished to do so, subject to the following conditions: | ||
* | ||
* The above copyright notice and this permission notice shall be included in | ||
* all copies or substantial portions of the Software. | ||
* | ||
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR | ||
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, | ||
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE | ||
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER | ||
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, | ||
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN | ||
* THE SOFTWARE. | ||
*/ | ||
var __read = this && this.__read || function (o, n) { | ||
var m = typeof Symbol === "function" && o[Symbol.iterator]; | ||
if (!m) return o; | ||
var i = m.call(o), | ||
r, | ||
ar = [], | ||
e; | ||
try { | ||
while ((n === void 0 || n-- > 0) && !(r = i.next()).done) { | ||
ar.push(r.value); | ||
} | ||
} catch (error) { | ||
e = { error: error }; | ||
} finally { | ||
try { | ||
if (r && !r.done && (m = i["return"])) m.call(i); | ||
} finally { | ||
if (e) throw e.error; | ||
} | ||
} | ||
return ar; | ||
}; | ||
var __spread = this && this.__spread || function () { | ||
for (var ar = [], i = 0; i < arguments.length; i++) { | ||
ar = ar.concat(__read(arguments[i])); | ||
}return ar; | ||
}; | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
var foundation_1 = __webpack_require__(0); | ||
var MDCComponent = /** @class */function () { | ||
function MDCComponent(root, foundation) { | ||
var args = []; | ||
for (var _i = 2; _i < arguments.length; _i++) { | ||
args[_i - 2] = arguments[_i]; | ||
} | ||
this.root_ = root; | ||
this.initialize.apply(this, __spread(args)); | ||
// Note that we initialize foundation here and not within the constructor's default param so that | ||
// this.root_ is defined and can be used within the foundation class. | ||
this.foundation_ = foundation === undefined ? this.getDefaultFoundation() : foundation; | ||
this.foundation_.init(); | ||
this.initialSyncWithDOM(); | ||
} | ||
MDCComponent.attachTo = function (root) { | ||
// Subclasses which extend MDCBase should provide an attachTo() method that takes a root element and | ||
// returns an instantiated component with its root set to that element. Also note that in the cases of | ||
// subclasses, an explicit foundation class will not have to be passed in; it will simply be initialized | ||
// from getDefaultFoundation(). | ||
return new MDCComponent(root, new foundation_1.MDCFoundation({})); | ||
}; | ||
/* istanbul ignore next: method param only exists for typing purposes; it does not need to be unit tested */ | ||
MDCComponent.prototype.initialize = function () { | ||
var _args = []; | ||
for (var _i = 0; _i < arguments.length; _i++) { | ||
_args[_i] = arguments[_i]; | ||
} | ||
// Subclasses can override this to do any additional setup work that would be considered part of a | ||
// "constructor". Essentially, it is a hook into the parent constructor before the foundation is | ||
// initialized. Any additional arguments besides root and foundation will be passed in here. | ||
}; | ||
MDCComponent.prototype.getDefaultFoundation = function () { | ||
// Subclasses must override this method to return a properly configured foundation class for the | ||
// component. | ||
throw new Error('Subclasses must override getDefaultFoundation to return a properly configured ' + 'foundation class'); | ||
}; | ||
MDCComponent.prototype.initialSyncWithDOM = function () { | ||
// Subclasses should override this method if they need to perform work to synchronize with a host DOM | ||
// object. An example of this would be a form control wrapper that needs to synchronize its internal state | ||
// to some property or attribute of the host DOM. Please note: this is *not* the place to perform DOM | ||
// reads/writes that would cause layout / paint, as this is called synchronously from within the constructor. | ||
}; | ||
MDCComponent.prototype.destroy = function () { | ||
// Subclasses may implement this method to release any resources / deregister any listeners they have | ||
// attached. An example of this might be deregistering a resize event from the window object. | ||
this.foundation_.destroy(); | ||
}; | ||
MDCComponent.prototype.listen = function (evtType, handler) { | ||
this.root_.addEventListener(evtType, handler); | ||
}; | ||
MDCComponent.prototype.unlisten = function (evtType, handler) { | ||
this.root_.removeEventListener(evtType, handler); | ||
}; | ||
/** | ||
* Fires a cross-browser-compatible custom event from the component root of the given type, with the given data. | ||
*/ | ||
MDCComponent.prototype.emit = function (evtType, evtData, shouldBubble) { | ||
if (shouldBubble === void 0) { | ||
shouldBubble = false; | ||
} | ||
var evt; | ||
if (typeof CustomEvent === 'function') { | ||
evt = new CustomEvent(evtType, { | ||
bubbles: shouldBubble, | ||
detail: evtData | ||
}); | ||
} else { | ||
evt = document.createEvent('CustomEvent'); | ||
evt.initCustomEvent(evtType, shouldBubble, false, evtData); | ||
} | ||
this.root_.dispatchEvent(evt); | ||
}; | ||
return MDCComponent; | ||
}(); | ||
exports.MDCComponent = MDCComponent; | ||
// tslint:disable-next-line:no-default-export Needed for backward compatibility with MDC Web v0.44.0 and earlier. | ||
exports.default = MDCComponent; | ||
/***/ }), | ||
/***/ 14: | ||
/***/ (function(module, exports, __webpack_require__) { | ||
"use strict"; | ||
/** | ||
* @license | ||
* Copyright 2016 Google Inc. | ||
* | ||
* Permission is hereby granted, free of charge, to any person obtaining a copy | ||
* of this software and associated documentation files (the "Software"), to deal | ||
* in the Software without restriction, including without limitation the rights | ||
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell | ||
* copies of the Software, and to permit persons to whom the Software is | ||
* furnished to do so, subject to the following conditions: | ||
* | ||
* The above copyright notice and this permission notice shall be included in | ||
* all copies or substantial portions of the Software. | ||
* | ||
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR | ||
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, | ||
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE | ||
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER | ||
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, | ||
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN | ||
* THE SOFTWARE. | ||
*/ | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
var cssPropertyNameMap = { | ||
animation: { | ||
prefixed: '-webkit-animation', | ||
standard: 'animation' | ||
}, | ||
transform: { | ||
prefixed: '-webkit-transform', | ||
standard: 'transform' | ||
}, | ||
transition: { | ||
prefixed: '-webkit-transition', | ||
standard: 'transition' | ||
} | ||
}; | ||
var jsEventTypeMap = { | ||
animationend: { | ||
cssProperty: 'animation', | ||
prefixed: 'webkitAnimationEnd', | ||
standard: 'animationend' | ||
}, | ||
animationiteration: { | ||
cssProperty: 'animation', | ||
prefixed: 'webkitAnimationIteration', | ||
standard: 'animationiteration' | ||
}, | ||
animationstart: { | ||
cssProperty: 'animation', | ||
prefixed: 'webkitAnimationStart', | ||
standard: 'animationstart' | ||
}, | ||
transitionend: { | ||
cssProperty: 'transition', | ||
prefixed: 'webkitTransitionEnd', | ||
standard: 'transitionend' | ||
} | ||
}; | ||
function isWindow(windowObj) { | ||
return Boolean(windowObj.document) && typeof windowObj.document.createElement === 'function'; | ||
} | ||
function getCorrectPropertyName(windowObj, cssProperty) { | ||
if (isWindow(windowObj) && cssProperty in cssPropertyNameMap) { | ||
var el = windowObj.document.createElement('div'); | ||
var _a = cssPropertyNameMap[cssProperty], | ||
standard = _a.standard, | ||
prefixed = _a.prefixed; | ||
var isStandard = standard in el.style; | ||
return isStandard ? standard : prefixed; | ||
} | ||
return cssProperty; | ||
} | ||
exports.getCorrectPropertyName = getCorrectPropertyName; | ||
function getCorrectEventName(windowObj, eventType) { | ||
if (isWindow(windowObj) && eventType in jsEventTypeMap) { | ||
var el = windowObj.document.createElement('div'); | ||
var _a = jsEventTypeMap[eventType], | ||
standard = _a.standard, | ||
prefixed = _a.prefixed, | ||
cssProperty = _a.cssProperty; | ||
var isStandard = cssProperty in el.style; | ||
return isStandard ? standard : prefixed; | ||
} | ||
return eventType; | ||
} | ||
exports.getCorrectEventName = getCorrectEventName; | ||
/***/ }), | ||
/***/ 146: | ||
/***/ (function(module, exports, __webpack_require__) { | ||
"use strict"; | ||
/** | ||
* @license | ||
* Copyright 2019 Google Inc. | ||
* | ||
* Permission is hereby granted, free of charge, to any person obtaining a copy | ||
* of this software and associated documentation files (the "Software"), to deal | ||
* in the Software without restriction, including without limitation the rights | ||
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell | ||
* copies of the Software, and to permit persons to whom the Software is | ||
* furnished to do so, subject to the following conditions: | ||
* | ||
* The above copyright notice and this permission notice shall be included in | ||
* all copies or substantial portions of the Software. | ||
* | ||
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR | ||
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, | ||
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE | ||
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER | ||
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, | ||
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN | ||
* THE SOFTWARE. | ||
*/ | ||
function __export(m) { | ||
for (var p in m) { | ||
if (!exports.hasOwnProperty(p)) exports[p] = m[p]; | ||
} | ||
} | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
__export(__webpack_require__(147)); | ||
__export(__webpack_require__(81)); | ||
/***/ }), | ||
/***/ 147: | ||
/***/ (function(module, exports, __webpack_require__) { | ||
"use strict"; | ||
/** | ||
* @license | ||
* Copyright 2017 Google Inc. | ||
* | ||
* Permission is hereby granted, free of charge, to any person obtaining a copy | ||
* of this software and associated documentation files (the "Software"), to deal | ||
* in the Software without restriction, including without limitation the rights | ||
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell | ||
* copies of the Software, and to permit persons to whom the Software is | ||
* furnished to do so, subject to the following conditions: | ||
* | ||
* The above copyright notice and this permission notice shall be included in | ||
* all copies or substantial portions of the Software. | ||
* | ||
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR | ||
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, | ||
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE | ||
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER | ||
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, | ||
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN | ||
* THE SOFTWARE. | ||
*/ | ||
var __extends = this && this.__extends || function () { | ||
var _extendStatics = function extendStatics(d, b) { | ||
_extendStatics = Object.setPrototypeOf || { __proto__: [] } instanceof Array && function (d, b) { | ||
d.__proto__ = b; | ||
} || function (d, b) { | ||
for (var p in b) { | ||
if (b.hasOwnProperty(p)) d[p] = b[p]; | ||
(function webpackUniversalModuleDefinition(root, factory) { | ||
if (typeof exports === "object" && typeof module === "object") module.exports = factory(); else if (typeof define === "function" && define.amd) define([], factory); else if (typeof exports === "object") exports["slider"] = factory(); else root["mdc"] = root["mdc"] || {}, | ||
root["mdc"]["slider"] = factory(); | ||
})(this, function() { | ||
return function(modules) { | ||
var installedModules = {}; | ||
function __webpack_require__(moduleId) { | ||
if (installedModules[moduleId]) { | ||
return installedModules[moduleId].exports; | ||
} | ||
}; | ||
return _extendStatics(d, b); | ||
}; | ||
return function (d, b) { | ||
_extendStatics(d, b); | ||
function __() { | ||
this.constructor = d; | ||
var module = installedModules[moduleId] = { | ||
i: moduleId, | ||
l: false, | ||
exports: {} | ||
}; | ||
modules[moduleId].call(module.exports, module, module.exports, __webpack_require__); | ||
module.l = true; | ||
return module.exports; | ||
} | ||
d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); | ||
}; | ||
}(); | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
var component_1 = __webpack_require__(1); | ||
var constants_1 = __webpack_require__(80); | ||
var foundation_1 = __webpack_require__(81); | ||
var MDCSlider = /** @class */function (_super) { | ||
__extends(MDCSlider, _super); | ||
function MDCSlider() { | ||
return _super !== null && _super.apply(this, arguments) || this; | ||
} | ||
MDCSlider.attachTo = function (root) { | ||
return new MDCSlider(root); | ||
}; | ||
Object.defineProperty(MDCSlider.prototype, "value", { | ||
get: function get() { | ||
return this.foundation_.getValue(); | ||
}, | ||
set: function set(value) { | ||
this.foundation_.setValue(value); | ||
}, | ||
enumerable: true, | ||
configurable: true | ||
}); | ||
Object.defineProperty(MDCSlider.prototype, "min", { | ||
get: function get() { | ||
return this.foundation_.getMin(); | ||
}, | ||
set: function set(min) { | ||
this.foundation_.setMin(min); | ||
}, | ||
enumerable: true, | ||
configurable: true | ||
}); | ||
Object.defineProperty(MDCSlider.prototype, "max", { | ||
get: function get() { | ||
return this.foundation_.getMax(); | ||
}, | ||
set: function set(max) { | ||
this.foundation_.setMax(max); | ||
}, | ||
enumerable: true, | ||
configurable: true | ||
}); | ||
Object.defineProperty(MDCSlider.prototype, "step", { | ||
get: function get() { | ||
return this.foundation_.getStep(); | ||
}, | ||
set: function set(step) { | ||
this.foundation_.setStep(step); | ||
}, | ||
enumerable: true, | ||
configurable: true | ||
}); | ||
Object.defineProperty(MDCSlider.prototype, "disabled", { | ||
get: function get() { | ||
return this.foundation_.isDisabled(); | ||
}, | ||
set: function set(disabled) { | ||
this.foundation_.setDisabled(disabled); | ||
}, | ||
enumerable: true, | ||
configurable: true | ||
}); | ||
MDCSlider.prototype.initialize = function () { | ||
this.thumbContainer_ = this.root_.querySelector(constants_1.strings.THUMB_CONTAINER_SELECTOR); | ||
this.track_ = this.root_.querySelector(constants_1.strings.TRACK_SELECTOR); | ||
this.pinValueMarker_ = this.root_.querySelector(constants_1.strings.PIN_VALUE_MARKER_SELECTOR); | ||
this.trackMarkerContainer_ = this.root_.querySelector(constants_1.strings.TRACK_MARKER_CONTAINER_SELECTOR); | ||
}; | ||
MDCSlider.prototype.getDefaultFoundation = function () { | ||
var _this = this; | ||
// DO NOT INLINE this variable. For backward compatibility, foundations take a Partial<MDCFooAdapter>. | ||
// To ensure we don't accidentally omit any methods, we need a separate, strongly typed adapter variable. | ||
// tslint:disable:object-literal-sort-keys Methods should be in the same order as the adapter interface. | ||
var adapter = { | ||
hasClass: function hasClass(className) { | ||
return _this.root_.classList.contains(className); | ||
}, | ||
addClass: function addClass(className) { | ||
return _this.root_.classList.add(className); | ||
}, | ||
removeClass: function removeClass(className) { | ||
return _this.root_.classList.remove(className); | ||
}, | ||
getAttribute: function getAttribute(name) { | ||
return _this.root_.getAttribute(name); | ||
}, | ||
setAttribute: function setAttribute(name, value) { | ||
return _this.root_.setAttribute(name, value); | ||
}, | ||
removeAttribute: function removeAttribute(name) { | ||
return _this.root_.removeAttribute(name); | ||
}, | ||
computeBoundingRect: function computeBoundingRect() { | ||
return _this.root_.getBoundingClientRect(); | ||
}, | ||
getTabIndex: function getTabIndex() { | ||
return _this.root_.tabIndex; | ||
}, | ||
registerInteractionHandler: function registerInteractionHandler(evtType, handler) { | ||
return _this.listen(evtType, handler); | ||
}, | ||
deregisterInteractionHandler: function deregisterInteractionHandler(evtType, handler) { | ||
return _this.unlisten(evtType, handler); | ||
}, | ||
registerThumbContainerInteractionHandler: function registerThumbContainerInteractionHandler(evtType, handler) { | ||
_this.thumbContainer_.addEventListener(evtType, handler); | ||
}, | ||
deregisterThumbContainerInteractionHandler: function deregisterThumbContainerInteractionHandler(evtType, handler) { | ||
_this.thumbContainer_.removeEventListener(evtType, handler); | ||
}, | ||
registerBodyInteractionHandler: function registerBodyInteractionHandler(evtType, handler) { | ||
return document.body.addEventListener(evtType, handler); | ||
}, | ||
deregisterBodyInteractionHandler: function deregisterBodyInteractionHandler(evtType, handler) { | ||
return document.body.removeEventListener(evtType, handler); | ||
}, | ||
registerResizeHandler: function registerResizeHandler(handler) { | ||
return window.addEventListener('resize', handler); | ||
}, | ||
deregisterResizeHandler: function deregisterResizeHandler(handler) { | ||
return window.removeEventListener('resize', handler); | ||
}, | ||
notifyInput: function notifyInput() { | ||
return _this.emit(constants_1.strings.INPUT_EVENT, _this); | ||
}, | ||
notifyChange: function notifyChange() { | ||
return _this.emit(constants_1.strings.CHANGE_EVENT, _this); | ||
}, | ||
setThumbContainerStyleProperty: function setThumbContainerStyleProperty(propertyName, value) { | ||
_this.thumbContainer_.style.setProperty(propertyName, value); | ||
}, | ||
setTrackStyleProperty: function setTrackStyleProperty(propertyName, value) { | ||
return _this.track_.style.setProperty(propertyName, value); | ||
}, | ||
setMarkerValue: function setMarkerValue(value) { | ||
return _this.pinValueMarker_.innerText = value.toLocaleString(); | ||
}, | ||
appendTrackMarkers: function appendTrackMarkers(numMarkers) { | ||
var frag = document.createDocumentFragment(); | ||
for (var i = 0; i < numMarkers; i++) { | ||
var marker = document.createElement('div'); | ||
marker.classList.add('mdc-slider__track-marker'); | ||
frag.appendChild(marker); | ||
} | ||
_this.trackMarkerContainer_.appendChild(frag); | ||
}, | ||
removeTrackMarkers: function removeTrackMarkers() { | ||
while (_this.trackMarkerContainer_.firstChild) { | ||
_this.trackMarkerContainer_.removeChild(_this.trackMarkerContainer_.firstChild); | ||
} | ||
}, | ||
setLastTrackMarkersStyleProperty: function setLastTrackMarkersStyleProperty(propertyName, value) { | ||
// We remove and append new nodes, thus, the last track marker must be dynamically found. | ||
var lastTrackMarker = _this.root_.querySelector(constants_1.strings.LAST_TRACK_MARKER_SELECTOR); | ||
lastTrackMarker.style.setProperty(propertyName, value); | ||
}, | ||
isRTL: function isRTL() { | ||
return getComputedStyle(_this.root_).direction === 'rtl'; | ||
__webpack_require__.m = modules; | ||
__webpack_require__.c = installedModules; | ||
__webpack_require__.d = function(exports, name, getter) { | ||
if (!__webpack_require__.o(exports, name)) { | ||
Object.defineProperty(exports, name, { | ||
configurable: false, | ||
enumerable: true, | ||
get: getter | ||
}); | ||
} | ||
}; | ||
// tslint:enable:object-literal-sort-keys | ||
return new foundation_1.MDCSliderFoundation(adapter); | ||
}; | ||
MDCSlider.prototype.initialSyncWithDOM = function () { | ||
var origValueNow = this.parseFloat_(this.root_.getAttribute(constants_1.strings.ARIA_VALUENOW), this.value); | ||
var min = this.parseFloat_(this.root_.getAttribute(constants_1.strings.ARIA_VALUEMIN), this.min); | ||
var max = this.parseFloat_(this.root_.getAttribute(constants_1.strings.ARIA_VALUEMAX), this.max); | ||
// min and max need to be set in the right order to avoid throwing an error | ||
// when the new min is greater than the default max. | ||
if (min >= this.max) { | ||
this.max = max; | ||
this.min = min; | ||
} else { | ||
this.min = min; | ||
this.max = max; | ||
} | ||
this.step = this.parseFloat_(this.root_.getAttribute(constants_1.strings.STEP_DATA_ATTR), this.step); | ||
this.value = origValueNow; | ||
this.disabled = this.root_.hasAttribute(constants_1.strings.ARIA_DISABLED) && this.root_.getAttribute(constants_1.strings.ARIA_DISABLED) !== 'false'; | ||
this.foundation_.setupTrackMarker(); | ||
}; | ||
MDCSlider.prototype.layout = function () { | ||
this.foundation_.layout(); | ||
}; | ||
MDCSlider.prototype.stepUp = function (amount) { | ||
if (amount === void 0) { | ||
amount = this.step || 1; | ||
} | ||
this.value += amount; | ||
}; | ||
MDCSlider.prototype.stepDown = function (amount) { | ||
if (amount === void 0) { | ||
amount = this.step || 1; | ||
} | ||
this.value -= amount; | ||
}; | ||
MDCSlider.prototype.parseFloat_ = function (str, defaultValue) { | ||
var num = parseFloat(str); // tslint:disable-line:ban | ||
var isNumeric = typeof num === 'number' && isFinite(num); | ||
return isNumeric ? num : defaultValue; | ||
}; | ||
return MDCSlider; | ||
}(component_1.MDCComponent); | ||
exports.MDCSlider = MDCSlider; | ||
/***/ }), | ||
/***/ 80: | ||
/***/ (function(module, exports, __webpack_require__) { | ||
"use strict"; | ||
/** | ||
* @license | ||
* Copyright 2017 Google Inc. | ||
* | ||
* Permission is hereby granted, free of charge, to any person obtaining a copy | ||
* of this software and associated documentation files (the "Software"), to deal | ||
* in the Software without restriction, including without limitation the rights | ||
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell | ||
* copies of the Software, and to permit persons to whom the Software is | ||
* furnished to do so, subject to the following conditions: | ||
* | ||
* The above copyright notice and this permission notice shall be included in | ||
* all copies or substantial portions of the Software. | ||
* | ||
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR | ||
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, | ||
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE | ||
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER | ||
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, | ||
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN | ||
* THE SOFTWARE. | ||
*/ | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
var cssClasses = { | ||
ACTIVE: 'mdc-slider--active', | ||
DISABLED: 'mdc-slider--disabled', | ||
DISCRETE: 'mdc-slider--discrete', | ||
FOCUS: 'mdc-slider--focus', | ||
HAS_TRACK_MARKER: 'mdc-slider--display-markers', | ||
IN_TRANSIT: 'mdc-slider--in-transit', | ||
IS_DISCRETE: 'mdc-slider--discrete' | ||
}; | ||
exports.cssClasses = cssClasses; | ||
var strings = { | ||
ARIA_DISABLED: 'aria-disabled', | ||
ARIA_VALUEMAX: 'aria-valuemax', | ||
ARIA_VALUEMIN: 'aria-valuemin', | ||
ARIA_VALUENOW: 'aria-valuenow', | ||
CHANGE_EVENT: 'MDCSlider:change', | ||
INPUT_EVENT: 'MDCSlider:input', | ||
LAST_TRACK_MARKER_SELECTOR: '.mdc-slider__track-marker:last-child', | ||
PIN_VALUE_MARKER_SELECTOR: '.mdc-slider__pin-value-marker', | ||
STEP_DATA_ATTR: 'data-step', | ||
THUMB_CONTAINER_SELECTOR: '.mdc-slider__thumb-container', | ||
TRACK_MARKER_CONTAINER_SELECTOR: '.mdc-slider__track-marker-container', | ||
TRACK_SELECTOR: '.mdc-slider__track' | ||
}; | ||
exports.strings = strings; | ||
var numbers = { | ||
PAGE_FACTOR: 4 | ||
}; | ||
exports.numbers = numbers; | ||
/***/ }), | ||
/***/ 81: | ||
/***/ (function(module, exports, __webpack_require__) { | ||
"use strict"; | ||
/** | ||
* @license | ||
* Copyright 2017 Google Inc. | ||
* | ||
* Permission is hereby granted, free of charge, to any person obtaining a copy | ||
* of this software and associated documentation files (the "Software"), to deal | ||
* in the Software without restriction, including without limitation the rights | ||
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell | ||
* copies of the Software, and to permit persons to whom the Software is | ||
* furnished to do so, subject to the following conditions: | ||
* | ||
* The above copyright notice and this permission notice shall be included in | ||
* all copies or substantial portions of the Software. | ||
* | ||
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR | ||
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, | ||
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE | ||
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER | ||
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, | ||
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN | ||
* THE SOFTWARE. | ||
*/ | ||
var __extends = this && this.__extends || function () { | ||
var _extendStatics = function extendStatics(d, b) { | ||
_extendStatics = Object.setPrototypeOf || { __proto__: [] } instanceof Array && function (d, b) { | ||
d.__proto__ = b; | ||
} || function (d, b) { | ||
for (var p in b) { | ||
if (b.hasOwnProperty(p)) d[p] = b[p]; | ||
} | ||
__webpack_require__.n = function(module) { | ||
var getter = module && module.__esModule ? function getDefault() { | ||
return module["default"]; | ||
} : function getModuleExports() { | ||
return module; | ||
}; | ||
__webpack_require__.d(getter, "a", getter); | ||
return getter; | ||
}; | ||
return _extendStatics(d, b); | ||
}; | ||
return function (d, b) { | ||
_extendStatics(d, b); | ||
function __() { | ||
this.constructor = d; | ||
} | ||
d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); | ||
}; | ||
}(); | ||
var __assign = this && this.__assign || function () { | ||
__assign = Object.assign || function (t) { | ||
for (var s, i = 1, n = arguments.length; i < n; i++) { | ||
s = arguments[i]; | ||
for (var p in s) { | ||
if (Object.prototype.hasOwnProperty.call(s, p)) t[p] = s[p]; | ||
} | ||
} | ||
return t; | ||
}; | ||
return __assign.apply(this, arguments); | ||
}; | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
var util_1 = __webpack_require__(14); | ||
var foundation_1 = __webpack_require__(0); | ||
var constants_1 = __webpack_require__(80); | ||
var DOWN_EVENTS = ['mousedown', 'pointerdown', 'touchstart']; | ||
var UP_EVENTS = ['mouseup', 'pointerup', 'touchend']; | ||
var MOVE_EVENT_MAP = { | ||
mousedown: 'mousemove', | ||
pointerdown: 'pointermove', | ||
touchstart: 'touchmove' | ||
}; | ||
var KEY_IDS = { | ||
ARROW_DOWN: 'ArrowDown', | ||
ARROW_LEFT: 'ArrowLeft', | ||
ARROW_RIGHT: 'ArrowRight', | ||
ARROW_UP: 'ArrowUp', | ||
END: 'End', | ||
HOME: 'Home', | ||
PAGE_DOWN: 'PageDown', | ||
PAGE_UP: 'PageUp' | ||
}; | ||
var MDCSliderFoundation = /** @class */function (_super) { | ||
__extends(MDCSliderFoundation, _super); | ||
function MDCSliderFoundation(adapter) { | ||
var _this = _super.call(this, __assign({}, MDCSliderFoundation.defaultAdapter, adapter)) || this; | ||
/** | ||
* We set this to NaN since we want it to be a number, but we can't use '0' or '-1' | ||
* because those could be valid tabindices set by the client code. | ||
*/ | ||
_this.savedTabIndex_ = NaN; | ||
_this.active_ = false; | ||
_this.inTransit_ = false; | ||
_this.isDiscrete_ = false; | ||
_this.hasTrackMarker_ = false; | ||
_this.handlingThumbTargetEvt_ = false; | ||
_this.min_ = 0; | ||
_this.max_ = 100; | ||
_this.step_ = 0; | ||
_this.value_ = 0; | ||
_this.disabled_ = false; | ||
_this.preventFocusState_ = false; | ||
_this.thumbContainerPointerHandler_ = function () { | ||
return _this.handlingThumbTargetEvt_ = true; | ||
__webpack_require__.o = function(object, property) { | ||
return Object.prototype.hasOwnProperty.call(object, property); | ||
}; | ||
_this.interactionStartHandler_ = function (evt) { | ||
return _this.handleDown_(evt); | ||
}; | ||
_this.keydownHandler_ = function (evt) { | ||
return _this.handleKeydown_(evt); | ||
}; | ||
_this.focusHandler_ = function () { | ||
return _this.handleFocus_(); | ||
}; | ||
_this.blurHandler_ = function () { | ||
return _this.handleBlur_(); | ||
}; | ||
_this.resizeHandler_ = function () { | ||
return _this.layout(); | ||
}; | ||
return _this; | ||
} | ||
Object.defineProperty(MDCSliderFoundation, "cssClasses", { | ||
get: function get() { | ||
return constants_1.cssClasses; | ||
__webpack_require__.p = ""; | ||
return __webpack_require__(__webpack_require__.s = 152); | ||
}({ | ||
0: function(module, exports, __webpack_require__) { | ||
"use strict"; | ||
Object.defineProperty(exports, "__esModule", { | ||
value: true | ||
}); | ||
var MDCFoundation = function() { | ||
function MDCFoundation(adapter) { | ||
if (adapter === void 0) { | ||
adapter = {}; | ||
} | ||
this.adapter_ = adapter; | ||
} | ||
Object.defineProperty(MDCFoundation, "cssClasses", { | ||
get: function get() { | ||
return {}; | ||
}, | ||
enumerable: true, | ||
configurable: true | ||
}); | ||
Object.defineProperty(MDCFoundation, "strings", { | ||
get: function get() { | ||
return {}; | ||
}, | ||
enumerable: true, | ||
configurable: true | ||
}); | ||
Object.defineProperty(MDCFoundation, "numbers", { | ||
get: function get() { | ||
return {}; | ||
}, | ||
enumerable: true, | ||
configurable: true | ||
}); | ||
Object.defineProperty(MDCFoundation, "defaultAdapter", { | ||
get: function get() { | ||
return {}; | ||
}, | ||
enumerable: true, | ||
configurable: true | ||
}); | ||
MDCFoundation.prototype.init = function() {}; | ||
MDCFoundation.prototype.destroy = function() {}; | ||
return MDCFoundation; | ||
}(); | ||
exports.MDCFoundation = MDCFoundation; | ||
exports.default = MDCFoundation; | ||
}, | ||
enumerable: true, | ||
configurable: true | ||
}); | ||
Object.defineProperty(MDCSliderFoundation, "strings", { | ||
get: function get() { | ||
return constants_1.strings; | ||
1: function(module, exports, __webpack_require__) { | ||
"use strict"; | ||
var __read = this && this.__read || function(o, n) { | ||
var m = typeof Symbol === "function" && o[Symbol.iterator]; | ||
if (!m) return o; | ||
var i = m.call(o), r, ar = [], e; | ||
try { | ||
while ((n === void 0 || n-- > 0) && !(r = i.next()).done) { | ||
ar.push(r.value); | ||
} | ||
} catch (error) { | ||
e = { | ||
error: error | ||
}; | ||
} finally { | ||
try { | ||
if (r && !r.done && (m = i["return"])) m.call(i); | ||
} finally { | ||
if (e) throw e.error; | ||
} | ||
} | ||
return ar; | ||
}; | ||
var __spread = this && this.__spread || function() { | ||
for (var ar = [], i = 0; i < arguments.length; i++) { | ||
ar = ar.concat(__read(arguments[i])); | ||
} | ||
return ar; | ||
}; | ||
Object.defineProperty(exports, "__esModule", { | ||
value: true | ||
}); | ||
var foundation_1 = __webpack_require__(0); | ||
var MDCComponent = function() { | ||
function MDCComponent(root, foundation) { | ||
var args = []; | ||
for (var _i = 2; _i < arguments.length; _i++) { | ||
args[_i - 2] = arguments[_i]; | ||
} | ||
this.root_ = root; | ||
this.initialize.apply(this, __spread(args)); | ||
this.foundation_ = foundation === undefined ? this.getDefaultFoundation() : foundation; | ||
this.foundation_.init(); | ||
this.initialSyncWithDOM(); | ||
} | ||
MDCComponent.attachTo = function(root) { | ||
return new MDCComponent(root, new foundation_1.MDCFoundation({})); | ||
}; | ||
MDCComponent.prototype.initialize = function() { | ||
var _args = []; | ||
for (var _i = 0; _i < arguments.length; _i++) { | ||
_args[_i] = arguments[_i]; | ||
} | ||
}; | ||
MDCComponent.prototype.getDefaultFoundation = function() { | ||
throw new Error("Subclasses must override getDefaultFoundation to return a properly configured " + "foundation class"); | ||
}; | ||
MDCComponent.prototype.initialSyncWithDOM = function() {}; | ||
MDCComponent.prototype.destroy = function() { | ||
this.foundation_.destroy(); | ||
}; | ||
MDCComponent.prototype.listen = function(evtType, handler) { | ||
this.root_.addEventListener(evtType, handler); | ||
}; | ||
MDCComponent.prototype.unlisten = function(evtType, handler) { | ||
this.root_.removeEventListener(evtType, handler); | ||
}; | ||
MDCComponent.prototype.emit = function(evtType, evtData, shouldBubble) { | ||
if (shouldBubble === void 0) { | ||
shouldBubble = false; | ||
} | ||
var evt; | ||
if (typeof CustomEvent === "function") { | ||
evt = new CustomEvent(evtType, { | ||
bubbles: shouldBubble, | ||
detail: evtData | ||
}); | ||
} else { | ||
evt = document.createEvent("CustomEvent"); | ||
evt.initCustomEvent(evtType, shouldBubble, false, evtData); | ||
} | ||
this.root_.dispatchEvent(evt); | ||
}; | ||
return MDCComponent; | ||
}(); | ||
exports.MDCComponent = MDCComponent; | ||
exports.default = MDCComponent; | ||
}, | ||
enumerable: true, | ||
configurable: true | ||
}); | ||
Object.defineProperty(MDCSliderFoundation, "numbers", { | ||
get: function get() { | ||
return constants_1.numbers; | ||
}, | ||
enumerable: true, | ||
configurable: true | ||
}); | ||
Object.defineProperty(MDCSliderFoundation, "defaultAdapter", { | ||
get: function get() { | ||
// tslint:disable:object-literal-sort-keys Methods should be in the same order as the adapter interface. | ||
return { | ||
hasClass: function hasClass() { | ||
return false; | ||
11: function(module, exports, __webpack_require__) { | ||
"use strict"; | ||
Object.defineProperty(exports, "__esModule", { | ||
value: true | ||
}); | ||
var cssPropertyNameMap = { | ||
animation: { | ||
prefixed: "-webkit-animation", | ||
standard: "animation" | ||
}, | ||
addClass: function addClass() { | ||
return undefined; | ||
transform: { | ||
prefixed: "-webkit-transform", | ||
standard: "transform" | ||
}, | ||
removeClass: function removeClass() { | ||
return undefined; | ||
transition: { | ||
prefixed: "-webkit-transition", | ||
standard: "transition" | ||
} | ||
}; | ||
var jsEventTypeMap = { | ||
animationend: { | ||
cssProperty: "animation", | ||
prefixed: "webkitAnimationEnd", | ||
standard: "animationend" | ||
}, | ||
getAttribute: function getAttribute() { | ||
return null; | ||
animationiteration: { | ||
cssProperty: "animation", | ||
prefixed: "webkitAnimationIteration", | ||
standard: "animationiteration" | ||
}, | ||
setAttribute: function setAttribute() { | ||
return undefined; | ||
animationstart: { | ||
cssProperty: "animation", | ||
prefixed: "webkitAnimationStart", | ||
standard: "animationstart" | ||
}, | ||
removeAttribute: function removeAttribute() { | ||
return undefined; | ||
}, | ||
computeBoundingRect: function computeBoundingRect() { | ||
return { top: 0, right: 0, bottom: 0, left: 0, width: 0, height: 0 }; | ||
}, | ||
getTabIndex: function getTabIndex() { | ||
return 0; | ||
}, | ||
registerInteractionHandler: function registerInteractionHandler() { | ||
return undefined; | ||
}, | ||
deregisterInteractionHandler: function deregisterInteractionHandler() { | ||
return undefined; | ||
}, | ||
registerThumbContainerInteractionHandler: function registerThumbContainerInteractionHandler() { | ||
return undefined; | ||
}, | ||
deregisterThumbContainerInteractionHandler: function deregisterThumbContainerInteractionHandler() { | ||
return undefined; | ||
}, | ||
registerBodyInteractionHandler: function registerBodyInteractionHandler() { | ||
return undefined; | ||
}, | ||
deregisterBodyInteractionHandler: function deregisterBodyInteractionHandler() { | ||
return undefined; | ||
}, | ||
registerResizeHandler: function registerResizeHandler() { | ||
return undefined; | ||
}, | ||
deregisterResizeHandler: function deregisterResizeHandler() { | ||
return undefined; | ||
}, | ||
notifyInput: function notifyInput() { | ||
return undefined; | ||
}, | ||
notifyChange: function notifyChange() { | ||
return undefined; | ||
}, | ||
setThumbContainerStyleProperty: function setThumbContainerStyleProperty() { | ||
return undefined; | ||
}, | ||
setTrackStyleProperty: function setTrackStyleProperty() { | ||
return undefined; | ||
}, | ||
setMarkerValue: function setMarkerValue() { | ||
return undefined; | ||
}, | ||
appendTrackMarkers: function appendTrackMarkers() { | ||
return undefined; | ||
}, | ||
removeTrackMarkers: function removeTrackMarkers() { | ||
return undefined; | ||
}, | ||
setLastTrackMarkersStyleProperty: function setLastTrackMarkersStyleProperty() { | ||
return undefined; | ||
}, | ||
isRTL: function isRTL() { | ||
return false; | ||
transitionend: { | ||
cssProperty: "transition", | ||
prefixed: "webkitTransitionEnd", | ||
standard: "transitionend" | ||
} | ||
}; | ||
// tslint:enable:object-literal-sort-keys | ||
}, | ||
enumerable: true, | ||
configurable: true | ||
}); | ||
MDCSliderFoundation.prototype.init = function () { | ||
var _this = this; | ||
this.isDiscrete_ = this.adapter_.hasClass(constants_1.cssClasses.IS_DISCRETE); | ||
this.hasTrackMarker_ = this.adapter_.hasClass(constants_1.cssClasses.HAS_TRACK_MARKER); | ||
DOWN_EVENTS.forEach(function (evtName) { | ||
_this.adapter_.registerInteractionHandler(evtName, _this.interactionStartHandler_); | ||
_this.adapter_.registerThumbContainerInteractionHandler(evtName, _this.thumbContainerPointerHandler_); | ||
}); | ||
this.adapter_.registerInteractionHandler('keydown', this.keydownHandler_); | ||
this.adapter_.registerInteractionHandler('focus', this.focusHandler_); | ||
this.adapter_.registerInteractionHandler('blur', this.blurHandler_); | ||
this.adapter_.registerResizeHandler(this.resizeHandler_); | ||
this.layout(); | ||
// At last step, provide a reasonable default value to discrete slider | ||
if (this.isDiscrete_ && this.getStep() === 0) { | ||
this.step_ = 1; | ||
} | ||
}; | ||
MDCSliderFoundation.prototype.destroy = function () { | ||
var _this = this; | ||
DOWN_EVENTS.forEach(function (evtName) { | ||
_this.adapter_.deregisterInteractionHandler(evtName, _this.interactionStartHandler_); | ||
_this.adapter_.deregisterThumbContainerInteractionHandler(evtName, _this.thumbContainerPointerHandler_); | ||
}); | ||
this.adapter_.deregisterInteractionHandler('keydown', this.keydownHandler_); | ||
this.adapter_.deregisterInteractionHandler('focus', this.focusHandler_); | ||
this.adapter_.deregisterInteractionHandler('blur', this.blurHandler_); | ||
this.adapter_.deregisterResizeHandler(this.resizeHandler_); | ||
}; | ||
MDCSliderFoundation.prototype.setupTrackMarker = function () { | ||
if (this.isDiscrete_ && this.hasTrackMarker_ && this.getStep() !== 0) { | ||
var min = this.getMin(); | ||
var max = this.getMax(); | ||
var step = this.getStep(); | ||
var numMarkers = (max - min) / step; | ||
// In case distance between max & min is indivisible to step, | ||
// we place the secondary to last marker proportionally at where thumb | ||
// could reach and place the last marker at max value | ||
var indivisible = Math.ceil(numMarkers) !== numMarkers; | ||
if (indivisible) { | ||
numMarkers = Math.ceil(numMarkers); | ||
function isWindow(windowObj) { | ||
return Boolean(windowObj.document) && typeof windowObj.document.createElement === "function"; | ||
} | ||
this.adapter_.removeTrackMarkers(); | ||
this.adapter_.appendTrackMarkers(numMarkers); | ||
if (indivisible) { | ||
var lastStepRatio = (max - numMarkers * step) / step + 1; | ||
this.adapter_.setLastTrackMarkersStyleProperty('flex-grow', String(lastStepRatio)); | ||
function getCorrectPropertyName(windowObj, cssProperty) { | ||
if (isWindow(windowObj) && cssProperty in cssPropertyNameMap) { | ||
var el = windowObj.document.createElement("div"); | ||
var _a = cssPropertyNameMap[cssProperty], standard = _a.standard, prefixed = _a.prefixed; | ||
var isStandard = standard in el.style; | ||
return isStandard ? standard : prefixed; | ||
} | ||
return cssProperty; | ||
} | ||
} | ||
}; | ||
MDCSliderFoundation.prototype.layout = function () { | ||
this.rect_ = this.adapter_.computeBoundingRect(); | ||
this.updateUIForCurrentValue_(); | ||
}; | ||
MDCSliderFoundation.prototype.getValue = function () { | ||
return this.value_; | ||
}; | ||
MDCSliderFoundation.prototype.setValue = function (value) { | ||
this.setValue_(value, false); | ||
}; | ||
MDCSliderFoundation.prototype.getMax = function () { | ||
return this.max_; | ||
}; | ||
MDCSliderFoundation.prototype.setMax = function (max) { | ||
if (max < this.min_) { | ||
throw new Error('Cannot set max to be less than the slider\'s minimum value'); | ||
} | ||
this.max_ = max; | ||
this.setValue_(this.value_, false, true); | ||
this.adapter_.setAttribute(constants_1.strings.ARIA_VALUEMAX, String(this.max_)); | ||
this.setupTrackMarker(); | ||
}; | ||
MDCSliderFoundation.prototype.getMin = function () { | ||
return this.min_; | ||
}; | ||
MDCSliderFoundation.prototype.setMin = function (min) { | ||
if (min > this.max_) { | ||
throw new Error('Cannot set min to be greater than the slider\'s maximum value'); | ||
} | ||
this.min_ = min; | ||
this.setValue_(this.value_, false, true); | ||
this.adapter_.setAttribute(constants_1.strings.ARIA_VALUEMIN, String(this.min_)); | ||
this.setupTrackMarker(); | ||
}; | ||
MDCSliderFoundation.prototype.getStep = function () { | ||
return this.step_; | ||
}; | ||
MDCSliderFoundation.prototype.setStep = function (step) { | ||
if (step < 0) { | ||
throw new Error('Step cannot be set to a negative number'); | ||
} | ||
if (this.isDiscrete_ && (typeof step !== 'number' || step < 1)) { | ||
step = 1; | ||
} | ||
this.step_ = step; | ||
this.setValue_(this.value_, false, true); | ||
this.setupTrackMarker(); | ||
}; | ||
MDCSliderFoundation.prototype.isDisabled = function () { | ||
return this.disabled_; | ||
}; | ||
MDCSliderFoundation.prototype.setDisabled = function (disabled) { | ||
this.disabled_ = disabled; | ||
this.toggleClass_(constants_1.cssClasses.DISABLED, this.disabled_); | ||
if (this.disabled_) { | ||
this.savedTabIndex_ = this.adapter_.getTabIndex(); | ||
this.adapter_.setAttribute(constants_1.strings.ARIA_DISABLED, 'true'); | ||
this.adapter_.removeAttribute('tabindex'); | ||
} else { | ||
this.adapter_.removeAttribute(constants_1.strings.ARIA_DISABLED); | ||
if (!isNaN(this.savedTabIndex_)) { | ||
this.adapter_.setAttribute('tabindex', String(this.savedTabIndex_)); | ||
exports.getCorrectPropertyName = getCorrectPropertyName; | ||
function getCorrectEventName(windowObj, eventType) { | ||
if (isWindow(windowObj) && eventType in jsEventTypeMap) { | ||
var el = windowObj.document.createElement("div"); | ||
var _a = jsEventTypeMap[eventType], standard = _a.standard, prefixed = _a.prefixed, cssProperty = _a.cssProperty; | ||
var isStandard = cssProperty in el.style; | ||
return isStandard ? standard : prefixed; | ||
} | ||
return eventType; | ||
} | ||
} | ||
}; | ||
/** | ||
* Called when the user starts interacting with the slider | ||
*/ | ||
MDCSliderFoundation.prototype.handleDown_ = function (downEvent) { | ||
var _this = this; | ||
if (this.disabled_) { | ||
return; | ||
} | ||
this.preventFocusState_ = true; | ||
this.setInTransit_(!this.handlingThumbTargetEvt_); | ||
this.handlingThumbTargetEvt_ = false; | ||
this.setActive_(true); | ||
var moveHandler = function moveHandler(moveEvent) { | ||
_this.handleMove_(moveEvent); | ||
}; | ||
var moveEventType = MOVE_EVENT_MAP[downEvent.type]; | ||
// Note: upHandler is [de]registered on ALL potential pointer-related release event types, since some browsers | ||
// do not always fire these consistently in pairs. | ||
// (See https://github.com/material-components/material-components-web/issues/1192) | ||
var upHandler = function upHandler() { | ||
_this.handleUp_(); | ||
_this.adapter_.deregisterBodyInteractionHandler(moveEventType, moveHandler); | ||
UP_EVENTS.forEach(function (evtName) { | ||
return _this.adapter_.deregisterBodyInteractionHandler(evtName, upHandler); | ||
exports.getCorrectEventName = getCorrectEventName; | ||
}, | ||
152: function(module, exports, __webpack_require__) { | ||
"use strict"; | ||
function __export(m) { | ||
for (var p in m) { | ||
if (!exports.hasOwnProperty(p)) exports[p] = m[p]; | ||
} | ||
} | ||
Object.defineProperty(exports, "__esModule", { | ||
value: true | ||
}); | ||
}; | ||
this.adapter_.registerBodyInteractionHandler(moveEventType, moveHandler); | ||
UP_EVENTS.forEach(function (evtName) { | ||
return _this.adapter_.registerBodyInteractionHandler(evtName, upHandler); | ||
}); | ||
this.setValueFromEvt_(downEvent); | ||
}; | ||
/** | ||
* Called when the user moves the slider | ||
*/ | ||
MDCSliderFoundation.prototype.handleMove_ = function (evt) { | ||
evt.preventDefault(); | ||
this.setValueFromEvt_(evt); | ||
}; | ||
/** | ||
* Called when the user's interaction with the slider ends | ||
*/ | ||
MDCSliderFoundation.prototype.handleUp_ = function () { | ||
this.setActive_(false); | ||
this.adapter_.notifyChange(); | ||
}; | ||
/** | ||
* Returns the pageX of the event | ||
*/ | ||
MDCSliderFoundation.prototype.getPageX_ = function (evt) { | ||
if (evt.targetTouches && evt.targetTouches.length > 0) { | ||
return evt.targetTouches[0].pageX; | ||
} | ||
return evt.pageX; | ||
}; | ||
/** | ||
* Sets the slider value from an event | ||
*/ | ||
MDCSliderFoundation.prototype.setValueFromEvt_ = function (evt) { | ||
var pageX = this.getPageX_(evt); | ||
var value = this.computeValueFromPageX_(pageX); | ||
this.setValue_(value, true); | ||
}; | ||
/** | ||
* Computes the new value from the pageX position | ||
*/ | ||
MDCSliderFoundation.prototype.computeValueFromPageX_ = function (pageX) { | ||
var _a = this, | ||
max = _a.max_, | ||
min = _a.min_; | ||
var xPos = pageX - this.rect_.left; | ||
var pctComplete = xPos / this.rect_.width; | ||
if (this.adapter_.isRTL()) { | ||
pctComplete = 1 - pctComplete; | ||
} | ||
// Fit the percentage complete between the range [min,max] | ||
// by remapping from [0, 1] to [min, min+(max-min)]. | ||
return min + pctComplete * (max - min); | ||
}; | ||
/** | ||
* Handles keydown events | ||
*/ | ||
MDCSliderFoundation.prototype.handleKeydown_ = function (evt) { | ||
var keyId = this.getKeyId_(evt); | ||
var value = this.getValueForKeyId_(keyId); | ||
if (isNaN(value)) { | ||
return; | ||
} | ||
// Prevent page from scrolling due to key presses that would normally scroll the page | ||
evt.preventDefault(); | ||
this.adapter_.addClass(constants_1.cssClasses.FOCUS); | ||
this.setValue_(value, true); | ||
this.adapter_.notifyChange(); | ||
}; | ||
/** | ||
* Returns the computed name of the event | ||
*/ | ||
MDCSliderFoundation.prototype.getKeyId_ = function (kbdEvt) { | ||
if (kbdEvt.key === KEY_IDS.ARROW_LEFT || kbdEvt.keyCode === 37) { | ||
return KEY_IDS.ARROW_LEFT; | ||
} | ||
if (kbdEvt.key === KEY_IDS.ARROW_RIGHT || kbdEvt.keyCode === 39) { | ||
return KEY_IDS.ARROW_RIGHT; | ||
} | ||
if (kbdEvt.key === KEY_IDS.ARROW_UP || kbdEvt.keyCode === 38) { | ||
return KEY_IDS.ARROW_UP; | ||
} | ||
if (kbdEvt.key === KEY_IDS.ARROW_DOWN || kbdEvt.keyCode === 40) { | ||
return KEY_IDS.ARROW_DOWN; | ||
} | ||
if (kbdEvt.key === KEY_IDS.HOME || kbdEvt.keyCode === 36) { | ||
return KEY_IDS.HOME; | ||
} | ||
if (kbdEvt.key === KEY_IDS.END || kbdEvt.keyCode === 35) { | ||
return KEY_IDS.END; | ||
} | ||
if (kbdEvt.key === KEY_IDS.PAGE_UP || kbdEvt.keyCode === 33) { | ||
return KEY_IDS.PAGE_UP; | ||
} | ||
if (kbdEvt.key === KEY_IDS.PAGE_DOWN || kbdEvt.keyCode === 34) { | ||
return KEY_IDS.PAGE_DOWN; | ||
} | ||
return ''; | ||
}; | ||
/** | ||
* Computes the value given a keyboard key ID | ||
*/ | ||
MDCSliderFoundation.prototype.getValueForKeyId_ = function (keyId) { | ||
var _a = this, | ||
max = _a.max_, | ||
min = _a.min_, | ||
step = _a.step_; | ||
var delta = step || (max - min) / 100; | ||
var valueNeedsToBeFlipped = this.adapter_.isRTL() && (keyId === KEY_IDS.ARROW_LEFT || keyId === KEY_IDS.ARROW_RIGHT); | ||
if (valueNeedsToBeFlipped) { | ||
delta = -delta; | ||
} | ||
switch (keyId) { | ||
case KEY_IDS.ARROW_LEFT: | ||
case KEY_IDS.ARROW_DOWN: | ||
return this.value_ - delta; | ||
case KEY_IDS.ARROW_RIGHT: | ||
case KEY_IDS.ARROW_UP: | ||
return this.value_ + delta; | ||
case KEY_IDS.HOME: | ||
return this.min_; | ||
case KEY_IDS.END: | ||
return this.max_; | ||
case KEY_IDS.PAGE_UP: | ||
return this.value_ + delta * constants_1.numbers.PAGE_FACTOR; | ||
case KEY_IDS.PAGE_DOWN: | ||
return this.value_ - delta * constants_1.numbers.PAGE_FACTOR; | ||
default: | ||
return NaN; | ||
} | ||
}; | ||
MDCSliderFoundation.prototype.handleFocus_ = function () { | ||
if (this.preventFocusState_) { | ||
return; | ||
} | ||
this.adapter_.addClass(constants_1.cssClasses.FOCUS); | ||
}; | ||
MDCSliderFoundation.prototype.handleBlur_ = function () { | ||
this.preventFocusState_ = false; | ||
this.adapter_.removeClass(constants_1.cssClasses.FOCUS); | ||
}; | ||
/** | ||
* Sets the value of the slider | ||
*/ | ||
MDCSliderFoundation.prototype.setValue_ = function (value, shouldFireInput, force) { | ||
if (force === void 0) { | ||
force = false; | ||
} | ||
if (value === this.value_ && !force) { | ||
return; | ||
} | ||
var _a = this, | ||
min = _a.min_, | ||
max = _a.max_; | ||
var valueSetToBoundary = value === min || value === max; | ||
if (this.step_ && !valueSetToBoundary) { | ||
value = this.quantize_(value); | ||
} | ||
if (value < min) { | ||
value = min; | ||
} else if (value > max) { | ||
value = max; | ||
} | ||
this.value_ = value; | ||
this.adapter_.setAttribute(constants_1.strings.ARIA_VALUENOW, String(this.value_)); | ||
this.updateUIForCurrentValue_(); | ||
if (shouldFireInput) { | ||
this.adapter_.notifyInput(); | ||
if (this.isDiscrete_) { | ||
this.adapter_.setMarkerValue(value); | ||
} | ||
} | ||
}; | ||
/** | ||
* Calculates the quantized value | ||
*/ | ||
MDCSliderFoundation.prototype.quantize_ = function (value) { | ||
var numSteps = Math.round(value / this.step_); | ||
return numSteps * this.step_; | ||
}; | ||
MDCSliderFoundation.prototype.updateUIForCurrentValue_ = function () { | ||
var _this = this; | ||
var _a = this, | ||
max = _a.max_, | ||
min = _a.min_, | ||
value = _a.value_; | ||
var pctComplete = (value - min) / (max - min); | ||
var translatePx = pctComplete * this.rect_.width; | ||
if (this.adapter_.isRTL()) { | ||
translatePx = this.rect_.width - translatePx; | ||
} | ||
var transformProp = util_1.getCorrectPropertyName(window, 'transform'); | ||
var transitionendEvtName = util_1.getCorrectEventName(window, 'transitionend'); | ||
if (this.inTransit_) { | ||
var onTransitionEnd_1 = function onTransitionEnd_1() { | ||
_this.setInTransit_(false); | ||
_this.adapter_.deregisterThumbContainerInteractionHandler(transitionendEvtName, onTransitionEnd_1); | ||
__export(__webpack_require__(153)); | ||
__export(__webpack_require__(44)); | ||
__export(__webpack_require__(86)); | ||
}, | ||
153: function(module, exports, __webpack_require__) { | ||
"use strict"; | ||
var __extends = this && this.__extends || function() { | ||
var _extendStatics = function extendStatics(d, b) { | ||
_extendStatics = Object.setPrototypeOf || { | ||
__proto__: [] | ||
} instanceof Array && function(d, b) { | ||
d.__proto__ = b; | ||
} || function(d, b) { | ||
for (var p in b) { | ||
if (b.hasOwnProperty(p)) d[p] = b[p]; | ||
} | ||
}; | ||
return _extendStatics(d, b); | ||
}; | ||
return function(d, b) { | ||
_extendStatics(d, b); | ||
function __() { | ||
this.constructor = d; | ||
} | ||
d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); | ||
}; | ||
}(); | ||
Object.defineProperty(exports, "__esModule", { | ||
value: true | ||
}); | ||
var component_1 = __webpack_require__(1); | ||
var constants_1 = __webpack_require__(44); | ||
var foundation_1 = __webpack_require__(86); | ||
var MDCSlider = function(_super) { | ||
__extends(MDCSlider, _super); | ||
function MDCSlider() { | ||
return _super !== null && _super.apply(this, arguments) || this; | ||
} | ||
MDCSlider.attachTo = function(root) { | ||
return new MDCSlider(root); | ||
}; | ||
Object.defineProperty(MDCSlider.prototype, "value", { | ||
get: function get() { | ||
return this.foundation_.getValue(); | ||
}, | ||
set: function set(value) { | ||
this.foundation_.setValue(value); | ||
}, | ||
enumerable: true, | ||
configurable: true | ||
}); | ||
Object.defineProperty(MDCSlider.prototype, "min", { | ||
get: function get() { | ||
return this.foundation_.getMin(); | ||
}, | ||
set: function set(min) { | ||
this.foundation_.setMin(min); | ||
}, | ||
enumerable: true, | ||
configurable: true | ||
}); | ||
Object.defineProperty(MDCSlider.prototype, "max", { | ||
get: function get() { | ||
return this.foundation_.getMax(); | ||
}, | ||
set: function set(max) { | ||
this.foundation_.setMax(max); | ||
}, | ||
enumerable: true, | ||
configurable: true | ||
}); | ||
Object.defineProperty(MDCSlider.prototype, "step", { | ||
get: function get() { | ||
return this.foundation_.getStep(); | ||
}, | ||
set: function set(step) { | ||
this.foundation_.setStep(step); | ||
}, | ||
enumerable: true, | ||
configurable: true | ||
}); | ||
Object.defineProperty(MDCSlider.prototype, "disabled", { | ||
get: function get() { | ||
return this.foundation_.isDisabled(); | ||
}, | ||
set: function set(disabled) { | ||
this.foundation_.setDisabled(disabled); | ||
}, | ||
enumerable: true, | ||
configurable: true | ||
}); | ||
MDCSlider.prototype.initialize = function() { | ||
this.thumbContainer_ = this.root_.querySelector(constants_1.strings.THUMB_CONTAINER_SELECTOR); | ||
this.track_ = this.root_.querySelector(constants_1.strings.TRACK_SELECTOR); | ||
this.pinValueMarker_ = this.root_.querySelector(constants_1.strings.PIN_VALUE_MARKER_SELECTOR); | ||
this.trackMarkerContainer_ = this.root_.querySelector(constants_1.strings.TRACK_MARKER_CONTAINER_SELECTOR); | ||
}; | ||
MDCSlider.prototype.getDefaultFoundation = function() { | ||
var _this = this; | ||
var adapter = { | ||
hasClass: function hasClass(className) { | ||
return _this.root_.classList.contains(className); | ||
}, | ||
addClass: function addClass(className) { | ||
return _this.root_.classList.add(className); | ||
}, | ||
removeClass: function removeClass(className) { | ||
return _this.root_.classList.remove(className); | ||
}, | ||
getAttribute: function getAttribute(name) { | ||
return _this.root_.getAttribute(name); | ||
}, | ||
setAttribute: function setAttribute(name, value) { | ||
return _this.root_.setAttribute(name, value); | ||
}, | ||
removeAttribute: function removeAttribute(name) { | ||
return _this.root_.removeAttribute(name); | ||
}, | ||
computeBoundingRect: function computeBoundingRect() { | ||
return _this.root_.getBoundingClientRect(); | ||
}, | ||
getTabIndex: function getTabIndex() { | ||
return _this.root_.tabIndex; | ||
}, | ||
registerInteractionHandler: function registerInteractionHandler(evtType, handler) { | ||
return _this.listen(evtType, handler); | ||
}, | ||
deregisterInteractionHandler: function deregisterInteractionHandler(evtType, handler) { | ||
return _this.unlisten(evtType, handler); | ||
}, | ||
registerThumbContainerInteractionHandler: function registerThumbContainerInteractionHandler(evtType, handler) { | ||
_this.thumbContainer_.addEventListener(evtType, handler); | ||
}, | ||
deregisterThumbContainerInteractionHandler: function deregisterThumbContainerInteractionHandler(evtType, handler) { | ||
_this.thumbContainer_.removeEventListener(evtType, handler); | ||
}, | ||
registerBodyInteractionHandler: function registerBodyInteractionHandler(evtType, handler) { | ||
return document.body.addEventListener(evtType, handler); | ||
}, | ||
deregisterBodyInteractionHandler: function deregisterBodyInteractionHandler(evtType, handler) { | ||
return document.body.removeEventListener(evtType, handler); | ||
}, | ||
registerResizeHandler: function registerResizeHandler(handler) { | ||
return window.addEventListener("resize", handler); | ||
}, | ||
deregisterResizeHandler: function deregisterResizeHandler(handler) { | ||
return window.removeEventListener("resize", handler); | ||
}, | ||
notifyInput: function notifyInput() { | ||
return _this.emit(constants_1.strings.INPUT_EVENT, _this); | ||
}, | ||
notifyChange: function notifyChange() { | ||
return _this.emit(constants_1.strings.CHANGE_EVENT, _this); | ||
}, | ||
setThumbContainerStyleProperty: function setThumbContainerStyleProperty(propertyName, value) { | ||
_this.thumbContainer_.style.setProperty(propertyName, value); | ||
}, | ||
setTrackStyleProperty: function setTrackStyleProperty(propertyName, value) { | ||
return _this.track_.style.setProperty(propertyName, value); | ||
}, | ||
setMarkerValue: function setMarkerValue(value) { | ||
return _this.pinValueMarker_.innerText = value.toLocaleString(); | ||
}, | ||
appendTrackMarkers: function appendTrackMarkers(numMarkers) { | ||
var frag = document.createDocumentFragment(); | ||
for (var i = 0; i < numMarkers; i++) { | ||
var marker = document.createElement("div"); | ||
marker.classList.add("mdc-slider__track-marker"); | ||
frag.appendChild(marker); | ||
} | ||
_this.trackMarkerContainer_.appendChild(frag); | ||
}, | ||
removeTrackMarkers: function removeTrackMarkers() { | ||
while (_this.trackMarkerContainer_.firstChild) { | ||
_this.trackMarkerContainer_.removeChild(_this.trackMarkerContainer_.firstChild); | ||
} | ||
}, | ||
setLastTrackMarkersStyleProperty: function setLastTrackMarkersStyleProperty(propertyName, value) { | ||
var lastTrackMarker = _this.root_.querySelector(constants_1.strings.LAST_TRACK_MARKER_SELECTOR); | ||
lastTrackMarker.style.setProperty(propertyName, value); | ||
}, | ||
isRTL: function isRTL() { | ||
return getComputedStyle(_this.root_).direction === "rtl"; | ||
} | ||
}; | ||
return new foundation_1.MDCSliderFoundation(adapter); | ||
}; | ||
MDCSlider.prototype.initialSyncWithDOM = function() { | ||
var origValueNow = this.parseFloat_(this.root_.getAttribute(constants_1.strings.ARIA_VALUENOW), this.value); | ||
var min = this.parseFloat_(this.root_.getAttribute(constants_1.strings.ARIA_VALUEMIN), this.min); | ||
var max = this.parseFloat_(this.root_.getAttribute(constants_1.strings.ARIA_VALUEMAX), this.max); | ||
if (min >= this.max) { | ||
this.max = max; | ||
this.min = min; | ||
} else { | ||
this.min = min; | ||
this.max = max; | ||
} | ||
this.step = this.parseFloat_(this.root_.getAttribute(constants_1.strings.STEP_DATA_ATTR), this.step); | ||
this.value = origValueNow; | ||
this.disabled = this.root_.hasAttribute(constants_1.strings.ARIA_DISABLED) && this.root_.getAttribute(constants_1.strings.ARIA_DISABLED) !== "false"; | ||
this.foundation_.setupTrackMarker(); | ||
}; | ||
MDCSlider.prototype.layout = function() { | ||
this.foundation_.layout(); | ||
}; | ||
MDCSlider.prototype.stepUp = function(amount) { | ||
if (amount === void 0) { | ||
amount = this.step || 1; | ||
} | ||
this.value += amount; | ||
}; | ||
MDCSlider.prototype.stepDown = function(amount) { | ||
if (amount === void 0) { | ||
amount = this.step || 1; | ||
} | ||
this.value -= amount; | ||
}; | ||
MDCSlider.prototype.parseFloat_ = function(str, defaultValue) { | ||
var num = parseFloat(str); | ||
var isNumeric = typeof num === "number" && isFinite(num); | ||
return isNumeric ? num : defaultValue; | ||
}; | ||
return MDCSlider; | ||
}(component_1.MDCComponent); | ||
exports.MDCSlider = MDCSlider; | ||
}, | ||
44: function(module, exports, __webpack_require__) { | ||
"use strict"; | ||
Object.defineProperty(exports, "__esModule", { | ||
value: true | ||
}); | ||
var cssClasses = { | ||
ACTIVE: "mdc-slider--active", | ||
DISABLED: "mdc-slider--disabled", | ||
DISCRETE: "mdc-slider--discrete", | ||
FOCUS: "mdc-slider--focus", | ||
HAS_TRACK_MARKER: "mdc-slider--display-markers", | ||
IN_TRANSIT: "mdc-slider--in-transit", | ||
IS_DISCRETE: "mdc-slider--discrete" | ||
}; | ||
this.adapter_.registerThumbContainerInteractionHandler(transitionendEvtName, onTransitionEnd_1); | ||
} | ||
requestAnimationFrame(function () { | ||
// NOTE(traviskaufman): It would be nice to use calc() here, | ||
// but IE cannot handle calcs in transforms correctly. | ||
// See: https://goo.gl/NC2itk | ||
// Also note that the -50% offset is used to center the slider thumb. | ||
_this.adapter_.setThumbContainerStyleProperty(transformProp, "translateX(" + translatePx + "px) translateX(-50%)"); | ||
_this.adapter_.setTrackStyleProperty(transformProp, "scaleX(" + pctComplete + ")"); | ||
}); | ||
}; | ||
/** | ||
* Toggles the active state of the slider | ||
*/ | ||
MDCSliderFoundation.prototype.setActive_ = function (active) { | ||
this.active_ = active; | ||
this.toggleClass_(constants_1.cssClasses.ACTIVE, this.active_); | ||
}; | ||
/** | ||
* Toggles the inTransit state of the slider | ||
*/ | ||
MDCSliderFoundation.prototype.setInTransit_ = function (inTransit) { | ||
this.inTransit_ = inTransit; | ||
this.toggleClass_(constants_1.cssClasses.IN_TRANSIT, this.inTransit_); | ||
}; | ||
/** | ||
* Conditionally adds or removes a class based on shouldBePresent | ||
*/ | ||
MDCSliderFoundation.prototype.toggleClass_ = function (className, shouldBePresent) { | ||
if (shouldBePresent) { | ||
this.adapter_.addClass(className); | ||
} else { | ||
this.adapter_.removeClass(className); | ||
} | ||
}; | ||
return MDCSliderFoundation; | ||
}(foundation_1.MDCFoundation); | ||
exports.MDCSliderFoundation = MDCSliderFoundation; | ||
// tslint:disable-next-line:no-default-export Needed for backward compatibility with MDC Web v0.44.0 and earlier. | ||
exports.default = MDCSliderFoundation; | ||
exports.cssClasses = cssClasses; | ||
var strings = { | ||
ARIA_DISABLED: "aria-disabled", | ||
ARIA_VALUEMAX: "aria-valuemax", | ||
ARIA_VALUEMIN: "aria-valuemin", | ||
ARIA_VALUENOW: "aria-valuenow", | ||
CHANGE_EVENT: "MDCSlider:change", | ||
INPUT_EVENT: "MDCSlider:input", | ||
LAST_TRACK_MARKER_SELECTOR: ".mdc-slider__track-marker:last-child", | ||
PIN_VALUE_MARKER_SELECTOR: ".mdc-slider__pin-value-marker", | ||
STEP_DATA_ATTR: "data-step", | ||
THUMB_CONTAINER_SELECTOR: ".mdc-slider__thumb-container", | ||
TRACK_MARKER_CONTAINER_SELECTOR: ".mdc-slider__track-marker-container", | ||
TRACK_SELECTOR: ".mdc-slider__track" | ||
}; | ||
exports.strings = strings; | ||
var numbers = { | ||
PAGE_FACTOR: 4 | ||
}; | ||
exports.numbers = numbers; | ||
}, | ||
86: function(module, exports, __webpack_require__) { | ||
"use strict"; | ||
var __extends = this && this.__extends || function() { | ||
var _extendStatics = function extendStatics(d, b) { | ||
_extendStatics = Object.setPrototypeOf || { | ||
__proto__: [] | ||
} instanceof Array && function(d, b) { | ||
d.__proto__ = b; | ||
} || function(d, b) { | ||
for (var p in b) { | ||
if (b.hasOwnProperty(p)) d[p] = b[p]; | ||
} | ||
}; | ||
return _extendStatics(d, b); | ||
}; | ||
return function(d, b) { | ||
_extendStatics(d, b); | ||
function __() { | ||
this.constructor = d; | ||
} | ||
d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); | ||
}; | ||
}(); | ||
var __assign = this && this.__assign || function() { | ||
__assign = Object.assign || function(t) { | ||
for (var s, i = 1, n = arguments.length; i < n; i++) { | ||
s = arguments[i]; | ||
for (var p in s) { | ||
if (Object.prototype.hasOwnProperty.call(s, p)) t[p] = s[p]; | ||
} | ||
} | ||
return t; | ||
}; | ||
return __assign.apply(this, arguments); | ||
}; | ||
Object.defineProperty(exports, "__esModule", { | ||
value: true | ||
}); | ||
var util_1 = __webpack_require__(11); | ||
var foundation_1 = __webpack_require__(0); | ||
var constants_1 = __webpack_require__(44); | ||
var DOWN_EVENTS = [ "mousedown", "pointerdown", "touchstart" ]; | ||
var UP_EVENTS = [ "mouseup", "pointerup", "touchend" ]; | ||
var MOVE_EVENT_MAP = { | ||
mousedown: "mousemove", | ||
pointerdown: "pointermove", | ||
touchstart: "touchmove" | ||
}; | ||
var KEY_IDS = { | ||
ARROW_DOWN: "ArrowDown", | ||
ARROW_LEFT: "ArrowLeft", | ||
ARROW_RIGHT: "ArrowRight", | ||
ARROW_UP: "ArrowUp", | ||
END: "End", | ||
HOME: "Home", | ||
PAGE_DOWN: "PageDown", | ||
PAGE_UP: "PageUp" | ||
}; | ||
var MDCSliderFoundation = function(_super) { | ||
__extends(MDCSliderFoundation, _super); | ||
function MDCSliderFoundation(adapter) { | ||
var _this = _super.call(this, __assign({}, MDCSliderFoundation.defaultAdapter, adapter)) || this; | ||
_this.savedTabIndex_ = NaN; | ||
_this.active_ = false; | ||
_this.inTransit_ = false; | ||
_this.isDiscrete_ = false; | ||
_this.hasTrackMarker_ = false; | ||
_this.handlingThumbTargetEvt_ = false; | ||
_this.min_ = 0; | ||
_this.max_ = 100; | ||
_this.step_ = 0; | ||
_this.value_ = 0; | ||
_this.disabled_ = false; | ||
_this.preventFocusState_ = false; | ||
_this.thumbContainerPointerHandler_ = function() { | ||
return _this.handlingThumbTargetEvt_ = true; | ||
}; | ||
_this.interactionStartHandler_ = function(evt) { | ||
return _this.handleDown_(evt); | ||
}; | ||
_this.keydownHandler_ = function(evt) { | ||
return _this.handleKeydown_(evt); | ||
}; | ||
_this.focusHandler_ = function() { | ||
return _this.handleFocus_(); | ||
}; | ||
_this.blurHandler_ = function() { | ||
return _this.handleBlur_(); | ||
}; | ||
_this.resizeHandler_ = function() { | ||
return _this.layout(); | ||
}; | ||
return _this; | ||
} | ||
Object.defineProperty(MDCSliderFoundation, "cssClasses", { | ||
get: function get() { | ||
return constants_1.cssClasses; | ||
}, | ||
enumerable: true, | ||
configurable: true | ||
}); | ||
Object.defineProperty(MDCSliderFoundation, "strings", { | ||
get: function get() { | ||
return constants_1.strings; | ||
}, | ||
enumerable: true, | ||
configurable: true | ||
}); | ||
Object.defineProperty(MDCSliderFoundation, "numbers", { | ||
get: function get() { | ||
return constants_1.numbers; | ||
}, | ||
enumerable: true, | ||
configurable: true | ||
}); | ||
Object.defineProperty(MDCSliderFoundation, "defaultAdapter", { | ||
get: function get() { | ||
return { | ||
hasClass: function hasClass() { | ||
return false; | ||
}, | ||
addClass: function addClass() { | ||
return undefined; | ||
}, | ||
removeClass: function removeClass() { | ||
return undefined; | ||
}, | ||
getAttribute: function getAttribute() { | ||
return null; | ||
}, | ||
setAttribute: function setAttribute() { | ||
return undefined; | ||
}, | ||
removeAttribute: function removeAttribute() { | ||
return undefined; | ||
}, | ||
computeBoundingRect: function computeBoundingRect() { | ||
return { | ||
top: 0, | ||
right: 0, | ||
bottom: 0, | ||
left: 0, | ||
width: 0, | ||
height: 0 | ||
}; | ||
}, | ||
getTabIndex: function getTabIndex() { | ||
return 0; | ||
}, | ||
registerInteractionHandler: function registerInteractionHandler() { | ||
return undefined; | ||
}, | ||
deregisterInteractionHandler: function deregisterInteractionHandler() { | ||
return undefined; | ||
}, | ||
registerThumbContainerInteractionHandler: function registerThumbContainerInteractionHandler() { | ||
return undefined; | ||
}, | ||
deregisterThumbContainerInteractionHandler: function deregisterThumbContainerInteractionHandler() { | ||
return undefined; | ||
}, | ||
registerBodyInteractionHandler: function registerBodyInteractionHandler() { | ||
return undefined; | ||
}, | ||
deregisterBodyInteractionHandler: function deregisterBodyInteractionHandler() { | ||
return undefined; | ||
}, | ||
registerResizeHandler: function registerResizeHandler() { | ||
return undefined; | ||
}, | ||
deregisterResizeHandler: function deregisterResizeHandler() { | ||
return undefined; | ||
}, | ||
notifyInput: function notifyInput() { | ||
return undefined; | ||
}, | ||
notifyChange: function notifyChange() { | ||
return undefined; | ||
}, | ||
setThumbContainerStyleProperty: function setThumbContainerStyleProperty() { | ||
return undefined; | ||
}, | ||
setTrackStyleProperty: function setTrackStyleProperty() { | ||
return undefined; | ||
}, | ||
setMarkerValue: function setMarkerValue() { | ||
return undefined; | ||
}, | ||
appendTrackMarkers: function appendTrackMarkers() { | ||
return undefined; | ||
}, | ||
removeTrackMarkers: function removeTrackMarkers() { | ||
return undefined; | ||
}, | ||
setLastTrackMarkersStyleProperty: function setLastTrackMarkersStyleProperty() { | ||
return undefined; | ||
}, | ||
isRTL: function isRTL() { | ||
return false; | ||
} | ||
}; | ||
}, | ||
enumerable: true, | ||
configurable: true | ||
}); | ||
MDCSliderFoundation.prototype.init = function() { | ||
var _this = this; | ||
this.isDiscrete_ = this.adapter_.hasClass(constants_1.cssClasses.IS_DISCRETE); | ||
this.hasTrackMarker_ = this.adapter_.hasClass(constants_1.cssClasses.HAS_TRACK_MARKER); | ||
DOWN_EVENTS.forEach(function(evtName) { | ||
_this.adapter_.registerInteractionHandler(evtName, _this.interactionStartHandler_); | ||
_this.adapter_.registerThumbContainerInteractionHandler(evtName, _this.thumbContainerPointerHandler_); | ||
}); | ||
this.adapter_.registerInteractionHandler("keydown", this.keydownHandler_); | ||
this.adapter_.registerInteractionHandler("focus", this.focusHandler_); | ||
this.adapter_.registerInteractionHandler("blur", this.blurHandler_); | ||
this.adapter_.registerResizeHandler(this.resizeHandler_); | ||
this.layout(); | ||
if (this.isDiscrete_ && this.getStep() === 0) { | ||
this.step_ = 1; | ||
} | ||
}; | ||
MDCSliderFoundation.prototype.destroy = function() { | ||
var _this = this; | ||
DOWN_EVENTS.forEach(function(evtName) { | ||
_this.adapter_.deregisterInteractionHandler(evtName, _this.interactionStartHandler_); | ||
_this.adapter_.deregisterThumbContainerInteractionHandler(evtName, _this.thumbContainerPointerHandler_); | ||
}); | ||
this.adapter_.deregisterInteractionHandler("keydown", this.keydownHandler_); | ||
this.adapter_.deregisterInteractionHandler("focus", this.focusHandler_); | ||
this.adapter_.deregisterInteractionHandler("blur", this.blurHandler_); | ||
this.adapter_.deregisterResizeHandler(this.resizeHandler_); | ||
}; | ||
MDCSliderFoundation.prototype.setupTrackMarker = function() { | ||
if (this.isDiscrete_ && this.hasTrackMarker_ && this.getStep() !== 0) { | ||
var min = this.getMin(); | ||
var max = this.getMax(); | ||
var step = this.getStep(); | ||
var numMarkers = (max - min) / step; | ||
var indivisible = Math.ceil(numMarkers) !== numMarkers; | ||
if (indivisible) { | ||
numMarkers = Math.ceil(numMarkers); | ||
} | ||
this.adapter_.removeTrackMarkers(); | ||
this.adapter_.appendTrackMarkers(numMarkers); | ||
if (indivisible) { | ||
var lastStepRatio = (max - numMarkers * step) / step + 1; | ||
this.adapter_.setLastTrackMarkersStyleProperty("flex-grow", String(lastStepRatio)); | ||
} | ||
} | ||
}; | ||
MDCSliderFoundation.prototype.layout = function() { | ||
this.rect_ = this.adapter_.computeBoundingRect(); | ||
this.updateUIForCurrentValue_(); | ||
}; | ||
MDCSliderFoundation.prototype.getValue = function() { | ||
return this.value_; | ||
}; | ||
MDCSliderFoundation.prototype.setValue = function(value) { | ||
this.setValue_(value, false); | ||
}; | ||
MDCSliderFoundation.prototype.getMax = function() { | ||
return this.max_; | ||
}; | ||
MDCSliderFoundation.prototype.setMax = function(max) { | ||
if (max < this.min_) { | ||
throw new Error("Cannot set max to be less than the slider's minimum value"); | ||
} | ||
this.max_ = max; | ||
this.setValue_(this.value_, false, true); | ||
this.adapter_.setAttribute(constants_1.strings.ARIA_VALUEMAX, String(this.max_)); | ||
this.setupTrackMarker(); | ||
}; | ||
MDCSliderFoundation.prototype.getMin = function() { | ||
return this.min_; | ||
}; | ||
MDCSliderFoundation.prototype.setMin = function(min) { | ||
if (min > this.max_) { | ||
throw new Error("Cannot set min to be greater than the slider's maximum value"); | ||
} | ||
this.min_ = min; | ||
this.setValue_(this.value_, false, true); | ||
this.adapter_.setAttribute(constants_1.strings.ARIA_VALUEMIN, String(this.min_)); | ||
this.setupTrackMarker(); | ||
}; | ||
MDCSliderFoundation.prototype.getStep = function() { | ||
return this.step_; | ||
}; | ||
MDCSliderFoundation.prototype.setStep = function(step) { | ||
if (step < 0) { | ||
throw new Error("Step cannot be set to a negative number"); | ||
} | ||
if (this.isDiscrete_ && (typeof step !== "number" || step < 1)) { | ||
step = 1; | ||
} | ||
this.step_ = step; | ||
this.setValue_(this.value_, false, true); | ||
this.setupTrackMarker(); | ||
}; | ||
MDCSliderFoundation.prototype.isDisabled = function() { | ||
return this.disabled_; | ||
}; | ||
MDCSliderFoundation.prototype.setDisabled = function(disabled) { | ||
this.disabled_ = disabled; | ||
this.toggleClass_(constants_1.cssClasses.DISABLED, this.disabled_); | ||
if (this.disabled_) { | ||
this.savedTabIndex_ = this.adapter_.getTabIndex(); | ||
this.adapter_.setAttribute(constants_1.strings.ARIA_DISABLED, "true"); | ||
this.adapter_.removeAttribute("tabindex"); | ||
} else { | ||
this.adapter_.removeAttribute(constants_1.strings.ARIA_DISABLED); | ||
if (!isNaN(this.savedTabIndex_)) { | ||
this.adapter_.setAttribute("tabindex", String(this.savedTabIndex_)); | ||
} | ||
} | ||
}; | ||
MDCSliderFoundation.prototype.handleDown_ = function(downEvent) { | ||
var _this = this; | ||
if (this.disabled_) { | ||
return; | ||
} | ||
this.preventFocusState_ = true; | ||
this.setInTransit_(!this.handlingThumbTargetEvt_); | ||
this.handlingThumbTargetEvt_ = false; | ||
this.setActive_(true); | ||
var moveHandler = function moveHandler(moveEvent) { | ||
_this.handleMove_(moveEvent); | ||
}; | ||
var moveEventType = MOVE_EVENT_MAP[downEvent.type]; | ||
var upHandler = function upHandler() { | ||
_this.handleUp_(); | ||
_this.adapter_.deregisterBodyInteractionHandler(moveEventType, moveHandler); | ||
UP_EVENTS.forEach(function(evtName) { | ||
return _this.adapter_.deregisterBodyInteractionHandler(evtName, upHandler); | ||
}); | ||
}; | ||
this.adapter_.registerBodyInteractionHandler(moveEventType, moveHandler); | ||
UP_EVENTS.forEach(function(evtName) { | ||
return _this.adapter_.registerBodyInteractionHandler(evtName, upHandler); | ||
}); | ||
this.setValueFromEvt_(downEvent); | ||
}; | ||
MDCSliderFoundation.prototype.handleMove_ = function(evt) { | ||
evt.preventDefault(); | ||
this.setValueFromEvt_(evt); | ||
}; | ||
MDCSliderFoundation.prototype.handleUp_ = function() { | ||
this.setActive_(false); | ||
this.adapter_.notifyChange(); | ||
}; | ||
MDCSliderFoundation.prototype.getPageX_ = function(evt) { | ||
if (evt.targetTouches && evt.targetTouches.length > 0) { | ||
return evt.targetTouches[0].pageX; | ||
} | ||
return evt.pageX; | ||
}; | ||
MDCSliderFoundation.prototype.setValueFromEvt_ = function(evt) { | ||
var pageX = this.getPageX_(evt); | ||
var value = this.computeValueFromPageX_(pageX); | ||
this.setValue_(value, true); | ||
}; | ||
MDCSliderFoundation.prototype.computeValueFromPageX_ = function(pageX) { | ||
var _a = this, max = _a.max_, min = _a.min_; | ||
var xPos = pageX - this.rect_.left; | ||
var pctComplete = xPos / this.rect_.width; | ||
if (this.adapter_.isRTL()) { | ||
pctComplete = 1 - pctComplete; | ||
} | ||
return min + pctComplete * (max - min); | ||
}; | ||
MDCSliderFoundation.prototype.handleKeydown_ = function(evt) { | ||
var keyId = this.getKeyId_(evt); | ||
var value = this.getValueForKeyId_(keyId); | ||
if (isNaN(value)) { | ||
return; | ||
} | ||
evt.preventDefault(); | ||
this.adapter_.addClass(constants_1.cssClasses.FOCUS); | ||
this.setValue_(value, true); | ||
this.adapter_.notifyChange(); | ||
}; | ||
MDCSliderFoundation.prototype.getKeyId_ = function(kbdEvt) { | ||
if (kbdEvt.key === KEY_IDS.ARROW_LEFT || kbdEvt.keyCode === 37) { | ||
return KEY_IDS.ARROW_LEFT; | ||
} | ||
if (kbdEvt.key === KEY_IDS.ARROW_RIGHT || kbdEvt.keyCode === 39) { | ||
return KEY_IDS.ARROW_RIGHT; | ||
} | ||
if (kbdEvt.key === KEY_IDS.ARROW_UP || kbdEvt.keyCode === 38) { | ||
return KEY_IDS.ARROW_UP; | ||
} | ||
if (kbdEvt.key === KEY_IDS.ARROW_DOWN || kbdEvt.keyCode === 40) { | ||
return KEY_IDS.ARROW_DOWN; | ||
} | ||
if (kbdEvt.key === KEY_IDS.HOME || kbdEvt.keyCode === 36) { | ||
return KEY_IDS.HOME; | ||
} | ||
if (kbdEvt.key === KEY_IDS.END || kbdEvt.keyCode === 35) { | ||
return KEY_IDS.END; | ||
} | ||
if (kbdEvt.key === KEY_IDS.PAGE_UP || kbdEvt.keyCode === 33) { | ||
return KEY_IDS.PAGE_UP; | ||
} | ||
if (kbdEvt.key === KEY_IDS.PAGE_DOWN || kbdEvt.keyCode === 34) { | ||
return KEY_IDS.PAGE_DOWN; | ||
} | ||
return ""; | ||
}; | ||
MDCSliderFoundation.prototype.getValueForKeyId_ = function(keyId) { | ||
var _a = this, max = _a.max_, min = _a.min_, step = _a.step_; | ||
var delta = step || (max - min) / 100; | ||
var valueNeedsToBeFlipped = this.adapter_.isRTL() && (keyId === KEY_IDS.ARROW_LEFT || keyId === KEY_IDS.ARROW_RIGHT); | ||
if (valueNeedsToBeFlipped) { | ||
delta = -delta; | ||
} | ||
switch (keyId) { | ||
case KEY_IDS.ARROW_LEFT: | ||
case KEY_IDS.ARROW_DOWN: | ||
return this.value_ - delta; | ||
/***/ }) | ||
case KEY_IDS.ARROW_RIGHT: | ||
case KEY_IDS.ARROW_UP: | ||
return this.value_ + delta; | ||
/******/ }); | ||
case KEY_IDS.HOME: | ||
return this.min_; | ||
case KEY_IDS.END: | ||
return this.max_; | ||
case KEY_IDS.PAGE_UP: | ||
return this.value_ + delta * constants_1.numbers.PAGE_FACTOR; | ||
case KEY_IDS.PAGE_DOWN: | ||
return this.value_ - delta * constants_1.numbers.PAGE_FACTOR; | ||
default: | ||
return NaN; | ||
} | ||
}; | ||
MDCSliderFoundation.prototype.handleFocus_ = function() { | ||
if (this.preventFocusState_) { | ||
return; | ||
} | ||
this.adapter_.addClass(constants_1.cssClasses.FOCUS); | ||
}; | ||
MDCSliderFoundation.prototype.handleBlur_ = function() { | ||
this.preventFocusState_ = false; | ||
this.adapter_.removeClass(constants_1.cssClasses.FOCUS); | ||
}; | ||
MDCSliderFoundation.prototype.setValue_ = function(value, shouldFireInput, force) { | ||
if (force === void 0) { | ||
force = false; | ||
} | ||
if (value === this.value_ && !force) { | ||
return; | ||
} | ||
var _a = this, min = _a.min_, max = _a.max_; | ||
var valueSetToBoundary = value === min || value === max; | ||
if (this.step_ && !valueSetToBoundary) { | ||
value = this.quantize_(value); | ||
} | ||
if (value < min) { | ||
value = min; | ||
} else if (value > max) { | ||
value = max; | ||
} | ||
this.value_ = value; | ||
this.adapter_.setAttribute(constants_1.strings.ARIA_VALUENOW, String(this.value_)); | ||
this.updateUIForCurrentValue_(); | ||
if (shouldFireInput) { | ||
this.adapter_.notifyInput(); | ||
if (this.isDiscrete_) { | ||
this.adapter_.setMarkerValue(value); | ||
} | ||
} | ||
}; | ||
MDCSliderFoundation.prototype.quantize_ = function(value) { | ||
var numSteps = Math.round(value / this.step_); | ||
return numSteps * this.step_; | ||
}; | ||
MDCSliderFoundation.prototype.updateUIForCurrentValue_ = function() { | ||
var _this = this; | ||
var _a = this, max = _a.max_, min = _a.min_, value = _a.value_; | ||
var pctComplete = (value - min) / (max - min); | ||
var translatePx = pctComplete * this.rect_.width; | ||
if (this.adapter_.isRTL()) { | ||
translatePx = this.rect_.width - translatePx; | ||
} | ||
var transformProp = util_1.getCorrectPropertyName(window, "transform"); | ||
var transitionendEvtName = util_1.getCorrectEventName(window, "transitionend"); | ||
if (this.inTransit_) { | ||
var onTransitionEnd_1 = function onTransitionEnd_1() { | ||
_this.setInTransit_(false); | ||
_this.adapter_.deregisterThumbContainerInteractionHandler(transitionendEvtName, onTransitionEnd_1); | ||
}; | ||
this.adapter_.registerThumbContainerInteractionHandler(transitionendEvtName, onTransitionEnd_1); | ||
} | ||
requestAnimationFrame(function() { | ||
_this.adapter_.setThumbContainerStyleProperty(transformProp, "translateX(" + translatePx + "px) translateX(-50%)"); | ||
_this.adapter_.setTrackStyleProperty(transformProp, "scaleX(" + pctComplete + ")"); | ||
}); | ||
}; | ||
MDCSliderFoundation.prototype.setActive_ = function(active) { | ||
this.active_ = active; | ||
this.toggleClass_(constants_1.cssClasses.ACTIVE, this.active_); | ||
}; | ||
MDCSliderFoundation.prototype.setInTransit_ = function(inTransit) { | ||
this.inTransit_ = inTransit; | ||
this.toggleClass_(constants_1.cssClasses.IN_TRANSIT, this.inTransit_); | ||
}; | ||
MDCSliderFoundation.prototype.toggleClass_ = function(className, shouldBePresent) { | ||
if (shouldBePresent) { | ||
this.adapter_.addClass(className); | ||
} else { | ||
this.adapter_.removeClass(className); | ||
} | ||
}; | ||
return MDCSliderFoundation; | ||
}(foundation_1.MDCFoundation); | ||
exports.MDCSliderFoundation = MDCSliderFoundation; | ||
exports.default = MDCSliderFoundation; | ||
} | ||
}); | ||
}); | ||
//# sourceMappingURL=mdc.slider.js.map |
@@ -1,161 +0,9 @@ | ||
/*! | ||
Material Components for the Web | ||
Copyright (c) 2019 Google Inc. | ||
License: MIT | ||
*/ | ||
!function(t,e){"object"==typeof exports&&"object"==typeof module?module.exports=e():"function"==typeof define&&define.amd?define([],e):"object"==typeof exports?exports.slider=e():(t.mdc=t.mdc||{},t.mdc.slider=e())}(this,function(){return function(t){function e(n){if(r[n])return r[n].exports;var i=r[n]={i:n,l:!1,exports:{}};return t[n].call(i.exports,i,i.exports,e),i.l=!0,i.exports}var r={};return e.m=t,e.c=r,e.d=function(t,r,n){e.o(t,r)||Object.defineProperty(t,r,{configurable:!1,enumerable:!0,get:n})},e.n=function(t){var r=t&&t.__esModule?function(){return t.default}:function(){return t};return e.d(r,"a",r),r},e.o=function(t,e){return Object.prototype.hasOwnProperty.call(t,e)},e.p="",e(e.s=146)}({0:function(t,e,r){"use strict";/** | ||
/** | ||
* @license | ||
* Copyright 2016 Google Inc. | ||
* Copyright Google LLC All Rights Reserved. | ||
* | ||
* Permission is hereby granted, free of charge, to any person obtaining a copy | ||
* of this software and associated documentation files (the "Software"), to deal | ||
* in the Software without restriction, including without limitation the rights | ||
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell | ||
* copies of the Software, and to permit persons to whom the Software is | ||
* furnished to do so, subject to the following conditions: | ||
* | ||
* The above copyright notice and this permission notice shall be included in | ||
* all copies or substantial portions of the Software. | ||
* | ||
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR | ||
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, | ||
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE | ||
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER | ||
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, | ||
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN | ||
* THE SOFTWARE. | ||
* Use of this source code is governed by an MIT-style license that can be | ||
* found in the LICENSE file at https://github.com/material-components/material-components-web/blob/master/LICENSE | ||
*/ | ||
Object.defineProperty(e,"__esModule",{value:!0});var n=function(){function t(t){void 0===t&&(t={}),this.adapter_=t}return Object.defineProperty(t,"cssClasses",{get:function(){return{}},enumerable:!0,configurable:!0}),Object.defineProperty(t,"strings",{get:function(){return{}},enumerable:!0,configurable:!0}),Object.defineProperty(t,"numbers",{get:function(){return{}},enumerable:!0,configurable:!0}),Object.defineProperty(t,"defaultAdapter",{get:function(){return{}},enumerable:!0,configurable:!0}),t.prototype.init=function(){},t.prototype.destroy=function(){},t}();e.MDCFoundation=n,e.default=n},1:function(t,e,r){"use strict";/** | ||
* @license | ||
* Copyright 2016 Google Inc. | ||
* | ||
* Permission is hereby granted, free of charge, to any person obtaining a copy | ||
* of this software and associated documentation files (the "Software"), to deal | ||
* in the Software without restriction, including without limitation the rights | ||
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell | ||
* copies of the Software, and to permit persons to whom the Software is | ||
* furnished to do so, subject to the following conditions: | ||
* | ||
* The above copyright notice and this permission notice shall be included in | ||
* all copies or substantial portions of the Software. | ||
* | ||
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR | ||
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, | ||
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE | ||
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER | ||
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, | ||
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN | ||
* THE SOFTWARE. | ||
*/ | ||
var n=this&&this.__read||function(t,e){var r="function"==typeof Symbol&&t[Symbol.iterator];if(!r)return t;var n,i,o=r.call(t),a=[];try{for(;(void 0===e||e-- >0)&&!(n=o.next()).done;)a.push(n.value)}catch(t){i={error:t}}finally{try{n&&!n.done&&(r=o.return)&&r.call(o)}finally{if(i)throw i.error}}return a},i=this&&this.__spread||function(){for(var t=[],e=0;e<arguments.length;e++)t=t.concat(n(arguments[e]));return t};Object.defineProperty(e,"__esModule",{value:!0});var o=r(0),a=function(){function t(t,e){for(var r=[],n=2;n<arguments.length;n++)r[n-2]=arguments[n];this.root_=t,this.initialize.apply(this,i(r)),this.foundation_=void 0===e?this.getDefaultFoundation():e,this.foundation_.init(),this.initialSyncWithDOM()}return t.attachTo=function(e){return new t(e,new o.MDCFoundation({}))},t.prototype.initialize=function(){for(var t=[],e=0;e<arguments.length;e++)t[e]=arguments[e]},t.prototype.getDefaultFoundation=function(){throw new Error("Subclasses must override getDefaultFoundation to return a properly configured foundation class")},t.prototype.initialSyncWithDOM=function(){},t.prototype.destroy=function(){this.foundation_.destroy()},t.prototype.listen=function(t,e){this.root_.addEventListener(t,e)},t.prototype.unlisten=function(t,e){this.root_.removeEventListener(t,e)},t.prototype.emit=function(t,e,r){void 0===r&&(r=!1);var n;"function"==typeof CustomEvent?n=new CustomEvent(t,{bubbles:r,detail:e}):(n=document.createEvent("CustomEvent"),n.initCustomEvent(t,r,!1,e)),this.root_.dispatchEvent(n)},t}();e.MDCComponent=a,e.default=a},14:function(t,e,r){"use strict";function n(t){return Boolean(t.document)&&"function"==typeof t.document.createElement}function i(t,e){if(n(t)&&e in a){var r=t.document.createElement("div"),i=a[e],o=i.standard,s=i.prefixed;return o in r.style?o:s}return e}function o(t,e){if(n(t)&&e in s){var r=t.document.createElement("div"),i=s[e],o=i.standard,a=i.prefixed;return i.cssProperty in r.style?o:a}return e}/** | ||
* @license | ||
* Copyright 2016 Google Inc. | ||
* | ||
* Permission is hereby granted, free of charge, to any person obtaining a copy | ||
* of this software and associated documentation files (the "Software"), to deal | ||
* in the Software without restriction, including without limitation the rights | ||
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell | ||
* copies of the Software, and to permit persons to whom the Software is | ||
* furnished to do so, subject to the following conditions: | ||
* | ||
* The above copyright notice and this permission notice shall be included in | ||
* all copies or substantial portions of the Software. | ||
* | ||
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR | ||
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, | ||
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE | ||
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER | ||
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, | ||
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN | ||
* THE SOFTWARE. | ||
*/ | ||
Object.defineProperty(e,"__esModule",{value:!0});var a={animation:{prefixed:"-webkit-animation",standard:"animation"},transform:{prefixed:"-webkit-transform",standard:"transform"},transition:{prefixed:"-webkit-transition",standard:"transition"}},s={animationend:{cssProperty:"animation",prefixed:"webkitAnimationEnd",standard:"animationend"},animationiteration:{cssProperty:"animation",prefixed:"webkitAnimationIteration",standard:"animationiteration"},animationstart:{cssProperty:"animation",prefixed:"webkitAnimationStart",standard:"animationstart"},transitionend:{cssProperty:"transition",prefixed:"webkitTransitionEnd",standard:"transitionend"}};e.getCorrectPropertyName=i,e.getCorrectEventName=o},146:function(t,e,r){"use strict";/** | ||
* @license | ||
* Copyright 2019 Google Inc. | ||
* | ||
* Permission is hereby granted, free of charge, to any person obtaining a copy | ||
* of this software and associated documentation files (the "Software"), to deal | ||
* in the Software without restriction, including without limitation the rights | ||
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell | ||
* copies of the Software, and to permit persons to whom the Software is | ||
* furnished to do so, subject to the following conditions: | ||
* | ||
* The above copyright notice and this permission notice shall be included in | ||
* all copies or substantial portions of the Software. | ||
* | ||
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR | ||
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, | ||
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE | ||
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER | ||
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, | ||
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN | ||
* THE SOFTWARE. | ||
*/ | ||
function n(t){for(var r in t)e.hasOwnProperty(r)||(e[r]=t[r])}Object.defineProperty(e,"__esModule",{value:!0}),n(r(147)),n(r(81))},147:function(t,e,r){"use strict";/** | ||
* @license | ||
* Copyright 2017 Google Inc. | ||
* | ||
* Permission is hereby granted, free of charge, to any person obtaining a copy | ||
* of this software and associated documentation files (the "Software"), to deal | ||
* in the Software without restriction, including without limitation the rights | ||
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell | ||
* copies of the Software, and to permit persons to whom the Software is | ||
* furnished to do so, subject to the following conditions: | ||
* | ||
* The above copyright notice and this permission notice shall be included in | ||
* all copies or substantial portions of the Software. | ||
* | ||
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR | ||
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, | ||
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE | ||
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER | ||
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, | ||
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN | ||
* THE SOFTWARE. | ||
*/ | ||
var n=this&&this.__extends||function(){var t=function(e,r){return(t=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var r in e)e.hasOwnProperty(r)&&(t[r]=e[r])})(e,r)};return function(e,r){function n(){this.constructor=e}t(e,r),e.prototype=null===r?Object.create(r):(n.prototype=r.prototype,new n)}}();Object.defineProperty(e,"__esModule",{value:!0});var i=r(1),o=r(80),a=r(81),s=function(t){function e(){return null!==t&&t.apply(this,arguments)||this}return n(e,t),e.attachTo=function(t){return new e(t)},Object.defineProperty(e.prototype,"value",{get:function(){return this.foundation_.getValue()},set:function(t){this.foundation_.setValue(t)},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"min",{get:function(){return this.foundation_.getMin()},set:function(t){this.foundation_.setMin(t)},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"max",{get:function(){return this.foundation_.getMax()},set:function(t){this.foundation_.setMax(t)},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"step",{get:function(){return this.foundation_.getStep()},set:function(t){this.foundation_.setStep(t)},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"disabled",{get:function(){return this.foundation_.isDisabled()},set:function(t){this.foundation_.setDisabled(t)},enumerable:!0,configurable:!0}),e.prototype.initialize=function(){this.thumbContainer_=this.root_.querySelector(o.strings.THUMB_CONTAINER_SELECTOR),this.track_=this.root_.querySelector(o.strings.TRACK_SELECTOR),this.pinValueMarker_=this.root_.querySelector(o.strings.PIN_VALUE_MARKER_SELECTOR),this.trackMarkerContainer_=this.root_.querySelector(o.strings.TRACK_MARKER_CONTAINER_SELECTOR)},e.prototype.getDefaultFoundation=function(){var t=this,e={hasClass:function(e){return t.root_.classList.contains(e)},addClass:function(e){return t.root_.classList.add(e)},removeClass:function(e){return t.root_.classList.remove(e)},getAttribute:function(e){return t.root_.getAttribute(e)},setAttribute:function(e,r){return t.root_.setAttribute(e,r)},removeAttribute:function(e){return t.root_.removeAttribute(e)},computeBoundingRect:function(){return t.root_.getBoundingClientRect()},getTabIndex:function(){return t.root_.tabIndex},registerInteractionHandler:function(e,r){return t.listen(e,r)},deregisterInteractionHandler:function(e,r){return t.unlisten(e,r)},registerThumbContainerInteractionHandler:function(e,r){t.thumbContainer_.addEventListener(e,r)},deregisterThumbContainerInteractionHandler:function(e,r){t.thumbContainer_.removeEventListener(e,r)},registerBodyInteractionHandler:function(t,e){return document.body.addEventListener(t,e)},deregisterBodyInteractionHandler:function(t,e){return document.body.removeEventListener(t,e)},registerResizeHandler:function(t){return window.addEventListener("resize",t)},deregisterResizeHandler:function(t){return window.removeEventListener("resize",t)},notifyInput:function(){return t.emit(o.strings.INPUT_EVENT,t)},notifyChange:function(){return t.emit(o.strings.CHANGE_EVENT,t)},setThumbContainerStyleProperty:function(e,r){t.thumbContainer_.style.setProperty(e,r)},setTrackStyleProperty:function(e,r){return t.track_.style.setProperty(e,r)},setMarkerValue:function(e){return t.pinValueMarker_.innerText=e.toLocaleString()},appendTrackMarkers:function(e){for(var r=document.createDocumentFragment(),n=0;n<e;n++){var i=document.createElement("div");i.classList.add("mdc-slider__track-marker"),r.appendChild(i)}t.trackMarkerContainer_.appendChild(r)},removeTrackMarkers:function(){for(;t.trackMarkerContainer_.firstChild;)t.trackMarkerContainer_.removeChild(t.trackMarkerContainer_.firstChild)},setLastTrackMarkersStyleProperty:function(e,r){t.root_.querySelector(o.strings.LAST_TRACK_MARKER_SELECTOR).style.setProperty(e,r)},isRTL:function(){return"rtl"===getComputedStyle(t.root_).direction}};return new a.MDCSliderFoundation(e)},e.prototype.initialSyncWithDOM=function(){var t=this.parseFloat_(this.root_.getAttribute(o.strings.ARIA_VALUENOW),this.value),e=this.parseFloat_(this.root_.getAttribute(o.strings.ARIA_VALUEMIN),this.min),r=this.parseFloat_(this.root_.getAttribute(o.strings.ARIA_VALUEMAX),this.max);e>=this.max?(this.max=r,this.min=e):(this.min=e,this.max=r),this.step=this.parseFloat_(this.root_.getAttribute(o.strings.STEP_DATA_ATTR),this.step),this.value=t,this.disabled=this.root_.hasAttribute(o.strings.ARIA_DISABLED)&&"false"!==this.root_.getAttribute(o.strings.ARIA_DISABLED),this.foundation_.setupTrackMarker()},e.prototype.layout=function(){this.foundation_.layout()},e.prototype.stepUp=function(t){void 0===t&&(t=this.step||1),this.value+=t},e.prototype.stepDown=function(t){void 0===t&&(t=this.step||1),this.value-=t},e.prototype.parseFloat_=function(t,e){var r=parseFloat(t);return"number"==typeof r&&isFinite(r)?r:e},e}(i.MDCComponent);e.MDCSlider=s},80:function(t,e,r){"use strict";/** | ||
* @license | ||
* Copyright 2017 Google Inc. | ||
* | ||
* Permission is hereby granted, free of charge, to any person obtaining a copy | ||
* of this software and associated documentation files (the "Software"), to deal | ||
* in the Software without restriction, including without limitation the rights | ||
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell | ||
* copies of the Software, and to permit persons to whom the Software is | ||
* furnished to do so, subject to the following conditions: | ||
* | ||
* The above copyright notice and this permission notice shall be included in | ||
* all copies or substantial portions of the Software. | ||
* | ||
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR | ||
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, | ||
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE | ||
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER | ||
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, | ||
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN | ||
* THE SOFTWARE. | ||
*/ | ||
Object.defineProperty(e,"__esModule",{value:!0});var n={ACTIVE:"mdc-slider--active",DISABLED:"mdc-slider--disabled",DISCRETE:"mdc-slider--discrete",FOCUS:"mdc-slider--focus",HAS_TRACK_MARKER:"mdc-slider--display-markers",IN_TRANSIT:"mdc-slider--in-transit",IS_DISCRETE:"mdc-slider--discrete"};e.cssClasses=n;var i={ARIA_DISABLED:"aria-disabled",ARIA_VALUEMAX:"aria-valuemax",ARIA_VALUEMIN:"aria-valuemin",ARIA_VALUENOW:"aria-valuenow",CHANGE_EVENT:"MDCSlider:change",INPUT_EVENT:"MDCSlider:input",LAST_TRACK_MARKER_SELECTOR:".mdc-slider__track-marker:last-child",PIN_VALUE_MARKER_SELECTOR:".mdc-slider__pin-value-marker",STEP_DATA_ATTR:"data-step",THUMB_CONTAINER_SELECTOR:".mdc-slider__thumb-container",TRACK_MARKER_CONTAINER_SELECTOR:".mdc-slider__track-marker-container",TRACK_SELECTOR:".mdc-slider__track"};e.strings=i;var o={PAGE_FACTOR:4};e.numbers=o},81:function(t,e,r){"use strict";/** | ||
* @license | ||
* Copyright 2017 Google Inc. | ||
* | ||
* Permission is hereby granted, free of charge, to any person obtaining a copy | ||
* of this software and associated documentation files (the "Software"), to deal | ||
* in the Software without restriction, including without limitation the rights | ||
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell | ||
* copies of the Software, and to permit persons to whom the Software is | ||
* furnished to do so, subject to the following conditions: | ||
* | ||
* The above copyright notice and this permission notice shall be included in | ||
* all copies or substantial portions of the Software. | ||
* | ||
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR | ||
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, | ||
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE | ||
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER | ||
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, | ||
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN | ||
* THE SOFTWARE. | ||
*/ | ||
var n=this&&this.__extends||function(){var t=function(e,r){return(t=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var r in e)e.hasOwnProperty(r)&&(t[r]=e[r])})(e,r)};return function(e,r){function n(){this.constructor=e}t(e,r),e.prototype=null===r?Object.create(r):(n.prototype=r.prototype,new n)}}(),i=this&&this.__assign||function(){return i=Object.assign||function(t){for(var e,r=1,n=arguments.length;r<n;r++){e=arguments[r];for(var i in e)Object.prototype.hasOwnProperty.call(e,i)&&(t[i]=e[i])}return t},i.apply(this,arguments)};Object.defineProperty(e,"__esModule",{value:!0});var o=r(14),a=r(0),s=r(80),u=["mousedown","pointerdown","touchstart"],c=["mouseup","pointerup","touchend"],d={mousedown:"mousemove",pointerdown:"pointermove",touchstart:"touchmove"},_={ARROW_DOWN:"ArrowDown",ARROW_LEFT:"ArrowLeft",ARROW_RIGHT:"ArrowRight",ARROW_UP:"ArrowUp",END:"End",HOME:"Home",PAGE_DOWN:"PageDown",PAGE_UP:"PageUp"},l=function(t){function e(r){var n=t.call(this,i({},e.defaultAdapter,r))||this;return n.savedTabIndex_=NaN,n.active_=!1,n.inTransit_=!1,n.isDiscrete_=!1,n.hasTrackMarker_=!1,n.handlingThumbTargetEvt_=!1,n.min_=0,n.max_=100,n.step_=0,n.value_=0,n.disabled_=!1,n.preventFocusState_=!1,n.thumbContainerPointerHandler_=function(){return n.handlingThumbTargetEvt_=!0},n.interactionStartHandler_=function(t){return n.handleDown_(t)},n.keydownHandler_=function(t){return n.handleKeydown_(t)},n.focusHandler_=function(){return n.handleFocus_()},n.blurHandler_=function(){return n.handleBlur_()},n.resizeHandler_=function(){return n.layout()},n}return n(e,t),Object.defineProperty(e,"cssClasses",{get:function(){return s.cssClasses},enumerable:!0,configurable:!0}),Object.defineProperty(e,"strings",{get:function(){return s.strings},enumerable:!0,configurable:!0}),Object.defineProperty(e,"numbers",{get:function(){return s.numbers},enumerable:!0,configurable:!0}),Object.defineProperty(e,"defaultAdapter",{get:function(){return{hasClass:function(){return!1},addClass:function(){},removeClass:function(){},getAttribute:function(){return null},setAttribute:function(){},removeAttribute:function(){},computeBoundingRect:function(){return{top:0,right:0,bottom:0,left:0,width:0,height:0}},getTabIndex:function(){return 0},registerInteractionHandler:function(){},deregisterInteractionHandler:function(){},registerThumbContainerInteractionHandler:function(){},deregisterThumbContainerInteractionHandler:function(){},registerBodyInteractionHandler:function(){},deregisterBodyInteractionHandler:function(){},registerResizeHandler:function(){},deregisterResizeHandler:function(){},notifyInput:function(){},notifyChange:function(){},setThumbContainerStyleProperty:function(){},setTrackStyleProperty:function(){},setMarkerValue:function(){},appendTrackMarkers:function(){},removeTrackMarkers:function(){},setLastTrackMarkersStyleProperty:function(){},isRTL:function(){return!1}}},enumerable:!0,configurable:!0}),e.prototype.init=function(){var t=this;this.isDiscrete_=this.adapter_.hasClass(s.cssClasses.IS_DISCRETE),this.hasTrackMarker_=this.adapter_.hasClass(s.cssClasses.HAS_TRACK_MARKER),u.forEach(function(e){t.adapter_.registerInteractionHandler(e,t.interactionStartHandler_),t.adapter_.registerThumbContainerInteractionHandler(e,t.thumbContainerPointerHandler_)}),this.adapter_.registerInteractionHandler("keydown",this.keydownHandler_),this.adapter_.registerInteractionHandler("focus",this.focusHandler_),this.adapter_.registerInteractionHandler("blur",this.blurHandler_),this.adapter_.registerResizeHandler(this.resizeHandler_),this.layout(),this.isDiscrete_&&0===this.getStep()&&(this.step_=1)},e.prototype.destroy=function(){var t=this;u.forEach(function(e){t.adapter_.deregisterInteractionHandler(e,t.interactionStartHandler_),t.adapter_.deregisterThumbContainerInteractionHandler(e,t.thumbContainerPointerHandler_)}),this.adapter_.deregisterInteractionHandler("keydown",this.keydownHandler_),this.adapter_.deregisterInteractionHandler("focus",this.focusHandler_),this.adapter_.deregisterInteractionHandler("blur",this.blurHandler_),this.adapter_.deregisterResizeHandler(this.resizeHandler_)},e.prototype.setupTrackMarker=function(){if(this.isDiscrete_&&this.hasTrackMarker_&&0!==this.getStep()){var t=this.getMin(),e=this.getMax(),r=this.getStep(),n=(e-t)/r,i=Math.ceil(n)!==n;if(i&&(n=Math.ceil(n)),this.adapter_.removeTrackMarkers(),this.adapter_.appendTrackMarkers(n),i){var o=(e-n*r)/r+1;this.adapter_.setLastTrackMarkersStyleProperty("flex-grow",String(o))}}},e.prototype.layout=function(){this.rect_=this.adapter_.computeBoundingRect(),this.updateUIForCurrentValue_()},e.prototype.getValue=function(){return this.value_},e.prototype.setValue=function(t){this.setValue_(t,!1)},e.prototype.getMax=function(){return this.max_},e.prototype.setMax=function(t){if(t<this.min_)throw new Error("Cannot set max to be less than the slider's minimum value");this.max_=t,this.setValue_(this.value_,!1,!0),this.adapter_.setAttribute(s.strings.ARIA_VALUEMAX,String(this.max_)),this.setupTrackMarker()},e.prototype.getMin=function(){return this.min_},e.prototype.setMin=function(t){if(t>this.max_)throw new Error("Cannot set min to be greater than the slider's maximum value");this.min_=t,this.setValue_(this.value_,!1,!0),this.adapter_.setAttribute(s.strings.ARIA_VALUEMIN,String(this.min_)),this.setupTrackMarker()},e.prototype.getStep=function(){return this.step_},e.prototype.setStep=function(t){if(t<0)throw new Error("Step cannot be set to a negative number");this.isDiscrete_&&("number"!=typeof t||t<1)&&(t=1),this.step_=t,this.setValue_(this.value_,!1,!0),this.setupTrackMarker()},e.prototype.isDisabled=function(){return this.disabled_},e.prototype.setDisabled=function(t){this.disabled_=t,this.toggleClass_(s.cssClasses.DISABLED,this.disabled_),this.disabled_?(this.savedTabIndex_=this.adapter_.getTabIndex(),this.adapter_.setAttribute(s.strings.ARIA_DISABLED,"true"),this.adapter_.removeAttribute("tabindex")):(this.adapter_.removeAttribute(s.strings.ARIA_DISABLED),isNaN(this.savedTabIndex_)||this.adapter_.setAttribute("tabindex",String(this.savedTabIndex_)))},e.prototype.handleDown_=function(t){var e=this;if(!this.disabled_){this.preventFocusState_=!0,this.setInTransit_(!this.handlingThumbTargetEvt_),this.handlingThumbTargetEvt_=!1,this.setActive_(!0);var r=function(t){e.handleMove_(t)},n=d[t.type],i=function t(){e.handleUp_(),e.adapter_.deregisterBodyInteractionHandler(n,r),c.forEach(function(r){return e.adapter_.deregisterBodyInteractionHandler(r,t)})};this.adapter_.registerBodyInteractionHandler(n,r),c.forEach(function(t){return e.adapter_.registerBodyInteractionHandler(t,i)}),this.setValueFromEvt_(t)}},e.prototype.handleMove_=function(t){t.preventDefault(),this.setValueFromEvt_(t)},e.prototype.handleUp_=function(){this.setActive_(!1),this.adapter_.notifyChange()},e.prototype.getPageX_=function(t){return t.targetTouches&&t.targetTouches.length>0?t.targetTouches[0].pageX:t.pageX},e.prototype.setValueFromEvt_=function(t){var e=this.getPageX_(t),r=this.computeValueFromPageX_(e);this.setValue_(r,!0)},e.prototype.computeValueFromPageX_=function(t){var e=this,r=e.max_,n=e.min_,i=t-this.rect_.left,o=i/this.rect_.width;return this.adapter_.isRTL()&&(o=1-o),n+o*(r-n)},e.prototype.handleKeydown_=function(t){var e=this.getKeyId_(t),r=this.getValueForKeyId_(e);isNaN(r)||(t.preventDefault(),this.adapter_.addClass(s.cssClasses.FOCUS),this.setValue_(r,!0),this.adapter_.notifyChange())},e.prototype.getKeyId_=function(t){return t.key===_.ARROW_LEFT||37===t.keyCode?_.ARROW_LEFT:t.key===_.ARROW_RIGHT||39===t.keyCode?_.ARROW_RIGHT:t.key===_.ARROW_UP||38===t.keyCode?_.ARROW_UP:t.key===_.ARROW_DOWN||40===t.keyCode?_.ARROW_DOWN:t.key===_.HOME||36===t.keyCode?_.HOME:t.key===_.END||35===t.keyCode?_.END:t.key===_.PAGE_UP||33===t.keyCode?_.PAGE_UP:t.key===_.PAGE_DOWN||34===t.keyCode?_.PAGE_DOWN:""},e.prototype.getValueForKeyId_=function(t){var e=this,r=e.max_,n=e.min_,i=e.step_,o=i||(r-n)/100;switch(this.adapter_.isRTL()&&(t===_.ARROW_LEFT||t===_.ARROW_RIGHT)&&(o=-o),t){case _.ARROW_LEFT:case _.ARROW_DOWN:return this.value_-o;case _.ARROW_RIGHT:case _.ARROW_UP:return this.value_+o;case _.HOME:return this.min_;case _.END:return this.max_;case _.PAGE_UP:return this.value_+o*s.numbers.PAGE_FACTOR;case _.PAGE_DOWN:return this.value_-o*s.numbers.PAGE_FACTOR;default:return NaN}},e.prototype.handleFocus_=function(){this.preventFocusState_||this.adapter_.addClass(s.cssClasses.FOCUS)},e.prototype.handleBlur_=function(){this.preventFocusState_=!1,this.adapter_.removeClass(s.cssClasses.FOCUS)},e.prototype.setValue_=function(t,e,r){if(void 0===r&&(r=!1),t!==this.value_||r){var n=this,i=n.min_,o=n.max_,a=t===i||t===o;this.step_&&!a&&(t=this.quantize_(t)),t<i?t=i:t>o&&(t=o),this.value_=t,this.adapter_.setAttribute(s.strings.ARIA_VALUENOW,String(this.value_)),this.updateUIForCurrentValue_(),e&&(this.adapter_.notifyInput(),this.isDiscrete_&&this.adapter_.setMarkerValue(t))}},e.prototype.quantize_=function(t){return Math.round(t/this.step_)*this.step_},e.prototype.updateUIForCurrentValue_=function(){var t=this,e=this,r=e.max_,n=e.min_,i=e.value_,a=(i-n)/(r-n),s=a*this.rect_.width;this.adapter_.isRTL()&&(s=this.rect_.width-s);var u=o.getCorrectPropertyName(window,"transform"),c=o.getCorrectEventName(window,"transitionend");if(this.inTransit_){var d=function e(){t.setInTransit_(!1),t.adapter_.deregisterThumbContainerInteractionHandler(c,e)};this.adapter_.registerThumbContainerInteractionHandler(c,d)}requestAnimationFrame(function(){t.adapter_.setThumbContainerStyleProperty(u,"translateX("+s+"px) translateX(-50%)"),t.adapter_.setTrackStyleProperty(u,"scaleX("+a+")")})},e.prototype.setActive_=function(t){this.active_=t,this.toggleClass_(s.cssClasses.ACTIVE,this.active_)},e.prototype.setInTransit_=function(t){this.inTransit_=t,this.toggleClass_(s.cssClasses.IN_TRANSIT,this.inTransit_)},e.prototype.toggleClass_=function(t,e){e?this.adapter_.addClass(t):this.adapter_.removeClass(t)},e}(a.MDCFoundation);e.MDCSliderFoundation=l,e.default=l}})}); | ||
!function(t,e){"object"==typeof exports&&"object"==typeof module?module.exports=e():"function"==typeof define&&define.amd?define([],e):"object"==typeof exports?exports.slider=e():(t.mdc=t.mdc||{},t.mdc.slider=e())}(this,function(){return function(t){function e(n){if(r[n])return r[n].exports;var i=r[n]={i:n,l:!1,exports:{}};return t[n].call(i.exports,i,i.exports,e),i.l=!0,i.exports}var r={};return e.m=t,e.c=r,e.d=function(t,r,n){e.o(t,r)||Object.defineProperty(t,r,{configurable:!1,enumerable:!0,get:n})},e.n=function(t){var r=t&&t.__esModule?function(){return t.default}:function(){return t};return e.d(r,"a",r),r},e.o=function(t,e){return Object.prototype.hasOwnProperty.call(t,e)},e.p="",e(e.s=152)}({0:function(t,e,r){"use strict";Object.defineProperty(e,"__esModule",{value:!0});var n=function(){function t(t){void 0===t&&(t={}),this.adapter_=t}return Object.defineProperty(t,"cssClasses",{get:function(){return{}},enumerable:!0,configurable:!0}),Object.defineProperty(t,"strings",{get:function(){return{}},enumerable:!0,configurable:!0}),Object.defineProperty(t,"numbers",{get:function(){return{}},enumerable:!0,configurable:!0}),Object.defineProperty(t,"defaultAdapter",{get:function(){return{}},enumerable:!0,configurable:!0}),t.prototype.init=function(){},t.prototype.destroy=function(){},t}();e.MDCFoundation=n,e.default=n},1:function(t,e,r){"use strict";var n=this&&this.__read||function(t,e){var r="function"==typeof Symbol&&t[Symbol.iterator];if(!r)return t;var n,i,o=r.call(t),a=[];try{for(;(void 0===e||e-- >0)&&!(n=o.next()).done;)a.push(n.value)}catch(t){i={error:t}}finally{try{n&&!n.done&&(r=o.return)&&r.call(o)}finally{if(i)throw i.error}}return a},i=this&&this.__spread||function(){for(var t=[],e=0;e<arguments.length;e++)t=t.concat(n(arguments[e]));return t};Object.defineProperty(e,"__esModule",{value:!0});var o=r(0),a=function(){function t(t,e){for(var r=[],n=2;n<arguments.length;n++)r[n-2]=arguments[n];this.root_=t,this.initialize.apply(this,i(r)),this.foundation_=void 0===e?this.getDefaultFoundation():e,this.foundation_.init(),this.initialSyncWithDOM()}return t.attachTo=function(e){return new t(e,new o.MDCFoundation({}))},t.prototype.initialize=function(){for(var t=[],e=0;e<arguments.length;e++)t[e]=arguments[e]},t.prototype.getDefaultFoundation=function(){throw new Error("Subclasses must override getDefaultFoundation to return a properly configured foundation class")},t.prototype.initialSyncWithDOM=function(){},t.prototype.destroy=function(){this.foundation_.destroy()},t.prototype.listen=function(t,e){this.root_.addEventListener(t,e)},t.prototype.unlisten=function(t,e){this.root_.removeEventListener(t,e)},t.prototype.emit=function(t,e,r){void 0===r&&(r=!1);var n;"function"==typeof CustomEvent?n=new CustomEvent(t,{bubbles:r,detail:e}):(n=document.createEvent("CustomEvent"),n.initCustomEvent(t,r,!1,e)),this.root_.dispatchEvent(n)},t}();e.MDCComponent=a,e.default=a},11:function(t,e,r){"use strict";function n(t){return Boolean(t.document)&&"function"==typeof t.document.createElement}function i(t,e){if(n(t)&&e in a){var r=t.document.createElement("div"),i=a[e],o=i.standard,s=i.prefixed;return o in r.style?o:s}return e}function o(t,e){if(n(t)&&e in s){var r=t.document.createElement("div"),i=s[e],o=i.standard,a=i.prefixed;return i.cssProperty in r.style?o:a}return e}Object.defineProperty(e,"__esModule",{value:!0});var a={animation:{prefixed:"-webkit-animation",standard:"animation"},transform:{prefixed:"-webkit-transform",standard:"transform"},transition:{prefixed:"-webkit-transition",standard:"transition"}},s={animationend:{cssProperty:"animation",prefixed:"webkitAnimationEnd",standard:"animationend"},animationiteration:{cssProperty:"animation",prefixed:"webkitAnimationIteration",standard:"animationiteration"},animationstart:{cssProperty:"animation",prefixed:"webkitAnimationStart",standard:"animationstart"},transitionend:{cssProperty:"transition",prefixed:"webkitTransitionEnd",standard:"transitionend"}};e.getCorrectPropertyName=i,e.getCorrectEventName=o},152:function(t,e,r){"use strict";function n(t){for(var r in t)e.hasOwnProperty(r)||(e[r]=t[r])}Object.defineProperty(e,"__esModule",{value:!0}),n(r(153)),n(r(44)),n(r(86))},153:function(t,e,r){"use strict";var n=this&&this.__extends||function(){var t=function(e,r){return(t=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var r in e)e.hasOwnProperty(r)&&(t[r]=e[r])})(e,r)};return function(e,r){function n(){this.constructor=e}t(e,r),e.prototype=null===r?Object.create(r):(n.prototype=r.prototype,new n)}}();Object.defineProperty(e,"__esModule",{value:!0});var i=r(1),o=r(44),a=r(86),s=function(t){function e(){return null!==t&&t.apply(this,arguments)||this}return n(e,t),e.attachTo=function(t){return new e(t)},Object.defineProperty(e.prototype,"value",{get:function(){return this.foundation_.getValue()},set:function(t){this.foundation_.setValue(t)},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"min",{get:function(){return this.foundation_.getMin()},set:function(t){this.foundation_.setMin(t)},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"max",{get:function(){return this.foundation_.getMax()},set:function(t){this.foundation_.setMax(t)},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"step",{get:function(){return this.foundation_.getStep()},set:function(t){this.foundation_.setStep(t)},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"disabled",{get:function(){return this.foundation_.isDisabled()},set:function(t){this.foundation_.setDisabled(t)},enumerable:!0,configurable:!0}),e.prototype.initialize=function(){this.thumbContainer_=this.root_.querySelector(o.strings.THUMB_CONTAINER_SELECTOR),this.track_=this.root_.querySelector(o.strings.TRACK_SELECTOR),this.pinValueMarker_=this.root_.querySelector(o.strings.PIN_VALUE_MARKER_SELECTOR),this.trackMarkerContainer_=this.root_.querySelector(o.strings.TRACK_MARKER_CONTAINER_SELECTOR)},e.prototype.getDefaultFoundation=function(){var t=this,e={hasClass:function(e){return t.root_.classList.contains(e)},addClass:function(e){return t.root_.classList.add(e)},removeClass:function(e){return t.root_.classList.remove(e)},getAttribute:function(e){return t.root_.getAttribute(e)},setAttribute:function(e,r){return t.root_.setAttribute(e,r)},removeAttribute:function(e){return t.root_.removeAttribute(e)},computeBoundingRect:function(){return t.root_.getBoundingClientRect()},getTabIndex:function(){return t.root_.tabIndex},registerInteractionHandler:function(e,r){return t.listen(e,r)},deregisterInteractionHandler:function(e,r){return t.unlisten(e,r)},registerThumbContainerInteractionHandler:function(e,r){t.thumbContainer_.addEventListener(e,r)},deregisterThumbContainerInteractionHandler:function(e,r){t.thumbContainer_.removeEventListener(e,r)},registerBodyInteractionHandler:function(t,e){return document.body.addEventListener(t,e)},deregisterBodyInteractionHandler:function(t,e){return document.body.removeEventListener(t,e)},registerResizeHandler:function(t){return window.addEventListener("resize",t)},deregisterResizeHandler:function(t){return window.removeEventListener("resize",t)},notifyInput:function(){return t.emit(o.strings.INPUT_EVENT,t)},notifyChange:function(){return t.emit(o.strings.CHANGE_EVENT,t)},setThumbContainerStyleProperty:function(e,r){t.thumbContainer_.style.setProperty(e,r)},setTrackStyleProperty:function(e,r){return t.track_.style.setProperty(e,r)},setMarkerValue:function(e){return t.pinValueMarker_.innerText=e.toLocaleString()},appendTrackMarkers:function(e){for(var r=document.createDocumentFragment(),n=0;n<e;n++){var i=document.createElement("div");i.classList.add("mdc-slider__track-marker"),r.appendChild(i)}t.trackMarkerContainer_.appendChild(r)},removeTrackMarkers:function(){for(;t.trackMarkerContainer_.firstChild;)t.trackMarkerContainer_.removeChild(t.trackMarkerContainer_.firstChild)},setLastTrackMarkersStyleProperty:function(e,r){t.root_.querySelector(o.strings.LAST_TRACK_MARKER_SELECTOR).style.setProperty(e,r)},isRTL:function(){return"rtl"===getComputedStyle(t.root_).direction}};return new a.MDCSliderFoundation(e)},e.prototype.initialSyncWithDOM=function(){var t=this.parseFloat_(this.root_.getAttribute(o.strings.ARIA_VALUENOW),this.value),e=this.parseFloat_(this.root_.getAttribute(o.strings.ARIA_VALUEMIN),this.min),r=this.parseFloat_(this.root_.getAttribute(o.strings.ARIA_VALUEMAX),this.max);e>=this.max?(this.max=r,this.min=e):(this.min=e,this.max=r),this.step=this.parseFloat_(this.root_.getAttribute(o.strings.STEP_DATA_ATTR),this.step),this.value=t,this.disabled=this.root_.hasAttribute(o.strings.ARIA_DISABLED)&&"false"!==this.root_.getAttribute(o.strings.ARIA_DISABLED),this.foundation_.setupTrackMarker()},e.prototype.layout=function(){this.foundation_.layout()},e.prototype.stepUp=function(t){void 0===t&&(t=this.step||1),this.value+=t},e.prototype.stepDown=function(t){void 0===t&&(t=this.step||1),this.value-=t},e.prototype.parseFloat_=function(t,e){var r=parseFloat(t);return"number"==typeof r&&isFinite(r)?r:e},e}(i.MDCComponent);e.MDCSlider=s},44:function(t,e,r){"use strict";Object.defineProperty(e,"__esModule",{value:!0});var n={ACTIVE:"mdc-slider--active",DISABLED:"mdc-slider--disabled",DISCRETE:"mdc-slider--discrete",FOCUS:"mdc-slider--focus",HAS_TRACK_MARKER:"mdc-slider--display-markers",IN_TRANSIT:"mdc-slider--in-transit",IS_DISCRETE:"mdc-slider--discrete"};e.cssClasses=n;var i={ARIA_DISABLED:"aria-disabled",ARIA_VALUEMAX:"aria-valuemax",ARIA_VALUEMIN:"aria-valuemin",ARIA_VALUENOW:"aria-valuenow",CHANGE_EVENT:"MDCSlider:change",INPUT_EVENT:"MDCSlider:input",LAST_TRACK_MARKER_SELECTOR:".mdc-slider__track-marker:last-child",PIN_VALUE_MARKER_SELECTOR:".mdc-slider__pin-value-marker",STEP_DATA_ATTR:"data-step",THUMB_CONTAINER_SELECTOR:".mdc-slider__thumb-container",TRACK_MARKER_CONTAINER_SELECTOR:".mdc-slider__track-marker-container",TRACK_SELECTOR:".mdc-slider__track"};e.strings=i;var o={PAGE_FACTOR:4};e.numbers=o},86:function(t,e,r){"use strict";var n=this&&this.__extends||function(){var t=function(e,r){return(t=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var r in e)e.hasOwnProperty(r)&&(t[r]=e[r])})(e,r)};return function(e,r){function n(){this.constructor=e}t(e,r),e.prototype=null===r?Object.create(r):(n.prototype=r.prototype,new n)}}(),i=this&&this.__assign||function(){return i=Object.assign||function(t){for(var e,r=1,n=arguments.length;r<n;r++){e=arguments[r];for(var i in e)Object.prototype.hasOwnProperty.call(e,i)&&(t[i]=e[i])}return t},i.apply(this,arguments)};Object.defineProperty(e,"__esModule",{value:!0});var o=r(11),a=r(0),s=r(44),u=["mousedown","pointerdown","touchstart"],c=["mouseup","pointerup","touchend"],d={mousedown:"mousemove",pointerdown:"pointermove",touchstart:"touchmove"},_={ARROW_DOWN:"ArrowDown",ARROW_LEFT:"ArrowLeft",ARROW_RIGHT:"ArrowRight",ARROW_UP:"ArrowUp",END:"End",HOME:"Home",PAGE_DOWN:"PageDown",PAGE_UP:"PageUp"},l=function(t){function e(r){var n=t.call(this,i({},e.defaultAdapter,r))||this;return n.savedTabIndex_=NaN,n.active_=!1,n.inTransit_=!1,n.isDiscrete_=!1,n.hasTrackMarker_=!1,n.handlingThumbTargetEvt_=!1,n.min_=0,n.max_=100,n.step_=0,n.value_=0,n.disabled_=!1,n.preventFocusState_=!1,n.thumbContainerPointerHandler_=function(){return n.handlingThumbTargetEvt_=!0},n.interactionStartHandler_=function(t){return n.handleDown_(t)},n.keydownHandler_=function(t){return n.handleKeydown_(t)},n.focusHandler_=function(){return n.handleFocus_()},n.blurHandler_=function(){return n.handleBlur_()},n.resizeHandler_=function(){return n.layout()},n}return n(e,t),Object.defineProperty(e,"cssClasses",{get:function(){return s.cssClasses},enumerable:!0,configurable:!0}),Object.defineProperty(e,"strings",{get:function(){return s.strings},enumerable:!0,configurable:!0}),Object.defineProperty(e,"numbers",{get:function(){return s.numbers},enumerable:!0,configurable:!0}),Object.defineProperty(e,"defaultAdapter",{get:function(){return{hasClass:function(){return!1},addClass:function(){},removeClass:function(){},getAttribute:function(){return null},setAttribute:function(){},removeAttribute:function(){},computeBoundingRect:function(){return{top:0,right:0,bottom:0,left:0,width:0,height:0}},getTabIndex:function(){return 0},registerInteractionHandler:function(){},deregisterInteractionHandler:function(){},registerThumbContainerInteractionHandler:function(){},deregisterThumbContainerInteractionHandler:function(){},registerBodyInteractionHandler:function(){},deregisterBodyInteractionHandler:function(){},registerResizeHandler:function(){},deregisterResizeHandler:function(){},notifyInput:function(){},notifyChange:function(){},setThumbContainerStyleProperty:function(){},setTrackStyleProperty:function(){},setMarkerValue:function(){},appendTrackMarkers:function(){},removeTrackMarkers:function(){},setLastTrackMarkersStyleProperty:function(){},isRTL:function(){return!1}}},enumerable:!0,configurable:!0}),e.prototype.init=function(){var t=this;this.isDiscrete_=this.adapter_.hasClass(s.cssClasses.IS_DISCRETE),this.hasTrackMarker_=this.adapter_.hasClass(s.cssClasses.HAS_TRACK_MARKER),u.forEach(function(e){t.adapter_.registerInteractionHandler(e,t.interactionStartHandler_),t.adapter_.registerThumbContainerInteractionHandler(e,t.thumbContainerPointerHandler_)}),this.adapter_.registerInteractionHandler("keydown",this.keydownHandler_),this.adapter_.registerInteractionHandler("focus",this.focusHandler_),this.adapter_.registerInteractionHandler("blur",this.blurHandler_),this.adapter_.registerResizeHandler(this.resizeHandler_),this.layout(),this.isDiscrete_&&0===this.getStep()&&(this.step_=1)},e.prototype.destroy=function(){var t=this;u.forEach(function(e){t.adapter_.deregisterInteractionHandler(e,t.interactionStartHandler_),t.adapter_.deregisterThumbContainerInteractionHandler(e,t.thumbContainerPointerHandler_)}),this.adapter_.deregisterInteractionHandler("keydown",this.keydownHandler_),this.adapter_.deregisterInteractionHandler("focus",this.focusHandler_),this.adapter_.deregisterInteractionHandler("blur",this.blurHandler_),this.adapter_.deregisterResizeHandler(this.resizeHandler_)},e.prototype.setupTrackMarker=function(){if(this.isDiscrete_&&this.hasTrackMarker_&&0!==this.getStep()){var t=this.getMin(),e=this.getMax(),r=this.getStep(),n=(e-t)/r,i=Math.ceil(n)!==n;if(i&&(n=Math.ceil(n)),this.adapter_.removeTrackMarkers(),this.adapter_.appendTrackMarkers(n),i){var o=(e-n*r)/r+1;this.adapter_.setLastTrackMarkersStyleProperty("flex-grow",String(o))}}},e.prototype.layout=function(){this.rect_=this.adapter_.computeBoundingRect(),this.updateUIForCurrentValue_()},e.prototype.getValue=function(){return this.value_},e.prototype.setValue=function(t){this.setValue_(t,!1)},e.prototype.getMax=function(){return this.max_},e.prototype.setMax=function(t){if(t<this.min_)throw new Error("Cannot set max to be less than the slider's minimum value");this.max_=t,this.setValue_(this.value_,!1,!0),this.adapter_.setAttribute(s.strings.ARIA_VALUEMAX,String(this.max_)),this.setupTrackMarker()},e.prototype.getMin=function(){return this.min_},e.prototype.setMin=function(t){if(t>this.max_)throw new Error("Cannot set min to be greater than the slider's maximum value");this.min_=t,this.setValue_(this.value_,!1,!0),this.adapter_.setAttribute(s.strings.ARIA_VALUEMIN,String(this.min_)),this.setupTrackMarker()},e.prototype.getStep=function(){return this.step_},e.prototype.setStep=function(t){if(t<0)throw new Error("Step cannot be set to a negative number");this.isDiscrete_&&("number"!=typeof t||t<1)&&(t=1),this.step_=t,this.setValue_(this.value_,!1,!0),this.setupTrackMarker()},e.prototype.isDisabled=function(){return this.disabled_},e.prototype.setDisabled=function(t){this.disabled_=t,this.toggleClass_(s.cssClasses.DISABLED,this.disabled_),this.disabled_?(this.savedTabIndex_=this.adapter_.getTabIndex(),this.adapter_.setAttribute(s.strings.ARIA_DISABLED,"true"),this.adapter_.removeAttribute("tabindex")):(this.adapter_.removeAttribute(s.strings.ARIA_DISABLED),isNaN(this.savedTabIndex_)||this.adapter_.setAttribute("tabindex",String(this.savedTabIndex_)))},e.prototype.handleDown_=function(t){var e=this;if(!this.disabled_){this.preventFocusState_=!0,this.setInTransit_(!this.handlingThumbTargetEvt_),this.handlingThumbTargetEvt_=!1,this.setActive_(!0);var r=function(t){e.handleMove_(t)},n=d[t.type],i=function t(){e.handleUp_(),e.adapter_.deregisterBodyInteractionHandler(n,r),c.forEach(function(r){return e.adapter_.deregisterBodyInteractionHandler(r,t)})};this.adapter_.registerBodyInteractionHandler(n,r),c.forEach(function(t){return e.adapter_.registerBodyInteractionHandler(t,i)}),this.setValueFromEvt_(t)}},e.prototype.handleMove_=function(t){t.preventDefault(),this.setValueFromEvt_(t)},e.prototype.handleUp_=function(){this.setActive_(!1),this.adapter_.notifyChange()},e.prototype.getPageX_=function(t){return t.targetTouches&&t.targetTouches.length>0?t.targetTouches[0].pageX:t.pageX},e.prototype.setValueFromEvt_=function(t){var e=this.getPageX_(t),r=this.computeValueFromPageX_(e);this.setValue_(r,!0)},e.prototype.computeValueFromPageX_=function(t){var e=this,r=e.max_,n=e.min_,i=t-this.rect_.left,o=i/this.rect_.width;return this.adapter_.isRTL()&&(o=1-o),n+o*(r-n)},e.prototype.handleKeydown_=function(t){var e=this.getKeyId_(t),r=this.getValueForKeyId_(e);isNaN(r)||(t.preventDefault(),this.adapter_.addClass(s.cssClasses.FOCUS),this.setValue_(r,!0),this.adapter_.notifyChange())},e.prototype.getKeyId_=function(t){return t.key===_.ARROW_LEFT||37===t.keyCode?_.ARROW_LEFT:t.key===_.ARROW_RIGHT||39===t.keyCode?_.ARROW_RIGHT:t.key===_.ARROW_UP||38===t.keyCode?_.ARROW_UP:t.key===_.ARROW_DOWN||40===t.keyCode?_.ARROW_DOWN:t.key===_.HOME||36===t.keyCode?_.HOME:t.key===_.END||35===t.keyCode?_.END:t.key===_.PAGE_UP||33===t.keyCode?_.PAGE_UP:t.key===_.PAGE_DOWN||34===t.keyCode?_.PAGE_DOWN:""},e.prototype.getValueForKeyId_=function(t){var e=this,r=e.max_,n=e.min_,i=e.step_,o=i||(r-n)/100;switch(this.adapter_.isRTL()&&(t===_.ARROW_LEFT||t===_.ARROW_RIGHT)&&(o=-o),t){case _.ARROW_LEFT:case _.ARROW_DOWN:return this.value_-o;case _.ARROW_RIGHT:case _.ARROW_UP:return this.value_+o;case _.HOME:return this.min_;case _.END:return this.max_;case _.PAGE_UP:return this.value_+o*s.numbers.PAGE_FACTOR;case _.PAGE_DOWN:return this.value_-o*s.numbers.PAGE_FACTOR;default:return NaN}},e.prototype.handleFocus_=function(){this.preventFocusState_||this.adapter_.addClass(s.cssClasses.FOCUS)},e.prototype.handleBlur_=function(){this.preventFocusState_=!1,this.adapter_.removeClass(s.cssClasses.FOCUS)},e.prototype.setValue_=function(t,e,r){if(void 0===r&&(r=!1),t!==this.value_||r){var n=this,i=n.min_,o=n.max_,a=t===i||t===o;this.step_&&!a&&(t=this.quantize_(t)),t<i?t=i:t>o&&(t=o),this.value_=t,this.adapter_.setAttribute(s.strings.ARIA_VALUENOW,String(this.value_)),this.updateUIForCurrentValue_(),e&&(this.adapter_.notifyInput(),this.isDiscrete_&&this.adapter_.setMarkerValue(t))}},e.prototype.quantize_=function(t){return Math.round(t/this.step_)*this.step_},e.prototype.updateUIForCurrentValue_=function(){var t=this,e=this,r=e.max_,n=e.min_,i=e.value_,a=(i-n)/(r-n),s=a*this.rect_.width;this.adapter_.isRTL()&&(s=this.rect_.width-s);var u=o.getCorrectPropertyName(window,"transform"),c=o.getCorrectEventName(window,"transitionend");if(this.inTransit_){var d=function e(){t.setInTransit_(!1),t.adapter_.deregisterThumbContainerInteractionHandler(c,e)};this.adapter_.registerThumbContainerInteractionHandler(c,d)}requestAnimationFrame(function(){t.adapter_.setThumbContainerStyleProperty(u,"translateX("+s+"px) translateX(-50%)"),t.adapter_.setTrackStyleProperty(u,"scaleX("+a+")")})},e.prototype.setActive_=function(t){this.active_=t,this.toggleClass_(s.cssClasses.ACTIVE,this.active_)},e.prototype.setInTransit_=function(t){this.inTransit_=t,this.toggleClass_(s.cssClasses.IN_TRANSIT,this.inTransit_)},e.prototype.toggleClass_=function(t,e){e?this.adapter_.addClass(t):this.adapter_.removeClass(t)},e}(a.MDCFoundation);e.MDCSliderFoundation=l,e.default=l}})}); | ||
//# sourceMappingURL=mdc.slider.min.js.map |
@@ -25,2 +25,3 @@ /** | ||
export * from './component'; | ||
export * from './constants'; | ||
export * from './foundation'; |
@@ -24,3 +24,4 @@ /** | ||
export * from './component'; | ||
export * from './constants'; | ||
export * from './foundation'; | ||
//# sourceMappingURL=index.js.map |
{ | ||
"name": "@material/slider", | ||
"version": "1.1.0", | ||
"version": "2.3.0", | ||
"description": "The Material Components for the web slider component", | ||
@@ -27,5 +27,5 @@ "main": "dist/mdc.slider.js", | ||
"@material/theme": "^1.1.0", | ||
"@material/typography": "^1.0.0", | ||
"@material/typography": "^2.3.0", | ||
"tslib": "^1.9.3" | ||
} | ||
} |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
New author
Supply chain riskA new npm collaborator published a version of the package for the first time. New collaborators are usually benign additions to a project, but do indicate a change to the security surface area of a package.
Found 1 instance in 1 package
Mixed license
License(Experimental) Package contains multiple licenses.
Found 1 instance in 1 package
516538
1
2925
1
+ Added@material/typography@2.3.0(transitive)
- Removed@material/typography@1.0.0(transitive)
Updated@material/typography@^2.3.0