@vuer-ai/vuer-uikit 0.0.4 → 0.0.7

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 (153) hide show
  1. package/dist/{chunk-FXIL4NQZ.js → chunk-2JCULHBM.js} +2 -2
  2. package/dist/{chunk-3Q75Z2CT.mjs → chunk-2TRYGIGT.mjs} +2 -2
  3. package/dist/{chunk-QOUX33X5.mjs → chunk-3XVIJY3H.mjs} +11 -16
  4. package/dist/{chunk-XACRGXGF.js → chunk-4PAHMURP.js} +6 -13
  5. package/dist/{chunk-RACVRWME.js → chunk-5MZCQW4U.js} +13 -18
  6. package/dist/{chunk-7V4ELMOH.js → chunk-5OUTEHVX.js} +8 -12
  7. package/dist/{chunk-KQHNQQUZ.js → chunk-5P3KAS53.js} +5 -4
  8. package/dist/{chunk-ECWCQWV5.js → chunk-5SR53QBZ.js} +22 -27
  9. package/dist/{chunk-OE56M4MX.js → chunk-5TVG5JK5.js} +4 -4
  10. package/dist/{chunk-PKGNHHWG.mjs → chunk-5ZZC23M7.mjs} +1 -1
  11. package/dist/{chunk-OTDY2E2A.js → chunk-66DYOZI3.js} +8 -8
  12. package/dist/{chunk-KYKEJFJT.js → chunk-6N5422RT.js} +9 -9
  13. package/dist/{chunk-6ILSFDR5.mjs → chunk-7X6N54LX.mjs} +3 -3
  14. package/dist/{chunk-XPNUQSKQ.mjs → chunk-B2E7AY66.mjs} +9 -17
  15. package/dist/{chunk-X2QENXCS.mjs → chunk-BOPZFNFS.mjs} +1 -1
  16. package/dist/{chunk-5GPQ7U5B.mjs → chunk-DDOX4EEM.mjs} +7 -11
  17. package/dist/{chunk-NN7R5DNL.mjs → chunk-DZ4J7I7I.mjs} +20 -25
  18. package/dist/{chunk-G7XNQVPB.js → chunk-E33MW663.js} +14 -22
  19. package/dist/{chunk-D4C5V4EN.mjs → chunk-E5KWKBH3.mjs} +8 -1
  20. package/dist/{chunk-R6XNT4PN.js → chunk-EGPLKTJM.js} +15 -15
  21. package/dist/{chunk-COFRS37Z.mjs → chunk-EUY74AXP.mjs} +11 -7
  22. package/dist/{chunk-ATDHGFVI.mjs → chunk-F776EMXP.mjs} +3 -3
  23. package/dist/{chunk-GSXXTAQ3.js → chunk-FP26SRGL.js} +19 -15
  24. package/dist/{chunk-MASRZTZC.mjs → chunk-FRT225GK.mjs} +1 -1
  25. package/dist/{chunk-75QDQ67T.js → chunk-FSMKJAZT.js} +8 -1
  26. package/dist/{chunk-WOG6UIG5.mjs → chunk-G6PRZVSE.mjs} +1 -1
  27. package/dist/{chunk-Z37VNICQ.js → chunk-H5P4IX7R.js} +3 -3
  28. package/dist/{chunk-LVSI4HYF.mjs → chunk-IG43DNY2.mjs} +9 -9
  29. package/dist/{chunk-LD7Y34QT.js → chunk-IGBWUFZL.js} +2 -2
  30. package/dist/chunk-IOI3YFTY.js +261 -0
  31. package/dist/{chunk-Q3APPCB2.mjs → chunk-IQ6J7YTQ.mjs} +4 -4
  32. package/dist/{chunk-DWIK2CUV.mjs → chunk-JAMJUXBY.mjs} +1 -1
  33. package/dist/chunk-KQAHAGUG.js +609 -0
  34. package/dist/chunk-KTNZSZ5Y.mjs +23 -0
  35. package/dist/{chunk-7A7VNE3J.mjs → chunk-LLXRJYQB.mjs} +1 -1
  36. package/dist/{chunk-7WUQTWQX.js → chunk-MZ4POL3U.js} +18 -20
  37. package/dist/chunk-O4TK3AKI.mjs +259 -0
  38. package/dist/chunk-OBWGRG45.js +21 -0
  39. package/dist/{chunk-KVFK3YC7.js → chunk-PIR7EZC6.js} +6 -6
  40. package/dist/{chunk-5BIQ3IN7.js → chunk-QA7H2Z3Z.js} +5 -5
  41. package/dist/{chunk-66JQXJEV.mjs → chunk-QVUX6LLD.mjs} +8 -10
  42. package/dist/{chunk-25GQKTNF.mjs → chunk-QYRRQ65X.mjs} +19 -9
  43. package/dist/{chunk-ENZI5WM7.js → chunk-SKO72K64.js} +22 -12
  44. package/dist/{chunk-TOZYLDAL.mjs → chunk-SP3DH5MP.mjs} +5 -12
  45. package/dist/{chunk-CZSRIDXN.mjs → chunk-T3VSSE2L.mjs} +1 -1
  46. package/dist/{chunk-IPKCIMU4.mjs → chunk-TMBKCIVQ.mjs} +9 -17
  47. package/dist/{chunk-YQORMF34.js → chunk-U7SNLMJR.js} +12 -12
  48. package/dist/{chunk-7SXCVFSA.mjs → chunk-UMIQYHO6.mjs} +1 -1
  49. package/dist/{chunk-KO7BQ6RR.js → chunk-VAXIFFOT.js} +4 -4
  50. package/dist/{chunk-UFR656UY.mjs → chunk-WDUTW7HS.mjs} +11 -11
  51. package/dist/{chunk-M3KBBKQR.mjs → chunk-WMXX2UMD.mjs} +5 -5
  52. package/dist/{chunk-ATEHWT2R.mjs → chunk-WOZWC6KO.mjs} +4 -3
  53. package/dist/{chunk-SI56IQWH.js → chunk-X55EAYE2.js} +14 -22
  54. package/dist/chunk-XCCC7HVN.mjs +603 -0
  55. package/dist/{chunk-A2Z57NAA.js → chunk-XUQ5A7ZA.js} +2 -2
  56. package/dist/chunk-XXWQ4RVP.js +25 -0
  57. package/dist/{chunk-FYS6YECN.js → chunk-Y5I2GI4V.js} +2 -2
  58. package/dist/{chunk-277NQUJD.js → chunk-YXDJPCAF.js} +5 -5
  59. package/dist/highlight-cursor/cursor-provider.js +3 -3
  60. package/dist/highlight-cursor/cursor-provider.mjs +2 -2
  61. package/dist/highlight-cursor/enhanced-components.js +13 -13
  62. package/dist/highlight-cursor/enhanced-components.mjs +8 -8
  63. package/dist/highlight-cursor/index.js +19 -19
  64. package/dist/highlight-cursor/index.mjs +9 -9
  65. package/dist/index.css +9 -5
  66. package/dist/index.d.mts +3 -1
  67. package/dist/index.d.ts +3 -1
  68. package/dist/index.js +142 -132
  69. package/dist/index.mjs +31 -29
  70. package/dist/styles/theme.css +2 -1
  71. package/dist/styles/toast.css +6 -3
  72. package/dist/ui/avatar.js +7 -6
  73. package/dist/ui/avatar.mjs +3 -2
  74. package/dist/ui/badge.js +4 -4
  75. package/dist/ui/badge.mjs +2 -2
  76. package/dist/ui/button.js +3 -3
  77. package/dist/ui/button.mjs +2 -2
  78. package/dist/ui/card.js +9 -9
  79. package/dist/ui/card.mjs +2 -2
  80. package/dist/ui/checkbox.js +3 -3
  81. package/dist/ui/checkbox.mjs +2 -2
  82. package/dist/ui/collapsible.js +5 -5
  83. package/dist/ui/collapsible.mjs +2 -2
  84. package/dist/ui/dropdown.js +17 -17
  85. package/dist/ui/dropdown.mjs +2 -2
  86. package/dist/ui/index.d.mts +3 -1
  87. package/dist/ui/index.d.ts +3 -1
  88. package/dist/ui/index.js +129 -119
  89. package/dist/ui/index.mjs +29 -27
  90. package/dist/ui/input-numbers.js +4 -4
  91. package/dist/ui/input-numbers.mjs +3 -3
  92. package/dist/ui/input.d.mts +2 -2
  93. package/dist/ui/input.d.ts +2 -2
  94. package/dist/ui/input.js +4 -4
  95. package/dist/ui/input.mjs +2 -2
  96. package/dist/ui/layout.d.mts +1 -1
  97. package/dist/ui/layout.d.ts +1 -1
  98. package/dist/ui/layout.js +3 -3
  99. package/dist/ui/layout.mjs +2 -2
  100. package/dist/ui/modal.js +12 -12
  101. package/dist/ui/modal.mjs +2 -2
  102. package/dist/ui/popover.js +7 -6
  103. package/dist/ui/popover.mjs +3 -2
  104. package/dist/ui/radio-group.js +4 -4
  105. package/dist/ui/radio-group.mjs +2 -2
  106. package/dist/ui/select.d.mts +1 -1
  107. package/dist/ui/select.d.ts +1 -1
  108. package/dist/ui/select.js +12 -12
  109. package/dist/ui/select.mjs +2 -2
  110. package/dist/ui/sheet.d.mts +1 -1
  111. package/dist/ui/sheet.d.ts +1 -1
  112. package/dist/ui/sheet.js +10 -10
  113. package/dist/ui/sheet.mjs +2 -2
  114. package/dist/ui/slider.js +3 -3
  115. package/dist/ui/slider.mjs +2 -2
  116. package/dist/ui/switch.js +3 -3
  117. package/dist/ui/switch.mjs +2 -2
  118. package/dist/ui/tabs.js +7 -7
  119. package/dist/ui/tabs.mjs +3 -3
  120. package/dist/ui/textarea.d.mts +1 -1
  121. package/dist/ui/textarea.d.ts +1 -1
  122. package/dist/ui/textarea.js +3 -3
  123. package/dist/ui/textarea.mjs +2 -2
  124. package/dist/ui/theme-context.js +3 -3
  125. package/dist/ui/theme-context.mjs +1 -1
  126. package/dist/ui/timeline.d.mts +23 -0
  127. package/dist/ui/timeline.d.ts +23 -0
  128. package/dist/ui/timeline.js +14 -0
  129. package/dist/ui/timeline.mjs +5 -0
  130. package/dist/ui/toggle-group.js +5 -5
  131. package/dist/ui/toggle-group.mjs +3 -3
  132. package/dist/ui/toggle.js +4 -4
  133. package/dist/ui/toggle.mjs +2 -2
  134. package/dist/ui/tooltip.js +7 -6
  135. package/dist/ui/tooltip.mjs +3 -2
  136. package/dist/ui/tree-view-v2.d.mts +25 -0
  137. package/dist/ui/tree-view-v2.d.ts +25 -0
  138. package/dist/ui/tree-view-v2.js +13 -0
  139. package/dist/ui/tree-view-v2.mjs +4 -0
  140. package/dist/ui/tree-view.d.mts +7 -6
  141. package/dist/ui/tree-view.d.ts +7 -6
  142. package/dist/ui/tree-view.js +3 -3
  143. package/dist/ui/tree-view.mjs +2 -2
  144. package/dist/utils/cn.js +2 -2
  145. package/dist/utils/cn.mjs +1 -1
  146. package/dist/utils/index.js +2 -2
  147. package/dist/utils/index.mjs +1 -1
  148. package/package.json +8 -9
  149. package/dist/chunk-FVT46HEE.js +0 -21
  150. package/dist/chunk-HW6SLBO3.mjs +0 -9
  151. package/dist/chunk-UWO6RBCE.js +0 -11
  152. /package/dist/{chunk-S2F2GRDB.mjs → chunk-IKIXD35H.mjs} +0 -0
  153. /package/dist/{chunk-HUQZOPYD.js → chunk-P3NMVNEO.js} +0 -0
