saha-ui 1.22.5 → 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,CAwWpD,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 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
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 = 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
- activeIndex: F,
17
- sourceContainerId: A,
18
- dragPosition: a,
19
- isDragging: r,
20
- selectionState: l,
21
- historyState: c
22
- } = j;
23
- return p(() => {
24
- y(r && a ? (s) => [
25
- ...s.slice(-50),
26
- // Keep last 50 points
27
- { x: a.x, y: a.y, timestamp: Date.now() }
28
- ] : []);
29
- }, [r, a]), p(() => {
30
- if (!u || !h) return;
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
+ isDragging: i,
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 o = performance.now();
33
- n.current.frames++, o >= n.current.lastTime + 1e3 && (O(
38
+ const n = performance.now();
39
+ a.current.frames++, n >= a.current.lastTime + 1e3 && (k(
34
40
  Math.round(
35
- n.current.frames * 1e3 / (o - n.current.lastTime)
41
+ a.current.frames * 1e3 / (n - a.current.lastTime)
36
42
  )
37
- ), n.current.frames = 0, n.current.lastTime = o), requestAnimationFrame(s);
38
- }, m = requestAnimationFrame(s);
39
- return () => cancelAnimationFrame(m);
40
- }, [u, h]), p(() => {
41
- N.current = performance.now();
42
- }), p(() => {
43
- k(performance.now() - N.current);
44
- }), u ? /* @__PURE__ */ t(v, { 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: C(
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 T = ({
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
- }[I],
57
- !i && "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 T = ({
65
71
  /* @__PURE__ */ e("div", { className: "flex items-center gap-1", children: /* @__PURE__ */ e(
66
72
  "button",
67
73
  {
68
- onClick: () => D(!i),
74
+ onClick: () => S(!m),
69
75
  className: "p-1 hover:bg-background rounded transition-colors",
70
- children: i ? /* @__PURE__ */ e(z, { className: "w-4 h-4" }) : /* @__PURE__ */ e(G, { 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
- 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: [
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 T = ({
80
86
  /* @__PURE__ */ e(
81
87
  "span",
82
88
  {
83
- className: C(
89
+ className: j(
84
90
  "ml-2 font-mono font-medium",
85
- x >= 50 ? "text-green-500" : x >= 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: x
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
  ] })
@@ -102,45 +108,45 @@ const T = ({
102
108
  /* @__PURE__ */ t("div", { className: "bg-muted/50 rounded px-2 py-1 space-y-1", children: [
103
109
  /* @__PURE__ */ t("div", { className: "flex justify-between", children: [
104
110
  /* @__PURE__ */ e("span", { className: "text-muted-foreground", children: "Is Dragging:" }),
105
- /* @__PURE__ */ e("span", { className: "font-medium", children: r ? "Yes" : "No" })
111
+ /* @__PURE__ */ e("span", { className: "font-medium", children: i ? "Yes" : "No" })
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: R || "—" })
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
- a && /* @__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(a.x),
129
+ Math.round(o.x),
124
130
  ", y:",
125
131
  " ",
126
- Math.round(a.y)
132
+ Math.round(o.y)
127
133
  ] })
128
134
  ] })
129
135
  ] })
130
136
  ] }),
131
- l && /* @__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
- l.selectedIds.size,
143
+ f.selectedIds.size,
138
144
  " items"
139
145
  ] })
140
146
  ] }),
141
- l.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(l.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,32 +157,32 @@ const T = ({
151
157
  ] })
152
158
  ] })
153
159
  ] }),
154
- c && /* @__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: c.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: c.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: c.past.length })
173
+ /* @__PURE__ */ e("span", { className: "font-medium", children: u.past.length })
168
174
  ] })
169
175
  ] })
170
176
  ] }),
171
- b && /* @__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(b, 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
- g && r && d.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]",
@@ -197,7 +203,7 @@ const T = ({
197
203
  /* @__PURE__ */ e(
198
204
  "polyline",
199
205
  {
200
- points: d.map((s) => `${s.x},${s.y}`).join(" "),
206
+ points: p.map((s) => `${s.x},${s.y}`).join(" "),
201
207
  fill: "none",
202
208
  stroke: "url(#dragPathGrad)",
203
209
  strokeWidth: 2,
@@ -206,8 +212,8 @@ const T = ({
206
212
  strokeLinejoin: "round"
207
213
  }
208
214
  ),
209
- d.map((s, m) => {
210
- const o = 0.18 + m / d.length * 0.82;
215
+ p.map((s, r) => {
216
+ const n = 0.18 + r / p.length * 0.82;
211
217
  return /* @__PURE__ */ e(
212
218
  "circle",
213
219
  {
@@ -215,15 +221,15 @@ const T = ({
215
221
  cy: s.y,
216
222
  r: 2.25,
217
223
  fill: "url(#dotGrad)",
218
- fillOpacity: o
224
+ fillOpacity: n
219
225
  },
220
- m
226
+ r
221
227
  );
222
228
  })
223
229
  ]
224
230
  }
225
231
  ),
226
- g && r && a && /* @__PURE__ */ t(v, { children: [
232
+ c && i && (d || o) && /* @__PURE__ */ t(C, { children: [
227
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 } }" }),
228
234
  /* @__PURE__ */ t(
229
235
  "div",
@@ -231,8 +237,8 @@ const T = ({
231
237
  "aria-hidden": !0,
232
238
  style: {
233
239
  position: "fixed",
234
- left: a.x,
235
- top: a.y,
240
+ left: d ? d.x : o.x,
241
+ top: d ? d.y : o.y,
236
242
  transform: "translate(-50%, -50%)",
237
243
  pointerEvents: "none",
238
244
  zIndex: 1e4,
@@ -280,7 +286,7 @@ const T = ({
280
286
  ] })
281
287
  ] }) : null;
282
288
  };
283
- T.displayName = "DebugOverlay";
289
+ Y.displayName = "DebugOverlay";
284
290
  export {
285
- T as DebugOverlay
291
+ Y as DebugOverlay
286
292
  };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "saha-ui",
3
- "version": "1.22.5",
3
+ "version": "1.22.6",
4
4
  "description": "Ultra-modern React component library built with TypeScript, Tailwind CSS v4, and OKLCH colors",
5
5
  "type": "module",
6
6
  "license": "MIT",