@maomaolabs/core 1.0.2 → 1.1.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +101 -1
- package/dist/index.d.ts +41 -16
- package/dist/index.es.js +535 -470
- package/dist/style.css +1 -1
- package/package.json +1 -1
package/dist/index.es.js
CHANGED
|
@@ -1,21 +1,25 @@
|
|
|
1
1
|
"use client";
|
|
2
|
-
import { jsx as
|
|
3
|
-
import
|
|
4
|
-
import { createPortal as
|
|
5
|
-
|
|
6
|
-
|
|
2
|
+
import { jsx as o, Fragment as G, jsxs as p } from "react/jsx-runtime";
|
|
3
|
+
import J, { createContext as ne, useContext as ie, useSyncExternalStore as Ce, useState as z, useRef as M, useEffect as H, memo as V, useCallback as f, useMemo as E } from "react";
|
|
4
|
+
import { createPortal as oe } from "react-dom";
|
|
5
|
+
const se = ne("default");
|
|
6
|
+
function we() {
|
|
7
|
+
return ie(se);
|
|
8
|
+
}
|
|
9
|
+
function Rn({ children: e, systemStyle: t = "default" }) {
|
|
10
|
+
return /* @__PURE__ */ o(se.Provider, { value: t, children: e });
|
|
7
11
|
}
|
|
8
|
-
function
|
|
12
|
+
function $e(e) {
|
|
9
13
|
let t;
|
|
10
|
-
const
|
|
14
|
+
const i = /* @__PURE__ */ new Set(), n = (r, l) => {
|
|
11
15
|
const u = typeof r == "function" ? r(t) : r;
|
|
12
|
-
u !== t && (t = l ? u : Object.assign({}, t, u),
|
|
13
|
-
}, s = () => t, c = (r) => (
|
|
14
|
-
|
|
16
|
+
u !== t && (t = l ? u : Object.assign({}, t, u), i.forEach((d) => d()));
|
|
17
|
+
}, s = () => t, c = (r) => (i.add(r), () => {
|
|
18
|
+
i.delete(r);
|
|
15
19
|
});
|
|
16
20
|
t = e(n, s);
|
|
17
21
|
const a = (r) => {
|
|
18
|
-
const l =
|
|
22
|
+
const l = Ce(c, s, s);
|
|
19
23
|
return r ? r(l) : l;
|
|
20
24
|
};
|
|
21
25
|
return Object.assign(a, {
|
|
@@ -24,29 +28,29 @@ function ye(e) {
|
|
|
24
28
|
subscribe: c
|
|
25
29
|
}), a;
|
|
26
30
|
}
|
|
27
|
-
const
|
|
28
|
-
const
|
|
29
|
-
if (!
|
|
31
|
+
const re = 768, Ne = 200, Le = () => typeof window < "u" && window.innerWidth <= re, U = (e, t) => {
|
|
32
|
+
const i = e.find((r) => r.id === t);
|
|
33
|
+
if (!i)
|
|
30
34
|
return e;
|
|
31
|
-
const c = [...[...e].sort((r, l) => (r.zIndex || 0) - (l.zIndex || 0)).filter((r) => r.id !== t),
|
|
35
|
+
const c = [...[...e].sort((r, l) => (r.zIndex || 0) - (l.zIndex || 0)).filter((r) => r.id !== t), i], a = new Map(c.map((r, l) => [r.id, l + 1]));
|
|
32
36
|
return e.map((r) => ({
|
|
33
37
|
...r,
|
|
34
38
|
zIndex: a.get(r.id)
|
|
35
39
|
}));
|
|
36
|
-
},
|
|
40
|
+
}, Q = $e((e) => ({
|
|
37
41
|
windows: [],
|
|
38
42
|
snapPreview: null,
|
|
39
43
|
setSnapPreview: (t) => e({ snapPreview: t }),
|
|
40
44
|
openWindow: (t) => {
|
|
41
|
-
e((
|
|
42
|
-
const n =
|
|
43
|
-
if (n.find((
|
|
45
|
+
e((i) => {
|
|
46
|
+
const n = i.windows;
|
|
47
|
+
if (n.find((m) => m.id === t.id))
|
|
44
48
|
return {
|
|
45
|
-
windows:
|
|
49
|
+
windows: U(n, t.id).map(
|
|
46
50
|
(x) => x.id === t.id ? { ...x, isMinimized: !1 } : x
|
|
47
51
|
)
|
|
48
52
|
};
|
|
49
|
-
const c =
|
|
53
|
+
const c = Le(), { initialSize: a, initialPosition: r, ...l } = t, u = t, d = n.length > 0 ? Math.max(...n.map((m) => m.zIndex || 0)) : 0, h = {
|
|
50
54
|
...l,
|
|
51
55
|
zIndex: d + 1,
|
|
52
56
|
isMinimized: !1,
|
|
@@ -55,46 +59,46 @@ const se = 768, Me = 200, ze = () => typeof window < "u" && window.innerWidth <=
|
|
|
55
59
|
size: u.size || a || { width: 400, height: 300 },
|
|
56
60
|
position: u.position || r || { x: 50, y: 50 }
|
|
57
61
|
};
|
|
58
|
-
return { windows: [...n,
|
|
62
|
+
return { windows: [...n, h] };
|
|
59
63
|
});
|
|
60
64
|
},
|
|
61
65
|
closeWindow: (t) => {
|
|
62
|
-
e((
|
|
63
|
-
windows:
|
|
66
|
+
e((i) => ({
|
|
67
|
+
windows: i.windows.filter((n) => n.id !== t)
|
|
64
68
|
}));
|
|
65
69
|
},
|
|
66
70
|
focusWindow: (t) => {
|
|
67
|
-
e((
|
|
68
|
-
windows:
|
|
71
|
+
e((i) => i.windows.some((c) => c.id === t) ? {
|
|
72
|
+
windows: U(i.windows, t).map(
|
|
69
73
|
(c) => c.id === t ? { ...c, isMinimized: !1 } : c
|
|
70
74
|
)
|
|
71
|
-
} :
|
|
75
|
+
} : i);
|
|
72
76
|
},
|
|
73
|
-
updateWindow: (t,
|
|
77
|
+
updateWindow: (t, i) => {
|
|
74
78
|
e((n) => ({
|
|
75
|
-
windows: n.windows.map((s) => s.id === t ? { ...s, ...
|
|
79
|
+
windows: n.windows.map((s) => s.id === t ? { ...s, ...i } : s)
|
|
76
80
|
}));
|
|
77
81
|
}
|
|
78
82
|
}));
|
|
79
|
-
function
|
|
80
|
-
return
|
|
83
|
+
function le() {
|
|
84
|
+
return Q((e) => ({
|
|
81
85
|
openWindow: e.openWindow,
|
|
82
86
|
closeWindow: e.closeWindow,
|
|
83
87
|
focusWindow: e.focusWindow,
|
|
84
88
|
updateWindow: e.updateWindow
|
|
85
89
|
}));
|
|
86
90
|
}
|
|
87
|
-
function
|
|
88
|
-
return
|
|
91
|
+
function ce() {
|
|
92
|
+
return Q((e) => ({
|
|
89
93
|
snapPreview: e.snapPreview,
|
|
90
94
|
setSnapPreview: e.setSnapPreview
|
|
91
95
|
}));
|
|
92
96
|
}
|
|
93
|
-
function
|
|
94
|
-
return
|
|
97
|
+
function ae() {
|
|
98
|
+
return Q((e) => e.windows);
|
|
95
99
|
}
|
|
96
|
-
function
|
|
97
|
-
const [e, t] =
|
|
100
|
+
function ke() {
|
|
101
|
+
const [e, t] = z(!1);
|
|
98
102
|
return {
|
|
99
103
|
isOpen: e,
|
|
100
104
|
setIsOpen: t,
|
|
@@ -103,78 +107,78 @@ function we() {
|
|
|
103
107
|
}
|
|
104
108
|
};
|
|
105
109
|
}
|
|
106
|
-
const
|
|
107
|
-
container:
|
|
108
|
-
menuLeft:
|
|
109
|
-
dockWrapper:
|
|
110
|
-
menuRight:
|
|
111
|
-
dock:
|
|
112
|
-
catIcon:
|
|
113
|
-
launcher:
|
|
114
|
-
folderWrapper:
|
|
115
|
-
folderMenuPortal:
|
|
116
|
-
folderMenuPortalVisible:
|
|
117
|
-
folderLabel:
|
|
118
|
-
menuContentBase:
|
|
119
|
-
menuContentRight:
|
|
120
|
-
menuOpen:
|
|
121
|
-
menuClosed:
|
|
122
|
-
menuContentLeft:
|
|
123
|
-
},
|
|
124
|
-
zzzContainer:
|
|
125
|
-
z:
|
|
126
|
-
floatZ:
|
|
110
|
+
const Te = "_container_173at_1", We = "_menuLeft_173at_29", Re = "_dockWrapper_173at_43", Se = "_menuRight_173at_55", Ie = "_dock_173at_43", Be = "_catIcon_173at_103", Ee = "_launcher_173at_119", Oe = "_folderWrapper_173at_159", He = "_folderMenuPortal_173at_173", Ae = "_folderMenuPortalVisible_173at_217", De = "_folderLabel_173at_229", Pe = "_menuContentBase_173at_263", Fe = "_menuContentRight_173at_379 _menuContentBase_173at_263", Ve = "_menuOpen_173at_389", je = "_menuClosed_173at_401", Ze = "_menuContentLeft_173at_413 _menuContentBase_173at_263", v = {
|
|
111
|
+
container: Te,
|
|
112
|
+
menuLeft: We,
|
|
113
|
+
dockWrapper: Re,
|
|
114
|
+
menuRight: Se,
|
|
115
|
+
dock: Ie,
|
|
116
|
+
catIcon: Be,
|
|
117
|
+
launcher: Ee,
|
|
118
|
+
folderWrapper: Oe,
|
|
119
|
+
folderMenuPortal: He,
|
|
120
|
+
folderMenuPortalVisible: Ae,
|
|
121
|
+
folderLabel: De,
|
|
122
|
+
menuContentBase: Pe,
|
|
123
|
+
menuContentRight: Fe,
|
|
124
|
+
menuOpen: Ve,
|
|
125
|
+
menuClosed: je,
|
|
126
|
+
menuContentLeft: Ze
|
|
127
|
+
}, qe = "_zzzContainer_13qis_1", Xe = "_z_13qis_1", Ye = "_floatZ_13qis_1", X = {
|
|
128
|
+
zzzContainer: qe,
|
|
129
|
+
z: Xe,
|
|
130
|
+
floatZ: Ye
|
|
127
131
|
};
|
|
128
|
-
function
|
|
129
|
-
return /* @__PURE__ */
|
|
130
|
-
/* @__PURE__ */
|
|
131
|
-
/* @__PURE__ */
|
|
132
|
-
/* @__PURE__ */
|
|
132
|
+
function de({ show: e }) {
|
|
133
|
+
return /* @__PURE__ */ o(G, { children: e && /* @__PURE__ */ p("div", { className: X.zzzContainer, "aria-hidden": "true", children: [
|
|
134
|
+
/* @__PURE__ */ o("span", { className: X.z, children: "z" }),
|
|
135
|
+
/* @__PURE__ */ o("span", { className: X.z, children: "z" }),
|
|
136
|
+
/* @__PURE__ */ o("span", { className: X.z, children: "z" })
|
|
133
137
|
] }) });
|
|
134
138
|
}
|
|
135
|
-
const
|
|
136
|
-
buttonWrapper:
|
|
137
|
-
button:
|
|
138
|
-
activeIndicator:
|
|
139
|
-
preview:
|
|
140
|
-
fadeIn:
|
|
141
|
-
previewHeader:
|
|
142
|
-
previewTitle:
|
|
143
|
-
previewClose:
|
|
144
|
-
previewBody:
|
|
145
|
-
previewContent:
|
|
146
|
-
labelTooltip:
|
|
147
|
-
fadeInLabel:
|
|
139
|
+
const Ge = "_buttonWrapper_1hhpx_1", Ke = "_button_1hhpx_1", Je = "_activeIndicator_1hhpx_61", Qe = "_preview_1hhpx_85", Ue = "_fadeIn_1hhpx_1", et = "_previewHeader_1hhpx_125", tt = "_previewTitle_1hhpx_143", nt = "_previewClose_1hhpx_163", it = "_previewBody_1hhpx_203", ot = "_previewContent_1hhpx_231", st = "_labelTooltip_1hhpx_255", rt = "_fadeInLabel_1hhpx_1", S = {
|
|
140
|
+
buttonWrapper: Ge,
|
|
141
|
+
button: Ke,
|
|
142
|
+
activeIndicator: Je,
|
|
143
|
+
preview: Qe,
|
|
144
|
+
fadeIn: Ue,
|
|
145
|
+
previewHeader: et,
|
|
146
|
+
previewTitle: tt,
|
|
147
|
+
previewClose: nt,
|
|
148
|
+
previewBody: it,
|
|
149
|
+
previewContent: ot,
|
|
150
|
+
labelTooltip: st,
|
|
151
|
+
fadeInLabel: rt
|
|
148
152
|
};
|
|
149
|
-
function
|
|
150
|
-
const t =
|
|
151
|
-
return
|
|
152
|
-
const
|
|
153
|
-
if (!
|
|
153
|
+
function lt({ windowId: e }) {
|
|
154
|
+
const t = M(null);
|
|
155
|
+
return H(() => {
|
|
156
|
+
const i = t.current;
|
|
157
|
+
if (!i)
|
|
154
158
|
return;
|
|
155
|
-
const n =
|
|
159
|
+
const n = ct(e);
|
|
156
160
|
if (!n) {
|
|
157
|
-
|
|
161
|
+
i.replaceChildren();
|
|
158
162
|
return;
|
|
159
163
|
}
|
|
160
|
-
const s =
|
|
161
|
-
|
|
162
|
-
}, [e]), /* @__PURE__ */
|
|
164
|
+
const s = at(n);
|
|
165
|
+
i.replaceChildren(s);
|
|
166
|
+
}, [e]), /* @__PURE__ */ o("div", { ref: t, className: "window-preview-container" });
|
|
163
167
|
}
|
|
164
|
-
function
|
|
168
|
+
function ct(e) {
|
|
165
169
|
const t = document.getElementById(`window-${e}`);
|
|
166
170
|
return t instanceof HTMLElement ? t : null;
|
|
167
171
|
}
|
|
168
|
-
function
|
|
172
|
+
function at(e) {
|
|
169
173
|
const t = e.cloneNode(!0);
|
|
170
|
-
return
|
|
174
|
+
return dt(t), t;
|
|
171
175
|
}
|
|
172
|
-
function
|
|
173
|
-
e.removeAttribute("id"), e.querySelectorAll("[id]").forEach((
|
|
176
|
+
function dt(e) {
|
|
177
|
+
e.removeAttribute("id"), e.querySelectorAll("[id]").forEach((i) => i.removeAttribute("id")), ut(e);
|
|
174
178
|
const t = e.querySelector(".window-scrollbar");
|
|
175
179
|
t && t.style.setProperty("display", "flex", "important");
|
|
176
180
|
}
|
|
177
|
-
function
|
|
181
|
+
function ut(e) {
|
|
178
182
|
const t = {
|
|
179
183
|
display: "flex",
|
|
180
184
|
position: "static",
|
|
@@ -187,95 +191,98 @@ function rt(e) {
|
|
|
187
191
|
zIndex: "auto",
|
|
188
192
|
boxShadow: "none"
|
|
189
193
|
};
|
|
190
|
-
for (const [
|
|
191
|
-
e.style.setProperty(
|
|
194
|
+
for (const [i, n] of Object.entries(t))
|
|
195
|
+
e.style.setProperty(i, n, "important");
|
|
192
196
|
}
|
|
193
|
-
const
|
|
194
|
-
controls:
|
|
195
|
-
button:
|
|
196
|
-
close:
|
|
197
|
-
|
|
198
|
-
|
|
199
|
-
|
|
197
|
+
const mt = "_controls_1rfhk_1", ht = "_button_1rfhk_13", ft = "_close_1rfhk_59", _t = "_minimize_1rfhk_79", pt = "_maximize_1rfhk_87", A = {
|
|
198
|
+
controls: mt,
|
|
199
|
+
button: ht,
|
|
200
|
+
close: ft,
|
|
201
|
+
minimize: _t,
|
|
202
|
+
maximize: pt
|
|
203
|
+
}, bt = () => /* @__PURE__ */ p("svg", { width: "14", height: "14", viewBox: "0 0 24 24", fill: "none", stroke: "currentColor", strokeWidth: "2", strokeLinecap: "round", strokeLinejoin: "round", children: [
|
|
204
|
+
/* @__PURE__ */ o("line", { x1: "18", y1: "6", x2: "6", y2: "18" }),
|
|
205
|
+
/* @__PURE__ */ o("line", { x1: "6", y1: "6", x2: "18", y2: "18" })
|
|
200
206
|
] });
|
|
201
|
-
function
|
|
202
|
-
return /* @__PURE__ */
|
|
207
|
+
function ue({ onClose: e, disabled: t }) {
|
|
208
|
+
return /* @__PURE__ */ o(
|
|
203
209
|
"button",
|
|
204
210
|
{
|
|
205
|
-
className: `terminal-btn
|
|
211
|
+
className: `terminal-btn ${A.button} ${A.close}`,
|
|
206
212
|
onClick: e,
|
|
207
213
|
disabled: t,
|
|
208
214
|
title: "Close",
|
|
209
|
-
|
|
215
|
+
"data-action": "close",
|
|
216
|
+
children: /* @__PURE__ */ o(bt, {})
|
|
210
217
|
}
|
|
211
218
|
);
|
|
212
219
|
}
|
|
213
|
-
function
|
|
214
|
-
const [l, u] =
|
|
215
|
-
|
|
220
|
+
function gt({ icon: e, onClick: t, label: i, isActive: n, onClose: s, component: c, windowId: a, showTooltip: r = !0 }) {
|
|
221
|
+
const [l, u] = z(!1), d = M(null), h = M(null), m = () => {
|
|
222
|
+
h.current && (clearTimeout(h.current), h.current = null), u(!0);
|
|
216
223
|
}, x = () => {
|
|
217
|
-
|
|
224
|
+
h.current = setTimeout(() => {
|
|
218
225
|
u(!1);
|
|
219
226
|
}, 100);
|
|
220
227
|
};
|
|
221
|
-
return /* @__PURE__ */
|
|
228
|
+
return /* @__PURE__ */ p(
|
|
222
229
|
"div",
|
|
223
230
|
{
|
|
224
231
|
ref: d,
|
|
225
|
-
className:
|
|
226
|
-
onMouseEnter:
|
|
232
|
+
className: S.buttonWrapper,
|
|
233
|
+
onMouseEnter: m,
|
|
227
234
|
onMouseLeave: x,
|
|
228
235
|
children: [
|
|
229
|
-
l && typeof document < "u" &&
|
|
230
|
-
n && s ? /* @__PURE__ */
|
|
236
|
+
l && typeof document < "u" && oe(
|
|
237
|
+
n && s ? /* @__PURE__ */ p(
|
|
231
238
|
"div",
|
|
232
239
|
{
|
|
233
|
-
className:
|
|
240
|
+
className: S.preview,
|
|
234
241
|
style: {
|
|
235
242
|
left: d.current ? d.current.getBoundingClientRect().left + d.current.getBoundingClientRect().width / 2 : 0,
|
|
236
243
|
top: d.current ? d.current.getBoundingClientRect().top : 0
|
|
237
244
|
},
|
|
238
|
-
onMouseEnter:
|
|
245
|
+
onMouseEnter: m,
|
|
239
246
|
onMouseLeave: x,
|
|
240
247
|
children: [
|
|
241
|
-
/* @__PURE__ */
|
|
242
|
-
/* @__PURE__ */
|
|
243
|
-
/* @__PURE__ */
|
|
244
|
-
|
|
248
|
+
/* @__PURE__ */ p("div", { className: S.previewHeader, children: [
|
|
249
|
+
/* @__PURE__ */ o("span", { className: S.previewTitle, children: i }),
|
|
250
|
+
/* @__PURE__ */ o(
|
|
251
|
+
ue,
|
|
245
252
|
{
|
|
246
|
-
onClose: (
|
|
247
|
-
|
|
253
|
+
onClose: (_) => {
|
|
254
|
+
_ == null || _.preventDefault(), _ == null || _.stopPropagation(), s();
|
|
248
255
|
}
|
|
249
256
|
}
|
|
250
257
|
)
|
|
251
258
|
] }),
|
|
252
|
-
/* @__PURE__ */
|
|
253
|
-
|
|
254
|
-
}, children: /* @__PURE__ */
|
|
259
|
+
/* @__PURE__ */ o("div", { className: S.previewBody, onClick: (_) => {
|
|
260
|
+
_.stopPropagation(), t();
|
|
261
|
+
}, children: /* @__PURE__ */ o("div", { className: S.previewContent, children: a ? /* @__PURE__ */ o(lt, { windowId: a }) : c }) })
|
|
255
262
|
]
|
|
256
263
|
}
|
|
257
|
-
) : r ? /* @__PURE__ */
|
|
264
|
+
) : r ? /* @__PURE__ */ o(
|
|
258
265
|
"div",
|
|
259
266
|
{
|
|
260
|
-
className:
|
|
267
|
+
className: S.labelTooltip,
|
|
261
268
|
style: {
|
|
262
269
|
left: d.current ? d.current.getBoundingClientRect().left + d.current.getBoundingClientRect().width / 2 : 0,
|
|
263
270
|
top: d.current ? d.current.getBoundingClientRect().top : 0
|
|
264
271
|
},
|
|
265
|
-
children:
|
|
272
|
+
children: i
|
|
266
273
|
}
|
|
267
274
|
) : null,
|
|
268
275
|
document.body
|
|
269
276
|
),
|
|
270
|
-
/* @__PURE__ */
|
|
277
|
+
/* @__PURE__ */ p(
|
|
271
278
|
"button",
|
|
272
279
|
{
|
|
273
280
|
onClick: t,
|
|
274
|
-
"aria-label":
|
|
275
|
-
className:
|
|
281
|
+
"aria-label": i,
|
|
282
|
+
className: S.button,
|
|
276
283
|
children: [
|
|
277
284
|
e,
|
|
278
|
-
n && /* @__PURE__ */
|
|
285
|
+
n && /* @__PURE__ */ o("div", { className: S.activeIndicator })
|
|
279
286
|
]
|
|
280
287
|
}
|
|
281
288
|
)
|
|
@@ -283,10 +290,10 @@ function ut({ icon: e, onClick: t, label: o, isActive: n, onClose: s, component:
|
|
|
283
290
|
}
|
|
284
291
|
);
|
|
285
292
|
}
|
|
286
|
-
const
|
|
287
|
-
const n = t.some((c) => c.id === e.id), s = f(() =>
|
|
288
|
-
return /* @__PURE__ */
|
|
289
|
-
|
|
293
|
+
const vt = J.memo(gt), Z = vt, me = V(({ window: e, currentWindows: t, openWindow: i }) => {
|
|
294
|
+
const n = t.some((c) => c.id === e.id), s = f(() => i(e), [i, e]);
|
|
295
|
+
return /* @__PURE__ */ o(
|
|
296
|
+
Z,
|
|
290
297
|
{
|
|
291
298
|
icon: e.icon,
|
|
292
299
|
label: e.title,
|
|
@@ -294,12 +301,12 @@ const mt = C.memo(ut), G = mt, ue = Y(({ window: e, currentWindows: t, openWindo
|
|
|
294
301
|
isActive: n
|
|
295
302
|
}
|
|
296
303
|
);
|
|
297
|
-
}),
|
|
298
|
-
const [n, s] =
|
|
299
|
-
|
|
304
|
+
}), he = () => /* @__PURE__ */ o("svg", { width: "24", height: "24", viewBox: "0 0 24 24", fill: "none", stroke: "currentColor", strokeWidth: "2", strokeLinecap: "round", strokeLinejoin: "round", children: /* @__PURE__ */ o("path", { d: "M4 20h16a2 2 0 0 0 2-2V8a2 2 0 0 0-2-2h-7.93a2 2 0 0 1-1.66-.9l-.82-1.2A2 2 0 0 0 7.93 2H4a2 2 0 0 0-2 2v16a2 2 0 0 0 2 2Z" }) }), xt = V(({ folder: e, currentWindows: t, openWindow: i }) => {
|
|
305
|
+
const [n, s] = z(!1), [c, a] = z(!1), [r, l] = z(!1), [u, d] = z(null), h = M(null), m = M(null);
|
|
306
|
+
H(() => {
|
|
300
307
|
if (n) {
|
|
301
|
-
if (
|
|
302
|
-
const b =
|
|
308
|
+
if (h.current) {
|
|
309
|
+
const b = h.current.getBoundingClientRect();
|
|
303
310
|
d({
|
|
304
311
|
left: b.left + b.width / 2,
|
|
305
312
|
bottom: window.innerHeight - b.top + 10
|
|
@@ -315,51 +322,51 @@ const mt = C.memo(ut), G = mt, ue = Y(({ window: e, currentWindows: t, openWindo
|
|
|
315
322
|
}
|
|
316
323
|
}, [n]);
|
|
317
324
|
const x = f(() => {
|
|
318
|
-
|
|
319
|
-
}, []),
|
|
320
|
-
|
|
325
|
+
m.current && (clearTimeout(m.current), m.current = null), s(!0);
|
|
326
|
+
}, []), _ = f(() => {
|
|
327
|
+
m.current = setTimeout(() => {
|
|
321
328
|
s(!1);
|
|
322
329
|
}, 200);
|
|
323
330
|
}, []);
|
|
324
|
-
return /* @__PURE__ */
|
|
331
|
+
return /* @__PURE__ */ p(
|
|
325
332
|
"div",
|
|
326
333
|
{
|
|
327
|
-
ref:
|
|
328
|
-
className:
|
|
334
|
+
ref: h,
|
|
335
|
+
className: v.folderWrapper,
|
|
329
336
|
onMouseEnter: x,
|
|
330
|
-
onMouseLeave:
|
|
337
|
+
onMouseLeave: _,
|
|
331
338
|
children: [
|
|
332
|
-
c && u && typeof document < "u" &&
|
|
333
|
-
/* @__PURE__ */
|
|
339
|
+
c && u && typeof document < "u" && oe(
|
|
340
|
+
/* @__PURE__ */ p(
|
|
334
341
|
"div",
|
|
335
342
|
{
|
|
336
|
-
className: `${
|
|
343
|
+
className: `${v.folderMenuPortal} ${r ? v.folderMenuPortalVisible : ""}`,
|
|
337
344
|
style: {
|
|
338
345
|
left: u.left,
|
|
339
346
|
bottom: u.bottom
|
|
340
347
|
},
|
|
341
348
|
onMouseEnter: x,
|
|
342
|
-
onMouseLeave:
|
|
349
|
+
onMouseLeave: _,
|
|
343
350
|
children: [
|
|
344
|
-
e.apps.map((b) => /* @__PURE__ */
|
|
345
|
-
|
|
351
|
+
e.apps.map((b) => /* @__PURE__ */ o(
|
|
352
|
+
me,
|
|
346
353
|
{
|
|
347
354
|
window: b,
|
|
348
355
|
currentWindows: t,
|
|
349
|
-
openWindow:
|
|
356
|
+
openWindow: i
|
|
350
357
|
},
|
|
351
358
|
b.id
|
|
352
359
|
)),
|
|
353
|
-
/* @__PURE__ */
|
|
360
|
+
/* @__PURE__ */ o("div", { className: v.folderLabel, children: e.title })
|
|
354
361
|
]
|
|
355
362
|
}
|
|
356
363
|
),
|
|
357
364
|
document.body
|
|
358
365
|
),
|
|
359
|
-
/* @__PURE__ */
|
|
360
|
-
|
|
366
|
+
/* @__PURE__ */ o(
|
|
367
|
+
Z,
|
|
361
368
|
{
|
|
362
|
-
icon: e.icon || /* @__PURE__ */
|
|
369
|
+
icon: e.icon || /* @__PURE__ */ o(he, {}),
|
|
363
370
|
label: e.title,
|
|
364
371
|
onClick: () => s((b) => !b),
|
|
365
372
|
isActive: !1,
|
|
@@ -369,10 +376,10 @@ const mt = C.memo(ut), G = mt, ue = Y(({ window: e, currentWindows: t, openWindo
|
|
|
369
376
|
]
|
|
370
377
|
}
|
|
371
378
|
);
|
|
372
|
-
}),
|
|
373
|
-
const s = t.some((r) => r.id === e.id), c = f(() =>
|
|
374
|
-
return /* @__PURE__ */
|
|
375
|
-
|
|
379
|
+
}), yt = V(({ window: e, currentWindows: t, openWindow: i, closeWindow: n }) => {
|
|
380
|
+
const s = t.some((r) => r.id === e.id), c = f(() => i({ ...e, zIndex: 0, layer: e.layer || "normal" }), [i, e]), a = f(() => n(e.id), [n, e.id]);
|
|
381
|
+
return /* @__PURE__ */ o(
|
|
382
|
+
Z,
|
|
376
383
|
{
|
|
377
384
|
icon: e.icon,
|
|
378
385
|
label: e.title,
|
|
@@ -384,17 +391,17 @@ const mt = C.memo(ut), G = mt, ue = Y(({ window: e, currentWindows: t, openWindo
|
|
|
384
391
|
}
|
|
385
392
|
);
|
|
386
393
|
});
|
|
387
|
-
function
|
|
394
|
+
function zt(e) {
|
|
388
395
|
return "apps" in e;
|
|
389
396
|
}
|
|
390
|
-
function
|
|
391
|
-
const
|
|
392
|
-
return
|
|
393
|
-
windowsOptions:
|
|
394
|
-
isFolder:
|
|
397
|
+
function fe(e, t) {
|
|
398
|
+
const i = E(() => Array.isArray(e) ? e : [], [e]);
|
|
399
|
+
return E(() => i, [i]), {
|
|
400
|
+
windowsOptions: i,
|
|
401
|
+
isFolder: zt
|
|
395
402
|
};
|
|
396
403
|
}
|
|
397
|
-
const
|
|
404
|
+
const K = {
|
|
398
405
|
idle: `/\\_/\\
|
|
399
406
|
( -.- )
|
|
400
407
|
> ^ <`,
|
|
@@ -405,38 +412,38 @@ const U = {
|
|
|
405
412
|
( ^.^ )
|
|
406
413
|
> ^ <`
|
|
407
414
|
};
|
|
408
|
-
function
|
|
415
|
+
function Mt({
|
|
409
416
|
openWindow: e,
|
|
410
417
|
closeWindow: t,
|
|
411
|
-
toolbarItems:
|
|
418
|
+
toolbarItems: i = [],
|
|
412
419
|
currentWindows: n,
|
|
413
420
|
isOpen: s,
|
|
414
421
|
toggleOpen: c,
|
|
415
422
|
setIsOpen: a,
|
|
416
423
|
showLogo: r = !0
|
|
417
424
|
}) {
|
|
418
|
-
const l =
|
|
425
|
+
const l = J.useRef(null), { windowsOptions: u, isFolder: d } = fe(i), h = s ? K.open : n.length > 0 ? K.active : K.idle, m = () => {
|
|
419
426
|
l.current && (clearTimeout(l.current), l.current = null);
|
|
420
427
|
}, x = () => {
|
|
421
|
-
|
|
422
|
-
},
|
|
423
|
-
|
|
428
|
+
m(), a(!0);
|
|
429
|
+
}, _ = () => {
|
|
430
|
+
m();
|
|
424
431
|
}, b = () => {
|
|
425
432
|
l.current = setTimeout(() => {
|
|
426
433
|
a(!1);
|
|
427
434
|
}, 100);
|
|
428
435
|
};
|
|
429
|
-
return
|
|
436
|
+
return J.useEffect(() => () => {
|
|
430
437
|
l.current && clearTimeout(l.current);
|
|
431
|
-
}, []), /* @__PURE__ */
|
|
438
|
+
}, []), /* @__PURE__ */ p(
|
|
432
439
|
"div",
|
|
433
440
|
{
|
|
434
|
-
className:
|
|
441
|
+
className: v.container,
|
|
435
442
|
role: "toolbar",
|
|
436
443
|
"aria-label": "Desktop Toolbar",
|
|
437
444
|
children: [
|
|
438
|
-
/* @__PURE__ */
|
|
439
|
-
|
|
445
|
+
/* @__PURE__ */ o("div", { className: `${v.menuLeft} ${n.length > 0 ? v.menuOpen : v.menuClosed}`, children: /* @__PURE__ */ o("div", { className: v.menuContentLeft, children: n.map((y) => /* @__PURE__ */ o(
|
|
446
|
+
yt,
|
|
440
447
|
{
|
|
441
448
|
window: y,
|
|
442
449
|
currentWindows: n,
|
|
@@ -445,46 +452,46 @@ function pt({
|
|
|
445
452
|
},
|
|
446
453
|
y.id
|
|
447
454
|
)) }) }),
|
|
448
|
-
/* @__PURE__ */
|
|
455
|
+
/* @__PURE__ */ o(
|
|
449
456
|
"div",
|
|
450
457
|
{
|
|
451
|
-
className:
|
|
458
|
+
className: v.dockWrapper,
|
|
452
459
|
onMouseEnter: x,
|
|
453
460
|
onMouseLeave: b,
|
|
454
|
-
children: /* @__PURE__ */
|
|
461
|
+
children: /* @__PURE__ */ o("div", { className: v.dock, children: /* @__PURE__ */ p(
|
|
455
462
|
"button",
|
|
456
463
|
{
|
|
457
|
-
className:
|
|
464
|
+
className: v.launcher,
|
|
458
465
|
onClick: c,
|
|
459
466
|
"aria-label": s ? "Close Menu" : "Open Menu",
|
|
460
467
|
"aria-expanded": s,
|
|
461
468
|
children: [
|
|
462
|
-
r && /* @__PURE__ */
|
|
463
|
-
/* @__PURE__ */
|
|
464
|
-
/* @__PURE__ */
|
|
469
|
+
r && /* @__PURE__ */ p(G, { children: [
|
|
470
|
+
/* @__PURE__ */ o(de, { show: !s && n.length === 0 }),
|
|
471
|
+
/* @__PURE__ */ o("span", { className: `${v.catIcon}`, children: h })
|
|
465
472
|
] }),
|
|
466
|
-
!r && /* @__PURE__ */
|
|
473
|
+
!r && /* @__PURE__ */ o("span", { className: v.catIcon, style: { fontSize: "1.5rem" }, children: "🪟" })
|
|
467
474
|
]
|
|
468
475
|
}
|
|
469
476
|
) })
|
|
470
477
|
}
|
|
471
478
|
),
|
|
472
|
-
/* @__PURE__ */
|
|
479
|
+
/* @__PURE__ */ o(
|
|
473
480
|
"div",
|
|
474
481
|
{
|
|
475
|
-
className: `${
|
|
476
|
-
onMouseEnter:
|
|
482
|
+
className: `${v.menuRight} ${s ? v.menuOpen : v.menuClosed}`,
|
|
483
|
+
onMouseEnter: _,
|
|
477
484
|
onMouseLeave: b,
|
|
478
|
-
children: /* @__PURE__ */
|
|
479
|
-
|
|
485
|
+
children: /* @__PURE__ */ o("div", { className: v.menuContentRight, children: u.map((y, L) => d(y) ? /* @__PURE__ */ o(
|
|
486
|
+
xt,
|
|
480
487
|
{
|
|
481
488
|
folder: y,
|
|
482
489
|
currentWindows: n,
|
|
483
490
|
openWindow: e
|
|
484
491
|
},
|
|
485
|
-
y.id ??
|
|
486
|
-
) : n.some((
|
|
487
|
-
|
|
492
|
+
y.id ?? L
|
|
493
|
+
) : n.some((O) => O.id === y.id) ? null : /* @__PURE__ */ o(
|
|
494
|
+
me,
|
|
488
495
|
{
|
|
489
496
|
window: y,
|
|
490
497
|
currentWindows: n,
|
|
@@ -498,24 +505,24 @@ function pt({
|
|
|
498
505
|
}
|
|
499
506
|
);
|
|
500
507
|
}
|
|
501
|
-
const
|
|
502
|
-
desktopOnly:
|
|
503
|
-
mobileOnly:
|
|
504
|
-
icon:
|
|
505
|
-
},
|
|
506
|
-
pawButton:
|
|
507
|
-
mobileItems:
|
|
508
|
-
mobileItemsVisible:
|
|
509
|
-
mobileIcon:
|
|
510
|
-
folderContainer:
|
|
511
|
-
folderHeader:
|
|
512
|
-
folderContent:
|
|
513
|
-
},
|
|
508
|
+
const Ct = "_desktopOnly_ec5se_1", wt = "_mobileOnly_ec5se_9", $t = "_icon_ec5se_17", ee = {
|
|
509
|
+
desktopOnly: Ct,
|
|
510
|
+
mobileOnly: wt,
|
|
511
|
+
icon: $t
|
|
512
|
+
}, Nt = "_pawButton_n7khn_1", Lt = "_mobileItems_n7khn_57", kt = "_mobileItemsVisible_n7khn_103", Tt = "_mobileIcon_n7khn_115", Wt = "_folderContainer_n7khn_191", Rt = "_folderHeader_n7khn_203", St = "_folderContent_n7khn_213", B = {
|
|
513
|
+
pawButton: Nt,
|
|
514
|
+
mobileItems: Lt,
|
|
515
|
+
mobileItemsVisible: kt,
|
|
516
|
+
mobileIcon: Tt,
|
|
517
|
+
folderContainer: Wt,
|
|
518
|
+
folderHeader: Rt,
|
|
519
|
+
folderContent: St
|
|
520
|
+
}, _e = V(({ window: e, currentWindows: t, openWindow: i, closeMenu: n }) => {
|
|
514
521
|
const s = t.some((a) => a.id === e.id), c = f(() => {
|
|
515
|
-
|
|
516
|
-
}, [
|
|
517
|
-
return /* @__PURE__ */
|
|
518
|
-
|
|
522
|
+
i(e), n();
|
|
523
|
+
}, [i, e, n]);
|
|
524
|
+
return /* @__PURE__ */ o(
|
|
525
|
+
Z,
|
|
519
526
|
{
|
|
520
527
|
icon: e.icon,
|
|
521
528
|
label: e.title,
|
|
@@ -524,101 +531,101 @@ const bt = "_desktopOnly_ec5se_1", vt = "_mobileOnly_ec5se_9", gt = "_icon_ec5se
|
|
|
524
531
|
showTooltip: !1
|
|
525
532
|
}
|
|
526
533
|
);
|
|
527
|
-
}),
|
|
528
|
-
const [s, c] =
|
|
529
|
-
return /* @__PURE__ */
|
|
530
|
-
/* @__PURE__ */
|
|
531
|
-
|
|
534
|
+
}), It = V(({ folder: e, currentWindows: t, openWindow: i, closeMenu: n }) => {
|
|
535
|
+
const [s, c] = z(!1);
|
|
536
|
+
return /* @__PURE__ */ p("div", { className: B.folderContainer, children: [
|
|
537
|
+
/* @__PURE__ */ o("div", { className: B.folderHeader, children: /* @__PURE__ */ o(
|
|
538
|
+
Z,
|
|
532
539
|
{
|
|
533
|
-
icon: e.icon || /* @__PURE__ */
|
|
540
|
+
icon: e.icon || /* @__PURE__ */ o(he, {}),
|
|
534
541
|
label: e.title,
|
|
535
542
|
onClick: () => c((a) => !a),
|
|
536
543
|
isActive: s,
|
|
537
544
|
showTooltip: !1
|
|
538
545
|
}
|
|
539
546
|
) }),
|
|
540
|
-
s && /* @__PURE__ */
|
|
541
|
-
|
|
547
|
+
s && /* @__PURE__ */ o("div", { className: B.folderContent, children: e.apps.map((a) => /* @__PURE__ */ o(
|
|
548
|
+
_e,
|
|
542
549
|
{
|
|
543
550
|
window: a,
|
|
544
551
|
currentWindows: t,
|
|
545
|
-
openWindow:
|
|
552
|
+
openWindow: i,
|
|
546
553
|
closeMenu: n
|
|
547
554
|
},
|
|
548
555
|
a.id
|
|
549
556
|
)) })
|
|
550
557
|
] });
|
|
551
|
-
}),
|
|
558
|
+
}), te = {
|
|
552
559
|
IDLE: `/\\_/\\
|
|
553
560
|
( -.- )`,
|
|
554
561
|
OPEN: `/\\_/\\
|
|
555
562
|
( ^.^ )`
|
|
556
563
|
};
|
|
557
|
-
function
|
|
564
|
+
function Bt({
|
|
558
565
|
openWindow: e,
|
|
559
566
|
toolbarItems: t,
|
|
560
|
-
currentWindows:
|
|
567
|
+
currentWindows: i,
|
|
561
568
|
isOpen: n,
|
|
562
569
|
toggleOpen: s,
|
|
563
570
|
setIsOpen: c
|
|
564
571
|
}) {
|
|
565
|
-
const { windowsOptions: a, isFolder: r } =
|
|
566
|
-
return /* @__PURE__ */
|
|
567
|
-
/* @__PURE__ */
|
|
568
|
-
|
|
572
|
+
const { windowsOptions: a, isFolder: r } = fe(t), l = n ? te.OPEN : te.IDLE, u = () => c(!1);
|
|
573
|
+
return /* @__PURE__ */ p("div", { className: ee.mobileOnly, children: [
|
|
574
|
+
/* @__PURE__ */ o("div", { className: `${B.mobileItems} ${n ? B.mobileItemsVisible : ""}`, children: a.length === 0 ? /* @__PURE__ */ o("span", { children: "No apps available" }) : a.map((d, h) => r(d) ? /* @__PURE__ */ o(
|
|
575
|
+
It,
|
|
569
576
|
{
|
|
570
577
|
folder: d,
|
|
571
|
-
currentWindows:
|
|
578
|
+
currentWindows: i,
|
|
572
579
|
openWindow: e,
|
|
573
580
|
closeMenu: u
|
|
574
581
|
},
|
|
575
|
-
d.id ||
|
|
576
|
-
) : /* @__PURE__ */
|
|
577
|
-
|
|
582
|
+
d.id || h
|
|
583
|
+
) : /* @__PURE__ */ o(
|
|
584
|
+
_e,
|
|
578
585
|
{
|
|
579
586
|
window: d,
|
|
580
|
-
currentWindows:
|
|
587
|
+
currentWindows: i,
|
|
581
588
|
openWindow: e,
|
|
582
589
|
closeMenu: u
|
|
583
590
|
},
|
|
584
591
|
d.id
|
|
585
592
|
)) }),
|
|
586
|
-
/* @__PURE__ */
|
|
593
|
+
/* @__PURE__ */ p(
|
|
587
594
|
"button",
|
|
588
595
|
{
|
|
589
|
-
className: `${
|
|
596
|
+
className: `${B.pawButton} ${n ? B.pawButtonActive : ""}`,
|
|
590
597
|
onClick: s,
|
|
591
598
|
children: [
|
|
592
|
-
/* @__PURE__ */
|
|
593
|
-
/* @__PURE__ */
|
|
599
|
+
/* @__PURE__ */ o(de, { show: !n }),
|
|
600
|
+
/* @__PURE__ */ o("span", { className: `${ee.icon} ${B.mobileIcon}`, children: l })
|
|
594
601
|
]
|
|
595
602
|
}
|
|
596
603
|
)
|
|
597
604
|
] });
|
|
598
605
|
}
|
|
599
|
-
function
|
|
600
|
-
const [t,
|
|
601
|
-
return
|
|
602
|
-
const n = window.matchMedia(`(max-width: ${e}px)`), s = () =>
|
|
606
|
+
function pe(e = 768) {
|
|
607
|
+
const [t, i] = z(!1);
|
|
608
|
+
return H(() => {
|
|
609
|
+
const n = window.matchMedia(`(max-width: ${e}px)`), s = () => i(n.matches);
|
|
603
610
|
return s(), n.addEventListener("change", s), () => n.removeEventListener("change", s);
|
|
604
611
|
}, [e]), t;
|
|
605
612
|
}
|
|
606
|
-
function
|
|
607
|
-
const { openWindow:
|
|
608
|
-
return /* @__PURE__ */
|
|
609
|
-
|
|
613
|
+
function Sn({ toolbarItems: e, ...t }) {
|
|
614
|
+
const { openWindow: i, closeWindow: n } = le(), s = ae(), { isOpen: c, toggleOpen: a, setIsOpen: r } = ke(), l = pe();
|
|
615
|
+
return /* @__PURE__ */ o(G, { children: l ? /* @__PURE__ */ o(
|
|
616
|
+
Bt,
|
|
610
617
|
{
|
|
611
|
-
openWindow:
|
|
618
|
+
openWindow: i,
|
|
612
619
|
toolbarItems: e,
|
|
613
620
|
currentWindows: s,
|
|
614
621
|
isOpen: c,
|
|
615
622
|
toggleOpen: a,
|
|
616
623
|
setIsOpen: r
|
|
617
624
|
}
|
|
618
|
-
) : /* @__PURE__ */
|
|
619
|
-
|
|
625
|
+
) : /* @__PURE__ */ o(
|
|
626
|
+
Mt,
|
|
620
627
|
{
|
|
621
|
-
openWindow:
|
|
628
|
+
openWindow: i,
|
|
622
629
|
closeWindow: n,
|
|
623
630
|
toolbarItems: e,
|
|
624
631
|
currentWindows: s,
|
|
@@ -629,268 +636,332 @@ function Cn({ toolbarItems: e, ...t }) {
|
|
|
629
636
|
}
|
|
630
637
|
) });
|
|
631
638
|
}
|
|
632
|
-
const
|
|
633
|
-
const e =
|
|
639
|
+
const be = ne(null), Et = () => {
|
|
640
|
+
const e = ie(be);
|
|
634
641
|
if (!e)
|
|
635
642
|
throw new Error("useWindowUI must be used within Window (WindowContext.Provider)");
|
|
636
643
|
return e;
|
|
637
|
-
},
|
|
638
|
-
function
|
|
639
|
-
const c =
|
|
644
|
+
}, Ot = 300, Ht = 42, At = { width: 500, height: 300 }, Dt = { x: 100, y: 100 }, F = 20;
|
|
645
|
+
function Pt(e, t, i, n, s) {
|
|
646
|
+
const c = M(!1), a = M({ x: 0, y: 0 }), r = f((d) => {
|
|
640
647
|
if (!c.current)
|
|
641
648
|
return;
|
|
642
649
|
s == null || s(d.clientX, d.clientY);
|
|
643
|
-
const
|
|
650
|
+
const h = Math.min(
|
|
644
651
|
Math.max(0, d.clientX - a.current.x),
|
|
645
652
|
window.innerWidth - e.width
|
|
646
|
-
),
|
|
653
|
+
), m = Math.min(
|
|
647
654
|
Math.max(0, d.clientY - a.current.y),
|
|
648
655
|
window.innerHeight - e.height
|
|
649
656
|
);
|
|
650
|
-
|
|
657
|
+
i.current && (i.current.style.left = `${h}px`, i.current.style.top = `${m}px`), n({ x: h, y: m });
|
|
651
658
|
}, [e, n, s]), l = f((d) => {
|
|
652
|
-
var
|
|
653
|
-
(
|
|
659
|
+
var h;
|
|
660
|
+
(h = window.getSelection()) == null || h.removeAllRanges(), document.body.style.userSelect = "none", a.current = {
|
|
654
661
|
x: d.clientX - t.x,
|
|
655
662
|
y: d.clientY - t.y
|
|
656
663
|
}, c.current = !0;
|
|
657
664
|
}, [t.x, t.y]), u = f(() => {
|
|
658
665
|
c.current = !1, document.body.style.userSelect = "auto";
|
|
659
666
|
}, []);
|
|
660
|
-
return
|
|
667
|
+
return E(() => ({
|
|
661
668
|
dragTo: r,
|
|
662
669
|
startDrag: l,
|
|
663
670
|
stopDrag: u,
|
|
664
671
|
isDragging: c
|
|
665
672
|
}), [r, l, u]);
|
|
666
673
|
}
|
|
667
|
-
function
|
|
668
|
-
const n =
|
|
674
|
+
function Ft(e, t, i) {
|
|
675
|
+
const n = M(!1), s = M({ x: 0, y: 0, w: 0, h: 0 }), c = f((l) => {
|
|
669
676
|
if (!n.current)
|
|
670
677
|
return;
|
|
671
|
-
const u = Math.min(window.innerWidth, Math.max(
|
|
672
|
-
t.current && (t.current.style.width = `${u}px`, t.current.style.height = `${d}px`),
|
|
673
|
-
}, [
|
|
678
|
+
const u = Math.min(window.innerWidth, Math.max(Ot, s.current.w + l.clientX - s.current.x)), d = Math.min(window.innerHeight, Math.max(Ht, s.current.h + l.clientY - s.current.y));
|
|
679
|
+
t.current && (t.current.style.width = `${u}px`, t.current.style.height = `${d}px`), i({ width: u, height: d });
|
|
680
|
+
}, [i]), a = f((l) => {
|
|
674
681
|
var u;
|
|
675
682
|
(u = window.getSelection()) == null || u.removeAllRanges(), document.body.style.userSelect = "none", s.current = { x: l.clientX, y: l.clientY, w: e.width, h: e.height }, n.current = !0;
|
|
676
683
|
}, [e.width, e.height]), r = f(() => {
|
|
677
684
|
n.current = !1, document.body.style.userSelect = "auto";
|
|
678
685
|
}, []);
|
|
679
|
-
return
|
|
686
|
+
return E(() => ({
|
|
680
687
|
resizeTo: c,
|
|
681
688
|
startResize: a,
|
|
682
689
|
stopResize: r,
|
|
683
690
|
isResizing: n
|
|
684
691
|
}), [c, a, r]);
|
|
685
692
|
}
|
|
686
|
-
function
|
|
687
|
-
const t =
|
|
693
|
+
function Vt(e) {
|
|
694
|
+
const t = M(null), i = f((s, c) => {
|
|
688
695
|
const a = window.innerWidth, r = window.innerHeight;
|
|
689
696
|
let l = null;
|
|
690
697
|
s < F ? c < F ? l = "top-left" : c > r - F ? l = "bottom-left" : l = "left" : s > a - F && (c < F ? l = "top-right" : c > r - F ? l = "bottom-right" : l = "right"), l !== t.current && (t.current = l, e == null || e(l ? { side: l } : null));
|
|
691
698
|
}, [e]), n = f(() => {
|
|
692
699
|
t.current = null, e == null || e(null);
|
|
693
700
|
}, [e]);
|
|
694
|
-
return
|
|
701
|
+
return E(() => ({ currentSide: t, detectSnap: i, resetSnap: n }), [i, n]);
|
|
695
702
|
}
|
|
696
|
-
function
|
|
697
|
-
initialSize: e =
|
|
698
|
-
initialPosition: t =
|
|
699
|
-
isSnapped:
|
|
703
|
+
function jt({
|
|
704
|
+
initialSize: e = At,
|
|
705
|
+
initialPosition: t = Dt,
|
|
706
|
+
isSnapped: i,
|
|
700
707
|
onSnap: n,
|
|
701
708
|
onUnsnap: s,
|
|
702
709
|
setSnapPreview: c,
|
|
703
710
|
onPositionChange: a,
|
|
704
711
|
onSizeChange: r
|
|
705
712
|
}) {
|
|
706
|
-
const [l, u] =
|
|
707
|
-
|
|
708
|
-
}, []),
|
|
709
|
-
y.current =
|
|
713
|
+
const [l, u] = z(e), [d, h] = z(t), [m, x] = z(!1), [_, b] = z(!1), y = M(e), L = M(t), O = M(null), k = f((C) => {
|
|
714
|
+
L.current = C;
|
|
715
|
+
}, []), T = f((C) => {
|
|
716
|
+
y.current = C;
|
|
710
717
|
}, []);
|
|
711
|
-
|
|
712
|
-
u(e),
|
|
713
|
-
}, [e,
|
|
714
|
-
|
|
715
|
-
}, [t,
|
|
716
|
-
const
|
|
717
|
-
x(!0),
|
|
718
|
-
}, [
|
|
719
|
-
b(!0),
|
|
720
|
-
}, [
|
|
721
|
-
return
|
|
722
|
-
if (!
|
|
718
|
+
H(() => {
|
|
719
|
+
u(e), T(e);
|
|
720
|
+
}, [e, T]), H(() => {
|
|
721
|
+
h(t), k(t);
|
|
722
|
+
}, [t, k]);
|
|
723
|
+
const W = Vt(c), $ = Pt(l, d, O, k, W.detectSnap), R = Ft(l, O, T), D = f((C) => {
|
|
724
|
+
x(!0), $.startDrag(C);
|
|
725
|
+
}, [$]), P = f((C) => {
|
|
726
|
+
b(!0), R.startResize(C);
|
|
727
|
+
}, [R]);
|
|
728
|
+
return H(() => {
|
|
729
|
+
if (!m && !_)
|
|
723
730
|
return;
|
|
724
|
-
const
|
|
725
|
-
|
|
726
|
-
},
|
|
727
|
-
if (
|
|
728
|
-
const
|
|
729
|
-
|
|
731
|
+
const C = (w) => {
|
|
732
|
+
$.dragTo(w), R.resizeTo(w);
|
|
733
|
+
}, q = () => {
|
|
734
|
+
if ($.isDragging.current) {
|
|
735
|
+
const w = L.current.x !== d.x || L.current.y !== d.y;
|
|
736
|
+
h(L.current), W.currentSide.current && n ? (n(W.currentSide.current), W.resetSnap()) : w && (i && (s == null || s()), a == null || a(L.current)), $.stopDrag(), x(!1);
|
|
730
737
|
}
|
|
731
|
-
|
|
738
|
+
R.isResizing.current && (u(y.current), r == null || r(y.current), i && (s == null || s()), R.stopResize(), b(!1));
|
|
732
739
|
};
|
|
733
|
-
return window.addEventListener("mousemove",
|
|
734
|
-
window.removeEventListener("mousemove",
|
|
740
|
+
return window.addEventListener("mousemove", C), window.addEventListener("mouseup", q), () => {
|
|
741
|
+
window.removeEventListener("mousemove", C), window.removeEventListener("mouseup", q);
|
|
735
742
|
};
|
|
736
|
-
}, [R,
|
|
743
|
+
}, [$, R, n, s, i, W, a, r, m, _]), E(() => ({
|
|
737
744
|
size: l,
|
|
738
745
|
position: d,
|
|
739
|
-
windowRef:
|
|
740
|
-
drag:
|
|
741
|
-
resize:
|
|
742
|
-
isDragging:
|
|
743
|
-
isResizing:
|
|
744
|
-
}), [l, d,
|
|
746
|
+
windowRef: O,
|
|
747
|
+
drag: D,
|
|
748
|
+
resize: P,
|
|
749
|
+
isDragging: m,
|
|
750
|
+
isResizing: _
|
|
751
|
+
}), [l, d, m, _, D, P]);
|
|
745
752
|
}
|
|
746
|
-
const
|
|
747
|
-
/* @__PURE__ */
|
|
748
|
-
/* @__PURE__ */
|
|
753
|
+
const Zt = () => /* @__PURE__ */ o("svg", { width: "14", height: "14", viewBox: "0 0 24 24", fill: "none", stroke: "currentColor", strokeWidth: "2", strokeLinecap: "round", strokeLinejoin: "round", children: /* @__PURE__ */ o("rect", { x: "3", y: "3", width: "18", height: "18", rx: "2", ry: "2" }) }), qt = () => /* @__PURE__ */ p("svg", { width: "14", height: "14", viewBox: "0 0 24 24", fill: "none", stroke: "currentColor", strokeWidth: "2", strokeLinecap: "round", strokeLinejoin: "round", children: [
|
|
754
|
+
/* @__PURE__ */ o("rect", { x: "5", y: "9", width: "14", height: "14", rx: "2", ry: "2" }),
|
|
755
|
+
/* @__PURE__ */ o("path", { d: "M9 5h10a2 2 0 0 1 2 2v10" })
|
|
749
756
|
] });
|
|
750
|
-
function
|
|
751
|
-
return /* @__PURE__ */
|
|
757
|
+
function Xt({ onClick: e, isMaximized: t, disabled: i }) {
|
|
758
|
+
return /* @__PURE__ */ o(
|
|
752
759
|
"button",
|
|
753
760
|
{
|
|
754
|
-
className: `terminal-btn ${
|
|
761
|
+
className: `terminal-btn ${A.button} ${A.maximize}`,
|
|
755
762
|
onClick: () => {
|
|
756
763
|
e();
|
|
757
764
|
},
|
|
758
|
-
disabled:
|
|
765
|
+
disabled: i,
|
|
759
766
|
title: t ? "Restore" : "Maximize",
|
|
760
|
-
|
|
767
|
+
"data-action": "maximize",
|
|
768
|
+
children: t ? /* @__PURE__ */ o(qt, {}) : /* @__PURE__ */ o(Zt, {})
|
|
761
769
|
}
|
|
762
770
|
);
|
|
763
771
|
}
|
|
764
|
-
const
|
|
765
|
-
function
|
|
766
|
-
return /* @__PURE__ */
|
|
772
|
+
const Yt = () => /* @__PURE__ */ o("svg", { width: "14", height: "14", viewBox: "0 0 24 24", fill: "none", stroke: "currentColor", strokeWidth: "2", strokeLinecap: "round", strokeLinejoin: "round", children: /* @__PURE__ */ o("line", { x1: "5", y1: "12", x2: "19", y2: "12" }) });
|
|
773
|
+
function Gt({ onClick: e, isMinimized: t, disabled: i }) {
|
|
774
|
+
return /* @__PURE__ */ o(
|
|
767
775
|
"button",
|
|
768
776
|
{
|
|
769
|
-
className: `terminal-btn ${
|
|
777
|
+
className: `terminal-btn ${A.button} ${A.minimize}`,
|
|
770
778
|
onClick: () => {
|
|
771
779
|
e();
|
|
772
780
|
},
|
|
773
|
-
disabled:
|
|
781
|
+
disabled: i || t,
|
|
774
782
|
title: t ? "Restore" : "Minimize",
|
|
775
|
-
|
|
783
|
+
"data-action": "minimize",
|
|
784
|
+
children: /* @__PURE__ */ o(Yt, {})
|
|
776
785
|
}
|
|
777
786
|
);
|
|
778
787
|
}
|
|
779
|
-
const
|
|
780
|
-
container:
|
|
781
|
-
header:
|
|
782
|
-
body:
|
|
783
|
-
resizeHandle:
|
|
784
|
-
content:
|
|
785
|
-
scrollbar:
|
|
786
|
-
transition:
|
|
787
|
-
focused:
|
|
788
|
-
maximized:
|
|
789
|
-
minimized:
|
|
790
|
-
visible:
|
|
791
|
-
hidden:
|
|
792
|
-
scrollbarX:
|
|
793
|
-
},
|
|
794
|
-
title:
|
|
795
|
-
brandText:
|
|
796
|
-
windowIcon:
|
|
788
|
+
const Kt = "_container_xnmir_1", Jt = "_header_xnmir_27", Qt = "_body_xnmir_57", Ut = "_resizeHandle_xnmir_73", en = "_content_xnmir_93", tn = "_scrollbar_xnmir_181", nn = "_transition_xnmir_225", on = "_focused_xnmir_247", sn = "_maximized_xnmir_259", rn = "_minimized_xnmir_277", ln = "_visible_xnmir_285", cn = "_hidden_xnmir_295", an = "_scrollbarX_xnmir_347", N = {
|
|
789
|
+
container: Kt,
|
|
790
|
+
header: Jt,
|
|
791
|
+
body: Qt,
|
|
792
|
+
resizeHandle: Ut,
|
|
793
|
+
content: en,
|
|
794
|
+
scrollbar: tn,
|
|
795
|
+
transition: nn,
|
|
796
|
+
focused: on,
|
|
797
|
+
maximized: sn,
|
|
798
|
+
minimized: rn,
|
|
799
|
+
visible: ln,
|
|
800
|
+
hidden: cn,
|
|
801
|
+
scrollbarX: an
|
|
802
|
+
}, dn = "_title_tn8yk_1", un = "_brandText_tn8yk_25", mn = "_windowIcon_tn8yk_35", Y = {
|
|
803
|
+
title: dn,
|
|
804
|
+
brandText: un,
|
|
805
|
+
windowIcon: mn
|
|
797
806
|
};
|
|
798
|
-
function
|
|
807
|
+
function hn({ onClose: e, title: t, icon: i, canMinimize: n, canMaximize: s, canClose: c }) {
|
|
799
808
|
const {
|
|
800
809
|
drag: a,
|
|
801
810
|
isMaximized: r,
|
|
802
811
|
isMinimized: l,
|
|
803
812
|
minimize: u,
|
|
804
813
|
maximize: d,
|
|
805
|
-
restore:
|
|
806
|
-
} =
|
|
807
|
-
return /* @__PURE__ */
|
|
814
|
+
restore: h
|
|
815
|
+
} = Et(), m = pe(re);
|
|
816
|
+
return /* @__PURE__ */ p(
|
|
808
817
|
"div",
|
|
809
818
|
{
|
|
810
|
-
className: `window-header ${
|
|
819
|
+
className: `window-header ${N.header}`,
|
|
811
820
|
onMouseDown: a,
|
|
812
821
|
children: [
|
|
813
|
-
/* @__PURE__ */
|
|
814
|
-
|
|
815
|
-
/* @__PURE__ */
|
|
822
|
+
/* @__PURE__ */ p("span", { className: `window-title ${Y.title}`, children: [
|
|
823
|
+
i && /* @__PURE__ */ o("span", { className: `window-icon ${Y.windowIcon} ${Y.brandText}`, children: i }),
|
|
824
|
+
/* @__PURE__ */ o("span", { className: `brand-text ${Y.brandText}`, children: t })
|
|
816
825
|
] }),
|
|
817
|
-
/* @__PURE__ */
|
|
818
|
-
/* @__PURE__ */
|
|
819
|
-
/* @__PURE__ */
|
|
820
|
-
/* @__PURE__ */
|
|
826
|
+
/* @__PURE__ */ p("div", { className: `window-controls ${A.controls}`, children: [
|
|
827
|
+
/* @__PURE__ */ o(Gt, { onClick: u, isMinimized: l, disabled: n === !1 }),
|
|
828
|
+
/* @__PURE__ */ o(Xt, { onClick: r ? h : d, isMaximized: r, disabled: s === !1 || m }),
|
|
829
|
+
/* @__PURE__ */ o(ue, { onClose: e, disabled: c === !1 })
|
|
821
830
|
] })
|
|
822
831
|
]
|
|
823
832
|
}
|
|
824
833
|
);
|
|
825
834
|
}
|
|
826
|
-
|
|
827
|
-
|
|
828
|
-
|
|
829
|
-
|
|
830
|
-
|
|
831
|
-
|
|
835
|
+
function fn() {
|
|
836
|
+
if (typeof window > "u")
|
|
837
|
+
return {
|
|
838
|
+
left: { width: 0, height: 0, x: 0, y: 0 },
|
|
839
|
+
right: { width: 0, height: 0, x: 0, y: 0 },
|
|
840
|
+
"top-left": { width: 0, height: 0, x: 0, y: 0 },
|
|
841
|
+
"top-right": { width: 0, height: 0, x: 0, y: 0 },
|
|
842
|
+
"bottom-left": { width: 0, height: 0, x: 0, y: 0 },
|
|
843
|
+
"bottom-right": { width: 0, height: 0, x: 0, y: 0 }
|
|
844
|
+
};
|
|
845
|
+
const e = window.innerWidth / 2, t = window.innerHeight / 2, i = window.innerHeight;
|
|
846
|
+
return {
|
|
847
|
+
left: {
|
|
848
|
+
width: e,
|
|
849
|
+
height: i,
|
|
850
|
+
x: 0,
|
|
851
|
+
y: 0
|
|
852
|
+
},
|
|
853
|
+
right: {
|
|
854
|
+
width: e,
|
|
855
|
+
height: i,
|
|
856
|
+
x: e,
|
|
857
|
+
y: 0
|
|
858
|
+
},
|
|
859
|
+
"top-left": {
|
|
860
|
+
width: e,
|
|
861
|
+
height: t,
|
|
862
|
+
x: 0,
|
|
863
|
+
y: 0
|
|
864
|
+
},
|
|
865
|
+
"top-right": {
|
|
866
|
+
width: e,
|
|
867
|
+
height: t,
|
|
868
|
+
x: e,
|
|
869
|
+
y: 0
|
|
870
|
+
},
|
|
871
|
+
"bottom-left": {
|
|
872
|
+
width: e,
|
|
873
|
+
height: t,
|
|
874
|
+
x: 0,
|
|
875
|
+
y: t
|
|
876
|
+
},
|
|
877
|
+
"bottom-right": {
|
|
878
|
+
width: e,
|
|
879
|
+
height: t,
|
|
880
|
+
x: e,
|
|
881
|
+
y: t
|
|
882
|
+
}
|
|
883
|
+
};
|
|
884
|
+
}
|
|
885
|
+
const _n = ({ window: e }) => {
|
|
886
|
+
const { closeWindow: t, focusWindow: i, updateWindow: n } = le(), { setSnapPreview: s } = ce(), c = we(), [a, r] = z(!1), [l, u] = z(!1), d = M(null);
|
|
887
|
+
H(() => {
|
|
888
|
+
let I;
|
|
889
|
+
return I = requestAnimationFrame(() => r(!0)), () => {
|
|
890
|
+
cancelAnimationFrame(I), d.current && clearTimeout(d.current);
|
|
832
891
|
};
|
|
833
892
|
}, []);
|
|
834
|
-
const
|
|
835
|
-
|
|
893
|
+
const h = f(() => {
|
|
894
|
+
u(!0), d.current = setTimeout(() => {
|
|
836
895
|
t(e.id);
|
|
837
|
-
},
|
|
896
|
+
}, Ne);
|
|
838
897
|
}, [t, e.id]), m = f(() => {
|
|
839
898
|
n(e.id, { isMinimized: !0 });
|
|
840
|
-
}, [n, e.id]), h = f(() => {
|
|
841
|
-
n(e.id, { isMaximized: !0, isMinimized: !1, isSnapped: !1 });
|
|
842
899
|
}, [n, e.id]), x = f(() => {
|
|
900
|
+
n(e.id, { isMaximized: !0, isMinimized: !1, isSnapped: !1 });
|
|
901
|
+
}, [n, e.id]), _ = f(() => {
|
|
843
902
|
n(e.id, { isMinimized: !1, isMaximized: !1, isSnapped: !1 });
|
|
844
|
-
}, [n, e.id]),
|
|
845
|
-
|
|
846
|
-
|
|
847
|
-
|
|
848
|
-
|
|
849
|
-
|
|
850
|
-
|
|
851
|
-
|
|
852
|
-
|
|
853
|
-
|
|
903
|
+
}, [n, e.id]), b = f(
|
|
904
|
+
(I) => {
|
|
905
|
+
const ve = fn(), { width: xe, height: ye, x: ze, y: Me } = ve[I];
|
|
906
|
+
n(e.id, {
|
|
907
|
+
isSnapped: !0,
|
|
908
|
+
isMaximized: !1,
|
|
909
|
+
isMinimized: !1,
|
|
910
|
+
size: { width: xe, height: ye },
|
|
911
|
+
position: { x: ze, y: Me }
|
|
912
|
+
});
|
|
913
|
+
},
|
|
914
|
+
[n, e.id]
|
|
915
|
+
), y = f(() => {
|
|
854
916
|
n(e.id, { isSnapped: !1 });
|
|
855
|
-
}, [n, e.id]),
|
|
856
|
-
n(e.id, { position:
|
|
857
|
-
}, [n, e.id]),
|
|
858
|
-
n(e.id, { size:
|
|
917
|
+
}, [n, e.id]), L = f((I) => {
|
|
918
|
+
n(e.id, { position: I });
|
|
919
|
+
}, [n, e.id]), O = f((I) => {
|
|
920
|
+
n(e.id, { size: I });
|
|
859
921
|
}, [n, e.id]), {
|
|
860
|
-
size:
|
|
861
|
-
position:
|
|
862
|
-
isDragging:
|
|
863
|
-
isResizing:
|
|
922
|
+
size: k,
|
|
923
|
+
position: T,
|
|
924
|
+
isDragging: W,
|
|
925
|
+
isResizing: $,
|
|
864
926
|
drag: R,
|
|
865
|
-
resize:
|
|
927
|
+
resize: D,
|
|
866
928
|
windowRef: P
|
|
867
|
-
} =
|
|
929
|
+
} = jt({
|
|
868
930
|
initialSize: e.size,
|
|
869
931
|
initialPosition: e.position,
|
|
870
932
|
isMinimized: e.isMinimized || !1,
|
|
871
933
|
isMaximized: e.isMaximized || !1,
|
|
872
934
|
isSnapped: e.isSnapped || !1,
|
|
873
|
-
onSnap:
|
|
874
|
-
onUnsnap:
|
|
935
|
+
onSnap: b,
|
|
936
|
+
onUnsnap: y,
|
|
875
937
|
setSnapPreview: s,
|
|
876
|
-
onPositionChange:
|
|
877
|
-
onSizeChange:
|
|
878
|
-
}),
|
|
879
|
-
size:
|
|
880
|
-
position:
|
|
881
|
-
isDragging:
|
|
882
|
-
isResizing:
|
|
938
|
+
onPositionChange: L,
|
|
939
|
+
onSizeChange: O
|
|
940
|
+
}), C = E(() => ({
|
|
941
|
+
size: k,
|
|
942
|
+
position: T,
|
|
943
|
+
isDragging: W,
|
|
944
|
+
isResizing: $,
|
|
883
945
|
drag: R,
|
|
884
|
-
resize:
|
|
946
|
+
resize: D,
|
|
885
947
|
windowRef: P,
|
|
886
948
|
isMinimized: e.isMinimized || !1,
|
|
887
949
|
isMaximized: e.isMaximized || !1,
|
|
888
950
|
isSnapped: e.isSnapped || !1,
|
|
889
951
|
minimize: m,
|
|
890
|
-
maximize:
|
|
891
|
-
restore:
|
|
892
|
-
}), [
|
|
893
|
-
|
|
952
|
+
maximize: x,
|
|
953
|
+
restore: _
|
|
954
|
+
}), [k, T, W, $, R, D, P, e.isMinimized, e.isMaximized, e.isSnapped, m, x, _]), q = a && !l && !e.isMinimized, w = e.isMaximized, j = e.isMinimized, ge = E(() => ({
|
|
955
|
+
width: w ? void 0 : k.width,
|
|
956
|
+
height: j || w ? void 0 : k.height,
|
|
957
|
+
left: w ? void 0 : T.x,
|
|
958
|
+
top: w ? void 0 : T.y,
|
|
959
|
+
zIndex: e.zIndex,
|
|
960
|
+
display: "flex",
|
|
961
|
+
pointerEvents: j ? "none" : "auto",
|
|
962
|
+
...e.style
|
|
963
|
+
}), [k, T, w, j, e.zIndex, e.style]);
|
|
964
|
+
return /* @__PURE__ */ o(be.Provider, { value: C, children: /* @__PURE__ */ p(
|
|
894
965
|
"div",
|
|
895
966
|
{
|
|
896
967
|
ref: P,
|
|
@@ -900,27 +971,21 @@ const ln = ({ window: e }) => {
|
|
|
900
971
|
"aria-modal": "false",
|
|
901
972
|
tabIndex: -1,
|
|
902
973
|
className: `window-container
|
|
903
|
-
|
|
904
|
-
|
|
905
|
-
|
|
906
|
-
|
|
907
|
-
|
|
974
|
+
${N.container}
|
|
975
|
+
${!W && !$ ? `${N.transition} window-transition` : ""}
|
|
976
|
+
${q ? N.visible : N.hidden}
|
|
977
|
+
${w ? N.maximized : ""}
|
|
978
|
+
${j ? N.minimized : ""}
|
|
979
|
+
${e.className || ""}
|
|
908
980
|
`,
|
|
909
|
-
style:
|
|
910
|
-
|
|
911
|
-
|
|
912
|
-
left: I ? void 0 : E.x,
|
|
913
|
-
top: I ? void 0 : E.y,
|
|
914
|
-
zIndex: e.zIndex,
|
|
915
|
-
display: "flex",
|
|
916
|
-
pointerEvents: S ? "none" : "auto"
|
|
917
|
-
},
|
|
918
|
-
onMouseDown: () => o(e.id),
|
|
981
|
+
"data-system-style": c,
|
|
982
|
+
style: ge,
|
|
983
|
+
onMouseDown: () => i(e.id),
|
|
919
984
|
children: [
|
|
920
|
-
/* @__PURE__ */
|
|
921
|
-
|
|
985
|
+
/* @__PURE__ */ o(
|
|
986
|
+
hn,
|
|
922
987
|
{
|
|
923
|
-
onClose:
|
|
988
|
+
onClose: h,
|
|
924
989
|
title: e.title,
|
|
925
990
|
icon: e.icon,
|
|
926
991
|
canClose: e.canClose,
|
|
@@ -928,115 +993,115 @@ const ln = ({ window: e }) => {
|
|
|
928
993
|
canMaximize: e.canMaximize
|
|
929
994
|
}
|
|
930
995
|
),
|
|
931
|
-
/* @__PURE__ */
|
|
996
|
+
/* @__PURE__ */ o(
|
|
932
997
|
"div",
|
|
933
998
|
{
|
|
934
|
-
className: `window-scrollbar ${
|
|
935
|
-
style: { display:
|
|
999
|
+
className: `window-scrollbar ${N.scrollbar} ${N.content}`,
|
|
1000
|
+
style: { display: j ? "none" : "flex" },
|
|
936
1001
|
children: e.component
|
|
937
1002
|
}
|
|
938
1003
|
),
|
|
939
|
-
!
|
|
1004
|
+
!w && /* @__PURE__ */ o(
|
|
940
1005
|
"div",
|
|
941
1006
|
{
|
|
942
|
-
className: `window-resize-handle ${
|
|
943
|
-
onMouseDown:
|
|
1007
|
+
className: `window-resize-handle ${N.resizeHandle}`,
|
|
1008
|
+
onMouseDown: D
|
|
944
1009
|
}
|
|
945
1010
|
)
|
|
946
1011
|
]
|
|
947
1012
|
}
|
|
948
1013
|
) });
|
|
949
|
-
},
|
|
950
|
-
overlay:
|
|
951
|
-
overlayCorner:
|
|
952
|
-
visible:
|
|
953
|
-
left:
|
|
954
|
-
right:
|
|
955
|
-
topLeft:
|
|
956
|
-
topRight:
|
|
957
|
-
bottomLeft:
|
|
958
|
-
bottomRight:
|
|
1014
|
+
}, pn = V(_n), bn = "_overlay_16s5n_1", gn = "_overlayCorner_16s5n_37", vn = "_visible_16s5n_69", xn = "_left_16s5n_89", yn = "_right_16s5n_101", zn = "_topLeft_16s5n_113", Mn = "_topRight_16s5n_129", Cn = "_bottomLeft_16s5n_145", wn = "_bottomRight_16s5n_161", g = {
|
|
1015
|
+
overlay: bn,
|
|
1016
|
+
overlayCorner: gn,
|
|
1017
|
+
visible: vn,
|
|
1018
|
+
left: xn,
|
|
1019
|
+
right: yn,
|
|
1020
|
+
topLeft: zn,
|
|
1021
|
+
topRight: Mn,
|
|
1022
|
+
bottomLeft: Cn,
|
|
1023
|
+
bottomRight: wn
|
|
959
1024
|
};
|
|
960
|
-
function
|
|
961
|
-
return e ? /* @__PURE__ */
|
|
962
|
-
/* @__PURE__ */
|
|
1025
|
+
function $n({ side: e }) {
|
|
1026
|
+
return e ? /* @__PURE__ */ p(G, { children: [
|
|
1027
|
+
/* @__PURE__ */ o(
|
|
963
1028
|
"div",
|
|
964
1029
|
{
|
|
965
1030
|
className: `
|
|
966
|
-
${
|
|
967
|
-
${
|
|
968
|
-
${e === "left" ?
|
|
1031
|
+
${g.overlay}
|
|
1032
|
+
${g.left}
|
|
1033
|
+
${e === "left" ? g.visible : ""}
|
|
969
1034
|
`
|
|
970
1035
|
}
|
|
971
1036
|
),
|
|
972
|
-
/* @__PURE__ */
|
|
1037
|
+
/* @__PURE__ */ o(
|
|
973
1038
|
"div",
|
|
974
1039
|
{
|
|
975
1040
|
className: `
|
|
976
|
-
${
|
|
977
|
-
${
|
|
978
|
-
${e === "right" ?
|
|
1041
|
+
${g.overlay}
|
|
1042
|
+
${g.right}
|
|
1043
|
+
${e === "right" ? g.visible : ""}
|
|
979
1044
|
`
|
|
980
1045
|
}
|
|
981
1046
|
),
|
|
982
|
-
/* @__PURE__ */
|
|
1047
|
+
/* @__PURE__ */ o(
|
|
983
1048
|
"div",
|
|
984
1049
|
{
|
|
985
1050
|
className: `
|
|
986
|
-
${
|
|
987
|
-
${
|
|
988
|
-
${e === "top-left" ?
|
|
1051
|
+
${g.overlayCorner}
|
|
1052
|
+
${g.topLeft}
|
|
1053
|
+
${e === "top-left" ? g.visible : ""}
|
|
989
1054
|
`
|
|
990
1055
|
}
|
|
991
1056
|
),
|
|
992
|
-
/* @__PURE__ */
|
|
1057
|
+
/* @__PURE__ */ o(
|
|
993
1058
|
"div",
|
|
994
1059
|
{
|
|
995
1060
|
className: `
|
|
996
|
-
${
|
|
997
|
-
${
|
|
998
|
-
${e === "top-right" ?
|
|
1061
|
+
${g.overlayCorner}
|
|
1062
|
+
${g.topRight}
|
|
1063
|
+
${e === "top-right" ? g.visible : ""}
|
|
999
1064
|
`
|
|
1000
1065
|
}
|
|
1001
1066
|
),
|
|
1002
|
-
/* @__PURE__ */
|
|
1067
|
+
/* @__PURE__ */ o(
|
|
1003
1068
|
"div",
|
|
1004
1069
|
{
|
|
1005
1070
|
className: `
|
|
1006
|
-
${
|
|
1007
|
-
${
|
|
1008
|
-
${e === "bottom-left" ?
|
|
1071
|
+
${g.overlayCorner}
|
|
1072
|
+
${g.bottomLeft}
|
|
1073
|
+
${e === "bottom-left" ? g.visible : ""}
|
|
1009
1074
|
`
|
|
1010
1075
|
}
|
|
1011
1076
|
),
|
|
1012
|
-
/* @__PURE__ */
|
|
1077
|
+
/* @__PURE__ */ o(
|
|
1013
1078
|
"div",
|
|
1014
1079
|
{
|
|
1015
1080
|
className: `
|
|
1016
|
-
${
|
|
1017
|
-
${
|
|
1018
|
-
${e === "bottom-right" ?
|
|
1081
|
+
${g.overlayCorner}
|
|
1082
|
+
${g.bottomRight}
|
|
1083
|
+
${e === "bottom-right" ? g.visible : ""}
|
|
1019
1084
|
`
|
|
1020
1085
|
}
|
|
1021
1086
|
)
|
|
1022
1087
|
] }) : null;
|
|
1023
1088
|
}
|
|
1024
|
-
const
|
|
1025
|
-
manager:
|
|
1089
|
+
const Nn = "_manager_1t6jq_1", Ln = {
|
|
1090
|
+
manager: Nn
|
|
1026
1091
|
};
|
|
1027
|
-
function
|
|
1028
|
-
const e =
|
|
1029
|
-
return /* @__PURE__ */
|
|
1030
|
-
/* @__PURE__ */
|
|
1031
|
-
e.map((
|
|
1092
|
+
function In() {
|
|
1093
|
+
const e = ae(), { snapPreview: t } = ce();
|
|
1094
|
+
return /* @__PURE__ */ p("div", { className: Ln.manager, children: [
|
|
1095
|
+
/* @__PURE__ */ o($n, { side: t ? t.side : null }),
|
|
1096
|
+
e.map((i) => /* @__PURE__ */ o(pn, { window: i }, i.id))
|
|
1032
1097
|
] });
|
|
1033
1098
|
}
|
|
1034
1099
|
export {
|
|
1035
|
-
|
|
1036
|
-
|
|
1037
|
-
|
|
1038
|
-
|
|
1039
|
-
|
|
1040
|
-
|
|
1041
|
-
|
|
1100
|
+
Sn as Toolbar,
|
|
1101
|
+
pn as Window,
|
|
1102
|
+
In as WindowManager,
|
|
1103
|
+
Rn as WindowSystemProvider,
|
|
1104
|
+
le as useWindowActions,
|
|
1105
|
+
ce as useWindowSnap,
|
|
1106
|
+
ae as useWindows
|
|
1042
1107
|
};
|