@@ -0,0 +1,603 @@
1
+ import { TreeView } from './chunk-O4TK3AKI.mjs';
2
+ import { cn } from './chunk-KTNZSZ5Y.mjs';
3
+ import { Magnet, ChevronLeft, ChevronRight } from 'lucide-react';
4
+ import React, { useState, useRef, useCallback, useMemo, useEffect } from 'react';
5
+ import { jsx, jsxs } from 'react/jsx-runtime';
6
+
7
+ var formatDuration = (seconds) => {
8
+ const sign = seconds < 0 ? "-" : "";
9
+ const absSeconds = Math.abs(seconds);
10
+ if (absSeconds < 1) {
11
+ if (absSeconds < 5e-4) return "0s";
12
+ return `${sign}${Math.round(absSeconds * 1e3)}ms`;
13
+ }
14
+ if (absSeconds < 60) {
15
+ return `${sign}${absSeconds.toFixed(3)}s`;
16
+ }
17
+ const SECONDS_IN_MINUTE = 60;
18
+ const SECONDS_IN_HOUR = 3600;
19
+ const SECONDS_IN_DAY = 86400;
20
+ const SECONDS_IN_MONTH = 2592e3;
21
+ const SECONDS_IN_YEAR = 31536e3;
22
+ if (absSeconds < SECONDS_IN_HOUR) {
23
+ const m = Math.floor(absSeconds / SECONDS_IN_MINUTE);
24
+ const s = absSeconds % SECONDS_IN_MINUTE;
25
+ return `${sign}${m}m ${s.toFixed(2).padStart(5, "0")}s`;
26
+ }
27
+ if (absSeconds < SECONDS_IN_DAY) {
28
+ const h = Math.floor(absSeconds / SECONDS_IN_HOUR);
29
+ const m = Math.floor(absSeconds % SECONDS_IN_HOUR / SECONDS_IN_MINUTE);
30
+ const s = Math.floor(absSeconds % SECONDS_IN_MINUTE);
31
+ return `${sign}${h}h ${String(m).padStart(2, "0")}m ${String(s).padStart(2, "0")}s`;
32
+ }
33
+ if (absSeconds < SECONDS_IN_MONTH) {
34
+ const d2 = Math.floor(absSeconds / SECONDS_IN_DAY);
35
+ const h = Math.floor(absSeconds % SECONDS_IN_DAY / SECONDS_IN_HOUR);
36
+ const m = Math.floor(absSeconds % SECONDS_IN_HOUR / SECONDS_IN_MINUTE);
37
+ return `${sign}${d2}d ${String(h).padStart(2, "0")}h ${String(m).padStart(2, "0")}m`;
38
+ }
39
+ if (absSeconds < SECONDS_IN_YEAR) {
40
+ const mo2 = Math.floor(absSeconds / SECONDS_IN_MONTH);
41
+ const d2 = Math.floor(absSeconds % SECONDS_IN_MONTH / SECONDS_IN_DAY);
42
+ const h = Math.floor(absSeconds % SECONDS_IN_DAY / SECONDS_IN_HOUR);
43
+ return `${sign}${mo2}mo ${String(d2).padStart(3, "0")}d ${String(h).padStart(2, "0")}h`;
44
+ }
45
+ const y = Math.floor(absSeconds / SECONDS_IN_YEAR);
46
+ const mo = Math.floor(absSeconds % SECONDS_IN_YEAR / SECONDS_IN_MONTH);
47
+ const d = Math.floor(absSeconds % SECONDS_IN_MONTH / SECONDS_IN_DAY);
48
+ return `${sign}${y}y ${String(mo).padStart(2, "0")}mo ${String(d).padStart(3, "0")}d`;
49
+ };
50
+ var borderColorClasses = {
51
+ blue: "border-blue-500/85",
52
+ green: "border-green-500/85",
53
+ orange: "border-orange-500/85",
54
+ purple: "border-purple-500/85",
55
+ "gray-light": "border-line-secondary/20",
56
+ "gray-medium": "border-slate-500/85"
57
+ };
58
+ var colorClasses = {
59
+ blue: "bg-blue-500/85",
60
+ green: "bg-green-500/85",
61
+ orange: "bg-orange-500/85",
62
+ purple: "bg-purple-500/85",
63
+ "gray-light": "bg-line-secondary/20",
64
+ "gray-medium": "bg-slate-500/85"
65
+ };
66
+ var leftWedgeClasses = {
67
+ blue: "border-l-blue-500/85",
68
+ green: "border-l-green-500/85",
69
+ orange: "border-l-orange-500/85",
70
+ purple: "border-l-purple-500/85",
71
+ "gray-light": "border-l-slate-300",
72
+ "gray-medium": "border-l-slate-500/85"
73
+ };
74
+ var rightWedgeClasses = {
75
+ blue: "border-r-blue-500/85",
76
+ green: "border-r-green-500/85",
77
+ orange: "border-r-orange-500/85",
78
+ purple: "border-r-purple-500/85",
79
+ "gray-light": "border-r-slate-300",
80
+ "gray-medium": "border-r-slate-500/85"
81
+ };
82
+ function Timeline({ data, totalDuration, getIcon }) {
83
+ const [visibleData, setVisibleData] = useState([]);
84
+ const [hoveredId, setHoveredId] = useState(null);
85
+ const timelineContainerRef = useRef(null);
86
+ const [viewStart, setViewStart] = useState(-totalDuration * 0.25);
87
+ const [viewDuration, setViewDuration] = useState(totalDuration * 1.5);
88
+ const timeToPercent = useCallback(
89
+ (time) => (time - viewStart) / viewDuration * 100,
90
+ [viewStart, viewDuration]
91
+ );
92
+ const handlePan = (direction) => {
93
+ const panAmount = viewDuration * 0.1;
94
+ if (direction === "left") {
95
+ setViewStart((s) => s - panAmount);
96
+ } else {
97
+ setViewStart((s) => s + panAmount);
98
+ }
99
+ };
100
+ const timeMarkers = useMemo(() => {
101
+ const markers = [];
102
+ const niceIntervals = [
103
+ 1e-3,
104
+ 2e-3,
105
+ 5e-3,
106
+ 0.01,
107
+ 0.02,
108
+ 0.05,
109
+ 0.1,
110
+ 0.2,
111
+ 0.5,
112
+ 1,
113
+ 2,
114
+ 5,
115
+ 10,
116
+ 20,
117
+ 50,
118
+ 100
119
+ ];
120
+ const targetMarkerCount = 10;
121
+ const rawInterval = viewDuration / targetMarkerCount;
122
+ const interval = niceIntervals.find((i) => i > rawInterval) || niceIntervals[niceIntervals.length - 1];
123
+ const viewEnd = viewStart + viewDuration;
124
+ const shownSeconds = /* @__PURE__ */ new Set();
125
+ const formatTickLabel = (seconds) => {
126
+ const sign = seconds < 0 ? "-" : "";
127
+ const absSeconds = Math.abs(seconds);
128
+ let s = Math.floor(absSeconds);
129
+ let ms = Math.round((absSeconds - s) * 1e3);
130
+ if (ms >= 1e3) {
131
+ s += 1;
132
+ ms -= 1e3;
133
+ }
134
+ if (absSeconds < 1 && absSeconds > -1) {
135
+ return `${sign}${ms}ms`;
136
+ }
137
+ const baseSecond = s * (sign === "-" ? -1 : 1);
138
+ if (shownSeconds.has(baseSecond)) {
139
+ return ms > 0 ? `+${ms}ms` : "";
140
+ }
141
+ shownSeconds.add(baseSecond);
142
+ if (ms === 0) {
143
+ return `${sign}${s}s`;
144
+ }
145
+ return `${sign}${s}s`;
146
+ };
147
+ const firstMarkerTime = Math.floor(viewStart / interval) * interval;
148
+ const lastMarkerTime = Math.ceil(viewEnd / interval) * interval;
149
+ for (let time = firstMarkerTime; time <= lastMarkerTime; time += interval) {
150
+ const roundedTime = Number.parseFloat(time.toPrecision(15));
151
+ const label = formatTickLabel(roundedTime);
152
+ if (label) {
153
+ markers.push({ time: roundedTime, label });
154
+ }
155
+ }
156
+ return markers;
157
+ }, [viewStart, viewDuration]);
158
+ const keyEventTimes = useMemo(() => {
159
+ const events = [];
160
+ const timeSet = /* @__PURE__ */ new Set();
161
+ const addEvent = (time, type) => {
162
+ const key = `${time.toFixed(6)}-${type}`;
163
+ if (!timeSet.has(key)) {
164
+ events.push({ time, type });
165
+ timeSet.add(key);
166
+ }
167
+ };
168
+ visibleData.forEach((item) => {
169
+ if (item.createTime !== void 0) addEvent(item.createTime, "create");
170
+ if (item.startTime !== void 0) addEvent(item.startTime, "start");
171
+ if (item.startTime !== void 0 && item.duration !== void 0) {
172
+ addEvent(item.startTime + item.duration, "end");
173
+ }
174
+ if (item.time !== void 0) addEvent(item.time, "event");
175
+ });
176
+ return events.sort((a, b) => a.time - b.time);
177
+ }, [visibleData]);
178
+ const cursorContainerRef = useRef(null);
179
+ const lastClientX = useRef(0);
180
+ const isMouseOver = useRef(false);
181
+ const animationFrameRef = useRef(null);
182
+ const updateCursor = useCallback(() => {
183
+ if (!isMouseOver.current) return;
184
+ const timelineEl = timelineContainerRef.current;
185
+ const cursorEl = cursorContainerRef.current;
186
+ if (!timelineEl || !cursorEl) return;
187
+ const rect = timelineEl.getBoundingClientRect();
188
+ const cursorX = lastClientX.current - rect.left;
189
+ const rawHoverTime = viewStart + cursorX / timelineEl.offsetWidth * viewDuration;
190
+ const snapThresholdInPixels = 8;
191
+ const snapThresholdInTime = snapThresholdInPixels / timelineEl.offsetWidth * viewDuration;
192
+ let closestSnap = null;
193
+ let minDistance = Number.POSITIVE_INFINITY;
194
+ for (const event of keyEventTimes) {
195
+ const distance = Math.abs(event.time - rawHoverTime);
196
+ if (distance < minDistance && distance < snapThresholdInTime) {
197
+ minDistance = distance;
198
+ closestSnap = event;
199
+ }
200
+ }
201
+ const displayTime = (closestSnap == null ? void 0 : closestSnap.time) ?? rawHoverTime;
202
+ const percent = timeToPercent(displayTime);
203
+ cursorEl.style.setProperty("--cursor-left", `${percent}%`);
204
+ cursorEl.style.setProperty("--readout-text", `"${formatDuration(displayTime)}"`);
205
+ cursorEl.style.setProperty("--magnet-opacity", closestSnap ? "1" : "0");
206
+ cursorEl.classList.remove("opacity-0");
207
+ }, [viewStart, viewDuration, keyEventTimes, timeToPercent]);
208
+ useEffect(() => {
209
+ const timelineEl = timelineContainerRef.current;
210
+ if (!timelineEl) return;
211
+ const handleMouseMove = (e) => {
212
+ lastClientX.current = e.clientX;
213
+ if (animationFrameRef.current) cancelAnimationFrame(animationFrameRef.current);
214
+ animationFrameRef.current = requestAnimationFrame(updateCursor);
215
+ };
216
+ const handleMouseEnter = () => {
217
+ isMouseOver.current = true;
218
+ };
219
+ const handleMouseLeave = () => {
220
+ var _a;
221
+ isMouseOver.current = false;
222
+ if (animationFrameRef.current) cancelAnimationFrame(animationFrameRef.current);
223
+ (_a = cursorContainerRef.current) == null ? void 0 : _a.classList.add("opacity-0");
224
+ };
225
+ timelineEl.addEventListener("mousemove", handleMouseMove);
226
+ timelineEl.addEventListener("mouseenter", handleMouseEnter);
227
+ timelineEl.addEventListener("mouseleave", handleMouseLeave);
228
+ return () => {
229
+ timelineEl.removeEventListener("mousemove", handleMouseMove);
230
+ timelineEl.removeEventListener("mouseenter", handleMouseEnter);
231
+ timelineEl.removeEventListener("mouseleave", handleMouseLeave);
232
+ if (animationFrameRef.current) cancelAnimationFrame(animationFrameRef.current);
233
+ };
234
+ }, [updateCursor]);
235
+ useEffect(() => {
236
+ const timelineEl = timelineContainerRef.current;
237
+ if (!timelineEl) return;
238
+ const wheelHandler = (e) => {
239
+ e.preventDefault();
240
+ const container = timelineContainerRef.current;
241
+ if (!container) return;
242
+ if (e.ctrlKey || e.altKey) {
243
+ const rect = container.getBoundingClientRect();
244
+ const cursorX = e.clientX - rect.left;
245
+ const timeAtCursor = viewStart + cursorX / container.offsetWidth * viewDuration;
246
+ const zoomFactor = 1.1;
247
+ const newDuration = e.deltaY < 0 ? viewDuration / zoomFactor : viewDuration * zoomFactor;
248
+ const minDuration = 0.01;
249
+ const maxDuration = totalDuration * 10;
250
+ if (newDuration < minDuration || newDuration > maxDuration) return;
251
+ const newViewStart = timeAtCursor - cursorX / container.offsetWidth * newDuration;
252
+ setViewDuration(newDuration);
253
+ setViewStart(newViewStart);
254
+ } else {
255
+ const panX = e.deltaX / container.offsetWidth * viewDuration;
256
+ const panY = e.deltaY / container.offsetWidth * viewDuration;
257
+ setViewStart((s) => s + panX + panY);
258
+ }
259
+ };
260
+ timelineEl.addEventListener("wheel", wheelHandler, { passive: false });
261
+ return () => {
262
+ timelineEl.removeEventListener("wheel", wheelHandler);
263
+ };
264
+ }, [viewStart, viewDuration, totalDuration]);
265
+ useEffect(() => {
266
+ if (isMouseOver.current) {
267
+ if (animationFrameRef.current) cancelAnimationFrame(animationFrameRef.current);
268
+ animationFrameRef.current = requestAnimationFrame(updateCursor);
269
+ }
270
+ }, [viewStart, viewDuration, updateCursor]);
271
+ return /* @__PURE__ */ jsx("div", { className: "bg-bg-primary text-text-primary border-line-secondary/20 rounded-uk-md mx-auto w-full max-w-7xl overflow-hidden border font-sans shadow-2xl", children: /* @__PURE__ */ jsxs("div", { className: "grid grid-cols-[minmax(300px,30%)_1fr]", children: [
272
+ /* @__PURE__ */ jsx(
273
+ TreeView,
274
+ {
275
+ data,
276
+ getIcon,
277
+ onVisibleDataChange: setVisibleData,
278
+ onItemHover: setHoveredId,
279
+ hoveredId
280
+ }
281
+ ),
282
+ /* @__PURE__ */ jsxs("div", { className: "relative", children: [
283
+ /* @__PURE__ */ jsxs(
284
+ "div",
285
+ {
286
+ className: "border-line-secondary/20 scrollbar-hide relative cursor-crosshair overflow-x-auto border-l active:cursor-grabbing",
287
+ ref: timelineContainerRef,
288
+ children: [
289
+ /* @__PURE__ */ jsx("div", { className: "bg-bg-primary sticky top-0 z-10", children: /* @__PURE__ */ jsxs("div", { className: "border-line-secondary/20 relative h-8 border-b", children: [
290
+ keyEventTimes.map(({ time }, tickIndex) => {
291
+ const percent = timeToPercent(time);
292
+ if (percent < 0 || percent > 100) return null;
293
+ return /* @__PURE__ */ jsx(
294
+ "div",
295
+ {
296
+ className: "bg-line-secondary/20 absolute top-1/2 z-0 h-1 w-1 -translate-y-1/2 rounded-full",
297
+ style: { left: `${percent}%` }
298
+ },
299
+ `snap-${time}-${tickIndex}`
300
+ );
301
+ }),
302
+ timeMarkers.map((marker, ind) => {
303
+ const naturalCenterPercent = timeToPercent(marker.time);
304
+ if (naturalCenterPercent < -20 || naturalCenterPercent > 120) {
305
+ return null;
306
+ }
307
+ const labelHalfWidthPercent = 3;
308
+ const clampedCenterPercent = Math.min(
309
+ 100 - labelHalfWidthPercent,
310
+ Math.max(labelHalfWidthPercent, naturalCenterPercent)
311
+ );
312
+ const zInd = ind < timeMarkers.length - 1 ? "10" : "0";
313
+ return /* @__PURE__ */ jsxs(React.Fragment, { children: [
314
+ /* @__PURE__ */ jsx(
315
+ "div",
316
+ {
317
+ className: "bg-border bg-line-secondary/20 absolute top-0 h-full w-px",
318
+ style: { left: `${naturalCenterPercent}%` }
319
+ }
320
+ ),
321
+ /* @__PURE__ */ jsx(
322
+ "div",
323
+ {
324
+ className: cn(
325
+ "bg-bg-primary text-text-secondary rounded-uk-xs text-uk-sm pointer-events-none absolute top-1/2 -translate-x-1/2 -translate-y-1/2 px-1 backdrop-blur-sm",
326
+ "z-" + zInd
327
+ ),
328
+ style: { left: `${clampedCenterPercent}%` },
329
+ children: marker.label
330
+ }
331
+ )
332
+ ] }, marker.time);
333
+ })
334
+ ] }) }),
335
+ /* @__PURE__ */ jsx("div", { className: "relative pb-12", children: visibleData.map((item) => {
336
+ const isHaltedStep = item.isHalted;
337
+ const barStart = item.startTime;
338
+ const barEnd = item.startTime !== void 0 && item.duration !== void 0 ? item.startTime + item.duration : void 0;
339
+ const viewEnd = viewStart + viewDuration;
340
+ return /* @__PURE__ */ jsxs(
341
+ "div",
342
+ {
343
+ className: cn(
344
+ "relative h-[32px]",
345
+ hoveredId === item.id && "bg-bg-secondary/80"
346
+ ),
347
+ onMouseEnter: () => setHoveredId(item.id),
348
+ onMouseLeave: () => setHoveredId(null),
349
+ children: [
350
+ item.createTime !== void 0 && item.startTime !== void 0 && item.createTime < item.startTime && item.color && /* @__PURE__ */ jsxs(
351
+ "div",
352
+ {
353
+ className: "absolute top-1/2 h-2 -translate-y-1/2",
354
+ style: {
355
+ left: `${timeToPercent(item.createTime)}%`,
356
+ width: `${(item.startTime - item.createTime) / viewDuration * 100}%`
357
+ },
358
+ children: [
359
+ /* @__PURE__ */ jsx(
360
+ "div",
361
+ {
362
+ className: cn(
363
+ "absolute top-1/2 left-0 h-2 w-px -translate-y-1/2",
364
+ colorClasses[item.color]
365
+ )
366
+ }
367
+ ),
368
+ /* @__PURE__ */ jsx(
369
+ "div",
370
+ {
371
+ className: cn(
372
+ "absolute top-1/2 w-full -translate-y-1/2 border-t",
373
+ borderColorClasses[item.color]
374
+ )
375
+ }
376
+ ),
377
+ /* @__PURE__ */ jsx(
378
+ "div",
379
+ {
380
+ className: cn(
381
+ "absolute top-1/2 right-0 h-2 w-px -translate-y-1/2",
382
+ colorClasses[item.color]
383
+ )
384
+ }
385
+ )
386
+ ]
387
+ }
388
+ ),
389
+ item.startTime !== void 0 && item.duration !== void 0 && !isHaltedStep && /* @__PURE__ */ jsx(
390
+ "div",
391
+ {
392
+ className: cn(
393
+ "rounded-uk-xs absolute top-1/2 flex h-5 -translate-y-1/2 items-center justify-center overflow-hidden",
394
+ item.color && colorClasses[item.color],
395
+ item.hasStripes && "bg-[repeating-linear-gradient(-45deg,transparent,transparent_4px,rgba(0,0,0,0.1)_4px,rgba(0,0,0,0.1)_8px)]"
396
+ ),
397
+ style: {
398
+ left: `${timeToPercent(item.startTime)}%`,
399
+ width: `${item.duration / viewDuration * 100}%`
400
+ }
401
+ }
402
+ ),
403
+ item.startTime !== void 0 && item.duration !== void 0 && !isHaltedStep && (() => {
404
+ const visibleStart = Math.max(barStart || 0, viewStart);
405
+ const visibleEnd = Math.min(barEnd || 0, viewEnd);
406
+ if (visibleEnd <= visibleStart) return null;
407
+ const visibleDuration = visibleEnd - visibleStart;
408
+ const visibleWidthPercent = visibleDuration / viewDuration * 100;
409
+ if (visibleWidthPercent < 4) return null;
410
+ return /* @__PURE__ */ jsx(
411
+ "div",
412
+ {
413
+ className: "pointer-events-none absolute top-1/2 flex h-5 -translate-y-1/2 items-center justify-center",
414
+ style: {
415
+ left: `${timeToPercent(visibleStart)}%`,
416
+ width: `${visibleWidthPercent}%`
417
+ },
418
+ children: /* @__PURE__ */ jsx(
419
+ "span",
420
+ {
421
+ className: cn(
422
+ "text-uk-sm font-medium whitespace-nowrap",
423
+ item.color === "gray-light" || item.color === "gray-medium" ? "text-slate-600 dark:text-slate-300" : "text-text-highlight"
424
+ ),
425
+ children: formatDuration(item.duration)
426
+ }
427
+ )
428
+ }
429
+ );
430
+ })(),
431
+ item.startTime !== void 0 && item.duration !== void 0 && !isHaltedStep && item.color && /* @__PURE__ */ jsx(
432
+ "div",
433
+ {
434
+ className: cn(
435
+ "bg-bg-primary absolute top-1/2 z-10 size-2 -translate-x-1/2 -translate-y-1/2 rounded-full border-2",
436
+ borderColorClasses[item.color]
437
+ ),
438
+ style: {
439
+ left: `${timeToPercent(item.startTime)}%`
440
+ }
441
+ }
442
+ ),
443
+ isHaltedStep && item.startTime !== void 0 && item.duration !== void 0 && /* @__PURE__ */ jsx(
444
+ "div",
445
+ {
446
+ className: "absolute top-1/2 flex h-full -translate-y-1/2 items-center",
447
+ style: {
448
+ left: `${timeToPercent(item.startTime)}%`,
449
+ width: `${item.duration / viewDuration * 100}%`
450
+ },
451
+ children: /* @__PURE__ */ jsxs("div", { className: "relative flex h-full w-full items-center justify-center", children: [
452
+ /* @__PURE__ */ jsx("div", { className: "bg-line-secondary absolute top-1/2 left-0 h-2 w-px -translate-y-1/2" }),
453
+ /* @__PURE__ */ jsx("div", { className: "border-line-secondary w-full border-t border-dashed" }),
454
+ /* @__PURE__ */ jsx("div", { className: "bg-line-secondary absolute top-1/2 right-0 h-2 w-px -translate-y-1/2" })
455
+ ] })
456
+ }
457
+ ),
458
+ isHaltedStep && item.startTime !== void 0 && item.duration !== void 0 && (() => {
459
+ const visibleStart = Math.max(barStart || 0, viewStart);
460
+ const visibleEnd = Math.min(barEnd || 0, viewEnd);
461
+ if (visibleEnd <= visibleStart) return null;
462
+ const visibleDuration = visibleEnd - visibleStart;
463
+ const visibleWidthPercent = visibleDuration / viewDuration * 100;
464
+ if (visibleWidthPercent < 4) return null;
465
+ return /* @__PURE__ */ jsx(
466
+ "div",
467
+ {
468
+ className: "pointer-events-none absolute top-1/2 flex h-5 -translate-y-1/2 items-center justify-center",
469
+ style: {
470
+ left: `${timeToPercent(visibleStart)}%`,
471
+ width: `${visibleWidthPercent}%`
472
+ },
473
+ children: /* @__PURE__ */ jsx("div", { className: "text-text-highlight text-uk-sm flex h-5 items-center rounded-full bg-orange-500/85 px-2 font-medium whitespace-nowrap", children: formatDuration(item.duration) })
474
+ }
475
+ );
476
+ })(),
477
+ item.time !== void 0 && /* @__PURE__ */ jsx(
478
+ "div",
479
+ {
480
+ className: "absolute top-1/2 size-4 -translate-y-1/2 rounded-full",
481
+ style: {
482
+ left: `calc(${timeToPercent(item.time)}% - 4px)`
483
+ },
484
+ children: getIcon(item)
485
+ }
486
+ )
487
+ ]
488
+ },
489
+ item.id
490
+ );
491
+ }) }),
492
+ /* @__PURE__ */ jsx("div", { className: "pointer-events-none absolute top-0 left-0 z-10 h-full w-2", children: visibleData.map((item, index) => {
493
+ const barEnd = item.startTime !== void 0 && item.duration !== void 0 ? item.startTime + item.duration : void 0;
494
+ const isOffscreenLeft = barEnd !== void 0 && barEnd < viewStart || item.time !== void 0 && item.time < viewStart;
495
+ if (isOffscreenLeft && item.color) {
496
+ return /* @__PURE__ */ jsx(
497
+ "div",
498
+ {
499
+ className: cn(
500
+ "absolute h-0 w-0 border-y-[6px] border-r-[5px] border-y-transparent",
501
+ rightWedgeClasses[item.color]
502
+ ),
503
+ style: {
504
+ top: `${32 + index * 32 + 16}px`,
505
+ transform: "translateY(-50%)"
506
+ }
507
+ },
508
+ `left-wedge-${item.id}`
509
+ );
510
+ }
511
+ return null;
512
+ }) }),
513
+ /* @__PURE__ */ jsx("div", { className: "pointer-events-none absolute top-0 right-0 z-10 h-full w-2", children: visibleData.map((item, index) => {
514
+ const barStart = item.startTime;
515
+ const viewEnd = viewStart + viewDuration;
516
+ const isOffscreenRight = barStart !== void 0 && barStart > viewEnd || item.time !== void 0 && item.time > viewEnd;
517
+ if (isOffscreenRight && item.color) {
518
+ return /* @__PURE__ */ jsx(
519
+ "div",
520
+ {
521
+ className: cn(
522
+ "absolute h-0 w-0 border-y-[6px] border-l-[5px] border-y-transparent",
523
+ leftWedgeClasses[item.color]
524
+ ),
525
+ style: {
526
+ top: `${32 + index * 32 + 16}px`,
527
+ transform: "translateY(-50%)"
528
+ }
529
+ },
530
+ `right-wedge-${item.id}`
531
+ );
532
+ }
533
+ return null;
534
+ }) }),
535
+ /* @__PURE__ */ jsxs(
536
+ "div",
537
+ {
538
+ ref: cursorContainerRef,
539
+ className: "pointer-events-none absolute top-0 left-0 z-10 h-full w-full opacity-0 transition-opacity duration-150",
540
+ style: {
541
+ "--cursor-left": "0%",
542
+ "--readout-text": '""',
543
+ "--magnet-opacity": "0"
544
+ },
545
+ children: [
546
+ /* @__PURE__ */ jsx(
547
+ "div",
548
+ {
549
+ className: "absolute top-0 h-full w-px bg-red-500",
550
+ style: { left: "var(--cursor-left)" }
551
+ }
552
+ ),
553
+ /* @__PURE__ */ jsxs(
554
+ "div",
555
+ {
556
+ className: "bg-bg-primary border-line-secondary/20 rounded-uk-sm text-uk-sm absolute top-1 flex items-center justify-center border px-2 py-0.5 whitespace-nowrap shadow-lg",
557
+ style: {
558
+ left: "var(--cursor-left)",
559
+ transform: "translateX(-50%)",
560
+ minWidth: "11ch"
561
+ },
562
+ children: [
563
+ /* @__PURE__ */ jsx(
564
+ Magnet,
565
+ {
566
+ className: "text-text-secondary mr-1.5 size-3 transition-opacity",
567
+ style: { opacity: "var(--magnet-opacity)" }
568
+ }
569
+ ),
570
+ /* @__PURE__ */ jsx("span", { className: "font-mono tabular-nums after:content-[var(--readout-text)]" })
571
+ ]
572
+ }
573
+ )
574
+ ]
575
+ }
576
+ )
577
+ ]
578
+ }
579
+ ),
580
+ /* @__PURE__ */ jsx("div", { className: "absolute bottom-4 left-1/2 z-20 w-max -translate-x-1/2", children: /* @__PURE__ */ jsxs("div", { className: "bg-bg-primary/75 flex items-center gap-2 rounded-full p-1 shadow-lg backdrop-blur-[2px]", children: [
581
+ /* @__PURE__ */ jsx(
582
+ "button",
583
+ {
584
+ onClick: () => handlePan("left"),
585
+ className: "hover:bg-bg-secondary rounded-full p-1",
586
+ children: /* @__PURE__ */ jsx(ChevronLeft, { className: "size-4" })
587
+ }
588
+ ),
589
+ /* @__PURE__ */ jsx("span", { className: "text-uk-sm w-24 text-center font-mono", children: formatDuration(viewDuration) }),
590
+ /* @__PURE__ */ jsx(
591
+ "button",
592
+ {
593
+ onClick: () => handlePan("right"),
594
+ className: "hover:bg-bg-secondary rounded-full p-1",
595
+ children: /* @__PURE__ */ jsx(ChevronRight, { className: "size-4" })
596
+ }
597
+ )
598
+ ] }) })
599
+ ] })
600
+ ] }) });
601
+ }
602
+
603
+ export { Timeline };
@@ -1,6 +1,6 @@
1
1
  'use strict';
