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AiC,SAAS,CAAC,SAA3C;AACD,SAJD,MAIO;AACL,UAAA,UAAU,CAAC,SAAX,CAAqB,SAArB,GAAiC,CAAjC;AACD;AACF,OAxBa,CA0Bd;;;AACA,WAAK,SAAL,CAAe,YAAK;AAClB,QAAA,UAAU,CAAC,OAAX,GAAqB,MAAI,CAAC,OAAL,CAAa,MAAI,CAAC,KAAL,CAAW,OAAxB,CAArB;AAEA,QAAA,MAAI,CAAC,UAAL,GAAkB,UAAlB;AACD,OAJD;AAKD;AA3MM;AA/IwC,CAApC,C","sourcesContent":["// Mixins\nimport Positionable from '../positionable'\nimport Stackable from '../stackable'\nimport Activatable from '../activatable'\n\n// Utilities\nimport mixins, { ExtractVue } from '../../util/mixins'\nimport { convertToUnit } from '../../util/helpers'\n\n// Types\nimport { VNode } from 'vue'\n\nconst baseMixins = mixins(\n Stackable,\n Positionable,\n Activatable\n)\n\ninterface options extends ExtractVue<typeof baseMixins> {\n attach: boolean | string | Element\n offsetY: boolean\n offsetX: boolean\n $refs: {\n content: HTMLElement\n activator: HTMLElement\n }\n}\n\n/* @vue/component */\nexport default baseMixins.extend<options>().extend({\n name: 'menuable',\n\n props: {\n allowOverflow: Boolean,\n light: Boolean,\n dark: Boolean,\n maxWidth: {\n type: [Number, String],\n default: 'auto',\n },\n minWidth: [Number, String],\n nudgeBottom: {\n type: [Number, String],\n default: 0,\n },\n nudgeLeft: {\n type: [Number, String],\n default: 0,\n },\n nudgeRight: {\n type: [Number, String],\n default: 0,\n },\n nudgeTop: {\n type: [Number, String],\n default: 0,\n },\n nudgeWidth: {\n type: [Number, String],\n default: 0,\n },\n offsetOverflow: Boolean,\n openOnClick: Boolean,\n positionX: {\n type: Number,\n default: null,\n },\n positionY: {\n type: Number,\n default: null,\n },\n zIndex: {\n type: [Number, String],\n default: null,\n },\n },\n\n data: () => ({\n absoluteX: 0,\n absoluteY: 0,\n activatedBy: null as EventTarget | null,\n activatorFixed: false,\n activatorNode: null as null | VNode | VNode[],\n dimensions: {\n activator: {\n top: 0,\n left: 0,\n bottom: 0,\n right: 0,\n width: 0,\n height: 0,\n offsetTop: 0,\n scrollHeight: 0,\n offsetLeft: 0,\n },\n content: {\n top: 0,\n left: 0,\n bottom: 0,\n right: 0,\n width: 0,\n height: 0,\n offsetTop: 0,\n scrollHeight: 0,\n },\n },\n hasJustFocused: false,\n hasWindow: false,\n inputActivator: false,\n isContentActive: false,\n pageWidth: 0,\n pageYOffset: 0,\n stackClass: 'v-menu__content--active',\n stackMinZIndex: 6,\n }),\n\n computed: {\n computedLeft () {\n const a = this.dimensions.activator\n const c = this.dimensions.content\n const activatorLeft = (this.attach !== false ? a.offsetLeft : a.left) || 0\n const minWidth = Math.max(a.width, c.width)\n let left = 0\n left += this.left ? activatorLeft - (minWidth - a.width) : activatorLeft\n if (this.offsetX) {\n const maxWidth = isNaN(Number(this.maxWidth))\n ? a.width\n : Math.min(a.width, Number(this.maxWidth))\n\n left += this.left ? -maxWidth : a.width\n }\n if (this.nudgeLeft) left -= parseInt(this.nudgeLeft)\n if (this.nudgeRight) left += parseInt(this.nudgeRight)\n\n return left\n },\n computedTop () {\n const a = this.dimensions.activator\n const c = this.dimensions.content\n let top = 0\n\n if (this.top) top += a.height - c.height\n if (this.attach !== false) top += a.offsetTop\n else top += a.top + this.pageYOffset\n if (this.offsetY) top += this.top ? -a.height : a.height\n if (this.nudgeTop) top -= parseInt(this.nudgeTop)\n if (this.nudgeBottom) top += parseInt(this.nudgeBottom)\n\n return top\n },\n hasActivator (): boolean {\n return !!this.$slots.activator || !!this.$scopedSlots.activator || !!this.activator || !!this.inputActivator\n },\n },\n\n watch: {\n disabled (val) {\n val && this.callDeactivate()\n },\n isActive (val) {\n if (this.disabled) return\n\n val ? this.callActivate() : this.callDeactivate()\n },\n positionX: 'updateDimensions',\n positionY: 'updateDimensions',\n },\n\n beforeMount () {\n this.hasWindow = typeof window !== 'undefined'\n },\n\n methods: {\n absolutePosition () {\n return {\n offsetTop: 0,\n offsetLeft: 0,\n scrollHeight: 0,\n top: this.positionY || this.absoluteY,\n bottom: this.positionY || this.absoluteY,\n left: this.positionX || this.absoluteX,\n right: this.positionX || this.absoluteX,\n height: 0,\n width: 0,\n }\n },\n activate () {},\n calcLeft (menuWidth: number) {\n return convertToUnit(this.attach !== false\n ? this.computedLeft\n : this.calcXOverflow(this.computedLeft, menuWidth))\n },\n calcTop () {\n return convertToUnit(this.attach !== false\n ? this.computedTop\n : this.calcYOverflow(this.computedTop))\n },\n calcXOverflow (left: number, menuWidth: number) {\n const xOverflow = left + menuWidth - this.pageWidth + 12\n\n if ((!this.left || this.right) && xOverflow > 0) {\n left = Math.max(left - xOverflow, 0)\n } else {\n left = Math.max(left, 12)\n }\n\n return left + this.getOffsetLeft()\n },\n calcYOverflow (top: number) {\n const documentHeight = this.getInnerHeight()\n const toTop = this.pageYOffset + documentHeight\n const activator = this.dimensions.activator\n const contentHeight = this.dimensions.content.height\n const totalHeight = top + contentHeight\n const isOverflowing = toTop < totalHeight\n\n // If overflowing bottom and offset\n // TODO: set 'bottom' position instead of 'top'\n if (isOverflowing &&\n this.offsetOverflow &&\n // If we don't have enough room to offset\n // the overflow, don't offset\n activator.top > contentHeight\n ) {\n top = this.pageYOffset + (activator.top - contentHeight)\n // If overflowing bottom\n } else if (isOverflowing && !this.allowOverflow) {\n top = toTop - contentHeight - 12\n // If overflowing top\n } else if (top < this.pageYOffset && !this.allowOverflow) {\n top = this.pageYOffset + 12\n }\n\n return top < 12 ? 12 : top\n },\n callActivate () {\n if (!this.hasWindow) return\n\n this.activate()\n },\n callDeactivate () {\n this.isContentActive = false\n\n this.deactivate()\n },\n checkForPageYOffset () {\n if (this.hasWindow) {\n this.pageYOffset = this.activatorFixed ? 0 : this.getOffsetTop()\n }\n },\n checkActivatorFixed () {\n if (this.attach !== false) return\n let el = this.getActivator()\n while (el) {\n if (window.getComputedStyle(el).position === 'fixed') {\n this.activatorFixed = true\n return\n }\n el = el.offsetParent as HTMLElement\n }\n this.activatorFixed = false\n },\n deactivate () {},\n genActivatorListeners () {\n const listeners = Activatable.options.methods.genActivatorListeners.call(this)\n\n const onClick = listeners.click\n\n listeners.click = (e: MouseEvent & KeyboardEvent) => {\n if (this.openOnClick) {\n onClick && onClick(e)\n }\n\n this.absoluteX = e.clientX\n this.absoluteY = e.clientY\n }\n\n return listeners\n },\n getInnerHeight () {\n if (!this.hasWindow) return 0\n\n return window.innerHeight ||\n document.documentElement.clientHeight\n },\n getOffsetLeft () {\n if (!this.hasWindow) return 0\n\n return window.pageXOffset ||\n document.documentElement.scrollLeft\n },\n getOffsetTop () {\n if (!this.hasWindow) return 0\n\n return window.pageYOffset ||\n document.documentElement.scrollTop\n },\n getRoundedBoundedClientRect (el: Element) {\n const rect = el.getBoundingClientRect()\n return {\n top: Math.round(rect.top),\n left: Math.round(rect.left),\n bottom: Math.round(rect.bottom),\n right: Math.round(rect.right),\n width: Math.round(rect.width),\n height: Math.round(rect.height),\n }\n },\n measure (el: HTMLElement) {\n if (!el || !this.hasWindow) return null\n\n const rect = this.getRoundedBoundedClientRect(el)\n\n // Account for activator margin\n if (this.attach !== false) {\n const style = window.getComputedStyle(el)\n\n rect.left = parseInt(style.marginLeft!)\n rect.top = parseInt(style.marginTop!)\n }\n\n return rect\n },\n sneakPeek (cb: () => void) {\n requestAnimationFrame(() => {\n const el = this.$refs.content\n\n if (!el || el.style.display !== 'none') {\n cb()\n return\n }\n\n el.style.display = 'inline-block'\n cb()\n el.style.display = 'none'\n })\n },\n startTransition () {\n return new Promise<void>(resolve => requestAnimationFrame(() => {\n this.isContentActive = this.hasJustFocused = this.isActive\n resolve()\n }))\n },\n updateDimensions () {\n this.hasWindow = typeof window !== 'undefined'\n this.checkActivatorFixed()\n this.checkForPageYOffset()\n this.pageWidth = document.documentElement.clientWidth\n\n const dimensions: any = {}\n\n // Activator should already be shown\n if (!this.hasActivator || this.absolute) {\n dimensions.activator = this.absolutePosition()\n } else {\n const activator = this.getActivator()\n if (!activator) return\n\n dimensions.activator = this.measure(activator)\n dimensions.activator.offsetLeft = activator.offsetLeft\n if (this.attach !== false) {\n // account for css padding causing things to not line up\n // this is mostly for v-autocomplete, hopefully it won't break anything\n dimensions.activator.offsetTop = activator.offsetTop\n } else {\n dimensions.activator.offsetTop = 0\n }\n }\n\n // Display and hide to get dimensions\n this.sneakPeek(() => {\n dimensions.content = this.measure(this.$refs.content)\n\n this.dimensions = dimensions\n })\n },\n },\n})\n"],"sourceRoot":"","file":"index.js"} |