@material/menu-surface
Advanced tools
Comparing version 4.0.0-canary.79d881baf.0 to 4.0.0-canary.97cbbdc2.0
139
CHANGELOG.md
@@ -6,140 +6,7 @@ # Change Log | ||
# [4.0.0-canary.79d881baf.0](https://github.com/material-components/material-components-web/compare/v3.2.0...v4.0.0-canary.79d881baf.0) (2019-09-13) | ||
# 4.0.0-canary.97cbbdc2.0 (2019-11-01) | ||
**Note:** Version bump only for package @material/menu-surface | ||
### Bug Fixes | ||
# [4.0.0-canary.79d881baf.0](https://github.com/material-components/material-components-web/compare/v3.2.0...v4.0.0-canary.79d881baf.0) (2019-09-13) | ||
**Note:** Version bump only for package @material/menu-surface | ||
# [4.0.0-canary.79d881baf.0](https://github.com/material-components/material-components-web/compare/v3.2.0...v4.0.0-canary.79d881baf.0) (2019-09-13) | ||
**Note:** Version bump only for package @material/menu-surface | ||
# [4.0.0-canary.eab7903af.0](https://github.com/material-components/material-components-web/compare/v3.2.0...v4.0.0-canary.eab7903af.0) (2019-09-13) | ||
**Note:** Version bump only for package @material/menu-surface | ||
# [4.0.0-canary.eab7903af.0](https://github.com/material-components/material-components-web/compare/v3.2.0...v4.0.0-canary.eab7903af.0) (2019-09-13) | ||
**Note:** Version bump only for package @material/menu-surface | ||
# [3.2.0](https://github.com/material-components/material-components-web/compare/v3.1.1...v3.2.0) (2019-09-12) | ||
**Note:** Version bump only for package @material/menu-surface | ||
# [4.0.0-edc72a4d7.0](https://github.com/material-components/material-components-web/compare/v3.1.1...v4.0.0-edc72a4d7.0) (2019-09-09) | ||
**Note:** Version bump only for package @material/menu-surface | ||
# [4.0.0-canary.1](https://github.com/material-components/material-components-web/compare/v3.1.1...v4.0.0-canary.1) (2019-09-09) | ||
**Note:** Version bump only for package @material/menu-surface | ||
# [4.0.0-canary.1](https://github.com/material-components/material-components-web/compare/v3.1.1...v4.0.0-canary.1) (2019-09-09) | ||
**Note:** Version bump only for package @material/menu-surface | ||
# [4.0.0-canary.0](https://github.com/material-components/material-components-web/compare/v3.1.1...v4.0.0-canary.0) (2019-09-05) | ||
**Note:** Version bump only for package @material/menu-surface | ||
# [4.0.0-canary.0](https://github.com/material-components/material-components-web/compare/v3.1.1...v4.0.0-canary.0) (2019-09-05) | ||
**Note:** Version bump only for package @material/menu-surface | ||
# [4.0.0-canary.0](https://github.com/material-components/material-components-web/compare/v3.1.1...v4.0.0-canary.0) (2019-09-05) | ||
**Note:** Version bump only for package @material/menu-surface | ||
# [4.0.0-a9e694931.0](https://github.com/material-components/material-components-web/compare/v3.1.1...v4.0.0-a9e694931.0) (2019-09-05) | ||
**Note:** Version bump only for package @material/menu-surface | ||
# [4.0.0-snapshot.0](https://github.com/material-components/material-components-web/compare/v3.1.1...v4.0.0-snapshot.0) (2019-09-05) | ||
**Note:** Version bump only for package @material/menu-surface | ||
# [4.0.0-alpha.0](https://github.com/material-components/material-components-web/compare/v3.1.0...v4.0.0-alpha.0) (2019-08-07) | ||
**Note:** Version bump only for package @material/menu-surface | ||
# [3.1.0](https://github.com/material-components/material-components-web/compare/v3.0.0...v3.1.0) (2019-07-22) | ||
**Note:** Version bump only for package @material/menu-surface | ||
# [3.1.0-alpha.0](https://github.com/material-components/material-components-web/compare/v3.0.0...v3.1.0-alpha.0) (2019-07-16) | ||
**Note:** Version bump only for package @material/menu-surface | ||
# [3.1.0](https://github.com/material-components/material-components-web/compare/v3.0.0...v3.1.0) (2019-07-16) | ||
**Note:** Version bump only for package @material/menu-surface | ||
* **fab:** Add overflow: hidden; to ripple target to fix bounded ripple. ([#5214](https://github.com/material-components/material-components-web/issues/5214)) ([97cbbdc](https://github.com/material-components/material-components-web/commit/97cbbdc)) |
@@ -43,7 +43,2 @@ /** | ||
quickOpen: boolean; | ||
/** | ||
* Removes the menu-surface from it's current location and appends it to the | ||
* body to overcome any overflow:hidden issues. | ||
*/ | ||
hoistMenuToBody(): void; | ||
/** Sets the foundation to use page offsets for an positioning when the menu is hoisted to the body. */ | ||
@@ -50,0 +45,0 @@ setIsHoisted(isHoisted: boolean): void; |
@@ -74,10 +74,2 @@ /** | ||
}); | ||
/** | ||
* Removes the menu-surface from it's current location and appends it to the | ||
* body to overcome any overflow:hidden issues. | ||
*/ | ||
MDCMenuSurface.prototype.hoistMenuToBody = function () { | ||
document.body.appendChild(this.root_); | ||
this.setIsHoisted(true); | ||
}; | ||
/** Sets the foundation to use page offsets for an positioning when the menu is hoisted to the body. */ | ||
@@ -84,0 +76,0 @@ MDCMenuSurface.prototype.setIsHoisted = function (isHoisted) { |
@@ -30,3 +30,2 @@ // Generated by dts-bundle v0.7.3 | ||
import * as util from '@material/menu-surface/util'; | ||
export { Corner, CornerBit } from '@material/menu-surface/constants'; | ||
export { util }; | ||
@@ -71,77 +70,2 @@ export * from '@material/menu-surface/adapter'; | ||
declare module '@material/menu-surface/constants' { | ||
/** | ||
* @license | ||
* Copyright 2018 Google Inc. | ||
* | ||
* Permission is hereby granted, free of charge, to any person obtaining a copy | ||
* of this software and associated documentation files (the "Software"), to deal | ||
* in the Software without restriction, including without limitation the rights | ||
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell | ||
* copies of the Software, and to permit persons to whom the Software is | ||
* furnished to do so, subject to the following conditions: | ||
* | ||
* The above copyright notice and this permission notice shall be included in | ||
* all copies or substantial portions of the Software. | ||
* | ||
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR | ||
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, | ||
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE | ||
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER | ||
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, | ||
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN | ||
* THE SOFTWARE. | ||
*/ | ||
const cssClasses: { | ||
ANCHOR: string; | ||
ANIMATING_CLOSED: string; | ||
ANIMATING_OPEN: string; | ||
FIXED: string; | ||
OPEN: string; | ||
ROOT: string; | ||
}; | ||
const strings: { | ||
CLOSED_EVENT: string; | ||
OPENED_EVENT: string; | ||
FOCUSABLE_ELEMENTS: string; | ||
}; | ||
const numbers: { | ||
/** Total duration of menu-surface open animation. */ | ||
TRANSITION_OPEN_DURATION: number; | ||
/** Total duration of menu-surface close animation. */ | ||
TRANSITION_CLOSE_DURATION: number; | ||
/** Margin left to the edge of the viewport when menu-surface is at maximum possible height. */ | ||
MARGIN_TO_EDGE: number; | ||
/** Ratio of anchor width to menu-surface width for switching from corner positioning to center positioning. */ | ||
ANCHOR_TO_MENU_SURFACE_WIDTH_RATIO: number; | ||
}; | ||
/** | ||
* Enum for bits in the {@see Corner) bitmap. | ||
*/ | ||
enum CornerBit { | ||
BOTTOM = 1, | ||
CENTER = 2, | ||
RIGHT = 4, | ||
FLIP_RTL = 8 | ||
} | ||
/** | ||
* Enum for representing an element corner for positioning the menu-surface. | ||
* | ||
* The START constants map to LEFT if element directionality is left | ||
* to right and RIGHT if the directionality is right to left. | ||
* Likewise END maps to RIGHT or LEFT depending on the directionality. | ||
*/ | ||
enum Corner { | ||
TOP_LEFT = 0, | ||
TOP_RIGHT = 4, | ||
BOTTOM_LEFT = 1, | ||
BOTTOM_RIGHT = 5, | ||
TOP_START = 8, | ||
TOP_END = 12, | ||
BOTTOM_START = 9, | ||
BOTTOM_END = 13 | ||
} | ||
export { cssClasses, strings, numbers, CornerBit, Corner }; | ||
} | ||
declare module '@material/menu-surface/adapter' { | ||
@@ -243,7 +167,2 @@ /** | ||
quickOpen: boolean; | ||
/** | ||
* Removes the menu-surface from it's current location and appends it to the | ||
* body to overcome any overflow:hidden issues. | ||
*/ | ||
hoistMenuToBody(): void; | ||
/** Sets the foundation to use page offsets for an positioning when the menu is hoisted to the body. */ | ||
@@ -266,2 +185,77 @@ setIsHoisted(isHoisted: boolean): void; | ||
declare module '@material/menu-surface/constants' { | ||
/** | ||
* @license | ||
* Copyright 2018 Google Inc. | ||
* | ||
* Permission is hereby granted, free of charge, to any person obtaining a copy | ||
* of this software and associated documentation files (the "Software"), to deal | ||
* in the Software without restriction, including without limitation the rights | ||
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell | ||
* copies of the Software, and to permit persons to whom the Software is | ||
* furnished to do so, subject to the following conditions: | ||
* | ||
* The above copyright notice and this permission notice shall be included in | ||
* all copies or substantial portions of the Software. | ||
* | ||
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR | ||
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, | ||
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE | ||
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER | ||
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, | ||
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN | ||
* THE SOFTWARE. | ||
*/ | ||
const cssClasses: { | ||
ANCHOR: string; | ||
ANIMATING_CLOSED: string; | ||
ANIMATING_OPEN: string; | ||
FIXED: string; | ||
OPEN: string; | ||
ROOT: string; | ||
}; | ||
const strings: { | ||
CLOSED_EVENT: string; | ||
OPENED_EVENT: string; | ||
FOCUSABLE_ELEMENTS: string; | ||
}; | ||
const numbers: { | ||
/** Total duration of menu-surface open animation. */ | ||
TRANSITION_OPEN_DURATION: number; | ||
/** Total duration of menu-surface close animation. */ | ||
TRANSITION_CLOSE_DURATION: number; | ||
/** Margin left to the edge of the viewport when menu-surface is at maximum possible height. */ | ||
MARGIN_TO_EDGE: number; | ||
/** Ratio of anchor width to menu-surface width for switching from corner positioning to center positioning. */ | ||
ANCHOR_TO_MENU_SURFACE_WIDTH_RATIO: number; | ||
}; | ||
/** | ||
* Enum for bits in the {@see Corner) bitmap. | ||
*/ | ||
enum CornerBit { | ||
BOTTOM = 1, | ||
CENTER = 2, | ||
RIGHT = 4, | ||
FLIP_RTL = 8 | ||
} | ||
/** | ||
* Enum for representing an element corner for positioning the menu-surface. | ||
* | ||
* The START constants map to LEFT if element directionality is left | ||
* to right and RIGHT if the directionality is right to left. | ||
* Likewise END maps to RIGHT or LEFT depending on the directionality. | ||
*/ | ||
enum Corner { | ||
TOP_LEFT = 0, | ||
TOP_RIGHT = 4, | ||
BOTTOM_LEFT = 1, | ||
BOTTOM_RIGHT = 5, | ||
TOP_START = 8, | ||
TOP_END = 12, | ||
BOTTOM_START = 9, | ||
BOTTOM_END = 13 | ||
} | ||
export { cssClasses, strings, numbers, CornerBit, Corner }; | ||
} | ||
declare module '@material/menu-surface/foundation' { | ||
@@ -377,2 +371,3 @@ /** | ||
*/ | ||
export type AnyDuringTs36Migration = any; | ||
export interface MDCMenuDimensions { | ||
@@ -379,0 +374,0 @@ width: number; |
@@ -458,10 +458,2 @@ /** | ||
}); | ||
/** | ||
* Removes the menu-surface from it's current location and appends it to the | ||
* body to overcome any overflow:hidden issues. | ||
*/ | ||
MDCMenuSurface.prototype.hoistMenuToBody = function () { | ||
document.body.appendChild(this.root_); | ||
this.setIsHoisted(true); | ||
}; | ||
/** Sets the foundation to use page offsets for an positioning when the menu is hoisted to the body. */ | ||
@@ -1258,5 +1250,2 @@ MDCMenuSurface.prototype.setIsHoisted = function (isHoisted) { | ||
exports.util = util; | ||
var constants_1 = __webpack_require__(/*! ./constants */ "./packages/mdc-menu-surface/constants.ts"); | ||
exports.Corner = constants_1.Corner; | ||
exports.CornerBit = constants_1.CornerBit; | ||
__export(__webpack_require__(/*! ./component */ "./packages/mdc-menu-surface/component.ts")); | ||
@@ -1263,0 +1252,0 @@ __export(__webpack_require__(/*! ./constants */ "./packages/mdc-menu-surface/constants.ts")); |
@@ -1,1 +0,1 @@ | ||
!function(t,e){"object"==typeof exports&&"object"==typeof module?module.exports=e():"function"==typeof define&&define.amd?define([],e):"object"==typeof exports?exports.menuSurface=e():(t.mdc=t.mdc||{},t.mdc.menuSurface=e())}(this,function(){return i={},o.m=n={0:function(t,e,n){"use strict";Object.defineProperty(e,"__esModule",{value:!0});var i=(Object.defineProperty(o,"cssClasses",{get:function(){return{}},enumerable:!0,configurable:!0}),Object.defineProperty(o,"strings",{get:function(){return{}},enumerable:!0,configurable:!0}),Object.defineProperty(o,"numbers",{get:function(){return{}},enumerable:!0,configurable:!0}),Object.defineProperty(o,"defaultAdapter",{get:function(){return{}},enumerable:!0,configurable:!0}),o.prototype.init=function(){},o.prototype.destroy=function(){},o);function o(t){void 0===t&&(t={}),this.adapter_=t}e.MDCFoundation=i,e.default=i},1:function(t,e,n){"use strict";var i=this&&this.__read||function(t,e){var n="function"==typeof Symbol&&t[Symbol.iterator];if(!n)return t;var i,o,r=n.call(t),s=[];try{for(;(void 0===e||0<e--)&&!(i=r.next()).done;)s.push(i.value)}catch(t){o={error:t}}finally{try{i&&!i.done&&(n=r.return)&&n.call(r)}finally{if(o)throw o.error}}return s},o=this&&this.__spread||function(){for(var t=[],e=0;e<arguments.length;e++)t=t.concat(i(arguments[e]));return t};Object.defineProperty(e,"__esModule",{value:!0});var r=n(0),s=(a.attachTo=function(t){return new a(t,new r.MDCFoundation({}))},a.prototype.initialize=function(){for(var t=[],e=0;e<arguments.length;e++)t[e]=arguments[e]},a.prototype.getDefaultFoundation=function(){throw new Error("Subclasses must override getDefaultFoundation to return a properly configured foundation class")},a.prototype.initialSyncWithDOM=function(){},a.prototype.destroy=function(){this.foundation_.destroy()},a.prototype.listen=function(t,e,n){this.root_.addEventListener(t,e,n)},a.prototype.unlisten=function(t,e,n){this.root_.removeEventListener(t,e,n)},a.prototype.emit=function(t,e,n){var i;void 0===n&&(n=!1),"function"==typeof CustomEvent?i=new CustomEvent(t,{bubbles:n,detail:e}):(i=document.createEvent("CustomEvent")).initCustomEvent(t,n,!1,e),this.root_.dispatchEvent(i)},a);function a(t,e){for(var n=[],i=2;i<arguments.length;i++)n[i-2]=arguments[i];this.root_=t,this.initialize.apply(this,o(n)),this.foundation_=void 0===e?this.getDefaultFoundation():e,this.foundation_.init(),this.initialSyncWithDOM()}e.MDCComponent=s,e.default=s},138:function(t,n,e){"use strict";function i(t){for(var e in t)n.hasOwnProperty(e)||(n[e]=t[e])}var o=this&&this.__importStar||function(t){if(t&&t.__esModule)return t;var e={};if(null!=t)for(var n in t)Object.hasOwnProperty.call(t,n)&&(e[n]=t[n]);return e.default=t,e};Object.defineProperty(n,"__esModule",{value:!0});var r=o(e(22));n.util=r;var s=e(9);n.Corner=s.Corner,n.CornerBit=s.CornerBit,i(e(31)),i(e(9)),i(e(14))},14:function(t,e,n){"use strict";var i,o=this&&this.__extends||(i=function(t,e){return(i=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var n in e)e.hasOwnProperty(n)&&(t[n]=e[n])})(t,e)},function(t,e){function n(){this.constructor=t}i(t,e),t.prototype=null===e?Object.create(e):(n.prototype=e.prototype,new n)}),r=this&&this.__assign||function(){return(r=Object.assign||function(t){for(var e,n=1,i=arguments.length;n<i;n++)for(var o in e=arguments[n])Object.prototype.hasOwnProperty.call(e,o)&&(t[o]=e[o]);return t}).apply(this,arguments)},f=this&&this.__values||function(t){var e="function"==typeof Symbol&&t[Symbol.iterator],n=0;return e?e.call(t):{next:function(){return t&&n>=t.length&&(t=void 0),{value:t&&t[n++],done:!t}}}};Object.defineProperty(e,"__esModule",{value:!0});var s,a=n(0),O=n(9),u=(s=a.MDCFoundation,o(c,s),Object.defineProperty(c,"cssClasses",{get:function(){return O.cssClasses},enumerable:!0,configurable:!0}),Object.defineProperty(c,"strings",{get:function(){return O.strings},enumerable:!0,configurable:!0}),Object.defineProperty(c,"numbers",{get:function(){return O.numbers},enumerable:!0,configurable:!0}),Object.defineProperty(c,"Corner",{get:function(){return O.Corner},enumerable:!0,configurable:!0}),Object.defineProperty(c,"defaultAdapter",{get:function(){return{addClass:function(){},removeClass:function(){},hasClass:function(){return!1},hasAnchor:function(){return!1},isElementInContainer:function(){return!1},isFocused:function(){return!1},isRtl:function(){return!1},getInnerDimensions:function(){return{height:0,width:0}},getAnchorDimensions:function(){return null},getWindowDimensions:function(){return{height:0,width:0}},getBodyDimensions:function(){return{height:0,width:0}},getWindowScroll:function(){return{x:0,y:0}},setPosition:function(){},setMaxHeight:function(){},setTransformOrigin:function(){},saveFocus:function(){},restoreFocus:function(){},notifyClose:function(){},notifyOpen:function(){}}},enumerable:!0,configurable:!0}),c.prototype.init=function(){var t=c.cssClasses,e=t.ROOT,n=t.OPEN;if(!this.adapter_.hasClass(e))throw new Error(e+" class required in root element.");this.adapter_.hasClass(n)&&(this.isOpen_=!0)},c.prototype.destroy=function(){clearTimeout(this.openAnimationEndTimerId_),clearTimeout(this.closeAnimationEndTimerId_),cancelAnimationFrame(this.animationRequestId_)},c.prototype.setAnchorCorner=function(t){this.anchorCorner_=t},c.prototype.setAnchorMargin=function(t){this.anchorMargin_.top=t.top||0,this.anchorMargin_.right=t.right||0,this.anchorMargin_.bottom=t.bottom||0,this.anchorMargin_.left=t.left||0},c.prototype.setIsHoisted=function(t){this.isHoistedElement_=t},c.prototype.setFixedPosition=function(t){this.isFixedPosition_=t},c.prototype.setAbsolutePosition=function(t,e){this.position_.x=this.isFinite_(t)?t:0,this.position_.y=this.isFinite_(e)?e:0},c.prototype.setQuickOpen=function(t){this.isQuickOpen_=t},c.prototype.isOpen=function(){return this.isOpen_},c.prototype.open=function(){var t=this;this.adapter_.saveFocus(),this.isQuickOpen_||this.adapter_.addClass(c.cssClasses.ANIMATING_OPEN),this.animationRequestId_=requestAnimationFrame(function(){t.adapter_.addClass(c.cssClasses.OPEN),t.dimensions_=t.adapter_.getInnerDimensions(),t.autoPosition_(),t.isQuickOpen_?t.adapter_.notifyOpen():t.openAnimationEndTimerId_=setTimeout(function(){t.openAnimationEndTimerId_=0,t.adapter_.removeClass(c.cssClasses.ANIMATING_OPEN),t.adapter_.notifyOpen()},O.numbers.TRANSITION_OPEN_DURATION)}),this.isOpen_=!0},c.prototype.close=function(t){var e=this;void 0===t&&(t=!1),this.isQuickOpen_||this.adapter_.addClass(c.cssClasses.ANIMATING_CLOSED),requestAnimationFrame(function(){e.adapter_.removeClass(c.cssClasses.OPEN),e.isQuickOpen_?e.adapter_.notifyClose():e.closeAnimationEndTimerId_=setTimeout(function(){e.closeAnimationEndTimerId_=0,e.adapter_.removeClass(c.cssClasses.ANIMATING_CLOSED),e.adapter_.notifyClose()},O.numbers.TRANSITION_CLOSE_DURATION)}),this.isOpen_=!1,t||this.maybeRestoreFocus_()},c.prototype.handleBodyClick=function(t){var e=t.target;this.adapter_.isElementInContainer(e)||this.close()},c.prototype.handleKeydown=function(t){var e=t.keyCode;"Escape"!==t.key&&27!==e||this.close()},c.prototype.autoPosition_=function(){var t;this.measurements_=this.getAutoLayoutMeasurements_();var e=this.getOriginCorner_(),n=this.getMenuSurfaceMaxHeight_(e),i=this.hasBit_(e,O.CornerBit.BOTTOM)?"bottom":"top",o=this.hasBit_(e,O.CornerBit.RIGHT)?"right":"left",r=this.getHorizontalOriginOffset_(e),s=this.getVerticalOriginOffset_(e),a=this.measurements_,u=a.anchorSize,c=a.surfaceSize,h=((t={})[o]=r,t[i]=s,t);u.width/c.width>O.numbers.ANCHOR_TO_MENU_SURFACE_WIDTH_RATIO&&(o="center"),(this.isHoistedElement_||this.isFixedPosition_)&&this.adjustPositionForHoistedElement_(h),this.adapter_.setTransformOrigin(o+" "+i),this.adapter_.setPosition(h),this.adapter_.setMaxHeight(n?n+"px":"")},c.prototype.getAutoLayoutMeasurements_=function(){var t=this.adapter_.getAnchorDimensions(),e=this.adapter_.getBodyDimensions(),n=this.adapter_.getWindowDimensions(),i=this.adapter_.getWindowScroll();return{anchorSize:t=t||{top:this.position_.y,right:this.position_.x,bottom:this.position_.y,left:this.position_.x,width:0,height:0},bodySize:e,surfaceSize:this.dimensions_,viewportDistance:{top:t.top,right:n.width-t.right,bottom:n.height-t.bottom,left:t.left},viewportSize:n,windowScroll:i}},c.prototype.getOriginCorner_=function(){var t=O.Corner.TOP_LEFT,e=this.measurements_,n=e.viewportDistance,i=e.anchorSize,o=e.surfaceSize,r=this.hasBit_(this.anchorCorner_,O.CornerBit.BOTTOM),s=r?n.top+i.height+this.anchorMargin_.bottom:n.top+this.anchorMargin_.top,a=r?n.bottom-this.anchorMargin_.bottom:n.bottom+i.height-this.anchorMargin_.top,u=o.height-s,c=o.height-a;0<c&&u<c&&(t=this.setBit_(t,O.CornerBit.BOTTOM));var h=this.adapter_.isRtl(),f=this.hasBit_(this.anchorCorner_,O.CornerBit.FLIP_RTL),d=this.hasBit_(this.anchorCorner_,O.CornerBit.RIGHT),l=d&&!h||!d&&f&&h,_=l?n.left+i.width+this.anchorMargin_.right:n.left+this.anchorMargin_.left,p=l?n.right-this.anchorMargin_.right:n.right+i.width-this.anchorMargin_.left,m=o.width-_,y=o.width-p;return(m<0&&l&&h||d&&!l&&m<0||0<y&&m<y)&&(t=this.setBit_(t,O.CornerBit.RIGHT)),t},c.prototype.getMenuSurfaceMaxHeight_=function(t){var e=this.measurements_.viewportDistance,n=0,i=this.hasBit_(t,O.CornerBit.BOTTOM),o=this.hasBit_(this.anchorCorner_,O.CornerBit.BOTTOM),r=c.numbers.MARGIN_TO_EDGE;return i?(n=e.top+this.anchorMargin_.top-r,o||(n+=this.measurements_.anchorSize.height)):(n=e.bottom-this.anchorMargin_.bottom+this.measurements_.anchorSize.height-r,o&&(n-=this.measurements_.anchorSize.height)),n},c.prototype.getHorizontalOriginOffset_=function(t){var e=this.measurements_.anchorSize,n=this.hasBit_(t,O.CornerBit.RIGHT),i=this.hasBit_(this.anchorCorner_,O.CornerBit.RIGHT);if(n){var o=i?e.width-this.anchorMargin_.left:this.anchorMargin_.right;return this.isHoistedElement_||this.isFixedPosition_?o-(this.measurements_.viewportSize.width-this.measurements_.bodySize.width):o}return i?e.width-this.anchorMargin_.right:this.anchorMargin_.left},c.prototype.getVerticalOriginOffset_=function(t){var e=this.measurements_.anchorSize,n=this.hasBit_(t,O.CornerBit.BOTTOM),i=this.hasBit_(this.anchorCorner_,O.CornerBit.BOTTOM);return n?i?e.height-this.anchorMargin_.top:-this.anchorMargin_.bottom:i?e.height+this.anchorMargin_.bottom:this.anchorMargin_.top},c.prototype.adjustPositionForHoistedElement_=function(t){var e,n,i=this.measurements_,o=i.windowScroll,r=i.viewportDistance,s=Object.keys(t);try{for(var a=f(s),u=a.next();!u.done;u=a.next()){var c=u.value,h=t[c]||0;h+=r[c],this.isFixedPosition_||("top"===c?h+=o.y:"bottom"===c?h-=o.y:"left"===c?h+=o.x:h-=o.x),t[c]=h}}catch(t){e={error:t}}finally{try{u&&!u.done&&(n=a.return)&&n.call(a)}finally{if(e)throw e.error}}},c.prototype.maybeRestoreFocus_=function(){var t=this.adapter_.isFocused(),e=document.activeElement&&this.adapter_.isElementInContainer(document.activeElement);(t||e)&&this.adapter_.restoreFocus()},c.prototype.hasBit_=function(t,e){return Boolean(t&e)},c.prototype.setBit_=function(t,e){return t|e},c.prototype.isFinite_=function(t){return"number"==typeof t&&isFinite(t)},c);function c(t){var e=s.call(this,r({},c.defaultAdapter,t))||this;return e.isOpen_=!1,e.isQuickOpen_=!1,e.isHoistedElement_=!1,e.isFixedPosition_=!1,e.openAnimationEndTimerId_=0,e.closeAnimationEndTimerId_=0,e.animationRequestId_=0,e.anchorCorner_=O.Corner.TOP_START,e.anchorMargin_={top:0,right:0,bottom:0,left:0},e.position_={x:0,y:0},e}e.MDCMenuSurfaceFoundation=u,e.default=u},22:function(t,e,n){"use strict";var i;Object.defineProperty(e,"__esModule",{value:!0}),e.getTransformPropertyName=function(t,e){if(void 0===e&&(e=!1),void 0===i||e){var n=t.document.createElement("div");i="transform"in n.style?"transform":"webkitTransform"}return i}},31:function(t,e,n){"use strict";var i,o=this&&this.__extends||(i=function(t,e){return(i=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var n in e)e.hasOwnProperty(n)&&(t[n]=e[n])})(t,e)},function(t,e){function n(){this.constructor=t}i(t,e),t.prototype=null===e?Object.create(e):(n.prototype=e.prototype,new n)}),r=this&&this.__importStar||function(t){if(t&&t.__esModule)return t;var e={};if(null!=t)for(var n in t)Object.hasOwnProperty.call(t,n)&&(e[n]=t[n]);return e.default=t,e};Object.defineProperty(e,"__esModule",{value:!0});var s,a=n(1),u=n(9),c=n(14),h=r(n(22)),f=(s=a.MDCComponent,o(d,s),d.attachTo=function(t){return new d(t)},d.prototype.initialSyncWithDOM=function(){var e=this,t=this.root_.parentElement;this.anchorElement=t&&t.classList.contains(u.cssClasses.ANCHOR)?t:null,this.root_.classList.contains(u.cssClasses.FIXED)&&this.setFixedPosition(!0),this.handleKeydown_=function(t){return e.foundation_.handleKeydown(t)},this.handleBodyClick_=function(t){return e.foundation_.handleBodyClick(t)},this.registerBodyClickListener_=function(){return document.body.addEventListener("click",e.handleBodyClick_)},this.deregisterBodyClickListener_=function(){return document.body.removeEventListener("click",e.handleBodyClick_)},this.listen("keydown",this.handleKeydown_),this.listen(u.strings.OPENED_EVENT,this.registerBodyClickListener_),this.listen(u.strings.CLOSED_EVENT,this.deregisterBodyClickListener_)},d.prototype.destroy=function(){this.unlisten("keydown",this.handleKeydown_),this.unlisten(u.strings.OPENED_EVENT,this.registerBodyClickListener_),this.unlisten(u.strings.CLOSED_EVENT,this.deregisterBodyClickListener_),s.prototype.destroy.call(this)},d.prototype.isOpen=function(){return this.foundation_.isOpen()},d.prototype.open=function(){this.foundation_.open()},d.prototype.close=function(t){void 0===t&&(t=!1),this.foundation_.close(t)},Object.defineProperty(d.prototype,"quickOpen",{set:function(t){this.foundation_.setQuickOpen(t)},enumerable:!0,configurable:!0}),d.prototype.hoistMenuToBody=function(){document.body.appendChild(this.root_),this.setIsHoisted(!0)},d.prototype.setIsHoisted=function(t){this.foundation_.setIsHoisted(t)},d.prototype.setMenuSurfaceAnchorElement=function(t){this.anchorElement=t},d.prototype.setFixedPosition=function(t){t?this.root_.classList.add(u.cssClasses.FIXED):this.root_.classList.remove(u.cssClasses.FIXED),this.foundation_.setFixedPosition(t)},d.prototype.setAbsolutePosition=function(t,e){this.foundation_.setAbsolutePosition(t,e),this.setIsHoisted(!0)},d.prototype.setAnchorCorner=function(t){this.foundation_.setAnchorCorner(t)},d.prototype.setAnchorMargin=function(t){this.foundation_.setAnchorMargin(t)},d.prototype.getDefaultFoundation=function(){var n=this,t={addClass:function(t){return n.root_.classList.add(t)},removeClass:function(t){return n.root_.classList.remove(t)},hasClass:function(t){return n.root_.classList.contains(t)},hasAnchor:function(){return!!n.anchorElement},notifyClose:function(){return n.emit(c.MDCMenuSurfaceFoundation.strings.CLOSED_EVENT,{})},notifyOpen:function(){return n.emit(c.MDCMenuSurfaceFoundation.strings.OPENED_EVENT,{})},isElementInContainer:function(t){return n.root_.contains(t)},isRtl:function(){return"rtl"===getComputedStyle(n.root_).getPropertyValue("direction")},setTransformOrigin:function(t){var e=h.getTransformPropertyName(window)+"-origin";n.root_.style.setProperty(e,t)},isFocused:function(){return document.activeElement===n.root_},saveFocus:function(){n.previousFocus_=document.activeElement},restoreFocus:function(){n.root_.contains(document.activeElement)&&n.previousFocus_&&n.previousFocus_.focus&&n.previousFocus_.focus()},getInnerDimensions:function(){return{width:n.root_.offsetWidth,height:n.root_.offsetHeight}},getAnchorDimensions:function(){return n.anchorElement?n.anchorElement.getBoundingClientRect():null},getWindowDimensions:function(){return{width:window.innerWidth,height:window.innerHeight}},getBodyDimensions:function(){return{width:document.body.clientWidth,height:document.body.clientHeight}},getWindowScroll:function(){return{x:window.pageXOffset,y:window.pageYOffset}},setPosition:function(t){n.root_.style.left="left"in t?t.left+"px":"",n.root_.style.right="right"in t?t.right+"px":"",n.root_.style.top="top"in t?t.top+"px":"",n.root_.style.bottom="bottom"in t?t.bottom+"px":""},setMaxHeight:function(t){n.root_.style.maxHeight=t}};return new c.MDCMenuSurfaceFoundation(t)},d);function d(){return null!==s&&s.apply(this,arguments)||this}e.MDCMenuSurface=f},9:function(t,e,n){"use strict";Object.defineProperty(e,"__esModule",{value:!0});e.cssClasses={ANCHOR:"mdc-menu-surface--anchor",ANIMATING_CLOSED:"mdc-menu-surface--animating-closed",ANIMATING_OPEN:"mdc-menu-surface--animating-open",FIXED:"mdc-menu-surface--fixed",OPEN:"mdc-menu-surface--open",ROOT:"mdc-menu-surface"};var i={CLOSED_EVENT:"MDCMenuSurface:closed",OPENED_EVENT:"MDCMenuSurface:opened",FOCUSABLE_ELEMENTS:["button:not(:disabled)",'[href]:not([aria-disabled="true"])',"input:not(:disabled)","select:not(:disabled)","textarea:not(:disabled)",'[tabindex]:not([tabindex="-1"]):not([aria-disabled="true"])'].join(", ")};e.strings=i;var o,r,s,a;e.numbers={TRANSITION_OPEN_DURATION:120,TRANSITION_CLOSE_DURATION:75,MARGIN_TO_EDGE:32,ANCHOR_TO_MENU_SURFACE_WIDTH_RATIO:.67},(r=o=o||{})[r.BOTTOM=1]="BOTTOM",r[r.CENTER=2]="CENTER",r[r.RIGHT=4]="RIGHT",r[r.FLIP_RTL=8]="FLIP_RTL",e.CornerBit=o,(a=s=s||{})[a.TOP_LEFT=0]="TOP_LEFT",a[a.TOP_RIGHT=4]="TOP_RIGHT",a[a.BOTTOM_LEFT=1]="BOTTOM_LEFT",a[a.BOTTOM_RIGHT=5]="BOTTOM_RIGHT",a[a.TOP_START=8]="TOP_START",a[a.TOP_END=12]="TOP_END",a[a.BOTTOM_START=9]="BOTTOM_START",a[a.BOTTOM_END=13]="BOTTOM_END",e.Corner=s}},o.c=i,o.d=function(t,e,n){o.o(t,e)||Object.defineProperty(t,e,{enumerable:!0,get:n})},o.r=function(t){"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(t,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(t,"__esModule",{value:!0})},o.t=function(e,t){if(1&t&&(e=o(e)),8&t)return e;if(4&t&&"object"==typeof e&&e&&e.__esModule)return e;var n=Object.create(null);if(o.r(n),Object.defineProperty(n,"default",{enumerable:!0,value:e}),2&t&&"string"!=typeof e)for(var i in e)o.d(n,i,function(t){return e[t]}.bind(null,i));return n},o.n=function(t){var e=t&&t.__esModule?function(){return t.default}:function(){return t};return o.d(e,"a",e),e},o.o=function(t,e){return Object.prototype.hasOwnProperty.call(t,e)},o.p="",o(o.s=138);function o(t){if(i[t])return i[t].exports;var e=i[t]={i:t,l:!1,exports:{}};return n[t].call(e.exports,e,e.exports,o),e.l=!0,e.exports}var n,i}); | ||
!function(t,e){"object"==typeof exports&&"object"==typeof module?module.exports=e():"function"==typeof define&&define.amd?define([],e):"object"==typeof exports?exports.menuSurface=e():(t.mdc=t.mdc||{},t.mdc.menuSurface=e())}(this,function(){return i={},o.m=n={0:function(t,e,n){"use strict";Object.defineProperty(e,"__esModule",{value:!0});var i=(Object.defineProperty(o,"cssClasses",{get:function(){return{}},enumerable:!0,configurable:!0}),Object.defineProperty(o,"strings",{get:function(){return{}},enumerable:!0,configurable:!0}),Object.defineProperty(o,"numbers",{get:function(){return{}},enumerable:!0,configurable:!0}),Object.defineProperty(o,"defaultAdapter",{get:function(){return{}},enumerable:!0,configurable:!0}),o.prototype.init=function(){},o.prototype.destroy=function(){},o);function o(t){void 0===t&&(t={}),this.adapter_=t}e.MDCFoundation=i,e.default=i},1:function(t,e,n){"use strict";var i=this&&this.__read||function(t,e){var n="function"==typeof Symbol&&t[Symbol.iterator];if(!n)return t;var i,o,r=n.call(t),s=[];try{for(;(void 0===e||0<e--)&&!(i=r.next()).done;)s.push(i.value)}catch(t){o={error:t}}finally{try{i&&!i.done&&(n=r.return)&&n.call(r)}finally{if(o)throw o.error}}return s},o=this&&this.__spread||function(){for(var t=[],e=0;e<arguments.length;e++)t=t.concat(i(arguments[e]));return t};Object.defineProperty(e,"__esModule",{value:!0});var r=n(0),s=(a.attachTo=function(t){return new a(t,new r.MDCFoundation({}))},a.prototype.initialize=function(){for(var t=[],e=0;e<arguments.length;e++)t[e]=arguments[e]},a.prototype.getDefaultFoundation=function(){throw new Error("Subclasses must override getDefaultFoundation to return a properly configured foundation class")},a.prototype.initialSyncWithDOM=function(){},a.prototype.destroy=function(){this.foundation_.destroy()},a.prototype.listen=function(t,e,n){this.root_.addEventListener(t,e,n)},a.prototype.unlisten=function(t,e,n){this.root_.removeEventListener(t,e,n)},a.prototype.emit=function(t,e,n){var i;void 0===n&&(n=!1),"function"==typeof CustomEvent?i=new CustomEvent(t,{bubbles:n,detail:e}):(i=document.createEvent("CustomEvent")).initCustomEvent(t,n,!1,e),this.root_.dispatchEvent(i)},a);function a(t,e){for(var n=[],i=2;i<arguments.length;i++)n[i-2]=arguments[i];this.root_=t,this.initialize.apply(this,o(n)),this.foundation_=void 0===e?this.getDefaultFoundation():e,this.foundation_.init(),this.initialSyncWithDOM()}e.MDCComponent=s,e.default=s},138:function(t,n,e){"use strict";function i(t){for(var e in t)n.hasOwnProperty(e)||(n[e]=t[e])}var o=this&&this.__importStar||function(t){if(t&&t.__esModule)return t;var e={};if(null!=t)for(var n in t)Object.hasOwnProperty.call(t,n)&&(e[n]=t[n]);return e.default=t,e};Object.defineProperty(n,"__esModule",{value:!0});var r=o(e(22));n.util=r,i(e(31)),i(e(9)),i(e(14))},14:function(t,e,n){"use strict";var i,o=this&&this.__extends||(i=function(t,e){return(i=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var n in e)e.hasOwnProperty(n)&&(t[n]=e[n])})(t,e)},function(t,e){function n(){this.constructor=t}i(t,e),t.prototype=null===e?Object.create(e):(n.prototype=e.prototype,new n)}),r=this&&this.__assign||function(){return(r=Object.assign||function(t){for(var e,n=1,i=arguments.length;n<i;n++)for(var o in e=arguments[n])Object.prototype.hasOwnProperty.call(e,o)&&(t[o]=e[o]);return t}).apply(this,arguments)},f=this&&this.__values||function(t){var e="function"==typeof Symbol&&t[Symbol.iterator],n=0;return e?e.call(t):{next:function(){return t&&n>=t.length&&(t=void 0),{value:t&&t[n++],done:!t}}}};Object.defineProperty(e,"__esModule",{value:!0});var s,a=n(0),O=n(9),u=(s=a.MDCFoundation,o(c,s),Object.defineProperty(c,"cssClasses",{get:function(){return O.cssClasses},enumerable:!0,configurable:!0}),Object.defineProperty(c,"strings",{get:function(){return O.strings},enumerable:!0,configurable:!0}),Object.defineProperty(c,"numbers",{get:function(){return O.numbers},enumerable:!0,configurable:!0}),Object.defineProperty(c,"Corner",{get:function(){return O.Corner},enumerable:!0,configurable:!0}),Object.defineProperty(c,"defaultAdapter",{get:function(){return{addClass:function(){},removeClass:function(){},hasClass:function(){return!1},hasAnchor:function(){return!1},isElementInContainer:function(){return!1},isFocused:function(){return!1},isRtl:function(){return!1},getInnerDimensions:function(){return{height:0,width:0}},getAnchorDimensions:function(){return null},getWindowDimensions:function(){return{height:0,width:0}},getBodyDimensions:function(){return{height:0,width:0}},getWindowScroll:function(){return{x:0,y:0}},setPosition:function(){},setMaxHeight:function(){},setTransformOrigin:function(){},saveFocus:function(){},restoreFocus:function(){},notifyClose:function(){},notifyOpen:function(){}}},enumerable:!0,configurable:!0}),c.prototype.init=function(){var t=c.cssClasses,e=t.ROOT,n=t.OPEN;if(!this.adapter_.hasClass(e))throw new Error(e+" class required in root element.");this.adapter_.hasClass(n)&&(this.isOpen_=!0)},c.prototype.destroy=function(){clearTimeout(this.openAnimationEndTimerId_),clearTimeout(this.closeAnimationEndTimerId_),cancelAnimationFrame(this.animationRequestId_)},c.prototype.setAnchorCorner=function(t){this.anchorCorner_=t},c.prototype.setAnchorMargin=function(t){this.anchorMargin_.top=t.top||0,this.anchorMargin_.right=t.right||0,this.anchorMargin_.bottom=t.bottom||0,this.anchorMargin_.left=t.left||0},c.prototype.setIsHoisted=function(t){this.isHoistedElement_=t},c.prototype.setFixedPosition=function(t){this.isFixedPosition_=t},c.prototype.setAbsolutePosition=function(t,e){this.position_.x=this.isFinite_(t)?t:0,this.position_.y=this.isFinite_(e)?e:0},c.prototype.setQuickOpen=function(t){this.isQuickOpen_=t},c.prototype.isOpen=function(){return this.isOpen_},c.prototype.open=function(){var t=this;this.adapter_.saveFocus(),this.isQuickOpen_||this.adapter_.addClass(c.cssClasses.ANIMATING_OPEN),this.animationRequestId_=requestAnimationFrame(function(){t.adapter_.addClass(c.cssClasses.OPEN),t.dimensions_=t.adapter_.getInnerDimensions(),t.autoPosition_(),t.isQuickOpen_?t.adapter_.notifyOpen():t.openAnimationEndTimerId_=setTimeout(function(){t.openAnimationEndTimerId_=0,t.adapter_.removeClass(c.cssClasses.ANIMATING_OPEN),t.adapter_.notifyOpen()},O.numbers.TRANSITION_OPEN_DURATION)}),this.isOpen_=!0},c.prototype.close=function(t){var e=this;void 0===t&&(t=!1),this.isQuickOpen_||this.adapter_.addClass(c.cssClasses.ANIMATING_CLOSED),requestAnimationFrame(function(){e.adapter_.removeClass(c.cssClasses.OPEN),e.isQuickOpen_?e.adapter_.notifyClose():e.closeAnimationEndTimerId_=setTimeout(function(){e.closeAnimationEndTimerId_=0,e.adapter_.removeClass(c.cssClasses.ANIMATING_CLOSED),e.adapter_.notifyClose()},O.numbers.TRANSITION_CLOSE_DURATION)}),this.isOpen_=!1,t||this.maybeRestoreFocus_()},c.prototype.handleBodyClick=function(t){var e=t.target;this.adapter_.isElementInContainer(e)||this.close()},c.prototype.handleKeydown=function(t){var e=t.keyCode;"Escape"!==t.key&&27!==e||this.close()},c.prototype.autoPosition_=function(){var t;this.measurements_=this.getAutoLayoutMeasurements_();var e=this.getOriginCorner_(),n=this.getMenuSurfaceMaxHeight_(e),i=this.hasBit_(e,O.CornerBit.BOTTOM)?"bottom":"top",o=this.hasBit_(e,O.CornerBit.RIGHT)?"right":"left",r=this.getHorizontalOriginOffset_(e),s=this.getVerticalOriginOffset_(e),a=this.measurements_,u=a.anchorSize,c=a.surfaceSize,h=((t={})[o]=r,t[i]=s,t);u.width/c.width>O.numbers.ANCHOR_TO_MENU_SURFACE_WIDTH_RATIO&&(o="center"),(this.isHoistedElement_||this.isFixedPosition_)&&this.adjustPositionForHoistedElement_(h),this.adapter_.setTransformOrigin(o+" "+i),this.adapter_.setPosition(h),this.adapter_.setMaxHeight(n?n+"px":"")},c.prototype.getAutoLayoutMeasurements_=function(){var t=this.adapter_.getAnchorDimensions(),e=this.adapter_.getBodyDimensions(),n=this.adapter_.getWindowDimensions(),i=this.adapter_.getWindowScroll();return{anchorSize:t=t||{top:this.position_.y,right:this.position_.x,bottom:this.position_.y,left:this.position_.x,width:0,height:0},bodySize:e,surfaceSize:this.dimensions_,viewportDistance:{top:t.top,right:n.width-t.right,bottom:n.height-t.bottom,left:t.left},viewportSize:n,windowScroll:i}},c.prototype.getOriginCorner_=function(){var t=O.Corner.TOP_LEFT,e=this.measurements_,n=e.viewportDistance,i=e.anchorSize,o=e.surfaceSize,r=this.hasBit_(this.anchorCorner_,O.CornerBit.BOTTOM),s=r?n.top+i.height+this.anchorMargin_.bottom:n.top+this.anchorMargin_.top,a=r?n.bottom-this.anchorMargin_.bottom:n.bottom+i.height-this.anchorMargin_.top,u=o.height-s,c=o.height-a;0<c&&u<c&&(t=this.setBit_(t,O.CornerBit.BOTTOM));var h=this.adapter_.isRtl(),f=this.hasBit_(this.anchorCorner_,O.CornerBit.FLIP_RTL),d=this.hasBit_(this.anchorCorner_,O.CornerBit.RIGHT),l=d&&!h||!d&&f&&h,_=l?n.left+i.width+this.anchorMargin_.right:n.left+this.anchorMargin_.left,p=l?n.right-this.anchorMargin_.right:n.right+i.width-this.anchorMargin_.left,m=o.width-_,y=o.width-p;return(m<0&&l&&h||d&&!l&&m<0||0<y&&m<y)&&(t=this.setBit_(t,O.CornerBit.RIGHT)),t},c.prototype.getMenuSurfaceMaxHeight_=function(t){var e=this.measurements_.viewportDistance,n=0,i=this.hasBit_(t,O.CornerBit.BOTTOM),o=this.hasBit_(this.anchorCorner_,O.CornerBit.BOTTOM),r=c.numbers.MARGIN_TO_EDGE;return i?(n=e.top+this.anchorMargin_.top-r,o||(n+=this.measurements_.anchorSize.height)):(n=e.bottom-this.anchorMargin_.bottom+this.measurements_.anchorSize.height-r,o&&(n-=this.measurements_.anchorSize.height)),n},c.prototype.getHorizontalOriginOffset_=function(t){var e=this.measurements_.anchorSize,n=this.hasBit_(t,O.CornerBit.RIGHT),i=this.hasBit_(this.anchorCorner_,O.CornerBit.RIGHT);if(n){var o=i?e.width-this.anchorMargin_.left:this.anchorMargin_.right;return this.isHoistedElement_||this.isFixedPosition_?o-(this.measurements_.viewportSize.width-this.measurements_.bodySize.width):o}return i?e.width-this.anchorMargin_.right:this.anchorMargin_.left},c.prototype.getVerticalOriginOffset_=function(t){var e=this.measurements_.anchorSize,n=this.hasBit_(t,O.CornerBit.BOTTOM),i=this.hasBit_(this.anchorCorner_,O.CornerBit.BOTTOM);return n?i?e.height-this.anchorMargin_.top:-this.anchorMargin_.bottom:i?e.height+this.anchorMargin_.bottom:this.anchorMargin_.top},c.prototype.adjustPositionForHoistedElement_=function(t){var e,n,i=this.measurements_,o=i.windowScroll,r=i.viewportDistance,s=Object.keys(t);try{for(var a=f(s),u=a.next();!u.done;u=a.next()){var c=u.value,h=t[c]||0;h+=r[c],this.isFixedPosition_||("top"===c?h+=o.y:"bottom"===c?h-=o.y:"left"===c?h+=o.x:h-=o.x),t[c]=h}}catch(t){e={error:t}}finally{try{u&&!u.done&&(n=a.return)&&n.call(a)}finally{if(e)throw e.error}}},c.prototype.maybeRestoreFocus_=function(){var t=this.adapter_.isFocused(),e=document.activeElement&&this.adapter_.isElementInContainer(document.activeElement);(t||e)&&this.adapter_.restoreFocus()},c.prototype.hasBit_=function(t,e){return Boolean(t&e)},c.prototype.setBit_=function(t,e){return t|e},c.prototype.isFinite_=function(t){return"number"==typeof t&&isFinite(t)},c);function c(t){var e=s.call(this,r({},c.defaultAdapter,t))||this;return e.isOpen_=!1,e.isQuickOpen_=!1,e.isHoistedElement_=!1,e.isFixedPosition_=!1,e.openAnimationEndTimerId_=0,e.closeAnimationEndTimerId_=0,e.animationRequestId_=0,e.anchorCorner_=O.Corner.TOP_START,e.anchorMargin_={top:0,right:0,bottom:0,left:0},e.position_={x:0,y:0},e}e.MDCMenuSurfaceFoundation=u,e.default=u},22:function(t,e,n){"use strict";var i;Object.defineProperty(e,"__esModule",{value:!0}),e.getTransformPropertyName=function(t,e){if(void 0===e&&(e=!1),void 0===i||e){var n=t.document.createElement("div");i="transform"in n.style?"transform":"webkitTransform"}return i}},31:function(t,e,n){"use strict";var i,o=this&&this.__extends||(i=function(t,e){return(i=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var n in e)e.hasOwnProperty(n)&&(t[n]=e[n])})(t,e)},function(t,e){function n(){this.constructor=t}i(t,e),t.prototype=null===e?Object.create(e):(n.prototype=e.prototype,new n)}),r=this&&this.__importStar||function(t){if(t&&t.__esModule)return t;var e={};if(null!=t)for(var n in t)Object.hasOwnProperty.call(t,n)&&(e[n]=t[n]);return e.default=t,e};Object.defineProperty(e,"__esModule",{value:!0});var s,a=n(1),u=n(9),c=n(14),h=r(n(22)),f=(s=a.MDCComponent,o(d,s),d.attachTo=function(t){return new d(t)},d.prototype.initialSyncWithDOM=function(){var e=this,t=this.root_.parentElement;this.anchorElement=t&&t.classList.contains(u.cssClasses.ANCHOR)?t:null,this.root_.classList.contains(u.cssClasses.FIXED)&&this.setFixedPosition(!0),this.handleKeydown_=function(t){return e.foundation_.handleKeydown(t)},this.handleBodyClick_=function(t){return e.foundation_.handleBodyClick(t)},this.registerBodyClickListener_=function(){return document.body.addEventListener("click",e.handleBodyClick_)},this.deregisterBodyClickListener_=function(){return document.body.removeEventListener("click",e.handleBodyClick_)},this.listen("keydown",this.handleKeydown_),this.listen(u.strings.OPENED_EVENT,this.registerBodyClickListener_),this.listen(u.strings.CLOSED_EVENT,this.deregisterBodyClickListener_)},d.prototype.destroy=function(){this.unlisten("keydown",this.handleKeydown_),this.unlisten(u.strings.OPENED_EVENT,this.registerBodyClickListener_),this.unlisten(u.strings.CLOSED_EVENT,this.deregisterBodyClickListener_),s.prototype.destroy.call(this)},d.prototype.isOpen=function(){return this.foundation_.isOpen()},d.prototype.open=function(){this.foundation_.open()},d.prototype.close=function(t){void 0===t&&(t=!1),this.foundation_.close(t)},Object.defineProperty(d.prototype,"quickOpen",{set:function(t){this.foundation_.setQuickOpen(t)},enumerable:!0,configurable:!0}),d.prototype.setIsHoisted=function(t){this.foundation_.setIsHoisted(t)},d.prototype.setMenuSurfaceAnchorElement=function(t){this.anchorElement=t},d.prototype.setFixedPosition=function(t){t?this.root_.classList.add(u.cssClasses.FIXED):this.root_.classList.remove(u.cssClasses.FIXED),this.foundation_.setFixedPosition(t)},d.prototype.setAbsolutePosition=function(t,e){this.foundation_.setAbsolutePosition(t,e),this.setIsHoisted(!0)},d.prototype.setAnchorCorner=function(t){this.foundation_.setAnchorCorner(t)},d.prototype.setAnchorMargin=function(t){this.foundation_.setAnchorMargin(t)},d.prototype.getDefaultFoundation=function(){var n=this,t={addClass:function(t){return n.root_.classList.add(t)},removeClass:function(t){return n.root_.classList.remove(t)},hasClass:function(t){return n.root_.classList.contains(t)},hasAnchor:function(){return!!n.anchorElement},notifyClose:function(){return n.emit(c.MDCMenuSurfaceFoundation.strings.CLOSED_EVENT,{})},notifyOpen:function(){return n.emit(c.MDCMenuSurfaceFoundation.strings.OPENED_EVENT,{})},isElementInContainer:function(t){return n.root_.contains(t)},isRtl:function(){return"rtl"===getComputedStyle(n.root_).getPropertyValue("direction")},setTransformOrigin:function(t){var e=h.getTransformPropertyName(window)+"-origin";n.root_.style.setProperty(e,t)},isFocused:function(){return document.activeElement===n.root_},saveFocus:function(){n.previousFocus_=document.activeElement},restoreFocus:function(){n.root_.contains(document.activeElement)&&n.previousFocus_&&n.previousFocus_.focus&&n.previousFocus_.focus()},getInnerDimensions:function(){return{width:n.root_.offsetWidth,height:n.root_.offsetHeight}},getAnchorDimensions:function(){return n.anchorElement?n.anchorElement.getBoundingClientRect():null},getWindowDimensions:function(){return{width:window.innerWidth,height:window.innerHeight}},getBodyDimensions:function(){return{width:document.body.clientWidth,height:document.body.clientHeight}},getWindowScroll:function(){return{x:window.pageXOffset,y:window.pageYOffset}},setPosition:function(t){n.root_.style.left="left"in t?t.left+"px":"",n.root_.style.right="right"in t?t.right+"px":"",n.root_.style.top="top"in t?t.top+"px":"",n.root_.style.bottom="bottom"in t?t.bottom+"px":""},setMaxHeight:function(t){n.root_.style.maxHeight=t}};return new c.MDCMenuSurfaceFoundation(t)},d);function d(){return null!==s&&s.apply(this,arguments)||this}e.MDCMenuSurface=f},9:function(t,e,n){"use strict";Object.defineProperty(e,"__esModule",{value:!0});e.cssClasses={ANCHOR:"mdc-menu-surface--anchor",ANIMATING_CLOSED:"mdc-menu-surface--animating-closed",ANIMATING_OPEN:"mdc-menu-surface--animating-open",FIXED:"mdc-menu-surface--fixed",OPEN:"mdc-menu-surface--open",ROOT:"mdc-menu-surface"};var i={CLOSED_EVENT:"MDCMenuSurface:closed",OPENED_EVENT:"MDCMenuSurface:opened",FOCUSABLE_ELEMENTS:["button:not(:disabled)",'[href]:not([aria-disabled="true"])',"input:not(:disabled)","select:not(:disabled)","textarea:not(:disabled)",'[tabindex]:not([tabindex="-1"]):not([aria-disabled="true"])'].join(", ")};e.strings=i;var o,r,s,a;e.numbers={TRANSITION_OPEN_DURATION:120,TRANSITION_CLOSE_DURATION:75,MARGIN_TO_EDGE:32,ANCHOR_TO_MENU_SURFACE_WIDTH_RATIO:.67},(r=o=o||{})[r.BOTTOM=1]="BOTTOM",r[r.CENTER=2]="CENTER",r[r.RIGHT=4]="RIGHT",r[r.FLIP_RTL=8]="FLIP_RTL",e.CornerBit=o,(a=s=s||{})[a.TOP_LEFT=0]="TOP_LEFT",a[a.TOP_RIGHT=4]="TOP_RIGHT",a[a.BOTTOM_LEFT=1]="BOTTOM_LEFT",a[a.BOTTOM_RIGHT=5]="BOTTOM_RIGHT",a[a.TOP_START=8]="TOP_START",a[a.TOP_END=12]="TOP_END",a[a.BOTTOM_START=9]="BOTTOM_START",a[a.BOTTOM_END=13]="BOTTOM_END",e.Corner=s}},o.c=i,o.d=function(t,e,n){o.o(t,e)||Object.defineProperty(t,e,{enumerable:!0,get:n})},o.r=function(t){"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(t,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(t,"__esModule",{value:!0})},o.t=function(e,t){if(1&t&&(e=o(e)),8&t)return e;if(4&t&&"object"==typeof e&&e&&e.__esModule)return e;var n=Object.create(null);if(o.r(n),Object.defineProperty(n,"default",{enumerable:!0,value:e}),2&t&&"string"!=typeof e)for(var i in e)o.d(n,i,function(t){return e[t]}.bind(null,i));return n},o.n=function(t){var e=t&&t.__esModule?function(){return t.default}:function(){return t};return o.d(e,"a",e),e},o.o=function(t,e){return Object.prototype.hasOwnProperty.call(t,e)},o.p="",o(o.s=138);function o(t){if(i[t])return i[t].exports;var e=i[t]={i:t,l:!1,exports:{}};return n[t].call(e.exports,e,e.exports,o),e.l=!0,e.exports}var n,i}); |
@@ -24,3 +24,2 @@ /** | ||
import * as util from './util'; | ||
export { Corner, CornerBit } from './constants'; | ||
export { util }; | ||
@@ -27,0 +26,0 @@ export * from './adapter'; |
@@ -24,3 +24,2 @@ /** | ||
import * as util from './util'; | ||
export { Corner, CornerBit } from './constants'; | ||
export { util }; | ||
@@ -27,0 +26,0 @@ export * from './component'; |
{ | ||
"name": "@material/menu-surface", | ||
"version": "4.0.0-canary.79d881baf.0", | ||
"version": "4.0.0-canary.97cbbdc2.0", | ||
"description": "The Material Components for the web menu surface component", | ||
@@ -21,9 +21,9 @@ "license": "MIT", | ||
"dependencies": { | ||
"@material/animation": "^4.0.0-canary.79d881baf.0", | ||
"@material/base": "^4.0.0-canary.79d881baf.0", | ||
"@material/elevation": "^4.0.0-canary.79d881baf.0", | ||
"@material/feature-targeting": "^4.0.0-canary.79d881baf.0", | ||
"@material/rtl": "^4.0.0-canary.79d881baf.0", | ||
"@material/shape": "^4.0.0-canary.79d881baf.0", | ||
"@material/theme": "^4.0.0-canary.79d881baf.0", | ||
"@material/animation": "4.0.0-canary.97cbbdc2.0", | ||
"@material/base": "4.0.0-canary.97cbbdc2.0", | ||
"@material/elevation": "4.0.0-canary.97cbbdc2.0", | ||
"@material/feature-targeting": "4.0.0-canary.97cbbdc2.0", | ||
"@material/rtl": "4.0.0-canary.97cbbdc2.0", | ||
"@material/shape": "4.0.0-canary.97cbbdc2.0", | ||
"@material/theme": "4.0.0-canary.97cbbdc2.0", | ||
"tslib": "^1.9.3" | ||
@@ -34,3 +34,3 @@ }, | ||
}, | ||
"gitHead": "756806a2389389441b5b3c130de02948130d96b9" | ||
"gitHead": "49d37bbcdfa0f5872581945f58c03e62abb97090" | ||
} |
@@ -116,3 +116,3 @@ <!--docs: | ||
The menu surface can use absolute positioning when being displayed. This requires that the element containing the | ||
menu (`body` if using `hoistMenuToBody()`) has the `position: relative` style. | ||
menu has the `position: relative` style. | ||
@@ -127,3 +127,2 @@ ```html | ||
// ... | ||
menuSurface.hoistMenuToBody(); // Not required if the menu-surface is already positioned on the body. | ||
menuSurface.setAbsolutePosition(100, 100); | ||
@@ -179,4 +178,3 @@ ``` | ||
`setAbsolutePosition(x: number, y: number) => void` | Proxies to the foundation's `setAbsolutePosition(x, y)` method. Used to set the absolute x/y position of the menu on the page. Should only be used when the menu is hoisted to the body. | ||
`setMenuSurfaceAnchorElement(element: Element) => void` | Changes the element used as an anchor for `menu-surface` positioning logic. Should be used with conjunction with `hoistMenuToBody()`. | ||
`hoistMenuToBody() => void` | Removes the `menu-surface` element from the DOM and appends it to the `body` element. Should be used to overcome `overflow: hidden` issues. | ||
`setMenuSurfaceAnchorElement(element: Element) => void` | Changes the element used as an anchor for `menu-surface` positioning logic. | ||
`setIsHoisted() => void` | Proxies to the foundation's `setIsHoisted` method. | ||
@@ -183,0 +181,0 @@ `getDefaultFoundation() => MDCMenuSurfaceFoundation` | Returns the foundation. |
@@ -23,2 +23,3 @@ /** | ||
*/ | ||
export declare type AnyDuringTs36Migration = any; | ||
export interface MDCMenuDimensions { | ||
@@ -25,0 +26,0 @@ width: number; |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
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
305427
2939
230
+ Added@material/animation@4.0.0-canary.97cbbdc2.0(transitive)
+ Added@material/base@4.0.0-canary.97cbbdc2.0(transitive)
+ Added@material/elevation@4.0.0-canary.97cbbdc2.0(transitive)
+ Added@material/feature-targeting@4.0.0-canary.97cbbdc2.0(transitive)
+ Added@material/rtl@4.0.0-canary.97cbbdc2.0(transitive)
+ Added@material/shape@4.0.0-canary.97cbbdc2.0(transitive)
+ Added@material/theme@4.0.0-canary.97cbbdc2.0(transitive)
- Removed@material/animation@4.0.0(transitive)
- Removed@material/base@4.0.0(transitive)
- Removed@material/elevation@4.0.0(transitive)
- Removed@material/feature-targeting@4.0.0(transitive)
- Removed@material/rtl@4.0.0(transitive)
- Removed@material/shape@4.0.0(transitive)
- Removed@material/theme@4.0.0(transitive)