saha-ui 1.22.4 → 1.22.5

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