@vuer-ai/vuer-uikit 0.0.19 → 0.0.21

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 (248) hide show
  1. package/dist/chunk-2JCULHBM.js +58 -0
  2. package/dist/chunk-2TRYGIGT.mjs +76 -0
  3. package/dist/chunk-2YCL2ET2.js +431 -0
  4. package/dist/chunk-3FR3WKI4.mjs +24 -0
  5. package/dist/chunk-44KW6PTD.mjs +111 -0
  6. package/dist/chunk-5OUTEHVX.js +48 -0
  7. package/dist/chunk-5SR53QBZ.js +143 -0
  8. package/dist/chunk-5TVG5JK5.js +93 -0
  9. package/dist/chunk-5ZZC23M7.mjs +60 -0
  10. package/dist/chunk-6N5422RT.js +110 -0
  11. package/dist/chunk-AOUGWGQR.js +609 -0
  12. package/dist/chunk-B2E7AY66.mjs +86 -0
  13. package/dist/chunk-BOPZFNFS.mjs +54 -0
  14. package/dist/chunk-CLTLT5XW.js +27 -0
  15. package/dist/chunk-DDOX4EEM.mjs +46 -0
  16. package/dist/chunk-DZ4J7I7I.mjs +114 -0
  17. package/dist/chunk-E33MW663.js +179 -0
  18. package/dist/chunk-EAZQH4IX.mjs +27 -0
  19. package/dist/chunk-EFIRD3FN.js +69 -0
  20. package/dist/chunk-EOFYA6CS.js +53 -0
  21. package/dist/chunk-EUY74AXP.mjs +341 -0
  22. package/dist/chunk-EYIFKSU2.mjs +259 -0
  23. package/dist/chunk-F56ZKT7B.mjs +1 -0
  24. package/dist/chunk-F776EMXP.mjs +82 -0
  25. package/dist/chunk-FORVP7XH.js +164 -0
  26. package/dist/chunk-FP26SRGL.js +377 -0
  27. package/dist/chunk-FRT225GK.mjs +34 -0
  28. package/dist/chunk-G5KMD72J.mjs +162 -0
  29. package/dist/chunk-G6PRZVSE.mjs +71 -0
  30. package/dist/chunk-H5P4IX7R.js +67 -0
  31. package/dist/chunk-HLJ7PQA7.mjs +15 -0
  32. package/dist/chunk-IGBWUFZL.js +79 -0
  33. package/dist/chunk-IXHMIR5P.js +131 -0
  34. package/dist/chunk-JAMJUXBY.mjs +45 -0
  35. package/dist/chunk-JMPVDU2C.mjs +110 -0
  36. package/dist/chunk-KJ42IGH6.js +2 -0
  37. package/dist/chunk-KTNZSZ5Y.mjs +23 -0
  38. package/dist/chunk-LEPXSM36.mjs +46 -0
  39. package/dist/chunk-LLXRJYQB.mjs +31 -0
  40. package/dist/chunk-M4IVLZIH.mjs +1 -0
  41. package/dist/chunk-MRVMXKZO.mjs +106 -0
  42. package/dist/chunk-MZ4POL3U.js +301 -0
  43. package/dist/chunk-N7CINZS2.js +2 -0
  44. package/dist/chunk-NODFVSVC.mjs +39 -0
  45. package/dist/chunk-OOI3SJDU.mjs +206 -0
  46. package/dist/chunk-OQ237S4Z.js +94 -0
  47. package/dist/chunk-OTPUWWEB.js +98 -0
  48. package/dist/chunk-PIR7EZC6.js +187 -0
  49. package/dist/chunk-PVRQNCSJ.js +49 -0
  50. package/dist/chunk-Q5KEB4UK.mjs +51 -0
  51. package/dist/chunk-QEY7BWIR.js +208 -0
  52. package/dist/chunk-QJR6MCTR.js +32 -0
  53. package/dist/chunk-QVUX6LLD.mjs +270 -0
  54. package/dist/chunk-QYRRQ65X.mjs +115 -0
  55. package/dist/chunk-SKO72K64.js +118 -0
  56. package/dist/chunk-T3VSSE2L.mjs +165 -0
  57. package/dist/chunk-TMBKCIVQ.mjs +148 -0
  58. package/dist/chunk-U2ZLDPOE.js +261 -0
  59. package/dist/chunk-U7SNLMJR.js +110 -0
  60. package/dist/chunk-UFHMEEGL.js +113 -0
  61. package/dist/chunk-UKFVRXAR.mjs +409 -0
  62. package/dist/chunk-UPTTGNMB.js +41 -0
  63. package/dist/chunk-V4KNORQN.js +21 -0
  64. package/dist/chunk-VAXIFFOT.js +83 -0
  65. package/dist/chunk-VGCVIHBR.mjs +1 -0
  66. package/dist/chunk-VXHM7V6F.mjs +92 -0
  67. package/dist/chunk-WDUTW7HS.mjs +87 -0
  68. package/dist/chunk-WJ7T7FAH.js +135 -0
  69. package/dist/chunk-WO3WHXDP.mjs +66 -0
  70. package/dist/chunk-X55EAYE2.js +94 -0
  71. package/dist/chunk-XMG3IVGZ.mjs +95 -0
  72. package/dist/chunk-XWS4SIB5.js +2 -0
  73. package/dist/chunk-XXWQ4RVP.js +25 -0
  74. package/dist/chunk-Y5I2GI4V.js +33 -0
  75. package/dist/chunk-YXDJPCAF.js +99 -0
  76. package/dist/chunk-ZVG2UKKC.mjs +603 -0
  77. package/dist/highlight-cursor/cursor-context.d.mts +7 -0
  78. package/dist/highlight-cursor/cursor-context.d.ts +7 -0
  79. package/dist/highlight-cursor/cursor-context.js +14 -0
  80. package/dist/highlight-cursor/cursor-context.mjs +1 -0
  81. package/dist/highlight-cursor/cursor-provider.d.mts +7 -0
  82. package/dist/highlight-cursor/cursor-provider.d.ts +7 -0
  83. package/dist/highlight-cursor/cursor-provider.js +12 -0
  84. package/dist/highlight-cursor/cursor-provider.mjs +3 -0
  85. package/dist/highlight-cursor/enhanced-components.d.mts +20 -0
  86. package/dist/highlight-cursor/enhanced-components.d.ts +20 -0
  87. package/dist/highlight-cursor/enhanced-components.js +37 -0
  88. package/dist/highlight-cursor/enhanced-components.mjs +12 -0
  89. package/dist/highlight-cursor/index.d.mts +16 -0
  90. package/dist/highlight-cursor/index.d.ts +16 -0
  91. package/dist/highlight-cursor/index.js +51 -0
  92. package/dist/highlight-cursor/index.mjs +14 -0
  93. package/dist/highlight-cursor/tabs-cursor-context.d.mts +14 -0
  94. package/dist/highlight-cursor/tabs-cursor-context.d.ts +14 -0
  95. package/dist/highlight-cursor/tabs-cursor-context.js +14 -0
  96. package/dist/highlight-cursor/tabs-cursor-context.mjs +1 -0
  97. package/dist/highlight-cursor/types.d.mts +39 -0
  98. package/dist/highlight-cursor/types.d.ts +39 -0
  99. package/dist/highlight-cursor/types.js +2 -0
  100. package/dist/highlight-cursor/types.mjs +1 -0
  101. package/dist/highlight-cursor/with-cursor.d.mts +7 -0
  102. package/dist/highlight-cursor/with-cursor.d.ts +7 -0
  103. package/dist/highlight-cursor/with-cursor.js +11 -0
  104. package/dist/highlight-cursor/with-cursor.mjs +2 -0
  105. package/dist/index.css +318 -0
  106. package/dist/index.d.mts +55 -0
  107. package/dist/index.d.ts +55 -0
  108. package/dist/index.js +131 -131
  109. package/dist/index.mjs +38 -0
  110. package/dist/styles/theme.css +192 -0
  111. package/dist/styles/theme.d.mts +2 -0
  112. package/dist/styles/theme.d.ts +2 -0
  113. package/dist/styles/toast.css +61 -0
  114. package/dist/styles/toast.d.mts +2 -0
  115. package/dist/styles/toast.d.ts +2 -0
  116. package/dist/styles/variables.css +188 -0
  117. package/dist/styles/variables.d.mts +2 -0
  118. package/dist/styles/variables.d.ts +2 -0
  119. package/dist/ui/avatar.d.mts +16 -0
  120. package/dist/ui/avatar.d.ts +16 -0
  121. package/dist/ui/avatar.js +25 -0
  122. package/dist/ui/avatar.mjs +4 -0
  123. package/dist/ui/badge.d.mts +14 -0
  124. package/dist/ui/badge.d.ts +14 -0
  125. package/dist/ui/badge.js +17 -0
  126. package/dist/ui/badge.mjs +4 -0
  127. package/dist/ui/button.d.mts +16 -0
  128. package/dist/ui/button.d.ts +16 -0
  129. package/dist/ui/button.js +13 -0
  130. package/dist/ui/button.mjs +4 -0
  131. package/dist/ui/card.d.mts +12 -0
  132. package/dist/ui/card.d.ts +12 -0
  133. package/dist/ui/card.js +37 -0
  134. package/dist/ui/card.mjs +4 -0
  135. package/dist/ui/checkbox.d.mts +11 -0
  136. package/dist/ui/checkbox.d.ts +11 -0
  137. package/dist/ui/checkbox.js +13 -0
  138. package/dist/ui/checkbox.mjs +4 -0
  139. package/dist/ui/collapsible.d.mts +9 -0
  140. package/dist/ui/collapsible.d.ts +9 -0
  141. package/dist/ui/collapsible.js +21 -0
  142. package/dist/ui/collapsible.mjs +4 -0
  143. package/dist/ui/dropdown.d.mts +28 -0
  144. package/dist/ui/dropdown.d.ts +28 -0
  145. package/dist/ui/dropdown.js +69 -0
  146. package/dist/ui/dropdown.mjs +4 -0
  147. package/dist/ui/index.d.mts +47 -0
  148. package/dist/ui/index.d.ts +47 -0
  149. package/dist/ui/index.js +414 -0
  150. package/dist/ui/index.mjs +33 -0
  151. package/dist/ui/input-numbers.d.mts +15 -0
  152. package/dist/ui/input-numbers.d.ts +15 -0
  153. package/dist/ui/input-numbers.js +14 -0
  154. package/dist/ui/input-numbers.mjs +5 -0
  155. package/dist/ui/input.d.mts +22 -0
  156. package/dist/ui/input.d.ts +22 -0
  157. package/dist/ui/input.js +17 -0
  158. package/dist/ui/input.mjs +4 -0
  159. package/dist/ui/layout.d.mts +12 -0
  160. package/dist/ui/layout.d.ts +12 -0
  161. package/dist/ui/layout.js +13 -0
  162. package/dist/ui/layout.mjs +4 -0
  163. package/dist/ui/modal.d.mts +28 -0
  164. package/dist/ui/modal.d.ts +28 -0
  165. package/dist/ui/modal.js +49 -0
  166. package/dist/ui/modal.mjs +4 -0
  167. package/dist/ui/popover.d.mts +10 -0
  168. package/dist/ui/popover.d.ts +10 -0
  169. package/dist/ui/popover.js +25 -0
  170. package/dist/ui/popover.mjs +4 -0
  171. package/dist/ui/radio-group.d.mts +8 -0
  172. package/dist/ui/radio-group.d.ts +8 -0
  173. package/dist/ui/radio-group.js +17 -0
  174. package/dist/ui/radio-group.mjs +4 -0
  175. package/dist/ui/select.d.mts +28 -0
  176. package/dist/ui/select.d.ts +28 -0
  177. package/dist/ui/select.js +49 -0
  178. package/dist/ui/select.mjs +4 -0
  179. package/dist/ui/sheet.d.mts +16 -0
  180. package/dist/ui/sheet.d.ts +16 -0
  181. package/dist/ui/sheet.js +39 -0
  182. package/dist/ui/sheet.mjs +2 -0
  183. package/dist/ui/slider.d.mts +10 -0
  184. package/dist/ui/slider.d.ts +10 -0
  185. package/dist/ui/slider.js +13 -0
  186. package/dist/ui/slider.mjs +4 -0
  187. package/dist/ui/switch.d.mts +7 -0
  188. package/dist/ui/switch.d.ts +7 -0
  189. package/dist/ui/switch.js +13 -0
  190. package/dist/ui/switch.mjs +4 -0
  191. package/dist/ui/tabs.d.mts +16 -0
  192. package/dist/ui/tabs.d.ts +16 -0
  193. package/dist/ui/tabs.js +26 -0
  194. package/dist/ui/tabs.mjs +5 -0
  195. package/dist/ui/textarea.d.mts +16 -0
  196. package/dist/ui/textarea.d.ts +16 -0
  197. package/dist/ui/textarea.js +13 -0
  198. package/dist/ui/textarea.mjs +4 -0
  199. package/dist/ui/theme-context.d.mts +17 -0
  200. package/dist/ui/theme-context.d.ts +17 -0
  201. package/dist/ui/theme-context.js +17 -0
  202. package/dist/ui/theme-context.mjs +4 -0
  203. package/dist/ui/timeline.d.mts +23 -0
  204. package/dist/ui/timeline.d.ts +23 -0
  205. package/dist/ui/timeline.js +15 -0
  206. package/dist/ui/timeline.mjs +6 -0
  207. package/dist/ui/toast.d.mts +7 -0
  208. package/dist/ui/toast.d.ts +7 -0
  209. package/dist/ui/toast.js +14 -0
  210. package/dist/ui/toast.mjs +1 -0
  211. package/dist/ui/toggle-group.d.mts +12 -0
  212. package/dist/ui/toggle-group.d.ts +12 -0
  213. package/dist/ui/toggle-group.js +18 -0
  214. package/dist/ui/toggle-group.mjs +5 -0
  215. package/dist/ui/toggle.d.mts +13 -0
  216. package/dist/ui/toggle.d.ts +13 -0
  217. package/dist/ui/toggle.js +17 -0
  218. package/dist/ui/toggle.mjs +4 -0
  219. package/dist/ui/tooltip.d.mts +10 -0
  220. package/dist/ui/tooltip.d.ts +10 -0
  221. package/dist/ui/tooltip.js +25 -0
  222. package/dist/ui/tooltip.mjs +4 -0
  223. package/dist/ui/tree-view-v2.d.mts +25 -0
  224. package/dist/ui/tree-view-v2.d.ts +25 -0
  225. package/dist/ui/tree-view-v2.js +14 -0
  226. package/dist/ui/tree-view-v2.mjs +5 -0
  227. package/dist/ui/tree-view.d.mts +28 -0
  228. package/dist/ui/tree-view.d.ts +28 -0
  229. package/dist/ui/tree-view.js +11 -0
  230. package/dist/ui/tree-view.mjs +2 -0
  231. package/dist/ui/version-badge.d.mts +26 -0
  232. package/dist/ui/version-badge.d.ts +26 -0
  233. package/dist/ui/version-badge.js +14 -0
  234. package/dist/ui/version-badge.mjs +5 -0
  235. package/dist/utils/cn.d.mts +5 -0
  236. package/dist/utils/cn.d.ts +5 -0
  237. package/dist/utils/cn.js +10 -0
  238. package/dist/utils/cn.mjs +1 -0
  239. package/dist/utils/index.d.mts +3 -0
  240. package/dist/utils/index.d.ts +3 -0
  241. package/dist/utils/index.js +16 -0
  242. package/dist/utils/index.mjs +3 -0
  243. package/dist/utils/use-local-storage.d.mts +3 -0
  244. package/dist/utils/use-local-storage.d.ts +3 -0
  245. package/dist/utils/use-local-storage.js +10 -0
  246. package/dist/utils/use-local-storage.mjs +1 -0
  247. package/package.json +3 -2
  248. package/src/ui/version-badge.tsx +5 -2
