@material/drawer
Advanced tools
Comparing version 0.1.0 to 0.1.1
/*! | ||
Material Components for the web | ||
Copyright (c) 2016 Google Inc. | ||
Copyright (c) 2017 Google Inc. | ||
License: Apache-2.0 | ||
@@ -62,3 +62,3 @@ */ | ||
module.exports = __webpack_require__(8); | ||
module.exports = __webpack_require__(9); | ||
@@ -320,3 +320,4 @@ | ||
/* 7 */, | ||
/* 8 */ | ||
/* 8 */, | ||
/* 9 */ | ||
/***/ function(module, exports, __webpack_require__) { | ||
@@ -330,3 +331,3 @@ | ||
var _temporary = __webpack_require__(9); | ||
var _temporary = __webpack_require__(10); | ||
@@ -347,3 +348,3 @@ Object.defineProperty(exports, 'MDCTemporaryDrawer', { | ||
/***/ }, | ||
/* 9 */ | ||
/* 10 */ | ||
/***/ function(module, exports, __webpack_require__) { | ||
@@ -362,7 +363,7 @@ | ||
var _foundation = __webpack_require__(10); | ||
var _foundation = __webpack_require__(11); | ||
var _foundation2 = _interopRequireDefault(_foundation); | ||
var _util = __webpack_require__(12); | ||
var _util = __webpack_require__(13); | ||
@@ -515,3 +516,3 @@ var util = _interopRequireWildcard(_util); | ||
/***/ }, | ||
/* 10 */ | ||
/* 11 */ | ||
/***/ function(module, exports, __webpack_require__) { | ||
@@ -531,3 +532,3 @@ | ||
var _constants = __webpack_require__(11); | ||
var _constants = __webpack_require__(12); | ||
@@ -568,7 +569,2 @@ function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } } | ||
}, { | ||
key: 'numbers', | ||
get: function get() { | ||
return _constants.numbers; | ||
} | ||
}, { | ||
key: 'defaultAdapter', | ||
@@ -853,3 +849,3 @@ get: function get() { | ||
/***/ }, | ||
/* 11 */ | ||
/* 12 */ | ||
/***/ function(module, exports) { | ||
@@ -894,3 +890,3 @@ | ||
/***/ }, | ||
/* 12 */ | ||
/* 13 */ | ||
/***/ function(module, exports) { | ||
@@ -897,0 +893,0 @@ |
/*! | ||
Material Components for the web | ||
Copyright (c) 2016 Google Inc. | ||
Copyright (c) 2017 Google Inc. | ||
License: Apache-2.0 | ||
*/ | ||
!function(e,t){"object"==typeof exports&&"object"==typeof module?module.exports=t():"function"==typeof define&&define.amd?define([],t):"object"==typeof exports?exports.drawer=t():(e.mdc=e.mdc||{},e.mdc.drawer=t())}(this,function(){return function(e){function t(r){if(n[r])return n[r].exports;var a=n[r]={exports:{},id:r,loaded:!1};return e[r].call(a.exports,a,a.exports,t),a.loaded=!0,a.exports}var n={};return t.m=e,t.c=n,t.p="/assets/",t(0)}([function(e,t,n){e.exports=n(17)},function(e,t,n){"use strict";function r(e){return e&&e.__esModule?e:{default:e}}Object.defineProperty(t,"__esModule",{value:!0});var a=n(2);Object.defineProperty(t,"MDCFoundation",{enumerable:!0,get:function(){return r(a).default}});var i=n(3);Object.defineProperty(t,"MDCComponent",{enumerable:!0,get:function(){return r(i).default}})},function(e,t){"use strict";function n(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}Object.defineProperty(t,"__esModule",{value:!0});var r=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(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};n(this,e),this.adapter_=t}return r(e,null,[{key:"cssClasses",get:function(){return{}}},{key:"strings",get:function(){return{}}},{key:"numbers",get:function(){return{}}},{key:"defaultAdapter",get:function(){return{}}}]),r(e,[{key:"init",value:function(){}},{key:"destroy",value:function(){}}]),e}();t.default=a},function(e,t,n){"use strict";function r(e){return e&&e.__esModule?e:{default:e}}function a(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}Object.defineProperty(t,"__esModule",{value:!0});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=n(2),s=r(o),u=function(){function e(t,n){a(this,e),this.root_=t;for(var r=arguments.length,i=Array(r>2?r-2:0),o=2;o<r;o++)i[o-2]=arguments[o];this.initialize.apply(this,i),this.foundation_=void 0===n?this.getDefaultFoundation():n,this.foundation_.init(),this.initialSyncWithDOM()}return i(e,null,[{key:"attachTo",value:function(t){return new e(t,new s.default)}}]),i(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=void 0;"function"==typeof CustomEvent?n=new CustomEvent(e,{detail:t}):(n=document.createEvent("CustomEvent"),n.initCustomEvent(e,!1,!1,t)),this.root_.dispatchEvent(n)}}]),e}();t.default=u},,,,,,,,,,,,,,function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var r=n(20);Object.defineProperty(t,"MDCTemporaryDrawer",{enumerable:!0,get:function(){return r.MDCTemporaryDrawer}}),Object.defineProperty(t,"MDCTemporaryDrawerFoundation",{enumerable:!0,get:function(){return r.MDCTemporaryDrawerFoundation}})},function(e,t){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var n="mdc-temporary-drawer";t.cssClasses={ROOT:n,OPEN:n+"--open",ANIMATING:n+"--animating",RIGHT:n+"--right"},t.strings={DRAWER_SELECTOR:"."+n+"__drawer",OPACITY_VAR_NAME:"--"+n+"-opacity",FOCUSABLE_ELEMENTS:"a[href], area[href], input:not([disabled]), select:not([disabled]), textarea:not([disabled]), button:not([disabled]), iframe, object, embed, [tabindex], [contenteditable]"}},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 a(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 i(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)}Object.defineProperty(t,"__esModule",{value:!0});var o=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},s=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}}(),u=n(1),c=n(18),d=function(e){function t(e){r(this,t);var n=a(this,(t.__proto__||Object.getPrototypeOf(t)).call(this,o(t.defaultAdapter,e)));return n.transitionEndHandler_=function(e){n.adapter_.isDrawer(e.target)&&(n.adapter_.removeClass(t.cssClasses.ANIMATING),n.adapter_.deregisterTransitionEndHandler(n.transitionEndHandler_))},n.inert_=!1,n.componentClickHandler_=function(){return n.close()},n.drawerClickHandler_=function(e){return e.stopPropagation()},n.componentTouchStartHandler_=function(e){return n.handleTouchStart_(e)},n.componentTouchMoveHandler_=function(e){return n.handleTouchMove_(e)},n.componentTouchEndHandler_=function(e){return n.handleTouchEnd_(e)},n.documentKeydownHandler_=function(e){(e.key&&"Escape"===e.key||27===e.keyCode)&&n.close()},n}return i(t,e),s(t,null,[{key:"cssClasses",get:function(){return c.cssClasses}},{key:"strings",get:function(){return c.strings}},{key:"numbers",get:function(){return c.numbers}},{key:"defaultAdapter",get:function(){return{addClass:function(){},removeClass:function(){},hasClass:function(){},hasNecessaryDom:function(){return!1},registerInteractionHandler:function(){},deregisterInteractionHandler:function(){},registerDrawerInteractionHandler:function(){},deregisterDrawerInteractionHandler:function(){},registerTransitionEndHandler:function(){},deregisterTransitionEndHandler:function(){},registerDocumentKeydownHandler:function(){},deregisterDocumentKeydownHandler:function(){},setTranslateX:function(){},updateCssVariable:function(){},getFocusableElements:function(){},saveElementTabState:function(){},restoreElementTabState:function(){},makeElementUntabbable:function(){},isRtl:function(){return!1},getDrawerWidth:function(){return 0},isDrawer:function(){return!1}}}}]),s(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.detabinate_(),this.isOpen_=!1),this.adapter_.updateCssVariable(0),this.adapter_.registerInteractionHandler("click",this.componentClickHandler_),this.adapter_.registerDrawerInteractionHandler("click",this.drawerClickHandler_),this.adapter_.registerDrawerInteractionHandler("touchstart",this.componentTouchStartHandler_),this.adapter_.registerInteractionHandler("touchmove",this.componentTouchMoveHandler_),this.adapter_.registerInteractionHandler("touchend",this.componentTouchEndHandler_)}},{key:"destroy",value:function(){this.adapter_.deregisterInteractionHandler("click",this.componentClickHandler_),this.adapter_.deregisterDrawerInteractionHandler("click",this.drawerClickHandler_),this.adapter_.deregisterDrawerInteractionHandler("touchstart",this.componentTouchStartHandler_),this.adapter_.deregisterInteractionHandler("touchmove",this.componentTouchMoveHandler_),this.adapter_.deregisterInteractionHandler("touchend",this.componentTouchEndHandler_),this.adapter_.deregisterDocumentKeydownHandler(this.documentKeydownHandler_)}},{key:"open",value:function(){this.adapter_.updateCssVariable(""),this.adapter_.registerTransitionEndHandler(this.transitionEndHandler_),this.adapter_.registerDocumentKeydownHandler(this.documentKeydownHandler_),this.adapter_.addClass(t.cssClasses.ANIMATING),this.adapter_.addClass(t.cssClasses.OPEN),this.retabinate_(),this.isOpen_=!0}},{key:"close",value:function(){this.adapter_.updateCssVariable(""),this.adapter_.deregisterDocumentKeydownHandler(this.documentKeydownHandler_),this.adapter_.registerTransitionEndHandler(this.transitionEndHandler_),this.adapter_.addClass(t.cssClasses.ANIMATING),this.adapter_.removeClass(t.cssClasses.OPEN),this.detabinate_(),this.isOpen_=!1}},{key:"isOpen",value:function(){return this.isOpen_}},{key:"detabinate_",value:function(){if(!this.inert_){var e=this.adapter_.getFocusableElements();if(e)for(var t=0;t<e.length;t++)this.adapter_.saveElementTabState(e[t]),this.adapter_.makeElementUntabbable(e[t]);this.inert_=!0}}},{key:"retabinate_",value:function(){if(this.inert_){var e=this.adapter_.getFocusableElements();if(e)for(var t=0;t<e.length;t++)this.adapter_.restoreElementTabState(e[t]);this.inert_=!1}}},{key:"handleTouchStart_",value:function(e){this.adapter_.hasClass(t.cssClasses.OPEN)&&(e.pointerType&&"touch"!==e.pointerType||(this.direction_=this.adapter_.isRtl()?-1:1,this.drawerWidth_=this.adapter_.getDrawerWidth(),this.startX_=e.touches?e.touches[0].pageX:e.pageX,this.currentX_=this.startX_,this.touchingSideNav_=!0,requestAnimationFrame(this.updateDrawer_.bind(this))))}},{key:"handleTouchMove_",value:function(e){e.pointerType&&"touch"!==e.pointerType||(this.currentX_=e.touches?e.touches[0].pageX:e.pageX)}},{key:"handleTouchEnd_",value:function(e){if(!e.pointerType||"touch"===e.pointerType){this.touchingSideNav_=!1,this.adapter_.setTranslateX(null),this.adapter_.updateCssVariable("");var t=null;t=1===this.direction_?Math.min(0,this.currentX_-this.startX_):Math.max(0,this.currentX_-this.startX_),Math.abs(t/this.drawerWidth_)>=.5?this.close():this.open()}}},{key:"updateDrawer_",value:function(){if(this.touchingSideNav_){requestAnimationFrame(this.updateDrawer_.bind(this));var e=null,t=null;e=1===this.direction_?Math.min(0,this.currentX_-this.startX_):Math.max(0,this.currentX_-this.startX_),t=Math.max(0,1+this.direction_*(e/this.drawerWidth_)),this.adapter_.setTranslateX(e),this.adapter_.updateCssVariable(t)}}}]),t}(u.MDCFoundation);t.default=d},function(e,t,n){"use strict";function r(e){if(e&&e.__esModule)return e;var t={};if(null!=e)for(var n in e)Object.prototype.hasOwnProperty.call(e,n)&&(t[n]=e[n]);return t.default=e,t}function a(e){return e&&e.__esModule?e:{default: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 s(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)}Object.defineProperty(t,"__esModule",{value:!0}),t.MDCTemporaryDrawer=t.MDCTemporaryDrawerFoundation=void 0;var u=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}}(),c=n(1),d=n(19),l=a(d),f=n(21),p=r(f);t.MDCTemporaryDrawerFoundation=l.default;t.MDCTemporaryDrawer=function(e){function t(){return i(this,t),o(this,(t.__proto__||Object.getPrototypeOf(t)).apply(this,arguments))}return s(t,e),u(t,[{key:"getDefaultFoundation",value:function(){var e=this,t=l.default.strings,n=t.FOCUSABLE_ELEMENTS,r=t.OPACITY_VAR_NAME;return new l.default({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.drawer)},registerInteractionHandler:function(t,n){return e.root_.addEventListener(p.remapEvent(t),n,p.applyPassive())},deregisterInteractionHandler:function(t,n){return e.root_.removeEventListener(p.remapEvent(t),n,p.applyPassive())},registerDrawerInteractionHandler:function(t,n){return e.drawer.addEventListener(p.remapEvent(t),n)},deregisterDrawerInteractionHandler:function(t,n){return e.drawer.removeEventListener(p.remapEvent(t),n)},registerTransitionEndHandler:function(t){return e.drawer.addEventListener("transitionend",t)},deregisterTransitionEndHandler:function(t){return e.drawer.removeEventListener("transitionend",t)},registerDocumentKeydownHandler:function(e){return document.addEventListener("keydown",e)},deregisterDocumentKeydownHandler:function(e){return document.removeEventListener("keydown",e)},getDrawerWidth:function(){return e.drawer.offsetWidth},setTranslateX:function(t){return e.drawer.style.setProperty(p.getTransformPropertyName(),null===t?null:"translateX("+t+"px)")},updateCssVariable:function(t){p.supportsCssCustomProperties()&&e.root_.style.setProperty(r,t)},getFocusableElements:function(){return e.drawer.querySelectorAll(n)},saveElementTabState:function(e){return p.saveElementTabState(e)},restoreElementTabState:function(e){return p.restoreElementTabState(e)},makeElementUntabbable:function(e){return e.setAttribute("tabindex",-1)},isRtl:function(){return"rtl"===getComputedStyle(e.root_).getPropertyValue("direction")},isDrawer:function(t){return t===e.drawer}})}},{key:"open",get:function(){return this.foundation_.isOpen()},set:function(e){e?this.foundation_.open():this.foundation_.close()}},{key:"drawer",get:function(){return this.root_.querySelector(l.default.strings.DRAWER_SELECTOR)}}],[{key:"attachTo",value:function(e){return new t(e)}}]),t}(c.MDCComponent)},function(e,t){"use strict";function n(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:window;if(!("ontouchstart"in t.document))switch(e){case"touchstart":return"pointerdown";case"touchmove":return"pointermove";case"touchend":return"pointerup";default:return e}return e}function r(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:window,t=arguments.length>1&&void 0!==arguments[1]&&arguments[1];if(void 0===d||t){var n=e.document.createElement("div"),r="transform"in n.style?"transform":"-webkit-transform";d=r}return d}function a(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:window;return"CSS"in e&&e.CSS.supports("(--color: red)")}function i(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:window,t=arguments.length>1&&void 0!==arguments[1]&&arguments[1];if(void 0===l||t){var n=!1;try{e.document.addEventListener("test",null,{get passive(){n=!0}})}catch(e){}l=n}return!!l&&{passive:!0}}function o(e){e.hasAttribute("tabindex")&&e.setAttribute(u,e.getAttribute("tabindex")),e.setAttribute(c,!0)}function s(e){e.hasAttribute(c)&&(e.hasAttribute(u)?(e.setAttribute("tabindex",e.getAttribute(u)),e.removeAttribute(u)):e.removeAttribute("tabindex"),e.removeAttribute(c))}Object.defineProperty(t,"__esModule",{value:!0}),t.remapEvent=n,t.getTransformPropertyName=r,t.supportsCssCustomProperties=a,t.applyPassive=i,t.saveElementTabState=o,t.restoreElementTabState=s;var u="data-mdc-tabindex",c="data-mdc-tabindex-handled",d=void 0,l=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.drawer=t():(e.mdc=e.mdc||{},e.mdc.drawer=t())}(this,function(){return function(e){function t(r){if(n[r])return n[r].exports;var a=n[r]={exports:{},id:r,loaded:!1};return e[r].call(a.exports,a,a.exports,t),a.loaded=!0,a.exports}var n={};return t.m=e,t.c=n,t.p="/assets/",t(0)}([function(e,t,n){e.exports=n(18)},function(e,t,n){"use strict";function r(e){return e&&e.__esModule?e:{default:e}}Object.defineProperty(t,"__esModule",{value:!0});var a=n(2);Object.defineProperty(t,"MDCFoundation",{enumerable:!0,get:function(){return r(a).default}});var i=n(3);Object.defineProperty(t,"MDCComponent",{enumerable:!0,get:function(){return r(i).default}})},function(e,t){"use strict";function n(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}Object.defineProperty(t,"__esModule",{value:!0});var r=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(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};n(this,e),this.adapter_=t}return r(e,null,[{key:"cssClasses",get:function(){return{}}},{key:"strings",get:function(){return{}}},{key:"numbers",get:function(){return{}}},{key:"defaultAdapter",get:function(){return{}}}]),r(e,[{key:"init",value:function(){}},{key:"destroy",value:function(){}}]),e}();t.default=a},function(e,t,n){"use strict";function r(e){return e&&e.__esModule?e:{default:e}}function a(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}Object.defineProperty(t,"__esModule",{value:!0});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=n(2),s=r(o),u=function(){function e(t,n){a(this,e),this.root_=t;for(var r=arguments.length,i=Array(r>2?r-2:0),o=2;o<r;o++)i[o-2]=arguments[o];this.initialize.apply(this,i),this.foundation_=void 0===n?this.getDefaultFoundation():n,this.foundation_.init(),this.initialSyncWithDOM()}return i(e,null,[{key:"attachTo",value:function(t){return new e(t,new s.default)}}]),i(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=void 0;"function"==typeof CustomEvent?n=new CustomEvent(e,{detail:t}):(n=document.createEvent("CustomEvent"),n.initCustomEvent(e,!1,!1,t)),this.root_.dispatchEvent(n)}}]),e}();t.default=u},,,,,,,,,,,,,,,function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var r=n(21);Object.defineProperty(t,"MDCTemporaryDrawer",{enumerable:!0,get:function(){return r.MDCTemporaryDrawer}}),Object.defineProperty(t,"MDCTemporaryDrawerFoundation",{enumerable:!0,get:function(){return r.MDCTemporaryDrawerFoundation}})},function(e,t){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var n="mdc-temporary-drawer";t.cssClasses={ROOT:n,OPEN:n+"--open",ANIMATING:n+"--animating",RIGHT:n+"--right"},t.strings={DRAWER_SELECTOR:"."+n+"__drawer",OPACITY_VAR_NAME:"--"+n+"-opacity",FOCUSABLE_ELEMENTS:"a[href], area[href], input:not([disabled]), select:not([disabled]), textarea:not([disabled]), button:not([disabled]), iframe, object, embed, [tabindex], [contenteditable]"}},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 a(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 i(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)}Object.defineProperty(t,"__esModule",{value:!0});var o=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},s=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}}(),u=n(1),c=n(19),d=function(e){function t(e){r(this,t);var n=a(this,(t.__proto__||Object.getPrototypeOf(t)).call(this,o(t.defaultAdapter,e)));return n.transitionEndHandler_=function(e){n.adapter_.isDrawer(e.target)&&(n.adapter_.removeClass(t.cssClasses.ANIMATING),n.adapter_.deregisterTransitionEndHandler(n.transitionEndHandler_))},n.inert_=!1,n.componentClickHandler_=function(){return n.close()},n.drawerClickHandler_=function(e){return e.stopPropagation()},n.componentTouchStartHandler_=function(e){return n.handleTouchStart_(e)},n.componentTouchMoveHandler_=function(e){return n.handleTouchMove_(e)},n.componentTouchEndHandler_=function(e){return n.handleTouchEnd_(e)},n.documentKeydownHandler_=function(e){(e.key&&"Escape"===e.key||27===e.keyCode)&&n.close()},n}return i(t,e),s(t,null,[{key:"cssClasses",get:function(){return c.cssClasses}},{key:"strings",get:function(){return c.strings}},{key:"defaultAdapter",get:function(){return{addClass:function(){},removeClass:function(){},hasClass:function(){},hasNecessaryDom:function(){return!1},registerInteractionHandler:function(){},deregisterInteractionHandler:function(){},registerDrawerInteractionHandler:function(){},deregisterDrawerInteractionHandler:function(){},registerTransitionEndHandler:function(){},deregisterTransitionEndHandler:function(){},registerDocumentKeydownHandler:function(){},deregisterDocumentKeydownHandler:function(){},setTranslateX:function(){},updateCssVariable:function(){},getFocusableElements:function(){},saveElementTabState:function(){},restoreElementTabState:function(){},makeElementUntabbable:function(){},isRtl:function(){return!1},getDrawerWidth:function(){return 0},isDrawer:function(){return!1}}}}]),s(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.detabinate_(),this.isOpen_=!1),this.adapter_.updateCssVariable(0),this.adapter_.registerInteractionHandler("click",this.componentClickHandler_),this.adapter_.registerDrawerInteractionHandler("click",this.drawerClickHandler_),this.adapter_.registerDrawerInteractionHandler("touchstart",this.componentTouchStartHandler_),this.adapter_.registerInteractionHandler("touchmove",this.componentTouchMoveHandler_),this.adapter_.registerInteractionHandler("touchend",this.componentTouchEndHandler_)}},{key:"destroy",value:function(){this.adapter_.deregisterInteractionHandler("click",this.componentClickHandler_),this.adapter_.deregisterDrawerInteractionHandler("click",this.drawerClickHandler_),this.adapter_.deregisterDrawerInteractionHandler("touchstart",this.componentTouchStartHandler_),this.adapter_.deregisterInteractionHandler("touchmove",this.componentTouchMoveHandler_),this.adapter_.deregisterInteractionHandler("touchend",this.componentTouchEndHandler_),this.adapter_.deregisterDocumentKeydownHandler(this.documentKeydownHandler_)}},{key:"open",value:function(){this.adapter_.updateCssVariable(""),this.adapter_.registerTransitionEndHandler(this.transitionEndHandler_),this.adapter_.registerDocumentKeydownHandler(this.documentKeydownHandler_),this.adapter_.addClass(t.cssClasses.ANIMATING),this.adapter_.addClass(t.cssClasses.OPEN),this.retabinate_(),this.isOpen_=!0}},{key:"close",value:function(){this.adapter_.updateCssVariable(""),this.adapter_.deregisterDocumentKeydownHandler(this.documentKeydownHandler_),this.adapter_.registerTransitionEndHandler(this.transitionEndHandler_),this.adapter_.addClass(t.cssClasses.ANIMATING),this.adapter_.removeClass(t.cssClasses.OPEN),this.detabinate_(),this.isOpen_=!1}},{key:"isOpen",value:function(){return this.isOpen_}},{key:"detabinate_",value:function(){if(!this.inert_){var e=this.adapter_.getFocusableElements();if(e)for(var t=0;t<e.length;t++)this.adapter_.saveElementTabState(e[t]),this.adapter_.makeElementUntabbable(e[t]);this.inert_=!0}}},{key:"retabinate_",value:function(){if(this.inert_){var e=this.adapter_.getFocusableElements();if(e)for(var t=0;t<e.length;t++)this.adapter_.restoreElementTabState(e[t]);this.inert_=!1}}},{key:"handleTouchStart_",value:function(e){this.adapter_.hasClass(t.cssClasses.OPEN)&&(e.pointerType&&"touch"!==e.pointerType||(this.direction_=this.adapter_.isRtl()?-1:1,this.drawerWidth_=this.adapter_.getDrawerWidth(),this.startX_=e.touches?e.touches[0].pageX:e.pageX,this.currentX_=this.startX_,this.touchingSideNav_=!0,requestAnimationFrame(this.updateDrawer_.bind(this))))}},{key:"handleTouchMove_",value:function(e){e.pointerType&&"touch"!==e.pointerType||(this.currentX_=e.touches?e.touches[0].pageX:e.pageX)}},{key:"handleTouchEnd_",value:function(e){if(!e.pointerType||"touch"===e.pointerType){this.touchingSideNav_=!1,this.adapter_.setTranslateX(null),this.adapter_.updateCssVariable("");var t=null;t=1===this.direction_?Math.min(0,this.currentX_-this.startX_):Math.max(0,this.currentX_-this.startX_),Math.abs(t/this.drawerWidth_)>=.5?this.close():this.open()}}},{key:"updateDrawer_",value:function(){if(this.touchingSideNav_){requestAnimationFrame(this.updateDrawer_.bind(this));var e=null,t=null;e=1===this.direction_?Math.min(0,this.currentX_-this.startX_):Math.max(0,this.currentX_-this.startX_),t=Math.max(0,1+this.direction_*(e/this.drawerWidth_)),this.adapter_.setTranslateX(e),this.adapter_.updateCssVariable(t)}}}]),t}(u.MDCFoundation);t.default=d},function(e,t,n){"use strict";function r(e){if(e&&e.__esModule)return e;var t={};if(null!=e)for(var n in e)Object.prototype.hasOwnProperty.call(e,n)&&(t[n]=e[n]);return t.default=e,t}function a(e){return e&&e.__esModule?e:{default: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 s(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)}Object.defineProperty(t,"__esModule",{value:!0}),t.MDCTemporaryDrawer=t.MDCTemporaryDrawerFoundation=void 0;var u=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}}(),c=n(1),d=n(20),l=a(d),f=n(22),p=r(f);t.MDCTemporaryDrawerFoundation=l.default;t.MDCTemporaryDrawer=function(e){function t(){return i(this,t),o(this,(t.__proto__||Object.getPrototypeOf(t)).apply(this,arguments))}return s(t,e),u(t,[{key:"getDefaultFoundation",value:function(){var e=this,t=l.default.strings,n=t.FOCUSABLE_ELEMENTS,r=t.OPACITY_VAR_NAME;return new l.default({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.drawer)},registerInteractionHandler:function(t,n){return e.root_.addEventListener(p.remapEvent(t),n,p.applyPassive())},deregisterInteractionHandler:function(t,n){return e.root_.removeEventListener(p.remapEvent(t),n,p.applyPassive())},registerDrawerInteractionHandler:function(t,n){return e.drawer.addEventListener(p.remapEvent(t),n)},deregisterDrawerInteractionHandler:function(t,n){return e.drawer.removeEventListener(p.remapEvent(t),n)},registerTransitionEndHandler:function(t){return e.drawer.addEventListener("transitionend",t)},deregisterTransitionEndHandler:function(t){return e.drawer.removeEventListener("transitionend",t)},registerDocumentKeydownHandler:function(e){return document.addEventListener("keydown",e)},deregisterDocumentKeydownHandler:function(e){return document.removeEventListener("keydown",e)},getDrawerWidth:function(){return e.drawer.offsetWidth},setTranslateX:function(t){return e.drawer.style.setProperty(p.getTransformPropertyName(),null===t?null:"translateX("+t+"px)")},updateCssVariable:function(t){p.supportsCssCustomProperties()&&e.root_.style.setProperty(r,t)},getFocusableElements:function(){return e.drawer.querySelectorAll(n)},saveElementTabState:function(e){return p.saveElementTabState(e)},restoreElementTabState:function(e){return p.restoreElementTabState(e)},makeElementUntabbable:function(e){return e.setAttribute("tabindex",-1)},isRtl:function(){return"rtl"===getComputedStyle(e.root_).getPropertyValue("direction")},isDrawer:function(t){return t===e.drawer}})}},{key:"open",get:function(){return this.foundation_.isOpen()},set:function(e){e?this.foundation_.open():this.foundation_.close()}},{key:"drawer",get:function(){return this.root_.querySelector(l.default.strings.DRAWER_SELECTOR)}}],[{key:"attachTo",value:function(e){return new t(e)}}]),t}(c.MDCComponent)},function(e,t){"use strict";function n(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:window;if(!("ontouchstart"in t.document))switch(e){case"touchstart":return"pointerdown";case"touchmove":return"pointermove";case"touchend":return"pointerup";default:return e}return e}function r(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:window,t=arguments.length>1&&void 0!==arguments[1]&&arguments[1];if(void 0===d||t){var n=e.document.createElement("div"),r="transform"in n.style?"transform":"-webkit-transform";d=r}return d}function a(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:window;return"CSS"in e&&e.CSS.supports("(--color: red)")}function i(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:window,t=arguments.length>1&&void 0!==arguments[1]&&arguments[1];if(void 0===l||t){var n=!1;try{e.document.addEventListener("test",null,{get passive(){n=!0}})}catch(e){}l=n}return!!l&&{passive:!0}}function o(e){e.hasAttribute("tabindex")&&e.setAttribute(u,e.getAttribute("tabindex")),e.setAttribute(c,!0)}function s(e){e.hasAttribute(c)&&(e.hasAttribute(u)?(e.setAttribute("tabindex",e.getAttribute(u)),e.removeAttribute(u)):e.removeAttribute("tabindex"),e.removeAttribute(c))}Object.defineProperty(t,"__esModule",{value:!0}),t.remapEvent=n,t.getTransformPropertyName=r,t.supportsCssCustomProperties=a,t.applyPassive=i,t.saveElementTabState=o,t.restoreElementTabState=s;var u="data-mdc-tabindex",c="data-mdc-tabindex-handled",d=void 0,l=void 0}])}); |
{ | ||
"name": "@material/drawer", | ||
"version": "0.1.0", | ||
"version": "0.1.1", | ||
"description": "The Material Components Web drawer component", | ||
@@ -12,5 +12,5 @@ "license": "Apache-2.0", | ||
"dependencies": { | ||
"@material/animation": "^0.1.0", | ||
"@material/animation": "^0.1.1", | ||
"@material/base": "^0.1.0", | ||
"@material/elevation": "^0.1.0", | ||
"@material/elevation": "^0.1.1", | ||
"@material/rtl": "^0.1.0", | ||
@@ -17,0 +17,0 @@ "@material/theme": "^0.1.0", |
@@ -18,3 +18,3 @@ /** | ||
import {MDCFoundation} from '@material/base'; | ||
import {cssClasses, strings, numbers} from './constants'; | ||
import {cssClasses, strings} from './constants'; | ||
@@ -30,6 +30,2 @@ export default class MDCTemporaryDrawerFoundation extends MDCFoundation { | ||
static get numbers() { | ||
return numbers; | ||
} | ||
static get defaultAdapter() { | ||
@@ -36,0 +32,0 @@ return { |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
181632
2884
Updated@material/animation@^0.1.1
Updated@material/elevation@^0.1.1