@material/snackbar
Advanced tools
Comparing version 0.37.1 to 0.38.0
@@ -78,3 +78,3 @@ /*! | ||
/******/ // Load entry module and return exports | ||
/******/ return __webpack_require__(__webpack_require__.s = 99); | ||
/******/ return __webpack_require__(__webpack_require__.s = 123); | ||
/******/ }) | ||
@@ -361,8 +361,320 @@ /************************************************************************/ | ||
/***/ 100: | ||
/***/ 10: | ||
/***/ (function(module, __webpack_exports__, __webpack_require__) { | ||
"use strict"; | ||
Object.defineProperty(__webpack_exports__, "__esModule", { value: true }); | ||
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "transformStyleProperties", function() { return transformStyleProperties; }); | ||
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "getCorrectEventName", function() { return getCorrectEventName; }); | ||
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "getCorrectPropertyName", function() { return getCorrectPropertyName; }); | ||
/** | ||
* @license | ||
* 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. | ||
*/ | ||
/** | ||
* @typedef {{ | ||
* noPrefix: string, | ||
* webkitPrefix: string, | ||
* styleProperty: string | ||
* }} | ||
*/ | ||
var VendorPropertyMapType = void 0; | ||
/** @const {Object<string, !VendorPropertyMapType>} */ | ||
var eventTypeMap = { | ||
'animationstart': { | ||
noPrefix: 'animationstart', | ||
webkitPrefix: 'webkitAnimationStart', | ||
styleProperty: 'animation' | ||
}, | ||
'animationend': { | ||
noPrefix: 'animationend', | ||
webkitPrefix: 'webkitAnimationEnd', | ||
styleProperty: 'animation' | ||
}, | ||
'animationiteration': { | ||
noPrefix: 'animationiteration', | ||
webkitPrefix: 'webkitAnimationIteration', | ||
styleProperty: 'animation' | ||
}, | ||
'transitionend': { | ||
noPrefix: 'transitionend', | ||
webkitPrefix: 'webkitTransitionEnd', | ||
styleProperty: 'transition' | ||
} | ||
}; | ||
/** @const {Object<string, !VendorPropertyMapType>} */ | ||
var cssPropertyMap = { | ||
'animation': { | ||
noPrefix: 'animation', | ||
webkitPrefix: '-webkit-animation' | ||
}, | ||
'transform': { | ||
noPrefix: 'transform', | ||
webkitPrefix: '-webkit-transform' | ||
}, | ||
'transition': { | ||
noPrefix: 'transition', | ||
webkitPrefix: '-webkit-transition' | ||
} | ||
}; | ||
/** | ||
* @param {!Object} windowObj | ||
* @return {boolean} | ||
*/ | ||
function hasProperShape(windowObj) { | ||
return windowObj['document'] !== undefined && typeof windowObj['document']['createElement'] === 'function'; | ||
} | ||
/** | ||
* @param {string} eventType | ||
* @return {boolean} | ||
*/ | ||
function eventFoundInMaps(eventType) { | ||
return eventType in eventTypeMap || eventType in cssPropertyMap; | ||
} | ||
/** | ||
* @param {string} eventType | ||
* @param {!Object<string, !VendorPropertyMapType>} map | ||
* @param {!Element} el | ||
* @return {string} | ||
*/ | ||
function getJavaScriptEventName(eventType, map, el) { | ||
return map[eventType].styleProperty in el.style ? map[eventType].noPrefix : map[eventType].webkitPrefix; | ||
} | ||
/** | ||
* Helper function to determine browser prefix for CSS3 animation events | ||
* and property names. | ||
* @param {!Object} windowObj | ||
* @param {string} eventType | ||
* @return {string} | ||
*/ | ||
function getAnimationName(windowObj, eventType) { | ||
if (!hasProperShape(windowObj) || !eventFoundInMaps(eventType)) { | ||
return eventType; | ||
} | ||
var map = /** @type {!Object<string, !VendorPropertyMapType>} */eventType in eventTypeMap ? eventTypeMap : cssPropertyMap; | ||
var el = windowObj['document']['createElement']('div'); | ||
var eventName = ''; | ||
if (map === eventTypeMap) { | ||
eventName = getJavaScriptEventName(eventType, map, el); | ||
} else { | ||
eventName = map[eventType].noPrefix in el.style ? map[eventType].noPrefix : map[eventType].webkitPrefix; | ||
} | ||
return eventName; | ||
} | ||
// Public functions to access getAnimationName() for JavaScript events or CSS | ||
// property names. | ||
var transformStyleProperties = ['transform', 'WebkitTransform', 'MozTransform', 'OTransform', 'MSTransform']; | ||
/** | ||
* @param {!Object} windowObj | ||
* @param {string} eventType | ||
* @return {string} | ||
*/ | ||
function getCorrectEventName(windowObj, eventType) { | ||
return getAnimationName(windowObj, eventType); | ||
} | ||
/** | ||
* @param {!Object} windowObj | ||
* @param {string} eventType | ||
* @return {string} | ||
*/ | ||
function getCorrectPropertyName(windowObj, eventType) { | ||
return getAnimationName(windowObj, eventType); | ||
} | ||
/***/ }), | ||
/***/ 123: | ||
/***/ (function(module, __webpack_exports__, __webpack_require__) { | ||
"use strict"; | ||
Object.defineProperty(__webpack_exports__, "__esModule", { value: true }); | ||
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "MDCSnackbar", function() { return MDCSnackbar; }); | ||
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_0__material_base_index__ = __webpack_require__(7); | ||
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_1__constants__ = __webpack_require__(101); | ||
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_1__foundation__ = __webpack_require__(124); | ||
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_2__material_animation_index__ = __webpack_require__(10); | ||
/* harmony reexport (binding) */ __webpack_require__.d(__webpack_exports__, "MDCSnackbarFoundation", function() { return __WEBPACK_IMPORTED_MODULE_1__foundation__["a"]; }); | ||
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; }; }(); | ||
function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } } | ||
function _possibleConstructorReturn(self, call) { if (!self) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return call && (typeof call === "object" || typeof call === "function") ? call : self; } | ||
function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function, not " + typeof superClass); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, enumerable: false, writable: true, configurable: true } }); if (superClass) Object.setPrototypeOf ? Object.setPrototypeOf(subClass, superClass) : subClass.__proto__ = superClass; } | ||
/** | ||
* 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. | ||
*/ | ||
var MDCSnackbar = function (_MDCComponent) { | ||
_inherits(MDCSnackbar, _MDCComponent); | ||
function MDCSnackbar() { | ||
_classCallCheck(this, MDCSnackbar); | ||
return _possibleConstructorReturn(this, (MDCSnackbar.__proto__ || Object.getPrototypeOf(MDCSnackbar)).apply(this, arguments)); | ||
} | ||
_createClass(MDCSnackbar, [{ | ||
key: 'show', | ||
value: function show(data) { | ||
this.foundation_.show(data); | ||
} | ||
}, { | ||
key: 'getDefaultFoundation', | ||
value: function getDefaultFoundation() { | ||
var _this2 = this; | ||
var _MDCSnackbarFoundatio = __WEBPACK_IMPORTED_MODULE_1__foundation__["a" /* default */].strings, | ||
TEXT_SELECTOR = _MDCSnackbarFoundatio.TEXT_SELECTOR, | ||
ACTION_BUTTON_SELECTOR = _MDCSnackbarFoundatio.ACTION_BUTTON_SELECTOR; | ||
var getText = function getText() { | ||
return _this2.root_.querySelector(TEXT_SELECTOR); | ||
}; | ||
var getActionButton = function getActionButton() { | ||
return _this2.root_.querySelector(ACTION_BUTTON_SELECTOR); | ||
}; | ||
/* eslint brace-style: "off" */ | ||
return new __WEBPACK_IMPORTED_MODULE_1__foundation__["a" /* default */]({ | ||
addClass: function addClass(className) { | ||
return _this2.root_.classList.add(className); | ||
}, | ||
removeClass: function removeClass(className) { | ||
return _this2.root_.classList.remove(className); | ||
}, | ||
setAriaHidden: function setAriaHidden() { | ||
return _this2.root_.setAttribute('aria-hidden', 'true'); | ||
}, | ||
unsetAriaHidden: function unsetAriaHidden() { | ||
return _this2.root_.removeAttribute('aria-hidden'); | ||
}, | ||
setActionAriaHidden: function setActionAriaHidden() { | ||
return getActionButton().setAttribute('aria-hidden', 'true'); | ||
}, | ||
unsetActionAriaHidden: function unsetActionAriaHidden() { | ||
return getActionButton().removeAttribute('aria-hidden'); | ||
}, | ||
setActionText: function setActionText(text) { | ||
getActionButton().textContent = text; | ||
}, | ||
setMessageText: function setMessageText(text) { | ||
getText().textContent = text; | ||
}, | ||
setFocus: function setFocus() { | ||
return getActionButton().focus(); | ||
}, | ||
visibilityIsHidden: function visibilityIsHidden() { | ||
return document.hidden; | ||
}, | ||
registerCapturedBlurHandler: function registerCapturedBlurHandler(handler) { | ||
return getActionButton().addEventListener('blur', handler, true); | ||
}, | ||
deregisterCapturedBlurHandler: function deregisterCapturedBlurHandler(handler) { | ||
return getActionButton().removeEventListener('blur', handler, true); | ||
}, | ||
registerVisibilityChangeHandler: function registerVisibilityChangeHandler(handler) { | ||
return document.addEventListener('visibilitychange', handler); | ||
}, | ||
deregisterVisibilityChangeHandler: function deregisterVisibilityChangeHandler(handler) { | ||
return document.removeEventListener('visibilitychange', handler); | ||
}, | ||
registerCapturedInteractionHandler: function registerCapturedInteractionHandler(evt, handler) { | ||
return document.body.addEventListener(evt, handler, true); | ||
}, | ||
deregisterCapturedInteractionHandler: function deregisterCapturedInteractionHandler(evt, handler) { | ||
return document.body.removeEventListener(evt, handler, true); | ||
}, | ||
registerActionClickHandler: function registerActionClickHandler(handler) { | ||
return getActionButton().addEventListener('click', handler); | ||
}, | ||
deregisterActionClickHandler: function deregisterActionClickHandler(handler) { | ||
return getActionButton().removeEventListener('click', handler); | ||
}, | ||
registerTransitionEndHandler: function registerTransitionEndHandler(handler) { | ||
return _this2.root_.addEventListener(Object(__WEBPACK_IMPORTED_MODULE_2__material_animation_index__["getCorrectEventName"])(window, 'transitionend'), handler); | ||
}, | ||
deregisterTransitionEndHandler: function deregisterTransitionEndHandler(handler) { | ||
return _this2.root_.removeEventListener(Object(__WEBPACK_IMPORTED_MODULE_2__material_animation_index__["getCorrectEventName"])(window, 'transitionend'), handler); | ||
}, | ||
notifyShow: function notifyShow() { | ||
return _this2.emit(__WEBPACK_IMPORTED_MODULE_1__foundation__["a" /* default */].strings.SHOW_EVENT); | ||
}, | ||
notifyHide: function notifyHide() { | ||
return _this2.emit(__WEBPACK_IMPORTED_MODULE_1__foundation__["a" /* default */].strings.HIDE_EVENT); | ||
} | ||
}); | ||
} | ||
}, { | ||
key: 'dismissesOnAction', | ||
get: function get() { | ||
return this.foundation_.dismissesOnAction(); | ||
}, | ||
set: function set(dismissesOnAction) { | ||
this.foundation_.setDismissOnAction(dismissesOnAction); | ||
} | ||
}], [{ | ||
key: 'attachTo', | ||
value: function attachTo(root) { | ||
return new MDCSnackbar(root); | ||
} | ||
}]); | ||
return MDCSnackbar; | ||
}(__WEBPACK_IMPORTED_MODULE_0__material_base_index__["MDCComponent"]); | ||
/***/ }), | ||
/***/ 124: | ||
/***/ (function(module, __webpack_exports__, __webpack_require__) { | ||
"use strict"; | ||
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_0__material_base_index__ = __webpack_require__(7); | ||
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_1__constants__ = __webpack_require__(125); | ||
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; }; | ||
@@ -668,3 +980,3 @@ | ||
/***/ 101: | ||
/***/ 125: | ||
/***/ (function(module, __webpack_exports__, __webpack_require__) { | ||
@@ -746,314 +1058,2 @@ | ||
/***/ }), | ||
/***/ 8: | ||
/***/ (function(module, __webpack_exports__, __webpack_require__) { | ||
"use strict"; | ||
Object.defineProperty(__webpack_exports__, "__esModule", { value: true }); | ||
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "transformStyleProperties", function() { return transformStyleProperties; }); | ||
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "getCorrectEventName", function() { return getCorrectEventName; }); | ||
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "getCorrectPropertyName", function() { return getCorrectPropertyName; }); | ||
/** | ||
* @license | ||
* 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. | ||
*/ | ||
/** | ||
* @typedef {{ | ||
* noPrefix: string, | ||
* webkitPrefix: string, | ||
* styleProperty: string | ||
* }} | ||
*/ | ||
var VendorPropertyMapType = void 0; | ||
/** @const {Object<string, !VendorPropertyMapType>} */ | ||
var eventTypeMap = { | ||
'animationstart': { | ||
noPrefix: 'animationstart', | ||
webkitPrefix: 'webkitAnimationStart', | ||
styleProperty: 'animation' | ||
}, | ||
'animationend': { | ||
noPrefix: 'animationend', | ||
webkitPrefix: 'webkitAnimationEnd', | ||
styleProperty: 'animation' | ||
}, | ||
'animationiteration': { | ||
noPrefix: 'animationiteration', | ||
webkitPrefix: 'webkitAnimationIteration', | ||
styleProperty: 'animation' | ||
}, | ||
'transitionend': { | ||
noPrefix: 'transitionend', | ||
webkitPrefix: 'webkitTransitionEnd', | ||
styleProperty: 'transition' | ||
} | ||
}; | ||
/** @const {Object<string, !VendorPropertyMapType>} */ | ||
var cssPropertyMap = { | ||
'animation': { | ||
noPrefix: 'animation', | ||
webkitPrefix: '-webkit-animation' | ||
}, | ||
'transform': { | ||
noPrefix: 'transform', | ||
webkitPrefix: '-webkit-transform' | ||
}, | ||
'transition': { | ||
noPrefix: 'transition', | ||
webkitPrefix: '-webkit-transition' | ||
} | ||
}; | ||
/** | ||
* @param {!Object} windowObj | ||
* @return {boolean} | ||
*/ | ||
function hasProperShape(windowObj) { | ||
return windowObj['document'] !== undefined && typeof windowObj['document']['createElement'] === 'function'; | ||
} | ||
/** | ||
* @param {string} eventType | ||
* @return {boolean} | ||
*/ | ||
function eventFoundInMaps(eventType) { | ||
return eventType in eventTypeMap || eventType in cssPropertyMap; | ||
} | ||
/** | ||
* @param {string} eventType | ||
* @param {!Object<string, !VendorPropertyMapType>} map | ||
* @param {!Element} el | ||
* @return {string} | ||
*/ | ||
function getJavaScriptEventName(eventType, map, el) { | ||
return map[eventType].styleProperty in el.style ? map[eventType].noPrefix : map[eventType].webkitPrefix; | ||
} | ||
/** | ||
* Helper function to determine browser prefix for CSS3 animation events | ||
* and property names. | ||
* @param {!Object} windowObj | ||
* @param {string} eventType | ||
* @return {string} | ||
*/ | ||
function getAnimationName(windowObj, eventType) { | ||
if (!hasProperShape(windowObj) || !eventFoundInMaps(eventType)) { | ||
return eventType; | ||
} | ||
var map = /** @type {!Object<string, !VendorPropertyMapType>} */eventType in eventTypeMap ? eventTypeMap : cssPropertyMap; | ||
var el = windowObj['document']['createElement']('div'); | ||
var eventName = ''; | ||
if (map === eventTypeMap) { | ||
eventName = getJavaScriptEventName(eventType, map, el); | ||
} else { | ||
eventName = map[eventType].noPrefix in el.style ? map[eventType].noPrefix : map[eventType].webkitPrefix; | ||
} | ||
return eventName; | ||
} | ||
// Public functions to access getAnimationName() for JavaScript events or CSS | ||
// property names. | ||
var transformStyleProperties = ['transform', 'WebkitTransform', 'MozTransform', 'OTransform', 'MSTransform']; | ||
/** | ||
* @param {!Object} windowObj | ||
* @param {string} eventType | ||
* @return {string} | ||
*/ | ||
function getCorrectEventName(windowObj, eventType) { | ||
return getAnimationName(windowObj, eventType); | ||
} | ||
/** | ||
* @param {!Object} windowObj | ||
* @param {string} eventType | ||
* @return {string} | ||
*/ | ||
function getCorrectPropertyName(windowObj, eventType) { | ||
return getAnimationName(windowObj, eventType); | ||
} | ||
/***/ }), | ||
/***/ 99: | ||
/***/ (function(module, __webpack_exports__, __webpack_require__) { | ||
"use strict"; | ||
Object.defineProperty(__webpack_exports__, "__esModule", { value: true }); | ||
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "MDCSnackbar", function() { return MDCSnackbar; }); | ||
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_0__material_base_index__ = __webpack_require__(7); | ||
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_1__foundation__ = __webpack_require__(100); | ||
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_2__material_animation_index__ = __webpack_require__(8); | ||
/* harmony reexport (binding) */ __webpack_require__.d(__webpack_exports__, "MDCSnackbarFoundation", function() { return __WEBPACK_IMPORTED_MODULE_1__foundation__["a"]; }); | ||
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; }; }(); | ||
function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } } | ||
function _possibleConstructorReturn(self, call) { if (!self) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return call && (typeof call === "object" || typeof call === "function") ? call : self; } | ||
function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function, not " + typeof superClass); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, enumerable: false, writable: true, configurable: true } }); if (superClass) Object.setPrototypeOf ? Object.setPrototypeOf(subClass, superClass) : subClass.__proto__ = superClass; } | ||
/** | ||
* 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. | ||
*/ | ||
var MDCSnackbar = function (_MDCComponent) { | ||
_inherits(MDCSnackbar, _MDCComponent); | ||
function MDCSnackbar() { | ||
_classCallCheck(this, MDCSnackbar); | ||
return _possibleConstructorReturn(this, (MDCSnackbar.__proto__ || Object.getPrototypeOf(MDCSnackbar)).apply(this, arguments)); | ||
} | ||
_createClass(MDCSnackbar, [{ | ||
key: 'show', | ||
value: function show(data) { | ||
this.foundation_.show(data); | ||
} | ||
}, { | ||
key: 'getDefaultFoundation', | ||
value: function getDefaultFoundation() { | ||
var _this2 = this; | ||
var _MDCSnackbarFoundatio = __WEBPACK_IMPORTED_MODULE_1__foundation__["a" /* default */].strings, | ||
TEXT_SELECTOR = _MDCSnackbarFoundatio.TEXT_SELECTOR, | ||
ACTION_BUTTON_SELECTOR = _MDCSnackbarFoundatio.ACTION_BUTTON_SELECTOR; | ||
var getText = function getText() { | ||
return _this2.root_.querySelector(TEXT_SELECTOR); | ||
}; | ||
var getActionButton = function getActionButton() { | ||
return _this2.root_.querySelector(ACTION_BUTTON_SELECTOR); | ||
}; | ||
/* eslint brace-style: "off" */ | ||
return new __WEBPACK_IMPORTED_MODULE_1__foundation__["a" /* default */]({ | ||
addClass: function addClass(className) { | ||
return _this2.root_.classList.add(className); | ||
}, | ||
removeClass: function removeClass(className) { | ||
return _this2.root_.classList.remove(className); | ||
}, | ||
setAriaHidden: function setAriaHidden() { | ||
return _this2.root_.setAttribute('aria-hidden', 'true'); | ||
}, | ||
unsetAriaHidden: function unsetAriaHidden() { | ||
return _this2.root_.removeAttribute('aria-hidden'); | ||
}, | ||
setActionAriaHidden: function setActionAriaHidden() { | ||
return getActionButton().setAttribute('aria-hidden', 'true'); | ||
}, | ||
unsetActionAriaHidden: function unsetActionAriaHidden() { | ||
return getActionButton().removeAttribute('aria-hidden'); | ||
}, | ||
setActionText: function setActionText(text) { | ||
getActionButton().textContent = text; | ||
}, | ||
setMessageText: function setMessageText(text) { | ||
getText().textContent = text; | ||
}, | ||
setFocus: function setFocus() { | ||
return getActionButton().focus(); | ||
}, | ||
visibilityIsHidden: function visibilityIsHidden() { | ||
return document.hidden; | ||
}, | ||
registerCapturedBlurHandler: function registerCapturedBlurHandler(handler) { | ||
return getActionButton().addEventListener('blur', handler, true); | ||
}, | ||
deregisterCapturedBlurHandler: function deregisterCapturedBlurHandler(handler) { | ||
return getActionButton().removeEventListener('blur', handler, true); | ||
}, | ||
registerVisibilityChangeHandler: function registerVisibilityChangeHandler(handler) { | ||
return document.addEventListener('visibilitychange', handler); | ||
}, | ||
deregisterVisibilityChangeHandler: function deregisterVisibilityChangeHandler(handler) { | ||
return document.removeEventListener('visibilitychange', handler); | ||
}, | ||
registerCapturedInteractionHandler: function registerCapturedInteractionHandler(evt, handler) { | ||
return document.body.addEventListener(evt, handler, true); | ||
}, | ||
deregisterCapturedInteractionHandler: function deregisterCapturedInteractionHandler(evt, handler) { | ||
return document.body.removeEventListener(evt, handler, true); | ||
}, | ||
registerActionClickHandler: function registerActionClickHandler(handler) { | ||
return getActionButton().addEventListener('click', handler); | ||
}, | ||
deregisterActionClickHandler: function deregisterActionClickHandler(handler) { | ||
return getActionButton().removeEventListener('click', handler); | ||
}, | ||
registerTransitionEndHandler: function registerTransitionEndHandler(handler) { | ||
return _this2.root_.addEventListener(Object(__WEBPACK_IMPORTED_MODULE_2__material_animation_index__["getCorrectEventName"])(window, 'transitionend'), handler); | ||
}, | ||
deregisterTransitionEndHandler: function deregisterTransitionEndHandler(handler) { | ||
return _this2.root_.removeEventListener(Object(__WEBPACK_IMPORTED_MODULE_2__material_animation_index__["getCorrectEventName"])(window, 'transitionend'), handler); | ||
}, | ||
notifyShow: function notifyShow() { | ||
return _this2.emit(__WEBPACK_IMPORTED_MODULE_1__foundation__["a" /* default */].strings.SHOW_EVENT); | ||
}, | ||
notifyHide: function notifyHide() { | ||
return _this2.emit(__WEBPACK_IMPORTED_MODULE_1__foundation__["a" /* default */].strings.HIDE_EVENT); | ||
} | ||
}); | ||
} | ||
}, { | ||
key: 'dismissesOnAction', | ||
get: function get() { | ||
return this.foundation_.dismissesOnAction(); | ||
}, | ||
set: function set(dismissesOnAction) { | ||
this.foundation_.setDismissOnAction(dismissesOnAction); | ||
} | ||
}], [{ | ||
key: 'attachTo', | ||
value: function attachTo(root) { | ||
return new MDCSnackbar(root); | ||
} | ||
}]); | ||
return MDCSnackbar; | ||
}(__WEBPACK_IMPORTED_MODULE_0__material_base_index__["MDCComponent"]); | ||
/***/ }) | ||
@@ -1060,0 +1060,0 @@ |
@@ -6,3 +6,3 @@ /*! | ||
*/ | ||
!function(t,e){"object"==typeof exports&&"object"==typeof module?module.exports=e():"function"==typeof define&&define.amd?define([],e):"object"==typeof exports?exports.snackbar=e():(t.mdc=t.mdc||{},t.mdc.snackbar=e())}(this,function(){return function(t){function e(i){if(n[i])return n[i].exports;var r=n[i]={i:i,l:!1,exports:{}};return t[i].call(r.exports,r,r.exports,e),r.l=!0,r.exports}var n={};return e.m=t,e.c=n,e.d=function(t,n,i){e.o(t,n)||Object.defineProperty(t,n,{configurable:!1,enumerable:!0,get:i})},e.n=function(t){var n=t&&t.__esModule?function(){return t.default}:function(){return t};return e.d(n,"a",n),n},e.o=function(t,e){return Object.prototype.hasOwnProperty.call(t,e)},e.p="",e(e.s=99)}({0:function(t,e,n){"use strict";function i(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}var r=function(){function t(t,e){for(var n=0;n<e.length;n++){var i=e[n];i.enumerable=i.enumerable||!1,i.configurable=!0,"value"in i&&(i.writable=!0),Object.defineProperty(t,i.key,i)}}return function(e,n,i){return n&&t(e.prototype,n),i&&t(e,i),e}}(),o=function(){function t(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};i(this,t),this.adapter_=e}return r(t,null,[{key:"cssClasses",get:function(){return{}}},{key:"strings",get:function(){return{}}},{key:"numbers",get:function(){return{}}},{key:"defaultAdapter",get:function(){return{}}}]),r(t,[{key:"init",value:function(){}},{key:"destroy",value:function(){}}]),t}();e.a=o},1:function(t,e,n){"use strict";function i(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}var r=n(0),o=function(){function t(t,e){for(var n=0;n<e.length;n++){var i=e[n];i.enumerable=i.enumerable||!1,i.configurable=!0,"value"in i&&(i.writable=!0),Object.defineProperty(t,i.key,i)}}return function(e,n,i){return n&&t(e.prototype,n),i&&t(e,i),e}}(),a=function(){function t(e){var n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:void 0;i(this,t),this.root_=e;for(var r=arguments.length,o=Array(r>2?r-2:0),a=2;a<r;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(t,null,[{key:"attachTo",value:function(e){return new t(e,new r.a)}}]),o(t,[{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(t,e){this.root_.addEventListener(t,e)}},{key:"unlisten",value:function(t,e){this.root_.removeEventListener(t,e)}},{key:"emit",value:function(t,e){var n=arguments.length>2&&void 0!==arguments[2]&&arguments[2],i=void 0;"function"==typeof CustomEvent?i=new CustomEvent(t,{detail:e,bubbles:n}):(i=document.createEvent("CustomEvent"),i.initCustomEvent(t,n,!1,e)),this.root_.dispatchEvent(i)}}]),t}();e.a=a},100:function(t,e,n){"use strict";function i(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}function r(t,e){if(!t)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!e||"object"!=typeof e&&"function"!=typeof e?t:e}function o(t,e){if("function"!=typeof e&&null!==e)throw new TypeError("Super expression must either be null or a function, not "+typeof e);t.prototype=Object.create(e&&e.prototype,{constructor:{value:t,enumerable:!1,writable:!0,configurable:!0}}),e&&(Object.setPrototypeOf?Object.setPrototypeOf(t,e):t.__proto__=e)}var a=n(7),s=n(101),u=Object.assign||function(t){for(var e=1;e<arguments.length;e++){var n=arguments[e];for(var i in n)Object.prototype.hasOwnProperty.call(n,i)&&(t[i]=n[i])}return t},c=function(){function t(t,e){for(var n=0;n<e.length;n++){var i=e[n];i.enumerable=i.enumerable||!1,i.configurable=!0,"value"in i&&(i.writable=!0),Object.defineProperty(t,i.key,i)}}return function(e,n,i){return n&&t(e.prototype,n),i&&t(e,i),e}}(),d=function(t){function e(t){i(this,e);var n=r(this,(e.__proto__||Object.getPrototypeOf(e)).call(this,u(e.defaultAdapter,t)));return n.active_=!1,n.actionWasClicked_=!1,n.dismissOnAction_=!0,n.firstFocus_=!0,n.pointerDownRecognized_=!1,n.snackbarHasFocus_=!1,n.snackbarData_=null,n.queue_=[],n.actionClickHandler_=function(){n.actionWasClicked_=!0,n.invokeAction_()},n.visibilitychangeHandler_=function(){clearTimeout(n.timeoutId_),n.snackbarHasFocus_=!0,n.adapter_.visibilityIsHidden()||setTimeout(n.cleanup_.bind(n),n.snackbarData_.timeout||s.b.MESSAGE_TIMEOUT)},n.interactionHandler_=function(t){"touchstart"!=t.type&&"mousedown"!=t.type||(n.pointerDownRecognized_=!0),n.handlePossibleTabKeyboardFocus_(t),"focus"==t.type&&(n.pointerDownRecognized_=!1)},n.blurHandler_=function(){clearTimeout(n.timeoutId_),n.snackbarHasFocus_=!1,n.timeoutId_=setTimeout(n.cleanup_.bind(n),n.snackbarData_.timeout||s.b.MESSAGE_TIMEOUT)},n}return o(e,t),c(e,[{key:"active",get:function(){return this.active_}}],[{key:"cssClasses",get:function(){return s.a}},{key:"strings",get:function(){return s.c}},{key:"defaultAdapter",get:function(){return{addClass:function(){},removeClass:function(){},setAriaHidden:function(){},unsetAriaHidden:function(){},setActionAriaHidden:function(){},unsetActionAriaHidden:function(){},setActionText:function(){},setMessageText:function(){},setFocus:function(){},visibilityIsHidden:function(){return!1},registerCapturedBlurHandler:function(){},deregisterCapturedBlurHandler:function(){},registerVisibilityChangeHandler:function(){},deregisterVisibilityChangeHandler:function(){},registerCapturedInteractionHandler:function(){},deregisterCapturedInteractionHandler:function(){},registerActionClickHandler:function(){},deregisterActionClickHandler:function(){},registerTransitionEndHandler:function(){},deregisterTransitionEndHandler:function(){},notifyShow:function(){},notifyHide:function(){}}}}]),c(e,[{key:"init",value:function(){this.adapter_.registerActionClickHandler(this.actionClickHandler_),this.adapter_.setAriaHidden(),this.adapter_.setActionAriaHidden()}},{key:"destroy",value:function(){var t=this;this.adapter_.deregisterActionClickHandler(this.actionClickHandler_),this.adapter_.deregisterCapturedBlurHandler(this.blurHandler_),this.adapter_.deregisterVisibilityChangeHandler(this.visibilitychangeHandler_),["touchstart","mousedown","focus"].forEach(function(e){t.adapter_.deregisterCapturedInteractionHandler(e,t.interactionHandler_)})}},{key:"dismissesOnAction",value:function(){return this.dismissOnAction_}},{key:"setDismissOnAction",value:function(t){this.dismissOnAction_=!!t}},{key:"show",value:function(t){var e=this;if(!t)throw new Error("Please provide a data object with at least a message to display.");if(!t.message)throw new Error("Please provide a message to be displayed.");if(t.actionHandler&&!t.actionText)throw new Error("Please provide action text with the handler.");if(this.active)return void this.queue_.push(t);clearTimeout(this.timeoutId_),this.snackbarData_=t,this.firstFocus_=!0,this.adapter_.registerVisibilityChangeHandler(this.visibilitychangeHandler_),this.adapter_.registerCapturedBlurHandler(this.blurHandler_),["touchstart","mousedown","focus"].forEach(function(t){e.adapter_.registerCapturedInteractionHandler(t,e.interactionHandler_)});var n=s.a.ACTIVE,i=s.a.MULTILINE,r=s.a.ACTION_ON_BOTTOM;this.adapter_.setMessageText(this.snackbarData_.message),this.snackbarData_.multiline&&(this.adapter_.addClass(i),this.snackbarData_.actionOnBottom&&this.adapter_.addClass(r)),this.snackbarData_.actionHandler?(this.adapter_.setActionText(this.snackbarData_.actionText),this.actionHandler_=this.snackbarData_.actionHandler,this.setActionHidden_(!1)):(this.setActionHidden_(!0),this.actionHandler_=null,this.adapter_.setActionText(null)),this.active_=!0,this.adapter_.addClass(n),this.adapter_.unsetAriaHidden(),this.adapter_.notifyShow(),this.timeoutId_=setTimeout(this.cleanup_.bind(this),this.snackbarData_.timeout||s.b.MESSAGE_TIMEOUT)}},{key:"handlePossibleTabKeyboardFocus_",value:function(){this.firstFocus_&&!this.pointerDownRecognized_&&this.setFocusOnAction_(),this.firstFocus_=!1}},{key:"setFocusOnAction_",value:function(){this.adapter_.setFocus(),this.snackbarHasFocus_=!0,this.firstFocus_=!1}},{key:"invokeAction_",value:function(){try{if(!this.actionHandler_)return;this.actionHandler_()}finally{this.dismissOnAction_&&this.cleanup_()}}},{key:"cleanup_",value:function(){var t=this;if(!this.snackbarHasFocus_||this.actionWasClicked_){var e=s.a.ACTIVE,n=s.a.MULTILINE,i=s.a.ACTION_ON_BOTTOM;this.adapter_.removeClass(e);var r=function e(){clearTimeout(t.timeoutId_),t.adapter_.deregisterTransitionEndHandler(e),t.adapter_.removeClass(n),t.adapter_.removeClass(i),t.setActionHidden_(!0),t.adapter_.setAriaHidden(),t.active_=!1,t.snackbarHasFocus_=!1,t.adapter_.notifyHide(),t.showNext_()};this.adapter_.registerTransitionEndHandler(r)}}},{key:"showNext_",value:function(){this.queue_.length&&this.show(this.queue_.shift())}},{key:"setActionHidden_",value:function(t){t?this.adapter_.setActionAriaHidden():this.adapter_.unsetActionAriaHidden()}}]),e}(a.MDCFoundation);e.a=d},101:function(t,e,n){"use strict";n.d(e,"a",function(){return i}),n.d(e,"c",function(){return r}),n.d(e,"b",function(){return o});var i={ROOT:"mdc-snackbar",TEXT:"mdc-snackbar__text",ACTION_WRAPPER:"mdc-snackbar__action-wrapper",ACTION_BUTTON:"mdc-snackbar__action-button",ACTIVE:"mdc-snackbar--active",MULTILINE:"mdc-snackbar--multiline",ACTION_ON_BOTTOM:"mdc-snackbar--action-on-bottom"},r={TEXT_SELECTOR:".mdc-snackbar__text",ACTION_WRAPPER_SELECTOR:".mdc-snackbar__action-wrapper",ACTION_BUTTON_SELECTOR:".mdc-snackbar__action-button",SHOW_EVENT:"MDCSnackbar:show",HIDE_EVENT:"MDCSnackbar:hide"},o={MESSAGE_TIMEOUT:2750}},7:function(t,e,n){"use strict";Object.defineProperty(e,"__esModule",{value:!0});var i=n(0),r=n(1);n.d(e,"MDCFoundation",function(){return i.a}),n.d(e,"MDCComponent",function(){return r.a})},8:function(t,e,n){"use strict";function i(t){return void 0!==t.document&&"function"==typeof t.document.createElement}function r(t){return t in c||t in d}function o(t,e,n){return e[t].styleProperty in n.style?e[t].noPrefix:e[t].webkitPrefix}function a(t,e){if(!i(t)||!r(e))return e;var n=e in c?c:d,a=t.document.createElement("div");return n===c?o(e,n,a):n[e].noPrefix in a.style?n[e].noPrefix:n[e].webkitPrefix}function s(t,e){return a(t,e)}function u(t,e){return a(t,e)}Object.defineProperty(e,"__esModule",{value:!0}),n.d(e,"transformStyleProperties",function(){return f}),n.d(e,"getCorrectEventName",function(){return s}),n.d(e,"getCorrectPropertyName",function(){return u});/** | ||
!function(t,e){"object"==typeof exports&&"object"==typeof module?module.exports=e():"function"==typeof define&&define.amd?define([],e):"object"==typeof exports?exports.snackbar=e():(t.mdc=t.mdc||{},t.mdc.snackbar=e())}(this,function(){return function(t){function e(i){if(n[i])return n[i].exports;var r=n[i]={i:i,l:!1,exports:{}};return t[i].call(r.exports,r,r.exports,e),r.l=!0,r.exports}var n={};return e.m=t,e.c=n,e.d=function(t,n,i){e.o(t,n)||Object.defineProperty(t,n,{configurable:!1,enumerable:!0,get:i})},e.n=function(t){var n=t&&t.__esModule?function(){return t.default}:function(){return t};return e.d(n,"a",n),n},e.o=function(t,e){return Object.prototype.hasOwnProperty.call(t,e)},e.p="",e(e.s=123)}({0:function(t,e,n){"use strict";function i(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}var r=function(){function t(t,e){for(var n=0;n<e.length;n++){var i=e[n];i.enumerable=i.enumerable||!1,i.configurable=!0,"value"in i&&(i.writable=!0),Object.defineProperty(t,i.key,i)}}return function(e,n,i){return n&&t(e.prototype,n),i&&t(e,i),e}}(),o=function(){function t(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};i(this,t),this.adapter_=e}return r(t,null,[{key:"cssClasses",get:function(){return{}}},{key:"strings",get:function(){return{}}},{key:"numbers",get:function(){return{}}},{key:"defaultAdapter",get:function(){return{}}}]),r(t,[{key:"init",value:function(){}},{key:"destroy",value:function(){}}]),t}();e.a=o},1:function(t,e,n){"use strict";function i(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}var r=n(0),o=function(){function t(t,e){for(var n=0;n<e.length;n++){var i=e[n];i.enumerable=i.enumerable||!1,i.configurable=!0,"value"in i&&(i.writable=!0),Object.defineProperty(t,i.key,i)}}return function(e,n,i){return n&&t(e.prototype,n),i&&t(e,i),e}}(),a=function(){function t(e){var n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:void 0;i(this,t),this.root_=e;for(var r=arguments.length,o=Array(r>2?r-2:0),a=2;a<r;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(t,null,[{key:"attachTo",value:function(e){return new t(e,new r.a)}}]),o(t,[{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(t,e){this.root_.addEventListener(t,e)}},{key:"unlisten",value:function(t,e){this.root_.removeEventListener(t,e)}},{key:"emit",value:function(t,e){var n=arguments.length>2&&void 0!==arguments[2]&&arguments[2],i=void 0;"function"==typeof CustomEvent?i=new CustomEvent(t,{detail:e,bubbles:n}):(i=document.createEvent("CustomEvent"),i.initCustomEvent(t,n,!1,e)),this.root_.dispatchEvent(i)}}]),t}();e.a=a},10:function(t,e,n){"use strict";function i(t){return void 0!==t.document&&"function"==typeof t.document.createElement}function r(t){return t in c||t in d}function o(t,e,n){return e[t].styleProperty in n.style?e[t].noPrefix:e[t].webkitPrefix}function a(t,e){if(!i(t)||!r(e))return e;var n=e in c?c:d,a=t.document.createElement("div");return n===c?o(e,n,a):n[e].noPrefix in a.style?n[e].noPrefix:n[e].webkitPrefix}function s(t,e){return a(t,e)}function u(t,e){return a(t,e)}Object.defineProperty(e,"__esModule",{value:!0}),n.d(e,"transformStyleProperties",function(){return f}),n.d(e,"getCorrectEventName",function(){return s}),n.d(e,"getCorrectPropertyName",function(){return u});/** | ||
* @license | ||
@@ -23,3 +23,3 @@ * Copyright 2016 Google Inc. All Rights Reserved. | ||
*/ | ||
var c={animationstart:{noPrefix:"animationstart",webkitPrefix:"webkitAnimationStart",styleProperty:"animation"},animationend:{noPrefix:"animationend",webkitPrefix:"webkitAnimationEnd",styleProperty:"animation"},animationiteration:{noPrefix:"animationiteration",webkitPrefix:"webkitAnimationIteration",styleProperty:"animation"},transitionend:{noPrefix:"transitionend",webkitPrefix:"webkitTransitionEnd",styleProperty:"transition"}},d={animation:{noPrefix:"animation",webkitPrefix:"-webkit-animation"},transform:{noPrefix:"transform",webkitPrefix:"-webkit-transform"},transition:{noPrefix:"transition",webkitPrefix:"-webkit-transition"}},f=["transform","WebkitTransform","MozTransform","OTransform","MSTransform"]},99:function(t,e,n){"use strict";function i(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}function r(t,e){if(!t)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!e||"object"!=typeof e&&"function"!=typeof e?t:e}function o(t,e){if("function"!=typeof e&&null!==e)throw new TypeError("Super expression must either be null or a function, not "+typeof e);t.prototype=Object.create(e&&e.prototype,{constructor:{value:t,enumerable:!1,writable:!0,configurable:!0}}),e&&(Object.setPrototypeOf?Object.setPrototypeOf(t,e):t.__proto__=e)}Object.defineProperty(e,"__esModule",{value:!0}),n.d(e,"MDCSnackbar",function(){return d});var a=n(7),s=n(100),u=n(8);n.d(e,"MDCSnackbarFoundation",function(){return s.a});var c=function(){function t(t,e){for(var n=0;n<e.length;n++){var i=e[n];i.enumerable=i.enumerable||!1,i.configurable=!0,"value"in i&&(i.writable=!0),Object.defineProperty(t,i.key,i)}}return function(e,n,i){return n&&t(e.prototype,n),i&&t(e,i),e}}(),d=function(t){function e(){return i(this,e),r(this,(e.__proto__||Object.getPrototypeOf(e)).apply(this,arguments))}return o(e,t),c(e,[{key:"show",value:function(t){this.foundation_.show(t)}},{key:"getDefaultFoundation",value:function(){var t=this,e=s.a.strings,n=e.TEXT_SELECTOR,i=e.ACTION_BUTTON_SELECTOR,r=function(){return t.root_.querySelector(n)},o=function(){return t.root_.querySelector(i)};return new s.a({addClass:function(e){return t.root_.classList.add(e)},removeClass:function(e){return t.root_.classList.remove(e)},setAriaHidden:function(){return t.root_.setAttribute("aria-hidden","true")},unsetAriaHidden:function(){return t.root_.removeAttribute("aria-hidden")},setActionAriaHidden:function(){return o().setAttribute("aria-hidden","true")},unsetActionAriaHidden:function(){return o().removeAttribute("aria-hidden")},setActionText:function(t){o().textContent=t},setMessageText:function(t){r().textContent=t},setFocus:function(){return o().focus()},visibilityIsHidden:function(){return document.hidden},registerCapturedBlurHandler:function(t){return o().addEventListener("blur",t,!0)},deregisterCapturedBlurHandler:function(t){return o().removeEventListener("blur",t,!0)},registerVisibilityChangeHandler:function(t){return document.addEventListener("visibilitychange",t)},deregisterVisibilityChangeHandler:function(t){return document.removeEventListener("visibilitychange",t)},registerCapturedInteractionHandler:function(t,e){return document.body.addEventListener(t,e,!0)},deregisterCapturedInteractionHandler:function(t,e){return document.body.removeEventListener(t,e,!0)},registerActionClickHandler:function(t){return o().addEventListener("click",t)},deregisterActionClickHandler:function(t){return o().removeEventListener("click",t)},registerTransitionEndHandler:function(e){return t.root_.addEventListener(Object(u.getCorrectEventName)(window,"transitionend"),e)},deregisterTransitionEndHandler:function(e){return t.root_.removeEventListener(Object(u.getCorrectEventName)(window,"transitionend"),e)},notifyShow:function(){return t.emit(s.a.strings.SHOW_EVENT)},notifyHide:function(){return t.emit(s.a.strings.HIDE_EVENT)}})}},{key:"dismissesOnAction",get:function(){return this.foundation_.dismissesOnAction()},set:function(t){this.foundation_.setDismissOnAction(t)}}],[{key:"attachTo",value:function(t){return new e(t)}}]),e}(a.MDCComponent)}})}); | ||
var c={animationstart:{noPrefix:"animationstart",webkitPrefix:"webkitAnimationStart",styleProperty:"animation"},animationend:{noPrefix:"animationend",webkitPrefix:"webkitAnimationEnd",styleProperty:"animation"},animationiteration:{noPrefix:"animationiteration",webkitPrefix:"webkitAnimationIteration",styleProperty:"animation"},transitionend:{noPrefix:"transitionend",webkitPrefix:"webkitTransitionEnd",styleProperty:"transition"}},d={animation:{noPrefix:"animation",webkitPrefix:"-webkit-animation"},transform:{noPrefix:"transform",webkitPrefix:"-webkit-transform"},transition:{noPrefix:"transition",webkitPrefix:"-webkit-transition"}},f=["transform","WebkitTransform","MozTransform","OTransform","MSTransform"]},123:function(t,e,n){"use strict";function i(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}function r(t,e){if(!t)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!e||"object"!=typeof e&&"function"!=typeof e?t:e}function o(t,e){if("function"!=typeof e&&null!==e)throw new TypeError("Super expression must either be null or a function, not "+typeof e);t.prototype=Object.create(e&&e.prototype,{constructor:{value:t,enumerable:!1,writable:!0,configurable:!0}}),e&&(Object.setPrototypeOf?Object.setPrototypeOf(t,e):t.__proto__=e)}Object.defineProperty(e,"__esModule",{value:!0}),n.d(e,"MDCSnackbar",function(){return d});var a=n(7),s=n(124),u=n(10);n.d(e,"MDCSnackbarFoundation",function(){return s.a});var c=function(){function t(t,e){for(var n=0;n<e.length;n++){var i=e[n];i.enumerable=i.enumerable||!1,i.configurable=!0,"value"in i&&(i.writable=!0),Object.defineProperty(t,i.key,i)}}return function(e,n,i){return n&&t(e.prototype,n),i&&t(e,i),e}}(),d=function(t){function e(){return i(this,e),r(this,(e.__proto__||Object.getPrototypeOf(e)).apply(this,arguments))}return o(e,t),c(e,[{key:"show",value:function(t){this.foundation_.show(t)}},{key:"getDefaultFoundation",value:function(){var t=this,e=s.a.strings,n=e.TEXT_SELECTOR,i=e.ACTION_BUTTON_SELECTOR,r=function(){return t.root_.querySelector(n)},o=function(){return t.root_.querySelector(i)};return new s.a({addClass:function(e){return t.root_.classList.add(e)},removeClass:function(e){return t.root_.classList.remove(e)},setAriaHidden:function(){return t.root_.setAttribute("aria-hidden","true")},unsetAriaHidden:function(){return t.root_.removeAttribute("aria-hidden")},setActionAriaHidden:function(){return o().setAttribute("aria-hidden","true")},unsetActionAriaHidden:function(){return o().removeAttribute("aria-hidden")},setActionText:function(t){o().textContent=t},setMessageText:function(t){r().textContent=t},setFocus:function(){return o().focus()},visibilityIsHidden:function(){return document.hidden},registerCapturedBlurHandler:function(t){return o().addEventListener("blur",t,!0)},deregisterCapturedBlurHandler:function(t){return o().removeEventListener("blur",t,!0)},registerVisibilityChangeHandler:function(t){return document.addEventListener("visibilitychange",t)},deregisterVisibilityChangeHandler:function(t){return document.removeEventListener("visibilitychange",t)},registerCapturedInteractionHandler:function(t,e){return document.body.addEventListener(t,e,!0)},deregisterCapturedInteractionHandler:function(t,e){return document.body.removeEventListener(t,e,!0)},registerActionClickHandler:function(t){return o().addEventListener("click",t)},deregisterActionClickHandler:function(t){return o().removeEventListener("click",t)},registerTransitionEndHandler:function(e){return t.root_.addEventListener(Object(u.getCorrectEventName)(window,"transitionend"),e)},deregisterTransitionEndHandler:function(e){return t.root_.removeEventListener(Object(u.getCorrectEventName)(window,"transitionend"),e)},notifyShow:function(){return t.emit(s.a.strings.SHOW_EVENT)},notifyHide:function(){return t.emit(s.a.strings.HIDE_EVENT)}})}},{key:"dismissesOnAction",get:function(){return this.foundation_.dismissesOnAction()},set:function(t){this.foundation_.setDismissOnAction(t)}}],[{key:"attachTo",value:function(t){return new e(t)}}]),e}(a.MDCComponent)},124:function(t,e,n){"use strict";function i(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}function r(t,e){if(!t)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!e||"object"!=typeof e&&"function"!=typeof e?t:e}function o(t,e){if("function"!=typeof e&&null!==e)throw new TypeError("Super expression must either be null or a function, not "+typeof e);t.prototype=Object.create(e&&e.prototype,{constructor:{value:t,enumerable:!1,writable:!0,configurable:!0}}),e&&(Object.setPrototypeOf?Object.setPrototypeOf(t,e):t.__proto__=e)}var a=n(7),s=n(125),u=Object.assign||function(t){for(var e=1;e<arguments.length;e++){var n=arguments[e];for(var i in n)Object.prototype.hasOwnProperty.call(n,i)&&(t[i]=n[i])}return t},c=function(){function t(t,e){for(var n=0;n<e.length;n++){var i=e[n];i.enumerable=i.enumerable||!1,i.configurable=!0,"value"in i&&(i.writable=!0),Object.defineProperty(t,i.key,i)}}return function(e,n,i){return n&&t(e.prototype,n),i&&t(e,i),e}}(),d=function(t){function e(t){i(this,e);var n=r(this,(e.__proto__||Object.getPrototypeOf(e)).call(this,u(e.defaultAdapter,t)));return n.active_=!1,n.actionWasClicked_=!1,n.dismissOnAction_=!0,n.firstFocus_=!0,n.pointerDownRecognized_=!1,n.snackbarHasFocus_=!1,n.snackbarData_=null,n.queue_=[],n.actionClickHandler_=function(){n.actionWasClicked_=!0,n.invokeAction_()},n.visibilitychangeHandler_=function(){clearTimeout(n.timeoutId_),n.snackbarHasFocus_=!0,n.adapter_.visibilityIsHidden()||setTimeout(n.cleanup_.bind(n),n.snackbarData_.timeout||s.b.MESSAGE_TIMEOUT)},n.interactionHandler_=function(t){"touchstart"!=t.type&&"mousedown"!=t.type||(n.pointerDownRecognized_=!0),n.handlePossibleTabKeyboardFocus_(t),"focus"==t.type&&(n.pointerDownRecognized_=!1)},n.blurHandler_=function(){clearTimeout(n.timeoutId_),n.snackbarHasFocus_=!1,n.timeoutId_=setTimeout(n.cleanup_.bind(n),n.snackbarData_.timeout||s.b.MESSAGE_TIMEOUT)},n}return o(e,t),c(e,[{key:"active",get:function(){return this.active_}}],[{key:"cssClasses",get:function(){return s.a}},{key:"strings",get:function(){return s.c}},{key:"defaultAdapter",get:function(){return{addClass:function(){},removeClass:function(){},setAriaHidden:function(){},unsetAriaHidden:function(){},setActionAriaHidden:function(){},unsetActionAriaHidden:function(){},setActionText:function(){},setMessageText:function(){},setFocus:function(){},visibilityIsHidden:function(){return!1},registerCapturedBlurHandler:function(){},deregisterCapturedBlurHandler:function(){},registerVisibilityChangeHandler:function(){},deregisterVisibilityChangeHandler:function(){},registerCapturedInteractionHandler:function(){},deregisterCapturedInteractionHandler:function(){},registerActionClickHandler:function(){},deregisterActionClickHandler:function(){},registerTransitionEndHandler:function(){},deregisterTransitionEndHandler:function(){},notifyShow:function(){},notifyHide:function(){}}}}]),c(e,[{key:"init",value:function(){this.adapter_.registerActionClickHandler(this.actionClickHandler_),this.adapter_.setAriaHidden(),this.adapter_.setActionAriaHidden()}},{key:"destroy",value:function(){var t=this;this.adapter_.deregisterActionClickHandler(this.actionClickHandler_),this.adapter_.deregisterCapturedBlurHandler(this.blurHandler_),this.adapter_.deregisterVisibilityChangeHandler(this.visibilitychangeHandler_),["touchstart","mousedown","focus"].forEach(function(e){t.adapter_.deregisterCapturedInteractionHandler(e,t.interactionHandler_)})}},{key:"dismissesOnAction",value:function(){return this.dismissOnAction_}},{key:"setDismissOnAction",value:function(t){this.dismissOnAction_=!!t}},{key:"show",value:function(t){var e=this;if(!t)throw new Error("Please provide a data object with at least a message to display.");if(!t.message)throw new Error("Please provide a message to be displayed.");if(t.actionHandler&&!t.actionText)throw new Error("Please provide action text with the handler.");if(this.active)return void this.queue_.push(t);clearTimeout(this.timeoutId_),this.snackbarData_=t,this.firstFocus_=!0,this.adapter_.registerVisibilityChangeHandler(this.visibilitychangeHandler_),this.adapter_.registerCapturedBlurHandler(this.blurHandler_),["touchstart","mousedown","focus"].forEach(function(t){e.adapter_.registerCapturedInteractionHandler(t,e.interactionHandler_)});var n=s.a.ACTIVE,i=s.a.MULTILINE,r=s.a.ACTION_ON_BOTTOM;this.adapter_.setMessageText(this.snackbarData_.message),this.snackbarData_.multiline&&(this.adapter_.addClass(i),this.snackbarData_.actionOnBottom&&this.adapter_.addClass(r)),this.snackbarData_.actionHandler?(this.adapter_.setActionText(this.snackbarData_.actionText),this.actionHandler_=this.snackbarData_.actionHandler,this.setActionHidden_(!1)):(this.setActionHidden_(!0),this.actionHandler_=null,this.adapter_.setActionText(null)),this.active_=!0,this.adapter_.addClass(n),this.adapter_.unsetAriaHidden(),this.adapter_.notifyShow(),this.timeoutId_=setTimeout(this.cleanup_.bind(this),this.snackbarData_.timeout||s.b.MESSAGE_TIMEOUT)}},{key:"handlePossibleTabKeyboardFocus_",value:function(){this.firstFocus_&&!this.pointerDownRecognized_&&this.setFocusOnAction_(),this.firstFocus_=!1}},{key:"setFocusOnAction_",value:function(){this.adapter_.setFocus(),this.snackbarHasFocus_=!0,this.firstFocus_=!1}},{key:"invokeAction_",value:function(){try{if(!this.actionHandler_)return;this.actionHandler_()}finally{this.dismissOnAction_&&this.cleanup_()}}},{key:"cleanup_",value:function(){var t=this;if(!this.snackbarHasFocus_||this.actionWasClicked_){var e=s.a.ACTIVE,n=s.a.MULTILINE,i=s.a.ACTION_ON_BOTTOM;this.adapter_.removeClass(e);var r=function e(){clearTimeout(t.timeoutId_),t.adapter_.deregisterTransitionEndHandler(e),t.adapter_.removeClass(n),t.adapter_.removeClass(i),t.setActionHidden_(!0),t.adapter_.setAriaHidden(),t.active_=!1,t.snackbarHasFocus_=!1,t.adapter_.notifyHide(),t.showNext_()};this.adapter_.registerTransitionEndHandler(r)}}},{key:"showNext_",value:function(){this.queue_.length&&this.show(this.queue_.shift())}},{key:"setActionHidden_",value:function(t){t?this.adapter_.setActionAriaHidden():this.adapter_.unsetActionAriaHidden()}}]),e}(a.MDCFoundation);e.a=d},125:function(t,e,n){"use strict";n.d(e,"a",function(){return i}),n.d(e,"c",function(){return r}),n.d(e,"b",function(){return o});var i={ROOT:"mdc-snackbar",TEXT:"mdc-snackbar__text",ACTION_WRAPPER:"mdc-snackbar__action-wrapper",ACTION_BUTTON:"mdc-snackbar__action-button",ACTIVE:"mdc-snackbar--active",MULTILINE:"mdc-snackbar--multiline",ACTION_ON_BOTTOM:"mdc-snackbar--action-on-bottom"},r={TEXT_SELECTOR:".mdc-snackbar__text",ACTION_WRAPPER_SELECTOR:".mdc-snackbar__action-wrapper",ACTION_BUTTON_SELECTOR:".mdc-snackbar__action-button",SHOW_EVENT:"MDCSnackbar:show",HIDE_EVENT:"MDCSnackbar:hide"},o={MESSAGE_TIMEOUT:2750}},7:function(t,e,n){"use strict";Object.defineProperty(e,"__esModule",{value:!0});var i=n(0),r=n(1);n.d(e,"MDCFoundation",function(){return i.a}),n.d(e,"MDCComponent",function(){return r.a})}})}); | ||
//# sourceMappingURL=mdc.snackbar.min.js.map |
{ | ||
"name": "@material/snackbar", | ||
"description": "The Material Components for the web snackbar component", | ||
"version": "0.37.1", | ||
"version": "0.38.0", | ||
"license": "Apache-2.0", | ||
@@ -20,5 +20,5 @@ "keywords": [ | ||
"@material/rtl": "^0.36.0", | ||
"@material/theme": "^0.35.0", | ||
"@material/typography": "^0.37.1" | ||
"@material/theme": "^0.38.0", | ||
"@material/typography": "^0.38.0" | ||
} | ||
} |
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
93685
0
+ Added@material/theme@0.38.0(transitive)
+ Added@material/typography@0.38.0(transitive)
- Removed@material/theme@0.35.0(transitive)
- Removed@material/typography@0.37.1(transitive)
Updated@material/theme@^0.38.0
Updated@material/typography@^0.38.0