@@ -0,0 +1,603 @@
1
+ import { TreeView } from './chunk-EYIFKSU2.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 };
@@ -0,0 +1,7 @@
1
+ import * as react from 'react';
2
+ import { CursorContextType } from './types.mjs';
3
+
4
+ declare const CursorContext: react.Context<CursorContextType>;
5
+ declare const useCursor: () => CursorContextType;
6
+
7
+ export { CursorContext, useCursor };
@@ -0,0 +1,7 @@
1
+ import * as react from 'react';
2
+ import { CursorContextType } from './types.js';
3
+
4
+ declare const CursorContext: react.Context<CursorContextType>;
5
+ declare const useCursor: () => CursorContextType;
6
+
7
+ export { CursorContext, useCursor };
@@ -0,0 +1,14 @@
1
+ 'use strict';
2
+
3
+ var chunkCLTLT5XW_js = require('../chunk-CLTLT5XW.js');
4
+
5
+
6
+
7
+ Object.defineProperty(exports, "CursorContext", {
8
+ enumerable: true,
9
+ get: function () { return chunkCLTLT5XW_js.CursorContext; }
10
+ });
11
+ Object.defineProperty(exports, "useCursor", {
12
+ enumerable: true,
13
+ get: function () { return chunkCLTLT5XW_js.useCursor; }
14
+ });
@@ -0,0 +1 @@
1
+ export { CursorContext, useCursor } from '../chunk-3FR3WKI4.mjs';
@@ -0,0 +1,7 @@
1
+ import * as react_jsx_runtime from 'react/jsx-runtime';
2
+ import { CursorProviderProps } from './types.mjs';
3
+ import 'react';
4
+
5
+ declare const CursorProvider: ({ children, maxOffsetX, maxOffsetY, cursorSize, transitionDuration, cursorClassName, className, as: Component, ...props }: CursorProviderProps) => react_jsx_runtime.JSX.Element;
6
+
7
+ export { CursorProvider };
@@ -0,0 +1,7 @@
1
+ import * as react_jsx_runtime from 'react/jsx-runtime';
2
+ import { CursorProviderProps } from './types.js';
3
+ import 'react';
4
+
5
+ declare const CursorProvider: ({ children, maxOffsetX, maxOffsetY, cursorSize, transitionDuration, cursorClassName, className, as: Component, ...props }: CursorProviderProps) => react_jsx_runtime.JSX.Element;
6
+
7
+ export { CursorProvider };
@@ -0,0 +1,12 @@
1
+ 'use strict';
2
+
3
+ var chunkQEY7BWIR_js = require('../chunk-QEY7BWIR.js');
4
+ require('../chunk-XXWQ4RVP.js');
5
+ require('../chunk-CLTLT5XW.js');
6
+
7
+
8
+
9
+ Object.defineProperty(exports, "CursorProvider", {
10
+ enumerable: true,
11
+ get: function () { return chunkQEY7BWIR_js.CursorProvider; }
12
+ });
@@ -0,0 +1,3 @@
1
+ export { CursorProvider } from '../chunk-OOI3SJDU.mjs';
2
+ import '../chunk-KTNZSZ5Y.mjs';
3
+ import '../chunk-3FR3WKI4.mjs';