@nice2dev/ui 1.0.5 → 1.0.8
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 +253 -207
- package/dist/NiceAPIFlow.doc-DnQLPUie.js +30 -0
- package/dist/NiceAPIFlow.doc-Dx4qw1lm.cjs +6 -0
- package/dist/NiceBranchManager.doc-BXjiENlD.cjs +6 -0
- package/dist/NiceBranchManager.doc-xLB82YwU.js +30 -0
- package/dist/NiceButton-B5RXLDwI.cjs +1 -0
- package/dist/NiceButton-CDiS45Ya.cjs +1 -0
- package/dist/NiceButton-D9l39Rs7.js +595 -0
- package/dist/NiceButton-DmTHNHet.js +450 -0
- package/dist/NiceCodeTemplate.doc-BWxTE4C_.cjs +6 -0
- package/dist/NiceCodeTemplate.doc-CA2U5F-v.js +30 -0
- package/dist/NiceDataBranchGraph.doc-CkitupWc.js +29 -0
- package/dist/NiceDataBranchGraph.doc-DDUgipqH.cjs +5 -0
- package/dist/NiceDataBranchManager.doc-B0ODKOs4.js +30 -0
- package/dist/NiceDataBranchManager.doc-CC5o8ihs.cjs +6 -0
- package/dist/NiceDataConflictResolver.doc-CdzScNie.cjs +5 -0
- package/dist/NiceDataConflictResolver.doc-V8vxYAeo.js +29 -0
- package/dist/NiceDataDiffViewer.doc-CR14Bq3A.cjs +6 -0
- package/dist/NiceDataDiffViewer.doc-w2I2QjhX.js +30 -0
- package/dist/NiceDataMapper.doc-C7jSyHRM.js +30 -0
- package/dist/NiceDataMapper.doc-DXjQHz87.cjs +6 -0
- package/dist/NiceDataMergeBuilder.doc-CV32WC_w.cjs +6 -0
- package/dist/NiceDataMergeBuilder.doc-DtuYb3nx.js +30 -0
- package/dist/NiceDataSnapshot.doc-CFLkY3ry.js +30 -0
- package/dist/NiceDataSnapshot.doc-CpZyQ17u.cjs +6 -0
- package/dist/NiceErrorBoundary-BAeqfoSc.cjs +1 -0
- package/dist/NiceErrorBoundary-D1hh5GGe.js +732 -0
- package/dist/NiceErrorBoundary-Dta4TGee.cjs +1 -0
- package/dist/NiceErrorBoundary-niMx1aSJ.js +837 -0
- package/dist/NiceEventOrchestrator.doc-C4SJfIDV.js +30 -0
- package/dist/NiceEventOrchestrator.doc-CxjsLxBG.cjs +6 -0
- package/dist/NiceGitBlame.doc-BG3_K9_0.cjs +6 -0
- package/dist/NiceGitBlame.doc-DrJABEat.js +30 -0
- package/dist/NiceGitConflictResolver.doc-BK7hAfz6.js +30 -0
- package/dist/NiceGitConflictResolver.doc-CgroGM9_.cjs +6 -0
- package/dist/NiceGitDiffViewer.doc-BAwgcY_3.cjs +6 -0
- package/dist/NiceGitDiffViewer.doc-BXKJeP-E.js +30 -0
- package/dist/NiceGitGraph.doc-B-WtGuzn.cjs +5 -0
- package/dist/NiceGitGraph.doc-DxnDPCgC.js +29 -0
- package/dist/NiceGitHooks.doc-BrEizvMp.js +29 -0
- package/dist/NiceGitHooks.doc-C4EdV5zj.cjs +5 -0
- package/dist/NiceMergeRequestBuilder.doc-C5p8mYuh.cjs +6 -0
- package/dist/NiceMergeRequestBuilder.doc-Ct9RCmU8.js +30 -0
- package/dist/NiceModuleLifecyclePanel-BapdidD6.js +4776 -0
- package/dist/NiceModuleLifecyclePanel-Brg1RLwi.cjs +1 -0
- package/dist/NiceModuleLifecyclePanel-CsFsm534.cjs +1 -0
- package/dist/NiceModuleLifecyclePanel-I_TXRiiY.js +5053 -0
- package/dist/NicePinCodeInput-4q8yULuo.js +13359 -0
- package/dist/NicePinCodeInput-CrMfdxxc.js +15287 -0
- package/dist/NicePinCodeInput-D0aF9MK8.cjs +692 -0
- package/dist/NicePinCodeInput-eD2q8nGa.cjs +692 -0
- package/dist/NicePinCodeInput.css +1 -0
- package/dist/NicePipelineEditor.doc-0eGt8zbX.cjs +5 -0
- package/dist/NicePipelineEditor.doc-DTmaOebn.js +29 -0
- package/dist/NicePipelineMonitor.doc-67CmsRcf.cjs +5 -0
- package/dist/NicePipelineMonitor.doc-mSMdhuG8.js +29 -0
- package/dist/NiceSavedQueryPanel-BZNvqSQW.cjs +596 -0
- package/dist/NiceSavedQueryPanel-CUAsdOjJ.js +6190 -0
- package/dist/NiceSavedQueryPanel-DUw8plYP.js +5666 -0
- package/dist/NiceSavedQueryPanel-xpk09zy1.cjs +596 -0
- package/dist/NiceSavedQueryPanel.css +1 -0
- package/dist/NiceStateDesigner.doc-B36u0hNU.js +29 -0
- package/dist/NiceStateDesigner.doc-MPmvNHSx.cjs +5 -0
- package/dist/NiceStockChart-CHlOnWzN.cjs +287 -0
- package/dist/NiceStockChart-Cpmv9_Cc.js +2341 -0
- package/dist/NiceStockChart.css +1 -0
- package/dist/NiceTestBuilder.doc-BFInj8GJ.js +30 -0
- package/dist/NiceTestBuilder.doc-CB03U_uR.cjs +6 -0
- package/dist/NiceToggle-C1UKGXmJ.js +209 -0
- package/dist/NiceToggle-CaY1u82g.js +277 -0
- package/dist/NiceToggle-DFJFQv_Z.cjs +1 -0
- package/dist/NiceToggle-lVi-ETi0.cjs +1 -0
- package/dist/NiceWindow-D1awkyFl.js +1636 -0
- package/dist/NiceWindow-IdHAcP70.cjs +1 -0
- package/dist/NiceWindow-SiCaREbq.js +1408 -0
- package/dist/NiceWindow-yARTUJsg.cjs +1 -0
- package/dist/charts-Bx_kNBsE.js +4280 -0
- package/dist/charts-DECVsCHX.cjs +754 -0
- package/dist/charts.cjs +1 -0
- package/dist/charts.css +1 -0
- package/dist/charts.d.ts +1043 -0
- package/dist/charts.mjs +23 -0
- package/dist/core-BZBTsGWN.cjs +96 -0
- package/dist/core-BpghV7Ls.js +17555 -0
- package/dist/core-CfXsl755.js +16305 -0
- package/dist/core-DGJSUW64.cjs +96 -0
- package/dist/data-branching-De4ExX-S.cjs +1 -0
- package/dist/data-branching-DiRfob1f.js +6071 -0
- package/dist/data-branching.cjs +1 -0
- package/dist/data-branching.d.ts +401 -0
- package/dist/data-branching.mjs +9 -0
- package/dist/data.cjs +1 -0
- package/dist/data.d.ts +2003 -0
- package/dist/data.mjs +21 -0
- package/dist/devops-BnYinjkT.cjs +17 -0
- package/dist/devops-Ckh57eti.js +7198 -0
- package/dist/devops.cjs +1 -0
- package/dist/devops.d.ts +758 -0
- package/dist/devops.mjs +12 -0
- package/dist/editors.cjs +1 -0
- package/dist/editors.d.ts +2728 -0
- package/dist/editors.mjs +66 -0
- package/dist/feedback.cjs +1 -0
- package/dist/feedback.d.ts +339 -0
- package/dist/feedback.mjs +16 -0
- package/dist/index-C853adw1.cjs +6199 -0
- package/dist/index-CBIZ6mTQ.cjs +5734 -0
- package/dist/index-CIl98Vbm.js +72951 -0
- package/dist/index-CNwVELPJ.js +62857 -0
- package/dist/index-CUx_-gKK.cjs +1 -0
- package/dist/index-x8mRM4Jc.js +17 -0
- package/dist/index.cjs +1 -7866
- package/dist/index.css +1 -0
- package/dist/index.d.ts +4888 -180
- package/dist/index.mjs +1021 -105889
- package/dist/lazy.cjs +1 -0
- package/dist/lazy.d.ts +1880 -0
- package/dist/lazy.mjs +98 -0
- package/dist/navigation.cjs +1 -0
- package/dist/navigation.d.ts +1862 -0
- package/dist/navigation.mjs +576 -0
- package/dist/no-code-BCuadkm4.cjs +332 -0
- package/dist/no-code-TL7PyulA.js +7005 -0
- package/dist/no-code.cjs +1 -0
- package/dist/no-code.d.ts +870 -0
- package/dist/no-code.mjs +13 -0
- package/dist/overlays.cjs +1 -0
- package/dist/overlays.d.ts +706 -0
- package/dist/overlays.mjs +482 -0
- package/package.json +51 -1
|
@@ -0,0 +1,1636 @@
|
|
|
1
|
+
import { jsxs as z, Fragment as se, jsx as o } from "react/jsx-runtime";
|
|
2
|
+
import { b as be, h as Ie, t as we, g as De, i as ht, d as ft, u as Ce, s as pt, a as _t } from "./core-CfXsl755.js";
|
|
3
|
+
import gt, { useRef as q, useState as D, useEffect as X, useCallback as b, useReducer as wt, useMemo as ve, useContext as Pe, createContext as Ye, forwardRef as Te } from "react";
|
|
4
|
+
import { createPortal as fe } from "react-dom";
|
|
5
|
+
const Dt = ({
|
|
6
|
+
visible: e,
|
|
7
|
+
onClose: n,
|
|
8
|
+
title: r,
|
|
9
|
+
items: i,
|
|
10
|
+
showCancelButton: h = !0,
|
|
11
|
+
cancelText: d,
|
|
12
|
+
className: m,
|
|
13
|
+
style: g
|
|
14
|
+
}) => {
|
|
15
|
+
const { t: p } = be();
|
|
16
|
+
return e ? /* @__PURE__ */ z(se, { children: [
|
|
17
|
+
/* @__PURE__ */ o("div", { className: "nice-actionsheet__overlay", onClick: n }),
|
|
18
|
+
/* @__PURE__ */ z("div", { className: `nice-actionsheet ${m || ""}`, style: g, children: [
|
|
19
|
+
r && /* @__PURE__ */ o("div", { className: "nice-actionsheet__title", children: r }),
|
|
20
|
+
/* @__PURE__ */ o("div", { className: "nice-actionsheet__items", children: i.map((x, a) => /* @__PURE__ */ z(
|
|
21
|
+
"button",
|
|
22
|
+
{
|
|
23
|
+
className: `nice-actionsheet__item ${x.type === "danger" ? "nice-actionsheet__item--danger" : ""}`,
|
|
24
|
+
disabled: x.disabled,
|
|
25
|
+
onClick: () => {
|
|
26
|
+
x.onClick?.(), n();
|
|
27
|
+
},
|
|
28
|
+
children: [
|
|
29
|
+
x.icon && /* @__PURE__ */ o("span", { className: "nice-actionsheet__icon", children: x.icon }),
|
|
30
|
+
x.text
|
|
31
|
+
]
|
|
32
|
+
},
|
|
33
|
+
a
|
|
34
|
+
)) }),
|
|
35
|
+
h && /* @__PURE__ */ o("button", { className: "nice-actionsheet__cancel", onClick: n, children: d || p("cancel", "Cancel") })
|
|
36
|
+
] })
|
|
37
|
+
] }) : null;
|
|
38
|
+
}, Pt = ({
|
|
39
|
+
open: e,
|
|
40
|
+
onClose: n,
|
|
41
|
+
children: r,
|
|
42
|
+
title: i,
|
|
43
|
+
size: h = "md",
|
|
44
|
+
closeOnBackdropClick: d = !0,
|
|
45
|
+
closeOnEscape: m = !0,
|
|
46
|
+
disableFocusTrap: g = !1,
|
|
47
|
+
disableBodyScroll: p = !0,
|
|
48
|
+
zIndex: x = 1e3,
|
|
49
|
+
className: a,
|
|
50
|
+
style: M
|
|
51
|
+
}) => {
|
|
52
|
+
const C = q(null);
|
|
53
|
+
Ie(C, e && !g), X(() => {
|
|
54
|
+
if (!p && e) {
|
|
55
|
+
const s = document.body.style.overflow;
|
|
56
|
+
return document.body.style.overflow = "hidden", () => {
|
|
57
|
+
document.body.style.overflow = s;
|
|
58
|
+
};
|
|
59
|
+
}
|
|
60
|
+
}, [e, p]), X(() => {
|
|
61
|
+
if (!m || !e) return;
|
|
62
|
+
const s = (k) => {
|
|
63
|
+
k.key === "Escape" && (k.preventDefault(), n());
|
|
64
|
+
};
|
|
65
|
+
return document.addEventListener("keydown", s), () => document.removeEventListener("keydown", s);
|
|
66
|
+
}, [m, e, n]);
|
|
67
|
+
const f = b((s) => {
|
|
68
|
+
d && s.target === s.currentTarget && n();
|
|
69
|
+
}, [d, n]);
|
|
70
|
+
if (!e) return null;
|
|
71
|
+
const N = {
|
|
72
|
+
sm: "nice-modal--sm",
|
|
73
|
+
md: "nice-modal--md",
|
|
74
|
+
lg: "nice-modal--lg",
|
|
75
|
+
xl: "nice-modal--xl",
|
|
76
|
+
full: "nice-modal--full"
|
|
77
|
+
}[h];
|
|
78
|
+
return fe(
|
|
79
|
+
/* @__PURE__ */ o(
|
|
80
|
+
"div",
|
|
81
|
+
{
|
|
82
|
+
className: "nice-modal__overlay",
|
|
83
|
+
style: { zIndex: x },
|
|
84
|
+
onClick: f,
|
|
85
|
+
role: "presentation",
|
|
86
|
+
children: /* @__PURE__ */ o(
|
|
87
|
+
"div",
|
|
88
|
+
{
|
|
89
|
+
ref: C,
|
|
90
|
+
className: `nice-modal ${N} ${a || ""}`,
|
|
91
|
+
role: "dialog",
|
|
92
|
+
"aria-modal": "true",
|
|
93
|
+
"aria-label": i,
|
|
94
|
+
style: M,
|
|
95
|
+
tabIndex: -1,
|
|
96
|
+
children: r
|
|
97
|
+
}
|
|
98
|
+
)
|
|
99
|
+
}
|
|
100
|
+
),
|
|
101
|
+
document.body
|
|
102
|
+
);
|
|
103
|
+
}, Yt = ({
|
|
104
|
+
children: e,
|
|
105
|
+
showClose: n = !0,
|
|
106
|
+
onClose: r,
|
|
107
|
+
className: i
|
|
108
|
+
}) => /* @__PURE__ */ z("div", { className: `nice-modal__header ${i || ""}`, children: [
|
|
109
|
+
/* @__PURE__ */ o("div", { className: "nice-modal__title", children: e }),
|
|
110
|
+
n && r && /* @__PURE__ */ o(
|
|
111
|
+
"button",
|
|
112
|
+
{
|
|
113
|
+
type: "button",
|
|
114
|
+
className: "nice-modal__close",
|
|
115
|
+
onClick: r,
|
|
116
|
+
"aria-label": "Close",
|
|
117
|
+
children: /* @__PURE__ */ o("svg", { width: "20", height: "20", viewBox: "0 0 20 20", fill: "none", stroke: "currentColor", strokeWidth: "2", children: /* @__PURE__ */ o("path", { d: "M4 4l12 12M4 16L16 4" }) })
|
|
118
|
+
}
|
|
119
|
+
)
|
|
120
|
+
] }), Xt = ({ children: e, className: n }) => /* @__PURE__ */ o("div", { className: `nice-modal__body ${n || ""}`, children: e }), Ot = ({ children: e, className: n }) => /* @__PURE__ */ o("div", { className: `nice-modal__footer ${n || ""}`, children: e }), Ht = ({
|
|
121
|
+
open: e,
|
|
122
|
+
onClose: n,
|
|
123
|
+
children: r,
|
|
124
|
+
position: i = "right",
|
|
125
|
+
size: h = 320,
|
|
126
|
+
title: d,
|
|
127
|
+
closeOnBackdropClick: m = !0,
|
|
128
|
+
closeOnEscape: g = !0,
|
|
129
|
+
swipeToClose: p = !0,
|
|
130
|
+
zIndex: x = 1e3,
|
|
131
|
+
className: a,
|
|
132
|
+
style: M
|
|
133
|
+
}) => {
|
|
134
|
+
const C = q(null), [f, N] = D(!1), [s, k] = D(0);
|
|
135
|
+
Ie(C, e), X(() => {
|
|
136
|
+
if (!g || !e) return;
|
|
137
|
+
const l = (E) => {
|
|
138
|
+
E.key === "Escape" && (E.preventDefault(), n());
|
|
139
|
+
};
|
|
140
|
+
return document.addEventListener("keydown", l), () => document.removeEventListener("keydown", l);
|
|
141
|
+
}, [g, e, n]);
|
|
142
|
+
const c = b((l) => {
|
|
143
|
+
let E = 0;
|
|
144
|
+
switch (i) {
|
|
145
|
+
case "left":
|
|
146
|
+
E = Math.min(0, l.deltaX);
|
|
147
|
+
break;
|
|
148
|
+
case "right":
|
|
149
|
+
E = Math.max(0, l.deltaX);
|
|
150
|
+
break;
|
|
151
|
+
case "top":
|
|
152
|
+
E = Math.min(0, l.deltaY);
|
|
153
|
+
break;
|
|
154
|
+
case "bottom":
|
|
155
|
+
E = Math.max(0, l.deltaY);
|
|
156
|
+
break;
|
|
157
|
+
}
|
|
158
|
+
k(E);
|
|
159
|
+
}, [i]), v = b((l) => {
|
|
160
|
+
let T = !1;
|
|
161
|
+
switch (i) {
|
|
162
|
+
case "left":
|
|
163
|
+
T = l.deltaX < -100;
|
|
164
|
+
break;
|
|
165
|
+
case "right":
|
|
166
|
+
T = l.deltaX > 100;
|
|
167
|
+
break;
|
|
168
|
+
case "top":
|
|
169
|
+
T = l.deltaY < -100;
|
|
170
|
+
break;
|
|
171
|
+
case "bottom":
|
|
172
|
+
T = l.deltaY > 100;
|
|
173
|
+
break;
|
|
174
|
+
}
|
|
175
|
+
T && (we("light"), n()), k(0), N(!1);
|
|
176
|
+
}, [i, n]), { ref: _ } = ht({
|
|
177
|
+
enabled: p && e,
|
|
178
|
+
onPanStart: () => N(!0),
|
|
179
|
+
onPan: c,
|
|
180
|
+
onPanEnd: v
|
|
181
|
+
}), I = b((l) => {
|
|
182
|
+
m && l.target === l.currentTarget && n();
|
|
183
|
+
}, [m, n]);
|
|
184
|
+
if (!e) return null;
|
|
185
|
+
const R = i === "left" || i === "right", O = R ? { width: typeof h == "number" ? `${h}px` : h } : { height: typeof h == "number" ? `${h}px` : h }, t = () => {
|
|
186
|
+
if (f)
|
|
187
|
+
return R ? `translateX(${s}px)` : `translateY(${s}px)`;
|
|
188
|
+
};
|
|
189
|
+
return fe(
|
|
190
|
+
/* @__PURE__ */ z(se, { children: [
|
|
191
|
+
/* @__PURE__ */ o(
|
|
192
|
+
"div",
|
|
193
|
+
{
|
|
194
|
+
className: `nice-drawer__overlay ${e ? "nice-drawer__overlay--visible" : ""}`,
|
|
195
|
+
style: { zIndex: x },
|
|
196
|
+
onClick: I
|
|
197
|
+
}
|
|
198
|
+
),
|
|
199
|
+
/* @__PURE__ */ o(
|
|
200
|
+
"div",
|
|
201
|
+
{
|
|
202
|
+
ref: (l) => {
|
|
203
|
+
C.current = l, _.current = l;
|
|
204
|
+
},
|
|
205
|
+
className: `nice-drawer nice-drawer--${i} ${e ? "nice-drawer--open" : ""} ${a || ""}`,
|
|
206
|
+
style: {
|
|
207
|
+
...O,
|
|
208
|
+
zIndex: x + 1,
|
|
209
|
+
transform: t(),
|
|
210
|
+
transition: f ? "none" : void 0,
|
|
211
|
+
...M
|
|
212
|
+
},
|
|
213
|
+
role: "dialog",
|
|
214
|
+
"aria-modal": "true",
|
|
215
|
+
"aria-label": d,
|
|
216
|
+
tabIndex: -1,
|
|
217
|
+
children: r
|
|
218
|
+
}
|
|
219
|
+
)
|
|
220
|
+
] }),
|
|
221
|
+
document.body
|
|
222
|
+
);
|
|
223
|
+
}, qt = ({
|
|
224
|
+
open: e,
|
|
225
|
+
onClose: n,
|
|
226
|
+
children: r,
|
|
227
|
+
title: i,
|
|
228
|
+
showHandle: h = !0,
|
|
229
|
+
snapPoints: d = [0.5, 0.9],
|
|
230
|
+
initialSnap: m = 0,
|
|
231
|
+
expandable: g = !0,
|
|
232
|
+
closeOnBackdropClick: p = !0,
|
|
233
|
+
closeOnEscape: x = !0,
|
|
234
|
+
hapticFeedback: a = !0,
|
|
235
|
+
zIndex: M = 1e3,
|
|
236
|
+
className: C,
|
|
237
|
+
style: f
|
|
238
|
+
}) => {
|
|
239
|
+
const N = q(null), s = q(null), [k, c] = D(m), [v, _] = D(!1), [I, R] = D(0), O = q(0);
|
|
240
|
+
X(() => {
|
|
241
|
+
e && (c(m), R(0));
|
|
242
|
+
}, [e, m]), Ie(N, e), X(() => {
|
|
243
|
+
if (!x || !e) return;
|
|
244
|
+
const u = (y) => {
|
|
245
|
+
y.key === "Escape" && (y.preventDefault(), n());
|
|
246
|
+
};
|
|
247
|
+
return document.addEventListener("keydown", u), () => document.removeEventListener("keydown", u);
|
|
248
|
+
}, [x, e, n]), X(() => {
|
|
249
|
+
if (e) {
|
|
250
|
+
const u = document.body.style.overflow;
|
|
251
|
+
return document.body.style.overflow = "hidden", () => {
|
|
252
|
+
document.body.style.overflow = u;
|
|
253
|
+
};
|
|
254
|
+
}
|
|
255
|
+
}, [e]);
|
|
256
|
+
const t = b((u) => {
|
|
257
|
+
const y = u.target.closest(".nice-bottom-sheet__handle"), w = s.current, A = !w || w.scrollTop <= 0;
|
|
258
|
+
!y && !A || (_(!0), O.current = u.touches[0].clientY);
|
|
259
|
+
}, []), l = b((u) => {
|
|
260
|
+
if (!v) return;
|
|
261
|
+
const y = u.touches[0].clientY - O.current;
|
|
262
|
+
(y > 0 || k < d.length - 1) && R(y);
|
|
263
|
+
}, [v, k, d.length]), E = b(() => {
|
|
264
|
+
if (!v) return;
|
|
265
|
+
const u = window.innerHeight;
|
|
266
|
+
d[k] * u;
|
|
267
|
+
const y = -I, w = u * 0.15;
|
|
268
|
+
y > w && g && k < d.length - 1 ? (c(k + 1), a && we("selection")) : y < -w && (k > 0 ? (c(k - 1), a && we("selection")) : (a && we("light"), n())), _(!1), R(0);
|
|
269
|
+
}, [v, I, k, d, g, a, n]), T = b(() => {
|
|
270
|
+
p && n();
|
|
271
|
+
}, [p, n]);
|
|
272
|
+
if (!e) return null;
|
|
273
|
+
const P = d[k] * 100, S = v ? I : 0;
|
|
274
|
+
return fe(
|
|
275
|
+
/* @__PURE__ */ z(se, { children: [
|
|
276
|
+
/* @__PURE__ */ o(
|
|
277
|
+
"div",
|
|
278
|
+
{
|
|
279
|
+
className: `nice-bottom-sheet__overlay ${e ? "nice-bottom-sheet__overlay--visible" : ""}`,
|
|
280
|
+
style: { zIndex: M },
|
|
281
|
+
onClick: T
|
|
282
|
+
}
|
|
283
|
+
),
|
|
284
|
+
/* @__PURE__ */ z(
|
|
285
|
+
"div",
|
|
286
|
+
{
|
|
287
|
+
ref: N,
|
|
288
|
+
className: `nice-bottom-sheet ${e ? "nice-bottom-sheet--open" : ""} ${C || ""}`,
|
|
289
|
+
style: {
|
|
290
|
+
zIndex: M + 1,
|
|
291
|
+
height: `${P}vh`,
|
|
292
|
+
transform: `translateY(${Math.max(0, S)}px)`,
|
|
293
|
+
transition: v ? "none" : "transform 0.3s ease-out, height 0.3s ease-out",
|
|
294
|
+
...f
|
|
295
|
+
},
|
|
296
|
+
role: "dialog",
|
|
297
|
+
"aria-modal": "true",
|
|
298
|
+
"aria-label": i,
|
|
299
|
+
tabIndex: -1,
|
|
300
|
+
onTouchStart: t,
|
|
301
|
+
onTouchMove: l,
|
|
302
|
+
onTouchEnd: E,
|
|
303
|
+
children: [
|
|
304
|
+
h && /* @__PURE__ */ o("div", { className: "nice-bottom-sheet__handle", "aria-hidden": "true" }),
|
|
305
|
+
i && /* @__PURE__ */ o("div", { className: "nice-bottom-sheet__title", children: i }),
|
|
306
|
+
/* @__PURE__ */ o("div", { ref: s, className: "nice-bottom-sheet__content", children: r })
|
|
307
|
+
]
|
|
308
|
+
}
|
|
309
|
+
)
|
|
310
|
+
] }),
|
|
311
|
+
document.body
|
|
312
|
+
);
|
|
313
|
+
}, Bt = ({
|
|
314
|
+
trigger: e,
|
|
315
|
+
children: n,
|
|
316
|
+
placement: r = "bottom",
|
|
317
|
+
triggerMode: i = "click",
|
|
318
|
+
open: h,
|
|
319
|
+
onOpenChange: d,
|
|
320
|
+
hoverDelay: m = 200,
|
|
321
|
+
offset: g = 8,
|
|
322
|
+
className: p,
|
|
323
|
+
showArrow: x = !0
|
|
324
|
+
}) => {
|
|
325
|
+
const [a, M] = D(!1), C = q(null), f = q(null), N = q(null), s = h !== void 0, k = s ? h : a, c = b((t) => {
|
|
326
|
+
s || M(t), d?.(t);
|
|
327
|
+
}, [s, d]);
|
|
328
|
+
De(f, () => {
|
|
329
|
+
i !== "manual" && k && c(!1);
|
|
330
|
+
});
|
|
331
|
+
const v = b(() => {
|
|
332
|
+
i === "click" && c(!k);
|
|
333
|
+
}, [i, k, c]), _ = b(() => {
|
|
334
|
+
i === "hover" && (N.current && window.clearTimeout(N.current), N.current = window.setTimeout(() => c(!0), m));
|
|
335
|
+
}, [i, m, c]), I = b(() => {
|
|
336
|
+
i === "hover" && (N.current && window.clearTimeout(N.current), N.current = window.setTimeout(() => c(!1), m));
|
|
337
|
+
}, [i, m, c]), [R, O] = D({ top: 0, left: 0 });
|
|
338
|
+
return X(() => {
|
|
339
|
+
if (!k || !C.current || !f.current) return;
|
|
340
|
+
const t = C.current.getBoundingClientRect(), l = f.current.getBoundingClientRect(), E = window.innerWidth, T = window.innerHeight;
|
|
341
|
+
let P = 0, S = 0;
|
|
342
|
+
const [u, y = "center"] = r.split("-");
|
|
343
|
+
switch (u) {
|
|
344
|
+
case "top":
|
|
345
|
+
P = t.top - l.height - g, S = t.left + (t.width - l.width) / 2;
|
|
346
|
+
break;
|
|
347
|
+
case "bottom":
|
|
348
|
+
P = t.bottom + g, S = t.left + (t.width - l.width) / 2;
|
|
349
|
+
break;
|
|
350
|
+
case "left":
|
|
351
|
+
P = t.top + (t.height - l.height) / 2, S = t.left - l.width - g;
|
|
352
|
+
break;
|
|
353
|
+
case "right":
|
|
354
|
+
P = t.top + (t.height - l.height) / 2, S = t.right + g;
|
|
355
|
+
break;
|
|
356
|
+
}
|
|
357
|
+
u === "top" || u === "bottom" ? (y === "start" && (S = t.left), y === "end" && (S = t.right - l.width)) : (y === "start" && (P = t.top), y === "end" && (P = t.bottom - l.height)), S = Math.max(8, Math.min(E - l.width - 8, S)), P = Math.max(8, Math.min(T - l.height - 8, P)), O({ top: P, left: S });
|
|
358
|
+
}, [k, r, g]), /* @__PURE__ */ z(se, { children: [
|
|
359
|
+
/* @__PURE__ */ o(
|
|
360
|
+
"div",
|
|
361
|
+
{
|
|
362
|
+
ref: C,
|
|
363
|
+
className: "nice-popover__trigger",
|
|
364
|
+
onClick: v,
|
|
365
|
+
onMouseEnter: _,
|
|
366
|
+
onMouseLeave: I,
|
|
367
|
+
style: { display: "inline-block" },
|
|
368
|
+
children: e
|
|
369
|
+
}
|
|
370
|
+
),
|
|
371
|
+
k && fe(
|
|
372
|
+
/* @__PURE__ */ z(
|
|
373
|
+
"div",
|
|
374
|
+
{
|
|
375
|
+
ref: f,
|
|
376
|
+
className: `nice-popover nice-popover--${r} ${p || ""}`,
|
|
377
|
+
style: {
|
|
378
|
+
position: "fixed",
|
|
379
|
+
top: R.top,
|
|
380
|
+
left: R.left,
|
|
381
|
+
zIndex: 1100
|
|
382
|
+
},
|
|
383
|
+
onMouseEnter: _,
|
|
384
|
+
onMouseLeave: I,
|
|
385
|
+
role: "tooltip",
|
|
386
|
+
children: [
|
|
387
|
+
x && /* @__PURE__ */ o("div", { className: "nice-popover__arrow" }),
|
|
388
|
+
/* @__PURE__ */ o("div", { className: "nice-popover__content", children: n })
|
|
389
|
+
]
|
|
390
|
+
}
|
|
391
|
+
),
|
|
392
|
+
document.body
|
|
393
|
+
)
|
|
394
|
+
] });
|
|
395
|
+
}, At = ({
|
|
396
|
+
items: e,
|
|
397
|
+
children: n,
|
|
398
|
+
onOpen: r,
|
|
399
|
+
onClose: i,
|
|
400
|
+
className: h
|
|
401
|
+
}) => {
|
|
402
|
+
const [d, m] = D(!1), [g, p] = D({ x: 0, y: 0 }), x = q(null), a = q(null);
|
|
403
|
+
De(x, () => {
|
|
404
|
+
d && (m(!1), i?.());
|
|
405
|
+
});
|
|
406
|
+
const M = b((N) => {
|
|
407
|
+
N.preventDefault(), p({ x: N.clientX, y: N.clientY }), m(!0), r?.();
|
|
408
|
+
}, [r]), C = b((N) => {
|
|
409
|
+
!N.disabled && N.onClick && (N.onClick(), m(!1), i?.());
|
|
410
|
+
}, [i]);
|
|
411
|
+
X(() => {
|
|
412
|
+
if (!d) return;
|
|
413
|
+
const N = (s) => {
|
|
414
|
+
s.key === "Escape" && (m(!1), i?.());
|
|
415
|
+
};
|
|
416
|
+
return document.addEventListener("keydown", N), () => document.removeEventListener("keydown", N);
|
|
417
|
+
}, [d, i]);
|
|
418
|
+
const f = (N) => /* @__PURE__ */ o("ul", { className: "nice-context-menu__list", role: "menu", children: N.map((s) => s.divider ? /* @__PURE__ */ o("li", { className: "nice-context-menu__divider", role: "separator" }, s.key) : /* @__PURE__ */ o("li", { role: "presentation", children: /* @__PURE__ */ z(
|
|
419
|
+
"button",
|
|
420
|
+
{
|
|
421
|
+
type: "button",
|
|
422
|
+
className: `nice-context-menu__item ${s.disabled ? "nice-context-menu__item--disabled" : ""} ${s.danger ? "nice-context-menu__item--danger" : ""}`,
|
|
423
|
+
role: "menuitem",
|
|
424
|
+
disabled: s.disabled,
|
|
425
|
+
onClick: () => C(s),
|
|
426
|
+
children: [
|
|
427
|
+
s.icon && /* @__PURE__ */ o("span", { className: "nice-context-menu__icon", children: s.icon }),
|
|
428
|
+
/* @__PURE__ */ o("span", { className: "nice-context-menu__label", children: s.label })
|
|
429
|
+
]
|
|
430
|
+
}
|
|
431
|
+
) }, s.key)) });
|
|
432
|
+
return /* @__PURE__ */ z(se, { children: [
|
|
433
|
+
/* @__PURE__ */ o(
|
|
434
|
+
"div",
|
|
435
|
+
{
|
|
436
|
+
ref: a,
|
|
437
|
+
onContextMenu: M,
|
|
438
|
+
style: { display: "contents" },
|
|
439
|
+
children: n
|
|
440
|
+
}
|
|
441
|
+
),
|
|
442
|
+
d && fe(
|
|
443
|
+
/* @__PURE__ */ o(
|
|
444
|
+
"div",
|
|
445
|
+
{
|
|
446
|
+
ref: x,
|
|
447
|
+
className: `nice-context-menu ${h || ""}`,
|
|
448
|
+
style: {
|
|
449
|
+
position: "fixed",
|
|
450
|
+
left: g.x,
|
|
451
|
+
top: g.y,
|
|
452
|
+
zIndex: 1200
|
|
453
|
+
},
|
|
454
|
+
role: "menu",
|
|
455
|
+
children: f(e)
|
|
456
|
+
}
|
|
457
|
+
),
|
|
458
|
+
document.body
|
|
459
|
+
)
|
|
460
|
+
] });
|
|
461
|
+
}, Wt = ({
|
|
462
|
+
visible: e,
|
|
463
|
+
onClose: n,
|
|
464
|
+
targetRef: r,
|
|
465
|
+
position: i = "bottom",
|
|
466
|
+
title: h,
|
|
467
|
+
showArrow: d = !0,
|
|
468
|
+
width: m,
|
|
469
|
+
children: g,
|
|
470
|
+
className: p,
|
|
471
|
+
style: x,
|
|
472
|
+
displayStyle: a
|
|
473
|
+
}) => {
|
|
474
|
+
ft("tooltip", a);
|
|
475
|
+
const M = q(null), [C, f] = D({ top: 0, left: 0 }), N = b(() => {
|
|
476
|
+
const s = r.current, k = M.current;
|
|
477
|
+
if (!s || !k) return;
|
|
478
|
+
const c = s.getBoundingClientRect(), v = k.getBoundingClientRect();
|
|
479
|
+
let _ = 0, I = 0;
|
|
480
|
+
const R = 8;
|
|
481
|
+
switch (i) {
|
|
482
|
+
case "top":
|
|
483
|
+
_ = c.top - v.height - R, I = c.left + (c.width - v.width) / 2;
|
|
484
|
+
break;
|
|
485
|
+
case "bottom":
|
|
486
|
+
_ = c.bottom + R, I = c.left + (c.width - v.width) / 2;
|
|
487
|
+
break;
|
|
488
|
+
case "left":
|
|
489
|
+
_ = c.top + (c.height - v.height) / 2, I = c.left - v.width - R;
|
|
490
|
+
break;
|
|
491
|
+
case "right":
|
|
492
|
+
_ = c.top + (c.height - v.height) / 2, I = c.right + R;
|
|
493
|
+
break;
|
|
494
|
+
}
|
|
495
|
+
f({ top: _ + window.scrollY, left: I + window.scrollX });
|
|
496
|
+
}, [r, i]);
|
|
497
|
+
return X(() => {
|
|
498
|
+
if (e) {
|
|
499
|
+
requestAnimationFrame(N);
|
|
500
|
+
const s = (k) => {
|
|
501
|
+
M.current && !M.current.contains(k.target) && r.current && !r.current.contains(k.target) && n();
|
|
502
|
+
};
|
|
503
|
+
return document.addEventListener("mousedown", s), () => document.removeEventListener("mousedown", s);
|
|
504
|
+
}
|
|
505
|
+
}, [e, N, n, r]), e ? /* @__PURE__ */ z(
|
|
506
|
+
"div",
|
|
507
|
+
{
|
|
508
|
+
ref: M,
|
|
509
|
+
className: `nice-popover nice-popover--${i} ${p || ""}`,
|
|
510
|
+
style: { ...x, position: "absolute", top: C.top, left: C.left, width: m },
|
|
511
|
+
children: [
|
|
512
|
+
d && /* @__PURE__ */ o("div", { className: `nice-popover__arrow nice-popover__arrow--${i}` }),
|
|
513
|
+
h && /* @__PURE__ */ o("div", { className: "nice-popover__title", children: h }),
|
|
514
|
+
/* @__PURE__ */ o("div", { className: "nice-popover__content", children: g })
|
|
515
|
+
]
|
|
516
|
+
}
|
|
517
|
+
) : null;
|
|
518
|
+
}, Ft = ({
|
|
519
|
+
visible: e,
|
|
520
|
+
message: n,
|
|
521
|
+
container: r,
|
|
522
|
+
showIndicator: i = !0,
|
|
523
|
+
shading: h = !0,
|
|
524
|
+
className: d,
|
|
525
|
+
style: m
|
|
526
|
+
}) => {
|
|
527
|
+
const { t: g } = be();
|
|
528
|
+
if (!e) return null;
|
|
529
|
+
const p = !!r?.current, x = /* @__PURE__ */ z("div", { className: `nice-loadpanel ${d || ""}`, style: m, children: [
|
|
530
|
+
h && /* @__PURE__ */ o("div", { className: "nice-loadpanel__shade" }),
|
|
531
|
+
/* @__PURE__ */ z("div", { className: "nice-loadpanel__box", children: [
|
|
532
|
+
i && /* @__PURE__ */ o("div", { className: "nice-spinner nice-spinner--md" }),
|
|
533
|
+
/* @__PURE__ */ o("span", { className: "nice-loadpanel__text", children: n || g("loading", "Loading...") })
|
|
534
|
+
] })
|
|
535
|
+
] });
|
|
536
|
+
if (p && r.current) {
|
|
537
|
+
const a = r.current;
|
|
538
|
+
return a.style.position = a.style.position || "relative", x;
|
|
539
|
+
}
|
|
540
|
+
return x;
|
|
541
|
+
}, Ut = ({
|
|
542
|
+
direction: e = "row",
|
|
543
|
+
align: n,
|
|
544
|
+
justify: r,
|
|
545
|
+
wrap: i,
|
|
546
|
+
gap: h,
|
|
547
|
+
flex: d,
|
|
548
|
+
children: m,
|
|
549
|
+
className: g,
|
|
550
|
+
style: p
|
|
551
|
+
}) => /* @__PURE__ */ o(
|
|
552
|
+
"div",
|
|
553
|
+
{
|
|
554
|
+
className: `nice-box ${g || ""}`,
|
|
555
|
+
style: {
|
|
556
|
+
display: "flex",
|
|
557
|
+
flexDirection: e,
|
|
558
|
+
alignItems: n,
|
|
559
|
+
justifyContent: r,
|
|
560
|
+
flexWrap: i ? "wrap" : void 0,
|
|
561
|
+
gap: h,
|
|
562
|
+
flex: d,
|
|
563
|
+
...p
|
|
564
|
+
},
|
|
565
|
+
children: m
|
|
566
|
+
}
|
|
567
|
+
), Gt = ({
|
|
568
|
+
direction: e = "row",
|
|
569
|
+
items: n,
|
|
570
|
+
gap: r,
|
|
571
|
+
className: i,
|
|
572
|
+
style: h
|
|
573
|
+
}) => /* @__PURE__ */ o(
|
|
574
|
+
"div",
|
|
575
|
+
{
|
|
576
|
+
className: `nice-responsivebox ${i || ""}`,
|
|
577
|
+
style: { display: "flex", flexDirection: e, gap: r, ...h },
|
|
578
|
+
children: n.map((d, m) => /* @__PURE__ */ o("div", { style: { flex: d.ratio ?? 1, flexBasis: d.baseSize, flexShrink: d.shrink ?? 1 }, children: d.children }, m))
|
|
579
|
+
}
|
|
580
|
+
), Vt = ({
|
|
581
|
+
width: e = 200,
|
|
582
|
+
height: n = 200,
|
|
583
|
+
minWidth: r = 50,
|
|
584
|
+
minHeight: i = 50,
|
|
585
|
+
maxWidth: h = 1 / 0,
|
|
586
|
+
maxHeight: d = 1 / 0,
|
|
587
|
+
handles: m = ["right", "bottom", "bottomRight"],
|
|
588
|
+
onResize: g,
|
|
589
|
+
children: p,
|
|
590
|
+
className: x,
|
|
591
|
+
style: a
|
|
592
|
+
}) => {
|
|
593
|
+
const [M, C] = D({ width: e, height: n }), f = q(null), N = (c, v) => {
|
|
594
|
+
v.preventDefault();
|
|
595
|
+
const _ = v.clientX, I = v.clientY, R = M.width, O = M.height, t = (E) => {
|
|
596
|
+
const T = E.clientX - _, P = E.clientY - I;
|
|
597
|
+
let S = R, u = O;
|
|
598
|
+
(c.includes("right") || c === "right") && (S = R + T), (c.includes("bottom") || c === "bottom") && (u = O + P), (c.includes("left") || c === "left") && (S = R - T), (c.includes("top") || c === "top") && (u = O - P), S = Math.max(r, Math.min(h, S)), u = Math.max(i, Math.min(d, u)), C({ width: S, height: u }), g?.({ width: S, height: u });
|
|
599
|
+
}, l = () => {
|
|
600
|
+
document.removeEventListener("pointermove", t), document.removeEventListener("pointerup", l);
|
|
601
|
+
};
|
|
602
|
+
document.addEventListener("pointermove", t), document.addEventListener("pointerup", l);
|
|
603
|
+
}, s = (c) => {
|
|
604
|
+
switch (c) {
|
|
605
|
+
case "top":
|
|
606
|
+
case "bottom":
|
|
607
|
+
return "ns-resize";
|
|
608
|
+
case "left":
|
|
609
|
+
case "right":
|
|
610
|
+
return "ew-resize";
|
|
611
|
+
case "topLeft":
|
|
612
|
+
case "bottomRight":
|
|
613
|
+
return "nwse-resize";
|
|
614
|
+
case "topRight":
|
|
615
|
+
case "bottomLeft":
|
|
616
|
+
return "nesw-resize";
|
|
617
|
+
default:
|
|
618
|
+
return "default";
|
|
619
|
+
}
|
|
620
|
+
}, k = (c) => {
|
|
621
|
+
const v = { position: "absolute", zIndex: 1 }, _ = 8;
|
|
622
|
+
return c === "right" ? { ...v, top: 0, right: -_ / 2, width: _, height: "100%", cursor: s(c) } : c === "bottom" ? { ...v, left: 0, bottom: -_ / 2, width: "100%", height: _, cursor: s(c) } : c === "left" ? { ...v, top: 0, left: -_ / 2, width: _, height: "100%", cursor: s(c) } : c === "top" ? { ...v, top: -_ / 2, left: 0, width: "100%", height: _, cursor: s(c) } : c === "bottomRight" ? { ...v, bottom: -_ / 2, right: -_ / 2, width: _ * 2, height: _ * 2, cursor: s(c) } : c === "bottomLeft" ? { ...v, bottom: -_ / 2, left: -_ / 2, width: _ * 2, height: _ * 2, cursor: s(c) } : c === "topRight" ? { ...v, top: -_ / 2, right: -_ / 2, width: _ * 2, height: _ * 2, cursor: s(c) } : c === "topLeft" ? { ...v, top: -_ / 2, left: -_ / 2, width: _ * 2, height: _ * 2, cursor: s(c) } : v;
|
|
623
|
+
};
|
|
624
|
+
return /* @__PURE__ */ z(
|
|
625
|
+
"div",
|
|
626
|
+
{
|
|
627
|
+
ref: f,
|
|
628
|
+
className: `nice-resizable ${x || ""}`,
|
|
629
|
+
style: { ...a, width: M.width, height: M.height, position: "relative", overflow: "hidden" },
|
|
630
|
+
children: [
|
|
631
|
+
p,
|
|
632
|
+
m.map((c) => /* @__PURE__ */ o("div", { style: k(c), onPointerDown: (v) => N(c, v) }, c))
|
|
633
|
+
]
|
|
634
|
+
}
|
|
635
|
+
);
|
|
636
|
+
}, jt = ({
|
|
637
|
+
direction: e = "vertical",
|
|
638
|
+
showScrollbar: n = "onInteraction",
|
|
639
|
+
width: r,
|
|
640
|
+
height: i,
|
|
641
|
+
onScroll: h,
|
|
642
|
+
children: d,
|
|
643
|
+
className: m,
|
|
644
|
+
style: g
|
|
645
|
+
}) => {
|
|
646
|
+
const p = e === "horizontal" || e === "both" ? "auto" : "hidden", x = e === "vertical" || e === "both" ? "auto" : "hidden";
|
|
647
|
+
return /* @__PURE__ */ o(
|
|
648
|
+
"div",
|
|
649
|
+
{
|
|
650
|
+
className: `nice-scrollview ${n === "never" ? "nice-scrollview--hide-sb" : n === "always" ? "nice-scrollview--show-sb" : ""} ${m || ""}`,
|
|
651
|
+
style: { ...g, width: r, height: i, overflowX: p, overflowY: x },
|
|
652
|
+
onScroll: h,
|
|
653
|
+
children: d
|
|
654
|
+
}
|
|
655
|
+
);
|
|
656
|
+
};
|
|
657
|
+
function ze(e, n) {
|
|
658
|
+
if (!e) return { score: 1, indices: [] };
|
|
659
|
+
const r = e.toLowerCase(), i = n.toLowerCase();
|
|
660
|
+
let h = 0;
|
|
661
|
+
const d = [];
|
|
662
|
+
let m = 0, g = -1;
|
|
663
|
+
for (let p = 0; p < i.length && h < r.length; p++)
|
|
664
|
+
i[p] === r[h] && (d.push(p), g === p - 1 && (m += 3), (p === 0 || /[\s\-_/.]/.test(n[p - 1])) && (m += 5), n[p] === e[h] && (m += 1), m += 1, g = p, h++);
|
|
665
|
+
return h < r.length ? null : (m -= d[0] * 0.1, { score: m, indices: d });
|
|
666
|
+
}
|
|
667
|
+
function vt(e, n) {
|
|
668
|
+
if (n.length === 0) return [e];
|
|
669
|
+
const r = [];
|
|
670
|
+
let i = 0;
|
|
671
|
+
const h = new Set(n);
|
|
672
|
+
for (let d = 0; d < e.length; d++)
|
|
673
|
+
h.has(d) && (i < d && r.push(e.slice(i, d)), r.push(
|
|
674
|
+
gt.createElement("mark", { key: `m-${d}`, className: "nice-command-palette__match" }, e[d])
|
|
675
|
+
), i = d + 1);
|
|
676
|
+
return i < e.length && r.push(e.slice(i)), r;
|
|
677
|
+
}
|
|
678
|
+
function bt(e, n) {
|
|
679
|
+
switch (n.type) {
|
|
680
|
+
case "REGISTER": {
|
|
681
|
+
const r = new Map(e.commands);
|
|
682
|
+
return r.set(n.command.id, n.command), { ...e, commands: r };
|
|
683
|
+
}
|
|
684
|
+
case "REGISTER_BATCH": {
|
|
685
|
+
const r = new Map(e.commands);
|
|
686
|
+
for (const i of n.commands) r.set(i.id, i);
|
|
687
|
+
return { ...e, commands: r };
|
|
688
|
+
}
|
|
689
|
+
case "UNREGISTER": {
|
|
690
|
+
const r = new Map(e.commands);
|
|
691
|
+
return r.delete(n.id), { ...e, commands: r };
|
|
692
|
+
}
|
|
693
|
+
case "OPEN":
|
|
694
|
+
return { ...e, isOpen: !0, query: "", selectedIndex: 0 };
|
|
695
|
+
case "CLOSE":
|
|
696
|
+
return { ...e, isOpen: !1, query: "", selectedIndex: 0 };
|
|
697
|
+
case "SET_QUERY":
|
|
698
|
+
return { ...e, query: n.query, selectedIndex: 0 };
|
|
699
|
+
case "SET_SELECTED":
|
|
700
|
+
return { ...e, selectedIndex: n.index };
|
|
701
|
+
case "ADD_RECENT": {
|
|
702
|
+
const r = e.recentIds.filter((i) => i !== n.id);
|
|
703
|
+
return {
|
|
704
|
+
...e,
|
|
705
|
+
recentIds: [n.id, ...r].slice(0, n.maxRecent)
|
|
706
|
+
};
|
|
707
|
+
}
|
|
708
|
+
default:
|
|
709
|
+
return e;
|
|
710
|
+
}
|
|
711
|
+
}
|
|
712
|
+
const Xe = Ye(null);
|
|
713
|
+
function yt() {
|
|
714
|
+
const e = Pe(Xe);
|
|
715
|
+
if (!e)
|
|
716
|
+
throw new Error("useCommandPalette must be used within NiceCommandPaletteProvider");
|
|
717
|
+
return e;
|
|
718
|
+
}
|
|
719
|
+
const xt = ({
|
|
720
|
+
children: e,
|
|
721
|
+
commands: n,
|
|
722
|
+
placeholder: r = "Type a command...",
|
|
723
|
+
maxVisible: i = 10,
|
|
724
|
+
maxRecent: h = 5,
|
|
725
|
+
className: d,
|
|
726
|
+
emptyText: m = "No commands found",
|
|
727
|
+
closeOnAction: g = !0,
|
|
728
|
+
onOpen: p,
|
|
729
|
+
onClose: x
|
|
730
|
+
}) => {
|
|
731
|
+
const [a, M] = wt(bt, {
|
|
732
|
+
commands: new Map(n?.map((u) => [u.id, u]) ?? []),
|
|
733
|
+
isOpen: !1,
|
|
734
|
+
query: "",
|
|
735
|
+
selectedIndex: 0,
|
|
736
|
+
recentIds: []
|
|
737
|
+
}), C = q(null), f = q(null), [N, s] = D(!1), k = b((u) => {
|
|
738
|
+
M({ type: "REGISTER", command: u });
|
|
739
|
+
}, []), c = b((u) => {
|
|
740
|
+
M({ type: "UNREGISTER", id: u });
|
|
741
|
+
}, []), v = b((u) => {
|
|
742
|
+
M({ type: "REGISTER_BATCH", commands: u });
|
|
743
|
+
}, []), _ = b(() => {
|
|
744
|
+
M({ type: "OPEN" }), p?.();
|
|
745
|
+
}, [p]), I = b(() => {
|
|
746
|
+
M({ type: "CLOSE" }), x?.();
|
|
747
|
+
}, [x]), R = b(() => {
|
|
748
|
+
a.isOpen ? I() : _();
|
|
749
|
+
}, [a.isOpen, I, _]), t = ve(() => {
|
|
750
|
+
const u = Array.from(a.commands.values()).filter((w) => !w.hidden);
|
|
751
|
+
if (!a.query.trim()) {
|
|
752
|
+
const w = a.recentIds.map((Y) => a.commands.get(Y)).filter((Y) => !!Y && !Y.hidden), A = u.filter((Y) => !a.recentIds.includes(Y.id));
|
|
753
|
+
return A.sort((Y, ne) => Y.label.localeCompare(ne.label)), [...w, ...A].map((Y) => ({
|
|
754
|
+
command: Y,
|
|
755
|
+
match: null,
|
|
756
|
+
isRecent: a.recentIds.includes(Y.id)
|
|
757
|
+
}));
|
|
758
|
+
}
|
|
759
|
+
return u.map((w) => {
|
|
760
|
+
const A = ze(a.query, w.label), Y = w.description ? ze(a.query, w.description) : null, ne = w.keywords?.map((L) => ze(a.query, L)).filter(Boolean)[0] ?? null, ae = [A, Y, ne].filter(Boolean).sort((L, B) => (B?.score ?? 0) - (L?.score ?? 0))[0];
|
|
761
|
+
return { command: w, match: ae, isRecent: !1 };
|
|
762
|
+
}).filter((w) => w.match !== null).sort((w, A) => (A.match?.score ?? 0) - (w.match?.score ?? 0));
|
|
763
|
+
}, [a.commands, a.query, a.recentIds]).slice(0, i), l = b(
|
|
764
|
+
async (u) => {
|
|
765
|
+
const y = a.commands.get(u);
|
|
766
|
+
if (!(!y || y.disabled)) {
|
|
767
|
+
s(!0);
|
|
768
|
+
try {
|
|
769
|
+
await y.action(), M({ type: "ADD_RECENT", id: u, maxRecent: h });
|
|
770
|
+
} finally {
|
|
771
|
+
s(!1), g && I();
|
|
772
|
+
}
|
|
773
|
+
}
|
|
774
|
+
},
|
|
775
|
+
[a.commands, h, g, I]
|
|
776
|
+
);
|
|
777
|
+
X(() => {
|
|
778
|
+
const u = (y) => {
|
|
779
|
+
(y.metaKey || y.ctrlKey) && y.key === "k" && (y.preventDefault(), R()), y.key === "Escape" && a.isOpen && (y.preventDefault(), I());
|
|
780
|
+
};
|
|
781
|
+
return document.addEventListener("keydown", u), () => document.removeEventListener("keydown", u);
|
|
782
|
+
}, [R, a.isOpen, I]), X(() => {
|
|
783
|
+
a.isOpen && requestAnimationFrame(() => C.current?.focus());
|
|
784
|
+
}, [a.isOpen]);
|
|
785
|
+
const E = b(
|
|
786
|
+
(u) => {
|
|
787
|
+
const y = t.length;
|
|
788
|
+
if (y) {
|
|
789
|
+
if (u.key === "ArrowDown")
|
|
790
|
+
u.preventDefault(), M({ type: "SET_SELECTED", index: (a.selectedIndex + 1) % y });
|
|
791
|
+
else if (u.key === "ArrowUp")
|
|
792
|
+
u.preventDefault(), M({ type: "SET_SELECTED", index: (a.selectedIndex - 1 + y) % y });
|
|
793
|
+
else if (u.key === "Enter") {
|
|
794
|
+
u.preventDefault();
|
|
795
|
+
const w = t[a.selectedIndex];
|
|
796
|
+
w && l(w.command.id);
|
|
797
|
+
}
|
|
798
|
+
}
|
|
799
|
+
},
|
|
800
|
+
[t, a.selectedIndex, l]
|
|
801
|
+
);
|
|
802
|
+
X(() => {
|
|
803
|
+
if (!f.current) return;
|
|
804
|
+
f.current.children[a.selectedIndex]?.scrollIntoView({ block: "nearest" });
|
|
805
|
+
}, [a.selectedIndex]);
|
|
806
|
+
const T = ve(
|
|
807
|
+
() => ({
|
|
808
|
+
registerCommand: k,
|
|
809
|
+
unregisterCommand: c,
|
|
810
|
+
registerCommands: v,
|
|
811
|
+
open: _,
|
|
812
|
+
close: I,
|
|
813
|
+
toggle: R,
|
|
814
|
+
isOpen: a.isOpen,
|
|
815
|
+
executeCommand: l
|
|
816
|
+
}),
|
|
817
|
+
[k, c, v, _, I, R, a.isOpen, l]
|
|
818
|
+
), P = ve(() => {
|
|
819
|
+
const u = /* @__PURE__ */ new Map();
|
|
820
|
+
for (const y of t) {
|
|
821
|
+
const w = y.command.category ?? "General";
|
|
822
|
+
u.has(w) || u.set(w, []), u.get(w).push(y);
|
|
823
|
+
}
|
|
824
|
+
return u;
|
|
825
|
+
}, [t]);
|
|
826
|
+
let S = 0;
|
|
827
|
+
return /* @__PURE__ */ z(Xe.Provider, { value: T, children: [
|
|
828
|
+
e,
|
|
829
|
+
a.isOpen && /* @__PURE__ */ o("div", { className: `nice-command-palette__overlay ${d ?? ""}`, onClick: I, children: /* @__PURE__ */ z(
|
|
830
|
+
"div",
|
|
831
|
+
{
|
|
832
|
+
className: "nice-command-palette",
|
|
833
|
+
role: "dialog",
|
|
834
|
+
"aria-label": "Command Palette",
|
|
835
|
+
"aria-modal": "true",
|
|
836
|
+
onClick: (u) => u.stopPropagation(),
|
|
837
|
+
children: [
|
|
838
|
+
/* @__PURE__ */ o("div", { className: "nice-command-palette__input-wrapper", children: /* @__PURE__ */ o(
|
|
839
|
+
"input",
|
|
840
|
+
{
|
|
841
|
+
ref: C,
|
|
842
|
+
className: "nice-command-palette__input",
|
|
843
|
+
type: "text",
|
|
844
|
+
placeholder: r,
|
|
845
|
+
value: a.query,
|
|
846
|
+
onChange: (u) => M({ type: "SET_QUERY", query: u.target.value }),
|
|
847
|
+
onKeyDown: E,
|
|
848
|
+
"aria-label": "Search commands",
|
|
849
|
+
"aria-autocomplete": "list",
|
|
850
|
+
"aria-controls": "nice-command-palette-list",
|
|
851
|
+
"aria-activedescendant": t[a.selectedIndex] ? `nice-cmd-${t[a.selectedIndex].command.id}` : void 0
|
|
852
|
+
}
|
|
853
|
+
) }),
|
|
854
|
+
/* @__PURE__ */ z(
|
|
855
|
+
"div",
|
|
856
|
+
{
|
|
857
|
+
ref: f,
|
|
858
|
+
id: "nice-command-palette-list",
|
|
859
|
+
className: "nice-command-palette__list",
|
|
860
|
+
role: "listbox",
|
|
861
|
+
children: [
|
|
862
|
+
t.length === 0 && /* @__PURE__ */ o("div", { className: "nice-command-palette__empty", children: m }),
|
|
863
|
+
Array.from(P.entries()).map(([u, y]) => /* @__PURE__ */ z("div", { className: "nice-command-palette__group", children: [
|
|
864
|
+
/* @__PURE__ */ o("div", { className: "nice-command-palette__category", children: u }),
|
|
865
|
+
y.map((w) => {
|
|
866
|
+
const A = S++, Y = A === a.selectedIndex;
|
|
867
|
+
return /* @__PURE__ */ z(
|
|
868
|
+
"div",
|
|
869
|
+
{
|
|
870
|
+
id: `nice-cmd-${w.command.id}`,
|
|
871
|
+
className: `nice-command-palette__item ${Y ? "nice-command-palette__item--selected" : ""} ${w.command.disabled ? "nice-command-palette__item--disabled" : ""}`,
|
|
872
|
+
role: "option",
|
|
873
|
+
"aria-selected": Y,
|
|
874
|
+
"aria-disabled": w.command.disabled,
|
|
875
|
+
onClick: () => !w.command.disabled && l(w.command.id),
|
|
876
|
+
onMouseEnter: () => M({ type: "SET_SELECTED", index: A }),
|
|
877
|
+
children: [
|
|
878
|
+
w.command.icon && /* @__PURE__ */ o("span", { className: "nice-command-palette__icon", children: w.command.icon }),
|
|
879
|
+
/* @__PURE__ */ z("div", { className: "nice-command-palette__label-group", children: [
|
|
880
|
+
/* @__PURE__ */ o("span", { className: "nice-command-palette__label", children: w.match && a.query ? vt(w.command.label, w.match.indices) : w.command.label }),
|
|
881
|
+
w.command.description && /* @__PURE__ */ o("span", { className: "nice-command-palette__description", children: w.command.description })
|
|
882
|
+
] }),
|
|
883
|
+
w.command.shortcut && /* @__PURE__ */ o("kbd", { className: "nice-command-palette__shortcut", children: w.command.shortcut }),
|
|
884
|
+
w.isRecent && /* @__PURE__ */ o("span", { className: "nice-command-palette__recent-badge", children: "Recent" })
|
|
885
|
+
]
|
|
886
|
+
},
|
|
887
|
+
w.command.id
|
|
888
|
+
);
|
|
889
|
+
})
|
|
890
|
+
] }, u))
|
|
891
|
+
]
|
|
892
|
+
}
|
|
893
|
+
),
|
|
894
|
+
N && /* @__PURE__ */ o("div", { className: "nice-command-palette__executing", children: "Executing..." })
|
|
895
|
+
]
|
|
896
|
+
}
|
|
897
|
+
) })
|
|
898
|
+
] });
|
|
899
|
+
};
|
|
900
|
+
xt.displayName = "NiceCommandPaletteProvider";
|
|
901
|
+
function Qt(e) {
|
|
902
|
+
const { registerCommands: n, unregisterCommand: r } = yt();
|
|
903
|
+
X(() => (n(e), () => {
|
|
904
|
+
for (const i of e)
|
|
905
|
+
r(i.id);
|
|
906
|
+
}), []);
|
|
907
|
+
}
|
|
908
|
+
const Nt = Te(({
|
|
909
|
+
blocked: e,
|
|
910
|
+
message: n,
|
|
911
|
+
children: r,
|
|
912
|
+
className: i,
|
|
913
|
+
style: h,
|
|
914
|
+
id: d
|
|
915
|
+
}, m) => {
|
|
916
|
+
const g = Ce(d);
|
|
917
|
+
return /* @__PURE__ */ z(
|
|
918
|
+
"div",
|
|
919
|
+
{
|
|
920
|
+
ref: m,
|
|
921
|
+
id: g,
|
|
922
|
+
className: `nice-block-ui ${i || ""}`,
|
|
923
|
+
style: { position: "relative", ...h },
|
|
924
|
+
children: [
|
|
925
|
+
r,
|
|
926
|
+
e && /* @__PURE__ */ o("div", { className: "nice-block-ui__overlay", "aria-busy": "true", role: "alert", children: n && /* @__PURE__ */ o("div", { className: "nice-block-ui__message", children: n }) })
|
|
927
|
+
]
|
|
928
|
+
}
|
|
929
|
+
);
|
|
930
|
+
});
|
|
931
|
+
Nt.displayName = "NiceBlockUI";
|
|
932
|
+
const kt = Te(
|
|
933
|
+
({
|
|
934
|
+
windows: e,
|
|
935
|
+
onChange: n,
|
|
936
|
+
onClose: r,
|
|
937
|
+
onFocus: i,
|
|
938
|
+
showTaskbar: h = !0,
|
|
939
|
+
size: d = "md",
|
|
940
|
+
className: m,
|
|
941
|
+
style: g,
|
|
942
|
+
id: p,
|
|
943
|
+
...x
|
|
944
|
+
}, a) => {
|
|
945
|
+
const M = Ce(p), { t: C } = be(), [f, N] = D(null), s = q(null), k = Math.max(1, ...e.map((t) => t.zIndex ?? 1)), c = b(
|
|
946
|
+
(t, l) => {
|
|
947
|
+
const E = e.map((T) => T.key === t ? { ...T, ...l } : T);
|
|
948
|
+
n?.(E);
|
|
949
|
+
},
|
|
950
|
+
[e, n]
|
|
951
|
+
), v = b(
|
|
952
|
+
(t) => {
|
|
953
|
+
c(t, { zIndex: k + 1 }), i?.(t);
|
|
954
|
+
},
|
|
955
|
+
[c, k, i]
|
|
956
|
+
), _ = b(
|
|
957
|
+
(t) => {
|
|
958
|
+
r?.(t), n?.(e.filter((l) => l.key !== t));
|
|
959
|
+
},
|
|
960
|
+
[e, n, r]
|
|
961
|
+
), I = b(
|
|
962
|
+
(t) => {
|
|
963
|
+
const l = e.find((E) => E.key === t);
|
|
964
|
+
l && c(t, { minimized: !l.minimized, maximized: !1 });
|
|
965
|
+
},
|
|
966
|
+
[e, c]
|
|
967
|
+
), R = b(
|
|
968
|
+
(t) => {
|
|
969
|
+
const l = e.find((E) => E.key === t);
|
|
970
|
+
l && c(t, { maximized: !l.maximized, minimized: !1 });
|
|
971
|
+
},
|
|
972
|
+
[e, c]
|
|
973
|
+
);
|
|
974
|
+
X(() => {
|
|
975
|
+
if (!f) return;
|
|
976
|
+
const t = (E) => {
|
|
977
|
+
const T = e.find((P) => P.key === f.key);
|
|
978
|
+
if (T)
|
|
979
|
+
if (f.mode === "move")
|
|
980
|
+
c(f.key, {
|
|
981
|
+
x: E.clientX - f.offsetX,
|
|
982
|
+
y: E.clientY - f.offsetY
|
|
983
|
+
});
|
|
984
|
+
else {
|
|
985
|
+
const S = s.current?.getBoundingClientRect(), u = S?.left ?? 0, y = S?.top ?? 0;
|
|
986
|
+
c(f.key, {
|
|
987
|
+
width: Math.max(200, E.clientX - u - T.x),
|
|
988
|
+
height: Math.max(100, E.clientY - y - T.y)
|
|
989
|
+
});
|
|
990
|
+
}
|
|
991
|
+
}, l = () => N(null);
|
|
992
|
+
return document.addEventListener("mousemove", t), document.addEventListener("mouseup", l), () => {
|
|
993
|
+
document.removeEventListener("mousemove", t), document.removeEventListener("mouseup", l);
|
|
994
|
+
};
|
|
995
|
+
}, [f, e, c]);
|
|
996
|
+
const O = b(
|
|
997
|
+
(t, l, E) => {
|
|
998
|
+
l.preventDefault();
|
|
999
|
+
const T = e.find((P) => P.key === t);
|
|
1000
|
+
T && (v(t), N({
|
|
1001
|
+
key: t,
|
|
1002
|
+
offsetX: E === "move" ? l.clientX - T.x : 0,
|
|
1003
|
+
offsetY: E === "move" ? l.clientY - T.y : 0,
|
|
1004
|
+
mode: E
|
|
1005
|
+
}));
|
|
1006
|
+
},
|
|
1007
|
+
[e, v]
|
|
1008
|
+
);
|
|
1009
|
+
return /* @__PURE__ */ z(
|
|
1010
|
+
"div",
|
|
1011
|
+
{
|
|
1012
|
+
ref: (t) => {
|
|
1013
|
+
s.current = t, typeof a == "function" ? a(t) : a && (a.current = t);
|
|
1014
|
+
},
|
|
1015
|
+
id: M,
|
|
1016
|
+
className: `nice-wm nice-wm--${d} ${m ?? ""}`,
|
|
1017
|
+
style: { ...g, position: "relative", overflow: "hidden" },
|
|
1018
|
+
...x,
|
|
1019
|
+
children: [
|
|
1020
|
+
e.map((t) => {
|
|
1021
|
+
if (t.minimized) return null;
|
|
1022
|
+
const l = t.maximized, E = l ? { position: "absolute", top: 0, left: 0, width: "100%", height: "100%", zIndex: t.zIndex ?? 1 } : { position: "absolute", top: t.y, left: t.x, width: t.width, height: t.height, zIndex: t.zIndex ?? 1 };
|
|
1023
|
+
return /* @__PURE__ */ z(
|
|
1024
|
+
"div",
|
|
1025
|
+
{
|
|
1026
|
+
className: `nice-wm__window ${l ? "nice-wm__window--maximized" : ""}`,
|
|
1027
|
+
style: E,
|
|
1028
|
+
onMouseDown: () => v(t.key),
|
|
1029
|
+
role: "dialog",
|
|
1030
|
+
"aria-label": t.title,
|
|
1031
|
+
children: [
|
|
1032
|
+
/* @__PURE__ */ z(
|
|
1033
|
+
"div",
|
|
1034
|
+
{
|
|
1035
|
+
className: "nice-wm__titlebar",
|
|
1036
|
+
onMouseDown: (T) => !l && O(t.key, T, "move"),
|
|
1037
|
+
children: [
|
|
1038
|
+
t.icon && /* @__PURE__ */ o("span", { className: "nice-wm__icon", children: t.icon }),
|
|
1039
|
+
/* @__PURE__ */ o("span", { className: "nice-wm__title", children: t.title }),
|
|
1040
|
+
/* @__PURE__ */ z("div", { className: "nice-wm__controls", children: [
|
|
1041
|
+
(t.minimizable ?? !0) && /* @__PURE__ */ o("button", { type: "button", className: "nice-wm__ctrl-btn nice-wm__ctrl-btn--min", onClick: () => I(t.key), title: C("wm.minimize", "Minimize"), children: "─" }),
|
|
1042
|
+
(t.maximizable ?? !0) && /* @__PURE__ */ o("button", { type: "button", className: "nice-wm__ctrl-btn nice-wm__ctrl-btn--max", onClick: () => R(t.key), title: C("wm.maximize", "Maximize"), children: l ? "❐" : "☐" }),
|
|
1043
|
+
(t.closable ?? !0) && /* @__PURE__ */ o("button", { type: "button", className: "nice-wm__ctrl-btn nice-wm__ctrl-btn--close", onClick: () => _(t.key), title: C("wm.close", "Close"), children: "✕" })
|
|
1044
|
+
] })
|
|
1045
|
+
]
|
|
1046
|
+
}
|
|
1047
|
+
),
|
|
1048
|
+
/* @__PURE__ */ o("div", { className: "nice-wm__body", children: t.content }),
|
|
1049
|
+
(t.resizable ?? !0) && !l && /* @__PURE__ */ o(
|
|
1050
|
+
"div",
|
|
1051
|
+
{
|
|
1052
|
+
className: "nice-wm__resize-handle",
|
|
1053
|
+
onMouseDown: (T) => O(t.key, T, "resize")
|
|
1054
|
+
}
|
|
1055
|
+
)
|
|
1056
|
+
]
|
|
1057
|
+
},
|
|
1058
|
+
t.key
|
|
1059
|
+
);
|
|
1060
|
+
}),
|
|
1061
|
+
h && /* @__PURE__ */ o("div", { className: "nice-wm__taskbar", role: "toolbar", "aria-label": C("wm.taskbar", "Taskbar"), children: e.map((t) => /* @__PURE__ */ z(
|
|
1062
|
+
"button",
|
|
1063
|
+
{
|
|
1064
|
+
type: "button",
|
|
1065
|
+
className: `nice-wm__taskbar-btn ${t.minimized ? "nice-wm__taskbar-btn--minimized" : ""}`,
|
|
1066
|
+
onClick: () => {
|
|
1067
|
+
t.minimized && I(t.key), v(t.key);
|
|
1068
|
+
},
|
|
1069
|
+
children: [
|
|
1070
|
+
t.icon && /* @__PURE__ */ o("span", { className: "nice-wm__taskbar-icon", children: t.icon }),
|
|
1071
|
+
/* @__PURE__ */ o("span", { className: "nice-wm__taskbar-label", children: t.title })
|
|
1072
|
+
]
|
|
1073
|
+
},
|
|
1074
|
+
t.key
|
|
1075
|
+
)) })
|
|
1076
|
+
]
|
|
1077
|
+
}
|
|
1078
|
+
);
|
|
1079
|
+
}
|
|
1080
|
+
);
|
|
1081
|
+
kt.displayName = "NiceWindowManager";
|
|
1082
|
+
function Et(e, n) {
|
|
1083
|
+
const r = document.querySelector(e);
|
|
1084
|
+
if (!r) return null;
|
|
1085
|
+
const i = r.getBoundingClientRect();
|
|
1086
|
+
return {
|
|
1087
|
+
top: i.top - n + window.scrollY,
|
|
1088
|
+
left: i.left - n + window.scrollX,
|
|
1089
|
+
width: i.width + n * 2,
|
|
1090
|
+
height: i.height + n * 2
|
|
1091
|
+
};
|
|
1092
|
+
}
|
|
1093
|
+
function Mt(e, n, r, i) {
|
|
1094
|
+
const d = { w: window.innerWidth, h: window.innerHeight + window.scrollY }, m = {
|
|
1095
|
+
top: { top: e.top - r - 12, left: e.left + e.width / 2 - n / 2 },
|
|
1096
|
+
bottom: { top: e.top + e.height + 12, left: e.left + e.width / 2 - n / 2 },
|
|
1097
|
+
left: { top: e.top + e.height / 2 - r / 2, left: e.left - n - 12 },
|
|
1098
|
+
right: { top: e.top + e.height / 2 - r / 2, left: e.left + e.width + 12 }
|
|
1099
|
+
};
|
|
1100
|
+
if (i && i !== "auto")
|
|
1101
|
+
return { ...m[i], actualPlacement: i };
|
|
1102
|
+
for (const g of ["bottom", "top", "right", "left"]) {
|
|
1103
|
+
const p = m[g];
|
|
1104
|
+
if (p.top >= 0 && p.left >= 0 && p.top + r <= d.h && p.left + n <= d.w)
|
|
1105
|
+
return { ...p, actualPlacement: g };
|
|
1106
|
+
}
|
|
1107
|
+
return { ...m.bottom, actualPlacement: "bottom" };
|
|
1108
|
+
}
|
|
1109
|
+
const Oe = ({
|
|
1110
|
+
steps: e,
|
|
1111
|
+
active: n,
|
|
1112
|
+
onFinish: r,
|
|
1113
|
+
onSkip: i,
|
|
1114
|
+
onStepChange: h,
|
|
1115
|
+
closeOnEscape: d = !0,
|
|
1116
|
+
closeOnOverlayClick: m = !1,
|
|
1117
|
+
showProgress: g = !0,
|
|
1118
|
+
showSkipButton: p = !0,
|
|
1119
|
+
labels: x,
|
|
1120
|
+
animationDuration: a = 300,
|
|
1121
|
+
overlayOpacity: M = 0.6,
|
|
1122
|
+
zIndex: C = 1e4
|
|
1123
|
+
}) => {
|
|
1124
|
+
const [f, N] = D(0), [s, k] = D(null), [c, v] = D({ w: 340, h: 200 }), [_, I] = D(!0), R = q(null), O = q(-1), t = e[f], l = f === e.length - 1, E = f === 0, T = x?.next ?? "Next", P = x?.back ?? "Back", S = x?.finish ?? "Finish", u = x?.skip ?? "Skip", y = x?.stepOf ?? "of";
|
|
1125
|
+
X(() => {
|
|
1126
|
+
if (R.current) {
|
|
1127
|
+
const L = R.current.getBoundingClientRect();
|
|
1128
|
+
v({ w: L.width, h: L.height });
|
|
1129
|
+
}
|
|
1130
|
+
}, [f, n]), X(() => {
|
|
1131
|
+
if (!n || !t) return;
|
|
1132
|
+
const L = () => {
|
|
1133
|
+
const B = Et(t.target, t.highlightPadding ?? 8);
|
|
1134
|
+
k(B);
|
|
1135
|
+
};
|
|
1136
|
+
if (L(), t.scrollIntoView !== !1) {
|
|
1137
|
+
document.querySelector(t.target)?.scrollIntoView({ behavior: "smooth", block: "center" });
|
|
1138
|
+
const ye = setTimeout(L, 350);
|
|
1139
|
+
return () => clearTimeout(ye);
|
|
1140
|
+
}
|
|
1141
|
+
}, [n, t, f]), X(() => {
|
|
1142
|
+
!n || !t || O.current !== f && (O.current >= 0 && O.current < e.length && e[O.current]?.onLeave?.(), t.onEnter?.(), O.current = f);
|
|
1143
|
+
}, [n, t, f, e]), X(() => {
|
|
1144
|
+
if (!n || !t?.advanceOn) return;
|
|
1145
|
+
const L = document.querySelector(t.target);
|
|
1146
|
+
if (!L) return;
|
|
1147
|
+
const B = () => w();
|
|
1148
|
+
return L.addEventListener(t.advanceOn.event, B), () => L.removeEventListener(t.advanceOn.event, B);
|
|
1149
|
+
}, [n, t, f]), X(() => {
|
|
1150
|
+
if (!n) return;
|
|
1151
|
+
const L = (B) => {
|
|
1152
|
+
B.key === "Escape" && d ? i?.() : B.key === "ArrowRight" ? w() : B.key === "ArrowLeft" && A();
|
|
1153
|
+
};
|
|
1154
|
+
return document.addEventListener("keydown", L), () => document.removeEventListener("keydown", L);
|
|
1155
|
+
}, [n, f, d]), X(() => {
|
|
1156
|
+
I(!0);
|
|
1157
|
+
const L = setTimeout(() => I(!1), a);
|
|
1158
|
+
return () => clearTimeout(L);
|
|
1159
|
+
}, [f, a]);
|
|
1160
|
+
const w = b(() => {
|
|
1161
|
+
if (l)
|
|
1162
|
+
t?.onLeave?.(), r?.();
|
|
1163
|
+
else {
|
|
1164
|
+
const L = f + 1;
|
|
1165
|
+
N(L), h?.(L);
|
|
1166
|
+
}
|
|
1167
|
+
}, [f, l, r, h, t]), A = b(() => {
|
|
1168
|
+
if (!E) {
|
|
1169
|
+
const L = f - 1;
|
|
1170
|
+
N(L), h?.(L);
|
|
1171
|
+
}
|
|
1172
|
+
}, [f, E, h]), Y = ve(() => s ? Mt(s, c.w, c.h, t?.placement) : { top: window.innerHeight / 2, left: window.innerWidth / 2, actualPlacement: "bottom" }, [s, c, t?.placement]);
|
|
1173
|
+
if (!n || !t) return null;
|
|
1174
|
+
const ne = Math.max(document.documentElement.scrollWidth, window.innerWidth), ae = Math.max(document.documentElement.scrollHeight, window.innerHeight);
|
|
1175
|
+
return /* @__PURE__ */ z("div", { className: "nice-tutorial", style: { zIndex: C }, "aria-modal": "true", role: "dialog", "aria-label": "Tutorial", children: [
|
|
1176
|
+
/* @__PURE__ */ z(
|
|
1177
|
+
"svg",
|
|
1178
|
+
{
|
|
1179
|
+
className: "nice-tutorial__overlay",
|
|
1180
|
+
style: { position: "absolute", top: 0, left: 0, width: ne, height: ae, pointerEvents: "auto" },
|
|
1181
|
+
onClick: m ? i : void 0,
|
|
1182
|
+
children: [
|
|
1183
|
+
/* @__PURE__ */ o("defs", { children: /* @__PURE__ */ z("mask", { id: "nice-tutorial-mask", children: [
|
|
1184
|
+
/* @__PURE__ */ o("rect", { x: "0", y: "0", width: "100%", height: "100%", fill: "white" }),
|
|
1185
|
+
s && /* @__PURE__ */ o(
|
|
1186
|
+
"rect",
|
|
1187
|
+
{
|
|
1188
|
+
x: s.left,
|
|
1189
|
+
y: s.top,
|
|
1190
|
+
width: s.width,
|
|
1191
|
+
height: s.height,
|
|
1192
|
+
rx: "8",
|
|
1193
|
+
fill: "black",
|
|
1194
|
+
className: _ ? "nice-tutorial__spotlight--entering" : ""
|
|
1195
|
+
}
|
|
1196
|
+
)
|
|
1197
|
+
] }) }),
|
|
1198
|
+
/* @__PURE__ */ o(
|
|
1199
|
+
"rect",
|
|
1200
|
+
{
|
|
1201
|
+
x: "0",
|
|
1202
|
+
y: "0",
|
|
1203
|
+
width: "100%",
|
|
1204
|
+
height: "100%",
|
|
1205
|
+
fill: `rgba(0,0,0,${M})`,
|
|
1206
|
+
mask: "url(#nice-tutorial-mask)"
|
|
1207
|
+
}
|
|
1208
|
+
)
|
|
1209
|
+
]
|
|
1210
|
+
}
|
|
1211
|
+
),
|
|
1212
|
+
s && /* @__PURE__ */ o(
|
|
1213
|
+
"div",
|
|
1214
|
+
{
|
|
1215
|
+
className: `nice-tutorial__highlight ${_ ? "nice-tutorial__highlight--entering" : ""}`,
|
|
1216
|
+
style: {
|
|
1217
|
+
position: "absolute",
|
|
1218
|
+
top: s.top,
|
|
1219
|
+
left: s.left,
|
|
1220
|
+
width: s.width,
|
|
1221
|
+
height: s.height,
|
|
1222
|
+
transition: `all ${a}ms ease`
|
|
1223
|
+
}
|
|
1224
|
+
}
|
|
1225
|
+
),
|
|
1226
|
+
t.disableInteraction && s && /* @__PURE__ */ o(
|
|
1227
|
+
"div",
|
|
1228
|
+
{
|
|
1229
|
+
className: "nice-tutorial__blocker",
|
|
1230
|
+
style: {
|
|
1231
|
+
position: "absolute",
|
|
1232
|
+
top: s.top,
|
|
1233
|
+
left: s.left,
|
|
1234
|
+
width: s.width,
|
|
1235
|
+
height: s.height
|
|
1236
|
+
}
|
|
1237
|
+
}
|
|
1238
|
+
),
|
|
1239
|
+
/* @__PURE__ */ z(
|
|
1240
|
+
"div",
|
|
1241
|
+
{
|
|
1242
|
+
ref: R,
|
|
1243
|
+
className: `nice-tutorial__tooltip nice-tutorial__tooltip--${Y.actualPlacement} ${_ ? "nice-tutorial__tooltip--entering" : ""}`,
|
|
1244
|
+
style: {
|
|
1245
|
+
position: "absolute",
|
|
1246
|
+
top: Y.top,
|
|
1247
|
+
left: Y.left,
|
|
1248
|
+
transition: `all ${a}ms ease`,
|
|
1249
|
+
maxWidth: 380,
|
|
1250
|
+
zIndex: C + 1
|
|
1251
|
+
},
|
|
1252
|
+
children: [
|
|
1253
|
+
t.showArrow !== !1 && /* @__PURE__ */ o("div", { className: `nice-tutorial__arrow nice-tutorial__arrow--${Y.actualPlacement}` }),
|
|
1254
|
+
/* @__PURE__ */ z("div", { className: "nice-tutorial__header", children: [
|
|
1255
|
+
/* @__PURE__ */ o("h4", { className: "nice-tutorial__title", children: t.title }),
|
|
1256
|
+
p && /* @__PURE__ */ o(
|
|
1257
|
+
"button",
|
|
1258
|
+
{
|
|
1259
|
+
type: "button",
|
|
1260
|
+
className: "nice-tutorial__close",
|
|
1261
|
+
onClick: i,
|
|
1262
|
+
"aria-label": u,
|
|
1263
|
+
children: "✕"
|
|
1264
|
+
}
|
|
1265
|
+
)
|
|
1266
|
+
] }),
|
|
1267
|
+
/* @__PURE__ */ o("div", { className: "nice-tutorial__content", dangerouslySetInnerHTML: { __html: pt(t.content) } }),
|
|
1268
|
+
/* @__PURE__ */ z("div", { className: "nice-tutorial__footer", children: [
|
|
1269
|
+
g && /* @__PURE__ */ z("div", { className: "nice-tutorial__progress", children: [
|
|
1270
|
+
e.map((L, B) => /* @__PURE__ */ o(
|
|
1271
|
+
"span",
|
|
1272
|
+
{
|
|
1273
|
+
className: `nice-tutorial__dot ${B === f ? "nice-tutorial__dot--active" : ""} ${B < f ? "nice-tutorial__dot--done" : ""}`
|
|
1274
|
+
},
|
|
1275
|
+
B
|
|
1276
|
+
)),
|
|
1277
|
+
/* @__PURE__ */ z("span", { className: "nice-tutorial__step-label", children: [
|
|
1278
|
+
f + 1,
|
|
1279
|
+
" ",
|
|
1280
|
+
y,
|
|
1281
|
+
" ",
|
|
1282
|
+
e.length
|
|
1283
|
+
] })
|
|
1284
|
+
] }),
|
|
1285
|
+
/* @__PURE__ */ z("div", { className: "nice-tutorial__actions", children: [
|
|
1286
|
+
p && !l && /* @__PURE__ */ o("button", { type: "button", className: "nice-tutorial__btn nice-tutorial__btn--skip", onClick: i, children: u }),
|
|
1287
|
+
!E && /* @__PURE__ */ o("button", { type: "button", className: "nice-tutorial__btn nice-tutorial__btn--back", onClick: A, children: P }),
|
|
1288
|
+
!t.waitForAction && /* @__PURE__ */ o("button", { type: "button", className: "nice-tutorial__btn nice-tutorial__btn--next", onClick: w, children: l ? S : T })
|
|
1289
|
+
] })
|
|
1290
|
+
] })
|
|
1291
|
+
]
|
|
1292
|
+
}
|
|
1293
|
+
)
|
|
1294
|
+
] });
|
|
1295
|
+
};
|
|
1296
|
+
Oe.displayName = "NiceTutorial";
|
|
1297
|
+
const He = Ye({
|
|
1298
|
+
startTutorial: () => {
|
|
1299
|
+
},
|
|
1300
|
+
stopTutorial: () => {
|
|
1301
|
+
},
|
|
1302
|
+
isActive: !1,
|
|
1303
|
+
currentStep: 0,
|
|
1304
|
+
nextStep: () => {
|
|
1305
|
+
},
|
|
1306
|
+
prevStep: () => {
|
|
1307
|
+
},
|
|
1308
|
+
goToStep: () => {
|
|
1309
|
+
}
|
|
1310
|
+
});
|
|
1311
|
+
function Zt() {
|
|
1312
|
+
return Pe(He);
|
|
1313
|
+
}
|
|
1314
|
+
const zt = ({ children: e }) => {
|
|
1315
|
+
const [n, r] = D([]), [i, h] = D(!1), [d, m] = D(0), g = b((f) => {
|
|
1316
|
+
r(f), m(0), h(!0);
|
|
1317
|
+
}, []), p = b(() => {
|
|
1318
|
+
h(!1), m(0), r([]);
|
|
1319
|
+
}, []), x = b(() => {
|
|
1320
|
+
m((f) => Math.min(f + 1, n.length - 1));
|
|
1321
|
+
}, [n.length]), a = b(() => {
|
|
1322
|
+
m((f) => Math.max(f - 1, 0));
|
|
1323
|
+
}, []), M = b((f) => {
|
|
1324
|
+
m(Math.max(0, Math.min(f, n.length - 1)));
|
|
1325
|
+
}, [n.length]), C = {
|
|
1326
|
+
startTutorial: g,
|
|
1327
|
+
stopTutorial: p,
|
|
1328
|
+
isActive: i,
|
|
1329
|
+
currentStep: d,
|
|
1330
|
+
nextStep: x,
|
|
1331
|
+
prevStep: a,
|
|
1332
|
+
goToStep: M
|
|
1333
|
+
};
|
|
1334
|
+
return /* @__PURE__ */ z(He.Provider, { value: C, children: [
|
|
1335
|
+
e,
|
|
1336
|
+
i && n.length > 0 && /* @__PURE__ */ o(
|
|
1337
|
+
Oe,
|
|
1338
|
+
{
|
|
1339
|
+
steps: n,
|
|
1340
|
+
active: i,
|
|
1341
|
+
onFinish: p,
|
|
1342
|
+
onSkip: p,
|
|
1343
|
+
onStepChange: m
|
|
1344
|
+
}
|
|
1345
|
+
)
|
|
1346
|
+
] });
|
|
1347
|
+
};
|
|
1348
|
+
zt.displayName = "NiceTutorialProvider";
|
|
1349
|
+
function It(e, n, r, i, h) {
|
|
1350
|
+
const d = e <= h, m = e + h >= r, g = n <= h, p = n + h >= i;
|
|
1351
|
+
return g && d ? "top-left" : g && m ? "top-right" : p && d ? "bottom-left" : p && m ? "bottom-right" : d ? "left" : m ? "right" : g ? "top" : p ? "bottom" : "none";
|
|
1352
|
+
}
|
|
1353
|
+
function Ct(e) {
|
|
1354
|
+
switch (e) {
|
|
1355
|
+
case "left":
|
|
1356
|
+
return { left: 0, top: 0, width: "50%", height: "100%" };
|
|
1357
|
+
case "right":
|
|
1358
|
+
return { left: "50%", top: 0, width: "50%", height: "100%" };
|
|
1359
|
+
case "top":
|
|
1360
|
+
return { left: 0, top: 0, width: "100%", height: "50%" };
|
|
1361
|
+
case "bottom":
|
|
1362
|
+
return { left: 0, top: "50%", width: "100%", height: "50%" };
|
|
1363
|
+
case "top-left":
|
|
1364
|
+
return { left: 0, top: 0, width: "50%", height: "50%" };
|
|
1365
|
+
case "top-right":
|
|
1366
|
+
return { left: "50%", top: 0, width: "50%", height: "50%" };
|
|
1367
|
+
case "bottom-left":
|
|
1368
|
+
return { left: 0, top: "50%", width: "50%", height: "50%" };
|
|
1369
|
+
case "bottom-right":
|
|
1370
|
+
return { left: "50%", top: "50%", width: "50%", height: "50%" };
|
|
1371
|
+
default:
|
|
1372
|
+
return null;
|
|
1373
|
+
}
|
|
1374
|
+
}
|
|
1375
|
+
const Tt = Te(
|
|
1376
|
+
({
|
|
1377
|
+
windowKey: e,
|
|
1378
|
+
title: n,
|
|
1379
|
+
icon: r,
|
|
1380
|
+
children: i,
|
|
1381
|
+
footer: h,
|
|
1382
|
+
x: d = 100,
|
|
1383
|
+
y: m = 100,
|
|
1384
|
+
width: g = 480,
|
|
1385
|
+
height: p = 360,
|
|
1386
|
+
minWidth: x = 200,
|
|
1387
|
+
minHeight: a = 120,
|
|
1388
|
+
maxWidth: M,
|
|
1389
|
+
maxHeight: C,
|
|
1390
|
+
zIndex: f = 1,
|
|
1391
|
+
closable: N = !0,
|
|
1392
|
+
minimizable: s = !0,
|
|
1393
|
+
maximizable: k = !0,
|
|
1394
|
+
fullscreenable: c = !1,
|
|
1395
|
+
pinnable: v = !1,
|
|
1396
|
+
resizable: _ = !0,
|
|
1397
|
+
draggable: I = !0,
|
|
1398
|
+
snappable: R = !0,
|
|
1399
|
+
snapThreshold: O = 20,
|
|
1400
|
+
minimized: t,
|
|
1401
|
+
maximized: l,
|
|
1402
|
+
fullscreen: E,
|
|
1403
|
+
pinned: T,
|
|
1404
|
+
focused: P,
|
|
1405
|
+
onClose: S,
|
|
1406
|
+
onMinimize: u,
|
|
1407
|
+
onMaximize: y,
|
|
1408
|
+
onFullscreen: w,
|
|
1409
|
+
onPin: A,
|
|
1410
|
+
onFocus: Y,
|
|
1411
|
+
onMove: ne,
|
|
1412
|
+
onResize: ae,
|
|
1413
|
+
onSnap: L,
|
|
1414
|
+
onTitleBarDoubleClick: B,
|
|
1415
|
+
size: ye = "md",
|
|
1416
|
+
statusBar: Re,
|
|
1417
|
+
titleBarActions: qe,
|
|
1418
|
+
className: Be,
|
|
1419
|
+
style: Ae,
|
|
1420
|
+
id: $e,
|
|
1421
|
+
accessMode: We,
|
|
1422
|
+
...Fe
|
|
1423
|
+
}, Ue) => {
|
|
1424
|
+
const Ge = Ce($e), Ve = _t(We, $e), { t: le } = be();
|
|
1425
|
+
if (Ve === "hidden") return null;
|
|
1426
|
+
const [pe, re] = D({ x: d, y: m }), [_e, ge] = D({ width: g, height: p }), [je, Qe] = D(!1), [Ze, Je] = D(!1), [Ke, et] = D(!1), [tt, nt] = D(!1), [V, xe] = D("none"), it = t ?? je, G = l ?? Ze, U = E ?? Ke, de = T ?? tt, Ne = P ?? !0, ie = pe.x, oe = pe.y, Z = _e.width, J = _e.height, j = q(null), F = q(null), H = q(null), ot = b(() => {
|
|
1427
|
+
S?.(e);
|
|
1428
|
+
}, [e, S]), rt = b(() => {
|
|
1429
|
+
Qe(!0), u?.(e);
|
|
1430
|
+
}, [e, u]), ke = b(() => {
|
|
1431
|
+
const $ = !G;
|
|
1432
|
+
Je($), !$ && H.current ? (re({ x: H.current.x, y: H.current.y }), ge({ width: H.current.w, height: H.current.h }), H.current = null) : $ && (H.current = { x: ie, y: oe, w: Z, h: J }), xe("none"), y?.(e, $);
|
|
1433
|
+
}, [e, G, ie, oe, Z, J, y]), Ee = b(() => {
|
|
1434
|
+
const $ = !U;
|
|
1435
|
+
et($), $ ? H.current = { x: ie, y: oe, w: Z, h: J } : H.current && (re({ x: H.current.x, y: H.current.y }), ge({ width: H.current.w, height: H.current.h }), H.current = null), w?.(e, $);
|
|
1436
|
+
}, [e, U, ie, oe, Z, J, w]), ct = b(() => {
|
|
1437
|
+
const $ = !de;
|
|
1438
|
+
nt($), A?.(e, $);
|
|
1439
|
+
}, [e, de, A]), ue = b(() => {
|
|
1440
|
+
Y?.(e);
|
|
1441
|
+
}, [e, Y]), st = b(() => {
|
|
1442
|
+
B ? B(e) : k && ke();
|
|
1443
|
+
}, [e, k, ke, B]);
|
|
1444
|
+
X(() => {
|
|
1445
|
+
if (!j.current) return;
|
|
1446
|
+
const $ = (K) => {
|
|
1447
|
+
if (!j.current) return;
|
|
1448
|
+
const Q = K.clientX - j.current.startX + j.current.origX, me = K.clientY - j.current.startY + j.current.origY;
|
|
1449
|
+
re({ x: Q, y: me }), ne?.(e, { x: Q, y: me });
|
|
1450
|
+
}, W = (K) => {
|
|
1451
|
+
if (j.current) {
|
|
1452
|
+
if (R) {
|
|
1453
|
+
const Q = It(K.clientX, K.clientY, window.innerWidth, window.innerHeight, O);
|
|
1454
|
+
Q !== "none" && (H.current = { x: pe.x, y: pe.y, w: Z, h: J }, xe(Q), L?.(e, Q));
|
|
1455
|
+
}
|
|
1456
|
+
j.current = null;
|
|
1457
|
+
}
|
|
1458
|
+
};
|
|
1459
|
+
return document.addEventListener("mousemove", $), document.addEventListener("mouseup", W), () => {
|
|
1460
|
+
document.removeEventListener("mousemove", $), document.removeEventListener("mouseup", W);
|
|
1461
|
+
};
|
|
1462
|
+
});
|
|
1463
|
+
const at = b(
|
|
1464
|
+
($) => {
|
|
1465
|
+
!I || G || U || ($.preventDefault(), V !== "none" && (H.current && (re({ x: H.current.x, y: H.current.y }), ge({ width: H.current.w, height: H.current.h })), xe("none")), ue(), j.current = { startX: $.clientX, startY: $.clientY, origX: ie, origY: oe });
|
|
1466
|
+
},
|
|
1467
|
+
[I, G, U, V, ie, oe, ue]
|
|
1468
|
+
);
|
|
1469
|
+
X(() => {
|
|
1470
|
+
if (!F.current) return;
|
|
1471
|
+
const $ = (K) => {
|
|
1472
|
+
if (!F.current) return;
|
|
1473
|
+
const Q = K.clientX - F.current.startX, me = K.clientY - F.current.startY, ce = F.current.handle;
|
|
1474
|
+
let ee = F.current.origW, te = F.current.origH;
|
|
1475
|
+
if (ce.includes("e") && (ee = F.current.origW + Q), ce.includes("w") && (ee = F.current.origW - Q), ce.includes("s") && (te = F.current.origH + me), ce.includes("n") && (te = F.current.origH - me), ee = Math.max(x, M ? Math.min(M, ee) : ee), te = Math.max(a, C ? Math.min(C, te) : te), ce.includes("w")) {
|
|
1476
|
+
const Me = _e.width - ee;
|
|
1477
|
+
re((he) => ({ ...he, x: he.x + Me }));
|
|
1478
|
+
}
|
|
1479
|
+
if (ce.includes("n")) {
|
|
1480
|
+
const Me = _e.height - te;
|
|
1481
|
+
re((he) => ({ ...he, y: he.y + Me }));
|
|
1482
|
+
}
|
|
1483
|
+
ge({ width: ee, height: te }), ae?.(e, { width: ee, height: te });
|
|
1484
|
+
}, W = () => {
|
|
1485
|
+
F.current = null;
|
|
1486
|
+
};
|
|
1487
|
+
return document.addEventListener("mousemove", $), document.addEventListener("mouseup", W), () => {
|
|
1488
|
+
document.removeEventListener("mousemove", $), document.removeEventListener("mouseup", W);
|
|
1489
|
+
};
|
|
1490
|
+
});
|
|
1491
|
+
const lt = b(
|
|
1492
|
+
($, W) => {
|
|
1493
|
+
!_ || G || U || V !== "none" || (W.preventDefault(), W.stopPropagation(), ue(), F.current = { startX: W.clientX, startY: W.clientY, origW: Z, origH: J, handle: $ });
|
|
1494
|
+
},
|
|
1495
|
+
[_, G, U, V, Z, J, ue]
|
|
1496
|
+
);
|
|
1497
|
+
if (X(() => {
|
|
1498
|
+
if (!Ne) return;
|
|
1499
|
+
const $ = (W) => {
|
|
1500
|
+
W.key === "Escape" && U && Ee();
|
|
1501
|
+
};
|
|
1502
|
+
return document.addEventListener("keydown", $), () => document.removeEventListener("keydown", $);
|
|
1503
|
+
}, [Ne, U, Ee]), it) return null;
|
|
1504
|
+
const Se = V !== "none" ? Ct(V) : null, Le = G || U, dt = U ? { position: "fixed", top: 0, left: 0, width: "100vw", height: "100vh", zIndex: 999999 } : G ? { position: "absolute", top: 0, left: 0, width: "100%", height: "100%", zIndex: f } : Se ? { position: "absolute", ...Se, zIndex: f } : { position: "absolute", top: oe, left: ie, width: Z, height: J, zIndex: f }, ut = ["n", "e", "s", "w", "ne", "se", "sw", "nw"], mt = {
|
|
1505
|
+
n: "ns-resize",
|
|
1506
|
+
s: "ns-resize",
|
|
1507
|
+
e: "ew-resize",
|
|
1508
|
+
w: "ew-resize",
|
|
1509
|
+
ne: "nesw-resize",
|
|
1510
|
+
sw: "nesw-resize",
|
|
1511
|
+
nw: "nwse-resize",
|
|
1512
|
+
se: "nwse-resize"
|
|
1513
|
+
};
|
|
1514
|
+
return /* @__PURE__ */ z(
|
|
1515
|
+
"div",
|
|
1516
|
+
{
|
|
1517
|
+
ref: Ue,
|
|
1518
|
+
id: Ge,
|
|
1519
|
+
className: `nice-window nice-window--${ye} ${Ne ? "nice-window--focused" : ""} ${de ? "nice-window--pinned" : ""} ${Le ? "nice-window--maximized" : ""} ${V !== "none" ? `nice-window--snapped-${V}` : ""} ${Be ?? ""}`,
|
|
1520
|
+
style: { ...dt, ...Ae },
|
|
1521
|
+
onMouseDown: ue,
|
|
1522
|
+
role: "dialog",
|
|
1523
|
+
"aria-label": n,
|
|
1524
|
+
...Fe,
|
|
1525
|
+
children: [
|
|
1526
|
+
/* @__PURE__ */ z(
|
|
1527
|
+
"div",
|
|
1528
|
+
{
|
|
1529
|
+
className: "nice-window__titlebar",
|
|
1530
|
+
onMouseDown: at,
|
|
1531
|
+
onDoubleClick: st,
|
|
1532
|
+
children: [
|
|
1533
|
+
r && /* @__PURE__ */ o("span", { className: "nice-window__icon", children: r }),
|
|
1534
|
+
/* @__PURE__ */ o("span", { className: "nice-window__title", children: n }),
|
|
1535
|
+
/* @__PURE__ */ z("div", { className: "nice-window__actions", children: [
|
|
1536
|
+
qe,
|
|
1537
|
+
v && /* @__PURE__ */ o(
|
|
1538
|
+
"button",
|
|
1539
|
+
{
|
|
1540
|
+
type: "button",
|
|
1541
|
+
className: `nice-window__action nice-window__action--pin ${de ? "nice-window__action--active" : ""}`,
|
|
1542
|
+
onClick: ct,
|
|
1543
|
+
title: le("window.pin", de ? "Unpin" : "Pin"),
|
|
1544
|
+
children: "📌"
|
|
1545
|
+
}
|
|
1546
|
+
),
|
|
1547
|
+
s && /* @__PURE__ */ o(
|
|
1548
|
+
"button",
|
|
1549
|
+
{
|
|
1550
|
+
type: "button",
|
|
1551
|
+
className: "nice-window__action nice-window__action--minimize",
|
|
1552
|
+
onClick: rt,
|
|
1553
|
+
title: le("window.minimize", "Minimize"),
|
|
1554
|
+
children: "─"
|
|
1555
|
+
}
|
|
1556
|
+
),
|
|
1557
|
+
k && /* @__PURE__ */ o(
|
|
1558
|
+
"button",
|
|
1559
|
+
{
|
|
1560
|
+
type: "button",
|
|
1561
|
+
className: "nice-window__action nice-window__action--maximize",
|
|
1562
|
+
onClick: ke,
|
|
1563
|
+
title: le("window.maximize", G ? "Restore" : "Maximize"),
|
|
1564
|
+
children: G ? "❐" : "☐"
|
|
1565
|
+
}
|
|
1566
|
+
),
|
|
1567
|
+
c && /* @__PURE__ */ o(
|
|
1568
|
+
"button",
|
|
1569
|
+
{
|
|
1570
|
+
type: "button",
|
|
1571
|
+
className: "nice-window__action nice-window__action--fullscreen",
|
|
1572
|
+
onClick: Ee,
|
|
1573
|
+
title: le("window.fullscreen", U ? "Exit Full Screen" : "Full Screen"),
|
|
1574
|
+
children: U ? "⇲" : "⇱"
|
|
1575
|
+
}
|
|
1576
|
+
),
|
|
1577
|
+
N && /* @__PURE__ */ o(
|
|
1578
|
+
"button",
|
|
1579
|
+
{
|
|
1580
|
+
type: "button",
|
|
1581
|
+
className: "nice-window__action nice-window__action--close",
|
|
1582
|
+
onClick: ot,
|
|
1583
|
+
title: le("window.close", "Close"),
|
|
1584
|
+
children: "✕"
|
|
1585
|
+
}
|
|
1586
|
+
)
|
|
1587
|
+
] })
|
|
1588
|
+
]
|
|
1589
|
+
}
|
|
1590
|
+
),
|
|
1591
|
+
/* @__PURE__ */ o("div", { className: "nice-window__body", children: i }),
|
|
1592
|
+
h && /* @__PURE__ */ o("div", { className: "nice-window__footer", children: h }),
|
|
1593
|
+
Re && /* @__PURE__ */ o("div", { className: "nice-window__statusbar", children: Re }),
|
|
1594
|
+
_ && !Le && V === "none" && /* @__PURE__ */ o(se, { children: ut.map(($) => /* @__PURE__ */ o(
|
|
1595
|
+
"div",
|
|
1596
|
+
{
|
|
1597
|
+
className: `nice-window__resize nice-window__resize--${$}`,
|
|
1598
|
+
style: { cursor: mt[$] },
|
|
1599
|
+
onMouseDown: (W) => lt($, W)
|
|
1600
|
+
},
|
|
1601
|
+
$
|
|
1602
|
+
)) })
|
|
1603
|
+
]
|
|
1604
|
+
}
|
|
1605
|
+
);
|
|
1606
|
+
}
|
|
1607
|
+
);
|
|
1608
|
+
Tt.displayName = "NiceWindow";
|
|
1609
|
+
export {
|
|
1610
|
+
Dt as N,
|
|
1611
|
+
Nt as a,
|
|
1612
|
+
qt as b,
|
|
1613
|
+
Ut as c,
|
|
1614
|
+
xt as d,
|
|
1615
|
+
At as e,
|
|
1616
|
+
Ht as f,
|
|
1617
|
+
Ft as g,
|
|
1618
|
+
Pt as h,
|
|
1619
|
+
Xt as i,
|
|
1620
|
+
Ot as j,
|
|
1621
|
+
Yt as k,
|
|
1622
|
+
Bt as l,
|
|
1623
|
+
Wt as m,
|
|
1624
|
+
Vt as n,
|
|
1625
|
+
Gt as o,
|
|
1626
|
+
jt as p,
|
|
1627
|
+
Oe as q,
|
|
1628
|
+
zt as r,
|
|
1629
|
+
Tt as s,
|
|
1630
|
+
kt as t,
|
|
1631
|
+
yt as u,
|
|
1632
|
+
Qt as v,
|
|
1633
|
+
ze as w,
|
|
1634
|
+
vt as x,
|
|
1635
|
+
Zt as y
|
|
1636
|
+
};
|