@asup/context-menu 1.3.10 → 1.3.11
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 +230 -0
- package/dist/cjs/main.css.map +1 -0
- package/dist/cjs/main.js +727 -0
- package/dist/cjs/main.js.map +1 -0
- package/dist/context-menu.d.ts +41 -0
- package/dist/context-menu.d.ts.map +1 -0
- package/dist/main.css +230 -0
- package/dist/main.css.map +1 -0
- package/dist/main.js +710 -0
- package/dist/main.js.map +1 -0
- package/package.json +1 -1
package/dist/cjs/main.js
ADDED
|
@@ -0,0 +1,727 @@
|
|
|
1
|
+
require("./main.css");
|
|
2
|
+
var $gTuX4$reactjsxruntime = require("react/jsx-runtime");
|
|
3
|
+
var $gTuX4$react = require("react");
|
|
4
|
+
var $gTuX4$reactdom = require("react-dom");
|
|
5
|
+
|
|
6
|
+
|
|
7
|
+
function $parcel$exportWildcard(dest, source) {
|
|
8
|
+
Object.keys(source).forEach(function(key) {
|
|
9
|
+
if (key === 'default' || key === '__esModule' || Object.prototype.hasOwnProperty.call(dest, key)) {
|
|
10
|
+
return;
|
|
11
|
+
}
|
|
12
|
+
|
|
13
|
+
Object.defineProperty(dest, key, {
|
|
14
|
+
enumerable: true,
|
|
15
|
+
get: function get() {
|
|
16
|
+
return source[key];
|
|
17
|
+
}
|
|
18
|
+
});
|
|
19
|
+
});
|
|
20
|
+
|
|
21
|
+
return dest;
|
|
22
|
+
}
|
|
23
|
+
|
|
24
|
+
function $parcel$export(e, n, v, s) {
|
|
25
|
+
Object.defineProperty(e, n, {get: v, set: s, enumerable: true, configurable: true});
|
|
26
|
+
}
|
|
27
|
+
|
|
28
|
+
function $parcel$interopDefault(a) {
|
|
29
|
+
return a && a.__esModule ? a.default : a;
|
|
30
|
+
}
|
|
31
|
+
|
|
32
|
+
|
|
33
|
+
var $a68bd8a6c0fd98c2$exports = {};
|
|
34
|
+
|
|
35
|
+
$parcel$export($a68bd8a6c0fd98c2$exports, "ContextMenuHandler", function () { return $3c568ee547c732c3$export$ed4f9641643dc7e4; });
|
|
36
|
+
$parcel$export($a68bd8a6c0fd98c2$exports, "ContextWindow", function () { return $46fb0088a1bbb6d8$export$1af8984c69ba1b24; });
|
|
37
|
+
$parcel$export($a68bd8a6c0fd98c2$exports, "ContextWindowStack", function () { return $16208d559c772441$export$9f37482ccd50dad2; });
|
|
38
|
+
|
|
39
|
+
|
|
40
|
+
|
|
41
|
+
|
|
42
|
+
|
|
43
|
+
var $da5a7b95ca760552$exports = {};
|
|
44
|
+
|
|
45
|
+
$parcel$export($da5a7b95ca760552$exports, "anchor", function () { return $da5a7b95ca760552$export$2e2992790a6f69a8; }, function (v) { return $da5a7b95ca760552$export$2e2992790a6f69a8 = v; });
|
|
46
|
+
$parcel$export($da5a7b95ca760552$exports, "caretHolder", function () { return $da5a7b95ca760552$export$6ed5f4fbab298e07; }, function (v) { return $da5a7b95ca760552$export$6ed5f4fbab298e07 = v; });
|
|
47
|
+
$parcel$export($da5a7b95ca760552$exports, "contextMenu", function () { return $da5a7b95ca760552$export$218b899e1d476006; }, function (v) { return $da5a7b95ca760552$export$218b899e1d476006 = v; });
|
|
48
|
+
$parcel$export($da5a7b95ca760552$exports, "contextMenuHandler", function () { return $da5a7b95ca760552$export$ed8ffb5bb55a3bc8; }, function (v) { return $da5a7b95ca760552$export$ed8ffb5bb55a3bc8 = v; });
|
|
49
|
+
$parcel$export($da5a7b95ca760552$exports, "contextMenuItem", function () { return $da5a7b95ca760552$export$e5ea51c279904378; }, function (v) { return $da5a7b95ca760552$export$e5ea51c279904378 = v; });
|
|
50
|
+
$parcel$export($da5a7b95ca760552$exports, "contextMenuItemLabel", function () { return $da5a7b95ca760552$export$6ada86c5b962aa22; }, function (v) { return $da5a7b95ca760552$export$6ada86c5b962aa22 = v; });
|
|
51
|
+
$parcel$export($da5a7b95ca760552$exports, "disabled", function () { return $da5a7b95ca760552$export$683472f6198a076e; }, function (v) { return $da5a7b95ca760552$export$683472f6198a076e = v; });
|
|
52
|
+
$parcel$export($da5a7b95ca760552$exports, "hidden", function () { return $da5a7b95ca760552$export$73920f18ca706874; }, function (v) { return $da5a7b95ca760552$export$73920f18ca706874 = v; });
|
|
53
|
+
$parcel$export($da5a7b95ca760552$exports, "subMenu", function () { return $da5a7b95ca760552$export$6e0e6ce39e5a0361; }, function (v) { return $da5a7b95ca760552$export$6e0e6ce39e5a0361 = v; });
|
|
54
|
+
$parcel$export($da5a7b95ca760552$exports, "visible", function () { return $da5a7b95ca760552$export$664c6d24e3175067; }, function (v) { return $da5a7b95ca760552$export$664c6d24e3175067 = v; });
|
|
55
|
+
var $da5a7b95ca760552$export$2e2992790a6f69a8;
|
|
56
|
+
var $da5a7b95ca760552$export$6ed5f4fbab298e07;
|
|
57
|
+
var $da5a7b95ca760552$export$218b899e1d476006;
|
|
58
|
+
var $da5a7b95ca760552$export$ed8ffb5bb55a3bc8;
|
|
59
|
+
var $da5a7b95ca760552$export$e5ea51c279904378;
|
|
60
|
+
var $da5a7b95ca760552$export$6ada86c5b962aa22;
|
|
61
|
+
var $da5a7b95ca760552$export$683472f6198a076e;
|
|
62
|
+
var $da5a7b95ca760552$export$73920f18ca706874;
|
|
63
|
+
var $da5a7b95ca760552$export$6e0e6ce39e5a0361;
|
|
64
|
+
var $da5a7b95ca760552$export$664c6d24e3175067;
|
|
65
|
+
$da5a7b95ca760552$export$2e2992790a6f69a8 = `aiw-ContextMenu-module-WinFxq-anchor`;
|
|
66
|
+
$da5a7b95ca760552$export$6ed5f4fbab298e07 = `aiw-ContextMenu-module-WinFxq-caretHolder`;
|
|
67
|
+
$da5a7b95ca760552$export$218b899e1d476006 = `aiw-ContextMenu-module-WinFxq-contextMenu`;
|
|
68
|
+
$da5a7b95ca760552$export$ed8ffb5bb55a3bc8 = `aiw-ContextMenu-module-WinFxq-contextMenuHandler`;
|
|
69
|
+
$da5a7b95ca760552$export$e5ea51c279904378 = `aiw-ContextMenu-module-WinFxq-contextMenuItem`;
|
|
70
|
+
$da5a7b95ca760552$export$6ada86c5b962aa22 = `aiw-ContextMenu-module-WinFxq-contextMenuItemLabel`;
|
|
71
|
+
$da5a7b95ca760552$export$683472f6198a076e = `aiw-ContextMenu-module-WinFxq-disabled`;
|
|
72
|
+
$da5a7b95ca760552$export$73920f18ca706874 = `aiw-ContextMenu-module-WinFxq-hidden`;
|
|
73
|
+
$da5a7b95ca760552$export$6e0e6ce39e5a0361 = `aiw-ContextMenu-module-WinFxq-subMenu`;
|
|
74
|
+
$da5a7b95ca760552$export$664c6d24e3175067 = `aiw-ContextMenu-module-WinFxq-visible`;
|
|
75
|
+
|
|
76
|
+
|
|
77
|
+
|
|
78
|
+
|
|
79
|
+
|
|
80
|
+
|
|
81
|
+
|
|
82
|
+
|
|
83
|
+
const $d35a356381c44181$export$7e4e6110f96afd7e = ({ entries: entries, toClose: toClose, visible: visible })=>{
|
|
84
|
+
return /*#__PURE__*/ (0, $gTuX4$reactjsxruntime.jsxs)("span", {
|
|
85
|
+
className: (0, (/*@__PURE__*/$parcel$interopDefault($da5a7b95ca760552$exports))).caretHolder,
|
|
86
|
+
children: [
|
|
87
|
+
/*#__PURE__*/ (0, $gTuX4$reactjsxruntime.jsx)("svg", {
|
|
88
|
+
xmlns: "http://www.w3.org/2000/svg",
|
|
89
|
+
width: "16",
|
|
90
|
+
height: "16",
|
|
91
|
+
fill: "currentColor",
|
|
92
|
+
viewBox: "0 0 16 16",
|
|
93
|
+
children: /*#__PURE__*/ (0, $gTuX4$reactjsxruntime.jsx)("path", {
|
|
94
|
+
d: "m12.14 8.753-5.482 4.796c-.646.566-1.658.106-1.658-.753V3.204a1 1 0 0 1 1.659-.753l5.48 4.796a1 1 0 0 1 0 1.506z"
|
|
95
|
+
})
|
|
96
|
+
}),
|
|
97
|
+
/*#__PURE__*/ (0, $gTuX4$reactjsxruntime.jsx)("div", {
|
|
98
|
+
className: (0, (/*@__PURE__*/$parcel$interopDefault($da5a7b95ca760552$exports))).subMenu,
|
|
99
|
+
children: /*#__PURE__*/ (0, $gTuX4$reactjsxruntime.jsx)((0, $5150b66b01c99189$export$8dc6765e8be191c7), {
|
|
100
|
+
visible: visible,
|
|
101
|
+
entries: entries,
|
|
102
|
+
xPos: 14,
|
|
103
|
+
yPos: -21,
|
|
104
|
+
toClose: toClose
|
|
105
|
+
})
|
|
106
|
+
})
|
|
107
|
+
]
|
|
108
|
+
});
|
|
109
|
+
};
|
|
110
|
+
$d35a356381c44181$export$7e4e6110f96afd7e.displayName = "ContextSubMenu";
|
|
111
|
+
|
|
112
|
+
|
|
113
|
+
const $1e1f300656d89038$export$c868ef28d2ba36f1 = ({ entry: entry, toClose: toClose })=>{
|
|
114
|
+
const [target, setTarget] = (0, $gTuX4$react.useState)(null);
|
|
115
|
+
const [subMenuVisible, setSubMenuVisible] = (0, $gTuX4$react.useState)(false);
|
|
116
|
+
return /*#__PURE__*/ (0, $gTuX4$reactjsxruntime.jsxs)("div", {
|
|
117
|
+
className: [
|
|
118
|
+
(0, (/*@__PURE__*/$parcel$interopDefault($da5a7b95ca760552$exports))).contextMenuItem,
|
|
119
|
+
entry.disabled ? (0, (/*@__PURE__*/$parcel$interopDefault($da5a7b95ca760552$exports))).disabled : ""
|
|
120
|
+
].filter((c)=>c !== "").join(" "),
|
|
121
|
+
onMouseEnter: ()=>{
|
|
122
|
+
setSubMenuVisible(true);
|
|
123
|
+
},
|
|
124
|
+
onMouseLeave: ()=>{
|
|
125
|
+
setSubMenuVisible(false);
|
|
126
|
+
},
|
|
127
|
+
children: [
|
|
128
|
+
typeof entry.label === "string" ? /*#__PURE__*/ (0, $gTuX4$reactjsxruntime.jsx)("span", {
|
|
129
|
+
"aria-label": typeof entry.label === "string" ? entry.label : undefined,
|
|
130
|
+
"aria-disabled": entry.disabled,
|
|
131
|
+
className: (0, (/*@__PURE__*/$parcel$interopDefault($da5a7b95ca760552$exports))).contextMenuItemLabel,
|
|
132
|
+
onMouseEnter: ()=>{
|
|
133
|
+
const sel = window.getSelection();
|
|
134
|
+
const target = sel && sel.rangeCount > 0 ? sel.getRangeAt(0) : null;
|
|
135
|
+
setTarget(target);
|
|
136
|
+
},
|
|
137
|
+
onMouseLeave: ()=>{
|
|
138
|
+
setTarget(null);
|
|
139
|
+
},
|
|
140
|
+
onMouseDownCapture: (e)=>{
|
|
141
|
+
e.preventDefault();
|
|
142
|
+
e.stopPropagation();
|
|
143
|
+
entry.action && !entry.disabled && entry.action(target);
|
|
144
|
+
!entry.disabled && toClose();
|
|
145
|
+
},
|
|
146
|
+
children: entry.label
|
|
147
|
+
}) : entry.label,
|
|
148
|
+
entry.group && /*#__PURE__*/ (0, $gTuX4$reactjsxruntime.jsx)((0, $d35a356381c44181$export$7e4e6110f96afd7e), {
|
|
149
|
+
toClose: toClose,
|
|
150
|
+
entries: entry.group,
|
|
151
|
+
visible: subMenuVisible
|
|
152
|
+
})
|
|
153
|
+
]
|
|
154
|
+
});
|
|
155
|
+
};
|
|
156
|
+
|
|
157
|
+
|
|
158
|
+
const $5150b66b01c99189$export$8dc6765e8be191c7 = /*#__PURE__*/ (0, $gTuX4$react.forwardRef)(({ visible: visible, entries: entries, xPos: xPos, yPos: yPos, toClose: toClose }, ref)=>{
|
|
159
|
+
return /*#__PURE__*/ (0, $gTuX4$reactjsxruntime.jsx)("div", {
|
|
160
|
+
ref: ref,
|
|
161
|
+
className: [
|
|
162
|
+
(0, (/*@__PURE__*/$parcel$interopDefault($da5a7b95ca760552$exports))).contextMenu,
|
|
163
|
+
visible ? (0, (/*@__PURE__*/$parcel$interopDefault($da5a7b95ca760552$exports))).visible : (0, (/*@__PURE__*/$parcel$interopDefault($da5a7b95ca760552$exports))).hidden
|
|
164
|
+
].filter((c)=>c !== "").join(" "),
|
|
165
|
+
style: {
|
|
166
|
+
top: `${yPos}px`,
|
|
167
|
+
left: `${xPos}px`
|
|
168
|
+
},
|
|
169
|
+
onContextMenuCapture: (e)=>{
|
|
170
|
+
e.preventDefault();
|
|
171
|
+
e.stopPropagation();
|
|
172
|
+
},
|
|
173
|
+
children: entries.map((entry, i)=>/*#__PURE__*/ (0, $gTuX4$reactjsxruntime.jsx)((0, $1e1f300656d89038$export$c868ef28d2ba36f1), {
|
|
174
|
+
entry: entry,
|
|
175
|
+
toClose: toClose
|
|
176
|
+
}, i))
|
|
177
|
+
});
|
|
178
|
+
});
|
|
179
|
+
$5150b66b01c99189$export$8dc6765e8be191c7.displayName = "ContextMenu";
|
|
180
|
+
|
|
181
|
+
|
|
182
|
+
|
|
183
|
+
|
|
184
|
+
var $63cdf2819565020c$exports = {};
|
|
185
|
+
|
|
186
|
+
$parcel$export($63cdf2819565020c$exports, "caretHolder", function () { return $63cdf2819565020c$export$6ed5f4fbab298e07; }, function (v) { return $63cdf2819565020c$export$6ed5f4fbab298e07 = v; });
|
|
187
|
+
$parcel$export($63cdf2819565020c$exports, "disabled", function () { return $63cdf2819565020c$export$683472f6198a076e; }, function (v) { return $63cdf2819565020c$export$683472f6198a076e = v; });
|
|
188
|
+
$parcel$export($63cdf2819565020c$exports, "hidden", function () { return $63cdf2819565020c$export$73920f18ca706874; }, function (v) { return $63cdf2819565020c$export$73920f18ca706874 = v; });
|
|
189
|
+
$parcel$export($63cdf2819565020c$exports, "lowMenu", function () { return $63cdf2819565020c$export$59e4b099a896b33; }, function (v) { return $63cdf2819565020c$export$59e4b099a896b33 = v; });
|
|
190
|
+
$parcel$export($63cdf2819565020c$exports, "lowMenu-item", function () { return $63cdf2819565020c$export$19fbf76b734bf310; }, function (v) { return $63cdf2819565020c$export$19fbf76b734bf310 = v; });
|
|
191
|
+
$parcel$export($63cdf2819565020c$exports, "lowMenuButtonHolder", function () { return $63cdf2819565020c$export$22ec12d194e0789c; }, function (v) { return $63cdf2819565020c$export$22ec12d194e0789c = v; });
|
|
192
|
+
$parcel$export($63cdf2819565020c$exports, "lowMenuItem", function () { return $63cdf2819565020c$export$2ad34a478577e75d; }, function (v) { return $63cdf2819565020c$export$2ad34a478577e75d = v; });
|
|
193
|
+
$parcel$export($63cdf2819565020c$exports, "subMenu", function () { return $63cdf2819565020c$export$6e0e6ce39e5a0361; }, function (v) { return $63cdf2819565020c$export$6e0e6ce39e5a0361 = v; });
|
|
194
|
+
$parcel$export($63cdf2819565020c$exports, "visible", function () { return $63cdf2819565020c$export$664c6d24e3175067; }, function (v) { return $63cdf2819565020c$export$664c6d24e3175067 = v; });
|
|
195
|
+
var $63cdf2819565020c$export$6ed5f4fbab298e07;
|
|
196
|
+
var $63cdf2819565020c$export$683472f6198a076e;
|
|
197
|
+
var $63cdf2819565020c$export$73920f18ca706874;
|
|
198
|
+
var $63cdf2819565020c$export$59e4b099a896b33;
|
|
199
|
+
var $63cdf2819565020c$export$19fbf76b734bf310;
|
|
200
|
+
var $63cdf2819565020c$export$22ec12d194e0789c;
|
|
201
|
+
var $63cdf2819565020c$export$2ad34a478577e75d;
|
|
202
|
+
var $63cdf2819565020c$export$6e0e6ce39e5a0361;
|
|
203
|
+
var $63cdf2819565020c$export$664c6d24e3175067;
|
|
204
|
+
$63cdf2819565020c$export$6ed5f4fbab298e07 = `aiw-LowMenu-module-JfzGeq-caretHolder`;
|
|
205
|
+
$63cdf2819565020c$export$683472f6198a076e = `aiw-LowMenu-module-JfzGeq-disabled`;
|
|
206
|
+
$63cdf2819565020c$export$73920f18ca706874 = `aiw-LowMenu-module-JfzGeq-hidden`;
|
|
207
|
+
$63cdf2819565020c$export$59e4b099a896b33 = `aiw-LowMenu-module-JfzGeq-lowMenu`;
|
|
208
|
+
$63cdf2819565020c$export$19fbf76b734bf310 = `aiw-LowMenu-module-JfzGeq-lowMenu-item`;
|
|
209
|
+
$63cdf2819565020c$export$22ec12d194e0789c = `aiw-LowMenu-module-JfzGeq-lowMenuButtonHolder`;
|
|
210
|
+
$63cdf2819565020c$export$2ad34a478577e75d = `aiw-LowMenu-module-JfzGeq-lowMenuItem`;
|
|
211
|
+
$63cdf2819565020c$export$6e0e6ce39e5a0361 = `aiw-LowMenu-module-JfzGeq-subMenu`;
|
|
212
|
+
$63cdf2819565020c$export$664c6d24e3175067 = `aiw-LowMenu-module-JfzGeq-visible`;
|
|
213
|
+
|
|
214
|
+
|
|
215
|
+
|
|
216
|
+
|
|
217
|
+
|
|
218
|
+
|
|
219
|
+
|
|
220
|
+
|
|
221
|
+
const $d30299730ea8ec1e$export$251b9f54013cdfac = ({ entry: entry })=>{
|
|
222
|
+
const [visible, setVisible] = (0, $gTuX4$react.useState)(false);
|
|
223
|
+
if (!entry.group || entry.group.length === 0) return /*#__PURE__*/ (0, $gTuX4$reactjsxruntime.jsx)((0, $gTuX4$reactjsxruntime.Fragment), {});
|
|
224
|
+
return /*#__PURE__*/ (0, $gTuX4$reactjsxruntime.jsxs)("span", {
|
|
225
|
+
"aria-label": `Sub menu for ${entry.label}`,
|
|
226
|
+
className: (0, (/*@__PURE__*/$parcel$interopDefault($63cdf2819565020c$exports))).caretHolder,
|
|
227
|
+
onMouseEnter: ()=>{
|
|
228
|
+
setVisible(true);
|
|
229
|
+
},
|
|
230
|
+
onMouseLeave: ()=>{
|
|
231
|
+
setVisible(false);
|
|
232
|
+
},
|
|
233
|
+
children: [
|
|
234
|
+
/*#__PURE__*/ (0, $gTuX4$reactjsxruntime.jsx)("svg", {
|
|
235
|
+
xmlns: "http://www.w3.org/2000/svg",
|
|
236
|
+
width: "16",
|
|
237
|
+
height: "16",
|
|
238
|
+
fill: "currentColor",
|
|
239
|
+
viewBox: "0 0 16 16",
|
|
240
|
+
children: /*#__PURE__*/ (0, $gTuX4$reactjsxruntime.jsx)("path", {
|
|
241
|
+
d: "m12.14 8.753-5.482 4.796c-.646.566-1.658.106-1.658-.753V3.204a1 1 0 0 1 1.659-.753l5.48 4.796a1 1 0 0 1 0 1.506z"
|
|
242
|
+
})
|
|
243
|
+
}),
|
|
244
|
+
/*#__PURE__*/ (0, $gTuX4$reactjsxruntime.jsx)("div", {
|
|
245
|
+
className: (0, (/*@__PURE__*/$parcel$interopDefault($63cdf2819565020c$exports))).subMenu,
|
|
246
|
+
children: visible && /*#__PURE__*/ (0, $gTuX4$reactjsxruntime.jsx)((0, $5150b66b01c99189$export$8dc6765e8be191c7), {
|
|
247
|
+
visible: visible,
|
|
248
|
+
entries: entry.group,
|
|
249
|
+
xPos: 14,
|
|
250
|
+
yPos: entry.group.length * -21 - 8,
|
|
251
|
+
toClose: ()=>setVisible(false)
|
|
252
|
+
})
|
|
253
|
+
})
|
|
254
|
+
]
|
|
255
|
+
});
|
|
256
|
+
};
|
|
257
|
+
$d30299730ea8ec1e$export$251b9f54013cdfac.displayName = "LowSubMenu";
|
|
258
|
+
|
|
259
|
+
|
|
260
|
+
|
|
261
|
+
const $b34598671fff4a77$export$aafc28aea571c4bc = ({ entry: entry })=>{
|
|
262
|
+
const [target, setTarget] = (0, $gTuX4$react.useState)(null);
|
|
263
|
+
return /*#__PURE__*/ (0, $gTuX4$reactjsxruntime.jsxs)("div", {
|
|
264
|
+
className: [
|
|
265
|
+
(0, (/*@__PURE__*/$parcel$interopDefault($63cdf2819565020c$exports))).lowMenuItem,
|
|
266
|
+
entry.disabled ? (0, (/*@__PURE__*/$parcel$interopDefault($63cdf2819565020c$exports))).disabled : ""
|
|
267
|
+
].filter((c)=>c !== "").join(" "),
|
|
268
|
+
"aria-label": typeof entry.label === "string" ? entry.label : undefined,
|
|
269
|
+
"aria-disabled": entry.disabled,
|
|
270
|
+
onMouseEnter: ()=>{
|
|
271
|
+
const sel = window.getSelection();
|
|
272
|
+
const target = sel && sel.rangeCount > 0 ? sel.getRangeAt(0) : null;
|
|
273
|
+
setTarget(target);
|
|
274
|
+
},
|
|
275
|
+
onMouseLeave: ()=>{
|
|
276
|
+
setTarget(null);
|
|
277
|
+
},
|
|
278
|
+
onClick: (e)=>{
|
|
279
|
+
e.preventDefault();
|
|
280
|
+
e.stopPropagation();
|
|
281
|
+
entry.action && !entry.disabled && entry.action(target);
|
|
282
|
+
},
|
|
283
|
+
children: [
|
|
284
|
+
/*#__PURE__*/ (0, $gTuX4$reactjsxruntime.jsx)("span", {
|
|
285
|
+
children: entry.label
|
|
286
|
+
}),
|
|
287
|
+
entry.group && /*#__PURE__*/ (0, $gTuX4$reactjsxruntime.jsx)((0, $d30299730ea8ec1e$export$251b9f54013cdfac), {
|
|
288
|
+
entry: entry
|
|
289
|
+
})
|
|
290
|
+
]
|
|
291
|
+
});
|
|
292
|
+
};
|
|
293
|
+
$b34598671fff4a77$export$aafc28aea571c4bc.displayName = "LowMenuButton";
|
|
294
|
+
|
|
295
|
+
|
|
296
|
+
const $10d1ee4e7fc9bbbd$export$49e8edc8ebca5f25 = ({ entries: entries, visible: visible, xPos: xPos, yPos: yPos, maxWidth: maxWidth })=>{
|
|
297
|
+
return /*#__PURE__*/ (0, $gTuX4$reactjsxruntime.jsx)("div", {
|
|
298
|
+
className: [
|
|
299
|
+
(0, (/*@__PURE__*/$parcel$interopDefault($63cdf2819565020c$exports))).lowMenu,
|
|
300
|
+
visible ? (0, (/*@__PURE__*/$parcel$interopDefault($63cdf2819565020c$exports))).visible : (0, (/*@__PURE__*/$parcel$interopDefault($63cdf2819565020c$exports))).hidden
|
|
301
|
+
].join(" "),
|
|
302
|
+
"aria-label": "Low context menu",
|
|
303
|
+
style: {
|
|
304
|
+
left: `${xPos}px`,
|
|
305
|
+
top: `${yPos}px`,
|
|
306
|
+
maxWidth: `calc(${maxWidth}px)`,
|
|
307
|
+
width: `calc(${maxWidth}px - 4px)`
|
|
308
|
+
},
|
|
309
|
+
children: /*#__PURE__*/ (0, $gTuX4$reactjsxruntime.jsx)("div", {
|
|
310
|
+
className: (0, (/*@__PURE__*/$parcel$interopDefault($63cdf2819565020c$exports))).lowMenuButtonHolder,
|
|
311
|
+
children: entries.map((e, i)=>/*#__PURE__*/ (0, $gTuX4$reactjsxruntime.jsx)((0, $b34598671fff4a77$export$aafc28aea571c4bc), {
|
|
312
|
+
entry: e
|
|
313
|
+
}, i))
|
|
314
|
+
})
|
|
315
|
+
});
|
|
316
|
+
};
|
|
317
|
+
$10d1ee4e7fc9bbbd$export$49e8edc8ebca5f25.displayName = "LowMenu";
|
|
318
|
+
|
|
319
|
+
|
|
320
|
+
const $3c568ee547c732c3$export$fc58dc71afe92de2 = /*#__PURE__*/ (0, $gTuX4$react.createContext)(null);
|
|
321
|
+
const $3c568ee547c732c3$export$ed4f9641643dc7e4 = ({ children: children, menuItems: menuItems, showLowMenu: showLowMenu = false, ...rest })=>{
|
|
322
|
+
// Check for higher content menu
|
|
323
|
+
const higherContext = (0, $gTuX4$react.useContext)($3c568ee547c732c3$export$fc58dc71afe92de2);
|
|
324
|
+
const thisMenuItems = (0, $gTuX4$react.useMemo)(()=>[
|
|
325
|
+
...higherContext !== null ? [
|
|
326
|
+
...higherContext.menuItems,
|
|
327
|
+
{
|
|
328
|
+
label: /*#__PURE__*/ (0, $gTuX4$reactjsxruntime.jsx)("hr", {
|
|
329
|
+
style: {
|
|
330
|
+
flexGrow: 1,
|
|
331
|
+
cursor: "none",
|
|
332
|
+
margin: "0",
|
|
333
|
+
padding: "0"
|
|
334
|
+
}
|
|
335
|
+
})
|
|
336
|
+
}
|
|
337
|
+
] : [],
|
|
338
|
+
...menuItems
|
|
339
|
+
], [
|
|
340
|
+
higherContext,
|
|
341
|
+
menuItems
|
|
342
|
+
]);
|
|
343
|
+
// Menu resources
|
|
344
|
+
const divHandlderRef = (0, $gTuX4$react.useRef)(null);
|
|
345
|
+
const menuRef = (0, $gTuX4$react.useRef)(null);
|
|
346
|
+
const [menuXPos, setMenuXPos] = (0, $gTuX4$react.useState)(0);
|
|
347
|
+
const [menuYPos, setMenuYPos] = (0, $gTuX4$react.useState)(0);
|
|
348
|
+
const [menuVisible, setMenuVisible] = (0, $gTuX4$react.useState)(false);
|
|
349
|
+
const [menuInDom, setMenuInDom] = (0, $gTuX4$react.useState)(false);
|
|
350
|
+
const [mouseOverHandlerDiv, setMouseOverHandlerDiv] = (0, $gTuX4$react.useState)(false);
|
|
351
|
+
const [mouseOverMenu, setMouseOverMenu] = (0, $gTuX4$react.useState)(false);
|
|
352
|
+
// Get holder position
|
|
353
|
+
const divHandlerPos = divHandlderRef ? divHandlderRef.current?.getBoundingClientRect() : null;
|
|
354
|
+
// Handle click off the menu
|
|
355
|
+
const handleClick = (0, $gTuX4$react.useCallback)((e)=>{
|
|
356
|
+
if (menuRef.current && (e.target instanceof Element && !menuRef.current?.contains(e.target) || !(e.target instanceof Element))) setMenuVisible(false);
|
|
357
|
+
}, []);
|
|
358
|
+
// Update the document click handler
|
|
359
|
+
(0, $gTuX4$react.useEffect)(()=>{
|
|
360
|
+
if (menuVisible) document.addEventListener("mousedown", handleClick);
|
|
361
|
+
else document.removeEventListener("mousedown", handleClick);
|
|
362
|
+
return ()=>{
|
|
363
|
+
document.removeEventListener("mousedown", handleClick);
|
|
364
|
+
};
|
|
365
|
+
}, [
|
|
366
|
+
handleClick,
|
|
367
|
+
menuVisible
|
|
368
|
+
]);
|
|
369
|
+
const removeController = (0, $gTuX4$react.useRef)(new AbortController());
|
|
370
|
+
(0, $gTuX4$react.useEffect)(()=>{
|
|
371
|
+
if (!mouseOverMenu && !menuVisible && !mouseOverHandlerDiv) {
|
|
372
|
+
removeController.current.abort();
|
|
373
|
+
removeController.current = new AbortController();
|
|
374
|
+
setTimeout(()=>{
|
|
375
|
+
if (!removeController.current.signal.aborted) setMenuInDom(false);
|
|
376
|
+
}, 300);
|
|
377
|
+
}
|
|
378
|
+
}, [
|
|
379
|
+
mouseOverHandlerDiv,
|
|
380
|
+
menuVisible,
|
|
381
|
+
mouseOverMenu
|
|
382
|
+
]);
|
|
383
|
+
return /*#__PURE__*/ (0, $gTuX4$reactjsxruntime.jsxs)($3c568ee547c732c3$export$fc58dc71afe92de2.Provider, {
|
|
384
|
+
value: {
|
|
385
|
+
menuItems: thisMenuItems
|
|
386
|
+
},
|
|
387
|
+
children: [
|
|
388
|
+
/*#__PURE__*/ (0, $gTuX4$reactjsxruntime.jsx)("div", {
|
|
389
|
+
ref: divHandlderRef,
|
|
390
|
+
...rest,
|
|
391
|
+
className: [
|
|
392
|
+
(0, (/*@__PURE__*/$parcel$interopDefault($da5a7b95ca760552$exports))).contextMenuHandler,
|
|
393
|
+
rest.className
|
|
394
|
+
].join(" "),
|
|
395
|
+
onContextMenu: (e)=>{
|
|
396
|
+
if (!showLowMenu) {
|
|
397
|
+
setMenuInDom(true);
|
|
398
|
+
e.preventDefault();
|
|
399
|
+
e.stopPropagation();
|
|
400
|
+
setTimeout(()=>{
|
|
401
|
+
removeController.current.abort();
|
|
402
|
+
setMenuVisible(true);
|
|
403
|
+
setMenuXPos(e.pageX);
|
|
404
|
+
setMenuYPos(e.pageY);
|
|
405
|
+
}, 1);
|
|
406
|
+
}
|
|
407
|
+
},
|
|
408
|
+
onMouseEnter: (e)=>{
|
|
409
|
+
if (showLowMenu) {
|
|
410
|
+
setMenuInDom(true);
|
|
411
|
+
setMouseOverHandlerDiv(false);
|
|
412
|
+
setTimeout(()=>{
|
|
413
|
+
removeController.current.abort();
|
|
414
|
+
setMouseOverHandlerDiv(true);
|
|
415
|
+
}, 1);
|
|
416
|
+
}
|
|
417
|
+
rest.onMouseEnter && rest.onMouseEnter(e);
|
|
418
|
+
},
|
|
419
|
+
onMouseLeave: (e)=>{
|
|
420
|
+
if (showLowMenu) {
|
|
421
|
+
removeController.current.abort();
|
|
422
|
+
removeController.current = new AbortController();
|
|
423
|
+
setMouseOverHandlerDiv(false);
|
|
424
|
+
}
|
|
425
|
+
rest.onMouseLeave && rest.onMouseLeave(e);
|
|
426
|
+
},
|
|
427
|
+
children: children
|
|
428
|
+
}),
|
|
429
|
+
menuInDom && divHandlerPos && /*#__PURE__*/ (0, $gTuX4$reactdom.createPortal)(/*#__PURE__*/ (0, $gTuX4$reactjsxruntime.jsx)("div", {
|
|
430
|
+
className: (0, (/*@__PURE__*/$parcel$interopDefault($da5a7b95ca760552$exports))).anchor,
|
|
431
|
+
onMouseEnter: ()=>{
|
|
432
|
+
removeController.current.abort();
|
|
433
|
+
setMouseOverMenu(true);
|
|
434
|
+
},
|
|
435
|
+
onMouseLeave: ()=>{
|
|
436
|
+
removeController.current.abort();
|
|
437
|
+
removeController.current = new AbortController();
|
|
438
|
+
setMouseOverMenu(false);
|
|
439
|
+
},
|
|
440
|
+
children: showLowMenu ? /*#__PURE__*/ (0, $gTuX4$reactjsxruntime.jsx)((0, $10d1ee4e7fc9bbbd$export$49e8edc8ebca5f25), {
|
|
441
|
+
visible: mouseOverHandlerDiv,
|
|
442
|
+
entries: menuItems,
|
|
443
|
+
xPos: divHandlerPos.left,
|
|
444
|
+
yPos: divHandlerPos.bottom,
|
|
445
|
+
maxWidth: divHandlerPos.width
|
|
446
|
+
}) : /*#__PURE__*/ (0, $gTuX4$reactjsxruntime.jsx)((0, $5150b66b01c99189$export$8dc6765e8be191c7), {
|
|
447
|
+
visible: menuVisible,
|
|
448
|
+
ref: menuRef,
|
|
449
|
+
entries: thisMenuItems,
|
|
450
|
+
xPos: menuXPos,
|
|
451
|
+
yPos: menuYPos,
|
|
452
|
+
toClose: ()=>{
|
|
453
|
+
setMenuVisible(false);
|
|
454
|
+
setMouseOverMenu(false);
|
|
455
|
+
}
|
|
456
|
+
})
|
|
457
|
+
}), document.body)
|
|
458
|
+
]
|
|
459
|
+
});
|
|
460
|
+
};
|
|
461
|
+
$3c568ee547c732c3$export$ed4f9641643dc7e4.displayName = "ContextMenuHandler";
|
|
462
|
+
|
|
463
|
+
|
|
464
|
+
|
|
465
|
+
|
|
466
|
+
|
|
467
|
+
const $c986bcdcae4b83bd$export$d81cfea7c54be196 = (divRef)=>{
|
|
468
|
+
if (!divRef.current) return {
|
|
469
|
+
translateX: 0,
|
|
470
|
+
translateY: 0
|
|
471
|
+
};
|
|
472
|
+
else {
|
|
473
|
+
const innerBounce = 16;
|
|
474
|
+
const posn = divRef.current.getBoundingClientRect();
|
|
475
|
+
let translateX = 0;
|
|
476
|
+
if (posn.left < innerBounce) translateX = -posn.left + innerBounce;
|
|
477
|
+
else if (posn.right > window.innerWidth) translateX = Math.max(-posn.left + innerBounce, window.innerWidth - posn.right - innerBounce);
|
|
478
|
+
let translateY = 0;
|
|
479
|
+
if (posn.top < innerBounce) translateY = -posn.top + innerBounce;
|
|
480
|
+
else if (posn.bottom > window.innerHeight) translateY = Math.max(-posn.top + innerBounce, window.innerHeight - posn.bottom - innerBounce);
|
|
481
|
+
return {
|
|
482
|
+
translateX: translateX,
|
|
483
|
+
translateY: translateY
|
|
484
|
+
};
|
|
485
|
+
}
|
|
486
|
+
};
|
|
487
|
+
|
|
488
|
+
|
|
489
|
+
var $7c5fb3f6c1601913$exports = {};
|
|
490
|
+
|
|
491
|
+
$parcel$export($7c5fb3f6c1601913$exports, "contextWindow", function () { return $7c5fb3f6c1601913$export$72cad2e5ad4d2674; }, function (v) { return $7c5fb3f6c1601913$export$72cad2e5ad4d2674 = v; });
|
|
492
|
+
$parcel$export($7c5fb3f6c1601913$exports, "contextWindowAnchor", function () { return $7c5fb3f6c1601913$export$9f3a8a17ac700f7d; }, function (v) { return $7c5fb3f6c1601913$export$9f3a8a17ac700f7d = v; });
|
|
493
|
+
$parcel$export($7c5fb3f6c1601913$exports, "contextWindowBody", function () { return $7c5fb3f6c1601913$export$dfb2c4d2d1c0156f; }, function (v) { return $7c5fb3f6c1601913$export$dfb2c4d2d1c0156f = v; });
|
|
494
|
+
$parcel$export($7c5fb3f6c1601913$exports, "contextWindowTitle", function () { return $7c5fb3f6c1601913$export$1b02f2cd2f7db0f4; }, function (v) { return $7c5fb3f6c1601913$export$1b02f2cd2f7db0f4 = v; });
|
|
495
|
+
$parcel$export($7c5fb3f6c1601913$exports, "contextWindowTitleClose", function () { return $7c5fb3f6c1601913$export$7ba38d4cc2870e66; }, function (v) { return $7c5fb3f6c1601913$export$7ba38d4cc2870e66 = v; });
|
|
496
|
+
$parcel$export($7c5fb3f6c1601913$exports, "contextWindowTitleText", function () { return $7c5fb3f6c1601913$export$cebbac70b4d99c48; }, function (v) { return $7c5fb3f6c1601913$export$cebbac70b4d99c48 = v; });
|
|
497
|
+
$parcel$export($7c5fb3f6c1601913$exports, "moving", function () { return $7c5fb3f6c1601913$export$d03a2f3acc60252b; }, function (v) { return $7c5fb3f6c1601913$export$d03a2f3acc60252b = v; });
|
|
498
|
+
var $7c5fb3f6c1601913$export$72cad2e5ad4d2674;
|
|
499
|
+
var $7c5fb3f6c1601913$export$9f3a8a17ac700f7d;
|
|
500
|
+
var $7c5fb3f6c1601913$export$dfb2c4d2d1c0156f;
|
|
501
|
+
var $7c5fb3f6c1601913$export$1b02f2cd2f7db0f4;
|
|
502
|
+
var $7c5fb3f6c1601913$export$7ba38d4cc2870e66;
|
|
503
|
+
var $7c5fb3f6c1601913$export$cebbac70b4d99c48;
|
|
504
|
+
var $7c5fb3f6c1601913$export$d03a2f3acc60252b;
|
|
505
|
+
$7c5fb3f6c1601913$export$72cad2e5ad4d2674 = `aiw-ContextWindow-module-RIIF9a-contextWindow`;
|
|
506
|
+
$7c5fb3f6c1601913$export$9f3a8a17ac700f7d = `aiw-ContextWindow-module-RIIF9a-contextWindowAnchor`;
|
|
507
|
+
$7c5fb3f6c1601913$export$dfb2c4d2d1c0156f = `aiw-ContextWindow-module-RIIF9a-contextWindowBody`;
|
|
508
|
+
$7c5fb3f6c1601913$export$1b02f2cd2f7db0f4 = `aiw-ContextWindow-module-RIIF9a-contextWindowTitle`;
|
|
509
|
+
$7c5fb3f6c1601913$export$7ba38d4cc2870e66 = `aiw-ContextWindow-module-RIIF9a-contextWindowTitleClose`;
|
|
510
|
+
$7c5fb3f6c1601913$export$cebbac70b4d99c48 = `aiw-ContextWindow-module-RIIF9a-contextWindowTitleText`;
|
|
511
|
+
$7c5fb3f6c1601913$export$d03a2f3acc60252b = `aiw-ContextWindow-module-RIIF9a-moving`;
|
|
512
|
+
|
|
513
|
+
|
|
514
|
+
|
|
515
|
+
|
|
516
|
+
const $16208d559c772441$export$aff5d0593e3727b0 = /*#__PURE__*/ (0, $gTuX4$react.createContext)(null);
|
|
517
|
+
const $16208d559c772441$var$pushToTop = (windowId, minZIndex, windowList, setWindowList)=>{
|
|
518
|
+
const otherWindows = windowList.filter((w)=>w.windowId !== windowId).map((w, i)=>({
|
|
519
|
+
windowId: w.windowId,
|
|
520
|
+
zIndex: minZIndex + i
|
|
521
|
+
}));
|
|
522
|
+
setWindowList([
|
|
523
|
+
...otherWindows,
|
|
524
|
+
{
|
|
525
|
+
windowId: windowId,
|
|
526
|
+
zIndex: minZIndex + otherWindows.length
|
|
527
|
+
}
|
|
528
|
+
]);
|
|
529
|
+
};
|
|
530
|
+
const $16208d559c772441$export$9f37482ccd50dad2 = ({ minZIndex: minZIndex = 1000, children: children })=>{
|
|
531
|
+
const [currentWindows, setCurrentWindows] = (0, $gTuX4$react.useState)([]);
|
|
532
|
+
return /*#__PURE__*/ (0, $gTuX4$reactjsxruntime.jsx)($16208d559c772441$export$aff5d0593e3727b0.Provider, {
|
|
533
|
+
value: {
|
|
534
|
+
currentWindows: currentWindows.map((w)=>({
|
|
535
|
+
windowId: w.windowId,
|
|
536
|
+
zIndex: minZIndex + w.zIndex
|
|
537
|
+
})),
|
|
538
|
+
pushToTop: (ret)=>$16208d559c772441$var$pushToTop(ret, minZIndex, currentWindows, setCurrentWindows)
|
|
539
|
+
},
|
|
540
|
+
children: children
|
|
541
|
+
});
|
|
542
|
+
};
|
|
543
|
+
$16208d559c772441$export$9f37482ccd50dad2.displayName = "ContextWindowStack";
|
|
544
|
+
|
|
545
|
+
|
|
546
|
+
const $46fb0088a1bbb6d8$export$1af8984c69ba1b24 = ({ id: id, visible: visible, title: title, titleElement: titleElement, children: children, onOpen: onOpen, onClose: onClose, ...rest })=>{
|
|
547
|
+
const windowStack = (0, $gTuX4$react.useContext)((0, $16208d559c772441$export$aff5d0593e3727b0));
|
|
548
|
+
const windowId = (0, $gTuX4$react.useRef)(null);
|
|
549
|
+
const divRef = (0, $gTuX4$react.useRef)(null);
|
|
550
|
+
const windowRef = (0, $gTuX4$react.useRef)(null);
|
|
551
|
+
const [windowInDOM, setWindowInDOM] = (0, $gTuX4$react.useState)(false);
|
|
552
|
+
const [windowVisible, setWindowVisible] = (0, $gTuX4$react.useState)(false);
|
|
553
|
+
const zIndex = (0, $gTuX4$react.useMemo)(()=>{
|
|
554
|
+
return windowStack?.currentWindows.find((w)=>w.windowId === windowId.current)?.zIndex ?? 1;
|
|
555
|
+
}, [
|
|
556
|
+
windowStack?.currentWindows
|
|
557
|
+
]);
|
|
558
|
+
// Position
|
|
559
|
+
const windowPos = (0, $gTuX4$react.useRef)({
|
|
560
|
+
x: 0,
|
|
561
|
+
y: 0
|
|
562
|
+
});
|
|
563
|
+
const [moving, setMoving] = (0, $gTuX4$react.useState)(false);
|
|
564
|
+
const move = (0, $gTuX4$react.useCallback)((x, y)=>{
|
|
565
|
+
if (windowRef.current && windowPos.current) {
|
|
566
|
+
const window1 = windowRef.current;
|
|
567
|
+
const pos = windowPos.current;
|
|
568
|
+
pos.x += x;
|
|
569
|
+
pos.y += y;
|
|
570
|
+
window1.style.transform = `translate(${pos.x}px, ${pos.y}px)`;
|
|
571
|
+
}
|
|
572
|
+
}, []);
|
|
573
|
+
const checkPosition = (0, $gTuX4$react.useCallback)(()=>{
|
|
574
|
+
const chkPos = (0, $c986bcdcae4b83bd$export$d81cfea7c54be196)(windowRef);
|
|
575
|
+
move(chkPos.translateX, chkPos.translateY);
|
|
576
|
+
}, [
|
|
577
|
+
move
|
|
578
|
+
]);
|
|
579
|
+
const mouseMove = (0, $gTuX4$react.useCallback)((e)=>{
|
|
580
|
+
e.preventDefault();
|
|
581
|
+
e.stopPropagation();
|
|
582
|
+
move(e.movementX, e.movementY);
|
|
583
|
+
}, [
|
|
584
|
+
move
|
|
585
|
+
]);
|
|
586
|
+
const mouseUp = (0, $gTuX4$react.useCallback)((e)=>{
|
|
587
|
+
e.preventDefault();
|
|
588
|
+
e.stopPropagation();
|
|
589
|
+
setMoving(false);
|
|
590
|
+
checkPosition();
|
|
591
|
+
document.removeEventListener("mousemove", mouseMove);
|
|
592
|
+
document.removeEventListener("mouseup", mouseUp);
|
|
593
|
+
window.removeEventListener("resize", checkPosition);
|
|
594
|
+
if (e.target && (e.target instanceof HTMLElement || e.target instanceof SVGElement)) e.target.style.userSelect = "auto";
|
|
595
|
+
}, [
|
|
596
|
+
checkPosition,
|
|
597
|
+
mouseMove
|
|
598
|
+
]);
|
|
599
|
+
// Update visibility
|
|
600
|
+
(0, $gTuX4$react.useEffect)(()=>{
|
|
601
|
+
if (windowStack) {
|
|
602
|
+
// Visible set, but not in DOM
|
|
603
|
+
if (visible && !windowInDOM) setWindowInDOM(true);
|
|
604
|
+
else if (visible && windowInDOM && !windowVisible) {
|
|
605
|
+
if (!windowId.current) {
|
|
606
|
+
const maxWindowId = Math.max(0, ...windowStack.currentWindows.map((w)=>w.windowId));
|
|
607
|
+
windowId.current = maxWindowId + 1;
|
|
608
|
+
}
|
|
609
|
+
windowStack.pushToTop(windowId.current);
|
|
610
|
+
setWindowVisible(visible);
|
|
611
|
+
onOpen && onOpen();
|
|
612
|
+
// Get starting position
|
|
613
|
+
if (divRef.current && windowRef.current) {
|
|
614
|
+
const parentPos = divRef.current.getBoundingClientRect();
|
|
615
|
+
const pos = windowRef.current.getBoundingClientRect();
|
|
616
|
+
const windowHeight = pos.bottom - pos.top;
|
|
617
|
+
windowRef.current.style.left = `${parentPos.left}px`;
|
|
618
|
+
windowRef.current.style.top = `${parentPos.bottom + windowHeight < window.innerHeight ? parentPos.bottom : Math.max(0, parentPos.top - windowHeight)}px`;
|
|
619
|
+
windowRef.current.style.transform = "";
|
|
620
|
+
windowPos.current = {
|
|
621
|
+
x: 0,
|
|
622
|
+
y: 0
|
|
623
|
+
};
|
|
624
|
+
}
|
|
625
|
+
checkPosition();
|
|
626
|
+
} else if (windowId.current && !visible && windowVisible) setWindowVisible(false);
|
|
627
|
+
else if (windowId.current && !visible && windowInDOM) setWindowInDOM(false);
|
|
628
|
+
}
|
|
629
|
+
}, [
|
|
630
|
+
checkPosition,
|
|
631
|
+
onOpen,
|
|
632
|
+
visible,
|
|
633
|
+
windowInDOM,
|
|
634
|
+
windowStack,
|
|
635
|
+
windowVisible
|
|
636
|
+
]);
|
|
637
|
+
return /*#__PURE__*/ (0, $gTuX4$reactjsxruntime.jsxs)("div", {
|
|
638
|
+
className: (0, (/*@__PURE__*/$parcel$interopDefault($7c5fb3f6c1601913$exports))).contextWindowAnchor,
|
|
639
|
+
ref: divRef,
|
|
640
|
+
children: [
|
|
641
|
+
!windowStack && /*#__PURE__*/ (0, $gTuX4$reactjsxruntime.jsxs)("div", {
|
|
642
|
+
...rest,
|
|
643
|
+
children: [
|
|
644
|
+
false,
|
|
645
|
+
children
|
|
646
|
+
]
|
|
647
|
+
}),
|
|
648
|
+
windowStack && windowInDOM && /*#__PURE__*/ (0, $gTuX4$reactdom.createPortal)(/*#__PURE__*/ (0, $gTuX4$reactjsxruntime.jsxs)("div", {
|
|
649
|
+
...rest,
|
|
650
|
+
ref: windowRef,
|
|
651
|
+
id: id,
|
|
652
|
+
className: [
|
|
653
|
+
(0, (/*@__PURE__*/$parcel$interopDefault($7c5fb3f6c1601913$exports))).contextWindow,
|
|
654
|
+
rest.className
|
|
655
|
+
].join(" "),
|
|
656
|
+
style: {
|
|
657
|
+
...rest.style,
|
|
658
|
+
opacity: moving ? 0.8 : windowVisible ? 1 : 0,
|
|
659
|
+
visibility: windowVisible ? "visible" : "hidden",
|
|
660
|
+
zIndex: zIndex ?? 1,
|
|
661
|
+
minHeight: rest.style?.minHeight ?? "150px",
|
|
662
|
+
minWidth: rest.style?.minWidth ?? "200px",
|
|
663
|
+
maxHeight: rest.style?.maxHeight ?? "1000px",
|
|
664
|
+
maxWidth: rest.style?.maxWidth ?? "1000px"
|
|
665
|
+
},
|
|
666
|
+
onClickCapture: (e)=>{
|
|
667
|
+
windowId && windowId.current && windowStack.pushToTop(windowId.current);
|
|
668
|
+
rest.onClickCapture && rest.onClickCapture(e);
|
|
669
|
+
},
|
|
670
|
+
children: [
|
|
671
|
+
/*#__PURE__*/ (0, $gTuX4$reactjsxruntime.jsxs)("div", {
|
|
672
|
+
className: [
|
|
673
|
+
(0, (/*@__PURE__*/$parcel$interopDefault($7c5fb3f6c1601913$exports))).contextWindowTitle,
|
|
674
|
+
moving ? (0, (/*@__PURE__*/$parcel$interopDefault($7c5fb3f6c1601913$exports))).moving : ""
|
|
675
|
+
].filter((c)=>c !== "").join(" "),
|
|
676
|
+
onMouseDown: (e)=>{
|
|
677
|
+
if (e.target && (e.target instanceof HTMLElement || e.target instanceof SVGElement)) e.target.style.userSelect = "none";
|
|
678
|
+
setMoving(true);
|
|
679
|
+
windowId && windowId.current && windowStack.pushToTop(windowId.current);
|
|
680
|
+
document.addEventListener("mouseup", mouseUp);
|
|
681
|
+
document.addEventListener("mousemove", mouseMove);
|
|
682
|
+
window.addEventListener("resize", ()=>checkPosition());
|
|
683
|
+
},
|
|
684
|
+
children: [
|
|
685
|
+
/*#__PURE__*/ (0, $gTuX4$reactjsxruntime.jsx)("div", {
|
|
686
|
+
className: (0, (/*@__PURE__*/$parcel$interopDefault($7c5fb3f6c1601913$exports))).contextWindowTitleText,
|
|
687
|
+
title: title,
|
|
688
|
+
children: titleElement ? titleElement : title
|
|
689
|
+
}),
|
|
690
|
+
/*#__PURE__*/ (0, $gTuX4$reactjsxruntime.jsx)("div", {
|
|
691
|
+
className: (0, (/*@__PURE__*/$parcel$interopDefault($7c5fb3f6c1601913$exports))).contextWindowTitleClose,
|
|
692
|
+
children: /*#__PURE__*/ (0, $gTuX4$reactjsxruntime.jsx)("svg", {
|
|
693
|
+
xmlns: "http://www.w3.org/2000/svg",
|
|
694
|
+
width: "16",
|
|
695
|
+
height: "16",
|
|
696
|
+
fill: "currentColor",
|
|
697
|
+
viewBox: "0 0 16 16",
|
|
698
|
+
"aria-label": "Close window",
|
|
699
|
+
onClick: onClose,
|
|
700
|
+
children: /*#__PURE__*/ (0, $gTuX4$reactjsxruntime.jsx)("path", {
|
|
701
|
+
d: "M4.646 4.646a.5.5 0 0 1 .708 0L8 7.293l2.646-2.647a.5.5 0 0 1 .708.708L8.707 8l2.647 2.646a.5.5 0 0 1-.708.708L8 8.707l-2.646 2.647a.5.5 0 0 1-.708-.708L7.293 8 4.646 5.354a.5.5 0 0 1 0-.708z"
|
|
702
|
+
})
|
|
703
|
+
})
|
|
704
|
+
})
|
|
705
|
+
]
|
|
706
|
+
}),
|
|
707
|
+
/*#__PURE__*/ (0, $gTuX4$reactjsxruntime.jsx)("div", {
|
|
708
|
+
className: (0, (/*@__PURE__*/$parcel$interopDefault($7c5fb3f6c1601913$exports))).contextWindowBody,
|
|
709
|
+
children: /*#__PURE__*/ (0, $gTuX4$reactjsxruntime.jsx)("div", {
|
|
710
|
+
children: children
|
|
711
|
+
})
|
|
712
|
+
})
|
|
713
|
+
]
|
|
714
|
+
}), document.body)
|
|
715
|
+
]
|
|
716
|
+
});
|
|
717
|
+
};
|
|
718
|
+
$46fb0088a1bbb6d8$export$1af8984c69ba1b24.displayName = "ContextWindow";
|
|
719
|
+
|
|
720
|
+
|
|
721
|
+
|
|
722
|
+
|
|
723
|
+
|
|
724
|
+
$parcel$exportWildcard(module.exports, $a68bd8a6c0fd98c2$exports);
|
|
725
|
+
|
|
726
|
+
|
|
727
|
+
//# sourceMappingURL=main.js.map
|