saha-ui 1.22.4 → 1.22.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.
@@ -1 +1 @@
1
- {"version":3,"file":"DebugOverlay.d.ts","sourceRoot":"","sources":["../../../src/components/DragDrop/DebugOverlay.tsx"],"names":[],"mappings":"AAEA,OAAO,KAAsC,MAAM,OAAO,CAAC;AAS3D,MAAM,WAAW,iBAAiB;IAChC,OAAO,CAAC,EAAE,OAAO,CAAC;IAClB,QAAQ,CAAC,EAAE,UAAU,GAAG,WAAW,GAAG,aAAa,GAAG,cAAc,CAAC;IACrE,kBAAkB,CAAC,EAAE,OAAO,CAAC;IAC7B,YAAY,CAAC,EAAE,OAAO,CAAC;IACvB,sBAAsB,CAAC,EAAE,OAAO,CAAC;CAClC;AAMD,eAAO,MAAM,YAAY,EAAE,KAAK,CAAC,EAAE,CAAC,iBAAiB,CAoSpD,CAAC"}
1
+ {"version":3,"file":"DebugOverlay.d.ts","sourceRoot":"","sources":["../../../src/components/DragDrop/DebugOverlay.tsx"],"names":[],"mappings":"AAEA,OAAO,KAAsC,MAAM,OAAO,CAAC;AAS3D,MAAM,WAAW,iBAAiB;IAChC,OAAO,CAAC,EAAE,OAAO,CAAC;IAClB,QAAQ,CAAC,EAAE,UAAU,GAAG,WAAW,GAAG,aAAa,GAAG,cAAc,CAAC;IACrE,kBAAkB,CAAC,EAAE,OAAO,CAAC;IAC7B,YAAY,CAAC,EAAE,OAAO,CAAC;IACvB,sBAAsB,CAAC,EAAE,OAAO,CAAC;CAClC;AAMD,eAAO,MAAM,YAAY,EAAE,KAAK,CAAC,EAAE,CAAC,iBAAiB,CAyXpD,CAAC"}
@@ -1,51 +1,57 @@
1
- import { jsxs as t, Fragment as T, jsx as e } from "react/jsx-runtime";
2
- import { useState as m, useRef as b, useEffect as u } from "react";
3
- import { useDragDropContext as z } from "./DragDropContext.js";
4
- import { cn as v } from "../../lib/utils.js";
5
- import { ChevronUp as O, ChevronDown as P } from "lucide-react";
6
- const E = ({
7
- enabled: p = !0,
8
- position: w = "top-right",
9
- showCollisionRects: U = !0,
10
- showDragPath: D = !0,
11
- showPerformanceMetrics: f = !0
1
+ import { jsxs as t, Fragment as C, jsx as e } from "react/jsx-runtime";
2
+ import { useState as l, useRef as I, useEffect as h } from "react";
3
+ import { useDragDropContext as G } from "./DragDropContext.js";
4
+ import { cn as j } from "../../lib/utils.js";
5
+ import { ChevronUp as T, ChevronDown as L } from "lucide-react";
6
+ const Y = ({
7
+ enabled: x = !0,
8
+ position: D = "top-right",
9
+ showCollisionRects: M = !0,
10
+ showDragPath: c = !0,
11
+ showPerformanceMetrics: g = !0
12
12
  }) => {
13
- const j = z(), [r, I] = m(!0), [o, g] = m([]), [h, C] = m(0), [S, R] = m(0), a = b({ frames: 0, lastTime: performance.now() }), N = b(0), {
14
- activeId: k,
15
- activeItem: y,
16
- activeIndex: F,
17
- sourceContainerId: A,
18
- dragPosition: n,
13
+ const O = G(), [m, S] = l(!0), [p, y] = l([]), [N, k] = l(0), [R, P] = l(0), a = I({ frames: 0, lastTime: performance.now() }), b = I(0), {
14
+ activeId: F,
15
+ activeItem: v,
16
+ activeIndex: A,
17
+ sourceContainerId: z,
18
+ dragPosition: o,
19
19
  isDragging: i,
20
- selectionState: d,
21
- historyState: l
22
- } = j;
23
- return u(() => {
24
- g(i && n ? (s) => [
25
- ...s.slice(-50),
26
- // Keep last 50 points
27
- { x: n.x, y: n.y, timestamp: Date.now() }
28
- ] : []);
29
- }, [i, n]), u(() => {
30
- if (!p || !f) return;
20
+ selectionState: f,
21
+ historyState: u
22
+ } = O, [d, w] = l(null);
23
+ return h(() => {
24
+ if (!i || !c) {
25
+ y([]);
26
+ return;
27
+ }
28
+ const s = (r) => {
29
+ const n = { x: r.clientX, y: r.clientY, timestamp: Date.now() };
30
+ w(n), y((E) => [...E.slice(-50), n]);
31
+ };
32
+ return window.addEventListener("pointermove", s), () => {
33
+ window.removeEventListener("pointermove", s), w(null), y([]);
34
+ };
35
+ }, [i, c]), h(() => {
36
+ if (!x || !g) return;
31
37
  const s = () => {
32
- const x = performance.now();
33
- a.current.frames++, x >= a.current.lastTime + 1e3 && (C(
38
+ const n = performance.now();
39
+ a.current.frames++, n >= a.current.lastTime + 1e3 && (k(
34
40
  Math.round(
35
- a.current.frames * 1e3 / (x - a.current.lastTime)
41
+ a.current.frames * 1e3 / (n - a.current.lastTime)
36
42
  )
37
- ), a.current.frames = 0, a.current.lastTime = x), requestAnimationFrame(s);
38
- }, c = requestAnimationFrame(s);
39
- return () => cancelAnimationFrame(c);
40
- }, [p, f]), u(() => {
41
- N.current = performance.now();
42
- }), u(() => {
43
- R(performance.now() - N.current);
44
- }), p ? /* @__PURE__ */ t(T, { children: [
43
+ ), a.current.frames = 0, a.current.lastTime = n), requestAnimationFrame(s);
44
+ }, r = requestAnimationFrame(s);
45
+ return () => cancelAnimationFrame(r);
46
+ }, [x, g]), h(() => {
47
+ b.current = performance.now();
48
+ }), h(() => {
49
+ P(performance.now() - b.current);
50
+ }), x ? /* @__PURE__ */ t(C, { children: [
45
51
  /* @__PURE__ */ t(
46
52
  "div",
47
53
  {
48
- className: v(
54
+ className: j(
49
55
  "fixed z-[9999] bg-background border rounded-lg shadow-lg",
50
56
  "max-w-md transition-all duration-200",
51
57
  {
@@ -53,8 +59,8 @@ const E = ({
53
59
  "top-right": "top-4 right-4",
54
60
  "bottom-left": "bottom-4 left-4",
55
61
  "bottom-right": "bottom-4 right-4"
56
- }[w],
57
- !r && "w-auto"
62
+ }[D],
63
+ !m && "w-auto"
58
64
  ),
59
65
  children: [
60
66
  /* @__PURE__ */ t("div", { className: "flex items-center justify-between px-3 py-2 border-b bg-muted/50", children: [
@@ -65,14 +71,14 @@ const E = ({
65
71
  /* @__PURE__ */ e("div", { className: "flex items-center gap-1", children: /* @__PURE__ */ e(
66
72
  "button",
67
73
  {
68
- onClick: () => I(!r),
74
+ onClick: () => S(!m),
69
75
  className: "p-1 hover:bg-background rounded transition-colors",
70
- children: r ? /* @__PURE__ */ e(O, { className: "w-4 h-4" }) : /* @__PURE__ */ e(P, { className: "w-4 h-4" })
76
+ children: m ? /* @__PURE__ */ e(T, { className: "w-4 h-4" }) : /* @__PURE__ */ e(L, { className: "w-4 h-4" })
71
77
  }
72
78
  ) })
73
79
  ] }),
74
- r && /* @__PURE__ */ t("div", { className: "p-3 space-y-3 text-xs max-h-[500px] overflow-auto", children: [
75
- f && /* @__PURE__ */ t("div", { className: "space-y-1", children: [
80
+ m && /* @__PURE__ */ t("div", { className: "p-3 space-y-3 text-xs max-h-[500px] overflow-auto", children: [
81
+ g && /* @__PURE__ */ t("div", { className: "space-y-1", children: [
76
82
  /* @__PURE__ */ e("h4", { className: "font-semibold text-foreground mb-2", children: "Performance" }),
77
83
  /* @__PURE__ */ t("div", { className: "grid grid-cols-2 gap-2", children: [
78
84
  /* @__PURE__ */ t("div", { className: "bg-muted/50 rounded px-2 py-1", children: [
@@ -80,18 +86,18 @@ const E = ({
80
86
  /* @__PURE__ */ e(
81
87
  "span",
82
88
  {
83
- className: v(
89
+ className: j(
84
90
  "ml-2 font-mono font-medium",
85
- h >= 50 ? "text-green-500" : h >= 30 ? "text-yellow-500" : "text-red-500"
91
+ N >= 50 ? "text-green-500" : N >= 30 ? "text-yellow-500" : "text-red-500"
86
92
  ),
87
- children: h
93
+ children: N
88
94
  }
89
95
  )
90
96
  ] }),
91
97
  /* @__PURE__ */ t("div", { className: "bg-muted/50 rounded px-2 py-1", children: [
92
98
  /* @__PURE__ */ e("span", { className: "text-muted-foreground", children: "Render:" }),
93
99
  /* @__PURE__ */ t("span", { className: "ml-2 font-mono font-medium", children: [
94
- S.toFixed(2),
100
+ R.toFixed(2),
95
101
  "ms"
96
102
  ] })
97
103
  ] })
@@ -106,41 +112,41 @@ const E = ({
106
112
  ] }),
107
113
  /* @__PURE__ */ t("div", { className: "flex justify-between", children: [
108
114
  /* @__PURE__ */ e("span", { className: "text-muted-foreground", children: "Active ID:" }),
109
- /* @__PURE__ */ e("span", { className: "font-mono font-medium truncate max-w-[120px]", children: k || "—" })
115
+ /* @__PURE__ */ e("span", { className: "font-mono font-medium truncate max-w-[120px]", children: F || "—" })
110
116
  ] }),
111
117
  /* @__PURE__ */ t("div", { className: "flex justify-between", children: [
112
118
  /* @__PURE__ */ e("span", { className: "text-muted-foreground", children: "Active Index:" }),
113
- /* @__PURE__ */ e("span", { className: "font-medium", children: F ?? "—" })
119
+ /* @__PURE__ */ e("span", { className: "font-medium", children: A ?? "—" })
114
120
  ] }),
115
121
  /* @__PURE__ */ t("div", { className: "flex justify-between", children: [
116
122
  /* @__PURE__ */ e("span", { className: "text-muted-foreground", children: "Container:" }),
117
- /* @__PURE__ */ e("span", { className: "font-mono font-medium truncate max-w-[120px]", children: A || "—" })
123
+ /* @__PURE__ */ e("span", { className: "font-mono font-medium truncate max-w-[120px]", children: z || "—" })
118
124
  ] }),
119
- n && /* @__PURE__ */ t("div", { className: "flex justify-between", children: [
125
+ o && /* @__PURE__ */ t("div", { className: "flex justify-between", children: [
120
126
  /* @__PURE__ */ e("span", { className: "text-muted-foreground", children: "Position:" }),
121
127
  /* @__PURE__ */ t("span", { className: "font-mono font-medium", children: [
122
128
  "x: ",
123
- Math.round(n.x),
129
+ Math.round(o.x),
124
130
  ", y:",
125
131
  " ",
126
- Math.round(n.y)
132
+ Math.round(o.y)
127
133
  ] })
128
134
  ] })
129
135
  ] })
130
136
  ] }),
131
- d && /* @__PURE__ */ t("div", { className: "space-y-1", children: [
137
+ f && /* @__PURE__ */ t("div", { className: "space-y-1", children: [
132
138
  /* @__PURE__ */ e("h4", { className: "font-semibold text-foreground mb-2", children: "Multi-Selection" }),
133
139
  /* @__PURE__ */ t("div", { className: "bg-muted/50 rounded px-2 py-1 space-y-1", children: [
134
140
  /* @__PURE__ */ t("div", { className: "flex justify-between", children: [
135
141
  /* @__PURE__ */ e("span", { className: "text-muted-foreground", children: "Selected:" }),
136
142
  /* @__PURE__ */ t("span", { className: "font-medium", children: [
137
- d.selectedIds.size,
143
+ f.selectedIds.size,
138
144
  " items"
139
145
  ] })
140
146
  ] }),
141
- d.selectedIds.size > 0 && /* @__PURE__ */ t("div", { className: "mt-1 pt-1 border-t border-border", children: [
147
+ f.selectedIds.size > 0 && /* @__PURE__ */ t("div", { className: "mt-1 pt-1 border-t border-border", children: [
142
148
  /* @__PURE__ */ e("div", { className: "text-muted-foreground mb-1", children: "IDs:" }),
143
- /* @__PURE__ */ e("div", { className: "flex flex-wrap gap-1", children: Array.from(d.selectedIds).map((s) => /* @__PURE__ */ e(
149
+ /* @__PURE__ */ e("div", { className: "flex flex-wrap gap-1", children: Array.from(f.selectedIds).map((s) => /* @__PURE__ */ e(
144
150
  "span",
145
151
  {
146
152
  className: "px-1.5 py-0.5 bg-primary/20 text-primary rounded text-[10px] font-mono",
@@ -151,66 +157,136 @@ const E = ({
151
157
  ] })
152
158
  ] })
153
159
  ] }),
154
- l && /* @__PURE__ */ t("div", { className: "space-y-1", children: [
160
+ u && /* @__PURE__ */ t("div", { className: "space-y-1", children: [
155
161
  /* @__PURE__ */ e("h4", { className: "font-semibold text-foreground mb-2", children: "Undo/Redo" }),
156
162
  /* @__PURE__ */ t("div", { className: "bg-muted/50 rounded px-2 py-1 space-y-1", children: [
157
163
  /* @__PURE__ */ t("div", { className: "flex justify-between", children: [
158
164
  /* @__PURE__ */ e("span", { className: "text-muted-foreground", children: "Can Undo:" }),
159
- /* @__PURE__ */ e("span", { className: "font-medium", children: l.past.length > 0 ? "Yes" : "No" })
165
+ /* @__PURE__ */ e("span", { className: "font-medium", children: u.past.length > 0 ? "Yes" : "No" })
160
166
  ] }),
161
167
  /* @__PURE__ */ t("div", { className: "flex justify-between", children: [
162
168
  /* @__PURE__ */ e("span", { className: "text-muted-foreground", children: "Can Redo:" }),
163
- /* @__PURE__ */ e("span", { className: "font-medium", children: l.future.length > 0 ? "Yes" : "No" })
169
+ /* @__PURE__ */ e("span", { className: "font-medium", children: u.future.length > 0 ? "Yes" : "No" })
164
170
  ] }),
165
171
  /* @__PURE__ */ t("div", { className: "flex justify-between", children: [
166
172
  /* @__PURE__ */ e("span", { className: "text-muted-foreground", children: "History Size:" }),
167
- /* @__PURE__ */ e("span", { className: "font-medium", children: l.past.length })
173
+ /* @__PURE__ */ e("span", { className: "font-medium", children: u.past.length })
168
174
  ] })
169
175
  ] })
170
176
  ] }),
171
- y && /* @__PURE__ */ t("div", { className: "space-y-1", children: [
177
+ v && /* @__PURE__ */ t("div", { className: "space-y-1", children: [
172
178
  /* @__PURE__ */ e("h4", { className: "font-semibold text-foreground mb-2", children: "Active Item" }),
173
- /* @__PURE__ */ e("pre", { className: "bg-muted/50 rounded px-2 py-1 overflow-auto max-h-32 text-[10px] font-mono", children: JSON.stringify(y, null, 2) })
179
+ /* @__PURE__ */ e("pre", { className: "bg-muted/50 rounded px-2 py-1 overflow-auto max-h-32 text-[10px] font-mono", children: JSON.stringify(v, null, 2) })
174
180
  ] })
175
181
  ] })
176
182
  ]
177
183
  }
178
184
  ),
179
- D && i && o.length > 1 && /* @__PURE__ */ t(
185
+ c && i && p.length > 1 && /* @__PURE__ */ t(
180
186
  "svg",
181
187
  {
182
188
  className: "fixed inset-0 pointer-events-none z-[9998]",
183
189
  style: { width: "100vw", height: "100vh" },
184
190
  children: [
191
+ /* @__PURE__ */ t("defs", { children: [
192
+ /* @__PURE__ */ t("linearGradient", { id: "dragPathGrad", x1: "0%", y1: "0%", x2: "100%", y2: "0%", children: [
193
+ /* @__PURE__ */ e("stop", { offset: "0%", stopColor: "#6366f1", stopOpacity: "0.6" }),
194
+ /* @__PURE__ */ e("stop", { offset: "50%", stopColor: "#8b5cf6", stopOpacity: "0.9" }),
195
+ /* @__PURE__ */ e("stop", { offset: "100%", stopColor: "#6366f1", stopOpacity: "1" })
196
+ ] }),
197
+ /* @__PURE__ */ t("radialGradient", { id: "dotGrad", cx: "30%", cy: "30%", r: "70%", children: [
198
+ /* @__PURE__ */ e("stop", { offset: "0%", stopColor: "#ffffff", stopOpacity: "1" }),
199
+ /* @__PURE__ */ e("stop", { offset: "30%", stopColor: "#6366f1", stopOpacity: "1" }),
200
+ /* @__PURE__ */ e("stop", { offset: "100%", stopColor: "#8b5cf6", stopOpacity: "0.6" })
201
+ ] })
202
+ ] }),
185
203
  /* @__PURE__ */ e(
186
204
  "polyline",
187
205
  {
188
- points: o.map((s) => `${s.x},${s.y}`).join(" "),
206
+ points: p.map((s) => `${s.x},${s.y}`).join(" "),
189
207
  fill: "none",
190
- stroke: "hsl(var(--primary))",
191
- strokeWidth: "2",
192
- strokeOpacity: "0.5",
208
+ stroke: "url(#dragPathGrad)",
209
+ strokeWidth: 2,
210
+ strokeOpacity: 0.95,
193
211
  strokeLinecap: "round",
194
212
  strokeLinejoin: "round"
195
213
  }
196
214
  ),
197
- o.map((s, c) => /* @__PURE__ */ e(
198
- "circle",
199
- {
200
- cx: s.x,
201
- cy: s.y,
202
- r: 2,
203
- fill: "hsl(var(--primary))",
204
- fillOpacity: 0.3 + c / o.length * 0.7
205
- },
206
- c
207
- ))
215
+ p.map((s, r) => {
216
+ const n = 0.18 + r / p.length * 0.82;
217
+ return /* @__PURE__ */ e(
218
+ "circle",
219
+ {
220
+ cx: s.x,
221
+ cy: s.y,
222
+ r: 2.25,
223
+ fill: "url(#dotGrad)",
224
+ fillOpacity: n
225
+ },
226
+ r
227
+ );
228
+ })
208
229
  ]
209
230
  }
210
- )
231
+ ),
232
+ c && i && (d || o) && /* @__PURE__ */ t(C, { children: [
233
+ /* @__PURE__ */ e("style", { children: "@keyframes sahaPulse { 0% { transform: scale(1); opacity: 0.95 } 50% { transform: scale(1.12); opacity: 0.75 } 100% { transform: scale(1); opacity: 0.95 } }" }),
234
+ /* @__PURE__ */ t(
235
+ "div",
236
+ {
237
+ "aria-hidden": !0,
238
+ style: {
239
+ position: "fixed",
240
+ left: d ? d.x : o.x,
241
+ top: d ? d.y : o.y,
242
+ transform: "translate(-50%, -50%)",
243
+ pointerEvents: "none",
244
+ zIndex: 1e4,
245
+ width: 40,
246
+ height: 40,
247
+ display: "flex",
248
+ alignItems: "center",
249
+ justifyContent: "center"
250
+ },
251
+ children: [
252
+ /* @__PURE__ */ e(
253
+ "div",
254
+ {
255
+ style: {
256
+ width: 40,
257
+ height: 40,
258
+ borderRadius: 9999,
259
+ background: "radial-gradient(circle at 35% 30%, rgba(139,92,246,0.20), rgba(99,102,241,0.06))",
260
+ border: "1px solid rgba(99,102,241,0.18)",
261
+ boxShadow: "0 8px 22px rgba(15,23,42,0.14)",
262
+ animation: "sahaPulse 1.6s ease-in-out infinite",
263
+ transformOrigin: "center"
264
+ }
265
+ }
266
+ ),
267
+ /* @__PURE__ */ e(
268
+ "div",
269
+ {
270
+ style: {
271
+ position: "absolute",
272
+ left: "50%",
273
+ top: "50%",
274
+ transform: "translate(-50%, -50%)",
275
+ width: 10,
276
+ height: 10,
277
+ borderRadius: 9999,
278
+ background: "linear-gradient(135deg,#8b5cf6,#6366f1)",
279
+ boxShadow: "0 6px 18px rgba(139,92,246,0.24)"
280
+ }
281
+ }
282
+ )
283
+ ]
284
+ }
285
+ )
286
+ ] })
211
287
  ] }) : null;
212
288
  };
213
- E.displayName = "DebugOverlay";
289
+ Y.displayName = "DebugOverlay";
214
290
  export {
215
- E as DebugOverlay
291
+ Y as DebugOverlay
216
292
  };
@@ -1 +1 @@
1
- {"version":3,"file":"DragDropContext.d.ts","sourceRoot":"","sources":["../../../src/components/DragDrop/DragDropContext.tsx"],"names":[],"mappings":"AAEA,OAAO,KAON,MAAM,OAAO,CAAC;AACf,OAAO,KAAK,EACV,oBAAoB,EASpB,4BAA4B,EAI7B,MAAM,kBAAkB,CAAC;AAkB1B,eAAO,MAAM,kBAAkB,4BAM9B,CAAC;AAMF,eAAO,MAAM,gBAAgB,EAAE,KAAK,CAAC,EAAE,CAAC,4BAA4B,CA4dnE,CAAC"}
1
+ {"version":3,"file":"DragDropContext.d.ts","sourceRoot":"","sources":["../../../src/components/DragDrop/DragDropContext.tsx"],"names":[],"mappings":"AAEA,OAAO,KAON,MAAM,OAAO,CAAC;AACf,OAAO,KAAK,EACV,oBAAoB,EASpB,4BAA4B,EAI7B,MAAM,kBAAkB,CAAC;AAkB1B,eAAO,MAAM,kBAAkB,4BAM9B,CAAC;AAMF,eAAO,MAAM,gBAAgB,EAAE,KAAK,CAAC,EAAE,CAAC,4BAA4B,CA8fnE,CAAC"}