@mantine-vue/contextmenu 3.5.0 → 3.6.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/cjs/index.cjs CHANGED
@@ -67,9 +67,33 @@ var ContextMenuItem_default = /* @__PURE__ */ (0, vue.defineComponent)({
67
67
  className: {},
68
68
  style: {},
69
69
  hidden: { type: Boolean },
70
- icon: {},
71
- iconRight: {},
72
- title: {},
70
+ icon: { type: [
71
+ Object,
72
+ String,
73
+ Number,
74
+ Boolean,
75
+ null,
76
+ Array,
77
+ Function
78
+ ] },
79
+ iconRight: { type: [
80
+ Object,
81
+ String,
82
+ Number,
83
+ Boolean,
84
+ null,
85
+ Array,
86
+ Function
87
+ ] },
88
+ title: { type: [
89
+ Object,
90
+ String,
91
+ Number,
92
+ Boolean,
93
+ null,
94
+ Array,
95
+ Function
96
+ ] },
73
97
  color: {},
74
98
  disabled: {
75
99
  type: Boolean,
package/cjs/index.cjs.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"file":"index.cjs","names":[],"sources":["../src/utils.ts","../src/components/ContextMenuDivider/ContextMenuDivider.vue","../src/components/ContextMenuDivider/ContextMenuDivider.vue","../src/context.ts","../src/components/ContextMenuItem/ContextMenuItem.vue","../src/components/ContextMenuItem/ContextMenuItem.vue","../src/components/ContextMenu/ContextMenu.vue","../src/components/ContextMenu/ContextMenu.vue","../src/components/ContextMenuOverlay/ContextMenuOverlay.vue","../src/components/ContextMenuOverlay/ContextMenuOverlay.vue","../src/components/ContextMenuPortal/ContextMenuPortal.vue","../src/components/ContextMenuPortal/ContextMenuPortal.vue","../src/components/ContextMenuProvider/ContextMenuProvider.vue","../src/components/ContextMenuProvider/ContextMenuProvider.vue"],"sourcesContent":["import type { ContextMenuStyle, ContextMenuStyles } from './types'\nimport type { MantineStyle, MantineTheme } from '@mantine-vue/core'\n\n/** Returns a humanized version of a string, for example \"camelCase\" becomes \"Camel Case\". */\nexport function humanize(value: string) {\n const str = value\n .replace(/([a-z\\d])([A-Z]+)/g, '$1 $2')\n .replace(/\\W|_/g, ' ')\n .trim()\n .toLowerCase()\n\n return `${str.charAt(0).toUpperCase()}${str.slice(1)}`\n}\n\nexport function resolveContextMenuStyle(\n style: ContextMenuStyle | undefined,\n theme: MantineTheme,\n): MantineStyle | undefined {\n return typeof style === 'function' ? style(theme) : style\n}\n\nexport function resolveContextMenuStyles(\n styles: ContextMenuStyles | ((theme: MantineTheme) => ContextMenuStyles) | undefined,\n theme: MantineTheme,\n) {\n return typeof styles === 'function' ? styles(theme) : styles\n}\n","<script setup lang=\"ts\">\nimport { computed } from 'vue'\nimport { Box, useMantineTheme } from '@mantine-vue/core'\nimport { resolveContextMenuStyle } from '../../utils'\nimport type { ContextMenuDividerProps } from '../../types'\nimport '../../ContextMenuDivider.css'\n\ndefineOptions({ name: 'ContextMenuDivider' })\nconst props = defineProps<ContextMenuDividerProps>()\nconst theme = useMantineTheme()\nconst resolvedStyle = computed(() => resolveContextMenuStyle(props.style, theme.value))\n</script>\n\n<template>\n <Box :class=\"['mantine-contextmenu-divider', props.className]\" :style=\"resolvedStyle\" />\n</template>\n","<script setup lang=\"ts\">\nimport { computed } from 'vue'\nimport { Box, useMantineTheme } from '@mantine-vue/core'\nimport { resolveContextMenuStyle } from '../../utils'\nimport type { ContextMenuDividerProps } from '../../types'\nimport '../../ContextMenuDivider.css'\n\ndefineOptions({ name: 'ContextMenuDivider' })\nconst props = defineProps<ContextMenuDividerProps>()\nconst theme = useMantineTheme()\nconst resolvedStyle = computed(() => resolveContextMenuStyle(props.style, theme.value))\n</script>\n\n<template>\n <Box :class=\"['mantine-contextmenu-divider', props.className]\" :style=\"resolvedStyle\" />\n</template>\n","import { inject, readonly, ref, type InjectionKey, type Ref } from 'vue'\nimport type { ContextMenuContextValue, ContextMenuSettings } from './types'\n\nexport interface ResolvedContextMenuSettings {\n shadow: NonNullable<ContextMenuSettings['shadow']>\n borderRadius: NonNullable<ContextMenuSettings['borderRadius']>\n submenuDelay: number\n repositionOnRepeat: boolean\n}\n\nexport const ContextMenuSettingsKey = Symbol('ContextMenuSettings') as InjectionKey<\n Ref<ResolvedContextMenuSettings>\n>\n\nexport const ContextMenuKey = Symbol('ContextMenu') as InjectionKey<ContextMenuContextValue>\n\nconst hidden = readonly(ref(false))\nconst fallback: ContextMenuContextValue = {\n showContextMenu: () => () => undefined,\n hideContextMenu: () => undefined,\n isContextMenuVisible: hidden,\n}\n\nexport function useContextMenu() {\n return inject(ContextMenuKey, fallback)\n}\n\nexport function useContextMenuSettings() {\n return inject(ContextMenuSettingsKey, {\n value: {\n shadow: 'sm',\n borderRadius: 'xs',\n submenuDelay: 500,\n repositionOnRepeat: false,\n },\n } as Ref<ResolvedContextMenuSettings>)\n}\n","<script setup lang=\"ts\">\nimport { computed, ref, useSlots } from 'vue'\nimport {\n Box,\n UnstyledButton,\n parseThemeColor,\n resolveNode,\n rgba,\n useMantineTheme,\n} from '@mantine-vue/core'\nimport { useMediaQuery, useTimeout } from '@mantine-vue/hooks'\nimport ContextMenu from '../ContextMenu/ContextMenu.vue'\nimport { useContextMenuSettings } from '../../context'\nimport { resolveContextMenuStyle } from '../../utils'\nimport type { ContextMenuItemEmits, ContextMenuItemProps } from '../../types'\nimport '../../ContextMenuItem.css'\n\ndefineOptions({ name: 'ContextMenuItem' })\nconst props = withDefaults(defineProps<ContextMenuItemProps>(), { disabled: false })\nconst emit = defineEmits<ContextMenuItemEmits>()\nconst slots = useSlots()\nconst button = ref<HTMLElement | null>(null)\nconst submenuPosition = ref<{ x: number; y: number } | null>(null)\nconst settings = useContextMenuSettings()\nconst theme = useMantineTheme()\nconst hoverAvailable = useMediaQuery('(hover: hover)')\nconst hasSubmenu = computed(() => Boolean(props.items && !props.disabled))\nconst parsedColor = computed(() =>\n props.color ? parseThemeColor({ color: props.color, theme: theme.value }) : null,\n)\nconst itemStyle = computed(() => {\n const color = parsedColor.value?.value\n return {\n '--mantine-contextmenu-item-button-color': color ?? 'var(--mantine-color-text)',\n '--mantine-contextmenu-item-button-hover-bg-color-light': color\n ? rgba(color, 0.08)\n : rgba(theme.value.colors.gray[4], 0.25),\n '--mantine-contextmenu-item-button-hover-bg-color-dark': color\n ? rgba(color, 0.15)\n : rgba(theme.value.colors.dark[3], 0.25),\n '--mantine-contextmenu-item-button-pressed-bg-color-light': color\n ? rgba(color, 0.2)\n : rgba(theme.value.colors.gray[4], 0.5),\n '--mantine-contextmenu-item-button-pressed-bg-color-dark': color\n ? rgba(color, 0.3)\n : rgba(theme.value.colors.dark[3], 0.5),\n ...resolveContextMenuStyle(props.style, theme.value),\n }\n})\nconst icon = computed(() => resolveNode(props.icon, slots.icon))\nconst title = computed(() => resolveNode(props.title, slots.title))\nconst iconRight = computed(() => resolveNode(props.iconRight, slots.iconRight))\nconst renderIcon = () => icon.value\nconst renderTitle = () => title.value\nconst renderIconRight = () => iconRight.value\n\nconst showSubmenuTimeout = useTimeout(() => {\n if (!button.value) return\n const rect = button.value.getBoundingClientRect()\n submenuPosition.value = {\n x: (props.submenuProps.dir || 'ltr') === 'ltr' ? rect.right : rect.left,\n y: rect.top,\n }\n}, settings.value.submenuDelay)\nconst hideSubmenuTimeout = useTimeout(\n () => (submenuPosition.value = null),\n settings.value.submenuDelay,\n)\n\nfunction showSubmenu() {\n hideSubmenuTimeout.clear()\n showSubmenuTimeout.start()\n}\nfunction hideSubmenu() {\n showSubmenuTimeout.clear()\n hideSubmenuTimeout.start()\n}\nfunction mouseenter() {\n if (hasSubmenu.value && hoverAvailable.value) showSubmenu()\n}\nfunction mouseleave() {\n if (hasSubmenu.value && hoverAvailable.value) hideSubmenu()\n}\nfunction click(event: MouseEvent) {\n if (hasSubmenu.value) {\n event.stopPropagation()\n showSubmenu()\n } else if (props.onClick) {\n emit('hide')\n props.onClick(event)\n }\n}\n</script>\n\n<template>\n <div @mouseenter=\"mouseenter\" @mouseleave=\"mouseleave\">\n <UnstyledButton\n :ref=\"(node: any) => (button = node?.$el ?? node ?? null)\"\n :dir=\"props.submenuProps.dir || 'ltr'\"\n :class=\"['mantine-contextmenu-item-button', props.className]\"\n :disabled=\"props.disabled\"\n :style=\"itemStyle\"\n @click=\"click\"\n >\n <Box v-if=\"icon\" :fz=\"0\" me=\"xs\" :mt=\"-2\"><component :is=\"renderIcon\" /></Box>\n <div class=\"mantine-contextmenu-item-button-title\"><component :is=\"renderTitle\" /></div>\n <Box v-if=\"iconRight\" :fz=\"0\" ms=\"xs\" :mt=\"-2\"><component :is=\"renderIconRight\" /></Box>\n <Box v-else-if=\"props.items\" :mt=\"-1\" ms=\"xs\">\n {{ (props.submenuProps.dir || 'ltr') === 'rtl' ? '‹' : '›' }}\n </Box>\n </UnstyledButton>\n <ContextMenu\n v-if=\"submenuPosition && props.items\"\n v-bind=\"props.submenuProps\"\n :x=\"submenuPosition.x\"\n :y=\"submenuPosition.y\"\n :content=\"props.items\"\n :dir=\"props.submenuProps.dir || 'ltr'\"\n @hide=\"emit('hide')\"\n />\n </div>\n</template>\n","<script setup lang=\"ts\">\nimport { computed, ref, useSlots } from 'vue'\nimport {\n Box,\n UnstyledButton,\n parseThemeColor,\n resolveNode,\n rgba,\n useMantineTheme,\n} from '@mantine-vue/core'\nimport { useMediaQuery, useTimeout } from '@mantine-vue/hooks'\nimport ContextMenu from '../ContextMenu/ContextMenu.vue'\nimport { useContextMenuSettings } from '../../context'\nimport { resolveContextMenuStyle } from '../../utils'\nimport type { ContextMenuItemEmits, ContextMenuItemProps } from '../../types'\nimport '../../ContextMenuItem.css'\n\ndefineOptions({ name: 'ContextMenuItem' })\nconst props = withDefaults(defineProps<ContextMenuItemProps>(), { disabled: false })\nconst emit = defineEmits<ContextMenuItemEmits>()\nconst slots = useSlots()\nconst button = ref<HTMLElement | null>(null)\nconst submenuPosition = ref<{ x: number; y: number } | null>(null)\nconst settings = useContextMenuSettings()\nconst theme = useMantineTheme()\nconst hoverAvailable = useMediaQuery('(hover: hover)')\nconst hasSubmenu = computed(() => Boolean(props.items && !props.disabled))\nconst parsedColor = computed(() =>\n props.color ? parseThemeColor({ color: props.color, theme: theme.value }) : null,\n)\nconst itemStyle = computed(() => {\n const color = parsedColor.value?.value\n return {\n '--mantine-contextmenu-item-button-color': color ?? 'var(--mantine-color-text)',\n '--mantine-contextmenu-item-button-hover-bg-color-light': color\n ? rgba(color, 0.08)\n : rgba(theme.value.colors.gray[4], 0.25),\n '--mantine-contextmenu-item-button-hover-bg-color-dark': color\n ? rgba(color, 0.15)\n : rgba(theme.value.colors.dark[3], 0.25),\n '--mantine-contextmenu-item-button-pressed-bg-color-light': color\n ? rgba(color, 0.2)\n : rgba(theme.value.colors.gray[4], 0.5),\n '--mantine-contextmenu-item-button-pressed-bg-color-dark': color\n ? rgba(color, 0.3)\n : rgba(theme.value.colors.dark[3], 0.5),\n ...resolveContextMenuStyle(props.style, theme.value),\n }\n})\nconst icon = computed(() => resolveNode(props.icon, slots.icon))\nconst title = computed(() => resolveNode(props.title, slots.title))\nconst iconRight = computed(() => resolveNode(props.iconRight, slots.iconRight))\nconst renderIcon = () => icon.value\nconst renderTitle = () => title.value\nconst renderIconRight = () => iconRight.value\n\nconst showSubmenuTimeout = useTimeout(() => {\n if (!button.value) return\n const rect = button.value.getBoundingClientRect()\n submenuPosition.value = {\n x: (props.submenuProps.dir || 'ltr') === 'ltr' ? rect.right : rect.left,\n y: rect.top,\n }\n}, settings.value.submenuDelay)\nconst hideSubmenuTimeout = useTimeout(\n () => (submenuPosition.value = null),\n settings.value.submenuDelay,\n)\n\nfunction showSubmenu() {\n hideSubmenuTimeout.clear()\n showSubmenuTimeout.start()\n}\nfunction hideSubmenu() {\n showSubmenuTimeout.clear()\n hideSubmenuTimeout.start()\n}\nfunction mouseenter() {\n if (hasSubmenu.value && hoverAvailable.value) showSubmenu()\n}\nfunction mouseleave() {\n if (hasSubmenu.value && hoverAvailable.value) hideSubmenu()\n}\nfunction click(event: MouseEvent) {\n if (hasSubmenu.value) {\n event.stopPropagation()\n showSubmenu()\n } else if (props.onClick) {\n emit('hide')\n props.onClick(event)\n }\n}\n</script>\n\n<template>\n <div @mouseenter=\"mouseenter\" @mouseleave=\"mouseleave\">\n <UnstyledButton\n :ref=\"(node: any) => (button = node?.$el ?? node ?? null)\"\n :dir=\"props.submenuProps.dir || 'ltr'\"\n :class=\"['mantine-contextmenu-item-button', props.className]\"\n :disabled=\"props.disabled\"\n :style=\"itemStyle\"\n @click=\"click\"\n >\n <Box v-if=\"icon\" :fz=\"0\" me=\"xs\" :mt=\"-2\"><component :is=\"renderIcon\" /></Box>\n <div class=\"mantine-contextmenu-item-button-title\"><component :is=\"renderTitle\" /></div>\n <Box v-if=\"iconRight\" :fz=\"0\" ms=\"xs\" :mt=\"-2\"><component :is=\"renderIconRight\" /></Box>\n <Box v-else-if=\"props.items\" :mt=\"-1\" ms=\"xs\">\n {{ (props.submenuProps.dir || 'ltr') === 'rtl' ? '‹' : '›' }}\n </Box>\n </UnstyledButton>\n <ContextMenu\n v-if=\"submenuPosition && props.items\"\n v-bind=\"props.submenuProps\"\n :x=\"submenuPosition.x\"\n :y=\"submenuPosition.y\"\n :content=\"props.items\"\n :dir=\"props.submenuProps.dir || 'ltr'\"\n @hide=\"emit('hide')\"\n />\n </div>\n</template>\n","<script setup lang=\"ts\">\nimport { computed, onBeforeUnmount, ref, watch } from 'vue'\nimport { Paper, px, useMantineTheme, type MantineRadius } from '@mantine-vue/core'\nimport { useResizeObserver } from '@mantine-vue/hooks'\nimport ContextMenuDivider from '../ContextMenuDivider/ContextMenuDivider.vue'\nimport ContextMenuItem from '../ContextMenuItem/ContextMenuItem.vue'\nimport { useContextMenuSettings } from '../../context'\nimport { humanize, resolveContextMenuStyle, resolveContextMenuStyles } from '../../utils'\nimport type { ContextMenuEmits, ContextMenuItemOptions, ContextMenuProps } from '../../types'\nimport '../../ContextMenu.css'\n\ndefineOptions({ name: 'ContextMenu' })\nconst props = withDefaults(defineProps<ContextMenuProps>(), { dir: 'ltr' })\nconst emit = defineEmits<ContextMenuEmits>()\nconst settings = useContextMenuSettings()\nconst theme = useMantineTheme()\nconst { ref: menuRef, rect } = useResizeObserver<HTMLElement>()\nconst mounted = ref(false)\nlet frameId = 0\n\nwatch(\n () => [rect.value.width, rect.value.height],\n ([width, height]) => {\n if (width > 0 && height > 0) {\n cancelAnimationFrame(frameId)\n frameId = requestAnimationFrame(() => (mounted.value = true))\n }\n },\n { immediate: true },\n)\nonBeforeUnmount(() => cancelAnimationFrame(frameId))\n\nconst position = computed(() => {\n const spacing = px(theme.value.spacing.md)\n const windowWidth = typeof window === 'undefined' ? 0 : window.innerWidth\n const windowHeight = typeof window === 'undefined' ? 0 : window.innerHeight\n const top =\n props.y + rect.value.height + spacing > windowHeight\n ? windowHeight - rect.value.height - spacing\n : props.y\n const left =\n props.dir === 'rtl'\n ? props.x - rect.value.width < spacing\n ? spacing\n : props.x - rect.value.width\n : props.x + rect.value.width + spacing > windowWidth\n ? windowWidth - rect.value.width - spacing\n : props.x\n return { zIndex: props.zIndex, top: `${top}px`, left: `${left}px` }\n})\nconst resolvedStyles = computed(() => resolveContextMenuStyles(props.styles, theme.value))\nconst rootStyle = computed(() => ({\n ...position.value,\n ...resolveContextMenuStyle(props.style, theme.value),\n ...resolveContextMenuStyle(resolvedStyles.value?.root, theme.value),\n}))\nconst submenuProps = computed(() => ({\n className: props.className,\n style: props.style,\n classNames: props.classNames,\n styles: props.styles,\n dir: props.dir,\n}))\n\nfunction itemClass(item: ContextMenuItemOptions, part: 'item' | 'divider') {\n return [props.classNames?.[part], item.className].filter(Boolean).join(' ')\n}\nfunction itemStyle(item: ContextMenuItemOptions, part: 'item' | 'divider') {\n return {\n ...resolveContextMenuStyle(resolvedStyles.value?.[part], theme.value),\n ...resolveContextMenuStyle(item.style, theme.value),\n }\n}\nconst renderCustomContent = () =>\n typeof props.content === 'function' ? props.content(() => emit('hide')) : null\n</script>\n\n<template>\n <Paper\n :ref=\"(node: any) => (menuRef = node?.$el ?? node ?? null)\"\n :shadow=\"settings.shadow\"\n :radius=\"settings.borderRadius as MantineRadius\"\n :dir=\"props.dir\"\n :class=\"[\n 'mantine-contextmenu',\n mounted && 'mantine-contextmenu-mounted',\n props.className,\n props.classNames?.root,\n ]\"\n :style=\"rootStyle\"\n >\n <component v-if=\"typeof props.content === 'function'\" :is=\"renderCustomContent\" />\n <template v-else>\n <template v-for=\"item in props.content\" :key=\"item.key\">\n <ContextMenuItem\n v-if=\"!item.hidden && (item.onClick || item.items)\"\n :class-name=\"itemClass(item, 'item')\"\n :style=\"itemStyle(item, 'item')\"\n :title=\"item.title ?? humanize(item.key)\"\n :icon=\"item.icon\"\n :icon-right=\"item.iconRight\"\n :color=\"item.color\"\n :disabled=\"item.disabled\"\n :on-click=\"item.onClick\"\n :items=\"item.items\"\n :submenu-props=\"submenuProps\"\n @hide=\"emit('hide')\"\n />\n <ContextMenuDivider\n v-else-if=\"!item.hidden\"\n :class-name=\"itemClass(item, 'divider')\"\n :style=\"itemStyle(item, 'divider')\"\n />\n </template>\n </template>\n </Paper>\n</template>\n","<script setup lang=\"ts\">\nimport { computed, onBeforeUnmount, ref, watch } from 'vue'\nimport { Paper, px, useMantineTheme, type MantineRadius } from '@mantine-vue/core'\nimport { useResizeObserver } from '@mantine-vue/hooks'\nimport ContextMenuDivider from '../ContextMenuDivider/ContextMenuDivider.vue'\nimport ContextMenuItem from '../ContextMenuItem/ContextMenuItem.vue'\nimport { useContextMenuSettings } from '../../context'\nimport { humanize, resolveContextMenuStyle, resolveContextMenuStyles } from '../../utils'\nimport type { ContextMenuEmits, ContextMenuItemOptions, ContextMenuProps } from '../../types'\nimport '../../ContextMenu.css'\n\ndefineOptions({ name: 'ContextMenu' })\nconst props = withDefaults(defineProps<ContextMenuProps>(), { dir: 'ltr' })\nconst emit = defineEmits<ContextMenuEmits>()\nconst settings = useContextMenuSettings()\nconst theme = useMantineTheme()\nconst { ref: menuRef, rect } = useResizeObserver<HTMLElement>()\nconst mounted = ref(false)\nlet frameId = 0\n\nwatch(\n () => [rect.value.width, rect.value.height],\n ([width, height]) => {\n if (width > 0 && height > 0) {\n cancelAnimationFrame(frameId)\n frameId = requestAnimationFrame(() => (mounted.value = true))\n }\n },\n { immediate: true },\n)\nonBeforeUnmount(() => cancelAnimationFrame(frameId))\n\nconst position = computed(() => {\n const spacing = px(theme.value.spacing.md)\n const windowWidth = typeof window === 'undefined' ? 0 : window.innerWidth\n const windowHeight = typeof window === 'undefined' ? 0 : window.innerHeight\n const top =\n props.y + rect.value.height + spacing > windowHeight\n ? windowHeight - rect.value.height - spacing\n : props.y\n const left =\n props.dir === 'rtl'\n ? props.x - rect.value.width < spacing\n ? spacing\n : props.x - rect.value.width\n : props.x + rect.value.width + spacing > windowWidth\n ? windowWidth - rect.value.width - spacing\n : props.x\n return { zIndex: props.zIndex, top: `${top}px`, left: `${left}px` }\n})\nconst resolvedStyles = computed(() => resolveContextMenuStyles(props.styles, theme.value))\nconst rootStyle = computed(() => ({\n ...position.value,\n ...resolveContextMenuStyle(props.style, theme.value),\n ...resolveContextMenuStyle(resolvedStyles.value?.root, theme.value),\n}))\nconst submenuProps = computed(() => ({\n className: props.className,\n style: props.style,\n classNames: props.classNames,\n styles: props.styles,\n dir: props.dir,\n}))\n\nfunction itemClass(item: ContextMenuItemOptions, part: 'item' | 'divider') {\n return [props.classNames?.[part], item.className].filter(Boolean).join(' ')\n}\nfunction itemStyle(item: ContextMenuItemOptions, part: 'item' | 'divider') {\n return {\n ...resolveContextMenuStyle(resolvedStyles.value?.[part], theme.value),\n ...resolveContextMenuStyle(item.style, theme.value),\n }\n}\nconst renderCustomContent = () =>\n typeof props.content === 'function' ? props.content(() => emit('hide')) : null\n</script>\n\n<template>\n <Paper\n :ref=\"(node: any) => (menuRef = node?.$el ?? node ?? null)\"\n :shadow=\"settings.shadow\"\n :radius=\"settings.borderRadius as MantineRadius\"\n :dir=\"props.dir\"\n :class=\"[\n 'mantine-contextmenu',\n mounted && 'mantine-contextmenu-mounted',\n props.className,\n props.classNames?.root,\n ]\"\n :style=\"rootStyle\"\n >\n <component v-if=\"typeof props.content === 'function'\" :is=\"renderCustomContent\" />\n <template v-else>\n <template v-for=\"item in props.content\" :key=\"item.key\">\n <ContextMenuItem\n v-if=\"!item.hidden && (item.onClick || item.items)\"\n :class-name=\"itemClass(item, 'item')\"\n :style=\"itemStyle(item, 'item')\"\n :title=\"item.title ?? humanize(item.key)\"\n :icon=\"item.icon\"\n :icon-right=\"item.iconRight\"\n :color=\"item.color\"\n :disabled=\"item.disabled\"\n :on-click=\"item.onClick\"\n :items=\"item.items\"\n :submenu-props=\"submenuProps\"\n @hide=\"emit('hide')\"\n />\n <ContextMenuDivider\n v-else-if=\"!item.hidden\"\n :class-name=\"itemClass(item, 'divider')\"\n :style=\"itemStyle(item, 'divider')\"\n />\n </template>\n </template>\n </Paper>\n</template>\n","<script setup lang=\"ts\">\nimport { useContextMenuSettings } from '../../context'\nimport type { ContextMenuOverlayEmits } from '../../types'\nimport '../../ContextMenuOverlay.css'\n\ndefineOptions({ name: 'ContextMenuOverlay' })\nconst props = defineProps<{ zIndex?: number }>()\nconst emit = defineEmits<ContextMenuOverlayEmits>()\nconst settings = useContextMenuSettings()\n\nfunction click(event: MouseEvent) {\n event.preventDefault()\n emit('hide')\n}\n\nfunction contextmenu(event: MouseEvent) {\n event.preventDefault()\n if (!settings.value.repositionOnRepeat) {\n emit('hide')\n return\n }\n try {\n document.elementsFromPoint(event.clientX, event.clientY)[1]?.dispatchEvent(\n new MouseEvent('contextmenu', {\n bubbles: true,\n clientX: event.clientX,\n clientY: event.clientY,\n }),\n )\n } catch {\n // The target may disappear while the event is dispatched.\n }\n}\n</script>\n\n<template>\n <div\n class=\"mantine-contextmenu-overlay\"\n :style=\"{ zIndex: props.zIndex }\"\n @click=\"click\"\n @contextmenu=\"contextmenu\"\n >\n <slot />\n </div>\n</template>\n","<script setup lang=\"ts\">\nimport { useContextMenuSettings } from '../../context'\nimport type { ContextMenuOverlayEmits } from '../../types'\nimport '../../ContextMenuOverlay.css'\n\ndefineOptions({ name: 'ContextMenuOverlay' })\nconst props = defineProps<{ zIndex?: number }>()\nconst emit = defineEmits<ContextMenuOverlayEmits>()\nconst settings = useContextMenuSettings()\n\nfunction click(event: MouseEvent) {\n event.preventDefault()\n emit('hide')\n}\n\nfunction contextmenu(event: MouseEvent) {\n event.preventDefault()\n if (!settings.value.repositionOnRepeat) {\n emit('hide')\n return\n }\n try {\n document.elementsFromPoint(event.clientX, event.clientY)[1]?.dispatchEvent(\n new MouseEvent('contextmenu', {\n bubbles: true,\n clientX: event.clientX,\n clientY: event.clientY,\n }),\n )\n } catch {\n // The target may disappear while the event is dispatched.\n }\n}\n</script>\n\n<template>\n <div\n class=\"mantine-contextmenu-overlay\"\n :style=\"{ zIndex: props.zIndex }\"\n @click=\"click\"\n @contextmenu=\"contextmenu\"\n >\n <slot />\n </div>\n</template>\n","<script setup lang=\"ts\">\nimport { Portal } from '@mantine-vue/core'\nimport { useHotkeys, useWindowEvent } from '@mantine-vue/hooks'\nimport ContextMenu from '../ContextMenu/ContextMenu.vue'\nimport ContextMenuOverlay from '../ContextMenuOverlay/ContextMenuOverlay.vue'\nimport type { ContextMenuPortalEmits, ContextMenuPortalProps } from '../../types'\n\ndefineOptions({ name: 'ContextMenuPortal' })\nconst props = defineProps<ContextMenuPortalProps>()\nconst emit = defineEmits<ContextMenuPortalEmits>()\nconst hide = () => emit('hide')\nuseWindowEvent('resize', hide)\nuseWindowEvent('scroll', hide)\nuseHotkeys([['Escape', hide]])\n</script>\n\n<template>\n <Portal>\n <ContextMenuOverlay :z-index=\"props.zIndex\" @hide=\"hide\">\n <ContextMenu\n :x=\"props.x\"\n :y=\"props.y\"\n :content=\"props.content\"\n :dir=\"props.dir\"\n :z-index=\"props.zIndex\"\n :class-name=\"props.className\"\n :style=\"props.style\"\n :class-names=\"props.classNames\"\n :styles=\"props.styles\"\n @hide=\"hide\"\n />\n </ContextMenuOverlay>\n </Portal>\n</template>\n","<script setup lang=\"ts\">\nimport { Portal } from '@mantine-vue/core'\nimport { useHotkeys, useWindowEvent } from '@mantine-vue/hooks'\nimport ContextMenu from '../ContextMenu/ContextMenu.vue'\nimport ContextMenuOverlay from '../ContextMenuOverlay/ContextMenuOverlay.vue'\nimport type { ContextMenuPortalEmits, ContextMenuPortalProps } from '../../types'\n\ndefineOptions({ name: 'ContextMenuPortal' })\nconst props = defineProps<ContextMenuPortalProps>()\nconst emit = defineEmits<ContextMenuPortalEmits>()\nconst hide = () => emit('hide')\nuseWindowEvent('resize', hide)\nuseWindowEvent('scroll', hide)\nuseHotkeys([['Escape', hide]])\n</script>\n\n<template>\n <Portal>\n <ContextMenuOverlay :z-index=\"props.zIndex\" @hide=\"hide\">\n <ContextMenu\n :x=\"props.x\"\n :y=\"props.y\"\n :content=\"props.content\"\n :dir=\"props.dir\"\n :z-index=\"props.zIndex\"\n :class-name=\"props.className\"\n :style=\"props.style\"\n :class-names=\"props.classNames\"\n :styles=\"props.styles\"\n @hide=\"hide\"\n />\n </ContextMenuOverlay>\n </Portal>\n</template>\n","<script setup lang=\"ts\">\nimport { computed, provide, shallowRef, toRef } from 'vue'\nimport { useDirection } from '@mantine-vue/core'\nimport ContextMenuPortal from '../ContextMenuPortal/ContextMenuPortal.vue'\nimport { ContextMenuKey, ContextMenuSettingsKey } from '../../context'\nimport type {\n ContextMenuInstanceOptions,\n ContextMenuOptions,\n ContextMenuProviderProps,\n ShowContextMenuFunction,\n} from '../../types'\n\ndefineOptions({ name: 'ContextMenuProvider' })\nconst props = withDefaults(defineProps<ContextMenuProviderProps>(), {\n zIndex: 9999,\n shadow: 'sm',\n borderRadius: 'xs',\n submenuDelay: 500,\n repositionOnRepeat: false,\n})\nconst data = shallowRef<(ContextMenuInstanceOptions & ContextMenuOptions) | null>(null)\nconst { dir } = useDirection()\n\nfunction hideContextMenu() {\n data.value = null\n}\n\nconst showContextMenu: ShowContextMenuFunction = (content, options) => (event) => {\n event.preventDefault()\n event.stopPropagation()\n const position =\n 'touches' in event\n ? { x: event.touches.item(0)!.clientX, y: event.touches.item(0)!.clientY }\n : { x: event.clientX, y: event.clientY }\n data.value = {\n ...position,\n content,\n zIndex: options?.zIndex || props.zIndex,\n className: options?.className,\n style: options?.style,\n classNames: options?.classNames,\n styles: options?.styles,\n }\n}\n\nprovide(\n ContextMenuSettingsKey,\n computed(() => ({\n shadow: props.shadow,\n borderRadius: props.borderRadius,\n submenuDelay: props.submenuDelay,\n repositionOnRepeat: props.repositionOnRepeat,\n })),\n)\nprovide(ContextMenuKey, {\n showContextMenu,\n hideContextMenu,\n isContextMenuVisible: toRef(() => Boolean(data.value)),\n})\n</script>\n\n<template>\n <slot />\n <ContextMenuPortal v-if=\"data\" v-bind=\"data\" :dir=\"dir\" @hide=\"hideContextMenu\" />\n</template>\n","<script setup lang=\"ts\">\nimport { computed, provide, shallowRef, toRef } from 'vue'\nimport { useDirection } from '@mantine-vue/core'\nimport ContextMenuPortal from '../ContextMenuPortal/ContextMenuPortal.vue'\nimport { ContextMenuKey, ContextMenuSettingsKey } from '../../context'\nimport type {\n ContextMenuInstanceOptions,\n ContextMenuOptions,\n ContextMenuProviderProps,\n ShowContextMenuFunction,\n} from '../../types'\n\ndefineOptions({ name: 'ContextMenuProvider' })\nconst props = withDefaults(defineProps<ContextMenuProviderProps>(), {\n zIndex: 9999,\n shadow: 'sm',\n borderRadius: 'xs',\n submenuDelay: 500,\n repositionOnRepeat: false,\n})\nconst data = shallowRef<(ContextMenuInstanceOptions & ContextMenuOptions) | null>(null)\nconst { dir } = useDirection()\n\nfunction hideContextMenu() {\n data.value = null\n}\n\nconst showContextMenu: ShowContextMenuFunction = (content, options) => (event) => {\n event.preventDefault()\n event.stopPropagation()\n const position =\n 'touches' in event\n ? { x: event.touches.item(0)!.clientX, y: event.touches.item(0)!.clientY }\n : { x: event.clientX, y: event.clientY }\n data.value = {\n ...position,\n content,\n zIndex: options?.zIndex || props.zIndex,\n className: options?.className,\n style: options?.style,\n classNames: options?.classNames,\n styles: options?.styles,\n }\n}\n\nprovide(\n ContextMenuSettingsKey,\n computed(() => ({\n shadow: props.shadow,\n borderRadius: props.borderRadius,\n submenuDelay: props.submenuDelay,\n repositionOnRepeat: props.repositionOnRepeat,\n })),\n)\nprovide(ContextMenuKey, {\n showContextMenu,\n hideContextMenu,\n isContextMenuVisible: toRef(() => Boolean(data.value)),\n})\n</script>\n\n<template>\n <slot />\n <ContextMenuPortal v-if=\"data\" v-bind=\"data\" :dir=\"dir\" @hide=\"hideContextMenu\" />\n</template>\n"],"mappings":";;;;;;AAIA,SAAgB,SAAS,OAAe;CACtC,MAAM,MAAM,MACT,QAAQ,sBAAsB,OAAO,EACrC,QAAQ,SAAS,GAAG,EACpB,KAAK,EACL,YAAY;CAEf,OAAO,GAAG,IAAI,OAAO,CAAC,EAAE,YAAY,IAAI,IAAI,MAAM,CAAC;AACrD;AAEA,SAAgB,wBACd,OACA,OAC0B;CAC1B,OAAO,OAAO,UAAU,aAAa,MAAM,KAAK,IAAI;AACtD;AAEA,SAAgB,yBACd,QACA,OACA;CACA,OAAO,OAAO,WAAW,aAAa,OAAO,KAAK,IAAI;AACxD;;;;;;;;;;;EClBA,MAAM,QAAQ;EACd,MAAM,SAAA,GAAA,kBAAA,iBAAwB;EAC9B,MAAM,iBAAA,GAAA,IAAA,gBAA+B,wBAAwB,MAAM,OAAO,MAAM,KAAK,CAAC;;oEAII,kBAAA,GAAA,GAAA;IAAlF,QAAA,GAAA,IAAA,gBAAK,CAAA,+BAAkC,MAAM,SAAS,CAAA;IAAI,QAAA,GAAA,IAAA,gBAAO,cAAA,KAAa;;;;;;;AEJtF,IAAa,yBAAyB,OAAO,qBAAqB;AAIlE,IAAa,iBAAiB,OAAO,aAAa;AAGlD,IAAM,WAAoC;CACxC,6BAA6B,KAAA;CAC7B,uBAAuB,KAAA;CACvB,uBAAA,GAAA,IAAA,WAAA,GAAA,IAAA,KAJ0B,KAAK,CAIT;AACxB;AAEA,SAAgB,iBAAiB;CAC/B,QAAA,GAAA,IAAA,QAAc,gBAAg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;IAChB,YAAY,SAAS;IACrB,QAAQ,SAAS;GACnB;EACF;EAEA,CAAA,GAAA,IAAA,SACE,yBAAA,GAAA,IAAA,iBACgB;GACd,QAAQ,MAAM;GACd,cAAc,MAAM;GACpB,cAAc,MAAM;GACpB,oBAAoB,MAAM;EAC5B,EAAE,CACJ;EACA,CAAA,GAAA,IAAA,SAAQ,gBAAgB;GACtB;GACA;GACA,uBAAA,GAAA,IAAA,aAAkC,QAAQ,KAAK,KAAK,CAAC;EACvD,CAAC;;qGAIS,KAAA,QAAA,SAAA,GACiB,KAAA,UAAA,GAAA,IAAA,WAAA,IAAA,GAAA,IAAA,aAAyD,4BAAA,GAAA,IAAA,YAAA,EAAA,KAAA,EAAA,GAA3C,KAAA,OAAI;IAAG,MAAA,GAAA,IAAA,OAAK,GAAA;IAAM,QAAM"}
1
+ {"version":3,"file":"index.cjs","names":[],"sources":["../src/utils.ts","../src/components/ContextMenuDivider/ContextMenuDivider.vue","../src/components/ContextMenuDivider/ContextMenuDivider.vue","../src/context.ts","../src/components/ContextMenuItem/ContextMenuItem.vue","../src/components/ContextMenuItem/ContextMenuItem.vue","../src/components/ContextMenu/ContextMenu.vue","../src/components/ContextMenu/ContextMenu.vue","../src/components/ContextMenuOverlay/ContextMenuOverlay.vue","../src/components/ContextMenuOverlay/ContextMenuOverlay.vue","../src/components/ContextMenuPortal/ContextMenuPortal.vue","../src/components/ContextMenuPortal/ContextMenuPortal.vue","../src/components/ContextMenuProvider/ContextMenuProvider.vue","../src/components/ContextMenuProvider/ContextMenuProvider.vue"],"sourcesContent":["import type { ContextMenuStyle, ContextMenuStyles } from './types'\nimport type { MantineStyle, MantineTheme } from '@mantine-vue/core'\n\n/** Returns a humanized version of a string, for example \"camelCase\" becomes \"Camel Case\". */\nexport function humanize(value: string) {\n const str = value\n .replace(/([a-z\\d])([A-Z]+)/g, '$1 $2')\n .replace(/\\W|_/g, ' ')\n .trim()\n .toLowerCase()\n\n return `${str.charAt(0).toUpperCase()}${str.slice(1)}`\n}\n\nexport function resolveContextMenuStyle(\n style: ContextMenuStyle | undefined,\n theme: MantineTheme,\n): MantineStyle | undefined {\n return typeof style === 'function' ? style(theme) : style\n}\n\nexport function resolveContextMenuStyles(\n styles: ContextMenuStyles | ((theme: MantineTheme) => ContextMenuStyles) | undefined,\n theme: MantineTheme,\n) {\n return typeof styles === 'function' ? styles(theme) : styles\n}\n","<script setup lang=\"ts\">\nimport { computed } from 'vue'\nimport { Box, useMantineTheme } from '@mantine-vue/core'\nimport { resolveContextMenuStyle } from '../../utils'\nimport type { ContextMenuDividerProps } from '../../types'\nimport '../../ContextMenuDivider.css'\n\ndefineOptions({ name: 'ContextMenuDivider' })\nconst props = defineProps<ContextMenuDividerProps>()\nconst theme = useMantineTheme()\nconst resolvedStyle = computed(() => resolveContextMenuStyle(props.style, theme.value))\n</script>\n\n<template>\n <Box :class=\"['mantine-contextmenu-divider', props.className]\" :style=\"resolvedStyle\" />\n</template>\n","<script setup lang=\"ts\">\nimport { computed } from 'vue'\nimport { Box, useMantineTheme } from '@mantine-vue/core'\nimport { resolveContextMenuStyle } from '../../utils'\nimport type { ContextMenuDividerProps } from '../../types'\nimport '../../ContextMenuDivider.css'\n\ndefineOptions({ name: 'ContextMenuDivider' })\nconst props = defineProps<ContextMenuDividerProps>()\nconst theme = useMantineTheme()\nconst resolvedStyle = computed(() => resolveContextMenuStyle(props.style, theme.value))\n</script>\n\n<template>\n <Box :class=\"['mantine-contextmenu-divider', props.className]\" :style=\"resolvedStyle\" />\n</template>\n","import { inject, readonly, ref, type InjectionKey, type Ref } from 'vue'\nimport type { ContextMenuContextValue, ContextMenuSettings } from './types'\n\nexport interface ResolvedContextMenuSettings {\n shadow: NonNullable<ContextMenuSettings['shadow']>\n borderRadius: NonNullable<ContextMenuSettings['borderRadius']>\n submenuDelay: number\n repositionOnRepeat: boolean\n}\n\nexport const ContextMenuSettingsKey = Symbol('ContextMenuSettings') as InjectionKey<\n Ref<ResolvedContextMenuSettings>\n>\n\nexport const ContextMenuKey = Symbol('ContextMenu') as InjectionKey<ContextMenuContextValue>\n\nconst hidden = readonly(ref(false))\nconst fallback: ContextMenuContextValue = {\n showContextMenu: () => () => undefined,\n hideContextMenu: () => undefined,\n isContextMenuVisible: hidden,\n}\n\nexport function useContextMenu() {\n return inject(ContextMenuKey, fallback)\n}\n\nexport function useContextMenuSettings() {\n return inject(ContextMenuSettingsKey, {\n value: {\n shadow: 'sm',\n borderRadius: 'xs',\n submenuDelay: 500,\n repositionOnRepeat: false,\n },\n } as Ref<ResolvedContextMenuSettings>)\n}\n","<script setup lang=\"ts\">\nimport { computed, ref, useSlots } from 'vue'\nimport {\n Box,\n UnstyledButton,\n parseThemeColor,\n resolveNode,\n rgba,\n useMantineTheme,\n} from '@mantine-vue/core'\nimport { useMediaQuery, useTimeout } from '@mantine-vue/hooks'\nimport ContextMenu from '../ContextMenu/ContextMenu.vue'\nimport { useContextMenuSettings } from '../../context'\nimport { resolveContextMenuStyle } from '../../utils'\nimport type { ContextMenuItemEmits, ContextMenuItemProps } from '../../types'\nimport '../../ContextMenuItem.css'\n\ndefineOptions({ name: 'ContextMenuItem' })\nconst props = withDefaults(defineProps<ContextMenuItemProps>(), { disabled: false })\nconst emit = defineEmits<ContextMenuItemEmits>()\nconst slots = useSlots()\nconst button = ref<HTMLElement | null>(null)\nconst submenuPosition = ref<{ x: number; y: number } | null>(null)\nconst settings = useContextMenuSettings()\nconst theme = useMantineTheme()\nconst hoverAvailable = useMediaQuery('(hover: hover)')\nconst hasSubmenu = computed(() => Boolean(props.items && !props.disabled))\nconst parsedColor = computed(() =>\n props.color ? parseThemeColor({ color: props.color, theme: theme.value }) : null,\n)\nconst itemStyle = computed(() => {\n const color = parsedColor.value?.value\n return {\n '--mantine-contextmenu-item-button-color': color ?? 'var(--mantine-color-text)',\n '--mantine-contextmenu-item-button-hover-bg-color-light': color\n ? rgba(color, 0.08)\n : rgba(theme.value.colors.gray[4], 0.25),\n '--mantine-contextmenu-item-button-hover-bg-color-dark': color\n ? rgba(color, 0.15)\n : rgba(theme.value.colors.dark[3], 0.25),\n '--mantine-contextmenu-item-button-pressed-bg-color-light': color\n ? rgba(color, 0.2)\n : rgba(theme.value.colors.gray[4], 0.5),\n '--mantine-contextmenu-item-button-pressed-bg-color-dark': color\n ? rgba(color, 0.3)\n : rgba(theme.value.colors.dark[3], 0.5),\n ...resolveContextMenuStyle(props.style, theme.value),\n }\n})\nconst icon = computed(() => resolveNode(props.icon, slots.icon))\nconst title = computed(() => resolveNode(props.title, slots.title))\nconst iconRight = computed(() => resolveNode(props.iconRight, slots.iconRight))\nconst renderIcon = () => icon.value\nconst renderTitle = () => title.value\nconst renderIconRight = () => iconRight.value\n\nconst showSubmenuTimeout = useTimeout(() => {\n if (!button.value) return\n const rect = button.value.getBoundingClientRect()\n submenuPosition.value = {\n x: (props.submenuProps.dir || 'ltr') === 'ltr' ? rect.right : rect.left,\n y: rect.top,\n }\n}, settings.value.submenuDelay)\nconst hideSubmenuTimeout = useTimeout(\n () => (submenuPosition.value = null),\n settings.value.submenuDelay,\n)\n\nfunction showSubmenu() {\n hideSubmenuTimeout.clear()\n showSubmenuTimeout.start()\n}\nfunction hideSubmenu() {\n showSubmenuTimeout.clear()\n hideSubmenuTimeout.start()\n}\nfunction mouseenter() {\n if (hasSubmenu.value && hoverAvailable.value) showSubmenu()\n}\nfunction mouseleave() {\n if (hasSubmenu.value && hoverAvailable.value) hideSubmenu()\n}\nfunction click(event: MouseEvent) {\n if (hasSubmenu.value) {\n event.stopPropagation()\n showSubmenu()\n } else if (props.onClick) {\n emit('hide')\n props.onClick(event)\n }\n}\n</script>\n\n<template>\n <div @mouseenter=\"mouseenter\" @mouseleave=\"mouseleave\">\n <UnstyledButton\n :ref=\"(node: any) => (button = node?.$el ?? node ?? null)\"\n :dir=\"props.submenuProps.dir || 'ltr'\"\n :class=\"['mantine-contextmenu-item-button', props.className]\"\n :disabled=\"props.disabled\"\n :style=\"itemStyle\"\n @click=\"click\"\n >\n <Box v-if=\"icon\" :fz=\"0\" me=\"xs\" :mt=\"-2\"><component :is=\"renderIcon\" /></Box>\n <div class=\"mantine-contextmenu-item-button-title\"><component :is=\"renderTitle\" /></div>\n <Box v-if=\"iconRight\" :fz=\"0\" ms=\"xs\" :mt=\"-2\"><component :is=\"renderIconRight\" /></Box>\n <Box v-else-if=\"props.items\" :mt=\"-1\" ms=\"xs\">\n {{ (props.submenuProps.dir || 'ltr') === 'rtl' ? '‹' : '›' }}\n </Box>\n </UnstyledButton>\n <ContextMenu\n v-if=\"submenuPosition && props.items\"\n v-bind=\"props.submenuProps\"\n :x=\"submenuPosition.x\"\n :y=\"submenuPosition.y\"\n :content=\"props.items\"\n :dir=\"props.submenuProps.dir || 'ltr'\"\n @hide=\"emit('hide')\"\n />\n </div>\n</template>\n","<script setup lang=\"ts\">\nimport { computed, ref, useSlots } from 'vue'\nimport {\n Box,\n UnstyledButton,\n parseThemeColor,\n resolveNode,\n rgba,\n useMantineTheme,\n} from '@mantine-vue/core'\nimport { useMediaQuery, useTimeout } from '@mantine-vue/hooks'\nimport ContextMenu from '../ContextMenu/ContextMenu.vue'\nimport { useContextMenuSettings } from '../../context'\nimport { resolveContextMenuStyle } from '../../utils'\nimport type { ContextMenuItemEmits, ContextMenuItemProps } from '../../types'\nimport '../../ContextMenuItem.css'\n\ndefineOptions({ name: 'ContextMenuItem' })\nconst props = withDefaults(defineProps<ContextMenuItemProps>(), { disabled: false })\nconst emit = defineEmits<ContextMenuItemEmits>()\nconst slots = useSlots()\nconst button = ref<HTMLElement | null>(null)\nconst submenuPosition = ref<{ x: number; y: number } | null>(null)\nconst settings = useContextMenuSettings()\nconst theme = useMantineTheme()\nconst hoverAvailable = useMediaQuery('(hover: hover)')\nconst hasSubmenu = computed(() => Boolean(props.items && !props.disabled))\nconst parsedColor = computed(() =>\n props.color ? parseThemeColor({ color: props.color, theme: theme.value }) : null,\n)\nconst itemStyle = computed(() => {\n const color = parsedColor.value?.value\n return {\n '--mantine-contextmenu-item-button-color': color ?? 'var(--mantine-color-text)',\n '--mantine-contextmenu-item-button-hover-bg-color-light': color\n ? rgba(color, 0.08)\n : rgba(theme.value.colors.gray[4], 0.25),\n '--mantine-contextmenu-item-button-hover-bg-color-dark': color\n ? rgba(color, 0.15)\n : rgba(theme.value.colors.dark[3], 0.25),\n '--mantine-contextmenu-item-button-pressed-bg-color-light': color\n ? rgba(color, 0.2)\n : rgba(theme.value.colors.gray[4], 0.5),\n '--mantine-contextmenu-item-button-pressed-bg-color-dark': color\n ? rgba(color, 0.3)\n : rgba(theme.value.colors.dark[3], 0.5),\n ...resolveContextMenuStyle(props.style, theme.value),\n }\n})\nconst icon = computed(() => resolveNode(props.icon, slots.icon))\nconst title = computed(() => resolveNode(props.title, slots.title))\nconst iconRight = computed(() => resolveNode(props.iconRight, slots.iconRight))\nconst renderIcon = () => icon.value\nconst renderTitle = () => title.value\nconst renderIconRight = () => iconRight.value\n\nconst showSubmenuTimeout = useTimeout(() => {\n if (!button.value) return\n const rect = button.value.getBoundingClientRect()\n submenuPosition.value = {\n x: (props.submenuProps.dir || 'ltr') === 'ltr' ? rect.right : rect.left,\n y: rect.top,\n }\n}, settings.value.submenuDelay)\nconst hideSubmenuTimeout = useTimeout(\n () => (submenuPosition.value = null),\n settings.value.submenuDelay,\n)\n\nfunction showSubmenu() {\n hideSubmenuTimeout.clear()\n showSubmenuTimeout.start()\n}\nfunction hideSubmenu() {\n showSubmenuTimeout.clear()\n hideSubmenuTimeout.start()\n}\nfunction mouseenter() {\n if (hasSubmenu.value && hoverAvailable.value) showSubmenu()\n}\nfunction mouseleave() {\n if (hasSubmenu.value && hoverAvailable.value) hideSubmenu()\n}\nfunction click(event: MouseEvent) {\n if (hasSubmenu.value) {\n event.stopPropagation()\n showSubmenu()\n } else if (props.onClick) {\n emit('hide')\n props.onClick(event)\n }\n}\n</script>\n\n<template>\n <div @mouseenter=\"mouseenter\" @mouseleave=\"mouseleave\">\n <UnstyledButton\n :ref=\"(node: any) => (button = node?.$el ?? node ?? null)\"\n :dir=\"props.submenuProps.dir || 'ltr'\"\n :class=\"['mantine-contextmenu-item-button', props.className]\"\n :disabled=\"props.disabled\"\n :style=\"itemStyle\"\n @click=\"click\"\n >\n <Box v-if=\"icon\" :fz=\"0\" me=\"xs\" :mt=\"-2\"><component :is=\"renderIcon\" /></Box>\n <div class=\"mantine-contextmenu-item-button-title\"><component :is=\"renderTitle\" /></div>\n <Box v-if=\"iconRight\" :fz=\"0\" ms=\"xs\" :mt=\"-2\"><component :is=\"renderIconRight\" /></Box>\n <Box v-else-if=\"props.items\" :mt=\"-1\" ms=\"xs\">\n {{ (props.submenuProps.dir || 'ltr') === 'rtl' ? '‹' : '›' }}\n </Box>\n </UnstyledButton>\n <ContextMenu\n v-if=\"submenuPosition && props.items\"\n v-bind=\"props.submenuProps\"\n :x=\"submenuPosition.x\"\n :y=\"submenuPosition.y\"\n :content=\"props.items\"\n :dir=\"props.submenuProps.dir || 'ltr'\"\n @hide=\"emit('hide')\"\n />\n </div>\n</template>\n","<script setup lang=\"ts\">\nimport { computed, onBeforeUnmount, ref, watch } from 'vue'\nimport { Paper, px, useMantineTheme, type MantineRadius } from '@mantine-vue/core'\nimport { useResizeObserver } from '@mantine-vue/hooks'\nimport ContextMenuDivider from '../ContextMenuDivider/ContextMenuDivider.vue'\nimport ContextMenuItem from '../ContextMenuItem/ContextMenuItem.vue'\nimport { useContextMenuSettings } from '../../context'\nimport { humanize, resolveContextMenuStyle, resolveContextMenuStyles } from '../../utils'\nimport type { ContextMenuEmits, ContextMenuItemOptions, ContextMenuProps } from '../../types'\nimport '../../ContextMenu.css'\n\ndefineOptions({ name: 'ContextMenu' })\nconst props = withDefaults(defineProps<ContextMenuProps>(), { dir: 'ltr' })\nconst emit = defineEmits<ContextMenuEmits>()\nconst settings = useContextMenuSettings()\nconst theme = useMantineTheme()\nconst { ref: menuRef, rect } = useResizeObserver<HTMLElement>()\nconst mounted = ref(false)\nlet frameId = 0\n\nwatch(\n () => [rect.value.width, rect.value.height],\n ([width, height]) => {\n if (width > 0 && height > 0) {\n cancelAnimationFrame(frameId)\n frameId = requestAnimationFrame(() => (mounted.value = true))\n }\n },\n { immediate: true },\n)\nonBeforeUnmount(() => cancelAnimationFrame(frameId))\n\nconst position = computed(() => {\n const spacing = px(theme.value.spacing.md)\n const windowWidth = typeof window === 'undefined' ? 0 : window.innerWidth\n const windowHeight = typeof window === 'undefined' ? 0 : window.innerHeight\n const top =\n props.y + rect.value.height + spacing > windowHeight\n ? windowHeight - rect.value.height - spacing\n : props.y\n const left =\n props.dir === 'rtl'\n ? props.x - rect.value.width < spacing\n ? spacing\n : props.x - rect.value.width\n : props.x + rect.value.width + spacing > windowWidth\n ? windowWidth - rect.value.width - spacing\n : props.x\n return { zIndex: props.zIndex, top: `${top}px`, left: `${left}px` }\n})\nconst resolvedStyles = computed(() => resolveContextMenuStyles(props.styles, theme.value))\nconst rootStyle = computed(() => ({\n ...position.value,\n ...resolveContextMenuStyle(props.style, theme.value),\n ...resolveContextMenuStyle(resolvedStyles.value?.root, theme.value),\n}))\nconst submenuProps = computed(() => ({\n className: props.className,\n style: props.style,\n classNames: props.classNames,\n styles: props.styles,\n dir: props.dir,\n}))\n\nfunction itemClass(item: ContextMenuItemOptions, part: 'item' | 'divider') {\n return [props.classNames?.[part], item.className].filter(Boolean).join(' ')\n}\nfunction itemStyle(item: ContextMenuItemOptions, part: 'item' | 'divider') {\n return {\n ...resolveContextMenuStyle(resolvedStyles.value?.[part], theme.value),\n ...resolveContextMenuStyle(item.style, theme.value),\n }\n}\nconst renderCustomContent = () =>\n typeof props.content === 'function' ? props.content(() => emit('hide')) : null\n</script>\n\n<template>\n <Paper\n :ref=\"(node: any) => (menuRef = node?.$el ?? node ?? null)\"\n :shadow=\"settings.shadow\"\n :radius=\"settings.borderRadius as MantineRadius\"\n :dir=\"props.dir\"\n :class=\"[\n 'mantine-contextmenu',\n mounted && 'mantine-contextmenu-mounted',\n props.className,\n props.classNames?.root,\n ]\"\n :style=\"rootStyle\"\n >\n <component v-if=\"typeof props.content === 'function'\" :is=\"renderCustomContent\" />\n <template v-else>\n <template v-for=\"item in props.content\" :key=\"item.key\">\n <ContextMenuItem\n v-if=\"!item.hidden && (item.onClick || item.items)\"\n :class-name=\"itemClass(item, 'item')\"\n :style=\"itemStyle(item, 'item')\"\n :title=\"item.title ?? humanize(item.key)\"\n :icon=\"item.icon\"\n :icon-right=\"item.iconRight\"\n :color=\"item.color\"\n :disabled=\"item.disabled\"\n :on-click=\"item.onClick\"\n :items=\"item.items\"\n :submenu-props=\"submenuProps\"\n @hide=\"emit('hide')\"\n />\n <ContextMenuDivider\n v-else-if=\"!item.hidden\"\n :class-name=\"itemClass(item, 'divider')\"\n :style=\"itemStyle(item, 'divider')\"\n />\n </template>\n </template>\n </Paper>\n</template>\n","<script setup lang=\"ts\">\nimport { computed, onBeforeUnmount, ref, watch } from 'vue'\nimport { Paper, px, useMantineTheme, type MantineRadius } from '@mantine-vue/core'\nimport { useResizeObserver } from '@mantine-vue/hooks'\nimport ContextMenuDivider from '../ContextMenuDivider/ContextMenuDivider.vue'\nimport ContextMenuItem from '../ContextMenuItem/ContextMenuItem.vue'\nimport { useContextMenuSettings } from '../../context'\nimport { humanize, resolveContextMenuStyle, resolveContextMenuStyles } from '../../utils'\nimport type { ContextMenuEmits, ContextMenuItemOptions, ContextMenuProps } from '../../types'\nimport '../../ContextMenu.css'\n\ndefineOptions({ name: 'ContextMenu' })\nconst props = withDefaults(defineProps<ContextMenuProps>(), { dir: 'ltr' })\nconst emit = defineEmits<ContextMenuEmits>()\nconst settings = useContextMenuSettings()\nconst theme = useMantineTheme()\nconst { ref: menuRef, rect } = useResizeObserver<HTMLElement>()\nconst mounted = ref(false)\nlet frameId = 0\n\nwatch(\n () => [rect.value.width, rect.value.height],\n ([width, height]) => {\n if (width > 0 && height > 0) {\n cancelAnimationFrame(frameId)\n frameId = requestAnimationFrame(() => (mounted.value = true))\n }\n },\n { immediate: true },\n)\nonBeforeUnmount(() => cancelAnimationFrame(frameId))\n\nconst position = computed(() => {\n const spacing = px(theme.value.spacing.md)\n const windowWidth = typeof window === 'undefined' ? 0 : window.innerWidth\n const windowHeight = typeof window === 'undefined' ? 0 : window.innerHeight\n const top =\n props.y + rect.value.height + spacing > windowHeight\n ? windowHeight - rect.value.height - spacing\n : props.y\n const left =\n props.dir === 'rtl'\n ? props.x - rect.value.width < spacing\n ? spacing\n : props.x - rect.value.width\n : props.x + rect.value.width + spacing > windowWidth\n ? windowWidth - rect.value.width - spacing\n : props.x\n return { zIndex: props.zIndex, top: `${top}px`, left: `${left}px` }\n})\nconst resolvedStyles = computed(() => resolveContextMenuStyles(props.styles, theme.value))\nconst rootStyle = computed(() => ({\n ...position.value,\n ...resolveContextMenuStyle(props.style, theme.value),\n ...resolveContextMenuStyle(resolvedStyles.value?.root, theme.value),\n}))\nconst submenuProps = computed(() => ({\n className: props.className,\n style: props.style,\n classNames: props.classNames,\n styles: props.styles,\n dir: props.dir,\n}))\n\nfunction itemClass(item: ContextMenuItemOptions, part: 'item' | 'divider') {\n return [props.classNames?.[part], item.className].filter(Boolean).join(' ')\n}\nfunction itemStyle(item: ContextMenuItemOptions, part: 'item' | 'divider') {\n return {\n ...resolveContextMenuStyle(resolvedStyles.value?.[part], theme.value),\n ...resolveContextMenuStyle(item.style, theme.value),\n }\n}\nconst renderCustomContent = () =>\n typeof props.content === 'function' ? props.content(() => emit('hide')) : null\n</script>\n\n<template>\n <Paper\n :ref=\"(node: any) => (menuRef = node?.$el ?? node ?? null)\"\n :shadow=\"settings.shadow\"\n :radius=\"settings.borderRadius as MantineRadius\"\n :dir=\"props.dir\"\n :class=\"[\n 'mantine-contextmenu',\n mounted && 'mantine-contextmenu-mounted',\n props.className,\n props.classNames?.root,\n ]\"\n :style=\"rootStyle\"\n >\n <component v-if=\"typeof props.content === 'function'\" :is=\"renderCustomContent\" />\n <template v-else>\n <template v-for=\"item in props.content\" :key=\"item.key\">\n <ContextMenuItem\n v-if=\"!item.hidden && (item.onClick || item.items)\"\n :class-name=\"itemClass(item, 'item')\"\n :style=\"itemStyle(item, 'item')\"\n :title=\"item.title ?? humanize(item.key)\"\n :icon=\"item.icon\"\n :icon-right=\"item.iconRight\"\n :color=\"item.color\"\n :disabled=\"item.disabled\"\n :on-click=\"item.onClick\"\n :items=\"item.items\"\n :submenu-props=\"submenuProps\"\n @hide=\"emit('hide')\"\n />\n <ContextMenuDivider\n v-else-if=\"!item.hidden\"\n :class-name=\"itemClass(item, 'divider')\"\n :style=\"itemStyle(item, 'divider')\"\n />\n </template>\n </template>\n </Paper>\n</template>\n","<script setup lang=\"ts\">\nimport { useContextMenuSettings } from '../../context'\nimport type { ContextMenuOverlayEmits } from '../../types'\nimport '../../ContextMenuOverlay.css'\n\ndefineOptions({ name: 'ContextMenuOverlay' })\nconst props = defineProps<{ zIndex?: number }>()\nconst emit = defineEmits<ContextMenuOverlayEmits>()\nconst settings = useContextMenuSettings()\n\nfunction click(event: MouseEvent) {\n event.preventDefault()\n emit('hide')\n}\n\nfunction contextmenu(event: MouseEvent) {\n event.preventDefault()\n if (!settings.value.repositionOnRepeat) {\n emit('hide')\n return\n }\n try {\n document.elementsFromPoint(event.clientX, event.clientY)[1]?.dispatchEvent(\n new MouseEvent('contextmenu', {\n bubbles: true,\n clientX: event.clientX,\n clientY: event.clientY,\n }),\n )\n } catch {\n // The target may disappear while the event is dispatched.\n }\n}\n</script>\n\n<template>\n <div\n class=\"mantine-contextmenu-overlay\"\n :style=\"{ zIndex: props.zIndex }\"\n @click=\"click\"\n @contextmenu=\"contextmenu\"\n >\n <slot />\n </div>\n</template>\n","<script setup lang=\"ts\">\nimport { useContextMenuSettings } from '../../context'\nimport type { ContextMenuOverlayEmits } from '../../types'\nimport '../../ContextMenuOverlay.css'\n\ndefineOptions({ name: 'ContextMenuOverlay' })\nconst props = defineProps<{ zIndex?: number }>()\nconst emit = defineEmits<ContextMenuOverlayEmits>()\nconst settings = useContextMenuSettings()\n\nfunction click(event: MouseEvent) {\n event.preventDefault()\n emit('hide')\n}\n\nfunction contextmenu(event: MouseEvent) {\n event.preventDefault()\n if (!settings.value.repositionOnRepeat) {\n emit('hide')\n return\n }\n try {\n document.elementsFromPoint(event.clientX, event.clientY)[1]?.dispatchEvent(\n new MouseEvent('contextmenu', {\n bubbles: true,\n clientX: event.clientX,\n clientY: event.clientY,\n }),\n )\n } catch {\n // The target may disappear while the event is dispatched.\n }\n}\n</script>\n\n<template>\n <div\n class=\"mantine-contextmenu-overlay\"\n :style=\"{ zIndex: props.zIndex }\"\n @click=\"click\"\n @contextmenu=\"contextmenu\"\n >\n <slot />\n </div>\n</template>\n","<script setup lang=\"ts\">\nimport { Portal } from '@mantine-vue/core'\nimport { useHotkeys, useWindowEvent } from '@mantine-vue/hooks'\nimport ContextMenu from '../ContextMenu/ContextMenu.vue'\nimport ContextMenuOverlay from '../ContextMenuOverlay/ContextMenuOverlay.vue'\nimport type { ContextMenuPortalEmits, ContextMenuPortalProps } from '../../types'\n\ndefineOptions({ name: 'ContextMenuPortal' })\nconst props = defineProps<ContextMenuPortalProps>()\nconst emit = defineEmits<ContextMenuPortalEmits>()\nconst hide = () => emit('hide')\nuseWindowEvent('resize', hide)\nuseWindowEvent('scroll', hide)\nuseHotkeys([['Escape', hide]])\n</script>\n\n<template>\n <Portal>\n <ContextMenuOverlay :z-index=\"props.zIndex\" @hide=\"hide\">\n <ContextMenu\n :x=\"props.x\"\n :y=\"props.y\"\n :content=\"props.content\"\n :dir=\"props.dir\"\n :z-index=\"props.zIndex\"\n :class-name=\"props.className\"\n :style=\"props.style\"\n :class-names=\"props.classNames\"\n :styles=\"props.styles\"\n @hide=\"hide\"\n />\n </ContextMenuOverlay>\n </Portal>\n</template>\n","<script setup lang=\"ts\">\nimport { Portal } from '@mantine-vue/core'\nimport { useHotkeys, useWindowEvent } from '@mantine-vue/hooks'\nimport ContextMenu from '../ContextMenu/ContextMenu.vue'\nimport ContextMenuOverlay from '../ContextMenuOverlay/ContextMenuOverlay.vue'\nimport type { ContextMenuPortalEmits, ContextMenuPortalProps } from '../../types'\n\ndefineOptions({ name: 'ContextMenuPortal' })\nconst props = defineProps<ContextMenuPortalProps>()\nconst emit = defineEmits<ContextMenuPortalEmits>()\nconst hide = () => emit('hide')\nuseWindowEvent('resize', hide)\nuseWindowEvent('scroll', hide)\nuseHotkeys([['Escape', hide]])\n</script>\n\n<template>\n <Portal>\n <ContextMenuOverlay :z-index=\"props.zIndex\" @hide=\"hide\">\n <ContextMenu\n :x=\"props.x\"\n :y=\"props.y\"\n :content=\"props.content\"\n :dir=\"props.dir\"\n :z-index=\"props.zIndex\"\n :class-name=\"props.className\"\n :style=\"props.style\"\n :class-names=\"props.classNames\"\n :styles=\"props.styles\"\n @hide=\"hide\"\n />\n </ContextMenuOverlay>\n </Portal>\n</template>\n","<script setup lang=\"ts\">\nimport { computed, provide, shallowRef, toRef } from 'vue'\nimport { useDirection } from '@mantine-vue/core'\nimport ContextMenuPortal from '../ContextMenuPortal/ContextMenuPortal.vue'\nimport { ContextMenuKey, ContextMenuSettingsKey } from '../../context'\nimport type {\n ContextMenuInstanceOptions,\n ContextMenuOptions,\n ContextMenuProviderProps,\n ShowContextMenuFunction,\n} from '../../types'\n\ndefineOptions({ name: 'ContextMenuProvider' })\nconst props = withDefaults(defineProps<ContextMenuProviderProps>(), {\n zIndex: 9999,\n shadow: 'sm',\n borderRadius: 'xs',\n submenuDelay: 500,\n repositionOnRepeat: false,\n})\nconst data = shallowRef<(ContextMenuInstanceOptions & ContextMenuOptions) | null>(null)\nconst { dir } = useDirection()\n\nfunction hideContextMenu() {\n data.value = null\n}\n\nconst showContextMenu: ShowContextMenuFunction = (content, options) => (event) => {\n event.preventDefault()\n event.stopPropagation()\n const position =\n 'touches' in event\n ? { x: event.touches.item(0)!.clientX, y: event.touches.item(0)!.clientY }\n : { x: event.clientX, y: event.clientY }\n data.value = {\n ...position,\n content,\n zIndex: options?.zIndex || props.zIndex,\n className: options?.className,\n style: options?.style,\n classNames: options?.classNames,\n styles: options?.styles,\n }\n}\n\nprovide(\n ContextMenuSettingsKey,\n computed(() => ({\n shadow: props.shadow,\n borderRadius: props.borderRadius,\n submenuDelay: props.submenuDelay,\n repositionOnRepeat: props.repositionOnRepeat,\n })),\n)\nprovide(ContextMenuKey, {\n showContextMenu,\n hideContextMenu,\n isContextMenuVisible: toRef(() => Boolean(data.value)),\n})\n</script>\n\n<template>\n <slot />\n <ContextMenuPortal v-if=\"data\" v-bind=\"data\" :dir=\"dir\" @hide=\"hideContextMenu\" />\n</template>\n","<script setup lang=\"ts\">\nimport { computed, provide, shallowRef, toRef } from 'vue'\nimport { useDirection } from '@mantine-vue/core'\nimport ContextMenuPortal from '../ContextMenuPortal/ContextMenuPortal.vue'\nimport { ContextMenuKey, ContextMenuSettingsKey } from '../../context'\nimport type {\n ContextMenuInstanceOptions,\n ContextMenuOptions,\n ContextMenuProviderProps,\n ShowContextMenuFunction,\n} from '../../types'\n\ndefineOptions({ name: 'ContextMenuProvider' })\nconst props = withDefaults(defineProps<ContextMenuProviderProps>(), {\n zIndex: 9999,\n shadow: 'sm',\n borderRadius: 'xs',\n submenuDelay: 500,\n repositionOnRepeat: false,\n})\nconst data = shallowRef<(ContextMenuInstanceOptions & ContextMenuOptions) | null>(null)\nconst { dir } = useDirection()\n\nfunction hideContextMenu() {\n data.value = null\n}\n\nconst showContextMenu: ShowContextMenuFunction = (content, options) => (event) => {\n event.preventDefault()\n event.stopPropagation()\n const position =\n 'touches' in event\n ? { x: event.touches.item(0)!.clientX, y: event.touches.item(0)!.clientY }\n : { x: event.clientX, y: event.clientY }\n data.value = {\n ...position,\n content,\n zIndex: options?.zIndex || props.zIndex,\n className: options?.className,\n style: options?.style,\n classNames: options?.classNames,\n styles: options?.styles,\n }\n}\n\nprovide(\n ContextMenuSettingsKey,\n computed(() => ({\n shadow: props.shadow,\n borderRadius: props.borderRadius,\n submenuDelay: props.submenuDelay,\n repositionOnRepeat: props.repositionOnRepeat,\n })),\n)\nprovide(ContextMenuKey, {\n showContextMenu,\n hideContextMenu,\n isContextMenuVisible: toRef(() => Boolean(data.value)),\n})\n</script>\n\n<template>\n <slot />\n <ContextMenuPortal v-if=\"data\" v-bind=\"data\" :dir=\"dir\" @hide=\"hideContextMenu\" />\n</template>\n"],"mappings":";;;;;;AAIA,SAAgB,SAAS,OAAe;CACtC,MAAM,MAAM,MACT,QAAQ,sBAAsB,OAAO,EACrC,QAAQ,SAAS,GAAG,EACpB,KAAK,EACL,YAAY;CAEf,OAAO,GAAG,IAAI,OAAO,CAAC,EAAE,YAAY,IAAI,IAAI,MAAM,CAAC;AACrD;AAEA,SAAgB,wBACd,OACA,OAC0B;CAC1B,OAAO,OAAO,UAAU,aAAa,MAAM,KAAK,IAAI;AACtD;AAEA,SAAgB,yBACd,QACA,OACA;CACA,OAAO,OAAO,WAAW,aAAa,OAAO,KAAK,IAAI;AACxD;;;;;;;;;;;EClBA,MAAM,QAAQ;EACd,MAAM,SAAA,GAAA,kBAAA,iBAAwB;EAC9B,MAAM,iBAAA,GAAA,IAAA,gBAA+B,wBAAwB,MAAM,OAAO,MAAM,KAAK,CAAC;;oEAII,kBAAA,GAAA,GAAA;IAAlF,QAAA,GAAA,IAAA,gBAAK,CAAA,+BAAkC,MAAM,SAAS,CAAA;IAAI,QAAA,GAAA,IAAA,gBAAO,cAAA,KAAa;;;;;;;AEJtF,IAAa,yBAAyB,OAAO,qBAAqB;AAIlE,IAAa,iBAAiB,OAAO,aAAa;AAGlD,IAAM,WAAoC;CACxC,6BAA6B,KAAA;CAC7B,uBAAuB,KAAA;CACvB,uBAAA,GAAA,IAAA,WAAA,GAAA,IAAA,KAJ0B,KAAK,CAIT;AACxB;AAEA,SAAgB,iBAAiB;CAC/B,QAAA,GAAA,IAAA,QAAc,gBAAgB,QAAQ;AACxC;AAEA,SAAgB,yBAAyB;CACvC,QAAA,GAAA,IAAA,QAAc,wBAAwB,EACpC,OAAO;EACL,QAAQ;EACR,cAAc;EAC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,GAAA,IAAA,iBACgB;GACd,QAAQ,MAAM;GACd,cAAc,MAAM;GACpB,cAAc,MAAM;GACpB,oBAAoB,MAAM;EAC5B,EAAE,CACJ;EACA,CAAA,GAAA,IAAA,SAAQ,gBAAgB;GACtB;GACA;GACA,uBAAA,GAAA,IAAA,aAAkC,QAAQ,KAAK,KAAK,CAAC;EACvD,CAAC;;qGAIS,KAAA,QAAA,SAAA,GACiB,KAAA,UAAA,GAAA,IAAA,WAAA,IAAA,GAAA,IAAA,aAAyD,4BAAA,GAAA,IAAA,YAAA,EAAA,KAAA,EAAA,GAA3C,KAAA,OAAI;IAAG,MAAA,GAAA,IAAA,OAAK,GAAA;IAAM,QAAM"}
package/esm/index.mjs CHANGED
@@ -66,9 +66,33 @@ var ContextMenuItem_default = /* @__PURE__ */ defineComponent({
66
66
  className: {},
67
67
  style: {},
68
68
  hidden: { type: Boolean },
69
- icon: {},
70
- iconRight: {},
71
- title: {},
69
+ icon: { type: [
70
+ Object,
71
+ String,
72
+ Number,
73
+ Boolean,
74
+ null,
75
+ Array,
76
+ Function
77
+ ] },
78
+ iconRight: { type: [
79
+ Object,
80
+ String,
81
+ Number,
82
+ Boolean,
83
+ null,
84
+ Array,
85
+ Function
86
+ ] },
87
+ title: { type: [
88
+ Object,
89
+ String,
90
+ Number,
91
+ Boolean,
92
+ null,
93
+ Array,
94
+ Function
95
+ ] },
72
96
  color: {},
73
97
  disabled: {
74
98
  type: Boolean,
package/esm/index.mjs.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"file":"index.mjs","names":[],"sources":["../src/utils.ts","../src/components/ContextMenuDivider/ContextMenuDivider.vue","../src/components/ContextMenuDivider/ContextMenuDivider.vue","../src/context.ts","../src/components/ContextMenuItem/ContextMenuItem.vue","../src/components/ContextMenuItem/ContextMenuItem.vue","../src/components/ContextMenu/ContextMenu.vue","../src/components/ContextMenu/ContextMenu.vue","../src/components/ContextMenuOverlay/ContextMenuOverlay.vue","../src/components/ContextMenuOverlay/ContextMenuOverlay.vue","../src/components/ContextMenuPortal/ContextMenuPortal.vue","../src/components/ContextMenuPortal/ContextMenuPortal.vue","../src/components/ContextMenuProvider/ContextMenuProvider.vue","../src/components/ContextMenuProvider/ContextMenuProvider.vue"],"sourcesContent":["import type { ContextMenuStyle, ContextMenuStyles } from './types'\nimport type { MantineStyle, MantineTheme } from '@mantine-vue/core'\n\n/** Returns a humanized version of a string, for example \"camelCase\" becomes \"Camel Case\". */\nexport function humanize(value: string) {\n const str = value\n .replace(/([a-z\\d])([A-Z]+)/g, '$1 $2')\n .replace(/\\W|_/g, ' ')\n .trim()\n .toLowerCase()\n\n return `${str.charAt(0).toUpperCase()}${str.slice(1)}`\n}\n\nexport function resolveContextMenuStyle(\n style: ContextMenuStyle | undefined,\n theme: MantineTheme,\n): MantineStyle | undefined {\n return typeof style === 'function' ? style(theme) : style\n}\n\nexport function resolveContextMenuStyles(\n styles: ContextMenuStyles | ((theme: MantineTheme) => ContextMenuStyles) | undefined,\n theme: MantineTheme,\n) {\n return typeof styles === 'function' ? styles(theme) : styles\n}\n","<script setup lang=\"ts\">\nimport { computed } from 'vue'\nimport { Box, useMantineTheme } from '@mantine-vue/core'\nimport { resolveContextMenuStyle } from '../../utils'\nimport type { ContextMenuDividerProps } from '../../types'\nimport '../../ContextMenuDivider.css'\n\ndefineOptions({ name: 'ContextMenuDivider' })\nconst props = defineProps<ContextMenuDividerProps>()\nconst theme = useMantineTheme()\nconst resolvedStyle = computed(() => resolveContextMenuStyle(props.style, theme.value))\n</script>\n\n<template>\n <Box :class=\"['mantine-contextmenu-divider', props.className]\" :style=\"resolvedStyle\" />\n</template>\n","<script setup lang=\"ts\">\nimport { computed } from 'vue'\nimport { Box, useMantineTheme } from '@mantine-vue/core'\nimport { resolveContextMenuStyle } from '../../utils'\nimport type { ContextMenuDividerProps } from '../../types'\nimport '../../ContextMenuDivider.css'\n\ndefineOptions({ name: 'ContextMenuDivider' })\nconst props = defineProps<ContextMenuDividerProps>()\nconst theme = useMantineTheme()\nconst resolvedStyle = computed(() => resolveContextMenuStyle(props.style, theme.value))\n</script>\n\n<template>\n <Box :class=\"['mantine-contextmenu-divider', props.className]\" :style=\"resolvedStyle\" />\n</template>\n","import { inject, readonly, ref, type InjectionKey, type Ref } from 'vue'\nimport type { ContextMenuContextValue, ContextMenuSettings } from './types'\n\nexport interface ResolvedContextMenuSettings {\n shadow: NonNullable<ContextMenuSettings['shadow']>\n borderRadius: NonNullable<ContextMenuSettings['borderRadius']>\n submenuDelay: number\n repositionOnRepeat: boolean\n}\n\nexport const ContextMenuSettingsKey = Symbol('ContextMenuSettings') as InjectionKey<\n Ref<ResolvedContextMenuSettings>\n>\n\nexport const ContextMenuKey = Symbol('ContextMenu') as InjectionKey<ContextMenuContextValue>\n\nconst hidden = readonly(ref(false))\nconst fallback: ContextMenuContextValue = {\n showContextMenu: () => () => undefined,\n hideContextMenu: () => undefined,\n isContextMenuVisible: hidden,\n}\n\nexport function useContextMenu() {\n return inject(ContextMenuKey, fallback)\n}\n\nexport function useContextMenuSettings() {\n return inject(ContextMenuSettingsKey, {\n value: {\n shadow: 'sm',\n borderRadius: 'xs',\n submenuDelay: 500,\n repositionOnRepeat: false,\n },\n } as Ref<ResolvedContextMenuSettings>)\n}\n","<script setup lang=\"ts\">\nimport { computed, ref, useSlots } from 'vue'\nimport {\n Box,\n UnstyledButton,\n parseThemeColor,\n resolveNode,\n rgba,\n useMantineTheme,\n} from '@mantine-vue/core'\nimport { useMediaQuery, useTimeout } from '@mantine-vue/hooks'\nimport ContextMenu from '../ContextMenu/ContextMenu.vue'\nimport { useContextMenuSettings } from '../../context'\nimport { resolveContextMenuStyle } from '../../utils'\nimport type { ContextMenuItemEmits, ContextMenuItemProps } from '../../types'\nimport '../../ContextMenuItem.css'\n\ndefineOptions({ name: 'ContextMenuItem' })\nconst props = withDefaults(defineProps<ContextMenuItemProps>(), { disabled: false })\nconst emit = defineEmits<ContextMenuItemEmits>()\nconst slots = useSlots()\nconst button = ref<HTMLElement | null>(null)\nconst submenuPosition = ref<{ x: number; y: number } | null>(null)\nconst settings = useContextMenuSettings()\nconst theme = useMantineTheme()\nconst hoverAvailable = useMediaQuery('(hover: hover)')\nconst hasSubmenu = computed(() => Boolean(props.items && !props.disabled))\nconst parsedColor = computed(() =>\n props.color ? parseThemeColor({ color: props.color, theme: theme.value }) : null,\n)\nconst itemStyle = computed(() => {\n const color = parsedColor.value?.value\n return {\n '--mantine-contextmenu-item-button-color': color ?? 'var(--mantine-color-text)',\n '--mantine-contextmenu-item-button-hover-bg-color-light': color\n ? rgba(color, 0.08)\n : rgba(theme.value.colors.gray[4], 0.25),\n '--mantine-contextmenu-item-button-hover-bg-color-dark': color\n ? rgba(color, 0.15)\n : rgba(theme.value.colors.dark[3], 0.25),\n '--mantine-contextmenu-item-button-pressed-bg-color-light': color\n ? rgba(color, 0.2)\n : rgba(theme.value.colors.gray[4], 0.5),\n '--mantine-contextmenu-item-button-pressed-bg-color-dark': color\n ? rgba(color, 0.3)\n : rgba(theme.value.colors.dark[3], 0.5),\n ...resolveContextMenuStyle(props.style, theme.value),\n }\n})\nconst icon = computed(() => resolveNode(props.icon, slots.icon))\nconst title = computed(() => resolveNode(props.title, slots.title))\nconst iconRight = computed(() => resolveNode(props.iconRight, slots.iconRight))\nconst renderIcon = () => icon.value\nconst renderTitle = () => title.value\nconst renderIconRight = () => iconRight.value\n\nconst showSubmenuTimeout = useTimeout(() => {\n if (!button.value) return\n const rect = button.value.getBoundingClientRect()\n submenuPosition.value = {\n x: (props.submenuProps.dir || 'ltr') === 'ltr' ? rect.right : rect.left,\n y: rect.top,\n }\n}, settings.value.submenuDelay)\nconst hideSubmenuTimeout = useTimeout(\n () => (submenuPosition.value = null),\n settings.value.submenuDelay,\n)\n\nfunction showSubmenu() {\n hideSubmenuTimeout.clear()\n showSubmenuTimeout.start()\n}\nfunction hideSubmenu() {\n showSubmenuTimeout.clear()\n hideSubmenuTimeout.start()\n}\nfunction mouseenter() {\n if (hasSubmenu.value && hoverAvailable.value) showSubmenu()\n}\nfunction mouseleave() {\n if (hasSubmenu.value && hoverAvailable.value) hideSubmenu()\n}\nfunction click(event: MouseEvent) {\n if (hasSubmenu.value) {\n event.stopPropagation()\n showSubmenu()\n } else if (props.onClick) {\n emit('hide')\n props.onClick(event)\n }\n}\n</script>\n\n<template>\n <div @mouseenter=\"mouseenter\" @mouseleave=\"mouseleave\">\n <UnstyledButton\n :ref=\"(node: any) => (button = node?.$el ?? node ?? null)\"\n :dir=\"props.submenuProps.dir || 'ltr'\"\n :class=\"['mantine-contextmenu-item-button', props.className]\"\n :disabled=\"props.disabled\"\n :style=\"itemStyle\"\n @click=\"click\"\n >\n <Box v-if=\"icon\" :fz=\"0\" me=\"xs\" :mt=\"-2\"><component :is=\"renderIcon\" /></Box>\n <div class=\"mantine-contextmenu-item-button-title\"><component :is=\"renderTitle\" /></div>\n <Box v-if=\"iconRight\" :fz=\"0\" ms=\"xs\" :mt=\"-2\"><component :is=\"renderIconRight\" /></Box>\n <Box v-else-if=\"props.items\" :mt=\"-1\" ms=\"xs\">\n {{ (props.submenuProps.dir || 'ltr') === 'rtl' ? '‹' : '›' }}\n </Box>\n </UnstyledButton>\n <ContextMenu\n v-if=\"submenuPosition && props.items\"\n v-bind=\"props.submenuProps\"\n :x=\"submenuPosition.x\"\n :y=\"submenuPosition.y\"\n :content=\"props.items\"\n :dir=\"props.submenuProps.dir || 'ltr'\"\n @hide=\"emit('hide')\"\n />\n </div>\n</template>\n","<script setup lang=\"ts\">\nimport { computed, ref, useSlots } from 'vue'\nimport {\n Box,\n UnstyledButton,\n parseThemeColor,\n resolveNode,\n rgba,\n useMantineTheme,\n} from '@mantine-vue/core'\nimport { useMediaQuery, useTimeout } from '@mantine-vue/hooks'\nimport ContextMenu from '../ContextMenu/ContextMenu.vue'\nimport { useContextMenuSettings } from '../../context'\nimport { resolveContextMenuStyle } from '../../utils'\nimport type { ContextMenuItemEmits, ContextMenuItemProps } from '../../types'\nimport '../../ContextMenuItem.css'\n\ndefineOptions({ name: 'ContextMenuItem' })\nconst props = withDefaults(defineProps<ContextMenuItemProps>(), { disabled: false })\nconst emit = defineEmits<ContextMenuItemEmits>()\nconst slots = useSlots()\nconst button = ref<HTMLElement | null>(null)\nconst submenuPosition = ref<{ x: number; y: number } | null>(null)\nconst settings = useContextMenuSettings()\nconst theme = useMantineTheme()\nconst hoverAvailable = useMediaQuery('(hover: hover)')\nconst hasSubmenu = computed(() => Boolean(props.items && !props.disabled))\nconst parsedColor = computed(() =>\n props.color ? parseThemeColor({ color: props.color, theme: theme.value }) : null,\n)\nconst itemStyle = computed(() => {\n const color = parsedColor.value?.value\n return {\n '--mantine-contextmenu-item-button-color': color ?? 'var(--mantine-color-text)',\n '--mantine-contextmenu-item-button-hover-bg-color-light': color\n ? rgba(color, 0.08)\n : rgba(theme.value.colors.gray[4], 0.25),\n '--mantine-contextmenu-item-button-hover-bg-color-dark': color\n ? rgba(color, 0.15)\n : rgba(theme.value.colors.dark[3], 0.25),\n '--mantine-contextmenu-item-button-pressed-bg-color-light': color\n ? rgba(color, 0.2)\n : rgba(theme.value.colors.gray[4], 0.5),\n '--mantine-contextmenu-item-button-pressed-bg-color-dark': color\n ? rgba(color, 0.3)\n : rgba(theme.value.colors.dark[3], 0.5),\n ...resolveContextMenuStyle(props.style, theme.value),\n }\n})\nconst icon = computed(() => resolveNode(props.icon, slots.icon))\nconst title = computed(() => resolveNode(props.title, slots.title))\nconst iconRight = computed(() => resolveNode(props.iconRight, slots.iconRight))\nconst renderIcon = () => icon.value\nconst renderTitle = () => title.value\nconst renderIconRight = () => iconRight.value\n\nconst showSubmenuTimeout = useTimeout(() => {\n if (!button.value) return\n const rect = button.value.getBoundingClientRect()\n submenuPosition.value = {\n x: (props.submenuProps.dir || 'ltr') === 'ltr' ? rect.right : rect.left,\n y: rect.top,\n }\n}, settings.value.submenuDelay)\nconst hideSubmenuTimeout = useTimeout(\n () => (submenuPosition.value = null),\n settings.value.submenuDelay,\n)\n\nfunction showSubmenu() {\n hideSubmenuTimeout.clear()\n showSubmenuTimeout.start()\n}\nfunction hideSubmenu() {\n showSubmenuTimeout.clear()\n hideSubmenuTimeout.start()\n}\nfunction mouseenter() {\n if (hasSubmenu.value && hoverAvailable.value) showSubmenu()\n}\nfunction mouseleave() {\n if (hasSubmenu.value && hoverAvailable.value) hideSubmenu()\n}\nfunction click(event: MouseEvent) {\n if (hasSubmenu.value) {\n event.stopPropagation()\n showSubmenu()\n } else if (props.onClick) {\n emit('hide')\n props.onClick(event)\n }\n}\n</script>\n\n<template>\n <div @mouseenter=\"mouseenter\" @mouseleave=\"mouseleave\">\n <UnstyledButton\n :ref=\"(node: any) => (button = node?.$el ?? node ?? null)\"\n :dir=\"props.submenuProps.dir || 'ltr'\"\n :class=\"['mantine-contextmenu-item-button', props.className]\"\n :disabled=\"props.disabled\"\n :style=\"itemStyle\"\n @click=\"click\"\n >\n <Box v-if=\"icon\" :fz=\"0\" me=\"xs\" :mt=\"-2\"><component :is=\"renderIcon\" /></Box>\n <div class=\"mantine-contextmenu-item-button-title\"><component :is=\"renderTitle\" /></div>\n <Box v-if=\"iconRight\" :fz=\"0\" ms=\"xs\" :mt=\"-2\"><component :is=\"renderIconRight\" /></Box>\n <Box v-else-if=\"props.items\" :mt=\"-1\" ms=\"xs\">\n {{ (props.submenuProps.dir || 'ltr') === 'rtl' ? '‹' : '›' }}\n </Box>\n </UnstyledButton>\n <ContextMenu\n v-if=\"submenuPosition && props.items\"\n v-bind=\"props.submenuProps\"\n :x=\"submenuPosition.x\"\n :y=\"submenuPosition.y\"\n :content=\"props.items\"\n :dir=\"props.submenuProps.dir || 'ltr'\"\n @hide=\"emit('hide')\"\n />\n </div>\n</template>\n","<script setup lang=\"ts\">\nimport { computed, onBeforeUnmount, ref, watch } from 'vue'\nimport { Paper, px, useMantineTheme, type MantineRadius } from '@mantine-vue/core'\nimport { useResizeObserver } from '@mantine-vue/hooks'\nimport ContextMenuDivider from '../ContextMenuDivider/ContextMenuDivider.vue'\nimport ContextMenuItem from '../ContextMenuItem/ContextMenuItem.vue'\nimport { useContextMenuSettings } from '../../context'\nimport { humanize, resolveContextMenuStyle, resolveContextMenuStyles } from '../../utils'\nimport type { ContextMenuEmits, ContextMenuItemOptions, ContextMenuProps } from '../../types'\nimport '../../ContextMenu.css'\n\ndefineOptions({ name: 'ContextMenu' })\nconst props = withDefaults(defineProps<ContextMenuProps>(), { dir: 'ltr' })\nconst emit = defineEmits<ContextMenuEmits>()\nconst settings = useContextMenuSettings()\nconst theme = useMantineTheme()\nconst { ref: menuRef, rect } = useResizeObserver<HTMLElement>()\nconst mounted = ref(false)\nlet frameId = 0\n\nwatch(\n () => [rect.value.width, rect.value.height],\n ([width, height]) => {\n if (width > 0 && height > 0) {\n cancelAnimationFrame(frameId)\n frameId = requestAnimationFrame(() => (mounted.value = true))\n }\n },\n { immediate: true },\n)\nonBeforeUnmount(() => cancelAnimationFrame(frameId))\n\nconst position = computed(() => {\n const spacing = px(theme.value.spacing.md)\n const windowWidth = typeof window === 'undefined' ? 0 : window.innerWidth\n const windowHeight = typeof window === 'undefined' ? 0 : window.innerHeight\n const top =\n props.y + rect.value.height + spacing > windowHeight\n ? windowHeight - rect.value.height - spacing\n : props.y\n const left =\n props.dir === 'rtl'\n ? props.x - rect.value.width < spacing\n ? spacing\n : props.x - rect.value.width\n : props.x + rect.value.width + spacing > windowWidth\n ? windowWidth - rect.value.width - spacing\n : props.x\n return { zIndex: props.zIndex, top: `${top}px`, left: `${left}px` }\n})\nconst resolvedStyles = computed(() => resolveContextMenuStyles(props.styles, theme.value))\nconst rootStyle = computed(() => ({\n ...position.value,\n ...resolveContextMenuStyle(props.style, theme.value),\n ...resolveContextMenuStyle(resolvedStyles.value?.root, theme.value),\n}))\nconst submenuProps = computed(() => ({\n className: props.className,\n style: props.style,\n classNames: props.classNames,\n styles: props.styles,\n dir: props.dir,\n}))\n\nfunction itemClass(item: ContextMenuItemOptions, part: 'item' | 'divider') {\n return [props.classNames?.[part], item.className].filter(Boolean).join(' ')\n}\nfunction itemStyle(item: ContextMenuItemOptions, part: 'item' | 'divider') {\n return {\n ...resolveContextMenuStyle(resolvedStyles.value?.[part], theme.value),\n ...resolveContextMenuStyle(item.style, theme.value),\n }\n}\nconst renderCustomContent = () =>\n typeof props.content === 'function' ? props.content(() => emit('hide')) : null\n</script>\n\n<template>\n <Paper\n :ref=\"(node: any) => (menuRef = node?.$el ?? node ?? null)\"\n :shadow=\"settings.shadow\"\n :radius=\"settings.borderRadius as MantineRadius\"\n :dir=\"props.dir\"\n :class=\"[\n 'mantine-contextmenu',\n mounted && 'mantine-contextmenu-mounted',\n props.className,\n props.classNames?.root,\n ]\"\n :style=\"rootStyle\"\n >\n <component v-if=\"typeof props.content === 'function'\" :is=\"renderCustomContent\" />\n <template v-else>\n <template v-for=\"item in props.content\" :key=\"item.key\">\n <ContextMenuItem\n v-if=\"!item.hidden && (item.onClick || item.items)\"\n :class-name=\"itemClass(item, 'item')\"\n :style=\"itemStyle(item, 'item')\"\n :title=\"item.title ?? humanize(item.key)\"\n :icon=\"item.icon\"\n :icon-right=\"item.iconRight\"\n :color=\"item.color\"\n :disabled=\"item.disabled\"\n :on-click=\"item.onClick\"\n :items=\"item.items\"\n :submenu-props=\"submenuProps\"\n @hide=\"emit('hide')\"\n />\n <ContextMenuDivider\n v-else-if=\"!item.hidden\"\n :class-name=\"itemClass(item, 'divider')\"\n :style=\"itemStyle(item, 'divider')\"\n />\n </template>\n </template>\n </Paper>\n</template>\n","<script setup lang=\"ts\">\nimport { computed, onBeforeUnmount, ref, watch } from 'vue'\nimport { Paper, px, useMantineTheme, type MantineRadius } from '@mantine-vue/core'\nimport { useResizeObserver } from '@mantine-vue/hooks'\nimport ContextMenuDivider from '../ContextMenuDivider/ContextMenuDivider.vue'\nimport ContextMenuItem from '../ContextMenuItem/ContextMenuItem.vue'\nimport { useContextMenuSettings } from '../../context'\nimport { humanize, resolveContextMenuStyle, resolveContextMenuStyles } from '../../utils'\nimport type { ContextMenuEmits, ContextMenuItemOptions, ContextMenuProps } from '../../types'\nimport '../../ContextMenu.css'\n\ndefineOptions({ name: 'ContextMenu' })\nconst props = withDefaults(defineProps<ContextMenuProps>(), { dir: 'ltr' })\nconst emit = defineEmits<ContextMenuEmits>()\nconst settings = useContextMenuSettings()\nconst theme = useMantineTheme()\nconst { ref: menuRef, rect } = useResizeObserver<HTMLElement>()\nconst mounted = ref(false)\nlet frameId = 0\n\nwatch(\n () => [rect.value.width, rect.value.height],\n ([width, height]) => {\n if (width > 0 && height > 0) {\n cancelAnimationFrame(frameId)\n frameId = requestAnimationFrame(() => (mounted.value = true))\n }\n },\n { immediate: true },\n)\nonBeforeUnmount(() => cancelAnimationFrame(frameId))\n\nconst position = computed(() => {\n const spacing = px(theme.value.spacing.md)\n const windowWidth = typeof window === 'undefined' ? 0 : window.innerWidth\n const windowHeight = typeof window === 'undefined' ? 0 : window.innerHeight\n const top =\n props.y + rect.value.height + spacing > windowHeight\n ? windowHeight - rect.value.height - spacing\n : props.y\n const left =\n props.dir === 'rtl'\n ? props.x - rect.value.width < spacing\n ? spacing\n : props.x - rect.value.width\n : props.x + rect.value.width + spacing > windowWidth\n ? windowWidth - rect.value.width - spacing\n : props.x\n return { zIndex: props.zIndex, top: `${top}px`, left: `${left}px` }\n})\nconst resolvedStyles = computed(() => resolveContextMenuStyles(props.styles, theme.value))\nconst rootStyle = computed(() => ({\n ...position.value,\n ...resolveContextMenuStyle(props.style, theme.value),\n ...resolveContextMenuStyle(resolvedStyles.value?.root, theme.value),\n}))\nconst submenuProps = computed(() => ({\n className: props.className,\n style: props.style,\n classNames: props.classNames,\n styles: props.styles,\n dir: props.dir,\n}))\n\nfunction itemClass(item: ContextMenuItemOptions, part: 'item' | 'divider') {\n return [props.classNames?.[part], item.className].filter(Boolean).join(' ')\n}\nfunction itemStyle(item: ContextMenuItemOptions, part: 'item' | 'divider') {\n return {\n ...resolveContextMenuStyle(resolvedStyles.value?.[part], theme.value),\n ...resolveContextMenuStyle(item.style, theme.value),\n }\n}\nconst renderCustomContent = () =>\n typeof props.content === 'function' ? props.content(() => emit('hide')) : null\n</script>\n\n<template>\n <Paper\n :ref=\"(node: any) => (menuRef = node?.$el ?? node ?? null)\"\n :shadow=\"settings.shadow\"\n :radius=\"settings.borderRadius as MantineRadius\"\n :dir=\"props.dir\"\n :class=\"[\n 'mantine-contextmenu',\n mounted && 'mantine-contextmenu-mounted',\n props.className,\n props.classNames?.root,\n ]\"\n :style=\"rootStyle\"\n >\n <component v-if=\"typeof props.content === 'function'\" :is=\"renderCustomContent\" />\n <template v-else>\n <template v-for=\"item in props.content\" :key=\"item.key\">\n <ContextMenuItem\n v-if=\"!item.hidden && (item.onClick || item.items)\"\n :class-name=\"itemClass(item, 'item')\"\n :style=\"itemStyle(item, 'item')\"\n :title=\"item.title ?? humanize(item.key)\"\n :icon=\"item.icon\"\n :icon-right=\"item.iconRight\"\n :color=\"item.color\"\n :disabled=\"item.disabled\"\n :on-click=\"item.onClick\"\n :items=\"item.items\"\n :submenu-props=\"submenuProps\"\n @hide=\"emit('hide')\"\n />\n <ContextMenuDivider\n v-else-if=\"!item.hidden\"\n :class-name=\"itemClass(item, 'divider')\"\n :style=\"itemStyle(item, 'divider')\"\n />\n </template>\n </template>\n </Paper>\n</template>\n","<script setup lang=\"ts\">\nimport { useContextMenuSettings } from '../../context'\nimport type { ContextMenuOverlayEmits } from '../../types'\nimport '../../ContextMenuOverlay.css'\n\ndefineOptions({ name: 'ContextMenuOverlay' })\nconst props = defineProps<{ zIndex?: number }>()\nconst emit = defineEmits<ContextMenuOverlayEmits>()\nconst settings = useContextMenuSettings()\n\nfunction click(event: MouseEvent) {\n event.preventDefault()\n emit('hide')\n}\n\nfunction contextmenu(event: MouseEvent) {\n event.preventDefault()\n if (!settings.value.repositionOnRepeat) {\n emit('hide')\n return\n }\n try {\n document.elementsFromPoint(event.clientX, event.clientY)[1]?.dispatchEvent(\n new MouseEvent('contextmenu', {\n bubbles: true,\n clientX: event.clientX,\n clientY: event.clientY,\n }),\n )\n } catch {\n // The target may disappear while the event is dispatched.\n }\n}\n</script>\n\n<template>\n <div\n class=\"mantine-contextmenu-overlay\"\n :style=\"{ zIndex: props.zIndex }\"\n @click=\"click\"\n @contextmenu=\"contextmenu\"\n >\n <slot />\n </div>\n</template>\n","<script setup lang=\"ts\">\nimport { useContextMenuSettings } from '../../context'\nimport type { ContextMenuOverlayEmits } from '../../types'\nimport '../../ContextMenuOverlay.css'\n\ndefineOptions({ name: 'ContextMenuOverlay' })\nconst props = defineProps<{ zIndex?: number }>()\nconst emit = defineEmits<ContextMenuOverlayEmits>()\nconst settings = useContextMenuSettings()\n\nfunction click(event: MouseEvent) {\n event.preventDefault()\n emit('hide')\n}\n\nfunction contextmenu(event: MouseEvent) {\n event.preventDefault()\n if (!settings.value.repositionOnRepeat) {\n emit('hide')\n return\n }\n try {\n document.elementsFromPoint(event.clientX, event.clientY)[1]?.dispatchEvent(\n new MouseEvent('contextmenu', {\n bubbles: true,\n clientX: event.clientX,\n clientY: event.clientY,\n }),\n )\n } catch {\n // The target may disappear while the event is dispatched.\n }\n}\n</script>\n\n<template>\n <div\n class=\"mantine-contextmenu-overlay\"\n :style=\"{ zIndex: props.zIndex }\"\n @click=\"click\"\n @contextmenu=\"contextmenu\"\n >\n <slot />\n </div>\n</template>\n","<script setup lang=\"ts\">\nimport { Portal } from '@mantine-vue/core'\nimport { useHotkeys, useWindowEvent } from '@mantine-vue/hooks'\nimport ContextMenu from '../ContextMenu/ContextMenu.vue'\nimport ContextMenuOverlay from '../ContextMenuOverlay/ContextMenuOverlay.vue'\nimport type { ContextMenuPortalEmits, ContextMenuPortalProps } from '../../types'\n\ndefineOptions({ name: 'ContextMenuPortal' })\nconst props = defineProps<ContextMenuPortalProps>()\nconst emit = defineEmits<ContextMenuPortalEmits>()\nconst hide = () => emit('hide')\nuseWindowEvent('resize', hide)\nuseWindowEvent('scroll', hide)\nuseHotkeys([['Escape', hide]])\n</script>\n\n<template>\n <Portal>\n <ContextMenuOverlay :z-index=\"props.zIndex\" @hide=\"hide\">\n <ContextMenu\n :x=\"props.x\"\n :y=\"props.y\"\n :content=\"props.content\"\n :dir=\"props.dir\"\n :z-index=\"props.zIndex\"\n :class-name=\"props.className\"\n :style=\"props.style\"\n :class-names=\"props.classNames\"\n :styles=\"props.styles\"\n @hide=\"hide\"\n />\n </ContextMenuOverlay>\n </Portal>\n</template>\n","<script setup lang=\"ts\">\nimport { Portal } from '@mantine-vue/core'\nimport { useHotkeys, useWindowEvent } from '@mantine-vue/hooks'\nimport ContextMenu from '../ContextMenu/ContextMenu.vue'\nimport ContextMenuOverlay from '../ContextMenuOverlay/ContextMenuOverlay.vue'\nimport type { ContextMenuPortalEmits, ContextMenuPortalProps } from '../../types'\n\ndefineOptions({ name: 'ContextMenuPortal' })\nconst props = defineProps<ContextMenuPortalProps>()\nconst emit = defineEmits<ContextMenuPortalEmits>()\nconst hide = () => emit('hide')\nuseWindowEvent('resize', hide)\nuseWindowEvent('scroll', hide)\nuseHotkeys([['Escape', hide]])\n</script>\n\n<template>\n <Portal>\n <ContextMenuOverlay :z-index=\"props.zIndex\" @hide=\"hide\">\n <ContextMenu\n :x=\"props.x\"\n :y=\"props.y\"\n :content=\"props.content\"\n :dir=\"props.dir\"\n :z-index=\"props.zIndex\"\n :class-name=\"props.className\"\n :style=\"props.style\"\n :class-names=\"props.classNames\"\n :styles=\"props.styles\"\n @hide=\"hide\"\n />\n </ContextMenuOverlay>\n </Portal>\n</template>\n","<script setup lang=\"ts\">\nimport { computed, provide, shallowRef, toRef } from 'vue'\nimport { useDirection } from '@mantine-vue/core'\nimport ContextMenuPortal from '../ContextMenuPortal/ContextMenuPortal.vue'\nimport { ContextMenuKey, ContextMenuSettingsKey } from '../../context'\nimport type {\n ContextMenuInstanceOptions,\n ContextMenuOptions,\n ContextMenuProviderProps,\n ShowContextMenuFunction,\n} from '../../types'\n\ndefineOptions({ name: 'ContextMenuProvider' })\nconst props = withDefaults(defineProps<ContextMenuProviderProps>(), {\n zIndex: 9999,\n shadow: 'sm',\n borderRadius: 'xs',\n submenuDelay: 500,\n repositionOnRepeat: false,\n})\nconst data = shallowRef<(ContextMenuInstanceOptions & ContextMenuOptions) | null>(null)\nconst { dir } = useDirection()\n\nfunction hideContextMenu() {\n data.value = null\n}\n\nconst showContextMenu: ShowContextMenuFunction = (content, options) => (event) => {\n event.preventDefault()\n event.stopPropagation()\n const position =\n 'touches' in event\n ? { x: event.touches.item(0)!.clientX, y: event.touches.item(0)!.clientY }\n : { x: event.clientX, y: event.clientY }\n data.value = {\n ...position,\n content,\n zIndex: options?.zIndex || props.zIndex,\n className: options?.className,\n style: options?.style,\n classNames: options?.classNames,\n styles: options?.styles,\n }\n}\n\nprovide(\n ContextMenuSettingsKey,\n computed(() => ({\n shadow: props.shadow,\n borderRadius: props.borderRadius,\n submenuDelay: props.submenuDelay,\n repositionOnRepeat: props.repositionOnRepeat,\n })),\n)\nprovide(ContextMenuKey, {\n showContextMenu,\n hideContextMenu,\n isContextMenuVisible: toRef(() => Boolean(data.value)),\n})\n</script>\n\n<template>\n <slot />\n <ContextMenuPortal v-if=\"data\" v-bind=\"data\" :dir=\"dir\" @hide=\"hideContextMenu\" />\n</template>\n","<script setup lang=\"ts\">\nimport { computed, provide, shallowRef, toRef } from 'vue'\nimport { useDirection } from '@mantine-vue/core'\nimport ContextMenuPortal from '../ContextMenuPortal/ContextMenuPortal.vue'\nimport { ContextMenuKey, ContextMenuSettingsKey } from '../../context'\nimport type {\n ContextMenuInstanceOptions,\n ContextMenuOptions,\n ContextMenuProviderProps,\n ShowContextMenuFunction,\n} from '../../types'\n\ndefineOptions({ name: 'ContextMenuProvider' })\nconst props = withDefaults(defineProps<ContextMenuProviderProps>(), {\n zIndex: 9999,\n shadow: 'sm',\n borderRadius: 'xs',\n submenuDelay: 500,\n repositionOnRepeat: false,\n})\nconst data = shallowRef<(ContextMenuInstanceOptions & ContextMenuOptions) | null>(null)\nconst { dir } = useDirection()\n\nfunction hideContextMenu() {\n data.value = null\n}\n\nconst showContextMenu: ShowContextMenuFunction = (content, options) => (event) => {\n event.preventDefault()\n event.stopPropagation()\n const position =\n 'touches' in event\n ? { x: event.touches.item(0)!.clientX, y: event.touches.item(0)!.clientY }\n : { x: event.clientX, y: event.clientY }\n data.value = {\n ...position,\n content,\n zIndex: options?.zIndex || props.zIndex,\n className: options?.className,\n style: options?.style,\n classNames: options?.classNames,\n styles: options?.styles,\n }\n}\n\nprovide(\n ContextMenuSettingsKey,\n computed(() => ({\n shadow: props.shadow,\n borderRadius: props.borderRadius,\n submenuDelay: props.submenuDelay,\n repositionOnRepeat: props.repositionOnRepeat,\n })),\n)\nprovide(ContextMenuKey, {\n showContextMenu,\n hideContextMenu,\n isContextMenuVisible: toRef(() => Boolean(data.value)),\n})\n</script>\n\n<template>\n <slot />\n <ContextMenuPortal v-if=\"data\" v-bind=\"data\" :dir=\"dir\" @hide=\"hideContextMenu\" />\n</template>\n"],"mappings":";;;;;AAIA,SAAgB,SAAS,OAAe;CACtC,MAAM,MAAM,MACT,QAAQ,sBAAsB,OAAO,EACrC,QAAQ,SAAS,GAAG,EACpB,KAAK,EACL,YAAY;CAEf,OAAO,GAAG,IAAI,OAAO,CAAC,EAAE,YAAY,IAAI,IAAI,MAAM,CAAC;AACrD;AAEA,SAAgB,wBACd,OACA,OAC0B;CAC1B,OAAO,OAAO,UAAU,aAAa,MAAM,KAAK,IAAI;AACtD;AAEA,SAAgB,yBACd,QACA,OACA;CACA,OAAO,OAAO,WAAW,aAAa,OAAO,KAAK,IAAI;AACxD;;;;;;;;;;;EClBA,MAAM,QAAQ;EACd,MAAM,QAAQ,gBAAgB;EAC9B,MAAM,gBAAgB,eAAe,wBAAwB,MAAM,OAAO,MAAM,KAAK,CAAC;;uBAIpF,YAAwF,MAAA,GAAA,GAAA;IAAlF,OAAK,eAAA,CAAA,+BAAkC,MAAM,SAAS,CAAA;IAAI,OAAK,eAAE,cAAA,KAAa;;;;;;;A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K,QAAQ;EACf;EAEA,MAAM,mBAA4C,SAAS,aAAa,UAAU;GAChF,MAAM,eAAe;GACrB,MAAM,gBAAgB;GAKtB,KAAK,QAAQ;IACX,GAJA,aAAa,QACT;KAAE,GAAG,MAAM,QAAQ,KAAK,CAAC,EAAG;KAAS,GAAG,MAAM,QAAQ,KAAK,CAAC,EAAG;IAAQ,IACvE;KAAE,GAAG,MAAM;KAAS,GAAG,MAAM;IAAQ;IAGzC;IACA,QAAQ,SAAS,UAAU,MAAM;IACjC,WAAW,SAAS;IACpB,OAAO,SAAS;IAChB,YAAY,SAAS;IACrB,QAAQ,SAAS;GACnB;EACF;EAEA,QACE,wBACA,gBAAgB;GACd,QAAQ,MAAM;GACd,cAAc,MAAM;GACpB,cAAc,MAAM;GACpB,oBAAoB,MAAM;EAC5B,EAAE,CACJ;EACA,QAAQ,gBAAgB;GACtB;GACA;GACA,sBAAsB,YAAY,QAAQ,KAAK,KAAK,CAAC;EACvD,CAAC;;2DAIC,WAAQ,KAAA,QAAA,SAAA,GACiB,KAAA,SAAA,UAAA,GAAzB,YAAkF,2BAAlF,WAAkF,EAAA,KAAA,EAAA,GAA3C,KAAA,OAAI;IAAG,KAAK,MAAA,GAAA;IAAM,QAAM"}
1
+ {"version":3,"file":"index.mjs","names":[],"sources":["../src/utils.ts","../src/components/ContextMenuDivider/ContextMenuDivider.vue","../src/components/ContextMenuDivider/ContextMenuDivider.vue","../src/context.ts","../src/components/ContextMenuItem/ContextMenuItem.vue","../src/components/ContextMenuItem/ContextMenuItem.vue","../src/components/ContextMenu/ContextMenu.vue","../src/components/ContextMenu/ContextMenu.vue","../src/components/ContextMenuOverlay/ContextMenuOverlay.vue","../src/components/ContextMenuOverlay/ContextMenuOverlay.vue","../src/components/ContextMenuPortal/ContextMenuPortal.vue","../src/components/ContextMenuPortal/ContextMenuPortal.vue","../src/components/ContextMenuProvider/ContextMenuProvider.vue","../src/components/ContextMenuProvider/ContextMenuProvider.vue"],"sourcesContent":["import type { ContextMenuStyle, ContextMenuStyles } from './types'\nimport type { MantineStyle, MantineTheme } from '@mantine-vue/core'\n\n/** Returns a humanized version of a string, for example \"camelCase\" becomes \"Camel Case\". */\nexport function humanize(value: string) {\n const str = value\n .replace(/([a-z\\d])([A-Z]+)/g, '$1 $2')\n .replace(/\\W|_/g, ' ')\n .trim()\n .toLowerCase()\n\n return `${str.charAt(0).toUpperCase()}${str.slice(1)}`\n}\n\nexport function resolveContextMenuStyle(\n style: ContextMenuStyle | undefined,\n theme: MantineTheme,\n): MantineStyle | undefined {\n return typeof style === 'function' ? style(theme) : style\n}\n\nexport function resolveContextMenuStyles(\n styles: ContextMenuStyles | ((theme: MantineTheme) => ContextMenuStyles) | undefined,\n theme: MantineTheme,\n) {\n return typeof styles === 'function' ? styles(theme) : styles\n}\n","<script setup lang=\"ts\">\nimport { computed } from 'vue'\nimport { Box, useMantineTheme } from '@mantine-vue/core'\nimport { resolveContextMenuStyle } from '../../utils'\nimport type { ContextMenuDividerProps } from '../../types'\nimport '../../ContextMenuDivider.css'\n\ndefineOptions({ name: 'ContextMenuDivider' })\nconst props = defineProps<ContextMenuDividerProps>()\nconst theme = useMantineTheme()\nconst resolvedStyle = computed(() => resolveContextMenuStyle(props.style, theme.value))\n</script>\n\n<template>\n <Box :class=\"['mantine-contextmenu-divider', props.className]\" :style=\"resolvedStyle\" />\n</template>\n","<script setup lang=\"ts\">\nimport { computed } from 'vue'\nimport { Box, useMantineTheme } from '@mantine-vue/core'\nimport { resolveContextMenuStyle } from '../../utils'\nimport type { ContextMenuDividerProps } from '../../types'\nimport '../../ContextMenuDivider.css'\n\ndefineOptions({ name: 'ContextMenuDivider' })\nconst props = defineProps<ContextMenuDividerProps>()\nconst theme = useMantineTheme()\nconst resolvedStyle = computed(() => resolveContextMenuStyle(props.style, theme.value))\n</script>\n\n<template>\n <Box :class=\"['mantine-contextmenu-divider', props.className]\" :style=\"resolvedStyle\" />\n</template>\n","import { inject, readonly, ref, type InjectionKey, type Ref } from 'vue'\nimport type { ContextMenuContextValue, ContextMenuSettings } from './types'\n\nexport interface ResolvedContextMenuSettings {\n shadow: NonNullable<ContextMenuSettings['shadow']>\n borderRadius: NonNullable<ContextMenuSettings['borderRadius']>\n submenuDelay: number\n repositionOnRepeat: boolean\n}\n\nexport const ContextMenuSettingsKey = Symbol('ContextMenuSettings') as InjectionKey<\n Ref<ResolvedContextMenuSettings>\n>\n\nexport const ContextMenuKey = Symbol('ContextMenu') as InjectionKey<ContextMenuContextValue>\n\nconst hidden = readonly(ref(false))\nconst fallback: ContextMenuContextValue = {\n showContextMenu: () => () => undefined,\n hideContextMenu: () => undefined,\n isContextMenuVisible: hidden,\n}\n\nexport function useContextMenu() {\n return inject(ContextMenuKey, fallback)\n}\n\nexport function useContextMenuSettings() {\n return inject(ContextMenuSettingsKey, {\n value: {\n shadow: 'sm',\n borderRadius: 'xs',\n submenuDelay: 500,\n repositionOnRepeat: false,\n },\n } as Ref<ResolvedContextMenuSettings>)\n}\n","<script setup lang=\"ts\">\nimport { computed, ref, useSlots } from 'vue'\nimport {\n Box,\n UnstyledButton,\n parseThemeColor,\n resolveNode,\n rgba,\n useMantineTheme,\n} from '@mantine-vue/core'\nimport { useMediaQuery, useTimeout } from '@mantine-vue/hooks'\nimport ContextMenu from '../ContextMenu/ContextMenu.vue'\nimport { useContextMenuSettings } from '../../context'\nimport { resolveContextMenuStyle } from '../../utils'\nimport type { ContextMenuItemEmits, ContextMenuItemProps } from '../../types'\nimport '../../ContextMenuItem.css'\n\ndefineOptions({ name: 'ContextMenuItem' })\nconst props = withDefaults(defineProps<ContextMenuItemProps>(), { disabled: false })\nconst emit = defineEmits<ContextMenuItemEmits>()\nconst slots = useSlots()\nconst button = ref<HTMLElement | null>(null)\nconst submenuPosition = ref<{ x: number; y: number } | null>(null)\nconst settings = useContextMenuSettings()\nconst theme = useMantineTheme()\nconst hoverAvailable = useMediaQuery('(hover: hover)')\nconst hasSubmenu = computed(() => Boolean(props.items && !props.disabled))\nconst parsedColor = computed(() =>\n props.color ? parseThemeColor({ color: props.color, theme: theme.value }) : null,\n)\nconst itemStyle = computed(() => {\n const color = parsedColor.value?.value\n return {\n '--mantine-contextmenu-item-button-color': color ?? 'var(--mantine-color-text)',\n '--mantine-contextmenu-item-button-hover-bg-color-light': color\n ? rgba(color, 0.08)\n : rgba(theme.value.colors.gray[4], 0.25),\n '--mantine-contextmenu-item-button-hover-bg-color-dark': color\n ? rgba(color, 0.15)\n : rgba(theme.value.colors.dark[3], 0.25),\n '--mantine-contextmenu-item-button-pressed-bg-color-light': color\n ? rgba(color, 0.2)\n : rgba(theme.value.colors.gray[4], 0.5),\n '--mantine-contextmenu-item-button-pressed-bg-color-dark': color\n ? rgba(color, 0.3)\n : rgba(theme.value.colors.dark[3], 0.5),\n ...resolveContextMenuStyle(props.style, theme.value),\n }\n})\nconst icon = computed(() => resolveNode(props.icon, slots.icon))\nconst title = computed(() => resolveNode(props.title, slots.title))\nconst iconRight = computed(() => resolveNode(props.iconRight, slots.iconRight))\nconst renderIcon = () => icon.value\nconst renderTitle = () => title.value\nconst renderIconRight = () => iconRight.value\n\nconst showSubmenuTimeout = useTimeout(() => {\n if (!button.value) return\n const rect = button.value.getBoundingClientRect()\n submenuPosition.value = {\n x: (props.submenuProps.dir || 'ltr') === 'ltr' ? rect.right : rect.left,\n y: rect.top,\n }\n}, settings.value.submenuDelay)\nconst hideSubmenuTimeout = useTimeout(\n () => (submenuPosition.value = null),\n settings.value.submenuDelay,\n)\n\nfunction showSubmenu() {\n hideSubmenuTimeout.clear()\n showSubmenuTimeout.start()\n}\nfunction hideSubmenu() {\n showSubmenuTimeout.clear()\n hideSubmenuTimeout.start()\n}\nfunction mouseenter() {\n if (hasSubmenu.value && hoverAvailable.value) showSubmenu()\n}\nfunction mouseleave() {\n if (hasSubmenu.value && hoverAvailable.value) hideSubmenu()\n}\nfunction click(event: MouseEvent) {\n if (hasSubmenu.value) {\n event.stopPropagation()\n showSubmenu()\n } else if (props.onClick) {\n emit('hide')\n props.onClick(event)\n }\n}\n</script>\n\n<template>\n <div @mouseenter=\"mouseenter\" @mouseleave=\"mouseleave\">\n <UnstyledButton\n :ref=\"(node: any) => (button = node?.$el ?? node ?? null)\"\n :dir=\"props.submenuProps.dir || 'ltr'\"\n :class=\"['mantine-contextmenu-item-button', props.className]\"\n :disabled=\"props.disabled\"\n :style=\"itemStyle\"\n @click=\"click\"\n >\n <Box v-if=\"icon\" :fz=\"0\" me=\"xs\" :mt=\"-2\"><component :is=\"renderIcon\" /></Box>\n <div class=\"mantine-contextmenu-item-button-title\"><component :is=\"renderTitle\" /></div>\n <Box v-if=\"iconRight\" :fz=\"0\" ms=\"xs\" :mt=\"-2\"><component :is=\"renderIconRight\" /></Box>\n <Box v-else-if=\"props.items\" :mt=\"-1\" ms=\"xs\">\n {{ (props.submenuProps.dir || 'ltr') === 'rtl' ? '‹' : '›' }}\n </Box>\n </UnstyledButton>\n <ContextMenu\n v-if=\"submenuPosition && props.items\"\n v-bind=\"props.submenuProps\"\n :x=\"submenuPosition.x\"\n :y=\"submenuPosition.y\"\n :content=\"props.items\"\n :dir=\"props.submenuProps.dir || 'ltr'\"\n @hide=\"emit('hide')\"\n />\n </div>\n</template>\n","<script setup lang=\"ts\">\nimport { computed, ref, useSlots } from 'vue'\nimport {\n Box,\n UnstyledButton,\n parseThemeColor,\n resolveNode,\n rgba,\n useMantineTheme,\n} from '@mantine-vue/core'\nimport { useMediaQuery, useTimeout } from '@mantine-vue/hooks'\nimport ContextMenu from '../ContextMenu/ContextMenu.vue'\nimport { useContextMenuSettings } from '../../context'\nimport { resolveContextMenuStyle } from '../../utils'\nimport type { ContextMenuItemEmits, ContextMenuItemProps } from '../../types'\nimport '../../ContextMenuItem.css'\n\ndefineOptions({ name: 'ContextMenuItem' })\nconst props = withDefaults(defineProps<ContextMenuItemProps>(), { disabled: false })\nconst emit = defineEmits<ContextMenuItemEmits>()\nconst slots = useSlots()\nconst button = ref<HTMLElement | null>(null)\nconst submenuPosition = ref<{ x: number; y: number } | null>(null)\nconst settings = useContextMenuSettings()\nconst theme = useMantineTheme()\nconst hoverAvailable = useMediaQuery('(hover: hover)')\nconst hasSubmenu = computed(() => Boolean(props.items && !props.disabled))\nconst parsedColor = computed(() =>\n props.color ? parseThemeColor({ color: props.color, theme: theme.value }) : null,\n)\nconst itemStyle = computed(() => {\n const color = parsedColor.value?.value\n return {\n '--mantine-contextmenu-item-button-color': color ?? 'var(--mantine-color-text)',\n '--mantine-contextmenu-item-button-hover-bg-color-light': color\n ? rgba(color, 0.08)\n : rgba(theme.value.colors.gray[4], 0.25),\n '--mantine-contextmenu-item-button-hover-bg-color-dark': color\n ? rgba(color, 0.15)\n : rgba(theme.value.colors.dark[3], 0.25),\n '--mantine-contextmenu-item-button-pressed-bg-color-light': color\n ? rgba(color, 0.2)\n : rgba(theme.value.colors.gray[4], 0.5),\n '--mantine-contextmenu-item-button-pressed-bg-color-dark': color\n ? rgba(color, 0.3)\n : rgba(theme.value.colors.dark[3], 0.5),\n ...resolveContextMenuStyle(props.style, theme.value),\n }\n})\nconst icon = computed(() => resolveNode(props.icon, slots.icon))\nconst title = computed(() => resolveNode(props.title, slots.title))\nconst iconRight = computed(() => resolveNode(props.iconRight, slots.iconRight))\nconst renderIcon = () => icon.value\nconst renderTitle = () => title.value\nconst renderIconRight = () => iconRight.value\n\nconst showSubmenuTimeout = useTimeout(() => {\n if (!button.value) return\n const rect = button.value.getBoundingClientRect()\n submenuPosition.value = {\n x: (props.submenuProps.dir || 'ltr') === 'ltr' ? rect.right : rect.left,\n y: rect.top,\n }\n}, settings.value.submenuDelay)\nconst hideSubmenuTimeout = useTimeout(\n () => (submenuPosition.value = null),\n settings.value.submenuDelay,\n)\n\nfunction showSubmenu() {\n hideSubmenuTimeout.clear()\n showSubmenuTimeout.start()\n}\nfunction hideSubmenu() {\n showSubmenuTimeout.clear()\n hideSubmenuTimeout.start()\n}\nfunction mouseenter() {\n if (hasSubmenu.value && hoverAvailable.value) showSubmenu()\n}\nfunction mouseleave() {\n if (hasSubmenu.value && hoverAvailable.value) hideSubmenu()\n}\nfunction click(event: MouseEvent) {\n if (hasSubmenu.value) {\n event.stopPropagation()\n showSubmenu()\n } else if (props.onClick) {\n emit('hide')\n props.onClick(event)\n }\n}\n</script>\n\n<template>\n <div @mouseenter=\"mouseenter\" @mouseleave=\"mouseleave\">\n <UnstyledButton\n :ref=\"(node: any) => (button = node?.$el ?? node ?? null)\"\n :dir=\"props.submenuProps.dir || 'ltr'\"\n :class=\"['mantine-contextmenu-item-button', props.className]\"\n :disabled=\"props.disabled\"\n :style=\"itemStyle\"\n @click=\"click\"\n >\n <Box v-if=\"icon\" :fz=\"0\" me=\"xs\" :mt=\"-2\"><component :is=\"renderIcon\" /></Box>\n <div class=\"mantine-contextmenu-item-button-title\"><component :is=\"renderTitle\" /></div>\n <Box v-if=\"iconRight\" :fz=\"0\" ms=\"xs\" :mt=\"-2\"><component :is=\"renderIconRight\" /></Box>\n <Box v-else-if=\"props.items\" :mt=\"-1\" ms=\"xs\">\n {{ (props.submenuProps.dir || 'ltr') === 'rtl' ? '‹' : '›' }}\n </Box>\n </UnstyledButton>\n <ContextMenu\n v-if=\"submenuPosition && props.items\"\n v-bind=\"props.submenuProps\"\n :x=\"submenuPosition.x\"\n :y=\"submenuPosition.y\"\n :content=\"props.items\"\n :dir=\"props.submenuProps.dir || 'ltr'\"\n @hide=\"emit('hide')\"\n />\n </div>\n</template>\n","<script setup lang=\"ts\">\nimport { computed, onBeforeUnmount, ref, watch } from 'vue'\nimport { Paper, px, useMantineTheme, type MantineRadius } from '@mantine-vue/core'\nimport { useResizeObserver } from '@mantine-vue/hooks'\nimport ContextMenuDivider from '../ContextMenuDivider/ContextMenuDivider.vue'\nimport ContextMenuItem from '../ContextMenuItem/ContextMenuItem.vue'\nimport { useContextMenuSettings } from '../../context'\nimport { humanize, resolveContextMenuStyle, resolveContextMenuStyles } from '../../utils'\nimport type { ContextMenuEmits, ContextMenuItemOptions, ContextMenuProps } from '../../types'\nimport '../../ContextMenu.css'\n\ndefineOptions({ name: 'ContextMenu' })\nconst props = withDefaults(defineProps<ContextMenuProps>(), { dir: 'ltr' })\nconst emit = defineEmits<ContextMenuEmits>()\nconst settings = useContextMenuSettings()\nconst theme = useMantineTheme()\nconst { ref: menuRef, rect } = useResizeObserver<HTMLElement>()\nconst mounted = ref(false)\nlet frameId = 0\n\nwatch(\n () => [rect.value.width, rect.value.height],\n ([width, height]) => {\n if (width > 0 && height > 0) {\n cancelAnimationFrame(frameId)\n frameId = requestAnimationFrame(() => (mounted.value = true))\n }\n },\n { immediate: true },\n)\nonBeforeUnmount(() => cancelAnimationFrame(frameId))\n\nconst position = computed(() => {\n const spacing = px(theme.value.spacing.md)\n const windowWidth = typeof window === 'undefined' ? 0 : window.innerWidth\n const windowHeight = typeof window === 'undefined' ? 0 : window.innerHeight\n const top =\n props.y + rect.value.height + spacing > windowHeight\n ? windowHeight - rect.value.height - spacing\n : props.y\n const left =\n props.dir === 'rtl'\n ? props.x - rect.value.width < spacing\n ? spacing\n : props.x - rect.value.width\n : props.x + rect.value.width + spacing > windowWidth\n ? windowWidth - rect.value.width - spacing\n : props.x\n return { zIndex: props.zIndex, top: `${top}px`, left: `${left}px` }\n})\nconst resolvedStyles = computed(() => resolveContextMenuStyles(props.styles, theme.value))\nconst rootStyle = computed(() => ({\n ...position.value,\n ...resolveContextMenuStyle(props.style, theme.value),\n ...resolveContextMenuStyle(resolvedStyles.value?.root, theme.value),\n}))\nconst submenuProps = computed(() => ({\n className: props.className,\n style: props.style,\n classNames: props.classNames,\n styles: props.styles,\n dir: props.dir,\n}))\n\nfunction itemClass(item: ContextMenuItemOptions, part: 'item' | 'divider') {\n return [props.classNames?.[part], item.className].filter(Boolean).join(' ')\n}\nfunction itemStyle(item: ContextMenuItemOptions, part: 'item' | 'divider') {\n return {\n ...resolveContextMenuStyle(resolvedStyles.value?.[part], theme.value),\n ...resolveContextMenuStyle(item.style, theme.value),\n }\n}\nconst renderCustomContent = () =>\n typeof props.content === 'function' ? props.content(() => emit('hide')) : null\n</script>\n\n<template>\n <Paper\n :ref=\"(node: any) => (menuRef = node?.$el ?? node ?? null)\"\n :shadow=\"settings.shadow\"\n :radius=\"settings.borderRadius as MantineRadius\"\n :dir=\"props.dir\"\n :class=\"[\n 'mantine-contextmenu',\n mounted && 'mantine-contextmenu-mounted',\n props.className,\n props.classNames?.root,\n ]\"\n :style=\"rootStyle\"\n >\n <component v-if=\"typeof props.content === 'function'\" :is=\"renderCustomContent\" />\n <template v-else>\n <template v-for=\"item in props.content\" :key=\"item.key\">\n <ContextMenuItem\n v-if=\"!item.hidden && (item.onClick || item.items)\"\n :class-name=\"itemClass(item, 'item')\"\n :style=\"itemStyle(item, 'item')\"\n :title=\"item.title ?? humanize(item.key)\"\n :icon=\"item.icon\"\n :icon-right=\"item.iconRight\"\n :color=\"item.color\"\n :disabled=\"item.disabled\"\n :on-click=\"item.onClick\"\n :items=\"item.items\"\n :submenu-props=\"submenuProps\"\n @hide=\"emit('hide')\"\n />\n <ContextMenuDivider\n v-else-if=\"!item.hidden\"\n :class-name=\"itemClass(item, 'divider')\"\n :style=\"itemStyle(item, 'divider')\"\n />\n </template>\n </template>\n </Paper>\n</template>\n","<script setup lang=\"ts\">\nimport { computed, onBeforeUnmount, ref, watch } from 'vue'\nimport { Paper, px, useMantineTheme, type MantineRadius } from '@mantine-vue/core'\nimport { useResizeObserver } from '@mantine-vue/hooks'\nimport ContextMenuDivider from '../ContextMenuDivider/ContextMenuDivider.vue'\nimport ContextMenuItem from '../ContextMenuItem/ContextMenuItem.vue'\nimport { useContextMenuSettings } from '../../context'\nimport { humanize, resolveContextMenuStyle, resolveContextMenuStyles } from '../../utils'\nimport type { ContextMenuEmits, ContextMenuItemOptions, ContextMenuProps } from '../../types'\nimport '../../ContextMenu.css'\n\ndefineOptions({ name: 'ContextMenu' })\nconst props = withDefaults(defineProps<ContextMenuProps>(), { dir: 'ltr' })\nconst emit = defineEmits<ContextMenuEmits>()\nconst settings = useContextMenuSettings()\nconst theme = useMantineTheme()\nconst { ref: menuRef, rect } = useResizeObserver<HTMLElement>()\nconst mounted = ref(false)\nlet frameId = 0\n\nwatch(\n () => [rect.value.width, rect.value.height],\n ([width, height]) => {\n if (width > 0 && height > 0) {\n cancelAnimationFrame(frameId)\n frameId = requestAnimationFrame(() => (mounted.value = true))\n }\n },\n { immediate: true },\n)\nonBeforeUnmount(() => cancelAnimationFrame(frameId))\n\nconst position = computed(() => {\n const spacing = px(theme.value.spacing.md)\n const windowWidth = typeof window === 'undefined' ? 0 : window.innerWidth\n const windowHeight = typeof window === 'undefined' ? 0 : window.innerHeight\n const top =\n props.y + rect.value.height + spacing > windowHeight\n ? windowHeight - rect.value.height - spacing\n : props.y\n const left =\n props.dir === 'rtl'\n ? props.x - rect.value.width < spacing\n ? spacing\n : props.x - rect.value.width\n : props.x + rect.value.width + spacing > windowWidth\n ? windowWidth - rect.value.width - spacing\n : props.x\n return { zIndex: props.zIndex, top: `${top}px`, left: `${left}px` }\n})\nconst resolvedStyles = computed(() => resolveContextMenuStyles(props.styles, theme.value))\nconst rootStyle = computed(() => ({\n ...position.value,\n ...resolveContextMenuStyle(props.style, theme.value),\n ...resolveContextMenuStyle(resolvedStyles.value?.root, theme.value),\n}))\nconst submenuProps = computed(() => ({\n className: props.className,\n style: props.style,\n classNames: props.classNames,\n styles: props.styles,\n dir: props.dir,\n}))\n\nfunction itemClass(item: ContextMenuItemOptions, part: 'item' | 'divider') {\n return [props.classNames?.[part], item.className].filter(Boolean).join(' ')\n}\nfunction itemStyle(item: ContextMenuItemOptions, part: 'item' | 'divider') {\n return {\n ...resolveContextMenuStyle(resolvedStyles.value?.[part], theme.value),\n ...resolveContextMenuStyle(item.style, theme.value),\n }\n}\nconst renderCustomContent = () =>\n typeof props.content === 'function' ? props.content(() => emit('hide')) : null\n</script>\n\n<template>\n <Paper\n :ref=\"(node: any) => (menuRef = node?.$el ?? node ?? null)\"\n :shadow=\"settings.shadow\"\n :radius=\"settings.borderRadius as MantineRadius\"\n :dir=\"props.dir\"\n :class=\"[\n 'mantine-contextmenu',\n mounted && 'mantine-contextmenu-mounted',\n props.className,\n props.classNames?.root,\n ]\"\n :style=\"rootStyle\"\n >\n <component v-if=\"typeof props.content === 'function'\" :is=\"renderCustomContent\" />\n <template v-else>\n <template v-for=\"item in props.content\" :key=\"item.key\">\n <ContextMenuItem\n v-if=\"!item.hidden && (item.onClick || item.items)\"\n :class-name=\"itemClass(item, 'item')\"\n :style=\"itemStyle(item, 'item')\"\n :title=\"item.title ?? humanize(item.key)\"\n :icon=\"item.icon\"\n :icon-right=\"item.iconRight\"\n :color=\"item.color\"\n :disabled=\"item.disabled\"\n :on-click=\"item.onClick\"\n :items=\"item.items\"\n :submenu-props=\"submenuProps\"\n @hide=\"emit('hide')\"\n />\n <ContextMenuDivider\n v-else-if=\"!item.hidden\"\n :class-name=\"itemClass(item, 'divider')\"\n :style=\"itemStyle(item, 'divider')\"\n />\n </template>\n </template>\n </Paper>\n</template>\n","<script setup lang=\"ts\">\nimport { useContextMenuSettings } from '../../context'\nimport type { ContextMenuOverlayEmits } from '../../types'\nimport '../../ContextMenuOverlay.css'\n\ndefineOptions({ name: 'ContextMenuOverlay' })\nconst props = defineProps<{ zIndex?: number }>()\nconst emit = defineEmits<ContextMenuOverlayEmits>()\nconst settings = useContextMenuSettings()\n\nfunction click(event: MouseEvent) {\n event.preventDefault()\n emit('hide')\n}\n\nfunction contextmenu(event: MouseEvent) {\n event.preventDefault()\n if (!settings.value.repositionOnRepeat) {\n emit('hide')\n return\n }\n try {\n document.elementsFromPoint(event.clientX, event.clientY)[1]?.dispatchEvent(\n new MouseEvent('contextmenu', {\n bubbles: true,\n clientX: event.clientX,\n clientY: event.clientY,\n }),\n )\n } catch {\n // The target may disappear while the event is dispatched.\n }\n}\n</script>\n\n<template>\n <div\n class=\"mantine-contextmenu-overlay\"\n :style=\"{ zIndex: props.zIndex }\"\n @click=\"click\"\n @contextmenu=\"contextmenu\"\n >\n <slot />\n </div>\n</template>\n","<script setup lang=\"ts\">\nimport { useContextMenuSettings } from '../../context'\nimport type { ContextMenuOverlayEmits } from '../../types'\nimport '../../ContextMenuOverlay.css'\n\ndefineOptions({ name: 'ContextMenuOverlay' })\nconst props = defineProps<{ zIndex?: number }>()\nconst emit = defineEmits<ContextMenuOverlayEmits>()\nconst settings = useContextMenuSettings()\n\nfunction click(event: MouseEvent) {\n event.preventDefault()\n emit('hide')\n}\n\nfunction contextmenu(event: MouseEvent) {\n event.preventDefault()\n if (!settings.value.repositionOnRepeat) {\n emit('hide')\n return\n }\n try {\n document.elementsFromPoint(event.clientX, event.clientY)[1]?.dispatchEvent(\n new MouseEvent('contextmenu', {\n bubbles: true,\n clientX: event.clientX,\n clientY: event.clientY,\n }),\n )\n } catch {\n // The target may disappear while the event is dispatched.\n }\n}\n</script>\n\n<template>\n <div\n class=\"mantine-contextmenu-overlay\"\n :style=\"{ zIndex: props.zIndex }\"\n @click=\"click\"\n @contextmenu=\"contextmenu\"\n >\n <slot />\n </div>\n</template>\n","<script setup lang=\"ts\">\nimport { Portal } from '@mantine-vue/core'\nimport { useHotkeys, useWindowEvent } from '@mantine-vue/hooks'\nimport ContextMenu from '../ContextMenu/ContextMenu.vue'\nimport ContextMenuOverlay from '../ContextMenuOverlay/ContextMenuOverlay.vue'\nimport type { ContextMenuPortalEmits, ContextMenuPortalProps } from '../../types'\n\ndefineOptions({ name: 'ContextMenuPortal' })\nconst props = defineProps<ContextMenuPortalProps>()\nconst emit = defineEmits<ContextMenuPortalEmits>()\nconst hide = () => emit('hide')\nuseWindowEvent('resize', hide)\nuseWindowEvent('scroll', hide)\nuseHotkeys([['Escape', hide]])\n</script>\n\n<template>\n <Portal>\n <ContextMenuOverlay :z-index=\"props.zIndex\" @hide=\"hide\">\n <ContextMenu\n :x=\"props.x\"\n :y=\"props.y\"\n :content=\"props.content\"\n :dir=\"props.dir\"\n :z-index=\"props.zIndex\"\n :class-name=\"props.className\"\n :style=\"props.style\"\n :class-names=\"props.classNames\"\n :styles=\"props.styles\"\n @hide=\"hide\"\n />\n </ContextMenuOverlay>\n </Portal>\n</template>\n","<script setup lang=\"ts\">\nimport { Portal } from '@mantine-vue/core'\nimport { useHotkeys, useWindowEvent } from '@mantine-vue/hooks'\nimport ContextMenu from '../ContextMenu/ContextMenu.vue'\nimport ContextMenuOverlay from '../ContextMenuOverlay/ContextMenuOverlay.vue'\nimport type { ContextMenuPortalEmits, ContextMenuPortalProps } from '../../types'\n\ndefineOptions({ name: 'ContextMenuPortal' })\nconst props = defineProps<ContextMenuPortalProps>()\nconst emit = defineEmits<ContextMenuPortalEmits>()\nconst hide = () => emit('hide')\nuseWindowEvent('resize', hide)\nuseWindowEvent('scroll', hide)\nuseHotkeys([['Escape', hide]])\n</script>\n\n<template>\n <Portal>\n <ContextMenuOverlay :z-index=\"props.zIndex\" @hide=\"hide\">\n <ContextMenu\n :x=\"props.x\"\n :y=\"props.y\"\n :content=\"props.content\"\n :dir=\"props.dir\"\n :z-index=\"props.zIndex\"\n :class-name=\"props.className\"\n :style=\"props.style\"\n :class-names=\"props.classNames\"\n :styles=\"props.styles\"\n @hide=\"hide\"\n />\n </ContextMenuOverlay>\n </Portal>\n</template>\n","<script setup lang=\"ts\">\nimport { computed, provide, shallowRef, toRef } from 'vue'\nimport { useDirection } from '@mantine-vue/core'\nimport ContextMenuPortal from '../ContextMenuPortal/ContextMenuPortal.vue'\nimport { ContextMenuKey, ContextMenuSettingsKey } from '../../context'\nimport type {\n ContextMenuInstanceOptions,\n ContextMenuOptions,\n ContextMenuProviderProps,\n ShowContextMenuFunction,\n} from '../../types'\n\ndefineOptions({ name: 'ContextMenuProvider' })\nconst props = withDefaults(defineProps<ContextMenuProviderProps>(), {\n zIndex: 9999,\n shadow: 'sm',\n borderRadius: 'xs',\n submenuDelay: 500,\n repositionOnRepeat: false,\n})\nconst data = shallowRef<(ContextMenuInstanceOptions & ContextMenuOptions) | null>(null)\nconst { dir } = useDirection()\n\nfunction hideContextMenu() {\n data.value = null\n}\n\nconst showContextMenu: ShowContextMenuFunction = (content, options) => (event) => {\n event.preventDefault()\n event.stopPropagation()\n const position =\n 'touches' in event\n ? { x: event.touches.item(0)!.clientX, y: event.touches.item(0)!.clientY }\n : { x: event.clientX, y: event.clientY }\n data.value = {\n ...position,\n content,\n zIndex: options?.zIndex || props.zIndex,\n className: options?.className,\n style: options?.style,\n classNames: options?.classNames,\n styles: options?.styles,\n }\n}\n\nprovide(\n ContextMenuSettingsKey,\n computed(() => ({\n shadow: props.shadow,\n borderRadius: props.borderRadius,\n submenuDelay: props.submenuDelay,\n repositionOnRepeat: props.repositionOnRepeat,\n })),\n)\nprovide(ContextMenuKey, {\n showContextMenu,\n hideContextMenu,\n isContextMenuVisible: toRef(() => Boolean(data.value)),\n})\n</script>\n\n<template>\n <slot />\n <ContextMenuPortal v-if=\"data\" v-bind=\"data\" :dir=\"dir\" @hide=\"hideContextMenu\" />\n</template>\n","<script setup lang=\"ts\">\nimport { computed, provide, shallowRef, toRef } from 'vue'\nimport { useDirection } from '@mantine-vue/core'\nimport ContextMenuPortal from '../ContextMenuPortal/ContextMenuPortal.vue'\nimport { ContextMenuKey, ContextMenuSettingsKey } from '../../context'\nimport type {\n ContextMenuInstanceOptions,\n ContextMenuOptions,\n ContextMenuProviderProps,\n ShowContextMenuFunction,\n} from '../../types'\n\ndefineOptions({ name: 'ContextMenuProvider' })\nconst props = withDefaults(defineProps<ContextMenuProviderProps>(), {\n zIndex: 9999,\n shadow: 'sm',\n borderRadius: 'xs',\n submenuDelay: 500,\n repositionOnRepeat: false,\n})\nconst data = shallowRef<(ContextMenuInstanceOptions & ContextMenuOptions) | null>(null)\nconst { dir } = useDirection()\n\nfunction hideContextMenu() {\n data.value = null\n}\n\nconst showContextMenu: ShowContextMenuFunction = (content, options) => (event) => {\n event.preventDefault()\n event.stopPropagation()\n const position =\n 'touches' in event\n ? { x: event.touches.item(0)!.clientX, y: event.touches.item(0)!.clientY }\n : { x: event.clientX, y: event.clientY }\n data.value = {\n ...position,\n content,\n zIndex: options?.zIndex || props.zIndex,\n className: options?.className,\n style: options?.style,\n classNames: options?.classNames,\n styles: options?.styles,\n }\n}\n\nprovide(\n ContextMenuSettingsKey,\n computed(() => ({\n shadow: props.shadow,\n borderRadius: props.borderRadius,\n submenuDelay: props.submenuDelay,\n repositionOnRepeat: props.repositionOnRepeat,\n })),\n)\nprovide(ContextMenuKey, {\n showContextMenu,\n hideContextMenu,\n isContextMenuVisible: toRef(() => Boolean(data.value)),\n})\n</script>\n\n<template>\n <slot />\n <ContextMenuPortal v-if=\"data\" v-bind=\"data\" :dir=\"dir\" @hide=\"hideContextMenu\" />\n</template>\n"],"mappings":";;;;;AAIA,SAAgB,SAAS,OAAe;CACtC,MAAM,MAAM,MACT,QAAQ,sBAAsB,OAAO,EACrC,QAAQ,SAAS,GAAG,EACpB,KAAK,EACL,YAAY;CAEf,OAAO,GAAG,IAAI,OAAO,CAAC,EAAE,YAAY,IAAI,IAAI,MAAM,CAAC;AACrD;AAEA,SAAgB,wBACd,OACA,OAC0B;CAC1B,OAAO,OAAO,UAAU,aAAa,MAAM,KAAK,IAAI;AACtD;AAEA,SAAgB,yBACd,QACA,OACA;CACA,OAAO,OAAO,WAAW,aAAa,OAAO,KAAK,IAAI;AACxD;;;;;;;;;;;EClBA,MAAM,QAAQ;EACd,MAAM,QAAQ,gBAAgB;EAC9B,MAAM,gBAAgB,eAAe,wBAAwB,MAAM,OAAO,MAAM,KAAK,CAAC;;uBAIpF,YAAwF,MAAA,GAAA,GAAA;IAAlF,OAAK,eAAA,CAAA,+BAAkC,MAAM,SAAS,CAAA;IAAI,OAAK,eAAE,cAAA,KAAa;;;;;;;AEJtF,IAAa,yBAAyB,OAAO,qBAAqB;AAIlE,IAAa,iBAAiB,OAAO,aAAa;AAGlD,IAAM,WAAoC;CACxC,6BAA6B,KAAA;CAC7B,uBAAuB,KAAA;CACvB,sBAJa,SAAS,IAAI,KAAK,CAI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E,GAAG,MAAM,QAAQ,KAAK,CAAC,EAAG;KAAS,GAAG,MAAM,QAAQ,KAAK,CAAC,EAAG;IAAQ,IACvE;KAAE,GAAG,MAAM;KAAS,GAAG,MAAM;IAAQ;IAGzC;IACA,QAAQ,SAAS,UAAU,MAAM;IACjC,WAAW,SAAS;IACpB,OAAO,SAAS;IAChB,YAAY,SAAS;IACrB,QAAQ,SAAS;GACnB;EACF;EAEA,QACE,wBACA,gBAAgB;GACd,QAAQ,MAAM;GACd,cAAc,MAAM;GACpB,cAAc,MAAM;GACpB,oBAAoB,MAAM;EAC5B,EAAE,CACJ;EACA,QAAQ,gBAAgB;GACtB;GACA;GACA,sBAAsB,YAAY,QAAQ,KAAK,KAAK,CAAC;EACvD,CAAC;;2DAIC,WAAQ,KAAA,QAAA,SAAA,GACiB,KAAA,SAAA,UAAA,GAAzB,YAAkF,2BAAlF,WAAkF,EAAA,KAAA,EAAA,GAA3C,KAAA,OAAI;IAAG,KAAK,MAAA,GAAA;IAAM,QAAM"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@mantine-vue/contextmenu",
3
- "version": "3.5.0",
3
+ "version": "3.6.0",
4
4
  "description": "Desktop-grade context menu extension for Mantine Vue",
5
5
  "license": "MIT",
6
6
  "files": [
@@ -39,8 +39,8 @@
39
39
  "vue": "^3.5.0"
40
40
  },
41
41
  "peerDependencies": {
42
- "@mantine-vue/core": "3.5.0",
43
- "@mantine-vue/hooks": "3.5.0",
42
+ "@mantine-vue/core": "3.6.0",
43
+ "@mantine-vue/hooks": "3.6.0",
44
44
  "vue": "^3.5.0"
45
45
  },
46
46
  "mantineVue": {