@nice2dev/ui-3d 1.0.6 → 1.1.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (79) hide show
  1. package/dist/cjs/core/i18n.js +3 -3
  2. package/dist/cjs/dance/DanceBridge.js +13 -13
  3. package/dist/cjs/dance/DanceScoreEngine.js +8 -8
  4. package/dist/cjs/dance/PoseDetector.js +20 -20
  5. package/dist/cjs/material/NiceMaterialEditor.js +19 -19
  6. package/dist/cjs/model/ModelEditorLeftPanel.js +5 -5
  7. package/dist/cjs/model/ModelEditorMenuBar.js +6 -6
  8. package/dist/cjs/model/ModelEditorRightPanel.js +19 -19
  9. package/dist/cjs/model/ModelEditorSubComponents.js +10 -10
  10. package/dist/cjs/model/ModelEditorTimeline.js +6 -6
  11. package/dist/cjs/model/ModelEditorToolbar.js +4 -4
  12. package/dist/cjs/model/ModelEditorViewport.js +2 -2
  13. package/dist/cjs/model/ModelViewer.js +14 -14
  14. package/dist/cjs/model/NiceArmatureEditor.js +18 -18
  15. package/dist/cjs/model/NiceMorphTargetEditor.js +18 -18
  16. package/dist/cjs/model/NiceOctree.js +16 -16
  17. package/dist/cjs/model/NicePhysicsSimulation.js +24 -24
  18. package/dist/cjs/model/NiceProceduralGeometry.js +8 -8
  19. package/dist/cjs/model/NiceTerrainEditor.js +19 -19
  20. package/dist/cjs/model/NiceWeightPainter.js +14 -14
  21. package/dist/cjs/model/NiceXRPreview.js +18 -18
  22. package/dist/cjs/model/useModelEditor.js +127 -127
  23. package/dist/cjs/model/useModelViewer.js +61 -61
  24. package/dist/cjs/particle/NiceParticleEditor.js +11 -11
  25. package/dist/cjs/rendering/NiceCascadedShadows.js +12 -12
  26. package/dist/cjs/rendering/NiceRenderExport.js +5 -5
  27. package/dist/cjs/rendering/NiceSSAO.js +18 -18
  28. package/dist/cjs/rendering/NiceSSR.js +14 -14
  29. package/dist/cjs/rendering/NiceWebGPURenderer.js +21 -21
  30. package/dist/cjs/ui/dist/NiceButton-D9l39Rs7.js +598 -0
  31. package/dist/cjs/ui/dist/NiceButton-D9l39Rs7.js.map +1 -0
  32. package/dist/cjs/ui/dist/NiceErrorBoundary-niMx1aSJ.js +647 -0
  33. package/dist/cjs/ui/dist/NiceErrorBoundary-niMx1aSJ.js.map +1 -0
  34. package/dist/cjs/ui/dist/NiceModuleLifecyclePanel-I_TXRiiY.js +5048 -0
  35. package/dist/cjs/ui/dist/NiceModuleLifecyclePanel-I_TXRiiY.js.map +1 -0
  36. package/dist/cjs/ui/dist/NicePinCodeInput-CrMfdxxc.js +13081 -0
  37. package/dist/cjs/ui/dist/NicePinCodeInput-CrMfdxxc.js.map +1 -0
  38. package/dist/cjs/ui/dist/NiceSavedQueryPanel-CUAsdOjJ.js +6054 -0
  39. package/dist/cjs/ui/dist/NiceSavedQueryPanel-CUAsdOjJ.js.map +1 -0
  40. package/dist/cjs/ui/dist/NiceToggle-CaY1u82g.js +280 -0
  41. package/dist/cjs/ui/dist/NiceToggle-CaY1u82g.js.map +1 -0
  42. package/dist/cjs/ui/dist/NiceWindow-SiCaREbq.js +806 -0
  43. package/dist/cjs/ui/dist/NiceWindow-SiCaREbq.js.map +1 -0
  44. package/dist/cjs/ui/dist/charts-Bx_kNBsE.js +3508 -0
  45. package/dist/cjs/ui/dist/charts-Bx_kNBsE.js.map +1 -0
  46. package/dist/cjs/ui/dist/core-BpghV7Ls.js +10249 -0
  47. package/dist/cjs/ui/dist/core-BpghV7Ls.js.map +1 -0
  48. package/dist/cjs/ui/dist/index-CIl98Vbm.js +40039 -0
  49. package/dist/cjs/ui/dist/index-CIl98Vbm.js.map +1 -0
  50. package/dist/cjs/uv/NiceUVEditor.js +24 -24
  51. package/dist/esm/model/ModelEditorLeftPanel.js +4 -4
  52. package/dist/esm/model/ModelEditorMenuBar.js +4 -4
  53. package/dist/esm/model/ModelEditorRightPanel.js +5 -5
  54. package/dist/esm/model/ModelEditorSubComponents.js +2 -2
  55. package/dist/esm/model/ModelEditorTimeline.js +5 -5
  56. package/dist/esm/model/ModelEditorToolbar.js +3 -3
  57. package/dist/esm/model/ModelEditorViewport.js +2 -2
  58. package/dist/esm/model/ModelViewer.js +2 -2
  59. package/dist/esm/ui/dist/NiceButton-D9l39Rs7.js +593 -0
  60. package/dist/esm/ui/dist/NiceButton-D9l39Rs7.js.map +1 -0
  61. package/dist/esm/ui/dist/NiceErrorBoundary-niMx1aSJ.js +637 -0
  62. package/dist/esm/ui/dist/NiceErrorBoundary-niMx1aSJ.js.map +1 -0
  63. package/dist/esm/ui/dist/NiceModuleLifecyclePanel-I_TXRiiY.js +5007 -0
  64. package/dist/esm/ui/dist/NiceModuleLifecyclePanel-I_TXRiiY.js.map +1 -0
  65. package/dist/esm/ui/dist/NicePinCodeInput-CrMfdxxc.js +13011 -0
  66. package/dist/esm/ui/dist/NicePinCodeInput-CrMfdxxc.js.map +1 -0
  67. package/dist/esm/ui/dist/NiceSavedQueryPanel-CUAsdOjJ.js +6037 -0
  68. package/dist/esm/ui/dist/NiceSavedQueryPanel-CUAsdOjJ.js.map +1 -0
  69. package/dist/esm/ui/dist/NiceToggle-CaY1u82g.js +276 -0
  70. package/dist/esm/ui/dist/NiceToggle-CaY1u82g.js.map +1 -0
  71. package/dist/esm/ui/dist/NiceWindow-SiCaREbq.js +795 -0
  72. package/dist/esm/ui/dist/NiceWindow-SiCaREbq.js.map +1 -0
  73. package/dist/esm/ui/dist/charts-Bx_kNBsE.js +3483 -0
  74. package/dist/esm/ui/dist/charts-Bx_kNBsE.js.map +1 -0
  75. package/dist/esm/ui/dist/core-BpghV7Ls.js +10071 -0
  76. package/dist/esm/ui/dist/core-BpghV7Ls.js.map +1 -0
  77. package/dist/esm/ui/dist/index-CIl98Vbm.js +39917 -0
  78. package/dist/esm/ui/dist/index-CIl98Vbm.js.map +1 -0
  79. package/package.json +1 -1
