@material/menu
Advanced tools
Comparing version
@@ -78,3 +78,3 @@ /*! | ||
/******/ // Load entry module and return exports | ||
/******/ return __webpack_require__(__webpack_require__.s = 64); | ||
/******/ return __webpack_require__(__webpack_require__.s = 66); | ||
/******/ }) | ||
@@ -359,3 +359,3 @@ /************************************************************************/ | ||
/***/ 11: | ||
/***/ 10: | ||
/***/ (function(module, __webpack_exports__, __webpack_require__) { | ||
@@ -365,4 +365,172 @@ | ||
Object.defineProperty(__webpack_exports__, "__esModule", { value: true }); | ||
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_0__util__ = __webpack_require__(9); | ||
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_1__simple__ = __webpack_require__(13); | ||
/* harmony export (immutable) */ __webpack_exports__["getTransformPropertyName"] = getTransformPropertyName; | ||
/* harmony export (immutable) */ __webpack_exports__["clamp"] = clamp; | ||
/* harmony export (immutable) */ __webpack_exports__["bezierProgress"] = bezierProgress; | ||
/** | ||
* Copyright 2016 Google Inc. All Rights Reserved. | ||
* | ||
* Licensed under the Apache License, Version 2.0 (the "License"); | ||
* you may not use this file except in compliance with the License. | ||
* You may obtain a copy of the License at | ||
* | ||
* http://www.apache.org/licenses/LICENSE-2.0 | ||
* | ||
* Unless required by applicable law or agreed to in writing, software | ||
* distributed under the License is distributed on an "AS IS" BASIS, | ||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
* See the License for the specific language governing permissions and | ||
* limitations under the License. | ||
*/ | ||
/** @type {string|undefined} */ | ||
var storedTransformPropertyName_ = void 0; | ||
/** | ||
* Returns the name of the correct transform property to use on the current browser. | ||
* @param {!Window} globalObj | ||
* @param {boolean=} forceRefresh | ||
* @return {string} | ||
*/ | ||
function getTransformPropertyName(globalObj) { | ||
var forceRefresh = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : false; | ||
if (storedTransformPropertyName_ === undefined || forceRefresh) { | ||
var el = globalObj.document.createElement('div'); | ||
var transformPropertyName = 'transform' in el.style ? 'transform' : 'webkitTransform'; | ||
storedTransformPropertyName_ = transformPropertyName; | ||
} | ||
return storedTransformPropertyName_; | ||
} | ||
/** | ||
* Clamps a value between the minimum and the maximum, returning the clamped value. | ||
* @param {number} value | ||
* @param {number} min | ||
* @param {number} max | ||
* @return {number} | ||
*/ | ||
function clamp(value) { | ||
var min = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : 0; | ||
var max = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : 1; | ||
return Math.min(max, Math.max(min, value)); | ||
} | ||
/** | ||
* Returns the easing value to apply at time t, for a given cubic bezier curve. | ||
* Control points P0 and P3 are assumed to be (0,0) and (1,1), respectively. | ||
* Parameters are as follows: | ||
* - time: The current time in the animation, scaled between 0 and 1. | ||
* - x1: The x value of control point P1. | ||
* - y1: The y value of control point P1. | ||
* - x2: The x value of control point P2. | ||
* - y2: The y value of control point P2. | ||
* @param {number} time | ||
* @param {number} x1 | ||
* @param {number} y1 | ||
* @param {number} x2 | ||
* @param {number} y2 | ||
* @return {number} | ||
*/ | ||
function bezierProgress(time, x1, y1, x2, y2) { | ||
return getBezierCoordinate_(solvePositionFromXValue_(time, x1, x2), y1, y2); | ||
} | ||
/** | ||
* Compute a single coordinate at a position point between 0 and 1. | ||
* c1 and c2 are the matching coordinate on control points P1 and P2, respectively. | ||
* Control points P0 and P3 are assumed to be (0,0) and (1,1), respectively. | ||
* Adapted from https://github.com/google/closure-library/blob/master/closure/goog/math/bezier.js. | ||
* @param {number} t | ||
* @param {number} c1 | ||
* @param {number} c2 | ||
* @return {number} | ||
*/ | ||
function getBezierCoordinate_(t, c1, c2) { | ||
// Special case start and end. | ||
if (t === 0 || t === 1) { | ||
return t; | ||
} | ||
// Step one - from 4 points to 3 | ||
var ic0 = t * c1; | ||
var ic1 = c1 + t * (c2 - c1); | ||
var ic2 = c2 + t * (1 - c2); | ||
// Step two - from 3 points to 2 | ||
ic0 += t * (ic1 - ic0); | ||
ic1 += t * (ic2 - ic1); | ||
// Final step - last point | ||
return ic0 + t * (ic1 - ic0); | ||
} | ||
/** | ||
* Project a point onto the Bezier curve, from a given X. Calculates the position t along the curve. | ||
* Adapted from https://github.com/google/closure-library/blob/master/closure/goog/math/bezier.js. | ||
* @param {number} xVal | ||
* @param {number} x1 | ||
* @param {number} x2 | ||
* @return {number} | ||
*/ | ||
function solvePositionFromXValue_(xVal, x1, x2) { | ||
var EPSILON = 1e-6; | ||
var MAX_ITERATIONS = 8; | ||
if (xVal <= 0) { | ||
return 0; | ||
} else if (xVal >= 1) { | ||
return 1; | ||
} | ||
// Initial estimate of t using linear interpolation. | ||
var t = xVal; | ||
// Try gradient descent to solve for t. If it works, it is very fast. | ||
var tMin = 0; | ||
var tMax = 1; | ||
var value = 0; | ||
for (var i = 0; i < MAX_ITERATIONS; i++) { | ||
value = getBezierCoordinate_(t, x1, x2); | ||
var derivative = (getBezierCoordinate_(t + EPSILON, x1, x2) - value) / EPSILON; | ||
if (Math.abs(value - xVal) < EPSILON) { | ||
return t; | ||
} else if (Math.abs(derivative) < EPSILON) { | ||
break; | ||
} else { | ||
if (value < xVal) { | ||
tMin = t; | ||
} else { | ||
tMax = t; | ||
} | ||
t -= (value - xVal) / derivative; | ||
} | ||
} | ||
// If the gradient descent got stuck in a local minimum, e.g. because | ||
// the derivative was close to 0, use a Dichotomy refinement instead. | ||
// We limit the number of interations to 8. | ||
for (var _i = 0; Math.abs(value - xVal) > EPSILON && _i < MAX_ITERATIONS; _i++) { | ||
if (value < xVal) { | ||
tMin = t; | ||
t = (t + tMax) / 2; | ||
} else { | ||
tMax = t; | ||
t = (t + tMin) / 2; | ||
} | ||
value = getBezierCoordinate_(t, x1, x2); | ||
} | ||
return t; | ||
} | ||
/***/ }), | ||
/***/ 12: | ||
/***/ (function(module, __webpack_exports__, __webpack_require__) { | ||
"use strict"; | ||
Object.defineProperty(__webpack_exports__, "__esModule", { value: true }); | ||
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_0__util__ = __webpack_require__(10); | ||
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_1__simple__ = __webpack_require__(14); | ||
/* harmony reexport (binding) */ __webpack_require__.d(__webpack_exports__, "MDCSimpleMenu", function() { return __WEBPACK_IMPORTED_MODULE_1__simple__["a"]; }); | ||
@@ -393,3 +561,3 @@ /* harmony reexport (binding) */ __webpack_require__.d(__webpack_exports__, "MDCSimpleMenuFoundation", function() { return __WEBPACK_IMPORTED_MODULE_1__simple__["b"]; }); | ||
/***/ 13: | ||
/***/ 14: | ||
/***/ (function(module, __webpack_exports__, __webpack_require__) { | ||
@@ -400,4 +568,4 @@ | ||
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_0__material_base_component__ = __webpack_require__(1); | ||
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_1__foundation__ = __webpack_require__(14); | ||
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_2__util__ = __webpack_require__(9); | ||
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_1__foundation__ = __webpack_require__(15); | ||
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_2__util__ = __webpack_require__(10); | ||
/* harmony reexport (binding) */ __webpack_require__.d(__webpack_exports__, "b", function() { return __WEBPACK_IMPORTED_MODULE_1__foundation__["a"]; }); | ||
@@ -525,6 +693,6 @@ var _createClass = function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; }(); | ||
setScale: function setScale(x, y) { | ||
_this2.root_.style[__WEBPACK_IMPORTED_MODULE_2__util__["getTransformPropertyName"](window)] = 'scale(' + x + ', ' + y + ')'; | ||
_this2.root_.style[Object(__WEBPACK_IMPORTED_MODULE_2__util__["getTransformPropertyName"])(window)] = 'scale(' + x + ', ' + y + ')'; | ||
}, | ||
setInnerScale: function setInnerScale(x, y) { | ||
_this2.itemsContainer_.style[__WEBPACK_IMPORTED_MODULE_2__util__["getTransformPropertyName"](window)] = 'scale(' + x + ', ' + y + ')'; | ||
_this2.itemsContainer_.style[Object(__WEBPACK_IMPORTED_MODULE_2__util__["getTransformPropertyName"])(window)] = 'scale(' + x + ', ' + y + ')'; | ||
}, | ||
@@ -592,3 +760,3 @@ getNumberOfItems: function getNumberOfItems() { | ||
setTransformOrigin: function setTransformOrigin(origin) { | ||
_this2.root_.style[__WEBPACK_IMPORTED_MODULE_2__util__["getTransformPropertyName"](window) + '-origin'] = origin; | ||
_this2.root_.style[Object(__WEBPACK_IMPORTED_MODULE_2__util__["getTransformPropertyName"])(window) + '-origin'] = origin; | ||
}, | ||
@@ -656,3 +824,3 @@ setPosition: function setPosition(position) { | ||
/***/ 14: | ||
/***/ 15: | ||
/***/ (function(module, __webpack_exports__, __webpack_require__) { | ||
@@ -662,5 +830,5 @@ | ||
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_0__material_base_foundation__ = __webpack_require__(0); | ||
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_1__adapter__ = __webpack_require__(15); | ||
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_2__constants__ = __webpack_require__(16); | ||
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_3__util__ = __webpack_require__(9); | ||
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_1__adapter__ = __webpack_require__(16); | ||
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_2__constants__ = __webpack_require__(17); | ||
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_3__util__ = __webpack_require__(10); | ||
var _extends = Object.assign || function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; | ||
@@ -958,6 +1126,6 @@ | ||
var currentTime = __WEBPACK_IMPORTED_MODULE_3__util__["clamp"]((time - this.startTime_) / TRANSITION_DURATION_MS); | ||
var currentTime = Object(__WEBPACK_IMPORTED_MODULE_3__util__["clamp"])((time - this.startTime_) / TRANSITION_DURATION_MS); | ||
// Animate X axis very slowly, so that only the Y axis animation is visible during fade-out. | ||
var currentTimeX = __WEBPACK_IMPORTED_MODULE_3__util__["clamp"]((currentTime - TRANSITION_SCALE_ADJUSTMENT_X) / (1 - TRANSITION_SCALE_ADJUSTMENT_X)); | ||
var currentTimeX = Object(__WEBPACK_IMPORTED_MODULE_3__util__["clamp"])((currentTime - TRANSITION_SCALE_ADJUSTMENT_X) / (1 - TRANSITION_SCALE_ADJUSTMENT_X)); | ||
// No time-shifting on the Y axis when closing. | ||
@@ -973,10 +1141,10 @@ var currentTimeY = currentTime; | ||
// X axis moves faster, so time-shift forward. | ||
currentTimeX = __WEBPACK_IMPORTED_MODULE_3__util__["clamp"](currentTime + TRANSITION_SCALE_ADJUSTMENT_X); | ||
currentTimeX = Object(__WEBPACK_IMPORTED_MODULE_3__util__["clamp"])(currentTime + TRANSITION_SCALE_ADJUSTMENT_X); | ||
// Y axis moves slower, so time-shift backwards and adjust speed by the difference. | ||
currentTimeY = __WEBPACK_IMPORTED_MODULE_3__util__["clamp"]((currentTime - TRANSITION_SCALE_ADJUSTMENT_Y) / (1 - TRANSITION_SCALE_ADJUSTMENT_Y)); | ||
currentTimeY = Object(__WEBPACK_IMPORTED_MODULE_3__util__["clamp"])((currentTime - TRANSITION_SCALE_ADJUSTMENT_Y) / (1 - TRANSITION_SCALE_ADJUSTMENT_Y)); | ||
} | ||
// Apply cubic bezier easing independently to each axis. | ||
var easeX = __WEBPACK_IMPORTED_MODULE_3__util__["bezierProgress"](currentTimeX, TRANSITION_X1, TRANSITION_Y1, TRANSITION_X2, TRANSITION_Y2); | ||
var easeY = __WEBPACK_IMPORTED_MODULE_3__util__["bezierProgress"](currentTimeY, TRANSITION_X1, TRANSITION_Y1, TRANSITION_X2, TRANSITION_Y2); | ||
var easeX = Object(__WEBPACK_IMPORTED_MODULE_3__util__["bezierProgress"])(currentTimeX, TRANSITION_X1, TRANSITION_Y1, TRANSITION_X2, TRANSITION_Y2); | ||
var easeY = Object(__WEBPACK_IMPORTED_MODULE_3__util__["bezierProgress"])(currentTimeY, TRANSITION_X1, TRANSITION_Y1, TRANSITION_X2, TRANSITION_Y2); | ||
@@ -1294,3 +1462,3 @@ // Calculate the scales to apply to the outer container and inner container. | ||
/***/ 15: | ||
/***/ 16: | ||
/***/ (function(module, __webpack_exports__, __webpack_require__) { | ||
@@ -1560,3 +1728,3 @@ | ||
/***/ 16: | ||
/***/ 17: | ||
/***/ (function(module, __webpack_exports__, __webpack_require__) { | ||
@@ -1623,176 +1791,8 @@ | ||
/***/ 64: | ||
/***/ 66: | ||
/***/ (function(module, exports, __webpack_require__) { | ||
module.exports = __webpack_require__(11); | ||
module.exports = __webpack_require__(12); | ||
/***/ }), | ||
/***/ 9: | ||
/***/ (function(module, __webpack_exports__, __webpack_require__) { | ||
"use strict"; | ||
Object.defineProperty(__webpack_exports__, "__esModule", { value: true }); | ||
/* harmony export (immutable) */ __webpack_exports__["getTransformPropertyName"] = getTransformPropertyName; | ||
/* harmony export (immutable) */ __webpack_exports__["clamp"] = clamp; | ||
/* harmony export (immutable) */ __webpack_exports__["bezierProgress"] = bezierProgress; | ||
/** | ||
* Copyright 2016 Google Inc. All Rights Reserved. | ||
* | ||
* Licensed under the Apache License, Version 2.0 (the "License"); | ||
* you may not use this file except in compliance with the License. | ||
* You may obtain a copy of the License at | ||
* | ||
* http://www.apache.org/licenses/LICENSE-2.0 | ||
* | ||
* Unless required by applicable law or agreed to in writing, software | ||
* distributed under the License is distributed on an "AS IS" BASIS, | ||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
* See the License for the specific language governing permissions and | ||
* limitations under the License. | ||
*/ | ||
/** @type {string|undefined} */ | ||
var storedTransformPropertyName_ = void 0; | ||
/** | ||
* Returns the name of the correct transform property to use on the current browser. | ||
* @param {!Window} globalObj | ||
* @param {boolean=} forceRefresh | ||
* @return {string} | ||
*/ | ||
function getTransformPropertyName(globalObj) { | ||
var forceRefresh = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : false; | ||
if (storedTransformPropertyName_ === undefined || forceRefresh) { | ||
var el = globalObj.document.createElement('div'); | ||
var transformPropertyName = 'transform' in el.style ? 'transform' : 'webkitTransform'; | ||
storedTransformPropertyName_ = transformPropertyName; | ||
} | ||
return storedTransformPropertyName_; | ||
} | ||
/** | ||
* Clamps a value between the minimum and the maximum, returning the clamped value. | ||
* @param {number} value | ||
* @param {number} min | ||
* @param {number} max | ||
* @return {number} | ||
*/ | ||
function clamp(value) { | ||
var min = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : 0; | ||
var max = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : 1; | ||
return Math.min(max, Math.max(min, value)); | ||
} | ||
/** | ||
* Returns the easing value to apply at time t, for a given cubic bezier curve. | ||
* Control points P0 and P3 are assumed to be (0,0) and (1,1), respectively. | ||
* Parameters are as follows: | ||
* - time: The current time in the animation, scaled between 0 and 1. | ||
* - x1: The x value of control point P1. | ||
* - y1: The y value of control point P1. | ||
* - x2: The x value of control point P2. | ||
* - y2: The y value of control point P2. | ||
* @param {number} time | ||
* @param {number} x1 | ||
* @param {number} y1 | ||
* @param {number} x2 | ||
* @param {number} y2 | ||
* @return {number} | ||
*/ | ||
function bezierProgress(time, x1, y1, x2, y2) { | ||
return getBezierCoordinate_(solvePositionFromXValue_(time, x1, x2), y1, y2); | ||
} | ||
/** | ||
* Compute a single coordinate at a position point between 0 and 1. | ||
* c1 and c2 are the matching coordinate on control points P1 and P2, respectively. | ||
* Control points P0 and P3 are assumed to be (0,0) and (1,1), respectively. | ||
* Adapted from https://github.com/google/closure-library/blob/master/closure/goog/math/bezier.js. | ||
* @param {number} t | ||
* @param {number} c1 | ||
* @param {number} c2 | ||
* @return {number} | ||
*/ | ||
function getBezierCoordinate_(t, c1, c2) { | ||
// Special case start and end. | ||
if (t === 0 || t === 1) { | ||
return t; | ||
} | ||
// Step one - from 4 points to 3 | ||
var ic0 = t * c1; | ||
var ic1 = c1 + t * (c2 - c1); | ||
var ic2 = c2 + t * (1 - c2); | ||
// Step two - from 3 points to 2 | ||
ic0 += t * (ic1 - ic0); | ||
ic1 += t * (ic2 - ic1); | ||
// Final step - last point | ||
return ic0 + t * (ic1 - ic0); | ||
} | ||
/** | ||
* Project a point onto the Bezier curve, from a given X. Calculates the position t along the curve. | ||
* Adapted from https://github.com/google/closure-library/blob/master/closure/goog/math/bezier.js. | ||
* @param {number} xVal | ||
* @param {number} x1 | ||
* @param {number} x2 | ||
* @return {number} | ||
*/ | ||
function solvePositionFromXValue_(xVal, x1, x2) { | ||
var EPSILON = 1e-6; | ||
var MAX_ITERATIONS = 8; | ||
if (xVal <= 0) { | ||
return 0; | ||
} else if (xVal >= 1) { | ||
return 1; | ||
} | ||
// Initial estimate of t using linear interpolation. | ||
var t = xVal; | ||
// Try gradient descent to solve for t. If it works, it is very fast. | ||
var tMin = 0; | ||
var tMax = 1; | ||
var value = 0; | ||
for (var i = 0; i < MAX_ITERATIONS; i++) { | ||
value = getBezierCoordinate_(t, x1, x2); | ||
var derivative = (getBezierCoordinate_(t + EPSILON, x1, x2) - value) / EPSILON; | ||
if (Math.abs(value - xVal) < EPSILON) { | ||
return t; | ||
} else if (Math.abs(derivative) < EPSILON) { | ||
break; | ||
} else { | ||
if (value < xVal) { | ||
tMin = t; | ||
} else { | ||
tMax = t; | ||
} | ||
t -= (value - xVal) / derivative; | ||
} | ||
} | ||
// If the gradient descent got stuck in a local minimum, e.g. because | ||
// the derivative was close to 0, use a Dichotomy refinement instead. | ||
// We limit the number of interations to 8. | ||
for (var _i = 0; Math.abs(value - xVal) > EPSILON && _i < MAX_ITERATIONS; _i++) { | ||
if (value < xVal) { | ||
tMin = t; | ||
t = (t + tMax) / 2; | ||
} else { | ||
tMax = t; | ||
t = (t + tMin) / 2; | ||
} | ||
value = getBezierCoordinate_(t, x1, x2); | ||
} | ||
return t; | ||
} | ||
/***/ }) | ||
@@ -1799,0 +1799,0 @@ |
@@ -6,2 +6,2 @@ /*! | ||
*/ | ||
!function(e,t){"object"==typeof exports&&"object"==typeof module?module.exports=t():"function"==typeof define&&define.amd?define([],t):"object"==typeof exports?exports.menu=t():(e.mdc=e.mdc||{},e.mdc.menu=t())}(this,function(){return function(e){function t(r){if(n[r])return n[r].exports;var i=n[r]={i:r,l:!1,exports:{}};return e[r].call(i.exports,i,i.exports,t),i.l=!0,i.exports}var n={};return t.m=e,t.c=n,t.d=function(e,n,r){t.o(e,n)||Object.defineProperty(e,n,{configurable:!1,enumerable:!0,get:r})},t.n=function(e){var n=e&&e.__esModule?function(){return e.default}:function(){return e};return t.d(n,"a",n),n},t.o=function(e,t){return Object.prototype.hasOwnProperty.call(e,t)},t.p="/assets/",t(t.s=64)}({0:function(e,t,n){"use strict";function r(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}var i=function(){function e(e,t){for(var n=0;n<t.length;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,r.key,r)}}return function(t,n,r){return n&&e(t.prototype,n),r&&e(t,r),t}}(),o=function(){function e(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};r(this,e),this.adapter_=t}return i(e,null,[{key:"cssClasses",get:function(){return{}}},{key:"strings",get:function(){return{}}},{key:"numbers",get:function(){return{}}},{key:"defaultAdapter",get:function(){return{}}}]),i(e,[{key:"init",value:function(){}},{key:"destroy",value:function(){}}]),e}();t.a=o},1:function(e,t,n){"use strict";function r(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}var i=n(0),o=function(){function e(e,t){for(var n=0;n<t.length;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,r.key,r)}}return function(t,n,r){return n&&e(t.prototype,n),r&&e(t,r),t}}(),a=function(){function e(t){var n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:void 0;r(this,e),this.root_=t;for(var i=arguments.length,o=Array(i>2?i-2:0),a=2;a<i;a++)o[a-2]=arguments[a];this.initialize.apply(this,o),this.foundation_=void 0===n?this.getDefaultFoundation():n,this.foundation_.init(),this.initialSyncWithDOM()}return o(e,null,[{key:"attachTo",value:function(t){return new e(t,new i.a)}}]),o(e,[{key:"initialize",value:function(){}},{key:"getDefaultFoundation",value:function(){throw new Error("Subclasses must override getDefaultFoundation to return a properly configured foundation class")}},{key:"initialSyncWithDOM",value:function(){}},{key:"destroy",value:function(){this.foundation_.destroy()}},{key:"listen",value:function(e,t){this.root_.addEventListener(e,t)}},{key:"unlisten",value:function(e,t){this.root_.removeEventListener(e,t)}},{key:"emit",value:function(e,t){var n=arguments.length>2&&void 0!==arguments[2]&&arguments[2],r=void 0;"function"==typeof CustomEvent?r=new CustomEvent(e,{detail:t,bubbles:n}):(r=document.createEvent("CustomEvent"),r.initCustomEvent(e,n,!1,t)),this.root_.dispatchEvent(r)}}]),e}();t.a=a},11:function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var r=n(9),i=n(13);n.d(t,"MDCSimpleMenu",function(){return i.a}),n.d(t,"MDCSimpleMenuFoundation",function(){return i.b}),n.d(t,"util",function(){return r})},13:function(e,t,n){"use strict";function r(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function i(e,t){if(!e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!t||"object"!=typeof t&&"function"!=typeof t?e:t}function o(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function, not "+typeof t);e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,enumerable:!1,writable:!0,configurable:!0}}),t&&(Object.setPrototypeOf?Object.setPrototypeOf(e,t):e.__proto__=t)}n.d(t,"a",function(){return l});var a=n(1),s=n(14),u=n(9);n.d(t,"b",function(){return s.a});var c=function(){function e(e,t){for(var n=0;n<t.length;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,r.key,r)}}return function(t,n,r){return n&&e(t.prototype,n),r&&e(t,r),t}}(),l=function(e){function t(){var e;r(this,t);for(var n=arguments.length,o=Array(n),a=0;a<n;a++)o[a]=arguments[a];var s=i(this,(e=t.__proto__||Object.getPrototypeOf(t)).call.apply(e,[this].concat(o)));return s.previousFocus_,s}return o(t,e),c(t,[{key:"show",value:function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},t=e.focusIndex,n=void 0===t?null:t;this.foundation_.open({focusIndex:n})}},{key:"hide",value:function(){this.foundation_.close()}},{key:"getDefaultFoundation",value:function(){var e=this;return new s.a({addClass:function(t){return e.root_.classList.add(t)},removeClass:function(t){return e.root_.classList.remove(t)},hasClass:function(t){return e.root_.classList.contains(t)},hasNecessaryDom:function(){return Boolean(e.itemsContainer_)},getAttributeForEventTarget:function(e,t){return e.getAttribute(t)},getInnerDimensions:function(){var t=e.itemsContainer_;return{width:t.offsetWidth,height:t.offsetHeight}},hasAnchor:function(){return e.root_.parentElement&&e.root_.parentElement.classList.contains("mdc-menu-anchor")},getAnchorDimensions:function(){return e.root_.parentElement.getBoundingClientRect()},getWindowDimensions:function(){return{width:window.innerWidth,height:window.innerHeight}},setScale:function(t,n){e.root_.style[u.getTransformPropertyName(window)]="scale("+t+", "+n+")"},setInnerScale:function(t,n){e.itemsContainer_.style[u.getTransformPropertyName(window)]="scale("+t+", "+n+")"},getNumberOfItems:function(){return e.items.length},registerInteractionHandler:function(t,n){return e.root_.addEventListener(t,n)},deregisterInteractionHandler:function(t,n){return e.root_.removeEventListener(t,n)},registerBodyClickHandler:function(e){return document.body.addEventListener("click",e)},deregisterBodyClickHandler:function(e){return document.body.removeEventListener("click",e)},getYParamsForItemAtIndex:function(t){var n=e.items[t];return{top:n.offsetTop,height:n.offsetHeight}},setTransitionDelayForItemAtIndex:function(t,n){return e.items[t].style.setProperty("transition-delay",n)},getIndexForEventTarget:function(t){return e.items.indexOf(t)},notifySelected:function(t){return e.emit(s.a.strings.SELECTED_EVENT,{index:t.index,item:e.items[t.index]})},notifyCancel:function(){return e.emit(s.a.strings.CANCEL_EVENT,{})},saveFocus:function(){e.previousFocus_=document.activeElement},restoreFocus:function(){e.previousFocus_&&e.previousFocus_.focus()},isFocused:function(){return document.activeElement===e.root_},focus:function(){return e.root_.focus()},getFocusedItemIndex:function(){return e.items.indexOf(document.activeElement)},focusItemAtIndex:function(t){return e.items[t].focus()},isRtl:function(){return"rtl"===getComputedStyle(e.root_).getPropertyValue("direction")},setTransformOrigin:function(t){e.root_.style[u.getTransformPropertyName(window)+"-origin"]=t},setPosition:function(t){e.root_.style.left="left"in t?t.left:null,e.root_.style.right="right"in t?t.right:null,e.root_.style.top="top"in t?t.top:null,e.root_.style.bottom="bottom"in t?t.bottom:null},getAccurateTime:function(){return window.performance.now()}})}},{key:"open",get:function(){return this.foundation_.isOpen()},set:function(e){e?this.foundation_.open():this.foundation_.close()}},{key:"itemsContainer_",get:function(){return this.root_.querySelector(s.a.strings.ITEMS_SELECTOR)}},{key:"items",get:function(){var e=this.itemsContainer_;return[].slice.call(e.querySelectorAll(".mdc-list-item[role]"))}}],[{key:"attachTo",value:function(e){return new t(e)}}]),t}(a.a)},14:function(e,t,n){"use strict";function r(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function i(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function o(e,t){if(!e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!t||"object"!=typeof t&&"function"!=typeof t?e:t}function a(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function, not "+typeof t);e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,enumerable:!1,writable:!0,configurable:!0}}),t&&(Object.setPrototypeOf?Object.setPrototypeOf(e,t):e.__proto__=t)}var s=n(0),u=(n(15),n(16)),c=n(9),l=Object.assign||function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var r in n)Object.prototype.hasOwnProperty.call(n,r)&&(e[r]=n[r])}return e},f=function(){function e(e,t){for(var n=0;n<t.length;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,r.key,r)}}return function(t,n,r){return n&&e(t.prototype,n),r&&e(t,r),t}}(),d=function(e){function t(e){i(this,t);var n=o(this,(t.__proto__||Object.getPrototypeOf(t)).call(this,l(t.defaultAdapter,e)));return n.clickHandler_=function(e){return n.handlePossibleSelected_(e)},n.keydownHandler_=function(e){return n.handleKeyboardDown_(e)},n.keyupHandler_=function(e){return n.handleKeyboardUp_(e)},n.documentClickHandler_=function(e){n.adapter_.notifyCancel(),n.close(e)},n.isOpen_=!1,n.startScaleX_=0,n.startScaleY_=0,n.targetScale_=1,n.scaleX_=0,n.scaleY_=0,n.running_=!1,n.selectedTriggerTimerId_=0,n.animationRequestId_=0,n.dimensions_,n.startTime_,n.itemHeight_,n}return a(t,e),f(t,null,[{key:"cssClasses",get:function(){return u.a}},{key:"strings",get:function(){return u.c}},{key:"numbers",get:function(){return u.b}},{key:"defaultAdapter",get:function(){return{addClass:function(){},removeClass:function(){},hasClass:function(){return!1},hasNecessaryDom:function(){return!1},getAttributeForEventTarget:function(){},getInnerDimensions:function(){return{}},hasAnchor:function(){return!1},getAnchorDimensions:function(){return{}},getWindowDimensions:function(){return{}},setScale:function(){},setInnerScale:function(){},getNumberOfItems:function(){return 0},registerInteractionHandler:function(){},deregisterInteractionHandler:function(){},registerBodyClickHandler:function(){},deregisterBodyClickHandler:function(){},getYParamsForItemAtIndex:function(){return{}},setTransitionDelayForItemAtIndex:function(){},getIndexForEventTarget:function(){return 0},notifySelected:function(){},notifyCancel:function(){},saveFocus:function(){},restoreFocus:function(){},isFocused:function(){return!1},focus:function(){},getFocusedItemIndex:function(){return-1},focusItemAtIndex:function(){},isRtl:function(){return!1},setTransformOrigin:function(){},setPosition:function(){},getAccurateTime:function(){return 0}}}}]),f(t,[{key:"init",value:function(){var e=t.cssClasses,n=e.ROOT,r=e.OPEN;if(!this.adapter_.hasClass(n))throw new Error(n+" class required in root element.");if(!this.adapter_.hasNecessaryDom())throw new Error("Required DOM nodes missing in "+n+" component.");this.adapter_.hasClass(r)&&(this.isOpen_=!0),this.adapter_.registerInteractionHandler("click",this.clickHandler_),this.adapter_.registerInteractionHandler("keyup",this.keyupHandler_),this.adapter_.registerInteractionHandler("keydown",this.keydownHandler_)}},{key:"destroy",value:function(){clearTimeout(this.selectedTriggerTimerId_),cancelAnimationFrame(this.animationRequestId_),this.adapter_.deregisterInteractionHandler("click",this.clickHandler_),this.adapter_.deregisterInteractionHandler("keyup",this.keyupHandler_),this.adapter_.deregisterInteractionHandler("keydown",this.keydownHandler_),this.adapter_.deregisterBodyClickHandler(this.documentClickHandler_)}},{key:"applyTransitionDelays_",value:function(){for(var e=t.cssClasses,n=e.BOTTOM_LEFT,r=e.BOTTOM_RIGHT,i=this.adapter_.getNumberOfItems(),o=this.dimensions_.height,a=t.numbers.TRANSITION_DURATION_MS/1e3,s=t.numbers.TRANSITION_SCALE_ADJUSTMENT_Y,u=0;u<i;u++){var c=this.adapter_.getYParamsForItemAtIndex(u),l=c.top,f=c.height;this.itemHeight_=f;var d=l/o;(this.adapter_.hasClass(n)||this.adapter_.hasClass(r))&&(d=(o-l-f)/o);var h=(s+d*(1-s))*a;this.adapter_.setTransitionDelayForItemAtIndex(u,h.toFixed(3)+"s")}}},{key:"removeTransitionDelays_",value:function(){for(var e=this.adapter_.getNumberOfItems(),t=0;t<e;t++)this.adapter_.setTransitionDelayForItemAtIndex(t,null)}},{key:"animationLoop_",value:function(){var e=this,n=this.adapter_.getAccurateTime(),r=t.numbers,i=r.TRANSITION_DURATION_MS,o=r.TRANSITION_X1,a=r.TRANSITION_Y1,s=r.TRANSITION_X2,u=r.TRANSITION_Y2,l=r.TRANSITION_SCALE_ADJUSTMENT_X,f=r.TRANSITION_SCALE_ADJUSTMENT_Y,d=c.clamp((n-this.startTime_)/i),h=c.clamp((d-l)/(1-l)),_=d,m=this.startScaleY_;1===this.targetScale_&&(this.itemHeight_&&(m=Math.max(this.itemHeight_/this.dimensions_.height,m)),h=c.clamp(d+l),_=c.clamp((d-f)/(1-f)));var p=c.bezierProgress(h,o,a,s,u),y=c.bezierProgress(_,o,a,s,u);this.scaleX_=this.startScaleX_+(this.targetScale_-this.startScaleX_)*p;var v=1/(0===this.scaleX_?1:this.scaleX_);this.scaleY_=m+(this.targetScale_-m)*y;var g=1/(0===this.scaleY_?1:this.scaleY_);this.adapter_.setScale(this.scaleX_,this.scaleY_),this.adapter_.setInnerScale(v,g),d<1?this.animationRequestId_=requestAnimationFrame(function(){return e.animationLoop_()}):(this.animationRequestId_=0,this.running_=!1,this.adapter_.removeClass(t.cssClasses.ANIMATING))}},{key:"animateMenu_",value:function(){var e=this;this.startTime_=this.adapter_.getAccurateTime(),this.startScaleX_=this.scaleX_,this.startScaleY_=this.scaleY_,this.targetScale_=this.isOpen_?1:0,this.running_||(this.running_=!0,this.animationRequestId_=requestAnimationFrame(function(){return e.animationLoop_()}))}},{key:"focusOnOpen_",value:function(e){null===e?(this.adapter_.focus(),this.adapter_.isFocused()||this.adapter_.focusItemAtIndex(0)):this.adapter_.focusItemAtIndex(e)}},{key:"handleKeyboardDown_",value:function(e){if(e.altKey||e.ctrlKey||e.metaKey)return!0;var t=e.keyCode,n=e.key,r=e.shiftKey,i="Tab"===n||9===t,o="ArrowUp"===n||38===t,a="ArrowDown"===n||40===t,s="Space"===n||32===t,u=this.adapter_.getFocusedItemIndex(),c=this.adapter_.getNumberOfItems()-1;return r&&i&&0===u?(this.adapter_.focusItemAtIndex(c),e.preventDefault(),!1):!r&&i&&u===c?(this.adapter_.focusItemAtIndex(0),e.preventDefault(),!1):((o||a||s)&&e.preventDefault(),o?0===u||this.adapter_.isFocused()?this.adapter_.focusItemAtIndex(c):this.adapter_.focusItemAtIndex(u-1):a&&(u===c||this.adapter_.isFocused()?this.adapter_.focusItemAtIndex(0):this.adapter_.focusItemAtIndex(u+1)),!0)}},{key:"handleKeyboardUp_",value:function(e){if(e.altKey||e.ctrlKey||e.metaKey)return!0;var t=e.keyCode,n=e.key,r="Enter"===n||13===t,i="Space"===n||32===t,o="Escape"===n||27===t;return(r||i)&&this.handlePossibleSelected_(e),o&&(this.adapter_.notifyCancel(),this.close()),!0}},{key:"handlePossibleSelected_",value:function(e){var t=this;if("true"!==this.adapter_.getAttributeForEventTarget(e.target,u.c.ARIA_DISABLED_ATTR)){var n=this.adapter_.getIndexForEventTarget(e.target);n<0||this.selectedTriggerTimerId_||(this.selectedTriggerTimerId_=setTimeout(function(){t.selectedTriggerTimerId_=0,t.close(),t.adapter_.notifySelected({index:n})},u.b.SELECTED_TRIGGER_DELAY))}}},{key:"autoPosition_",value:function(){var e;if(this.adapter_.hasAnchor()){var t="top",n="left",i=this.adapter_.getAnchorDimensions(),o=this.adapter_.getWindowDimensions(),a=i.top+this.dimensions_.height-o.height,s=this.dimensions_.height-i.bottom;a>0&&s<a&&(t="bottom");var u=i.left+this.dimensions_.width-o.width,c=this.dimensions_.width-i.right,l=u>0,f=c>0;this.adapter_.isRtl()?(n="right",f&&u<c&&(n="left")):l&&c<u&&(n="right");var d=(e={},r(e,n,"0"),r(e,t,"0"),e);this.adapter_.setTransformOrigin(t+" "+n),this.adapter_.setPosition(d)}}},{key:"open",value:function(){var e=this,n=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},r=n.focusIndex,i=void 0===r?null:r;this.adapter_.saveFocus(),this.adapter_.addClass(t.cssClasses.ANIMATING),this.animationRequestId_=requestAnimationFrame(function(){e.dimensions_=e.adapter_.getInnerDimensions(),e.applyTransitionDelays_(),e.autoPosition_(),e.animateMenu_(),e.adapter_.addClass(t.cssClasses.OPEN),e.focusOnOpen_(i),e.adapter_.registerBodyClickHandler(e.documentClickHandler_)}),this.isOpen_=!0}},{key:"close",value:function(){var e=this,n=arguments.length>0&&void 0!==arguments[0]?arguments[0]:null;!!n&&"true"===this.adapter_.getAttributeForEventTarget(n.target,u.c.ARIA_DISABLED_ATTR)||(this.adapter_.deregisterBodyClickHandler(this.documentClickHandler_),this.adapter_.addClass(t.cssClasses.ANIMATING),requestAnimationFrame(function(){e.removeTransitionDelays_(),e.animateMenu_(),e.adapter_.removeClass(t.cssClasses.OPEN)}),this.isOpen_=!1,this.adapter_.restoreFocus())}},{key:"isOpen",value:function(){return this.isOpen_}}]),t}(s.a);t.a=d},15:function(e,t,n){"use strict";function r(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}var i=function(){function e(e,t){for(var n=0;n<t.length;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,r.key,r)}}return function(t,n,r){return n&&e(t.prototype,n),r&&e(t,r),t}}();!function(){function e(){r(this,e)}i(e,[{key:"addClass",value:function(e){}},{key:"removeClass",value:function(e){}},{key:"hasClass",value:function(e){}},{key:"hasNecessaryDom",value:function(){}},{key:"getAttributeForEventTarget",value:function(e,t){}},{key:"getInnerDimensions",value:function(){}},{key:"hasAnchor",value:function(){}},{key:"getAnchorDimensions",value:function(){}},{key:"getWindowDimensions",value:function(){}},{key:"setScale",value:function(e,t){}},{key:"setInnerScale",value:function(e,t){}},{key:"getNumberOfItems",value:function(){}},{key:"registerInteractionHandler",value:function(e,t){}},{key:"deregisterInteractionHandler",value:function(e,t){}},{key:"registerBodyClickHandler",value:function(e){}},{key:"deregisterBodyClickHandler",value:function(e){}},{key:"getYParamsForItemAtIndex",value:function(e){}},{key:"setTransitionDelayForItemAtIndex",value:function(e,t){}},{key:"getIndexForEventTarget",value:function(e){}},{key:"notifySelected",value:function(e){}},{key:"notifyCancel",value:function(){}},{key:"saveFocus",value:function(){}},{key:"restoreFocus",value:function(){}},{key:"isFocused",value:function(){}},{key:"focus",value:function(){}},{key:"getFocusedItemIndex",value:function(){}},{key:"focusItemAtIndex",value:function(e){}},{key:"isRtl",value:function(){}},{key:"setTransformOrigin",value:function(e){}},{key:"setPosition",value:function(e){}},{key:"getAccurateTime",value:function(){}}])}()},16:function(e,t,n){"use strict";n.d(t,"a",function(){return r}),n.d(t,"c",function(){return i}),n.d(t,"b",function(){return o});var r={ROOT:"mdc-simple-menu",OPEN:"mdc-simple-menu--open",ANIMATING:"mdc-simple-menu--animating",TOP_RIGHT:"mdc-simple-menu--open-from-top-right",BOTTOM_LEFT:"mdc-simple-menu--open-from-bottom-left",BOTTOM_RIGHT:"mdc-simple-menu--open-from-bottom-right"},i={ITEMS_SELECTOR:".mdc-simple-menu__items",SELECTED_EVENT:"MDCSimpleMenu:selected",CANCEL_EVENT:"MDCSimpleMenu:cancel",ARIA_DISABLED_ATTR:"aria-disabled"},o={SELECTED_TRIGGER_DELAY:50,TRANSITION_DURATION_MS:300,TRANSITION_SCALE_ADJUSTMENT_X:.5,TRANSITION_SCALE_ADJUSTMENT_Y:.2,TRANSITION_X1:0,TRANSITION_Y1:0,TRANSITION_X2:.2,TRANSITION_Y2:1}},64:function(e,t,n){e.exports=n(11)},9:function(e,t,n){"use strict";function r(e){var t=arguments.length>1&&void 0!==arguments[1]&&arguments[1];if(void 0===u||t){var n=e.document.createElement("div"),r="transform"in n.style?"transform":"webkitTransform";u=r}return u}function i(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0,n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:1;return Math.min(n,Math.max(t,e))}function o(e,t,n,r,i){return a(s(e,t,r),n,i)}function a(e,t,n){if(0===e||1===e)return e;var r=e*t,i=t+e*(n-t),o=n+e*(1-n);return r+=e*(i-r),i+=e*(o-i),r+e*(i-r)}function s(e,t,n){if(e<=0)return 0;if(e>=1)return 1;for(var r=e,i=0,o=1,s=0,u=0;u<8;u++){s=a(r,t,n);var c=(a(r+1e-6,t,n)-s)/1e-6;if(Math.abs(s-e)<1e-6)return r;if(Math.abs(c)<1e-6)break;s<e?i=r:o=r,r-=(s-e)/c}for(var l=0;Math.abs(s-e)>1e-6&&l<8;l++)s<e?(i=r,r=(r+o)/2):(o=r,r=(r+i)/2),s=a(r,t,n);return r}Object.defineProperty(t,"__esModule",{value:!0}),t.getTransformPropertyName=r,t.clamp=i,t.bezierProgress=o;var u=void 0}})}); | ||
!function(e,t){"object"==typeof exports&&"object"==typeof module?module.exports=t():"function"==typeof define&&define.amd?define([],t):"object"==typeof exports?exports.menu=t():(e.mdc=e.mdc||{},e.mdc.menu=t())}(this,function(){return function(e){function t(r){if(n[r])return n[r].exports;var i=n[r]={i:r,l:!1,exports:{}};return e[r].call(i.exports,i,i.exports,t),i.l=!0,i.exports}var n={};return t.m=e,t.c=n,t.d=function(e,n,r){t.o(e,n)||Object.defineProperty(e,n,{configurable:!1,enumerable:!0,get:r})},t.n=function(e){var n=e&&e.__esModule?function(){return e.default}:function(){return e};return t.d(n,"a",n),n},t.o=function(e,t){return Object.prototype.hasOwnProperty.call(e,t)},t.p="/assets/",t(t.s=66)}({0:function(e,t,n){"use strict";function r(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}var i=function(){function e(e,t){for(var n=0;n<t.length;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,r.key,r)}}return function(t,n,r){return n&&e(t.prototype,n),r&&e(t,r),t}}(),o=function(){function e(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};r(this,e),this.adapter_=t}return i(e,null,[{key:"cssClasses",get:function(){return{}}},{key:"strings",get:function(){return{}}},{key:"numbers",get:function(){return{}}},{key:"defaultAdapter",get:function(){return{}}}]),i(e,[{key:"init",value:function(){}},{key:"destroy",value:function(){}}]),e}();t.a=o},1:function(e,t,n){"use strict";function r(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}var i=n(0),o=function(){function e(e,t){for(var n=0;n<t.length;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,r.key,r)}}return function(t,n,r){return n&&e(t.prototype,n),r&&e(t,r),t}}(),a=function(){function e(t){var n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:void 0;r(this,e),this.root_=t;for(var i=arguments.length,o=Array(i>2?i-2:0),a=2;a<i;a++)o[a-2]=arguments[a];this.initialize.apply(this,o),this.foundation_=void 0===n?this.getDefaultFoundation():n,this.foundation_.init(),this.initialSyncWithDOM()}return o(e,null,[{key:"attachTo",value:function(t){return new e(t,new i.a)}}]),o(e,[{key:"initialize",value:function(){}},{key:"getDefaultFoundation",value:function(){throw new Error("Subclasses must override getDefaultFoundation to return a properly configured foundation class")}},{key:"initialSyncWithDOM",value:function(){}},{key:"destroy",value:function(){this.foundation_.destroy()}},{key:"listen",value:function(e,t){this.root_.addEventListener(e,t)}},{key:"unlisten",value:function(e,t){this.root_.removeEventListener(e,t)}},{key:"emit",value:function(e,t){var n=arguments.length>2&&void 0!==arguments[2]&&arguments[2],r=void 0;"function"==typeof CustomEvent?r=new CustomEvent(e,{detail:t,bubbles:n}):(r=document.createEvent("CustomEvent"),r.initCustomEvent(e,n,!1,t)),this.root_.dispatchEvent(r)}}]),e}();t.a=a},10:function(e,t,n){"use strict";function r(e){var t=arguments.length>1&&void 0!==arguments[1]&&arguments[1];if(void 0===u||t){var n=e.document.createElement("div"),r="transform"in n.style?"transform":"webkitTransform";u=r}return u}function i(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0,n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:1;return Math.min(n,Math.max(t,e))}function o(e,t,n,r,i){return a(s(e,t,r),n,i)}function a(e,t,n){if(0===e||1===e)return e;var r=e*t,i=t+e*(n-t),o=n+e*(1-n);return r+=e*(i-r),i+=e*(o-i),r+e*(i-r)}function s(e,t,n){if(e<=0)return 0;if(e>=1)return 1;for(var r=e,i=0,o=1,s=0,u=0;u<8;u++){s=a(r,t,n);var c=(a(r+1e-6,t,n)-s)/1e-6;if(Math.abs(s-e)<1e-6)return r;if(Math.abs(c)<1e-6)break;s<e?i=r:o=r,r-=(s-e)/c}for(var l=0;Math.abs(s-e)>1e-6&&l<8;l++)s<e?(i=r,r=(r+o)/2):(o=r,r=(r+i)/2),s=a(r,t,n);return r}Object.defineProperty(t,"__esModule",{value:!0}),t.getTransformPropertyName=r,t.clamp=i,t.bezierProgress=o;var u=void 0},12:function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var r=n(10),i=n(14);n.d(t,"MDCSimpleMenu",function(){return i.a}),n.d(t,"MDCSimpleMenuFoundation",function(){return i.b}),n.d(t,"util",function(){return r})},14:function(e,t,n){"use strict";function r(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function i(e,t){if(!e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!t||"object"!=typeof t&&"function"!=typeof t?e:t}function o(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function, not "+typeof t);e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,enumerable:!1,writable:!0,configurable:!0}}),t&&(Object.setPrototypeOf?Object.setPrototypeOf(e,t):e.__proto__=t)}n.d(t,"a",function(){return l});var a=n(1),s=n(15),u=n(10);n.d(t,"b",function(){return s.a});var c=function(){function e(e,t){for(var n=0;n<t.length;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,r.key,r)}}return function(t,n,r){return n&&e(t.prototype,n),r&&e(t,r),t}}(),l=function(e){function t(){var e;r(this,t);for(var n=arguments.length,o=Array(n),a=0;a<n;a++)o[a]=arguments[a];var s=i(this,(e=t.__proto__||Object.getPrototypeOf(t)).call.apply(e,[this].concat(o)));return s.previousFocus_,s}return o(t,e),c(t,[{key:"show",value:function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},t=e.focusIndex,n=void 0===t?null:t;this.foundation_.open({focusIndex:n})}},{key:"hide",value:function(){this.foundation_.close()}},{key:"getDefaultFoundation",value:function(){var e=this;return new s.a({addClass:function(t){return e.root_.classList.add(t)},removeClass:function(t){return e.root_.classList.remove(t)},hasClass:function(t){return e.root_.classList.contains(t)},hasNecessaryDom:function(){return Boolean(e.itemsContainer_)},getAttributeForEventTarget:function(e,t){return e.getAttribute(t)},getInnerDimensions:function(){var t=e.itemsContainer_;return{width:t.offsetWidth,height:t.offsetHeight}},hasAnchor:function(){return e.root_.parentElement&&e.root_.parentElement.classList.contains("mdc-menu-anchor")},getAnchorDimensions:function(){return e.root_.parentElement.getBoundingClientRect()},getWindowDimensions:function(){return{width:window.innerWidth,height:window.innerHeight}},setScale:function(t,n){e.root_.style[Object(u.getTransformPropertyName)(window)]="scale("+t+", "+n+")"},setInnerScale:function(t,n){e.itemsContainer_.style[Object(u.getTransformPropertyName)(window)]="scale("+t+", "+n+")"},getNumberOfItems:function(){return e.items.length},registerInteractionHandler:function(t,n){return e.root_.addEventListener(t,n)},deregisterInteractionHandler:function(t,n){return e.root_.removeEventListener(t,n)},registerBodyClickHandler:function(e){return document.body.addEventListener("click",e)},deregisterBodyClickHandler:function(e){return document.body.removeEventListener("click",e)},getYParamsForItemAtIndex:function(t){var n=e.items[t];return{top:n.offsetTop,height:n.offsetHeight}},setTransitionDelayForItemAtIndex:function(t,n){return e.items[t].style.setProperty("transition-delay",n)},getIndexForEventTarget:function(t){return e.items.indexOf(t)},notifySelected:function(t){return e.emit(s.a.strings.SELECTED_EVENT,{index:t.index,item:e.items[t.index]})},notifyCancel:function(){return e.emit(s.a.strings.CANCEL_EVENT,{})},saveFocus:function(){e.previousFocus_=document.activeElement},restoreFocus:function(){e.previousFocus_&&e.previousFocus_.focus()},isFocused:function(){return document.activeElement===e.root_},focus:function(){return e.root_.focus()},getFocusedItemIndex:function(){return e.items.indexOf(document.activeElement)},focusItemAtIndex:function(t){return e.items[t].focus()},isRtl:function(){return"rtl"===getComputedStyle(e.root_).getPropertyValue("direction")},setTransformOrigin:function(t){e.root_.style[Object(u.getTransformPropertyName)(window)+"-origin"]=t},setPosition:function(t){e.root_.style.left="left"in t?t.left:null,e.root_.style.right="right"in t?t.right:null,e.root_.style.top="top"in t?t.top:null,e.root_.style.bottom="bottom"in t?t.bottom:null},getAccurateTime:function(){return window.performance.now()}})}},{key:"open",get:function(){return this.foundation_.isOpen()},set:function(e){e?this.foundation_.open():this.foundation_.close()}},{key:"itemsContainer_",get:function(){return this.root_.querySelector(s.a.strings.ITEMS_SELECTOR)}},{key:"items",get:function(){var e=this.itemsContainer_;return[].slice.call(e.querySelectorAll(".mdc-list-item[role]"))}}],[{key:"attachTo",value:function(e){return new t(e)}}]),t}(a.a)},15:function(e,t,n){"use strict";function r(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function i(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function o(e,t){if(!e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!t||"object"!=typeof t&&"function"!=typeof t?e:t}function a(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function, not "+typeof t);e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,enumerable:!1,writable:!0,configurable:!0}}),t&&(Object.setPrototypeOf?Object.setPrototypeOf(e,t):e.__proto__=t)}var s=n(0),u=(n(16),n(17)),c=n(10),l=Object.assign||function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var r in n)Object.prototype.hasOwnProperty.call(n,r)&&(e[r]=n[r])}return e},f=function(){function e(e,t){for(var n=0;n<t.length;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,r.key,r)}}return function(t,n,r){return n&&e(t.prototype,n),r&&e(t,r),t}}(),d=function(e){function t(e){i(this,t);var n=o(this,(t.__proto__||Object.getPrototypeOf(t)).call(this,l(t.defaultAdapter,e)));return n.clickHandler_=function(e){return n.handlePossibleSelected_(e)},n.keydownHandler_=function(e){return n.handleKeyboardDown_(e)},n.keyupHandler_=function(e){return n.handleKeyboardUp_(e)},n.documentClickHandler_=function(e){n.adapter_.notifyCancel(),n.close(e)},n.isOpen_=!1,n.startScaleX_=0,n.startScaleY_=0,n.targetScale_=1,n.scaleX_=0,n.scaleY_=0,n.running_=!1,n.selectedTriggerTimerId_=0,n.animationRequestId_=0,n.dimensions_,n.startTime_,n.itemHeight_,n}return a(t,e),f(t,null,[{key:"cssClasses",get:function(){return u.a}},{key:"strings",get:function(){return u.c}},{key:"numbers",get:function(){return u.b}},{key:"defaultAdapter",get:function(){return{addClass:function(){},removeClass:function(){},hasClass:function(){return!1},hasNecessaryDom:function(){return!1},getAttributeForEventTarget:function(){},getInnerDimensions:function(){return{}},hasAnchor:function(){return!1},getAnchorDimensions:function(){return{}},getWindowDimensions:function(){return{}},setScale:function(){},setInnerScale:function(){},getNumberOfItems:function(){return 0},registerInteractionHandler:function(){},deregisterInteractionHandler:function(){},registerBodyClickHandler:function(){},deregisterBodyClickHandler:function(){},getYParamsForItemAtIndex:function(){return{}},setTransitionDelayForItemAtIndex:function(){},getIndexForEventTarget:function(){return 0},notifySelected:function(){},notifyCancel:function(){},saveFocus:function(){},restoreFocus:function(){},isFocused:function(){return!1},focus:function(){},getFocusedItemIndex:function(){return-1},focusItemAtIndex:function(){},isRtl:function(){return!1},setTransformOrigin:function(){},setPosition:function(){},getAccurateTime:function(){return 0}}}}]),f(t,[{key:"init",value:function(){var e=t.cssClasses,n=e.ROOT,r=e.OPEN;if(!this.adapter_.hasClass(n))throw new Error(n+" class required in root element.");if(!this.adapter_.hasNecessaryDom())throw new Error("Required DOM nodes missing in "+n+" component.");this.adapter_.hasClass(r)&&(this.isOpen_=!0),this.adapter_.registerInteractionHandler("click",this.clickHandler_),this.adapter_.registerInteractionHandler("keyup",this.keyupHandler_),this.adapter_.registerInteractionHandler("keydown",this.keydownHandler_)}},{key:"destroy",value:function(){clearTimeout(this.selectedTriggerTimerId_),cancelAnimationFrame(this.animationRequestId_),this.adapter_.deregisterInteractionHandler("click",this.clickHandler_),this.adapter_.deregisterInteractionHandler("keyup",this.keyupHandler_),this.adapter_.deregisterInteractionHandler("keydown",this.keydownHandler_),this.adapter_.deregisterBodyClickHandler(this.documentClickHandler_)}},{key:"applyTransitionDelays_",value:function(){for(var e=t.cssClasses,n=e.BOTTOM_LEFT,r=e.BOTTOM_RIGHT,i=this.adapter_.getNumberOfItems(),o=this.dimensions_.height,a=t.numbers.TRANSITION_DURATION_MS/1e3,s=t.numbers.TRANSITION_SCALE_ADJUSTMENT_Y,u=0;u<i;u++){var c=this.adapter_.getYParamsForItemAtIndex(u),l=c.top,f=c.height;this.itemHeight_=f;var d=l/o;(this.adapter_.hasClass(n)||this.adapter_.hasClass(r))&&(d=(o-l-f)/o);var h=(s+d*(1-s))*a;this.adapter_.setTransitionDelayForItemAtIndex(u,h.toFixed(3)+"s")}}},{key:"removeTransitionDelays_",value:function(){for(var e=this.adapter_.getNumberOfItems(),t=0;t<e;t++)this.adapter_.setTransitionDelayForItemAtIndex(t,null)}},{key:"animationLoop_",value:function(){var e=this,n=this.adapter_.getAccurateTime(),r=t.numbers,i=r.TRANSITION_DURATION_MS,o=r.TRANSITION_X1,a=r.TRANSITION_Y1,s=r.TRANSITION_X2,u=r.TRANSITION_Y2,l=r.TRANSITION_SCALE_ADJUSTMENT_X,f=r.TRANSITION_SCALE_ADJUSTMENT_Y,d=Object(c.clamp)((n-this.startTime_)/i),h=Object(c.clamp)((d-l)/(1-l)),_=d,m=this.startScaleY_;1===this.targetScale_&&(this.itemHeight_&&(m=Math.max(this.itemHeight_/this.dimensions_.height,m)),h=Object(c.clamp)(d+l),_=Object(c.clamp)((d-f)/(1-f)));var p=Object(c.bezierProgress)(h,o,a,s,u),y=Object(c.bezierProgress)(_,o,a,s,u);this.scaleX_=this.startScaleX_+(this.targetScale_-this.startScaleX_)*p;var v=1/(0===this.scaleX_?1:this.scaleX_);this.scaleY_=m+(this.targetScale_-m)*y;var g=1/(0===this.scaleY_?1:this.scaleY_);this.adapter_.setScale(this.scaleX_,this.scaleY_),this.adapter_.setInnerScale(v,g),d<1?this.animationRequestId_=requestAnimationFrame(function(){return e.animationLoop_()}):(this.animationRequestId_=0,this.running_=!1,this.adapter_.removeClass(t.cssClasses.ANIMATING))}},{key:"animateMenu_",value:function(){var e=this;this.startTime_=this.adapter_.getAccurateTime(),this.startScaleX_=this.scaleX_,this.startScaleY_=this.scaleY_,this.targetScale_=this.isOpen_?1:0,this.running_||(this.running_=!0,this.animationRequestId_=requestAnimationFrame(function(){return e.animationLoop_()}))}},{key:"focusOnOpen_",value:function(e){null===e?(this.adapter_.focus(),this.adapter_.isFocused()||this.adapter_.focusItemAtIndex(0)):this.adapter_.focusItemAtIndex(e)}},{key:"handleKeyboardDown_",value:function(e){if(e.altKey||e.ctrlKey||e.metaKey)return!0;var t=e.keyCode,n=e.key,r=e.shiftKey,i="Tab"===n||9===t,o="ArrowUp"===n||38===t,a="ArrowDown"===n||40===t,s="Space"===n||32===t,u=this.adapter_.getFocusedItemIndex(),c=this.adapter_.getNumberOfItems()-1;return r&&i&&0===u?(this.adapter_.focusItemAtIndex(c),e.preventDefault(),!1):!r&&i&&u===c?(this.adapter_.focusItemAtIndex(0),e.preventDefault(),!1):((o||a||s)&&e.preventDefault(),o?0===u||this.adapter_.isFocused()?this.adapter_.focusItemAtIndex(c):this.adapter_.focusItemAtIndex(u-1):a&&(u===c||this.adapter_.isFocused()?this.adapter_.focusItemAtIndex(0):this.adapter_.focusItemAtIndex(u+1)),!0)}},{key:"handleKeyboardUp_",value:function(e){if(e.altKey||e.ctrlKey||e.metaKey)return!0;var t=e.keyCode,n=e.key,r="Enter"===n||13===t,i="Space"===n||32===t,o="Escape"===n||27===t;return(r||i)&&this.handlePossibleSelected_(e),o&&(this.adapter_.notifyCancel(),this.close()),!0}},{key:"handlePossibleSelected_",value:function(e){var t=this;if("true"!==this.adapter_.getAttributeForEventTarget(e.target,u.c.ARIA_DISABLED_ATTR)){var n=this.adapter_.getIndexForEventTarget(e.target);n<0||this.selectedTriggerTimerId_||(this.selectedTriggerTimerId_=setTimeout(function(){t.selectedTriggerTimerId_=0,t.close(),t.adapter_.notifySelected({index:n})},u.b.SELECTED_TRIGGER_DELAY))}}},{key:"autoPosition_",value:function(){var e;if(this.adapter_.hasAnchor()){var t="top",n="left",i=this.adapter_.getAnchorDimensions(),o=this.adapter_.getWindowDimensions(),a=i.top+this.dimensions_.height-o.height,s=this.dimensions_.height-i.bottom;a>0&&s<a&&(t="bottom");var u=i.left+this.dimensions_.width-o.width,c=this.dimensions_.width-i.right,l=u>0,f=c>0;this.adapter_.isRtl()?(n="right",f&&u<c&&(n="left")):l&&c<u&&(n="right");var d=(e={},r(e,n,"0"),r(e,t,"0"),e);this.adapter_.setTransformOrigin(t+" "+n),this.adapter_.setPosition(d)}}},{key:"open",value:function(){var e=this,n=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},r=n.focusIndex,i=void 0===r?null:r;this.adapter_.saveFocus(),this.adapter_.addClass(t.cssClasses.ANIMATING),this.animationRequestId_=requestAnimationFrame(function(){e.dimensions_=e.adapter_.getInnerDimensions(),e.applyTransitionDelays_(),e.autoPosition_(),e.animateMenu_(),e.adapter_.addClass(t.cssClasses.OPEN),e.focusOnOpen_(i),e.adapter_.registerBodyClickHandler(e.documentClickHandler_)}),this.isOpen_=!0}},{key:"close",value:function(){var e=this,n=arguments.length>0&&void 0!==arguments[0]?arguments[0]:null;!!n&&"true"===this.adapter_.getAttributeForEventTarget(n.target,u.c.ARIA_DISABLED_ATTR)||(this.adapter_.deregisterBodyClickHandler(this.documentClickHandler_),this.adapter_.addClass(t.cssClasses.ANIMATING),requestAnimationFrame(function(){e.removeTransitionDelays_(),e.animateMenu_(),e.adapter_.removeClass(t.cssClasses.OPEN)}),this.isOpen_=!1,this.adapter_.restoreFocus())}},{key:"isOpen",value:function(){return this.isOpen_}}]),t}(s.a);t.a=d},16:function(e,t,n){"use strict";function r(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}var i=function(){function e(e,t){for(var n=0;n<t.length;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,r.key,r)}}return function(t,n,r){return n&&e(t.prototype,n),r&&e(t,r),t}}();!function(){function e(){r(this,e)}i(e,[{key:"addClass",value:function(e){}},{key:"removeClass",value:function(e){}},{key:"hasClass",value:function(e){}},{key:"hasNecessaryDom",value:function(){}},{key:"getAttributeForEventTarget",value:function(e,t){}},{key:"getInnerDimensions",value:function(){}},{key:"hasAnchor",value:function(){}},{key:"getAnchorDimensions",value:function(){}},{key:"getWindowDimensions",value:function(){}},{key:"setScale",value:function(e,t){}},{key:"setInnerScale",value:function(e,t){}},{key:"getNumberOfItems",value:function(){}},{key:"registerInteractionHandler",value:function(e,t){}},{key:"deregisterInteractionHandler",value:function(e,t){}},{key:"registerBodyClickHandler",value:function(e){}},{key:"deregisterBodyClickHandler",value:function(e){}},{key:"getYParamsForItemAtIndex",value:function(e){}},{key:"setTransitionDelayForItemAtIndex",value:function(e,t){}},{key:"getIndexForEventTarget",value:function(e){}},{key:"notifySelected",value:function(e){}},{key:"notifyCancel",value:function(){}},{key:"saveFocus",value:function(){}},{key:"restoreFocus",value:function(){}},{key:"isFocused",value:function(){}},{key:"focus",value:function(){}},{key:"getFocusedItemIndex",value:function(){}},{key:"focusItemAtIndex",value:function(e){}},{key:"isRtl",value:function(){}},{key:"setTransformOrigin",value:function(e){}},{key:"setPosition",value:function(e){}},{key:"getAccurateTime",value:function(){}}])}()},17:function(e,t,n){"use strict";n.d(t,"a",function(){return r}),n.d(t,"c",function(){return i}),n.d(t,"b",function(){return o});var r={ROOT:"mdc-simple-menu",OPEN:"mdc-simple-menu--open",ANIMATING:"mdc-simple-menu--animating",TOP_RIGHT:"mdc-simple-menu--open-from-top-right",BOTTOM_LEFT:"mdc-simple-menu--open-from-bottom-left",BOTTOM_RIGHT:"mdc-simple-menu--open-from-bottom-right"},i={ITEMS_SELECTOR:".mdc-simple-menu__items",SELECTED_EVENT:"MDCSimpleMenu:selected",CANCEL_EVENT:"MDCSimpleMenu:cancel",ARIA_DISABLED_ATTR:"aria-disabled"},o={SELECTED_TRIGGER_DELAY:50,TRANSITION_DURATION_MS:300,TRANSITION_SCALE_ADJUSTMENT_X:.5,TRANSITION_SCALE_ADJUSTMENT_Y:.2,TRANSITION_X1:0,TRANSITION_Y1:0,TRANSITION_X2:.2,TRANSITION_Y2:1}},66:function(e,t,n){e.exports=n(12)}})}); |
{ | ||
"name": "@material/menu", | ||
"version": "0.4.1", | ||
"version": "0.4.2", | ||
"description": "The Material Components for the web menu component", | ||
@@ -17,8 +17,8 @@ "license": "Apache-2.0", | ||
"dependencies": { | ||
"@material/animation": "^0.2.3", | ||
"@material/base": "^0.2.2", | ||
"@material/elevation": "^0.1.9", | ||
"@material/theme": "^0.1.5", | ||
"@material/typography": "^0.2.2" | ||
"@material/animation": "^0.3.0", | ||
"@material/base": "^0.2.3", | ||
"@material/elevation": "^0.1.10", | ||
"@material/theme": "^0.1.6", | ||
"@material/typography": "^0.2.3" | ||
} | ||
} |
@@ -263,3 +263,3 @@ <!--docs: | ||
integrate the component. As with all foundation classes, an adapter object must be provided. | ||
The adapter for temporary drawers must provide the following functions, with correct signatures: | ||
The adapter for simple menu must provide the following functions, with correct signatures: | ||
@@ -266,0 +266,0 @@ | Method Signature | Description | |
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
150302
0.14%2668
0.11%0
-100%+ Added
- Removed
Updated
Updated
Updated
Updated
Updated