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