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