2
2
 
3
- var chunkUWO6RBCE_js = require('./chunk-UWO6RBCE.js');
3
+ var chunkXXWQ4RVP_js = require('./chunk-XXWQ4RVP.js');
4
4
  var chunkCLTLT5XW_js = require('./chunk-CLTLT5XW.js');
5
5
  var react = require('react');
6
6
  var reactDom = require('react-dom');
@@ -186,7 +186,7 @@ var CursorProvider = ({
186
186
  Component,
187
187
  {
188
188
  ...props,
189
- className: chunkUWO6RBCE_js.cn(className),
189
+ className: chunkXXWQ4RVP_js.cn(className),
190
190
  style: {
191
191
  cursor: isMouseInside && !hoveredElementId ? "none" : "auto",
192
192
  ...props.style
@@ -0,0 +1,25 @@
1
+ 'use strict';
2
+
3
+ var clsx = require('clsx');
4
+ var tailwindMerge = require('tailwind-merge');
5
+
6
+ // src/utils/cn.ts
7
+ var twMerge = tailwindMerge.extendTailwindMerge({
8
+ override: {
9
+ classGroups: {
10
+ "font-size": [
11
+ "text-uk-xs",
12
+ "text-uk-sm",
13
+ "text-uk-md",
14
+ "text-uk-lg",
15
+ "text-uk-xl",
16
+ "text-uk-xxl"
17
+ ]
18
+ }
19
+ }
20
+ });
21
+ function cn(...inputs) {
22
+ return twMerge(clsx.clsx(inputs));
23
+ }
24
+
25
+ exports.cn = cn;
@@ -1,6 +1,6 @@
1
1
  'use strict';
2
2
 
3
- var chunkUWO6RBCE_js = require('./chunk-UWO6RBCE.js');
3
+ var chunkXXWQ4RVP_js = require('./chunk-XXWQ4RVP.js');
4
4
  var reactSlot = require('@radix-ui/react-slot');
5
5
  var jsxRuntime = require('react/jsx-runtime');
6
6
 
@@ -15,7 +15,7 @@ function Layout({
15
15
  return /* @__PURE__ */ jsxRuntime.jsx(
16
16
  Com,
17
17
  {
18
- className: chunkUWO6RBCE_js.cn(
18
+ className: chunkXXWQ4RVP_js.cn(
19
19
  {
20
20
  "gap-xs flex flex-col": orientation === "horizontal",
21
21
  "gap-xs grid grid-cols-[1fr_2fr] text-center": orientation === "vertical",