@asup/context-menu 1.3.2 → 1.3.4
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/dist/cjs/main.css +55 -45
- package/dist/cjs/main.css.map +1 -1
- package/dist/cjs/main.js +213 -70
- package/dist/cjs/main.js.map +1 -1
- package/dist/context-menu.d.ts +7 -9
- package/dist/context-menu.d.ts.map +1 -1
- package/dist/main.css +55 -45
- package/dist/main.css.map +1 -1
- package/dist/main.js +219 -72
- package/dist/main.js.map +1 -1
- package/package.json +31 -28
package/dist/main.js
CHANGED
|
@@ -1,12 +1,18 @@
|
|
|
1
1
|
import "./main.css";
|
|
2
|
-
import {
|
|
3
|
-
import $duWW8$react, {
|
|
2
|
+
import {jsx as $duWW8$jsx, jsxs as $duWW8$jsxs, Fragment as $duWW8$Fragment} from "react/jsx-runtime";
|
|
3
|
+
import $duWW8$react, {createContext as $duWW8$createContext, useContext as $duWW8$useContext, useMemo as $duWW8$useMemo, useRef as $duWW8$useRef, useState as $duWW8$useState, useCallback as $duWW8$useCallback, useEffect as $duWW8$useEffect} from "react";
|
|
4
4
|
import {createPortal as $duWW8$createPortal} from "react-dom";
|
|
5
5
|
|
|
6
6
|
|
|
7
7
|
function $parcel$export(e, n, v, s) {
|
|
8
8
|
Object.defineProperty(e, n, {get: v, set: s, enumerable: true, configurable: true});
|
|
9
9
|
}
|
|
10
|
+
|
|
11
|
+
function $parcel$interopDefault(a) {
|
|
12
|
+
return a && a.__esModule ? a.default : a;
|
|
13
|
+
}
|
|
14
|
+
|
|
15
|
+
|
|
10
16
|
var $b65191f6d0a0a991$exports = {};
|
|
11
17
|
|
|
12
18
|
$parcel$export($b65191f6d0a0a991$exports, "ContextMenuHandler", function () { return $1e1c1e9e0b943830$export$ed4f9641643dc7e4; });
|
|
@@ -17,13 +23,45 @@ $parcel$export($b65191f6d0a0a991$exports, "ContextWindowStack", function () { re
|
|
|
17
23
|
|
|
18
24
|
|
|
19
25
|
|
|
26
|
+
var $47067f35ca62d4a5$exports = {};
|
|
27
|
+
|
|
28
|
+
$parcel$export($47067f35ca62d4a5$exports, "anchor", function () { return $47067f35ca62d4a5$export$2e2992790a6f69a8; }, function (v) { return $47067f35ca62d4a5$export$2e2992790a6f69a8 = v; });
|
|
29
|
+
$parcel$export($47067f35ca62d4a5$exports, "caretHolder", function () { return $47067f35ca62d4a5$export$6ed5f4fbab298e07; }, function (v) { return $47067f35ca62d4a5$export$6ed5f4fbab298e07 = v; });
|
|
30
|
+
$parcel$export($47067f35ca62d4a5$exports, "contextMenu", function () { return $47067f35ca62d4a5$export$218b899e1d476006; }, function (v) { return $47067f35ca62d4a5$export$218b899e1d476006 = v; });
|
|
31
|
+
$parcel$export($47067f35ca62d4a5$exports, "contextMenuHandler", function () { return $47067f35ca62d4a5$export$ed8ffb5bb55a3bc8; }, function (v) { return $47067f35ca62d4a5$export$ed8ffb5bb55a3bc8 = v; });
|
|
32
|
+
$parcel$export($47067f35ca62d4a5$exports, "contextMenuItem", function () { return $47067f35ca62d4a5$export$e5ea51c279904378; }, function (v) { return $47067f35ca62d4a5$export$e5ea51c279904378 = v; });
|
|
33
|
+
$parcel$export($47067f35ca62d4a5$exports, "contextMenuItemLabel", function () { return $47067f35ca62d4a5$export$6ada86c5b962aa22; }, function (v) { return $47067f35ca62d4a5$export$6ada86c5b962aa22 = v; });
|
|
34
|
+
$parcel$export($47067f35ca62d4a5$exports, "disabled", function () { return $47067f35ca62d4a5$export$683472f6198a076e; }, function (v) { return $47067f35ca62d4a5$export$683472f6198a076e = v; });
|
|
35
|
+
$parcel$export($47067f35ca62d4a5$exports, "subMenu", function () { return $47067f35ca62d4a5$export$6e0e6ce39e5a0361; }, function (v) { return $47067f35ca62d4a5$export$6e0e6ce39e5a0361 = v; });
|
|
36
|
+
$parcel$export($47067f35ca62d4a5$exports, "visible", function () { return $47067f35ca62d4a5$export$664c6d24e3175067; }, function (v) { return $47067f35ca62d4a5$export$664c6d24e3175067 = v; });
|
|
37
|
+
var $47067f35ca62d4a5$export$2e2992790a6f69a8;
|
|
38
|
+
var $47067f35ca62d4a5$export$6ed5f4fbab298e07;
|
|
39
|
+
var $47067f35ca62d4a5$export$218b899e1d476006;
|
|
40
|
+
var $47067f35ca62d4a5$export$ed8ffb5bb55a3bc8;
|
|
41
|
+
var $47067f35ca62d4a5$export$e5ea51c279904378;
|
|
42
|
+
var $47067f35ca62d4a5$export$6ada86c5b962aa22;
|
|
43
|
+
var $47067f35ca62d4a5$export$683472f6198a076e;
|
|
44
|
+
var $47067f35ca62d4a5$export$6e0e6ce39e5a0361;
|
|
45
|
+
var $47067f35ca62d4a5$export$664c6d24e3175067;
|
|
46
|
+
$47067f35ca62d4a5$export$2e2992790a6f69a8 = `aiw-WinFxq-anchor`;
|
|
47
|
+
$47067f35ca62d4a5$export$6ed5f4fbab298e07 = `aiw-WinFxq-caretHolder`;
|
|
48
|
+
$47067f35ca62d4a5$export$218b899e1d476006 = `aiw-WinFxq-contextMenu`;
|
|
49
|
+
$47067f35ca62d4a5$export$ed8ffb5bb55a3bc8 = `aiw-WinFxq-contextMenuHandler`;
|
|
50
|
+
$47067f35ca62d4a5$export$e5ea51c279904378 = `aiw-WinFxq-contextMenuItem`;
|
|
51
|
+
$47067f35ca62d4a5$export$6ada86c5b962aa22 = `aiw-WinFxq-contextMenuItemLabel`;
|
|
52
|
+
$47067f35ca62d4a5$export$683472f6198a076e = `aiw-WinFxq-disabled`;
|
|
53
|
+
$47067f35ca62d4a5$export$6e0e6ce39e5a0361 = `aiw-WinFxq-subMenu`;
|
|
54
|
+
$47067f35ca62d4a5$export$664c6d24e3175067 = `aiw-WinFxq-visible`;
|
|
55
|
+
|
|
56
|
+
|
|
57
|
+
|
|
20
58
|
|
|
21
59
|
|
|
22
60
|
|
|
23
61
|
const $6ca59110355c8bf1$export$7e4e6110f96afd7e = ({ entries: entries, target: target, toClose: toClose })=>{
|
|
24
62
|
const [visible, setVisible] = (0, $duWW8$useState)(false);
|
|
25
63
|
return /*#__PURE__*/ (0, $duWW8$jsxs)("span", {
|
|
26
|
-
className:
|
|
64
|
+
className: (0, (/*@__PURE__*/$parcel$interopDefault($47067f35ca62d4a5$exports))).caretHolder,
|
|
27
65
|
onMouseEnter: ()=>{
|
|
28
66
|
setVisible(true);
|
|
29
67
|
},
|
|
@@ -42,7 +80,7 @@ const $6ca59110355c8bf1$export$7e4e6110f96afd7e = ({ entries: entries, target: t
|
|
|
42
80
|
})
|
|
43
81
|
}),
|
|
44
82
|
/*#__PURE__*/ (0, $duWW8$jsx)("div", {
|
|
45
|
-
className:
|
|
83
|
+
className: (0, (/*@__PURE__*/$parcel$interopDefault($47067f35ca62d4a5$exports))).subMenu,
|
|
46
84
|
children: /*#__PURE__*/ (0, $duWW8$jsx)((0, $567ed433af94513f$export$8dc6765e8be191c7), {
|
|
47
85
|
visible: visible,
|
|
48
86
|
entries: entries,
|
|
@@ -62,7 +100,10 @@ const $567ed433af94513f$export$8dc6765e8be191c7 = /*#__PURE__*/ (0, $duWW8$react
|
|
|
62
100
|
$567ed433af94513f$export$8dc6765e8be191c7.displayName = "ContextMenu";
|
|
63
101
|
return /*#__PURE__*/ (0, $duWW8$jsx)("div", {
|
|
64
102
|
ref: ref,
|
|
65
|
-
className:
|
|
103
|
+
className: [
|
|
104
|
+
(0, (/*@__PURE__*/$parcel$interopDefault($47067f35ca62d4a5$exports))).contextMenu,
|
|
105
|
+
visible ? (0, (/*@__PURE__*/$parcel$interopDefault($47067f35ca62d4a5$exports))).visible : ""
|
|
106
|
+
].filter((c)=>c !== "").join(" "),
|
|
66
107
|
style: {
|
|
67
108
|
top: `${yPos}px`,
|
|
68
109
|
left: `${xPos}px`
|
|
@@ -72,12 +113,15 @@ const $567ed433af94513f$export$8dc6765e8be191c7 = /*#__PURE__*/ (0, $duWW8$react
|
|
|
72
113
|
e.stopPropagation();
|
|
73
114
|
},
|
|
74
115
|
children: entries.map((entry, i)=>/*#__PURE__*/ (0, $duWW8$jsxs)("div", {
|
|
75
|
-
className:
|
|
116
|
+
className: [
|
|
117
|
+
(0, (/*@__PURE__*/$parcel$interopDefault($47067f35ca62d4a5$exports))).contextMenuItem,
|
|
118
|
+
entry.disabled ? (0, (/*@__PURE__*/$parcel$interopDefault($47067f35ca62d4a5$exports))).disabled : ""
|
|
119
|
+
].filter((c)=>c !== "").join(" "),
|
|
76
120
|
children: [
|
|
77
|
-
/*#__PURE__*/ (0, $duWW8$jsx)("span", {
|
|
121
|
+
typeof entry.label === "string" ? /*#__PURE__*/ (0, $duWW8$jsx)("span", {
|
|
78
122
|
"aria-label": typeof entry.label === "string" ? entry.label : undefined,
|
|
79
123
|
"aria-disabled": entry.disabled,
|
|
80
|
-
className:
|
|
124
|
+
className: (0, (/*@__PURE__*/$parcel$interopDefault($47067f35ca62d4a5$exports))).contextMenuItemLabel,
|
|
81
125
|
onMouseDownCapture: (ev)=>{
|
|
82
126
|
ev.preventDefault();
|
|
83
127
|
ev.stopPropagation();
|
|
@@ -85,7 +129,7 @@ const $567ed433af94513f$export$8dc6765e8be191c7 = /*#__PURE__*/ (0, $duWW8$react
|
|
|
85
129
|
!entry.disabled && toClose();
|
|
86
130
|
},
|
|
87
131
|
children: entry.label
|
|
88
|
-
}),
|
|
132
|
+
}) : entry.label,
|
|
89
133
|
entry.group && /*#__PURE__*/ (0, $duWW8$jsx)((0, $6ca59110355c8bf1$export$7e4e6110f96afd7e), {
|
|
90
134
|
toClose: toClose,
|
|
91
135
|
entries: entry.group,
|
|
@@ -100,6 +144,35 @@ $567ed433af94513f$export$8dc6765e8be191c7.displayName = "ContextMenu";
|
|
|
100
144
|
|
|
101
145
|
|
|
102
146
|
|
|
147
|
+
var $c7a6ae87165004e6$exports = {};
|
|
148
|
+
|
|
149
|
+
$parcel$export($c7a6ae87165004e6$exports, "caretHolder", function () { return $c7a6ae87165004e6$export$6ed5f4fbab298e07; }, function (v) { return $c7a6ae87165004e6$export$6ed5f4fbab298e07 = v; });
|
|
150
|
+
$parcel$export($c7a6ae87165004e6$exports, "disabled", function () { return $c7a6ae87165004e6$export$683472f6198a076e; }, function (v) { return $c7a6ae87165004e6$export$683472f6198a076e = v; });
|
|
151
|
+
$parcel$export($c7a6ae87165004e6$exports, "hidden", function () { return $c7a6ae87165004e6$export$73920f18ca706874; }, function (v) { return $c7a6ae87165004e6$export$73920f18ca706874 = v; });
|
|
152
|
+
$parcel$export($c7a6ae87165004e6$exports, "lowMenu", function () { return $c7a6ae87165004e6$export$59e4b099a896b33; }, function (v) { return $c7a6ae87165004e6$export$59e4b099a896b33 = v; });
|
|
153
|
+
$parcel$export($c7a6ae87165004e6$exports, "lowMenu-item", function () { return $c7a6ae87165004e6$export$19fbf76b734bf310; }, function (v) { return $c7a6ae87165004e6$export$19fbf76b734bf310 = v; });
|
|
154
|
+
$parcel$export($c7a6ae87165004e6$exports, "lowMenuItem", function () { return $c7a6ae87165004e6$export$2ad34a478577e75d; }, function (v) { return $c7a6ae87165004e6$export$2ad34a478577e75d = v; });
|
|
155
|
+
$parcel$export($c7a6ae87165004e6$exports, "subMenu", function () { return $c7a6ae87165004e6$export$6e0e6ce39e5a0361; }, function (v) { return $c7a6ae87165004e6$export$6e0e6ce39e5a0361 = v; });
|
|
156
|
+
$parcel$export($c7a6ae87165004e6$exports, "visible", function () { return $c7a6ae87165004e6$export$664c6d24e3175067; }, function (v) { return $c7a6ae87165004e6$export$664c6d24e3175067 = v; });
|
|
157
|
+
var $c7a6ae87165004e6$export$6ed5f4fbab298e07;
|
|
158
|
+
var $c7a6ae87165004e6$export$683472f6198a076e;
|
|
159
|
+
var $c7a6ae87165004e6$export$73920f18ca706874;
|
|
160
|
+
var $c7a6ae87165004e6$export$59e4b099a896b33;
|
|
161
|
+
var $c7a6ae87165004e6$export$19fbf76b734bf310;
|
|
162
|
+
var $c7a6ae87165004e6$export$2ad34a478577e75d;
|
|
163
|
+
var $c7a6ae87165004e6$export$6e0e6ce39e5a0361;
|
|
164
|
+
var $c7a6ae87165004e6$export$664c6d24e3175067;
|
|
165
|
+
$c7a6ae87165004e6$export$6ed5f4fbab298e07 = `aiw-JfzGeq-caretHolder`;
|
|
166
|
+
$c7a6ae87165004e6$export$683472f6198a076e = `aiw-JfzGeq-disabled`;
|
|
167
|
+
$c7a6ae87165004e6$export$73920f18ca706874 = `aiw-JfzGeq-hidden`;
|
|
168
|
+
$c7a6ae87165004e6$export$59e4b099a896b33 = `aiw-JfzGeq-lowMenu`;
|
|
169
|
+
$c7a6ae87165004e6$export$19fbf76b734bf310 = `aiw-JfzGeq-lowMenu-item`;
|
|
170
|
+
$c7a6ae87165004e6$export$2ad34a478577e75d = `aiw-JfzGeq-lowMenuItem`;
|
|
171
|
+
$c7a6ae87165004e6$export$6e0e6ce39e5a0361 = `aiw-JfzGeq-subMenu`;
|
|
172
|
+
$c7a6ae87165004e6$export$664c6d24e3175067 = `aiw-JfzGeq-visible`;
|
|
173
|
+
|
|
174
|
+
|
|
175
|
+
|
|
103
176
|
|
|
104
177
|
|
|
105
178
|
|
|
@@ -110,7 +183,7 @@ const $61945e5157f5e5bf$export$251b9f54013cdfac = ({ entry: entry, target: targe
|
|
|
110
183
|
if (!entry.group || entry.group.length === 0) return /*#__PURE__*/ (0, $duWW8$jsx)((0, $duWW8$Fragment), {});
|
|
111
184
|
return /*#__PURE__*/ (0, $duWW8$jsxs)("span", {
|
|
112
185
|
"aria-label": `Sub menu for ${entry.label}`,
|
|
113
|
-
className:
|
|
186
|
+
className: (0, (/*@__PURE__*/$parcel$interopDefault($c7a6ae87165004e6$exports))).caretHolder,
|
|
114
187
|
onMouseEnter: ()=>{
|
|
115
188
|
setVisible(true);
|
|
116
189
|
},
|
|
@@ -129,7 +202,7 @@ const $61945e5157f5e5bf$export$251b9f54013cdfac = ({ entry: entry, target: targe
|
|
|
129
202
|
})
|
|
130
203
|
}),
|
|
131
204
|
/*#__PURE__*/ (0, $duWW8$jsx)("div", {
|
|
132
|
-
className:
|
|
205
|
+
className: (0, (/*@__PURE__*/$parcel$interopDefault($c7a6ae87165004e6$exports))).subMenu,
|
|
133
206
|
children: /*#__PURE__*/ (0, $duWW8$jsx)((0, $567ed433af94513f$export$8dc6765e8be191c7), {
|
|
134
207
|
visible: visible,
|
|
135
208
|
entries: entry.group,
|
|
@@ -147,7 +220,10 @@ $61945e5157f5e5bf$export$251b9f54013cdfac.displayName = "LowSubMenu";
|
|
|
147
220
|
|
|
148
221
|
const $556d6f9158abfc99$export$aafc28aea571c4bc = ({ entry: entry, target: target })=>{
|
|
149
222
|
return /*#__PURE__*/ (0, $duWW8$jsxs)("div", {
|
|
150
|
-
className:
|
|
223
|
+
className: [
|
|
224
|
+
(0, (/*@__PURE__*/$parcel$interopDefault($c7a6ae87165004e6$exports))).lowMenuItem,
|
|
225
|
+
entry.disabled ? (0, (/*@__PURE__*/$parcel$interopDefault($c7a6ae87165004e6$exports))).disabled : ""
|
|
226
|
+
].filter((c)=>c !== "").join(" "),
|
|
151
227
|
"aria-label": typeof entry.label === "string" ? entry.label : undefined,
|
|
152
228
|
"aria-disabled": entry.disabled,
|
|
153
229
|
onClick: (event)=>{
|
|
@@ -157,7 +233,6 @@ const $556d6f9158abfc99$export$aafc28aea571c4bc = ({ entry: entry, target: targe
|
|
|
157
233
|
},
|
|
158
234
|
children: [
|
|
159
235
|
/*#__PURE__*/ (0, $duWW8$jsx)("span", {
|
|
160
|
-
className: "low-menu-item-label",
|
|
161
236
|
children: entry.label
|
|
162
237
|
}),
|
|
163
238
|
entry.group && /*#__PURE__*/ (0, $duWW8$jsx)((0, $61945e5157f5e5bf$export$251b9f54013cdfac), {
|
|
@@ -170,10 +245,17 @@ const $556d6f9158abfc99$export$aafc28aea571c4bc = ({ entry: entry, target: targe
|
|
|
170
245
|
$556d6f9158abfc99$export$aafc28aea571c4bc.displayName = "LowMenuButton";
|
|
171
246
|
|
|
172
247
|
|
|
173
|
-
const $914758b0c9d59759$export$49e8edc8ebca5f25 = ({ entries: entries, target: target })=>{
|
|
248
|
+
const $914758b0c9d59759$export$49e8edc8ebca5f25 = ({ entries: entries, target: target, visible: visible, xPos: xPos, yPos: yPos })=>{
|
|
174
249
|
return /*#__PURE__*/ (0, $duWW8$jsx)("div", {
|
|
175
|
-
className:
|
|
250
|
+
className: [
|
|
251
|
+
(0, (/*@__PURE__*/$parcel$interopDefault($c7a6ae87165004e6$exports))).lowMenu,
|
|
252
|
+
visible ? (0, (/*@__PURE__*/$parcel$interopDefault($c7a6ae87165004e6$exports))).visible : (0, (/*@__PURE__*/$parcel$interopDefault($c7a6ae87165004e6$exports))).hidden
|
|
253
|
+
].join(" "),
|
|
176
254
|
"aria-label": "Low context menu",
|
|
255
|
+
style: {
|
|
256
|
+
left: `${xPos}px`,
|
|
257
|
+
top: `${yPos}px`
|
|
258
|
+
},
|
|
177
259
|
children: entries.map((e, i)=>/*#__PURE__*/ (0, $duWW8$jsx)((0, $556d6f9158abfc99$export$aafc28aea571c4bc), {
|
|
178
260
|
entry: e,
|
|
179
261
|
target: target
|
|
@@ -183,18 +265,42 @@ const $914758b0c9d59759$export$49e8edc8ebca5f25 = ({ entries: entries, target: t
|
|
|
183
265
|
$914758b0c9d59759$export$49e8edc8ebca5f25.displayName = "LowMenu";
|
|
184
266
|
|
|
185
267
|
|
|
186
|
-
const $1e1c1e9e0b943830$export$
|
|
187
|
-
|
|
188
|
-
|
|
189
|
-
|
|
268
|
+
const $1e1c1e9e0b943830$export$fc58dc71afe92de2 = /*#__PURE__*/ (0, $duWW8$createContext)(null);
|
|
269
|
+
const $1e1c1e9e0b943830$export$ed4f9641643dc7e4 = ({ children: children, menuItems: menuItems, showLowMenu: showLowMenu = false, ...rest })=>{
|
|
270
|
+
var _divHandlderRef_current;
|
|
271
|
+
// Check for higher content menu
|
|
272
|
+
const higherContext = (0, $duWW8$useContext)($1e1c1e9e0b943830$export$fc58dc71afe92de2);
|
|
273
|
+
const thisMenuItems = (0, $duWW8$useMemo)(()=>[
|
|
274
|
+
...higherContext !== null ? [
|
|
275
|
+
...higherContext.menuItems,
|
|
276
|
+
{
|
|
277
|
+
label: /*#__PURE__*/ (0, $duWW8$jsx)("hr", {
|
|
278
|
+
style: {
|
|
279
|
+
flexGrow: 1,
|
|
280
|
+
cursor: "none",
|
|
281
|
+
margin: "0",
|
|
282
|
+
padding: "0"
|
|
283
|
+
}
|
|
284
|
+
})
|
|
285
|
+
}
|
|
286
|
+
] : [],
|
|
287
|
+
...menuItems
|
|
288
|
+
], [
|
|
289
|
+
higherContext,
|
|
290
|
+
menuItems
|
|
291
|
+
]);
|
|
190
292
|
// Menu resources
|
|
191
|
-
const
|
|
293
|
+
const divHandlderRef = (0, $duWW8$useRef)(null);
|
|
294
|
+
const divMenuRef = (0, $duWW8$useRef)(null);
|
|
192
295
|
const menuRef = (0, $duWW8$useRef)(null);
|
|
193
296
|
const [menuXPos, setMenuXPos] = (0, $duWW8$useState)(0);
|
|
194
297
|
const [menuYPos, setMenuYPos] = (0, $duWW8$useState)(0);
|
|
195
298
|
const [menuVisible, setMenuVisible] = (0, $duWW8$useState)(false);
|
|
196
299
|
const [target, setTarget] = (0, $duWW8$useState)(null);
|
|
197
300
|
const [lowTarget, setLowTarget] = (0, $duWW8$useState)(null);
|
|
301
|
+
const [lowMenuVisible, setLowMenuVisible] = (0, $duWW8$useState)(false);
|
|
302
|
+
// Get holder position
|
|
303
|
+
const divHandlerPos = divHandlderRef ? (_divHandlderRef_current = divHandlderRef.current) === null || _divHandlderRef_current === void 0 ? void 0 : _divHandlderRef_current.getBoundingClientRect() : null;
|
|
198
304
|
// Show menu when context is requested
|
|
199
305
|
const showMenu = (e)=>{
|
|
200
306
|
const sel = window.getSelection();
|
|
@@ -221,35 +327,45 @@ const $1e1c1e9e0b943830$export$ed4f9641643dc7e4 = ({ children: children, menuIte
|
|
|
221
327
|
handleClick,
|
|
222
328
|
menuVisible
|
|
223
329
|
]);
|
|
224
|
-
return /*#__PURE__*/ (0, $duWW8$jsxs)(
|
|
330
|
+
return /*#__PURE__*/ (0, $duWW8$jsxs)($1e1c1e9e0b943830$export$fc58dc71afe92de2.Provider, {
|
|
331
|
+
value: {
|
|
332
|
+
menuItems: thisMenuItems
|
|
333
|
+
},
|
|
225
334
|
children: [
|
|
226
335
|
/*#__PURE__*/ (0, $duWW8$jsx)("div", {
|
|
336
|
+
ref: divHandlderRef,
|
|
337
|
+
...rest,
|
|
338
|
+
className: [
|
|
339
|
+
(0, (/*@__PURE__*/$parcel$interopDefault($47067f35ca62d4a5$exports))).contextMenuHandler,
|
|
340
|
+
rest.className
|
|
341
|
+
].join(" "),
|
|
342
|
+
style: {
|
|
343
|
+
...rest.style
|
|
344
|
+
},
|
|
227
345
|
onContextMenu: showLowMenu ? undefined : showMenu,
|
|
228
|
-
|
|
229
|
-
|
|
346
|
+
onMouseEnter: ()=>{
|
|
347
|
+
showLowMenu && setLowMenuVisible(true);
|
|
348
|
+
},
|
|
349
|
+
onMouseLeave: ()=>{
|
|
350
|
+
showLowMenu && setLowMenuVisible(false);
|
|
351
|
+
},
|
|
230
352
|
children: children
|
|
231
353
|
}),
|
|
232
354
|
menuVisible && !showLowMenu && /*#__PURE__*/ (0, $duWW8$createPortal)(/*#__PURE__*/ (0, $duWW8$jsx)("div", {
|
|
233
|
-
|
|
234
|
-
|
|
235
|
-
top: 0,
|
|
236
|
-
left: 0
|
|
237
|
-
},
|
|
238
|
-
ref: divRef,
|
|
355
|
+
className: (0, (/*@__PURE__*/$parcel$interopDefault($47067f35ca62d4a5$exports))).anchor,
|
|
356
|
+
ref: divMenuRef,
|
|
239
357
|
children: /*#__PURE__*/ (0, $duWW8$jsx)((0, $567ed433af94513f$export$8dc6765e8be191c7), {
|
|
240
358
|
visible: true,
|
|
241
359
|
ref: menuRef,
|
|
242
|
-
entries:
|
|
360
|
+
entries: thisMenuItems,
|
|
243
361
|
xPos: menuXPos,
|
|
244
362
|
yPos: menuYPos,
|
|
245
363
|
target: target,
|
|
246
364
|
toClose: ()=>setMenuVisible(false)
|
|
247
365
|
})
|
|
248
366
|
}), document.body),
|
|
249
|
-
showLowMenu && /*#__PURE__*/ (0, $duWW8$jsx)("div", {
|
|
250
|
-
|
|
251
|
-
position: "relative"
|
|
252
|
-
},
|
|
367
|
+
showLowMenu && divHandlerPos && /*#__PURE__*/ (0, $duWW8$createPortal)(/*#__PURE__*/ (0, $duWW8$jsx)("div", {
|
|
368
|
+
className: (0, (/*@__PURE__*/$parcel$interopDefault($47067f35ca62d4a5$exports))).anchor,
|
|
253
369
|
onMouseEnter: ()=>{
|
|
254
370
|
const sel = window.getSelection();
|
|
255
371
|
const lowSel = sel && sel.rangeCount > 0 ? sel.getRangeAt(0) : null;
|
|
@@ -259,11 +375,13 @@ const $1e1c1e9e0b943830$export$ed4f9641643dc7e4 = ({ children: children, menuIte
|
|
|
259
375
|
setLowTarget(null);
|
|
260
376
|
},
|
|
261
377
|
children: /*#__PURE__*/ (0, $duWW8$jsx)((0, $914758b0c9d59759$export$49e8edc8ebca5f25), {
|
|
378
|
+
visible: lowMenuVisible,
|
|
262
379
|
entries: menuItems,
|
|
263
|
-
target: lowTarget
|
|
380
|
+
target: lowTarget,
|
|
381
|
+
xPos: divHandlerPos.left,
|
|
382
|
+
yPos: divHandlerPos.bottom
|
|
264
383
|
})
|
|
265
|
-
}),
|
|
266
|
-
" "
|
|
384
|
+
}), document.body)
|
|
267
385
|
]
|
|
268
386
|
});
|
|
269
387
|
};
|
|
@@ -273,6 +391,27 @@ $1e1c1e9e0b943830$export$ed4f9641643dc7e4.displayName = "ContextMenuHandler";
|
|
|
273
391
|
|
|
274
392
|
|
|
275
393
|
|
|
394
|
+
const $ab4d5d6bf03370d0$export$d81cfea7c54be196 = (divRef)=>{
|
|
395
|
+
if (!divRef.current) return {
|
|
396
|
+
translateX: 0,
|
|
397
|
+
translateY: 0
|
|
398
|
+
};
|
|
399
|
+
else {
|
|
400
|
+
const innerBounce = 16;
|
|
401
|
+
const posn = divRef.current.getBoundingClientRect();
|
|
402
|
+
let translateX = 0;
|
|
403
|
+
if (posn.left < innerBounce) translateX = -posn.left + innerBounce;
|
|
404
|
+
else if (posn.right > window.innerWidth) translateX = Math.max(-posn.left + innerBounce, window.innerWidth - posn.right - innerBounce);
|
|
405
|
+
let translateY = 0;
|
|
406
|
+
if (posn.top < innerBounce) translateY = -posn.top + innerBounce;
|
|
407
|
+
else if (posn.bottom > window.innerHeight) translateY = Math.max(-posn.top + innerBounce, window.innerHeight - posn.bottom - innerBounce);
|
|
408
|
+
return {
|
|
409
|
+
translateX: translateX,
|
|
410
|
+
translateY: translateY
|
|
411
|
+
};
|
|
412
|
+
}
|
|
413
|
+
};
|
|
414
|
+
|
|
276
415
|
|
|
277
416
|
|
|
278
417
|
|
|
@@ -306,29 +445,33 @@ const $17c46b9e6a2eb66e$export$9f37482ccd50dad2 = ({ minZIndex: minZIndex = 1000
|
|
|
306
445
|
$17c46b9e6a2eb66e$export$9f37482ccd50dad2.displayName = "ContextWindowStack";
|
|
307
446
|
|
|
308
447
|
|
|
309
|
-
|
|
310
|
-
|
|
311
|
-
|
|
312
|
-
|
|
313
|
-
|
|
314
|
-
|
|
315
|
-
|
|
316
|
-
|
|
317
|
-
|
|
318
|
-
|
|
319
|
-
|
|
320
|
-
|
|
321
|
-
|
|
322
|
-
|
|
323
|
-
|
|
324
|
-
|
|
325
|
-
|
|
326
|
-
|
|
327
|
-
|
|
328
|
-
|
|
329
|
-
|
|
330
|
-
|
|
331
|
-
|
|
448
|
+
var $ddf7153c7c69b209$exports = {};
|
|
449
|
+
|
|
450
|
+
$parcel$export($ddf7153c7c69b209$exports, "contextWindow", function () { return $ddf7153c7c69b209$export$72cad2e5ad4d2674; }, function (v) { return $ddf7153c7c69b209$export$72cad2e5ad4d2674 = v; });
|
|
451
|
+
$parcel$export($ddf7153c7c69b209$exports, "contextWindowAnchor", function () { return $ddf7153c7c69b209$export$9f3a8a17ac700f7d; }, function (v) { return $ddf7153c7c69b209$export$9f3a8a17ac700f7d = v; });
|
|
452
|
+
$parcel$export($ddf7153c7c69b209$exports, "contextWindowBody", function () { return $ddf7153c7c69b209$export$dfb2c4d2d1c0156f; }, function (v) { return $ddf7153c7c69b209$export$dfb2c4d2d1c0156f = v; });
|
|
453
|
+
$parcel$export($ddf7153c7c69b209$exports, "contextWindowTitle", function () { return $ddf7153c7c69b209$export$1b02f2cd2f7db0f4; }, function (v) { return $ddf7153c7c69b209$export$1b02f2cd2f7db0f4 = v; });
|
|
454
|
+
$parcel$export($ddf7153c7c69b209$exports, "contextWindowTitleClose", function () { return $ddf7153c7c69b209$export$7ba38d4cc2870e66; }, function (v) { return $ddf7153c7c69b209$export$7ba38d4cc2870e66 = v; });
|
|
455
|
+
$parcel$export($ddf7153c7c69b209$exports, "contextWindowTitleText", function () { return $ddf7153c7c69b209$export$cebbac70b4d99c48; }, function (v) { return $ddf7153c7c69b209$export$cebbac70b4d99c48 = v; });
|
|
456
|
+
$parcel$export($ddf7153c7c69b209$exports, "moving", function () { return $ddf7153c7c69b209$export$d03a2f3acc60252b; }, function (v) { return $ddf7153c7c69b209$export$d03a2f3acc60252b = v; });
|
|
457
|
+
var $ddf7153c7c69b209$export$72cad2e5ad4d2674;
|
|
458
|
+
var $ddf7153c7c69b209$export$9f3a8a17ac700f7d;
|
|
459
|
+
var $ddf7153c7c69b209$export$dfb2c4d2d1c0156f;
|
|
460
|
+
var $ddf7153c7c69b209$export$1b02f2cd2f7db0f4;
|
|
461
|
+
var $ddf7153c7c69b209$export$7ba38d4cc2870e66;
|
|
462
|
+
var $ddf7153c7c69b209$export$cebbac70b4d99c48;
|
|
463
|
+
var $ddf7153c7c69b209$export$d03a2f3acc60252b;
|
|
464
|
+
$ddf7153c7c69b209$export$72cad2e5ad4d2674 = `aiw-RIIF9a-contextWindow`;
|
|
465
|
+
$ddf7153c7c69b209$export$9f3a8a17ac700f7d = `aiw-RIIF9a-contextWindowAnchor`;
|
|
466
|
+
$ddf7153c7c69b209$export$dfb2c4d2d1c0156f = `aiw-RIIF9a-contextWindowBody`;
|
|
467
|
+
$ddf7153c7c69b209$export$1b02f2cd2f7db0f4 = `aiw-RIIF9a-contextWindowTitle`;
|
|
468
|
+
$ddf7153c7c69b209$export$7ba38d4cc2870e66 = `aiw-RIIF9a-contextWindowTitleClose`;
|
|
469
|
+
$ddf7153c7c69b209$export$cebbac70b4d99c48 = `aiw-RIIF9a-contextWindowTitleText`;
|
|
470
|
+
$ddf7153c7c69b209$export$d03a2f3acc60252b = `aiw-RIIF9a-moving`;
|
|
471
|
+
|
|
472
|
+
|
|
473
|
+
const $b5e8657823def5be$export$1af8984c69ba1b24 = ({ id: id, visible: visible, title: title, children: children, onOpen: onOpen, onClose: onClose, ...rest })=>{
|
|
474
|
+
var _rest_style, _rest_style1, _rest_style2, _rest_style3;
|
|
332
475
|
const windowStack = (0, $duWW8$useContext)((0, $17c46b9e6a2eb66e$export$aff5d0593e3727b0));
|
|
333
476
|
const windowId = (0, $duWW8$useRef)(null);
|
|
334
477
|
const divRef = (0, $duWW8$useRef)(null);
|
|
@@ -416,22 +559,23 @@ const $b5e8657823def5be$export$1af8984c69ba1b24 = ({ id: id, visible: visible, t
|
|
|
416
559
|
windowStack,
|
|
417
560
|
windowVisible
|
|
418
561
|
]);
|
|
419
|
-
var
|
|
562
|
+
var _rest_style_minHeight, _rest_style_minWidth, _rest_style_maxHeight, _rest_style_maxWidth;
|
|
420
563
|
return /*#__PURE__*/ (0, $duWW8$jsx)("div", {
|
|
421
|
-
className:
|
|
564
|
+
className: (0, (/*@__PURE__*/$parcel$interopDefault($ddf7153c7c69b209$exports))).contextWindowAnchor,
|
|
422
565
|
ref: divRef,
|
|
423
566
|
children: windowStack && /*#__PURE__*/ (0, $duWW8$createPortal)(/*#__PURE__*/ (0, $duWW8$jsxs)("div", {
|
|
567
|
+
...rest,
|
|
424
568
|
id: id,
|
|
425
|
-
className:
|
|
569
|
+
className: (0, (/*@__PURE__*/$parcel$interopDefault($ddf7153c7c69b209$exports))).contextWindow,
|
|
426
570
|
style: {
|
|
427
|
-
...style,
|
|
571
|
+
...rest.style,
|
|
428
572
|
opacity: moving ? 0.8 : windowVisible ? 1 : 0,
|
|
429
573
|
visibility: windowVisible ? "visible" : "hidden",
|
|
430
574
|
zIndex: zIndex !== null && zIndex !== void 0 ? zIndex : 1,
|
|
431
|
-
minHeight: (
|
|
432
|
-
minWidth: (
|
|
433
|
-
maxHeight: (
|
|
434
|
-
maxWidth: (
|
|
575
|
+
minHeight: (_rest_style_minHeight = (_rest_style = rest.style) === null || _rest_style === void 0 ? void 0 : _rest_style.minHeight) !== null && _rest_style_minHeight !== void 0 ? _rest_style_minHeight : "150px",
|
|
576
|
+
minWidth: (_rest_style_minWidth = (_rest_style1 = rest.style) === null || _rest_style1 === void 0 ? void 0 : _rest_style1.minWidth) !== null && _rest_style_minWidth !== void 0 ? _rest_style_minWidth : "200px",
|
|
577
|
+
maxHeight: (_rest_style_maxHeight = (_rest_style2 = rest.style) === null || _rest_style2 === void 0 ? void 0 : _rest_style2.maxHeight) !== null && _rest_style_maxHeight !== void 0 ? _rest_style_maxHeight : "1000px",
|
|
578
|
+
maxWidth: (_rest_style_maxWidth = (_rest_style3 = rest.style) === null || _rest_style3 === void 0 ? void 0 : _rest_style3.maxWidth) !== null && _rest_style_maxWidth !== void 0 ? _rest_style_maxWidth : "1000px"
|
|
435
579
|
},
|
|
436
580
|
onClickCapture: ()=>{
|
|
437
581
|
windowId && windowId.current && windowStack.pushToTop(windowId.current);
|
|
@@ -439,7 +583,10 @@ const $b5e8657823def5be$export$1af8984c69ba1b24 = ({ id: id, visible: visible, t
|
|
|
439
583
|
ref: windowRef,
|
|
440
584
|
children: [
|
|
441
585
|
/*#__PURE__*/ (0, $duWW8$jsxs)("div", {
|
|
442
|
-
className:
|
|
586
|
+
className: [
|
|
587
|
+
(0, (/*@__PURE__*/$parcel$interopDefault($ddf7153c7c69b209$exports))).contextWindowTitle,
|
|
588
|
+
moving ? (0, (/*@__PURE__*/$parcel$interopDefault($ddf7153c7c69b209$exports))).moving : ""
|
|
589
|
+
].filter((c)=>c !== "").join(" "),
|
|
443
590
|
onMouseDown: (e)=>{
|
|
444
591
|
if (e.target && (e.target instanceof HTMLElement || e.target instanceof SVGElement)) e.target.style.userSelect = "none";
|
|
445
592
|
setMoving(true);
|
|
@@ -450,11 +597,11 @@ const $b5e8657823def5be$export$1af8984c69ba1b24 = ({ id: id, visible: visible, t
|
|
|
450
597
|
},
|
|
451
598
|
children: [
|
|
452
599
|
/*#__PURE__*/ (0, $duWW8$jsx)("div", {
|
|
453
|
-
className:
|
|
600
|
+
className: (0, (/*@__PURE__*/$parcel$interopDefault($ddf7153c7c69b209$exports))).contextWindowTitleText,
|
|
454
601
|
children: title
|
|
455
602
|
}),
|
|
456
603
|
/*#__PURE__*/ (0, $duWW8$jsx)("div", {
|
|
457
|
-
className:
|
|
604
|
+
className: (0, (/*@__PURE__*/$parcel$interopDefault($ddf7153c7c69b209$exports))).contextWindowTitleClose,
|
|
458
605
|
children: /*#__PURE__*/ (0, $duWW8$jsx)("svg", {
|
|
459
606
|
xmlns: "http://www.w3.org/2000/svg",
|
|
460
607
|
width: "16",
|
|
@@ -471,7 +618,7 @@ const $b5e8657823def5be$export$1af8984c69ba1b24 = ({ id: id, visible: visible, t
|
|
|
471
618
|
]
|
|
472
619
|
}),
|
|
473
620
|
/*#__PURE__*/ (0, $duWW8$jsx)("div", {
|
|
474
|
-
className:
|
|
621
|
+
className: (0, (/*@__PURE__*/$parcel$interopDefault($ddf7153c7c69b209$exports))).contextWindowBody,
|
|
475
622
|
children: /*#__PURE__*/ (0, $duWW8$jsx)("div", {
|
|
476
623
|
children: children
|
|
477
624
|
})
|