@@ -0,0 +1,806 @@
1
+ 'use strict';
2
+
3
+ var jsxRuntime = require('react/jsx-runtime');
4
+ var coreBpghV7Ls = require('./core-BpghV7Ls.js');
5
+ var ke = require('react');
6
+
7
+ const Mt = ({
8
+ visible: e,
9
+ onClose: n,
10
+ title: i,
11
+ items: r,
12
+ showCancelButton: m = true,
13
+ cancelText: a,
14
+ className: h,
15
+ style: w
16
+ }) => {
17
+ const { t: p } = coreBpghV7Ls.g();
18
+ return e ? /* @__PURE__ */ jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [
19
+ /* @__PURE__ */ jsxRuntime.jsx("div", { className: "nice-actionsheet__overlay", onClick: n }),
20
+ /* @__PURE__ */ jsxRuntime.jsxs("div", { className: `nice-actionsheet ${h || ""}`, style: w, children: [
21
+ i && /* @__PURE__ */ jsxRuntime.jsx("div", { className: "nice-actionsheet__title", children: i }),
22
+ /* @__PURE__ */ jsxRuntime.jsx("div", { className: "nice-actionsheet__items", children: r.map((N, s) => /* @__PURE__ */ jsxRuntime.jsxs(
23
+ "button",
24
+ {
25
+ className: `nice-actionsheet__item ${N.type === "danger" ? "nice-actionsheet__item--danger" : ""}`,
26
+ disabled: N.disabled,
27
+ onClick: () => {
28
+ N.onClick?.(), n();
29
+ },
30
+ children: [
31
+ N.icon && /* @__PURE__ */ jsxRuntime.jsx("span", { className: "nice-actionsheet__icon", children: N.icon }),
32
+ N.text
33
+ ]
34
+ },
35
+ s
36
+ )) }),
37
+ m && /* @__PURE__ */ jsxRuntime.jsx("button", { className: "nice-actionsheet__cancel", onClick: n, children: a || p("cancel", "Cancel") })
38
+ ] })
39
+ ] }) : null;
40
+ }, St = ({
41
+ visible: e,
42
+ onClose: n,
43
+ targetRef: i,
44
+ position: r = "bottom",
45
+ title: m,
46
+ showArrow: a = true,
47
+ width: h,
48
+ children: w,
49
+ className: p,
50
+ style: N,
51
+ displayStyle: s
52
+ }) => {
53
+ coreBpghV7Ls.i("tooltip", s);
54
+ const k = ke.useRef(null), [L, d] = ke.useState({ top: 0, left: 0 }), A = ke.useCallback(() => {
55
+ const _ = i.current, $ = k.current;
56
+ if (!_ || !$)
57
+ return;
58
+ const c = _.getBoundingClientRect(), v = $.getBoundingClientRect();
59
+ let u = 0, I = 0;
60
+ const R = 8;
61
+ switch (r) {
62
+ case "top":
63
+ u = c.top - v.height - R, I = c.left + (c.width - v.width) / 2;
64
+ break;
65
+ case "bottom":
66
+ u = c.bottom + R, I = c.left + (c.width - v.width) / 2;
67
+ break;
68
+ case "left":
69
+ u = c.top + (c.height - v.height) / 2, I = c.left - v.width - R;
70
+ break;
71
+ case "right":
72
+ u = c.top + (c.height - v.height) / 2, I = c.right + R;
73
+ break;
74
+ }
75
+ d({ top: u + window.scrollY, left: I + window.scrollX });
76
+ }, [i, r]);
77
+ return ke.useEffect(() => {
78
+ if (e) {
79
+ requestAnimationFrame(A);
80
+ const _ = ($) => {
81
+ k.current && !k.current.contains($.target) && i.current && !i.current.contains($.target) && n();
82
+ };
83
+ return document.addEventListener("mousedown", _), () => document.removeEventListener("mousedown", _);
84
+ }
85
+ }, [e, A, n, i]), e ? /* @__PURE__ */ jsxRuntime.jsxs(
86
+ "div",
87
+ {
88
+ ref: k,
89
+ className: `nice-popover nice-popover--${r} ${p || ""}`,
90
+ style: { ...N, position: "absolute", top: L.top, left: L.left, width: h },
91
+ children: [
92
+ a && /* @__PURE__ */ jsxRuntime.jsx("div", { className: `nice-popover__arrow nice-popover__arrow--${r}` }),
93
+ m && /* @__PURE__ */ jsxRuntime.jsx("div", { className: "nice-popover__title", children: m }),
94
+ /* @__PURE__ */ jsxRuntime.jsx("div", { className: "nice-popover__content", children: w })
95
+ ]
96
+ }
97
+ ) : null;
98
+ }, Rt = ({
99
+ visible: e,
100
+ message: n,
101
+ container: i,
102
+ showIndicator: r = true,
103
+ shading: m = true,
104
+ className: a,
105
+ style: h
106
+ }) => {
107
+ const { t: w } = coreBpghV7Ls.g();
108
+ if (!e)
109
+ return null;
110
+ const p = !!i?.current, N = /* @__PURE__ */ jsxRuntime.jsxs("div", { className: `nice-loadpanel ${a || ""}`, style: h, children: [
111
+ m && /* @__PURE__ */ jsxRuntime.jsx("div", { className: "nice-loadpanel__shade" }),
112
+ /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "nice-loadpanel__box", children: [
113
+ r && /* @__PURE__ */ jsxRuntime.jsx("div", { className: "nice-spinner nice-spinner--md" }),
114
+ /* @__PURE__ */ jsxRuntime.jsx("span", { className: "nice-loadpanel__text", children: n || w("loading", "Loading...") })
115
+ ] })
116
+ ] });
117
+ if (p && i.current) {
118
+ const s = i.current;
119
+ return s.style.position = s.style.position || "relative", N;
120
+ }
121
+ return N;
122
+ }, Lt = ({
123
+ direction: e = "row",
124
+ align: n,
125
+ justify: i,
126
+ wrap: r,
127
+ gap: m,
128
+ flex: a,
129
+ children: h,
130
+ className: w,
131
+ style: p
132
+ }) => /* @__PURE__ */ jsxRuntime.jsx(
133
+ "div",
134
+ {
135
+ className: `nice-box ${w || ""}`,
136
+ style: {
137
+ display: "flex",
138
+ flexDirection: e,
139
+ alignItems: n,
140
+ justifyContent: i,
141
+ flexWrap: r ? "wrap" : void 0,
142
+ gap: m,
143
+ flex: a,
144
+ ...p
145
+ },
146
+ children: h
147
+ }
148
+ ), Tt = ({
149
+ direction: e = "row",
150
+ items: n,
151
+ gap: i,
152
+ className: r,
153
+ style: m
154
+ }) => /* @__PURE__ */ jsxRuntime.jsx(
155
+ "div",
156
+ {
157
+ className: `nice-responsivebox ${r || ""}`,
158
+ style: { display: "flex", flexDirection: e, gap: i, ...m },
159
+ children: n.map((a, h) => /* @__PURE__ */ jsxRuntime.jsx(
160
+ "div",
161
+ {
162
+ style: { flex: a.ratio ?? 1, flexBasis: a.baseSize, flexShrink: a.shrink ?? 1 },
163
+ children: a.children
164
+ },
165
+ h
166
+ ))
167
+ }
168
+ ), $t = ({
169
+ width: e = 200,
170
+ height: n = 200,
171
+ minWidth: i = 50,
172
+ minHeight: r = 50,
173
+ maxWidth: m = 1 / 0,
174
+ maxHeight: a = 1 / 0,
175
+ handles: h = ["right", "bottom", "bottomRight"],
176
+ onResize: w,
177
+ children: p,
178
+ className: N,
179
+ style: s
180
+ }) => {
181
+ const [k, L] = ke.useState({ width: e, height: n }), d = ke.useRef(null), A = (c, v) => {
182
+ v.preventDefault();
183
+ const u = v.clientX, I = v.clientY, R = k.width, X = k.height, t = (z) => {
184
+ const M = z.clientX - u, W = z.clientY - I;
185
+ let Y = R, l = X;
186
+ (c.includes("right") || c === "right") && (Y = R + M), (c.includes("bottom") || c === "bottom") && (l = X + W), (c.includes("left") || c === "left") && (Y = R - M), (c.includes("top") || c === "top") && (l = X - W), Y = Math.max(i, Math.min(m, Y)), l = Math.max(r, Math.min(a, l)), L({ width: Y, height: l }), w?.({ width: Y, height: l });
187
+ }, g = () => {
188
+ document.removeEventListener("pointermove", t), document.removeEventListener("pointerup", g);
189
+ };
190
+ document.addEventListener("pointermove", t), document.addEventListener("pointerup", g);
191
+ }, _ = (c) => {
192
+ switch (c) {
193
+ case "top":
194
+ case "bottom":
195
+ return "ns-resize";
196
+ case "left":
197
+ case "right":
198
+ return "ew-resize";
199
+ case "topLeft":
200
+ case "bottomRight":
201
+ return "nwse-resize";
202
+ case "topRight":
203
+ case "bottomLeft":
204
+ return "nesw-resize";
205
+ default:
206
+ return "default";
207
+ }
208
+ }, $ = (c) => {
209
+ const v = { position: "absolute", zIndex: 1 }, u = 8;
210
+ return c === "right" ? {
211
+ ...v,
212
+ top: 0,
213
+ right: -u / 2,
214
+ width: u,
215
+ height: "100%",
216
+ cursor: _(c)
217
+ } : c === "bottom" ? {
218
+ ...v,
219
+ left: 0,
220
+ bottom: -u / 2,
221
+ width: "100%",
222
+ height: u,
223
+ cursor: _(c)
224
+ } : c === "left" ? { ...v, top: 0, left: -u / 2, width: u, height: "100%", cursor: _(c) } : c === "top" ? { ...v, top: -u / 2, left: 0, width: "100%", height: u, cursor: _(c) } : c === "bottomRight" ? {
225
+ ...v,
226
+ bottom: -u / 2,
227
+ right: -u / 2,
228
+ width: u * 2,
229
+ height: u * 2,
230
+ cursor: _(c)
231
+ } : c === "bottomLeft" ? {
232
+ ...v,
233
+ bottom: -u / 2,
234
+ left: -u / 2,
235
+ width: u * 2,
236
+ height: u * 2,
237
+ cursor: _(c)
238
+ } : c === "topRight" ? {
239
+ ...v,
240
+ top: -u / 2,
241
+ right: -u / 2,
242
+ width: u * 2,
243
+ height: u * 2,
244
+ cursor: _(c)
245
+ } : c === "topLeft" ? {
246
+ ...v,
247
+ top: -u / 2,
248
+ left: -u / 2,
249
+ width: u * 2,
250
+ height: u * 2,
251
+ cursor: _(c)
252
+ } : v;
253
+ };
254
+ return /* @__PURE__ */ jsxRuntime.jsxs(
255
+ "div",
256
+ {
257
+ ref: d,
258
+ className: `nice-resizable ${N || ""}`,
259
+ style: {
260
+ ...s,
261
+ width: k.width,
262
+ height: k.height,
263
+ position: "relative",
264
+ overflow: "hidden"
265
+ },
266
+ children: [
267
+ p,
268
+ h.map((c) => /* @__PURE__ */ jsxRuntime.jsx("div", { style: $(c), onPointerDown: (v) => A(c, v) }, c))
269
+ ]
270
+ }
271
+ );
272
+ }, Pt = ({
273
+ direction: e = "vertical",
274
+ showScrollbar: n = "onInteraction",
275
+ width: i,
276
+ height: r,
277
+ onScroll: m,
278
+ children: a,
279
+ className: h,
280
+ style: w
281
+ }) => {
282
+ const p = e === "horizontal" || e === "both" ? "auto" : "hidden", N = e === "vertical" || e === "both" ? "auto" : "hidden";
283
+ return /* @__PURE__ */ jsxRuntime.jsx(
284
+ "div",
285
+ {
286
+ className: `nice-scrollview ${n === "never" ? "nice-scrollview--hide-sb" : n === "always" ? "nice-scrollview--show-sb" : ""} ${h || ""}`,
287
+ style: { ...w, width: i, height: r, overflowX: p, overflowY: N },
288
+ onScroll: m,
289
+ children: a
290
+ }
291
+ );
292
+ };
293
+ ke.createContext(null);
294
+ const wt = ke.forwardRef(
295
+ ({ blocked: e, message: n, children: i, className: r, style: m, id: a }, h) => {
296
+ const w = coreBpghV7Ls.b(a);
297
+ return /* @__PURE__ */ jsxRuntime.jsxs(
298
+ "div",
299
+ {
300
+ ref: h,
301
+ id: w,
302
+ className: `nice-block-ui ${r || ""}`,
303
+ style: { position: "relative", ...m },
304
+ children: [
305
+ i,
306
+ e && /* @__PURE__ */ jsxRuntime.jsx("div", { className: "nice-block-ui__overlay", "aria-busy": "true", role: "alert", children: n && /* @__PURE__ */ jsxRuntime.jsx("div", { className: "nice-block-ui__message", children: n }) })
307
+ ]
308
+ }
309
+ );
310
+ }
311
+ );
312
+ wt.displayName = "NiceBlockUI";
313
+ const vt = ke.forwardRef(
314
+ ({
315
+ windows: e,
316
+ onChange: n,
317
+ onClose: i,
318
+ onFocus: r,
319
+ showTaskbar: m = true,
320
+ size: a = "md",
321
+ className: h,
322
+ style: w,
323
+ id: p,
324
+ ...N
325
+ }, s) => {
326
+ const k = coreBpghV7Ls.b(p), { t: L } = coreBpghV7Ls.g(), [d, A] = ke.useState(null), _ = ke.useRef(null), $ = Math.max(1, ...e.map((t) => t.zIndex ?? 1)), c = ke.useCallback(
327
+ (t, g) => {
328
+ const z = e.map((M) => M.key === t ? { ...M, ...g } : M);
329
+ n?.(z);
330
+ },
331
+ [e, n]
332
+ ), v = ke.useCallback(
333
+ (t) => {
334
+ c(t, { zIndex: $ + 1 }), r?.(t);
335
+ },
336
+ [c, $, r]
337
+ ), u = ke.useCallback(
338
+ (t) => {
339
+ i?.(t), n?.(e.filter((g) => g.key !== t));
340
+ },
341
+ [e, n, i]
342
+ ), I = ke.useCallback(
343
+ (t) => {
344
+ const g = e.find((z) => z.key === t);
345
+ g && c(t, { minimized: !g.minimized, maximized: false });
346
+ },
347
+ [e, c]
348
+ ), R = ke.useCallback(
349
+ (t) => {
350
+ const g = e.find((z) => z.key === t);
351
+ g && c(t, { maximized: !g.maximized, minimized: false });
352
+ },
353
+ [e, c]
354
+ );
355
+ ke.useEffect(() => {
356
+ if (!d)
357
+ return;
358
+ const t = (z) => {
359
+ const M = e.find((W) => W.key === d.key);
360
+ if (M)
361
+ if (d.mode === "move")
362
+ c(d.key, {
363
+ x: z.clientX - d.offsetX,
364
+ y: z.clientY - d.offsetY
365
+ });
366
+ else {
367
+ const Y = _.current?.getBoundingClientRect(), l = Y?.left ?? 0, E = Y?.top ?? 0;
368
+ c(d.key, {
369
+ width: Math.max(200, z.clientX - l - M.x),
370
+ height: Math.max(100, z.clientY - E - M.y)
371
+ });
372
+ }
373
+ }, g = () => A(null);
374
+ return document.addEventListener("mousemove", t), document.addEventListener("mouseup", g), () => {
375
+ document.removeEventListener("mousemove", t), document.removeEventListener("mouseup", g);
376
+ };
377
+ }, [d, e, c]);
378
+ const X = ke.useCallback(
379
+ (t, g, z) => {
380
+ g.preventDefault();
381
+ const M = e.find((W) => W.key === t);
382
+ M && (v(t), A({
383
+ key: t,
384
+ offsetX: z === "move" ? g.clientX - M.x : 0,
385
+ offsetY: z === "move" ? g.clientY - M.y : 0,
386
+ mode: z
387
+ }));
388
+ },
389
+ [e, v]
390
+ );
391
+ return /* @__PURE__ */ jsxRuntime.jsxs(
392
+ "div",
393
+ {
394
+ ref: (t) => {
395
+ _.current = t, typeof s == "function" ? s(t) : s && (s.current = t);
396
+ },
397
+ id: k,
398
+ className: `nice-wm nice-wm--${a} ${h ?? ""}`,
399
+ style: { ...w, position: "relative", overflow: "hidden" },
400
+ ...N,
401
+ children: [
402
+ e.map((t) => {
403
+ if (t.minimized)
404
+ return null;
405
+ const g = t.maximized, z = g ? {
406
+ position: "absolute",
407
+ top: 0,
408
+ left: 0,
409
+ width: "100%",
410
+ height: "100%",
411
+ zIndex: t.zIndex ?? 1
412
+ } : {
413
+ position: "absolute",
414
+ top: t.y,
415
+ left: t.x,
416
+ width: t.width,
417
+ height: t.height,
418
+ zIndex: t.zIndex ?? 1
419
+ };
420
+ return /* @__PURE__ */ jsxRuntime.jsxs(
421
+ "div",
422
+ {
423
+ className: `nice-wm__window ${g ? "nice-wm__window--maximized" : ""}`,
424
+ style: z,
425
+ onMouseDown: () => v(t.key),
426
+ role: "dialog",
427
+ "aria-label": t.title,
428
+ children: [
429
+ /* @__PURE__ */ jsxRuntime.jsxs(
430
+ "div",
431
+ {
432
+ className: "nice-wm__titlebar",
433
+ onMouseDown: (M) => !g && X(t.key, M, "move"),
434
+ children: [
435
+ t.icon && /* @__PURE__ */ jsxRuntime.jsx("span", { className: "nice-wm__icon", children: t.icon }),
436
+ /* @__PURE__ */ jsxRuntime.jsx("span", { className: "nice-wm__title", children: t.title }),
437
+ /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "nice-wm__controls", children: [
438
+ (t.minimizable ?? true) && /* @__PURE__ */ jsxRuntime.jsx(
439
+ "button",
440
+ {
441
+ type: "button",
442
+ className: "nice-wm__ctrl-btn nice-wm__ctrl-btn--min",
443
+ onClick: () => I(t.key),
444
+ title: L("wm.minimize", "Minimize"),
445
+ children: "─"
446
+ }
447
+ ),
448
+ (t.maximizable ?? true) && /* @__PURE__ */ jsxRuntime.jsx(
449
+ "button",
450
+ {
451
+ type: "button",
452
+ className: "nice-wm__ctrl-btn nice-wm__ctrl-btn--max",
453
+ onClick: () => R(t.key),
454
+ title: L("wm.maximize", "Maximize"),
455
+ children: g ? "❐" : "☐"
456
+ }
457
+ ),
458
+ (t.closable ?? true) && /* @__PURE__ */ jsxRuntime.jsx(
459
+ "button",
460
+ {
461
+ type: "button",
462
+ className: "nice-wm__ctrl-btn nice-wm__ctrl-btn--close",
463
+ onClick: () => u(t.key),
464
+ title: L("wm.close", "Close"),
465
+ children: "✕"
466
+ }
467
+ )
468
+ ] })
469
+ ]
470
+ }
471
+ ),
472
+ /* @__PURE__ */ jsxRuntime.jsx("div", { className: "nice-wm__body", children: t.content }),
473
+ (t.resizable ?? true) && !g && /* @__PURE__ */ jsxRuntime.jsx(
474
+ "div",
475
+ {
476
+ className: "nice-wm__resize-handle",
477
+ onMouseDown: (M) => X(t.key, M, "resize")
478
+ }
479
+ )
480
+ ]
481
+ },
482
+ t.key
483
+ );
484
+ }),
485
+ m && /* @__PURE__ */ jsxRuntime.jsx("div", { className: "nice-wm__taskbar", role: "toolbar", "aria-label": L("wm.taskbar", "Taskbar"), children: e.map((t) => /* @__PURE__ */ jsxRuntime.jsxs(
486
+ "button",
487
+ {
488
+ type: "button",
489
+ className: `nice-wm__taskbar-btn ${t.minimized ? "nice-wm__taskbar-btn--minimized" : ""}`,
490
+ onClick: () => {
491
+ t.minimized && I(t.key), v(t.key);
492
+ },
493
+ children: [
494
+ t.icon && /* @__PURE__ */ jsxRuntime.jsx("span", { className: "nice-wm__taskbar-icon", children: t.icon }),
495
+ /* @__PURE__ */ jsxRuntime.jsx("span", { className: "nice-wm__taskbar-label", children: t.title })
496
+ ]
497
+ },
498
+ t.key
499
+ )) })
500
+ ]
501
+ }
502
+ );
503
+ }
504
+ );
505
+ vt.displayName = "NiceWindowManager";
506
+ ke.createContext({
507
+ startTutorial: () => {
508
+ },
509
+ stopTutorial: () => {
510
+ },
511
+ isActive: false,
512
+ currentStep: 0,
513
+ nextStep: () => {
514
+ },
515
+ prevStep: () => {
516
+ },
517
+ goToStep: () => {
518
+ }
519
+ });
520
+ function Nt(e, n, i, r, m) {
521
+ const a = e <= m, h = e + m >= i, w = n <= m, p = n + m >= r;
522
+ return w && a ? "top-left" : w && h ? "top-right" : p && a ? "bottom-left" : p && h ? "bottom-right" : a ? "left" : h ? "right" : w ? "top" : p ? "bottom" : "none";
523
+ }
524
+ function kt(e) {
525
+ switch (e) {
526
+ case "left":
527
+ return { left: 0, top: 0, width: "50%", height: "100%" };
528
+ case "right":
529
+ return { left: "50%", top: 0, width: "50%", height: "100%" };
530
+ case "top":
531
+ return { left: 0, top: 0, width: "100%", height: "50%" };
532
+ case "bottom":
533
+ return { left: 0, top: "50%", width: "100%", height: "50%" };
534
+ case "top-left":
535
+ return { left: 0, top: 0, width: "50%", height: "50%" };
536
+ case "top-right":
537
+ return { left: "50%", top: 0, width: "50%", height: "50%" };
538
+ case "bottom-left":
539
+ return { left: 0, top: "50%", width: "50%", height: "50%" };
540
+ case "bottom-right":
541
+ return { left: "50%", top: "50%", width: "50%", height: "50%" };
542
+ default:
543
+ return null;
544
+ }
545
+ }
546
+ const Et = ke.forwardRef(
547
+ ({
548
+ windowKey: e,
549
+ title: n,
550
+ icon: i,
551
+ children: r,
552
+ footer: m,
553
+ x: a = 100,
554
+ y: h = 100,
555
+ width: w = 480,
556
+ height: p = 360,
557
+ minWidth: N = 200,
558
+ minHeight: s = 120,
559
+ maxWidth: k,
560
+ maxHeight: L,
561
+ zIndex: d = 1,
562
+ closable: A = true,
563
+ minimizable: _ = true,
564
+ maximizable: $ = true,
565
+ fullscreenable: c = false,
566
+ pinnable: v = false,
567
+ resizable: u = true,
568
+ draggable: I = true,
569
+ snappable: R = true,
570
+ snapThreshold: X = 20,
571
+ minimized: t,
572
+ maximized: g,
573
+ fullscreen: z,
574
+ pinned: M,
575
+ focused: W,
576
+ onClose: Y,
577
+ onMinimize: l,
578
+ onMaximize: E,
579
+ onFullscreen: f,
580
+ onPin: O,
581
+ onFocus: S,
582
+ onMove: ne,
583
+ onResize: se,
584
+ onSnap: C,
585
+ onTitleBarDoubleClick: P,
586
+ size: we = "md",
587
+ statusBar: Ce,
588
+ titleBarActions: Ye,
589
+ className: Xe,
590
+ style: Oe,
591
+ id: Ie,
592
+ accessMode: qe,
593
+ ...Ae
594
+ }, Be) => {
595
+ const We = coreBpghV7Ls.b(Ie), Fe = coreBpghV7Ls.f(qe, Ie), { t: le } = coreBpghV7Ls.g();
596
+ if (Fe === "hidden")
597
+ return null;
598
+ const [he, ce] = ke.useState({ x: a, y: h }), [pe, fe] = ke.useState({ width: w, height: p }), [He, Ue] = ke.useState(false), [Ge, Ve] = ke.useState(false), [je, Qe] = ke.useState(false), [Ze, Je] = ke.useState(false), [V, ve] = ke.useState("none"), Ke = t ?? He, U = g ?? Ge, H = z ?? je, ae = M ?? Ze, be = W ?? true, ie = he.x, oe = he.y, Z = pe.width, J = pe.height, j = ke.useRef(
599
+ null
600
+ ), F = ke.useRef(null), T = ke.useRef(null), et = ke.useCallback(() => {
601
+ Y?.(e);
602
+ }, [e, Y]), tt = ke.useCallback(() => {
603
+ Ue(true), l?.(e);
604
+ }, [e, l]), ye = ke.useCallback(() => {
605
+ const y = !U;
606
+ Ve(y), !y && T.current ? (ce({ x: T.current.x, y: T.current.y }), fe({ width: T.current.w, height: T.current.h }), T.current = null) : y && (T.current = { x: ie, y: oe, w: Z, h: J }), ve("none"), E?.(e, y);
607
+ }, [e, U, ie, oe, Z, J, E]), xe = ke.useCallback(() => {
608
+ const y = !H;
609
+ Qe(y), y ? T.current = { x: ie, y: oe, w: Z, h: J } : T.current && (ce({ x: T.current.x, y: T.current.y }), fe({ width: T.current.w, height: T.current.h }), T.current = null), f?.(e, y);
610
+ }, [e, H, ie, oe, Z, J, f]), nt = ke.useCallback(() => {
611
+ const y = !ae;
612
+ Je(y), O?.(e, y);
613
+ }, [e, ae, O]), de = ke.useCallback(() => {
614
+ S?.(e);
615
+ }, [e, S]), it = ke.useCallback(() => {
616
+ P ? P(e) : $ && ye();
617
+ }, [e, $, ye, P]);
618
+ ke.useEffect(() => {
619
+ if (!j.current)
620
+ return;
621
+ const y = (K) => {
622
+ if (!j.current)
623
+ return;
624
+ const Q = K.clientX - j.current.startX + j.current.origX, ue = K.clientY - j.current.startY + j.current.origY;
625
+ ce({ x: Q, y: ue }), ne?.(e, { x: Q, y: ue });
626
+ }, B = (K) => {
627
+ if (j.current) {
628
+ if (R) {
629
+ const Q = Nt(
630
+ K.clientX,
631
+ K.clientY,
632
+ window.innerWidth,
633
+ window.innerHeight,
634
+ X
635
+ );
636
+ Q !== "none" && (T.current = { x: he.x, y: he.y, w: Z, h: J }, ve(Q), C?.(e, Q));
637
+ }
638
+ j.current = null;
639
+ }
640
+ };
641
+ return document.addEventListener("mousemove", y), document.addEventListener("mouseup", B), () => {
642
+ document.removeEventListener("mousemove", y), document.removeEventListener("mouseup", B);
643
+ };
644
+ });
645
+ const ot = ke.useCallback(
646
+ (y) => {
647
+ !I || U || H || (y.preventDefault(), V !== "none" && (T.current && (ce({ x: T.current.x, y: T.current.y }), fe({ width: T.current.w, height: T.current.h })), ve("none")), de(), j.current = { startX: y.clientX, startY: y.clientY, origX: ie, origY: oe });
648
+ },
649
+ [I, U, H, V, ie, oe, de]
650
+ );
651
+ ke.useEffect(() => {
652
+ if (!F.current)
653
+ return;
654
+ const y = (K) => {
655
+ if (!F.current)
656
+ return;
657
+ const Q = K.clientX - F.current.startX, ue = K.clientY - F.current.startY, re = F.current.handle;
658
+ let ee = F.current.origW, te = F.current.origH;
659
+ if (re.includes("e") && (ee = F.current.origW + Q), re.includes("w") && (ee = F.current.origW - Q), re.includes("s") && (te = F.current.origH + ue), re.includes("n") && (te = F.current.origH - ue), ee = Math.max(N, k ? Math.min(k, ee) : ee), te = Math.max(s, L ? Math.min(L, te) : te), re.includes("w")) {
660
+ const Ne = pe.width - ee;
661
+ ce((me) => ({ ...me, x: me.x + Ne }));
662
+ }
663
+ if (re.includes("n")) {
664
+ const Ne = pe.height - te;
665
+ ce((me) => ({ ...me, y: me.y + Ne }));
666
+ }
667
+ fe({ width: ee, height: te }), se?.(e, { width: ee, height: te });
668
+ }, B = () => {
669
+ F.current = null;
670
+ };
671
+ return document.addEventListener("mousemove", y), document.addEventListener("mouseup", B), () => {
672
+ document.removeEventListener("mousemove", y), document.removeEventListener("mouseup", B);
673
+ };
674
+ });
675
+ const ct = ke.useCallback(
676
+ (y, B) => {
677
+ !u || U || H || V !== "none" || (B.preventDefault(), B.stopPropagation(), de(), F.current = { startX: B.clientX, startY: B.clientY, origW: Z, origH: J, handle: y });
678
+ },
679
+ [u, U, H, V, Z, J, de]
680
+ );
681
+ if (ke.useEffect(() => {
682
+ if (!be)
683
+ return;
684
+ const y = (B) => {
685
+ B.key === "Escape" && H && xe();
686
+ };
687
+ return document.addEventListener("keydown", y), () => document.removeEventListener("keydown", y);
688
+ }, [be, H, xe]), Ke)
689
+ return null;
690
+ const Me = V !== "none" ? kt(V) : null, Se = U || H, rt = H ? { position: "fixed", top: 0, left: 0, width: "100vw", height: "100vh", zIndex: 999999 } : U ? { position: "absolute", top: 0, left: 0, width: "100%", height: "100%", zIndex: d } : Me ? { position: "absolute", ...Me, zIndex: d } : { position: "absolute", top: oe, left: ie, width: Z, height: J, zIndex: d }, st = ["n", "e", "s", "w", "ne", "se", "sw", "nw"], lt = {
691
+ n: "ns-resize",
692
+ s: "ns-resize",
693
+ e: "ew-resize",
694
+ w: "ew-resize",
695
+ ne: "nesw-resize",
696
+ sw: "nesw-resize",
697
+ nw: "nwse-resize",
698
+ se: "nwse-resize"
699
+ };
700
+ return /* @__PURE__ */ jsxRuntime.jsxs(
701
+ "div",
702
+ {
703
+ ref: Be,
704
+ id: We,
705
+ className: `nice-window nice-window--${we} ${be ? "nice-window--focused" : ""} ${ae ? "nice-window--pinned" : ""} ${Se ? "nice-window--maximized" : ""} ${V !== "none" ? `nice-window--snapped-${V}` : ""} ${Xe ?? ""}`,
706
+ style: { ...rt, ...Oe },
707
+ onMouseDown: de,
708
+ role: "dialog",
709
+ "aria-label": n,
710
+ ...Ae,
711
+ children: [
712
+ /* @__PURE__ */ jsxRuntime.jsxs(
713
+ "div",
714
+ {
715
+ className: "nice-window__titlebar",
716
+ onMouseDown: ot,
717
+ onDoubleClick: it,
718
+ children: [
719
+ i && /* @__PURE__ */ jsxRuntime.jsx("span", { className: "nice-window__icon", children: i }),
720
+ /* @__PURE__ */ jsxRuntime.jsx("span", { className: "nice-window__title", children: n }),
721
+ /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "nice-window__actions", children: [
722
+ Ye,
723
+ v && /* @__PURE__ */ jsxRuntime.jsx(
724
+ "button",
725
+ {
726
+ type: "button",
727
+ className: `nice-window__action nice-window__action--pin ${ae ? "nice-window__action--active" : ""}`,
728
+ onClick: nt,
729
+ title: le("window.pin", ae ? "Unpin" : "Pin"),
730
+ children: "📌"
731
+ }
732
+ ),
733
+ _ && /* @__PURE__ */ jsxRuntime.jsx(
734
+ "button",
735
+ {
736
+ type: "button",
737
+ className: "nice-window__action nice-window__action--minimize",
738
+ onClick: tt,
739
+ title: le("window.minimize", "Minimize"),
740
+ children: "─"
741
+ }
742
+ ),
743
+ $ && /* @__PURE__ */ jsxRuntime.jsx(
744
+ "button",
745
+ {
746
+ type: "button",
747
+ className: "nice-window__action nice-window__action--maximize",
748
+ onClick: ye,
749
+ title: le("window.maximize", U ? "Restore" : "Maximize"),
750
+ children: U ? "❐" : "☐"
751
+ }
752
+ ),
753
+ c && /* @__PURE__ */ jsxRuntime.jsx(
754
+ "button",
755
+ {
756
+ type: "button",
757
+ className: "nice-window__action nice-window__action--fullscreen",
758
+ onClick: xe,
759
+ title: le("window.fullscreen", H ? "Exit Full Screen" : "Full Screen"),
760
+ children: H ? "⇲" : "⇱"
761
+ }
762
+ ),
763
+ A && /* @__PURE__ */ jsxRuntime.jsx(
764
+ "button",
765
+ {
766
+ type: "button",
767
+ className: "nice-window__action nice-window__action--close",
768
+ onClick: et,
769
+ title: le("window.close", "Close"),
770
+ children: "✕"
771
+ }
772
+ )
773
+ ] })
774
+ ]
775
+ }
776
+ ),
777
+ /* @__PURE__ */ jsxRuntime.jsx("div", { className: "nice-window__body", children: r }),
778
+ m && /* @__PURE__ */ jsxRuntime.jsx("div", { className: "nice-window__footer", children: m }),
779
+ Ce && /* @__PURE__ */ jsxRuntime.jsx("div", { className: "nice-window__statusbar", children: Ce }),
780
+ u && !Se && V === "none" && /* @__PURE__ */ jsxRuntime.jsx(jsxRuntime.Fragment, { children: st.map((y) => /* @__PURE__ */ jsxRuntime.jsx(
781
+ "div",
782
+ {
783
+ className: `nice-window__resize nice-window__resize--${y}`,
784
+ style: { cursor: lt[y] },
785
+ onMouseDown: (B) => ct(y, B)
786
+ },
787
+ y
788
+ )) })
789
+ ]
790
+ }
791
+ );
792
+ }
793
+ );
794
+ Et.displayName = "NiceWindow";
795
+
796
+ exports.N = Mt;
797
+ exports.a = wt;
798
+ exports.b = Lt;
799
+ exports.d = Rt;
800
+ exports.e = St;
801
+ exports.f = $t;
802
+ exports.g = Tt;
803
+ exports.h = Pt;
804
+ exports.k = Et;
805
+ exports.l = vt;
806
+ //# sourceMappingURL=NiceWindow-SiCaREbq.js.map