@mantine-vue/contextmenu 2.3.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/esm/index.mjs ADDED
@@ -0,0 +1,531 @@
1
+ import { Fragment, computed, defineComponent, h, inject, onBeforeUnmount, provide, readonly, ref, shallowRef, toRef, watch } from "vue";
2
+ import { Box, Paper, Portal, UnstyledButton, parseThemeColor, px, resolveNode, rgba, useDirection, useMantineTheme } from "@mantine-vue/core";
3
+ import { useHotkeys, useMediaQuery, useResizeObserver, useTimeout, useWindowEvent } from "@mantine-vue/hooks";
4
+ //#region src/utils.ts
5
+ /** Returns a humanized version of a string, for example "camelCase" becomes "Camel Case". */
6
+ function humanize(value) {
7
+ const str = value.replace(/([a-z\d])([A-Z]+)/g, "$1 $2").replace(/\W|_/g, " ").trim().toLowerCase();
8
+ return `${str.charAt(0).toUpperCase()}${str.slice(1)}`;
9
+ }
10
+ function resolveContextMenuStyle(style, theme) {
11
+ return typeof style === "function" ? style(theme) : style;
12
+ }
13
+ function resolveContextMenuStyles(styles, theme) {
14
+ return typeof styles === "function" ? styles(theme) : styles;
15
+ }
16
+ //#endregion
17
+ //#region src/ContextMenuDivider.ts
18
+ var ContextMenuDivider = defineComponent({
19
+ name: "ContextMenuDivider",
20
+ props: {
21
+ className: {
22
+ type: String,
23
+ default: void 0
24
+ },
25
+ style: {
26
+ type: [Object, Function],
27
+ default: void 0
28
+ }
29
+ },
30
+ setup(props) {
31
+ const theme = useMantineTheme();
32
+ return () => h(Box, {
33
+ class: ["mantine-contextmenu-divider", props.className],
34
+ style: resolveContextMenuStyle(props.style, theme.value)
35
+ });
36
+ }
37
+ });
38
+ //#endregion
39
+ //#region src/context.ts
40
+ var ContextMenuSettingsKey = Symbol("ContextMenuSettings");
41
+ var ContextMenuKey = Symbol("ContextMenu");
42
+ var fallback = {
43
+ showContextMenu: () => () => void 0,
44
+ hideContextMenu: () => void 0,
45
+ isContextMenuVisible: readonly(ref(false))
46
+ };
47
+ function useContextMenu() {
48
+ return inject(ContextMenuKey, fallback);
49
+ }
50
+ function useContextMenuSettings() {
51
+ return inject(ContextMenuSettingsKey, { value: {
52
+ shadow: "sm",
53
+ borderRadius: "xs",
54
+ submenuDelay: 500,
55
+ repositionOnRepeat: false
56
+ } });
57
+ }
58
+ //#endregion
59
+ //#region src/ContextMenuItem.ts
60
+ var ContextMenuItem = defineComponent({
61
+ name: "ContextMenuItem",
62
+ props: {
63
+ title: {
64
+ type: null,
65
+ required: true
66
+ },
67
+ icon: {
68
+ type: null,
69
+ default: void 0
70
+ },
71
+ iconRight: {
72
+ type: null,
73
+ default: void 0
74
+ },
75
+ color: {
76
+ type: String,
77
+ default: void 0
78
+ },
79
+ disabled: {
80
+ type: Boolean,
81
+ default: false
82
+ },
83
+ onClick: {
84
+ type: Function,
85
+ default: void 0
86
+ },
87
+ items: {
88
+ type: Array,
89
+ default: void 0
90
+ },
91
+ onHide: {
92
+ type: Function,
93
+ required: true
94
+ },
95
+ submenuProps: {
96
+ type: Object,
97
+ required: true
98
+ },
99
+ className: {
100
+ type: String,
101
+ default: void 0
102
+ },
103
+ style: {
104
+ type: [Object, Function],
105
+ default: void 0
106
+ }
107
+ },
108
+ setup(props) {
109
+ const button = ref(null);
110
+ const submenuPosition = ref(null);
111
+ const settings = useContextMenuSettings();
112
+ const theme = useMantineTheme();
113
+ const hoverAvailable = useMediaQuery("(hover: hover)");
114
+ const showSubmenuTimeout = useTimeout(() => {
115
+ if (!button.value) return;
116
+ const rect = button.value.getBoundingClientRect();
117
+ submenuPosition.value = {
118
+ x: (props.submenuProps.dir || "ltr") === "ltr" ? rect.right : rect.left,
119
+ y: rect.top
120
+ };
121
+ }, settings.value.submenuDelay);
122
+ const hideSubmenuTimeout = useTimeout(() => {
123
+ submenuPosition.value = null;
124
+ }, settings.value.submenuDelay);
125
+ const showSubmenu = () => {
126
+ hideSubmenuTimeout.clear();
127
+ showSubmenuTimeout.start();
128
+ };
129
+ const hideSubmenu = () => {
130
+ showSubmenuTimeout.clear();
131
+ hideSubmenuTimeout.start();
132
+ };
133
+ const handleSubmenuClick = (event) => {
134
+ event.stopPropagation();
135
+ showSubmenu();
136
+ };
137
+ const handleActionClick = (event) => {
138
+ props.onHide();
139
+ props.onClick?.(event);
140
+ };
141
+ const setButtonRef = (node) => {
142
+ button.value = node?.$el ?? node ?? null;
143
+ };
144
+ return () => {
145
+ const hasSubmenu = Boolean(props.items && !props.disabled);
146
+ const parsed = props.color ? parseThemeColor({
147
+ color: props.color,
148
+ theme: theme.value
149
+ }) : null;
150
+ const itemColor = parsed?.value ?? "var(--mantine-color-text)";
151
+ const colorValue = parsed?.value;
152
+ return h("div", {
153
+ onMouseenter: hasSubmenu && hoverAvailable.value ? showSubmenu : void 0,
154
+ onMouseleave: hasSubmenu && hoverAvailable.value ? hideSubmenu : void 0
155
+ }, [h(UnstyledButton, {
156
+ ref: setButtonRef,
157
+ dir: props.submenuProps.dir || "ltr",
158
+ class: ["mantine-contextmenu-item-button", props.className],
159
+ disabled: props.disabled,
160
+ style: {
161
+ "--mantine-contextmenu-item-button-color": itemColor,
162
+ "--mantine-contextmenu-item-button-hover-bg-color-light": colorValue ? rgba(colorValue, .08) : rgba(theme.value.colors.gray[4], .25),
163
+ "--mantine-contextmenu-item-button-hover-bg-color-dark": colorValue ? rgba(colorValue, .15) : rgba(theme.value.colors.dark[3], .25),
164
+ "--mantine-contextmenu-item-button-pressed-bg-color-light": colorValue ? rgba(colorValue, .2) : rgba(theme.value.colors.gray[4], .5),
165
+ "--mantine-contextmenu-item-button-pressed-bg-color-dark": colorValue ? rgba(colorValue, .3) : rgba(theme.value.colors.dark[3], .5),
166
+ ...resolveContextMenuStyle(props.style, theme.value)
167
+ },
168
+ onClick: hasSubmenu ? handleSubmenuClick : props.onClick ? handleActionClick : void 0
169
+ }, () => [
170
+ props.icon ? h(Box, {
171
+ fz: 0,
172
+ me: "xs",
173
+ mt: -2
174
+ }, () => resolveNode(props.icon)) : null,
175
+ h("div", { class: "mantine-contextmenu-item-button-title" }, [resolveNode(props.title)]),
176
+ props.iconRight ? h(Box, {
177
+ fz: 0,
178
+ ms: "xs",
179
+ mt: -2
180
+ }, () => resolveNode(props.iconRight)) : props.items ? h(Box, {
181
+ mt: -1,
182
+ ms: "xs"
183
+ }, () => (props.submenuProps.dir || "ltr") === "rtl" ? "‹" : "›") : null
184
+ ]), submenuPosition.value && props.items ? h(ContextMenu, {
185
+ ...props.submenuProps,
186
+ x: submenuPosition.value.x,
187
+ y: submenuPosition.value.y,
188
+ content: props.items,
189
+ onHide: props.onHide,
190
+ dir: props.submenuProps.dir || "ltr"
191
+ }) : null]);
192
+ };
193
+ }
194
+ });
195
+ //#endregion
196
+ //#region src/ContextMenu.ts
197
+ var ContextMenu = defineComponent({
198
+ name: "ContextMenu",
199
+ props: {
200
+ x: {
201
+ type: Number,
202
+ required: true
203
+ },
204
+ y: {
205
+ type: Number,
206
+ required: true
207
+ },
208
+ content: {
209
+ type: [Array, Function],
210
+ required: true
211
+ },
212
+ onHide: {
213
+ type: Function,
214
+ required: true
215
+ },
216
+ zIndex: {
217
+ type: Number,
218
+ default: void 0
219
+ },
220
+ dir: {
221
+ type: String,
222
+ default: "ltr"
223
+ },
224
+ className: {
225
+ type: String,
226
+ default: void 0
227
+ },
228
+ style: {
229
+ type: [Object, Function],
230
+ default: void 0
231
+ },
232
+ classNames: {
233
+ type: Object,
234
+ default: void 0
235
+ },
236
+ styles: {
237
+ type: [Object, Function],
238
+ default: void 0
239
+ }
240
+ },
241
+ setup(props) {
242
+ const settings = useContextMenuSettings();
243
+ const theme = useMantineTheme();
244
+ const { ref: menuRef, rect } = useResizeObserver();
245
+ const mounted = ref(false);
246
+ let frameId = 0;
247
+ watch(() => [rect.value.width, rect.value.height], ([width, height]) => {
248
+ if (width > 0 && height > 0) {
249
+ cancelAnimationFrame(frameId);
250
+ frameId = requestAnimationFrame(() => {
251
+ mounted.value = true;
252
+ });
253
+ }
254
+ }, { immediate: true });
255
+ onBeforeUnmount(() => cancelAnimationFrame(frameId));
256
+ const position = computed(() => {
257
+ const spacing = px(theme.value.spacing.md);
258
+ const windowWidth = typeof window === "undefined" ? 0 : window.innerWidth;
259
+ const windowHeight = typeof window === "undefined" ? 0 : window.innerHeight;
260
+ const top = props.y + rect.value.height + spacing > windowHeight ? windowHeight - rect.value.height - spacing : props.y;
261
+ const left = props.dir === "rtl" ? props.x - rect.value.width < spacing ? spacing : props.x - rect.value.width : props.x + rect.value.width + spacing > windowWidth ? windowWidth - rect.value.width - spacing : props.x;
262
+ return {
263
+ zIndex: props.zIndex,
264
+ top: `${top}px`,
265
+ left: `${left}px`
266
+ };
267
+ });
268
+ const setMenuRef = (node) => {
269
+ menuRef.value = node?.$el ?? node ?? null;
270
+ };
271
+ return () => {
272
+ const resolvedStyles = resolveContextMenuStyles(props.styles, theme.value);
273
+ const submenuProps = {
274
+ className: props.className,
275
+ style: props.style,
276
+ classNames: props.classNames,
277
+ styles: props.styles,
278
+ dir: props.dir
279
+ };
280
+ const content = typeof props.content === "function" ? props.content(props.onHide) : props.content.map((item) => {
281
+ if (item.hidden) return null;
282
+ if (item.onClick || item.items) return h(ContextMenuItem, {
283
+ key: item.key,
284
+ className: [props.classNames?.item, item.className].filter(Boolean).join(" "),
285
+ style: {
286
+ ...resolveContextMenuStyle(resolvedStyles?.item, theme.value),
287
+ ...resolveContextMenuStyle(item.style, theme.value)
288
+ },
289
+ title: item.title ?? humanize(item.key),
290
+ icon: item.icon,
291
+ iconRight: item.iconRight,
292
+ color: item.color,
293
+ disabled: item.disabled,
294
+ onClick: item.onClick,
295
+ items: item.items,
296
+ onHide: props.onHide,
297
+ submenuProps
298
+ });
299
+ return h(ContextMenuDivider, {
300
+ key: item.key,
301
+ className: [props.classNames?.divider, item.className].filter(Boolean).join(" "),
302
+ style: {
303
+ ...resolveContextMenuStyle(resolvedStyles?.divider, theme.value),
304
+ ...resolveContextMenuStyle(item.style, theme.value)
305
+ }
306
+ });
307
+ });
308
+ return h(Paper, {
309
+ ref: setMenuRef,
310
+ shadow: settings.value.shadow,
311
+ radius: settings.value.borderRadius,
312
+ dir: props.dir,
313
+ class: [
314
+ "mantine-contextmenu",
315
+ mounted.value && "mantine-contextmenu-mounted",
316
+ props.className,
317
+ props.classNames?.root
318
+ ],
319
+ style: {
320
+ ...position.value,
321
+ ...resolveContextMenuStyle(props.style, theme.value),
322
+ ...resolveContextMenuStyle(resolvedStyles?.root, theme.value)
323
+ }
324
+ }, () => content);
325
+ };
326
+ }
327
+ });
328
+ //#endregion
329
+ //#region src/ContextMenuOverlay.ts
330
+ var ContextMenuOverlay = defineComponent({
331
+ name: "ContextMenuOverlay",
332
+ props: {
333
+ zIndex: {
334
+ type: Number,
335
+ default: void 0
336
+ },
337
+ onHide: {
338
+ type: Function,
339
+ required: true
340
+ }
341
+ },
342
+ setup(props, { slots }) {
343
+ const settings = useContextMenuSettings();
344
+ const handleClick = (event) => {
345
+ event.preventDefault();
346
+ props.onHide();
347
+ };
348
+ const handleContextMenu = (event) => {
349
+ event.preventDefault();
350
+ if (!settings.value.repositionOnRepeat) {
351
+ props.onHide();
352
+ return;
353
+ }
354
+ try {
355
+ document.elementsFromPoint(event.clientX, event.clientY)[1]?.dispatchEvent(new MouseEvent("contextmenu", {
356
+ bubbles: true,
357
+ clientX: event.clientX,
358
+ clientY: event.clientY
359
+ }));
360
+ } catch {}
361
+ };
362
+ return () => h("div", {
363
+ class: "mantine-contextmenu-overlay",
364
+ style: { zIndex: props.zIndex },
365
+ onClick: handleClick,
366
+ onContextmenu: handleContextMenu
367
+ }, slots.default?.());
368
+ }
369
+ });
370
+ //#endregion
371
+ //#region src/ContextMenuPortal.ts
372
+ var ContextMenuPortal = defineComponent({
373
+ name: "ContextMenuPortal",
374
+ props: {
375
+ x: {
376
+ type: Number,
377
+ required: true
378
+ },
379
+ y: {
380
+ type: Number,
381
+ required: true
382
+ },
383
+ content: {
384
+ type: [Array, Function],
385
+ required: true
386
+ },
387
+ onHide: {
388
+ type: Function,
389
+ required: true
390
+ },
391
+ zIndex: {
392
+ type: Number,
393
+ default: void 0
394
+ },
395
+ dir: {
396
+ type: String,
397
+ required: true
398
+ },
399
+ className: {
400
+ type: String,
401
+ default: void 0
402
+ },
403
+ style: {
404
+ type: [Object, Function],
405
+ default: void 0
406
+ },
407
+ classNames: {
408
+ type: Object,
409
+ default: void 0
410
+ },
411
+ styles: {
412
+ type: [Object, Function],
413
+ default: void 0
414
+ }
415
+ },
416
+ setup(props) {
417
+ useWindowEvent("resize", props.onHide);
418
+ useWindowEvent("scroll", props.onHide);
419
+ useHotkeys([["Escape", props.onHide]]);
420
+ return () => h(Portal, null, () => h(ContextMenuOverlay, {
421
+ zIndex: props.zIndex,
422
+ onHide: props.onHide
423
+ }, () => h(ContextMenu, {
424
+ x: props.x,
425
+ y: props.y,
426
+ content: props.content,
427
+ onHide: props.onHide,
428
+ dir: props.dir,
429
+ zIndex: props.zIndex,
430
+ className: props.className,
431
+ style: props.style,
432
+ classNames: props.classNames,
433
+ styles: props.styles
434
+ })));
435
+ }
436
+ });
437
+ //#endregion
438
+ //#region src/ContextMenuProvider.ts
439
+ var DEFAULT_SETTINGS = {
440
+ shadow: "sm",
441
+ borderRadius: "xs",
442
+ submenuDelay: 500,
443
+ repositionOnRepeat: false
444
+ };
445
+ var ContextMenuProvider = defineComponent({
446
+ name: "ContextMenuProvider",
447
+ props: {
448
+ zIndex: {
449
+ type: Number,
450
+ default: 9999
451
+ },
452
+ shadow: {
453
+ type: String,
454
+ default: DEFAULT_SETTINGS.shadow
455
+ },
456
+ borderRadius: {
457
+ type: [String, Number],
458
+ default: DEFAULT_SETTINGS.borderRadius
459
+ },
460
+ submenuDelay: {
461
+ type: Number,
462
+ default: DEFAULT_SETTINGS.submenuDelay
463
+ },
464
+ repositionOnRepeat: {
465
+ type: Boolean,
466
+ default: DEFAULT_SETTINGS.repositionOnRepeat
467
+ },
468
+ className: {
469
+ type: String,
470
+ default: void 0
471
+ },
472
+ style: {
473
+ type: [Object, Function],
474
+ default: void 0
475
+ },
476
+ classNames: {
477
+ type: Object,
478
+ default: void 0
479
+ },
480
+ styles: {
481
+ type: [Object, Function],
482
+ default: void 0
483
+ }
484
+ },
485
+ setup(props, { slots }) {
486
+ const data = shallowRef(null);
487
+ const { dir } = useDirection();
488
+ const hideContextMenu = () => {
489
+ data.value = null;
490
+ };
491
+ const showContextMenu = (content, options) => (event) => {
492
+ event.preventDefault();
493
+ event.stopPropagation();
494
+ data.value = {
495
+ ..."touches" in event ? {
496
+ x: event.touches.item(0).clientX,
497
+ y: event.touches.item(0).clientY
498
+ } : {
499
+ x: event.clientX,
500
+ y: event.clientY
501
+ },
502
+ content,
503
+ zIndex: options?.zIndex || props.zIndex,
504
+ className: options?.className,
505
+ style: options?.style,
506
+ classNames: options?.classNames,
507
+ styles: options?.styles
508
+ };
509
+ };
510
+ provide(ContextMenuSettingsKey, computed(() => ({
511
+ shadow: props.shadow,
512
+ borderRadius: props.borderRadius,
513
+ submenuDelay: props.submenuDelay,
514
+ repositionOnRepeat: props.repositionOnRepeat
515
+ })));
516
+ provide(ContextMenuKey, {
517
+ showContextMenu,
518
+ hideContextMenu,
519
+ isContextMenuVisible: toRef(() => Boolean(data.value))
520
+ });
521
+ return () => h(Fragment, null, [slots.default?.(), data.value ? h(ContextMenuPortal, {
522
+ ...data.value,
523
+ onHide: hideContextMenu,
524
+ dir: dir.value
525
+ }) : null]);
526
+ }
527
+ });
528
+ //#endregion
529
+ export { ContextMenu, ContextMenuKey as ContextMenuCtx, ContextMenuKey, ContextMenuDivider, ContextMenuItem, ContextMenuOverlay, ContextMenuPortal, ContextMenuProvider, ContextMenuSettingsKey as ContextMenuSettingsCtx, ContextMenuSettingsKey, humanize, resolveContextMenuStyle, resolveContextMenuStyles, useContextMenu };
530
+
531
+ //# sourceMappingURL=index.mjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.mjs","names":[],"sources":["../src/utils.ts","../src/ContextMenuDivider.ts","../src/context.ts","../src/ContextMenuItem.ts","../src/ContextMenu.ts","../src/ContextMenuOverlay.ts","../src/ContextMenuPortal.ts","../src/ContextMenuProvider.ts"],"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","import { defineComponent, h, type PropType } from 'vue'\nimport { Box, useMantineTheme } from '@mantine-vue/core'\nimport { resolveContextMenuStyle } from './utils'\nimport type { ContextMenuDividerProps, ContextMenuStyle } from './types'\nimport './ContextMenuDivider.css'\n\nexport const ContextMenuDivider = defineComponent({\n name: 'ContextMenuDivider',\n props: {\n className: { type: String, default: undefined },\n style: {\n type: [Object, Function] as PropType<ContextMenuStyle>,\n default: undefined,\n },\n },\n setup(props: ContextMenuDividerProps) {\n const theme = useMantineTheme()\n\n return () =>\n h(Box, {\n class: ['mantine-contextmenu-divider', props.className],\n style: resolveContextMenuStyle(props.style, theme.value),\n })\n },\n})\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","import { defineComponent, h, ref, type DefineComponent, type PropType, type VNode } from 'vue'\nimport {\n Box,\n parseThemeColor,\n resolveNode,\n rgba,\n UnstyledButton,\n useMantineTheme,\n type MantineColor,\n type MantineNode,\n} from '@mantine-vue/core'\nimport { useMediaQuery, useTimeout } from '@mantine-vue/hooks'\nimport { ContextMenu } from './ContextMenu'\nimport { useContextMenuSettings } from './context'\nimport { resolveContextMenuStyle } from './utils'\nimport type {\n ContextMenuItemOptions,\n ContextMenuItemProps,\n ContextMenuSubmenuProps,\n ContextMenuStyle,\n} from './types'\nimport './ContextMenuItem.css'\n\nexport const ContextMenuItem = defineComponent({\n name: 'ContextMenuItem',\n props: {\n title: {\n type: null as unknown as PropType<MantineNode>,\n required: true,\n },\n icon: {\n type: null as unknown as PropType<MantineNode>,\n default: undefined,\n },\n iconRight: {\n type: null as unknown as PropType<MantineNode>,\n default: undefined,\n },\n color: {\n type: String as PropType<MantineColor>,\n default: undefined,\n },\n disabled: { type: Boolean, default: false },\n onClick: {\n type: Function as PropType<(event: MouseEvent) => void>,\n default: undefined,\n },\n items: {\n type: Array as PropType<ContextMenuItemOptions[]>,\n default: undefined,\n },\n onHide: {\n type: Function as PropType<() => void>,\n required: true,\n },\n submenuProps: {\n type: Object as PropType<ContextMenuSubmenuProps>,\n required: true,\n },\n className: { type: String, default: undefined },\n style: {\n type: [Object, Function] as PropType<ContextMenuStyle>,\n default: undefined,\n },\n },\n setup(props) {\n const button = ref<HTMLElement | null>(null)\n const submenuPosition = ref<{ x: number; y: number } | null>(null)\n const settings = useContextMenuSettings()\n const theme = useMantineTheme()\n const hoverAvailable = useMediaQuery('(hover: hover)')\n\n const showSubmenuTimeout = useTimeout(() => {\n if (!button.value) {\n return\n }\n\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)\n\n const hideSubmenuTimeout = useTimeout(() => {\n submenuPosition.value = null\n }, settings.value.submenuDelay)\n\n const showSubmenu = () => {\n hideSubmenuTimeout.clear()\n showSubmenuTimeout.start()\n }\n\n const hideSubmenu = () => {\n showSubmenuTimeout.clear()\n hideSubmenuTimeout.start()\n }\n\n const handleSubmenuClick = (event: MouseEvent) => {\n event.stopPropagation()\n showSubmenu()\n }\n\n const handleActionClick = (event: MouseEvent) => {\n props.onHide()\n props.onClick?.(event)\n }\n\n const setButtonRef = (node: any) => {\n button.value = node?.$el ?? node ?? null\n }\n\n return (): VNode => {\n const hasSubmenu = Boolean(props.items && !props.disabled)\n const parsed = props.color\n ? parseThemeColor({ color: props.color, theme: theme.value })\n : null\n const itemColor = parsed?.value ?? 'var(--mantine-color-text)'\n const colorValue = parsed?.value\n\n return h(\n 'div',\n {\n onMouseenter: hasSubmenu && hoverAvailable.value ? showSubmenu : undefined,\n onMouseleave: hasSubmenu && hoverAvailable.value ? hideSubmenu : undefined,\n },\n [\n h(\n UnstyledButton,\n {\n ref: setButtonRef,\n dir: props.submenuProps.dir || 'ltr',\n class: ['mantine-contextmenu-item-button', props.className],\n disabled: props.disabled,\n style: {\n '--mantine-contextmenu-item-button-color': itemColor,\n '--mantine-contextmenu-item-button-hover-bg-color-light': colorValue\n ? rgba(colorValue, 0.08)\n : rgba(theme.value.colors.gray[4], 0.25),\n '--mantine-contextmenu-item-button-hover-bg-color-dark': colorValue\n ? rgba(colorValue, 0.15)\n : rgba(theme.value.colors.dark[3], 0.25),\n '--mantine-contextmenu-item-button-pressed-bg-color-light': colorValue\n ? rgba(colorValue, 0.2)\n : rgba(theme.value.colors.gray[4], 0.5),\n '--mantine-contextmenu-item-button-pressed-bg-color-dark': colorValue\n ? rgba(colorValue, 0.3)\n : rgba(theme.value.colors.dark[3], 0.5),\n ...resolveContextMenuStyle(props.style, theme.value),\n },\n onClick: hasSubmenu\n ? handleSubmenuClick\n : props.onClick\n ? handleActionClick\n : undefined,\n },\n () => [\n props.icon\n ? h(Box, { fz: 0, me: 'xs', mt: -2 }, () => resolveNode(props.icon))\n : null,\n h('div', { class: 'mantine-contextmenu-item-button-title' }, [\n resolveNode(props.title),\n ]),\n props.iconRight\n ? h(Box, { fz: 0, ms: 'xs', mt: -2 }, () => resolveNode(props.iconRight))\n : props.items\n ? h(Box, { mt: -1, ms: 'xs' }, () =>\n (props.submenuProps.dir || 'ltr') === 'rtl' ? '‹' : '›',\n )\n : null,\n ],\n ),\n submenuPosition.value && props.items\n ? h(ContextMenu, {\n ...props.submenuProps,\n x: submenuPosition.value.x,\n y: submenuPosition.value.y,\n content: props.items,\n onHide: props.onHide,\n dir: props.submenuProps.dir || 'ltr',\n })\n : null,\n ],\n )\n }\n },\n}) as unknown as DefineComponent<ContextMenuItemProps>\n","import {\n computed,\n defineComponent,\n h,\n onBeforeUnmount,\n ref,\n watch,\n type DefineComponent,\n type PropType,\n type VNode,\n type VNodeChild,\n} from 'vue'\nimport {\n Paper,\n px,\n useMantineTheme,\n type MantineRadius,\n type MantineTheme,\n} from '@mantine-vue/core'\nimport { useResizeObserver } from '@mantine-vue/hooks'\nimport { ContextMenuDivider } from './ContextMenuDivider'\nimport { ContextMenuItem } from './ContextMenuItem'\nimport { useContextMenuSettings } from './context'\nimport { resolveContextMenuStyle, resolveContextMenuStyles, humanize } from './utils'\nimport type {\n ContextMenuContent,\n ContextMenuOptions,\n ContextMenuProps,\n ContextMenuSubmenuProps,\n ContextMenuStyles,\n ContextMenuStyle,\n} from './types'\nimport './ContextMenu.css'\n\nexport const ContextMenu = defineComponent({\n name: 'ContextMenu',\n props: {\n x: { type: Number, required: true },\n y: { type: Number, required: true },\n content: {\n type: [Array, Function] as PropType<ContextMenuContent>,\n required: true,\n },\n onHide: {\n type: Function as PropType<() => void>,\n required: true,\n },\n zIndex: { type: Number, default: undefined },\n dir: {\n type: String as PropType<'ltr' | 'rtl'>,\n default: 'ltr',\n },\n className: { type: String, default: undefined },\n style: {\n type: [Object, Function] as PropType<ContextMenuStyle>,\n default: undefined,\n },\n classNames: {\n type: Object as PropType<ContextMenuOptions['classNames']>,\n default: undefined,\n },\n styles: {\n type: [Object, Function] as PropType<\n ContextMenuStyles | ((theme: MantineTheme) => ContextMenuStyles)\n >,\n default: undefined,\n },\n },\n setup(props: ContextMenuProps) {\n const settings = useContextMenuSettings()\n const theme = useMantineTheme()\n const { ref: menuRef, rect } = useResizeObserver<HTMLElement>()\n const mounted = ref(false)\n let frameId = 0\n\n watch(\n () => [rect.value.width, rect.value.height],\n ([width, height]) => {\n if (width > 0 && height > 0) {\n cancelAnimationFrame(frameId)\n frameId = requestAnimationFrame(() => {\n mounted.value = true\n })\n }\n },\n { immediate: true },\n )\n\n onBeforeUnmount(() => cancelAnimationFrame(frameId))\n\n const 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\n return { zIndex: props.zIndex, top: `${top}px`, left: `${left}px` }\n })\n\n const setMenuRef = (node: any) => {\n menuRef.value = node?.$el ?? node ?? null\n }\n\n return (): VNode => {\n const resolvedStyles = resolveContextMenuStyles(props.styles, theme.value)\n const submenuProps: ContextMenuSubmenuProps = {\n className: props.className,\n style: props.style,\n classNames: props.classNames,\n styles: props.styles,\n dir: props.dir,\n }\n\n const content: VNodeChild =\n typeof props.content === 'function'\n ? props.content(props.onHide)\n : props.content.map((item): VNodeChild => {\n if (item.hidden) {\n return null\n }\n\n if (item.onClick || item.items) {\n return h(ContextMenuItem, {\n key: item.key,\n className: [props.classNames?.item, item.className].filter(Boolean).join(' '),\n style: {\n ...resolveContextMenuStyle(resolvedStyles?.item, theme.value),\n ...resolveContextMenuStyle(item.style, theme.value),\n },\n title: item.title ?? humanize(item.key),\n icon: item.icon,\n iconRight: item.iconRight,\n color: item.color,\n disabled: item.disabled,\n onClick: item.onClick,\n items: item.items,\n onHide: props.onHide,\n submenuProps,\n })\n }\n\n return h(ContextMenuDivider, {\n key: item.key,\n className: [props.classNames?.divider, item.className].filter(Boolean).join(' '),\n style: {\n ...resolveContextMenuStyle(resolvedStyles?.divider, theme.value),\n ...resolveContextMenuStyle(item.style, theme.value),\n },\n })\n })\n\n return h(\n Paper,\n {\n ref: setMenuRef,\n shadow: settings.value.shadow,\n radius: settings.value.borderRadius as MantineRadius,\n dir: props.dir,\n class: [\n 'mantine-contextmenu',\n mounted.value && 'mantine-contextmenu-mounted',\n props.className,\n props.classNames?.root,\n ],\n style: {\n ...position.value,\n ...resolveContextMenuStyle(props.style, theme.value),\n ...resolveContextMenuStyle(resolvedStyles?.root, theme.value),\n },\n },\n () => content,\n )\n }\n },\n}) as unknown as DefineComponent<ContextMenuProps>\n","import { defineComponent, h, type PropType } from 'vue'\nimport { useContextMenuSettings } from './context'\nimport './ContextMenuOverlay.css'\n\nexport const ContextMenuOverlay = defineComponent({\n name: 'ContextMenuOverlay',\n props: {\n zIndex: { type: Number, default: undefined },\n onHide: {\n type: Function as PropType<() => void>,\n required: true,\n },\n },\n setup(props, { slots }) {\n const settings = useContextMenuSettings()\n\n const handleClick = (event: MouseEvent) => {\n event.preventDefault()\n props.onHide()\n }\n\n const handleContextMenu = (event: MouseEvent) => {\n event.preventDefault()\n\n if (!settings.value.repositionOnRepeat) {\n props.onHide()\n return\n }\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 // Ignore dispatch errors from elements that disappear during the event.\n }\n }\n\n return () =>\n h(\n 'div',\n {\n class: 'mantine-contextmenu-overlay',\n style: { zIndex: props.zIndex },\n onClick: handleClick,\n onContextmenu: handleContextMenu,\n },\n slots.default?.(),\n )\n },\n})\n","import { defineComponent, h, type PropType } from 'vue'\nimport { Portal, type Direction, type MantineTheme } from '@mantine-vue/core'\nimport { useHotkeys, useWindowEvent } from '@mantine-vue/hooks'\nimport { ContextMenu } from './ContextMenu'\nimport { ContextMenuOverlay } from './ContextMenuOverlay'\nimport type {\n ContextMenuContent,\n ContextMenuOptions,\n ContextMenuPortalProps,\n ContextMenuStyles,\n ContextMenuStyle,\n} from './types'\n\nexport const ContextMenuPortal = defineComponent({\n name: 'ContextMenuPortal',\n props: {\n x: { type: Number, required: true },\n y: { type: Number, required: true },\n content: {\n type: [Array, Function] as PropType<ContextMenuContent>,\n required: true,\n },\n onHide: {\n type: Function as PropType<() => void>,\n required: true,\n },\n zIndex: { type: Number, default: undefined },\n dir: {\n type: String as PropType<Direction>,\n required: true,\n },\n className: { type: String, default: undefined },\n style: {\n type: [Object, Function] as PropType<ContextMenuStyle>,\n default: undefined,\n },\n classNames: {\n type: Object as PropType<ContextMenuOptions['classNames']>,\n default: undefined,\n },\n styles: {\n type: [Object, Function] as PropType<\n ContextMenuStyles | ((theme: MantineTheme) => ContextMenuStyles)\n >,\n default: undefined,\n },\n },\n setup(props: ContextMenuPortalProps) {\n useWindowEvent('resize', props.onHide)\n useWindowEvent('scroll', props.onHide)\n useHotkeys([['Escape', props.onHide]])\n\n return () =>\n h(Portal, null, () =>\n h(ContextMenuOverlay, { zIndex: props.zIndex, onHide: props.onHide }, () =>\n h(ContextMenu, {\n x: props.x,\n y: props.y,\n content: props.content,\n onHide: props.onHide,\n dir: props.dir,\n zIndex: props.zIndex,\n className: props.className,\n style: props.style,\n classNames: props.classNames,\n styles: props.styles,\n }),\n ),\n )\n },\n})\n","import {\n Fragment,\n computed,\n defineComponent,\n h,\n provide,\n shallowRef,\n toRef,\n type PropType,\n} from 'vue'\nimport {\n useDirection,\n type MantineRadius,\n type MantineShadow,\n type MantineTheme,\n} from '@mantine-vue/core'\nimport { ContextMenuPortal } from './ContextMenuPortal'\nimport { ContextMenuKey, ContextMenuSettingsKey, useContextMenu } from './context'\nimport type {\n ContextMenuInstanceOptions,\n ContextMenuOptions,\n ContextMenuStyles,\n ContextMenuStyle,\n ShowContextMenuFunction,\n} from './types'\n\nconst DEFAULT_SETTINGS = {\n shadow: 'sm',\n borderRadius: 'xs',\n submenuDelay: 500,\n repositionOnRepeat: false,\n} as const\n\nexport const ContextMenuProvider = defineComponent({\n name: 'ContextMenuProvider',\n props: {\n zIndex: { type: Number, default: 9999 },\n shadow: {\n type: String as PropType<MantineShadow>,\n default: DEFAULT_SETTINGS.shadow,\n },\n borderRadius: {\n type: [String, Number] as PropType<MantineRadius>,\n default: DEFAULT_SETTINGS.borderRadius,\n },\n submenuDelay: { type: Number, default: DEFAULT_SETTINGS.submenuDelay },\n repositionOnRepeat: {\n type: Boolean,\n default: DEFAULT_SETTINGS.repositionOnRepeat,\n },\n className: { type: String, default: undefined },\n style: {\n type: [Object, Function] as PropType<ContextMenuStyle>,\n default: undefined,\n },\n classNames: {\n type: Object as PropType<ContextMenuOptions['classNames']>,\n default: undefined,\n },\n styles: {\n type: [Object, Function] as PropType<\n ContextMenuStyles | ((theme: MantineTheme) => ContextMenuStyles)\n >,\n default: undefined,\n },\n },\n setup(props, { slots }) {\n const data = shallowRef<(ContextMenuInstanceOptions & ContextMenuOptions) | null>(null)\n const { dir } = useDirection()\n\n const hideContextMenu = () => {\n data.value = null\n }\n\n const showContextMenu: ShowContextMenuFunction = (content, options) => (event) => {\n event.preventDefault()\n event.stopPropagation()\n\n const position =\n 'touches' in event\n ? {\n x: event.touches.item(0)!.clientX,\n y: event.touches.item(0)!.clientY,\n }\n : { x: event.clientX, y: event.clientY }\n\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\n provide(\n ContextMenuSettingsKey,\n computed(() => ({\n shadow: props.shadow,\n borderRadius: props.borderRadius,\n submenuDelay: props.submenuDelay,\n repositionOnRepeat: props.repositionOnRepeat,\n })),\n )\n provide(ContextMenuKey, {\n showContextMenu,\n hideContextMenu,\n isContextMenuVisible: toRef(() => Boolean(data.value)),\n })\n\n return () =>\n h(Fragment, null, [\n slots.default?.(),\n data.value\n ? h(ContextMenuPortal, {\n ...data.value,\n onHide: hideContextMenu,\n dir: dir.value,\n })\n : null,\n ])\n },\n})\n\nexport { ContextMenuKey, ContextMenuSettingsKey, useContextMenu }\nexport { ContextMenuKey as ContextMenuCtx, ContextMenuSettingsKey as ContextMenuSettingsCtx }\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;;;ACpBA,IAAa,qBAAqB,gBAAgB;CAChD,MAAM;CACN,O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 +1,4 @@
1
+ import { type DefineComponent } from 'vue';
2
+ import type { ContextMenuProps } from './types';
3
+ import './ContextMenu.css';
4
+ export declare const ContextMenu: DefineComponent<ContextMenuProps>;
@@ -0,0 +1,14 @@
1
+ import type { ContextMenuStyle } from './types';
2
+ import './ContextMenuDivider.css';
3
+ export declare const ContextMenuDivider: import("vue").DefineComponent<{
4
+ className?: string | undefined;
5
+ style?: ContextMenuStyle | undefined;
6
+ }, () => import("vue").VNode<import("vue").RendererNode, import("vue").RendererElement, {
7
+ [key: string]: any;
8
+ }>, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {}, string, import("vue").PublicProps, Readonly<{
9
+ className?: string | undefined;
10
+ style?: ContextMenuStyle | undefined;
11
+ }> & Readonly<{}>, {
12
+ style: ContextMenuStyle;
13
+ className: string;
14
+ }, {}, {}, {}, string, import("vue").ComponentProvideOptions, true, {}, any>;
@@ -0,0 +1,4 @@
1
+ import { type DefineComponent } from 'vue';
2
+ import type { ContextMenuItemProps } from './types';
3
+ import './ContextMenuItem.css';
4
+ export declare const ContextMenuItem: DefineComponent<ContextMenuItemProps>;
@@ -0,0 +1,25 @@
1
+ import { type PropType } from 'vue';
2
+ import './ContextMenuOverlay.css';
3
+ export declare const ContextMenuOverlay: import("vue").DefineComponent<import("vue").ExtractPropTypes<{
4
+ zIndex: {
5
+ type: NumberConstructor;
6
+ default: undefined;
7
+ };
8
+ onHide: {
9
+ type: PropType<() => void>;
10
+ required: true;
11
+ };
12
+ }>, () => import("vue").VNode<import("vue").RendererNode, import("vue").RendererElement, {
13
+ [key: string]: any;
14
+ }>, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {}, string, import("vue").PublicProps, Readonly<import("vue").ExtractPropTypes<{
15
+ zIndex: {
16
+ type: NumberConstructor;
17
+ default: undefined;
18
+ };
19
+ onHide: {
20
+ type: PropType<() => void>;
21
+ required: true;
22
+ };
23
+ }>> & Readonly<{}>, {
24
+ zIndex: number;
25
+ }, {}, {}, {}, string, import("vue").ComponentProvideOptions, true, {}, any>;
@@ -0,0 +1,33 @@
1
+ import { type MantineTheme } from '@mantine-vue/core';
2
+ import type { ContextMenuContent, ContextMenuStyles, ContextMenuStyle } from './types';
3
+ export declare const ContextMenuPortal: import("vue").DefineComponent<{
4
+ zIndex?: number | undefined;
5
+ dir: "ltr" | "rtl";
6
+ onHide: import("./types").HideContextMenuFunction;
7
+ x: number;
8
+ y: number;
9
+ content: ContextMenuContent;
10
+ className?: string | undefined;
11
+ style?: ContextMenuStyle | undefined;
12
+ classNames?: Partial<Record<"root" | "item" | "divider", string>> | undefined;
13
+ styles?: (ContextMenuStyles | ((theme: MantineTheme) => ContextMenuStyles)) | undefined;
14
+ }, () => import("vue").VNode<import("vue").RendererNode, import("vue").RendererElement, {
15
+ [key: string]: any;
16
+ }>, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {}, string, import("vue").PublicProps, Readonly<{
17
+ zIndex?: number | undefined;
18
+ dir: "ltr" | "rtl";
19
+ onHide: import("./types").HideContextMenuFunction;
20
+ x: number;
21
+ y: number;
22
+ content: ContextMenuContent;
23
+ className?: string | undefined;
24
+ style?: ContextMenuStyle | undefined;
25
+ classNames?: Partial<Record<"root" | "item" | "divider", string>> | undefined;
26
+ styles?: (ContextMenuStyles | ((theme: MantineTheme) => ContextMenuStyles)) | undefined;
27
+ }> & Readonly<{}>, {
28
+ style: ContextMenuStyle;
29
+ classNames: Partial<Record<"root" | "item" | "divider", string>> | undefined;
30
+ styles: Partial<Record<"root" | "item" | "divider", ContextMenuStyle>> | ((theme: MantineTheme) => ContextMenuStyles);
31
+ zIndex: number;
32
+ className: string;
33
+ }, {}, {}, {}, string, import("vue").ComponentProvideOptions, true, {}, any>;