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,
|
|
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
|
|
2
|
-
import { useState as
|
|
3
|
-
import { useDragDropContext as
|
|
4
|
-
import { cn as
|
|
5
|
-
import { ChevronUp as
|
|
6
|
-
const
|
|
7
|
-
enabled:
|
|
8
|
-
position:
|
|
9
|
-
showCollisionRects:
|
|
10
|
-
showDragPath:
|
|
11
|
-
showPerformanceMetrics:
|
|
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
|
|
14
|
-
activeId:
|
|
15
|
-
activeItem:
|
|
16
|
-
activeIndex:
|
|
17
|
-
sourceContainerId:
|
|
18
|
-
dragPosition:
|
|
19
|
-
isDragging:
|
|
20
|
-
selectionState:
|
|
21
|
-
historyState:
|
|
22
|
-
} =
|
|
23
|
-
return
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
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
|
|
33
|
-
|
|
38
|
+
const n = performance.now();
|
|
39
|
+
a.current.frames++, n >= a.current.lastTime + 1e3 && (k(
|
|
34
40
|
Math.round(
|
|
35
|
-
|
|
41
|
+
a.current.frames * 1e3 / (n - a.current.lastTime)
|
|
36
42
|
)
|
|
37
|
-
),
|
|
38
|
-
},
|
|
39
|
-
return () => cancelAnimationFrame(
|
|
40
|
-
}, [
|
|
41
|
-
|
|
42
|
-
}),
|
|
43
|
-
|
|
44
|
-
}),
|
|
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:
|
|
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
|
-
}[
|
|
57
|
-
!
|
|
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: () =>
|
|
74
|
+
onClick: () => S(!m),
|
|
69
75
|
className: "p-1 hover:bg-background rounded transition-colors",
|
|
70
|
-
children:
|
|
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
|
-
|
|
75
|
-
|
|
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:
|
|
89
|
+
className: j(
|
|
84
90
|
"ml-2 font-mono font-medium",
|
|
85
|
-
|
|
91
|
+
N >= 50 ? "text-green-500" : N >= 30 ? "text-yellow-500" : "text-red-500"
|
|
86
92
|
),
|
|
87
|
-
children:
|
|
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
|
-
|
|
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:
|
|
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:
|
|
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:
|
|
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:
|
|
123
|
+
/* @__PURE__ */ e("span", { className: "font-mono font-medium truncate max-w-[120px]", children: z || "—" })
|
|
118
124
|
] }),
|
|
119
|
-
|
|
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(
|
|
129
|
+
Math.round(o.x),
|
|
124
130
|
", y:",
|
|
125
131
|
" ",
|
|
126
|
-
Math.round(
|
|
132
|
+
Math.round(o.y)
|
|
127
133
|
] })
|
|
128
134
|
] })
|
|
129
135
|
] })
|
|
130
136
|
] }),
|
|
131
|
-
|
|
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
|
-
|
|
143
|
+
f.selectedIds.size,
|
|
138
144
|
" items"
|
|
139
145
|
] })
|
|
140
146
|
] }),
|
|
141
|
-
|
|
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(
|
|
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
|
-
|
|
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:
|
|
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:
|
|
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:
|
|
173
|
+
/* @__PURE__ */ e("span", { className: "font-medium", children: u.past.length })
|
|
168
174
|
] })
|
|
169
175
|
] })
|
|
170
176
|
] }),
|
|
171
|
-
|
|
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(
|
|
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
|
-
|
|
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:
|
|
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
|
-
|
|
210
|
-
const
|
|
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:
|
|
224
|
+
fillOpacity: n
|
|
219
225
|
},
|
|
220
|
-
|
|
226
|
+
r
|
|
221
227
|
);
|
|
222
228
|
})
|
|
223
229
|
]
|
|
224
230
|
}
|
|
225
231
|
),
|
|
226
|
-
|
|
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:
|
|
235
|
-
top:
|
|
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
|
-
|
|
289
|
+
Y.displayName = "DebugOverlay";
|
|
284
290
|
export {
|
|
285
|
-
|
|
291
|
+
Y as DebugOverlay
|
|
286
292
|
};
|