414 lines
16 KiB
JavaScript
414 lines
16 KiB
JavaScript
/**
|
|
* @license
|
|
* Copyright Google LLC All Rights Reserved.
|
|
*
|
|
* 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
|
|
*/
|
|
(function webpackUniversalModuleDefinition(root, factory) {
|
|
if(typeof exports === 'object' && typeof module === 'object')
|
|
module.exports = factory();
|
|
else if(typeof define === 'function' && define.amd)
|
|
define("@material/animation", [], factory);
|
|
else if(typeof exports === 'object')
|
|
exports["animation"] = factory();
|
|
else
|
|
root["mdc"] = root["mdc"] || {}, root["mdc"]["animation"] = 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, { enumerable: true, get: getter });
|
|
/******/ }
|
|
/******/ };
|
|
/******/
|
|
/******/ // define __esModule on exports
|
|
/******/ __webpack_require__.r = function(exports) {
|
|
/******/ if(typeof Symbol !== 'undefined' && Symbol.toStringTag) {
|
|
/******/ Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });
|
|
/******/ }
|
|
/******/ Object.defineProperty(exports, '__esModule', { value: true });
|
|
/******/ };
|
|
/******/
|
|
/******/ // create a fake namespace object
|
|
/******/ // mode & 1: value is a module id, require it
|
|
/******/ // mode & 2: merge all properties of value into the ns
|
|
/******/ // mode & 4: return value when already ns object
|
|
/******/ // mode & 8|1: behave like require
|
|
/******/ __webpack_require__.t = function(value, mode) {
|
|
/******/ if(mode & 1) value = __webpack_require__(value);
|
|
/******/ if(mode & 8) return value;
|
|
/******/ if((mode & 4) && typeof value === 'object' && value && value.__esModule) return value;
|
|
/******/ var ns = Object.create(null);
|
|
/******/ __webpack_require__.r(ns);
|
|
/******/ Object.defineProperty(ns, 'default', { enumerable: true, value: value });
|
|
/******/ if(mode & 2 && typeof value != 'string') for(var key in value) __webpack_require__.d(ns, key, function(key) { return value[key]; }.bind(null, key));
|
|
/******/ return ns;
|
|
/******/ };
|
|
/******/
|
|
/******/ // 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 = "./packages/mdc-animation/index.ts");
|
|
/******/ })
|
|
/************************************************************************/
|
|
/******/ ({
|
|
|
|
/***/ "./packages/mdc-animation/animationframe.ts":
|
|
/*!**************************************************!*\
|
|
!*** ./packages/mdc-animation/animationframe.ts ***!
|
|
\**************************************************/
|
|
/*! no static exports found */
|
|
/***/ (function(module, exports, __webpack_require__) {
|
|
|
|
"use strict";
|
|
|
|
/**
|
|
* @license
|
|
* Copyright 2020 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 });
|
|
exports.AnimationFrame = void 0;
|
|
/**
|
|
* AnimationFrame provides a user-friendly abstraction around requesting
|
|
* and canceling animation frames.
|
|
*/
|
|
var AnimationFrame = /** @class */function () {
|
|
function AnimationFrame() {
|
|
this.rafIDs = new Map();
|
|
}
|
|
/**
|
|
* Requests an animation frame. Cancels any existing frame with the same key.
|
|
* @param {string} key The key for this callback.
|
|
* @param {FrameRequestCallback} callback The callback to be executed.
|
|
*/
|
|
AnimationFrame.prototype.request = function (key, callback) {
|
|
var _this = this;
|
|
this.cancel(key);
|
|
var frameID = requestAnimationFrame(function (frame) {
|
|
_this.rafIDs.delete(key);
|
|
// Callback must come *after* the key is deleted so that nested calls to
|
|
// request with the same key are not deleted.
|
|
callback(frame);
|
|
});
|
|
this.rafIDs.set(key, frameID);
|
|
};
|
|
/**
|
|
* Cancels a queued callback with the given key.
|
|
* @param {string} key The key for this callback.
|
|
*/
|
|
AnimationFrame.prototype.cancel = function (key) {
|
|
var rafID = this.rafIDs.get(key);
|
|
if (rafID) {
|
|
cancelAnimationFrame(rafID);
|
|
this.rafIDs.delete(key);
|
|
}
|
|
};
|
|
/**
|
|
* Cancels all queued callback.
|
|
*/
|
|
AnimationFrame.prototype.cancelAll = function () {
|
|
var _this = this;
|
|
// Need to use forEach because it's the only iteration method supported
|
|
// by IE11. Suppress the underscore because we don't need it.
|
|
// tslint:disable-next-line:enforce-name-casing
|
|
this.rafIDs.forEach(function (_, key) {
|
|
_this.cancel(key);
|
|
});
|
|
};
|
|
/**
|
|
* Returns the queue of unexecuted callback keys.
|
|
*/
|
|
AnimationFrame.prototype.getQueue = function () {
|
|
var queue = [];
|
|
// Need to use forEach because it's the only iteration method supported
|
|
// by IE11. Suppress the underscore because we don't need it.
|
|
// tslint:disable-next-line:enforce-name-casing
|
|
this.rafIDs.forEach(function (_, key) {
|
|
queue.push(key);
|
|
});
|
|
return queue;
|
|
};
|
|
return AnimationFrame;
|
|
}();
|
|
exports.AnimationFrame = AnimationFrame;
|
|
|
|
/***/ }),
|
|
|
|
/***/ "./packages/mdc-animation/index.ts":
|
|
/*!*****************************************!*\
|
|
!*** ./packages/mdc-animation/index.ts ***!
|
|
\*****************************************/
|
|
/*! no static exports found */
|
|
/***/ (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.
|
|
*/
|
|
|
|
var __createBinding = this && this.__createBinding || (Object.create ? function (o, m, k, k2) {
|
|
if (k2 === undefined) k2 = k;
|
|
Object.defineProperty(o, k2, { enumerable: true, get: function get() {
|
|
return m[k];
|
|
} });
|
|
} : function (o, m, k, k2) {
|
|
if (k2 === undefined) k2 = k;
|
|
o[k2] = m[k];
|
|
});
|
|
var __setModuleDefault = this && this.__setModuleDefault || (Object.create ? function (o, v) {
|
|
Object.defineProperty(o, "default", { enumerable: true, value: v });
|
|
} : function (o, v) {
|
|
o["default"] = v;
|
|
});
|
|
var __importStar = this && this.__importStar || function (mod) {
|
|
if (mod && mod.__esModule) return mod;
|
|
var result = {};
|
|
if (mod != null) for (var k in mod) {
|
|
if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
|
|
}__setModuleDefault(result, mod);
|
|
return result;
|
|
};
|
|
var __exportStar = this && this.__exportStar || function (m, exports) {
|
|
for (var p in m) {
|
|
if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
|
|
}
|
|
};
|
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
exports.util = void 0;
|
|
var util = __importStar(__webpack_require__(/*! ./util */ "./packages/mdc-animation/util.ts"));
|
|
exports.util = util;
|
|
__exportStar(__webpack_require__(/*! ./animationframe */ "./packages/mdc-animation/animationframe.ts"), exports);
|
|
__exportStar(__webpack_require__(/*! ./types */ "./packages/mdc-animation/types.ts"), exports);
|
|
__exportStar(__webpack_require__(/*! ./util */ "./packages/mdc-animation/util.ts"), exports); // Old namespace for backward compatibility
|
|
|
|
/***/ }),
|
|
|
|
/***/ "./packages/mdc-animation/types.ts":
|
|
/*!*****************************************!*\
|
|
!*** ./packages/mdc-animation/types.ts ***!
|
|
\*****************************************/
|
|
/*! no static exports found */
|
|
/***/ (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.
|
|
*/
|
|
|
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
|
/***/ }),
|
|
|
|
/***/ "./packages/mdc-animation/util.ts":
|
|
/*!****************************************!*\
|
|
!*** ./packages/mdc-animation/util.ts ***!
|
|
\****************************************/
|
|
/*! no static exports found */
|
|
/***/ (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 });
|
|
exports.getCorrectEventName = exports.getCorrectPropertyName = void 0;
|
|
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;
|
|
|
|
/***/ })
|
|
|
|
/******/ });
|
|
});
|
|
//# sourceMappingURL=mdc.animation.js.map
|