@asup/context-menu 1.3.3 → 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/main.js CHANGED
@@ -1,12 +1,18 @@
1
1
  import "./main.css";
2
- import {jsxs as $duWW8$jsxs, Fragment as $duWW8$Fragment, jsx as $duWW8$jsx} from "react/jsx-runtime";
3
- import $duWW8$react, {useRef as $duWW8$useRef, useState as $duWW8$useState, useCallback as $duWW8$useCallback, useEffect as $duWW8$useEffect, useContext as $duWW8$useContext, useMemo as $duWW8$useMemo, createContext as $duWW8$createContext} from "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: "caret-holder",
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: "sub-menu",
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: `context-menu${visible ? " visible" : ""}`,
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: `context-menu-item${entry.disabled ? " disabled" : ""}`,
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: "context-menu-item-label",
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: "caret-holder",
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: "sub-menu",
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: `low-menu-item${entry.disabled ? " disabled" : ""}`,
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, visible: visible })=>{
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: `low-menu ${visible ? "visible" : "hidden"}`,
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,12 +265,33 @@ const $914758b0c9d59759$export$49e8edc8ebca5f25 = ({ entries: entries, target: t
183
265
  $914758b0c9d59759$export$49e8edc8ebca5f25.displayName = "LowMenu";
184
266
 
185
267
 
186
- const $1e1c1e9e0b943830$export$ed4f9641643dc7e4 = ({ children: children, menuItems: menuItems, showLowMenu: showLowMenu = false, style: style = {
187
- height: "fit-content",
188
- width: "fit-content"
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 divRef = (0, $duWW8$useRef)(null);
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);
@@ -196,6 +299,8 @@ const $1e1c1e9e0b943830$export$ed4f9641643dc7e4 = ({ children: children, menuIte
196
299
  const [target, setTarget] = (0, $duWW8$useState)(null);
197
300
  const [lowTarget, setLowTarget] = (0, $duWW8$useState)(null);
198
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;
199
304
  // Show menu when context is requested
200
305
  const showMenu = (e)=>{
201
306
  const sel = window.getSelection();
@@ -222,12 +327,22 @@ const $1e1c1e9e0b943830$export$ed4f9641643dc7e4 = ({ children: children, menuIte
222
327
  handleClick,
223
328
  menuVisible
224
329
  ]);
225
- return /*#__PURE__*/ (0, $duWW8$jsxs)((0, $duWW8$Fragment), {
330
+ return /*#__PURE__*/ (0, $duWW8$jsxs)($1e1c1e9e0b943830$export$fc58dc71afe92de2.Provider, {
331
+ value: {
332
+ menuItems: thisMenuItems
333
+ },
226
334
  children: [
227
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
+ },
228
345
  onContextMenu: showLowMenu ? undefined : showMenu,
229
- className: "context-menu-handler",
230
- style: style,
231
346
  onMouseEnter: ()=>{
232
347
  showLowMenu && setLowMenuVisible(true);
233
348
  },
@@ -237,26 +352,20 @@ const $1e1c1e9e0b943830$export$ed4f9641643dc7e4 = ({ children: children, menuIte
237
352
  children: children
238
353
  }),
239
354
  menuVisible && !showLowMenu && /*#__PURE__*/ (0, $duWW8$createPortal)(/*#__PURE__*/ (0, $duWW8$jsx)("div", {
240
- style: {
241
- position: "absolute",
242
- top: 0,
243
- left: 0
244
- },
245
- ref: divRef,
355
+ className: (0, (/*@__PURE__*/$parcel$interopDefault($47067f35ca62d4a5$exports))).anchor,
356
+ ref: divMenuRef,
246
357
  children: /*#__PURE__*/ (0, $duWW8$jsx)((0, $567ed433af94513f$export$8dc6765e8be191c7), {
247
358
  visible: true,
248
359
  ref: menuRef,
249
- entries: menuItems,
360
+ entries: thisMenuItems,
250
361
  xPos: menuXPos,
251
362
  yPos: menuYPos,
252
363
  target: target,
253
364
  toClose: ()=>setMenuVisible(false)
254
365
  })
255
366
  }), document.body),
256
- showLowMenu && /*#__PURE__*/ (0, $duWW8$jsx)("div", {
257
- style: {
258
- position: "relative"
259
- },
367
+ showLowMenu && divHandlerPos && /*#__PURE__*/ (0, $duWW8$createPortal)(/*#__PURE__*/ (0, $duWW8$jsx)("div", {
368
+ className: (0, (/*@__PURE__*/$parcel$interopDefault($47067f35ca62d4a5$exports))).anchor,
260
369
  onMouseEnter: ()=>{
261
370
  const sel = window.getSelection();
262
371
  const lowSel = sel && sel.rangeCount > 0 ? sel.getRangeAt(0) : null;
@@ -268,9 +377,11 @@ const $1e1c1e9e0b943830$export$ed4f9641643dc7e4 = ({ children: children, menuIte
268
377
  children: /*#__PURE__*/ (0, $duWW8$jsx)((0, $914758b0c9d59759$export$49e8edc8ebca5f25), {
269
378
  visible: lowMenuVisible,
270
379
  entries: menuItems,
271
- target: lowTarget
380
+ target: lowTarget,
381
+ xPos: divHandlerPos.left,
382
+ yPos: divHandlerPos.bottom
272
383
  })
273
- })
384
+ }), document.body)
274
385
  ]
275
386
  });
276
387
  };
@@ -280,6 +391,27 @@ $1e1c1e9e0b943830$export$ed4f9641643dc7e4.displayName = "ContextMenuHandler";
280
391
 
281
392
 
282
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
+
283
415
 
284
416
 
285
417
 
@@ -313,29 +445,33 @@ const $17c46b9e6a2eb66e$export$9f37482ccd50dad2 = ({ minZIndex: minZIndex = 1000
313
445
  $17c46b9e6a2eb66e$export$9f37482ccd50dad2.displayName = "ContextWindowStack";
314
446
 
315
447
 
316
- const $ab4d5d6bf03370d0$export$d81cfea7c54be196 = (divRef)=>{
317
- if (!divRef.current) return {
318
- translateX: 0,
319
- translateY: 0
320
- };
321
- else {
322
- const innerBounce = 16;
323
- const posn = divRef.current.getBoundingClientRect();
324
- let translateX = 0;
325
- if (posn.left < innerBounce) translateX = -posn.left + innerBounce;
326
- else if (posn.right > window.innerWidth) translateX = Math.max(-posn.left + innerBounce, window.innerWidth - posn.right - innerBounce);
327
- let translateY = 0;
328
- if (posn.top < innerBounce) translateY = -posn.top + innerBounce;
329
- else if (posn.bottom > window.innerHeight) translateY = Math.max(-posn.top + innerBounce, window.innerHeight - posn.bottom - innerBounce);
330
- return {
331
- translateX: translateX,
332
- translateY: translateY
333
- };
334
- }
335
- };
336
-
337
-
338
- const $b5e8657823def5be$export$1af8984c69ba1b24 = ({ id: id, visible: visible, title: title, style: style, children: children, onOpen: onOpen, onClose: onClose })=>{
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;
339
475
  const windowStack = (0, $duWW8$useContext)((0, $17c46b9e6a2eb66e$export$aff5d0593e3727b0));
340
476
  const windowId = (0, $duWW8$useRef)(null);
341
477
  const divRef = (0, $duWW8$useRef)(null);
@@ -423,22 +559,23 @@ const $b5e8657823def5be$export$1af8984c69ba1b24 = ({ id: id, visible: visible, t
423
559
  windowStack,
424
560
  windowVisible
425
561
  ]);
426
- var _style_minHeight, _style_minWidth, _style_maxHeight, _style_maxWidth;
562
+ var _rest_style_minHeight, _rest_style_minWidth, _rest_style_maxHeight, _rest_style_maxWidth;
427
563
  return /*#__PURE__*/ (0, $duWW8$jsx)("div", {
428
- className: "contextwindow-anchor",
564
+ className: (0, (/*@__PURE__*/$parcel$interopDefault($ddf7153c7c69b209$exports))).contextWindowAnchor,
429
565
  ref: divRef,
430
566
  children: windowStack && /*#__PURE__*/ (0, $duWW8$createPortal)(/*#__PURE__*/ (0, $duWW8$jsxs)("div", {
567
+ ...rest,
431
568
  id: id,
432
- className: "contextwindow",
569
+ className: (0, (/*@__PURE__*/$parcel$interopDefault($ddf7153c7c69b209$exports))).contextWindow,
433
570
  style: {
434
- ...style,
571
+ ...rest.style,
435
572
  opacity: moving ? 0.8 : windowVisible ? 1 : 0,
436
573
  visibility: windowVisible ? "visible" : "hidden",
437
574
  zIndex: zIndex !== null && zIndex !== void 0 ? zIndex : 1,
438
- minHeight: (_style_minHeight = style === null || style === void 0 ? void 0 : style.minHeight) !== null && _style_minHeight !== void 0 ? _style_minHeight : "150px",
439
- minWidth: (_style_minWidth = style === null || style === void 0 ? void 0 : style.minWidth) !== null && _style_minWidth !== void 0 ? _style_minWidth : "200px",
440
- maxHeight: (_style_maxHeight = style === null || style === void 0 ? void 0 : style.maxHeight) !== null && _style_maxHeight !== void 0 ? _style_maxHeight : "1000px",
441
- maxWidth: (_style_maxWidth = style === null || style === void 0 ? void 0 : style.maxWidth) !== null && _style_maxWidth !== void 0 ? _style_maxWidth : "1000px"
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"
442
579
  },
443
580
  onClickCapture: ()=>{
444
581
  windowId && windowId.current && windowStack.pushToTop(windowId.current);
@@ -446,7 +583,10 @@ const $b5e8657823def5be$export$1af8984c69ba1b24 = ({ id: id, visible: visible, t
446
583
  ref: windowRef,
447
584
  children: [
448
585
  /*#__PURE__*/ (0, $duWW8$jsxs)("div", {
449
- className: `contextwindow-title ${moving ? "moving" : ""}`,
586
+ className: [
587
+ (0, (/*@__PURE__*/$parcel$interopDefault($ddf7153c7c69b209$exports))).contextWindowTitle,
588
+ moving ? (0, (/*@__PURE__*/$parcel$interopDefault($ddf7153c7c69b209$exports))).moving : ""
589
+ ].filter((c)=>c !== "").join(" "),
450
590
  onMouseDown: (e)=>{
451
591
  if (e.target && (e.target instanceof HTMLElement || e.target instanceof SVGElement)) e.target.style.userSelect = "none";
452
592
  setMoving(true);
@@ -457,11 +597,11 @@ const $b5e8657823def5be$export$1af8984c69ba1b24 = ({ id: id, visible: visible, t
457
597
  },
458
598
  children: [
459
599
  /*#__PURE__*/ (0, $duWW8$jsx)("div", {
460
- className: "contextwindow-title-text",
600
+ className: (0, (/*@__PURE__*/$parcel$interopDefault($ddf7153c7c69b209$exports))).contextWindowTitleText,
461
601
  children: title
462
602
  }),
463
603
  /*#__PURE__*/ (0, $duWW8$jsx)("div", {
464
- className: "contextwindow-title-close",
604
+ className: (0, (/*@__PURE__*/$parcel$interopDefault($ddf7153c7c69b209$exports))).contextWindowTitleClose,
465
605
  children: /*#__PURE__*/ (0, $duWW8$jsx)("svg", {
466
606
  xmlns: "http://www.w3.org/2000/svg",
467
607
  width: "16",
@@ -478,7 +618,7 @@ const $b5e8657823def5be$export$1af8984c69ba1b24 = ({ id: id, visible: visible, t
478
618
  ]
479
619
  }),
480
620
  /*#__PURE__*/ (0, $duWW8$jsx)("div", {
481
- className: "contextwindow-body",
621
+ className: (0, (/*@__PURE__*/$parcel$interopDefault($ddf7153c7c69b209$exports))).contextWindowBody,
482
622
  children: /*#__PURE__*/ (0, $duWW8$jsx)("div", {
483
623
  children: children
484
624
  })