@nice2dev/ui-3d 1.0.5 → 1.0.6

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