@zendir/ui 0.4.1 → 0.6.0

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 (391) hide show
  1. package/CHANGELOG.md +34 -0
  2. package/README.md +640 -631
  3. package/dist/_virtual/_rolldown/runtime.js +13 -0
  4. package/dist/index.js +17 -221
  5. package/dist/react/3d/CesiumCaptureSource.d.ts +0 -1
  6. package/dist/react/3d/CesiumCaptureSource.js +364 -283
  7. package/dist/react/3d/CesiumCaptureSource.js.map +1 -1
  8. package/dist/react/3d/ZenSpace3D.d.ts +2 -3
  9. package/dist/react/3d/ZenSpace3D.js +1681 -1237
  10. package/dist/react/3d/ZenSpace3D.js.map +1 -1
  11. package/dist/react/3d/ZenSpace3DCesium.d.ts +0 -1
  12. package/dist/react/3d/ZenSpace3DCesium.js +513 -560
  13. package/dist/react/3d/ZenSpace3DCesium.js.map +1 -1
  14. package/dist/react/3d/ZenSpace3DShaders.js +61 -66
  15. package/dist/react/3d/ZenSpace3DShaders.js.map +1 -1
  16. package/dist/react/3d/ZenSpace3DTypes.d.ts +19 -20
  17. package/dist/react/3d/ZenSpace3DUtils.d.ts +0 -1
  18. package/dist/react/3d/ZenSpace3DUtils.js +37 -24
  19. package/dist/react/3d/ZenSpace3DUtils.js.map +1 -1
  20. package/dist/react/3d/capturePngAnalysis.js +42 -36
  21. package/dist/react/3d/capturePngAnalysis.js.map +1 -1
  22. package/dist/react/3d/index.d.ts +3 -3
  23. package/dist/react/3d/index.js +5 -53
  24. package/dist/react/3d/threeLoader.d.ts +1 -1
  25. package/dist/react/3d/threeLoader.js +23 -18
  26. package/dist/react/3d/threeLoader.js.map +1 -1
  27. package/dist/react/astro/ClassificationBanner.d.ts +2 -3
  28. package/dist/react/astro/ClassificationBanner.js +95 -79
  29. package/dist/react/astro/ClassificationBanner.js.map +1 -1
  30. package/dist/react/astro/GlobalStatusBar.d.ts +0 -1
  31. package/dist/react/astro/GlobalStatusBar.js +157 -163
  32. package/dist/react/astro/GlobalStatusBar.js.map +1 -1
  33. package/dist/react/astro/MissionClock.d.ts +7 -8
  34. package/dist/react/astro/MissionClock.js +377 -400
  35. package/dist/react/astro/MissionClock.js.map +1 -1
  36. package/dist/react/astro/MonitoringIcon.d.ts +1 -2
  37. package/dist/react/astro/MonitoringIcon.js +422 -358
  38. package/dist/react/astro/MonitoringIcon.js.map +1 -1
  39. package/dist/react/astro/Notification.d.ts +1 -2
  40. package/dist/react/astro/Notification.js +229 -126
  41. package/dist/react/astro/Notification.js.map +1 -1
  42. package/dist/react/astro/Progress.d.ts +0 -1
  43. package/dist/react/astro/Progress.js +199 -141
  44. package/dist/react/astro/Progress.js.map +1 -1
  45. package/dist/react/astro/SimulationControls.d.ts +3 -4
  46. package/dist/react/astro/SimulationControls.js +596 -650
  47. package/dist/react/astro/SimulationControls.js.map +1 -1
  48. package/dist/react/astro/StatusIndicator.d.ts +0 -1
  49. package/dist/react/astro/StatusIndicator.js +236 -170
  50. package/dist/react/astro/StatusIndicator.js.map +1 -1
  51. package/dist/react/astro/UnifiedTimeline.d.ts +9 -10
  52. package/dist/react/astro/UnifiedTimeline.js +2345 -2392
  53. package/dist/react/astro/UnifiedTimeline.js.map +1 -1
  54. package/dist/react/astro/index.d.ts +5 -5
  55. package/dist/react/astro/index.js +1 -25
  56. package/dist/react/cards/AccessCard.d.ts +0 -1
  57. package/dist/react/cards/AccessCard.js +471 -405
  58. package/dist/react/cards/AccessCard.js.map +1 -1
  59. package/dist/react/cards/OrbitCard.d.ts +0 -1
  60. package/dist/react/cards/OrbitCard.js +487 -364
  61. package/dist/react/cards/OrbitCard.js.map +1 -1
  62. package/dist/react/cards/SpacecraftCard.d.ts +0 -1
  63. package/dist/react/cards/SpacecraftCard.js +813 -925
  64. package/dist/react/cards/SpacecraftCard.js.map +1 -1
  65. package/dist/react/cards/TelemetryCard.d.ts +0 -1
  66. package/dist/react/cards/TelemetryCard.js +1055 -732
  67. package/dist/react/cards/TelemetryCard.js.map +1 -1
  68. package/dist/react/cards/TelemetryStreamCard.d.ts +0 -1
  69. package/dist/react/cards/TelemetryStreamCard.js +323 -297
  70. package/dist/react/cards/TelemetryStreamCard.js.map +1 -1
  71. package/dist/react/cards/index.d.ts +1 -1
  72. package/dist/react/cards/index.js +1 -8
  73. package/dist/react/charts/GroundTrackMap.d.ts +6 -7
  74. package/dist/react/charts/GroundTrackMap.js +1377 -1256
  75. package/dist/react/charts/GroundTrackMap.js.map +1 -1
  76. package/dist/react/charts/GroundTrackMapLeaflet.d.ts +1 -2
  77. package/dist/react/charts/GroundTrackMapLeaflet.js +1065 -987
  78. package/dist/react/charts/GroundTrackMapLeaflet.js.map +1 -1
  79. package/dist/react/charts/groundTrackMapLeafletTiles.js +34 -25
  80. package/dist/react/charts/groundTrackMapLeafletTiles.js.map +1 -1
  81. package/dist/react/charts/groundTrackMapLeafletUtils.js +70 -61
  82. package/dist/react/charts/groundTrackMapLeafletUtils.js.map +1 -1
  83. package/dist/react/charts/index.d.ts +1 -1
  84. package/dist/react/charts/index.js +7 -100
  85. package/dist/react/charts/unified/AstroChart.d.ts +1 -2
  86. package/dist/react/charts/unified/AstroChart.js +1331 -1411
  87. package/dist/react/charts/unified/AstroChart.js.map +1 -1
  88. package/dist/react/charts/unified/PowerOverviewChart.d.ts +3 -3
  89. package/dist/react/charts/unified/PowerOverviewChart.js +495 -478
  90. package/dist/react/charts/unified/PowerOverviewChart.js.map +1 -1
  91. package/dist/react/charts/unified/domain.d.ts +12 -13
  92. package/dist/react/charts/unified/domain.js +3999 -3145
  93. package/dist/react/charts/unified/domain.js.map +1 -1
  94. package/dist/react/charts/unified/generators.d.ts +3 -4
  95. package/dist/react/charts/unified/generators.js +561 -498
  96. package/dist/react/charts/unified/generators.js.map +1 -1
  97. package/dist/react/charts/unified/index.d.ts +1 -1
  98. package/dist/react/charts/unified/presets.d.ts +14 -15
  99. package/dist/react/charts/unified/presets.js +857 -994
  100. package/dist/react/charts/unified/presets.js.map +1 -1
  101. package/dist/react/charts/unified/sync.d.ts +2 -3
  102. package/dist/react/charts/unified/sync.js +229 -195
  103. package/dist/react/charts/unified/sync.js.map +1 -1
  104. package/dist/react/charts/unified/theme.d.ts +11 -12
  105. package/dist/react/charts/unified/theme.js +606 -642
  106. package/dist/react/charts/unified/theme.js.map +1 -1
  107. package/dist/react/charts/unified/types.d.ts +32 -33
  108. package/dist/react/charts/unified/useChartStream.d.ts +1 -2
  109. package/dist/react/charts/unified/useChartStream.js +203 -216
  110. package/dist/react/charts/unified/useChartStream.js.map +1 -1
  111. package/dist/react/chatgpt/AppCard.d.ts +1 -2
  112. package/dist/react/chatgpt/index.d.ts +7 -7
  113. package/dist/react/chatgpt/index.js +160 -139
  114. package/dist/react/chatgpt/index.js.map +1 -1
  115. package/dist/react/context/CategoryContext.d.ts +0 -1
  116. package/dist/react/context/CategoryContext.js +78 -29
  117. package/dist/react/context/CategoryContext.js.map +1 -1
  118. package/dist/react/context/DisplaySettingsContext.d.ts +1 -2
  119. package/dist/react/context/DisplaySettingsContext.js +205 -156
  120. package/dist/react/context/DisplaySettingsContext.js.map +1 -1
  121. package/dist/react/context/SpatialSelectionContext.d.ts +0 -1
  122. package/dist/react/context/SpatialSelectionContext.js +36 -7
  123. package/dist/react/context/SpatialSelectionContext.js.map +1 -1
  124. package/dist/react/core/data/DataTable.d.ts +3 -4
  125. package/dist/react/core/data/DataTable.js +473 -440
  126. package/dist/react/core/data/DataTable.js.map +1 -1
  127. package/dist/react/core/data/DataValue.d.ts +4 -5
  128. package/dist/react/core/data/DataValue.js +605 -538
  129. package/dist/react/core/data/DataValue.js.map +1 -1
  130. package/dist/react/core/data/propertyConfig.d.ts +1 -2
  131. package/dist/react/core/data/propertyConfig.js +446 -382
  132. package/dist/react/core/data/propertyConfig.js.map +1 -1
  133. package/dist/react/core/display/AstroIcon.d.ts +4 -5
  134. package/dist/react/core/display/AstroIcon.js +339 -429
  135. package/dist/react/core/display/AstroIcon.js.map +1 -1
  136. package/dist/react/core/display/Badge.d.ts +2 -3
  137. package/dist/react/core/display/Badge.js +131 -131
  138. package/dist/react/core/display/Badge.js.map +1 -1
  139. package/dist/react/core/display/CardHeader.d.ts +0 -1
  140. package/dist/react/core/display/CardHeader.js +398 -311
  141. package/dist/react/core/display/CardHeader.js.map +1 -1
  142. package/dist/react/core/display/Container.d.ts +2 -3
  143. package/dist/react/core/display/Container.js +640 -668
  144. package/dist/react/core/display/Container.js.map +1 -1
  145. package/dist/react/core/display/CopyButton.d.ts +1 -2
  146. package/dist/react/core/display/CopyButton.js +158 -101
  147. package/dist/react/core/display/CopyButton.js.map +1 -1
  148. package/dist/react/core/display/GlassCard.d.ts +3 -4
  149. package/dist/react/core/display/GlassCard.js +416 -369
  150. package/dist/react/core/display/GlassCard.js.map +1 -1
  151. package/dist/react/core/display/HeaderIconWithStatus.d.ts +0 -1
  152. package/dist/react/core/display/HeaderIconWithStatus.js +152 -152
  153. package/dist/react/core/display/HeaderIconWithStatus.js.map +1 -1
  154. package/dist/react/core/display/Icon.d.ts +2 -3
  155. package/dist/react/core/display/Icon.js +172 -143
  156. package/dist/react/core/display/Icon.js.map +1 -1
  157. package/dist/react/core/display/Typography.d.ts +24 -25
  158. package/dist/react/core/display/Typography.js +360 -178
  159. package/dist/react/core/display/Typography.js.map +1 -1
  160. package/dist/react/core/feedback/ConfirmDialog.d.ts +1 -2
  161. package/dist/react/core/feedback/ConfirmDialog.js +343 -304
  162. package/dist/react/core/feedback/ConfirmDialog.js.map +1 -1
  163. package/dist/react/core/feedback/Dialog.d.ts +2 -3
  164. package/dist/react/core/feedback/Dialog.js +189 -197
  165. package/dist/react/core/feedback/Dialog.js.map +1 -1
  166. package/dist/react/core/feedback/Toast.d.ts +2 -3
  167. package/dist/react/core/feedback/Toast.js +346 -207
  168. package/dist/react/core/feedback/Toast.js.map +1 -1
  169. package/dist/react/core/index.d.ts +26 -26
  170. package/dist/react/core/index.js +7 -119
  171. package/dist/react/core/inputs/Button.d.ts +2 -3
  172. package/dist/react/core/inputs/Button.js +281 -304
  173. package/dist/react/core/inputs/Button.js.map +1 -1
  174. package/dist/react/core/inputs/Checkbox.d.ts +2 -3
  175. package/dist/react/core/inputs/Checkbox.js +139 -127
  176. package/dist/react/core/inputs/Checkbox.js.map +1 -1
  177. package/dist/react/core/inputs/Input.d.ts +3 -4
  178. package/dist/react/core/inputs/Input.js +277 -285
  179. package/dist/react/core/inputs/Input.js.map +1 -1
  180. package/dist/react/core/inputs/LimitsBar.d.ts +1 -2
  181. package/dist/react/core/inputs/LimitsBar.js +271 -196
  182. package/dist/react/core/inputs/LimitsBar.js.map +1 -1
  183. package/dist/react/core/inputs/NumberInput.d.ts +2 -3
  184. package/dist/react/core/inputs/NumberInput.js +531 -503
  185. package/dist/react/core/inputs/NumberInput.js.map +1 -1
  186. package/dist/react/core/inputs/PinInput.d.ts +2 -3
  187. package/dist/react/core/inputs/PinInput.js +224 -207
  188. package/dist/react/core/inputs/PinInput.js.map +1 -1
  189. package/dist/react/core/inputs/Select.d.ts +1 -2
  190. package/dist/react/core/inputs/Select.js +298 -299
  191. package/dist/react/core/inputs/Select.js.map +1 -1
  192. package/dist/react/core/inputs/Toggle.d.ts +2 -3
  193. package/dist/react/core/inputs/Toggle.js +142 -148
  194. package/dist/react/core/inputs/Toggle.js.map +1 -1
  195. package/dist/react/core/layout/Box.d.ts +3 -4
  196. package/dist/react/core/layout/Box.js +118 -122
  197. package/dist/react/core/layout/Box.js.map +1 -1
  198. package/dist/react/core/layout/Center.d.ts +0 -1
  199. package/dist/react/core/layout/Center.js +45 -32
  200. package/dist/react/core/layout/Center.js.map +1 -1
  201. package/dist/react/core/layout/Divider.d.ts +1 -2
  202. package/dist/react/core/layout/Divider.js +112 -106
  203. package/dist/react/core/layout/Divider.js.map +1 -1
  204. package/dist/react/core/layout/Flex.d.ts +4 -5
  205. package/dist/react/core/layout/Flex.js +120 -124
  206. package/dist/react/core/layout/Flex.js.map +1 -1
  207. package/dist/react/core/layout/Grid.d.ts +5 -6
  208. package/dist/react/core/layout/Grid.js +131 -138
  209. package/dist/react/core/layout/Grid.js.map +1 -1
  210. package/dist/react/core/layout/Spacer.d.ts +0 -1
  211. package/dist/react/core/layout/Spacer.js +36 -29
  212. package/dist/react/core/layout/Spacer.js.map +1 -1
  213. package/dist/react/core/layout/Stack.d.ts +4 -5
  214. package/dist/react/core/layout/Stack.js +127 -70
  215. package/dist/react/core/layout/Stack.js.map +1 -1
  216. package/dist/react/core/layout/responsive.d.ts +1 -2
  217. package/dist/react/core/layout/responsive.js +25 -19
  218. package/dist/react/core/layout/responsive.js.map +1 -1
  219. package/dist/react/core/layout/useBreakpoint.d.ts +1 -1
  220. package/dist/react/core/layout/useBreakpoint.js +119 -66
  221. package/dist/react/core/layout/useBreakpoint.js.map +1 -1
  222. package/dist/react/core/navigation/AppBar.d.ts +1 -2
  223. package/dist/react/core/navigation/AppBar.js +827 -805
  224. package/dist/react/core/navigation/AppBar.js.map +1 -1
  225. package/dist/react/core/navigation/Pagination.d.ts +2 -3
  226. package/dist/react/core/navigation/Pagination.js +207 -187
  227. package/dist/react/core/navigation/Pagination.js.map +1 -1
  228. package/dist/react/core/navigation/SideNav.d.ts +11 -5
  229. package/dist/react/core/navigation/SideNav.js +857 -602
  230. package/dist/react/core/navigation/SideNav.js.map +1 -1
  231. package/dist/react/core/navigation/Tabs.d.ts +0 -1
  232. package/dist/react/core/navigation/Tabs.js +113 -119
  233. package/dist/react/core/navigation/Tabs.js.map +1 -1
  234. package/dist/react/core/overlays/Popover.d.ts +2 -3
  235. package/dist/react/core/overlays/Popover.js +303 -282
  236. package/dist/react/core/overlays/Popover.js.map +1 -1
  237. package/dist/react/core/overlays/SidePanel.d.ts +1 -2
  238. package/dist/react/core/overlays/SidePanel.js +217 -212
  239. package/dist/react/core/overlays/SidePanel.js.map +1 -1
  240. package/dist/react/core/overlays/Tooltip.d.ts +1 -2
  241. package/dist/react/core/overlays/Tooltip.js +170 -176
  242. package/dist/react/core/overlays/Tooltip.js.map +1 -1
  243. package/dist/react/core/widgets/ActivityPlanner.d.ts +0 -1
  244. package/dist/react/core/widgets/ActivityPlanner.js +855 -517
  245. package/dist/react/core/widgets/ActivityPlanner.js.map +1 -1
  246. package/dist/react/core/widgets/Capture.d.ts +2 -3
  247. package/dist/react/core/widgets/Capture.js +965 -779
  248. package/dist/react/core/widgets/Capture.js.map +1 -1
  249. package/dist/react/core/widgets/ChatPanel.d.ts +16 -17
  250. package/dist/react/core/widgets/ChatPanel.js +1734 -1034
  251. package/dist/react/core/widgets/ChatPanel.js.map +1 -1
  252. package/dist/react/core/widgets/ColorPickerPanel.d.ts +0 -1
  253. package/dist/react/core/widgets/ColorPickerPanel.js +298 -287
  254. package/dist/react/core/widgets/ColorPickerPanel.js.map +1 -1
  255. package/dist/react/core/widgets/CommandBuilder.d.ts +2 -3
  256. package/dist/react/core/widgets/CommandBuilder.js +624 -516
  257. package/dist/react/core/widgets/CommandBuilder.js.map +1 -1
  258. package/dist/react/core/widgets/ConnectionForm.d.ts +2 -3
  259. package/dist/react/core/widgets/ConnectionForm.js +528 -492
  260. package/dist/react/core/widgets/ConnectionForm.js.map +1 -1
  261. package/dist/react/core/widgets/FileExplorer.d.ts +3 -4
  262. package/dist/react/core/widgets/FileExplorer.js +617 -505
  263. package/dist/react/core/widgets/FileExplorer.js.map +1 -1
  264. package/dist/react/core/widgets/HexViewer.d.ts +2 -3
  265. package/dist/react/core/widgets/HexViewer.js +1353 -1091
  266. package/dist/react/core/widgets/HexViewer.js.map +1 -1
  267. package/dist/react/core/widgets/ImageFrame.d.ts +1 -2
  268. package/dist/react/core/widgets/ImageFrame.js +230 -193
  269. package/dist/react/core/widgets/ImageFrame.js.map +1 -1
  270. package/dist/react/core/widgets/ImageGallery.d.ts +2 -1
  271. package/dist/react/core/widgets/ImageGallery.js +380 -314
  272. package/dist/react/core/widgets/ImageGallery.js.map +1 -1
  273. package/dist/react/core/widgets/ImagePanel.d.ts +0 -1
  274. package/dist/react/core/widgets/ImagePanel.js +110 -101
  275. package/dist/react/core/widgets/ImagePanel.js.map +1 -1
  276. package/dist/react/core/widgets/LogViewer.d.ts +2 -3
  277. package/dist/react/core/widgets/LogViewer.js +711 -607
  278. package/dist/react/core/widgets/LogViewer.js.map +1 -1
  279. package/dist/react/core/widgets/MessageStream.d.ts +3 -4
  280. package/dist/react/core/widgets/MessageStream.js +514 -444
  281. package/dist/react/core/widgets/MessageStream.js.map +1 -1
  282. package/dist/react/core/widgets/MissionCalendar.d.ts +3 -4
  283. package/dist/react/core/widgets/MissionCalendar.js +1488 -1020
  284. package/dist/react/core/widgets/MissionCalendar.js.map +1 -1
  285. package/dist/react/core/widgets/PacketViewer.d.ts +2 -3
  286. package/dist/react/core/widgets/PacketViewer.js +550 -421
  287. package/dist/react/core/widgets/PacketViewer.js.map +1 -1
  288. package/dist/react/core/widgets/capture-placeholder.png.js +6 -5
  289. package/dist/react/core/widgets/capture-placeholder.png.js.map +1 -1
  290. package/dist/react/hooks/index.d.ts +5 -5
  291. package/dist/react/hooks/useAccessWindows.d.ts +0 -1
  292. package/dist/react/hooks/useCompactMode.d.ts +1 -1
  293. package/dist/react/hooks/useCompactMode.js +104 -58
  294. package/dist/react/hooks/useCompactMode.js.map +1 -1
  295. package/dist/react/hooks/useGroundTrackHistory.d.ts +0 -1
  296. package/dist/react/hooks/useSimulationScene.d.ts +1 -2
  297. package/dist/react/hooks/useSimulationScene.js +481 -374
  298. package/dist/react/hooks/useSimulationScene.js.map +1 -1
  299. package/dist/react/index.d.ts +3 -3
  300. package/dist/react/panels/LayerControlPanel.d.ts +1 -2
  301. package/dist/react/panels/LayerControlPanel.js +223 -180
  302. package/dist/react/panels/LayerControlPanel.js.map +1 -1
  303. package/dist/react/panels/ObjectInventoryPanel.d.ts +2 -3
  304. package/dist/react/panels/ObjectInventoryPanel.js +315 -250
  305. package/dist/react/panels/ObjectInventoryPanel.js.map +1 -1
  306. package/dist/react/panels/index.d.ts +1 -1
  307. package/dist/react/panels/index.js +1 -6
  308. package/dist/react/shared/ErrorBoundary.d.ts +1 -2
  309. package/dist/react/shared/ErrorBoundary.js +170 -139
  310. package/dist/react/shared/ErrorBoundary.js.map +1 -1
  311. package/dist/react/shared/Skeleton.d.ts +1 -2
  312. package/dist/react/shared/Skeleton.js +300 -301
  313. package/dist/react/shared/Skeleton.js.map +1 -1
  314. package/dist/react/theme/ThemeProvider.d.ts +2 -321
  315. package/dist/react/theme/ThemeProvider.js +312 -939
  316. package/dist/react/theme/ThemeProvider.js.map +1 -1
  317. package/dist/react/theme/cardAccent.d.ts +1 -2
  318. package/dist/react/theme/cardAccent.js +196 -126
  319. package/dist/react/theme/cardAccent.js.map +1 -1
  320. package/dist/react/theme/config.d.ts +0 -1
  321. package/dist/react/theme/config.js +47 -25
  322. package/dist/react/theme/config.js.map +1 -1
  323. package/dist/react/theme/index.d.ts +2 -2
  324. package/dist/react/theme/index.js +1 -16
  325. package/dist/react/theme/types.d.ts +332 -0
  326. package/dist/react/theme/types.js +39 -0
  327. package/dist/react/theme/types.js.map +1 -0
  328. package/dist/react/types.d.ts +8 -8
  329. package/dist/react/types.js +147 -47
  330. package/dist/react/types.js.map +1 -1
  331. package/dist/react/utils/categoryPalette.d.ts +0 -1
  332. package/dist/react/utils/categoryPalette.js +91 -102
  333. package/dist/react/utils/categoryPalette.js.map +1 -1
  334. package/dist/react/utils/index.d.ts +5 -5
  335. package/dist/react/utils/index.js +457 -371
  336. package/dist/react/utils/index.js.map +1 -1
  337. package/dist/react/visualizations/EclipseTimerCard.d.ts +0 -1
  338. package/dist/react/visualizations/LinkBudgetCard.d.ts +0 -1
  339. package/dist/react/visualizations/NavBallCard.d.ts +0 -1
  340. package/dist/react/visualizations/PropulsionCard.d.ts +1 -2
  341. package/dist/react/visualizations/SensorFootprintCard.d.ts +1 -2
  342. package/dist/react/visualizations/ThermalHeatmapCard.d.ts +0 -1
  343. package/dist/react/visualizations/index.d.ts +3 -3
  344. package/dist/react.d.ts +2 -1
  345. package/dist/react.js +17 -221
  346. package/dist/shaders/atmosphere.frag.js +6 -5
  347. package/dist/shaders/atmosphere.frag.js.map +1 -1
  348. package/dist/shaders/atmosphere.vert.js +6 -5
  349. package/dist/shaders/atmosphere.vert.js.map +1 -1
  350. package/dist/shaders/stars.frag.js +6 -5
  351. package/dist/shaders/stars.frag.js.map +1 -1
  352. package/dist/shaders/stars.vert.js +6 -5
  353. package/dist/shaders/stars.vert.js.map +1 -1
  354. package/dist/style.css +217 -194
  355. package/dist/tokens/core.d.ts +159 -0
  356. package/dist/tokens/core.js +144 -0
  357. package/dist/tokens/core.js.map +1 -0
  358. package/dist/tokens/css-vars.d.ts +213 -2
  359. package/dist/tokens/css-vars.js +590 -227
  360. package/dist/tokens/css-vars.js.map +1 -1
  361. package/dist/tokens/index.d.ts +31 -228
  362. package/dist/tokens/index.js +281 -366
  363. package/dist/tokens/index.js.map +1 -1
  364. package/dist/tokens/palettes/astro.d.ts +129 -0
  365. package/dist/tokens/palettes/astro.js +112 -0
  366. package/dist/tokens/palettes/astro.js.map +1 -0
  367. package/dist/tokens/palettes/index.d.ts +288 -0
  368. package/dist/tokens/palettes/index.js +35 -0
  369. package/dist/tokens/palettes/index.js.map +1 -0
  370. package/dist/tokens/palettes/tailwind.d.ts +324 -0
  371. package/dist/tokens/palettes/tailwind.js +201 -0
  372. package/dist/tokens/palettes/tailwind.js.map +1 -0
  373. package/dist/tokens/palettes/zendir.d.ts +126 -0
  374. package/dist/tokens/palettes/zendir.js +92 -0
  375. package/dist/tokens/palettes/zendir.js.map +1 -0
  376. package/dist/tokens/themes.d.ts +30 -0
  377. package/dist/tokens/themes.js +704 -0
  378. package/dist/tokens/themes.js.map +1 -0
  379. package/dist/tokens/tokens.css +419 -41
  380. package/dist/types/index.d.ts +2 -2
  381. package/package.json +310 -313
  382. package/dist/index.js.map +0 -1
  383. package/dist/react/3d/index.js.map +0 -1
  384. package/dist/react/astro/index.js.map +0 -1
  385. package/dist/react/cards/index.js.map +0 -1
  386. package/dist/react/charts/index.js.map +0 -1
  387. package/dist/react/core/index.js.map +0 -1
  388. package/dist/react/panels/index.js.map +0 -1
  389. package/dist/react/theme/astro-tokens.d.ts +0 -153
  390. package/dist/react/theme/index.js.map +0 -1
  391. package/dist/react.js.map +0 -1
@@ -1,520 +1,632 @@
1
- import { jsxs, jsx, Fragment } from "react/jsx-runtime";
2
- import React, { memo, useState, useMemo, useCallback } from "react";
3
1
  import { useTheme } from "../../theme/ThemeProvider.js";
4
2
  import { AstroIcon } from "../display/AstroIcon.js";
3
+ import React, { memo, useCallback, useMemo, useState } from "react";
4
+ import { Fragment, jsx, jsxs } from "react/jsx-runtime";
5
+ //#region src/react/core/widgets/FileExplorer.tsx
6
+ /**
7
+ * @zendir/ui - FileExplorer Component
8
+ *
9
+ * Hierarchical file browser for mission data management and file operations.
10
+ * Supports tree navigation, file actions (download, delete, upload),
11
+ * search, breadcrumbs, and multiple selection.
12
+ *
13
+ * Features:
14
+ * - Tree view and list view modes
15
+ * - Breadcrumb navigation
16
+ * - File type icons
17
+ * - Search/filter
18
+ * - Multi-select with checkboxes
19
+ * - File actions (open, download, delete, rename)
20
+ * - Upload dropzone
21
+ * - File size and modified date display
22
+ * - Sort by name, size, date
23
+ *
24
+ * @example
25
+ * ```tsx
26
+ * <FileExplorer
27
+ * files={fileTree}
28
+ * onFileOpen={(file) => console.log('Open:', file)}
29
+ * onFileDownload={(file) => console.log('Download:', file)}
30
+ * />
31
+ * ```
32
+ */
5
33
  function formatFileSize(bytes) {
6
- if (bytes === void 0 || bytes === null) return "—";
7
- if (bytes === 0) return "0 B";
8
- const units = ["B", "KB", "MB", "GB", "TB"];
9
- const i = Math.floor(Math.log(bytes) / Math.log(1024));
10
- return `${(bytes / Math.pow(1024, i)).toFixed(i > 0 ? 1 : 0)} ${units[i]}`;
34
+ if (bytes === void 0 || bytes === null) return "—";
35
+ if (bytes === 0) return "0 B";
36
+ const units = [
37
+ "B",
38
+ "KB",
39
+ "MB",
40
+ "GB",
41
+ "TB"
42
+ ];
43
+ const i = Math.floor(Math.log(bytes) / Math.log(1024));
44
+ return `${(bytes / Math.pow(1024, i)).toFixed(i > 0 ? 1 : 0)} ${units[i]}`;
11
45
  }
12
46
  function formatDate(date) {
13
- if (!date) return "—";
14
- const d = typeof date === "string" ? new Date(date) : date;
15
- if (isNaN(d.getTime())) return String(date);
16
- return d.toLocaleDateString("en-US", { month: "short", day: "2-digit", year: "numeric" }) + " " + d.toLocaleTimeString("en-US", { hour12: false, hour: "2-digit", minute: "2-digit" });
47
+ if (!date) return "—";
48
+ const d = typeof date === "string" ? new Date(date) : date;
49
+ if (isNaN(d.getTime())) return String(date);
50
+ return d.toLocaleDateString("en-US", {
51
+ month: "short",
52
+ day: "2-digit",
53
+ year: "numeric"
54
+ }) + " " + d.toLocaleTimeString("en-US", {
55
+ hour12: false,
56
+ hour: "2-digit",
57
+ minute: "2-digit"
58
+ });
17
59
  }
18
60
  function getFileIconName(file) {
19
- var _a;
20
- if (file.isDirectory) return "folder";
21
- const ext = ((_a = file.name.split(".").pop()) == null ? void 0 : _a.toLowerCase()) ?? "";
22
- const iconMap = {
23
- rb: "code",
24
- py: "code",
25
- js: "code",
26
- ts: "code",
27
- jsx: "code",
28
- tsx: "code",
29
- json: "insert-drive-file",
30
- yaml: "insert-drive-file",
31
- yml: "insert-drive-file",
32
- xml: "insert-drive-file",
33
- csv: "table-chart",
34
- txt: "short-text",
35
- md: "description",
36
- log: "insert-drive-file",
37
- gz: "archive",
38
- zip: "archive",
39
- tar: "archive",
40
- bin: "storage",
41
- dat: "storage",
42
- png: "image",
43
- jpg: "image",
44
- gif: "image",
45
- svg: "image",
46
- pdf: "picture-as-pdf",
47
- doc: "insert-drive-file",
48
- xls: "table-chart",
49
- ppt: "insert-drive-file"
50
- };
51
- return iconMap[ext] || "insert-drive-file";
61
+ if (file.isDirectory) return "folder";
62
+ return {
63
+ rb: "code",
64
+ py: "code",
65
+ js: "code",
66
+ ts: "code",
67
+ jsx: "code",
68
+ tsx: "code",
69
+ json: "insert-drive-file",
70
+ yaml: "insert-drive-file",
71
+ yml: "insert-drive-file",
72
+ xml: "insert-drive-file",
73
+ csv: "table-chart",
74
+ txt: "short-text",
75
+ md: "description",
76
+ log: "insert-drive-file",
77
+ gz: "archive",
78
+ zip: "archive",
79
+ tar: "archive",
80
+ bin: "storage",
81
+ dat: "storage",
82
+ png: "image",
83
+ jpg: "image",
84
+ gif: "image",
85
+ svg: "image",
86
+ pdf: "picture-as-pdf",
87
+ doc: "insert-drive-file",
88
+ xls: "table-chart",
89
+ ppt: "insert-drive-file"
90
+ }[file.name.split(".").pop()?.toLowerCase() ?? ""] || "insert-drive-file";
52
91
  }
53
92
  function flattenVisible(files, expanded, depth = 0) {
54
- const result = [];
55
- for (const f of files) {
56
- result.push({ file: f, depth });
57
- if (f.isDirectory && expanded.has(f.path) && f.children) {
58
- result.push(...flattenVisible(f.children, expanded, depth + 1));
59
- }
60
- }
61
- return result;
93
+ const result = [];
94
+ for (const f of files) {
95
+ result.push({
96
+ file: f,
97
+ depth
98
+ });
99
+ if (f.isDirectory && expanded.has(f.path) && f.children) result.push(...flattenVisible(f.children, expanded, depth + 1));
100
+ }
101
+ return result;
62
102
  }
63
103
  function filterFiles(files, query) {
64
- const q = query.toLowerCase();
65
- return files.reduce((acc, f) => {
66
- if (f.isDirectory && f.children) {
67
- const filteredChildren = filterFiles(f.children, query);
68
- if (filteredChildren.length > 0 || f.name.toLowerCase().includes(q)) {
69
- acc.push({ ...f, children: filteredChildren });
70
- }
71
- } else if (f.name.toLowerCase().includes(q)) {
72
- acc.push(f);
73
- }
74
- return acc;
75
- }, []);
104
+ const q = query.toLowerCase();
105
+ return files.reduce((acc, f) => {
106
+ if (f.isDirectory && f.children) {
107
+ const filteredChildren = filterFiles(f.children, query);
108
+ if (filteredChildren.length > 0 || f.name.toLowerCase().includes(q)) acc.push({
109
+ ...f,
110
+ children: filteredChildren
111
+ });
112
+ } else if (f.name.toLowerCase().includes(q)) acc.push(f);
113
+ return acc;
114
+ }, []);
76
115
  }
77
116
  function sortFiles(files, sortBy, sortDir) {
78
- const sorted = [...files].sort((a, b) => {
79
- if (a.isDirectory !== b.isDirectory) return a.isDirectory ? -1 : 1;
80
- let cmp = 0;
81
- if (sortBy === "name") cmp = a.name.localeCompare(b.name);
82
- else if (sortBy === "size") cmp = (a.size ?? 0) - (b.size ?? 0);
83
- else if (sortBy === "modified") {
84
- const da = a.modified ? new Date(a.modified).getTime() : 0;
85
- const db = b.modified ? new Date(b.modified).getTime() : 0;
86
- cmp = da - db;
87
- }
88
- return sortDir === "asc" ? cmp : -cmp;
89
- });
90
- return sorted.map(
91
- (f) => f.isDirectory && f.children ? { ...f, children: sortFiles(f.children, sortBy, sortDir) } : f
92
- );
117
+ return [...files].sort((a, b) => {
118
+ if (a.isDirectory !== b.isDirectory) return a.isDirectory ? -1 : 1;
119
+ let cmp = 0;
120
+ if (sortBy === "name") cmp = a.name.localeCompare(b.name);
121
+ else if (sortBy === "size") cmp = (a.size ?? 0) - (b.size ?? 0);
122
+ else if (sortBy === "modified") cmp = (a.modified ? new Date(a.modified).getTime() : 0) - (b.modified ? new Date(b.modified).getTime() : 0);
123
+ return sortDir === "asc" ? cmp : -cmp;
124
+ }).map((f) => f.isDirectory && f.children ? {
125
+ ...f,
126
+ children: sortFiles(f.children, sortBy, sortDir)
127
+ } : f);
93
128
  }
94
- const FileExplorer = memo(function FileExplorer2({
95
- files,
96
- height = 500,
97
- title,
98
- viewMode: initialViewMode = "list",
99
- showSearch = true,
100
- showBreadcrumbs = true,
101
- showDetails = true,
102
- multiSelect = false,
103
- allowUpload = false,
104
- allowDelete = false,
105
- onFileOpen,
106
- onFileDownload: _onFileDownload,
107
- onFileDelete,
108
- onFileUpload,
109
- onSelectionChange: _onSelectionChange,
110
- className = "",
111
- bordered = true,
112
- style: styleProp
113
- }) {
114
- const { tokens, theme } = useTheme();
115
- const isTransparentTheme = theme === "transparent" || theme === "transparent-bold" || theme === "transparent-minimal";
116
- const [expanded, setExpanded] = useState(/* @__PURE__ */ new Set());
117
- const [selected, setSelected] = useState(/* @__PURE__ */ new Set());
118
- const [currentPath, setCurrentPath] = useState([]);
119
- const [searchQuery, setSearchQuery] = useState("");
120
- const [sortBy, setSortBy] = useState("name");
121
- const [sortDir, setSortDir] = useState("asc");
122
- const [isDragging, setIsDragging] = useState(false);
123
- const [scrollTop, setScrollTop] = useState(0);
124
- const [viewportHeight, setViewportHeight] = useState(240);
125
- const listRef = React.useRef(null);
126
- const processedFiles = useMemo(() => {
127
- let result = files;
128
- if (searchQuery.trim()) result = filterFiles(result, searchQuery);
129
- return sortFiles(result, sortBy, sortDir);
130
- }, [files, searchQuery, sortBy, sortDir]);
131
- const currentFiles = useMemo(() => {
132
- let current = processedFiles;
133
- for (const dir of currentPath) {
134
- const found = current.find((f) => f.isDirectory && f.name === dir);
135
- if (found && found.children) current = found.children;
136
- else break;
137
- }
138
- return current;
139
- }, [processedFiles, currentPath]);
140
- const visibleItems = useMemo(() => {
141
- if (initialViewMode === "tree") return flattenVisible(processedFiles, expanded);
142
- return currentFiles.map((f) => ({ file: f, depth: 0 }));
143
- }, [processedFiles, expanded, currentFiles, initialViewMode]);
144
- const toggleExpand = useCallback((path) => {
145
- setExpanded((prev) => {
146
- const next = new Set(prev);
147
- if (next.has(path)) next.delete(path);
148
- else next.add(path);
149
- return next;
150
- });
151
- }, []);
152
- const toggleSelect = useCallback((path) => {
153
- setSelected((prev) => {
154
- const next = new Set(prev);
155
- if (next.has(path)) next.delete(path);
156
- else {
157
- if (!multiSelect) next.clear();
158
- next.add(path);
159
- }
160
- return next;
161
- });
162
- }, [multiSelect]);
163
- const handleFileClick = useCallback((file) => {
164
- if (file.isDirectory) {
165
- if (initialViewMode === "list") {
166
- setCurrentPath((prev) => [...prev, file.name]);
167
- } else {
168
- toggleExpand(file.path);
169
- }
170
- } else {
171
- toggleSelect(file.path);
172
- }
173
- }, [initialViewMode, toggleExpand, toggleSelect]);
174
- const handleFileDoubleClick = useCallback((file) => {
175
- if (!file.isDirectory) onFileOpen == null ? void 0 : onFileOpen(file);
176
- }, [onFileOpen]);
177
- const navigateTo = useCallback((idx) => {
178
- setCurrentPath((prev) => prev.slice(0, idx));
179
- }, []);
180
- const handleDrop = useCallback((e) => {
181
- e.preventDefault();
182
- setIsDragging(false);
183
- if (!allowUpload || !onFileUpload) return;
184
- const droppedFiles = Array.from(e.dataTransfer.files);
185
- if (droppedFiles.length > 0) {
186
- onFileUpload(droppedFiles, "/" + currentPath.join("/"));
187
- }
188
- }, [allowUpload, onFileUpload, currentPath]);
189
- const handleSort = useCallback((col) => {
190
- if (sortBy === col) setSortDir((d) => d === "asc" ? "desc" : "asc");
191
- else {
192
- setSortBy(col);
193
- setSortDir("asc");
194
- }
195
- }, [sortBy]);
196
- const selectedFiles = useMemo(
197
- () => visibleItems.filter((v) => selected.has(v.file.path)).map((v) => v.file),
198
- [visibleItems, selected]
199
- );
200
- const rowHeightPx = Number.parseInt(String(tokens.elementSize.sm), 10) || 32;
201
- const overscanRows = 12;
202
- const totalRows = visibleItems.length;
203
- const startRow = Math.max(0, Math.floor(scrollTop / rowHeightPx) - overscanRows);
204
- const visibleRows = Math.ceil(viewportHeight / rowHeightPx) + overscanRows * 2;
205
- const endRow = Math.min(totalRows, startRow + visibleRows);
206
- const virtualVisibleItems = useMemo(
207
- () => visibleItems.slice(startRow, endRow),
208
- [visibleItems, startRow, endRow]
209
- );
210
- React.useEffect(() => {
211
- const el = listRef.current;
212
- if (!el) return void 0;
213
- const updateHeight = () => setViewportHeight(Math.max(rowHeightPx * 4, el.clientHeight || 240));
214
- updateHeight();
215
- if (typeof ResizeObserver !== "undefined") {
216
- const observer = new ResizeObserver(updateHeight);
217
- observer.observe(el);
218
- return () => observer.disconnect();
219
- }
220
- window.addEventListener("resize", updateHeight);
221
- return () => window.removeEventListener("resize", updateHeight);
222
- }, [rowHeightPx]);
223
- return /* @__PURE__ */ jsxs(
224
- "div",
225
- {
226
- className: `file-explorer ${className}`,
227
- style: {
228
- height: typeof height === "number" ? height : void 0,
229
- background: tokens.colors.background.base,
230
- ...bordered ? tokens.colors.border.cardStyle ?? { border: `1px solid ${tokens.colors.border.muted}` } : { border: "none" },
231
- borderRadius: tokens.borderRadius.lg,
232
- overflow: "hidden",
233
- display: "flex",
234
- flexDirection: "column",
235
- fontFamily: tokens.typography.fontFamily.primary,
236
- color: tokens.colors.text.primary,
237
- backdropFilter: isTransparentTheme ? "blur(10px)" : void 0,
238
- WebkitBackdropFilter: isTransparentTheme ? "blur(10px)" : void 0,
239
- ...styleProp
240
- },
241
- children: [
242
- /* @__PURE__ */ jsxs("div", { style: {
243
- padding: `${tokens.spacing.sm} ${tokens.spacing.smd}`,
244
- borderBottom: `1px solid ${tokens.colors.border.muted}`,
245
- background: tokens.colors.background.surface,
246
- backdropFilter: "blur(8px)",
247
- display: "flex",
248
- alignItems: "center",
249
- justifyContent: "space-between"
250
- }, children: [
251
- /* @__PURE__ */ jsx("span", { style: { fontWeight: tokens.typography.fontWeight.medium, fontSize: tokens.typography.fontSize.sm }, children: title || "File Explorer" }),
252
- /* @__PURE__ */ jsxs("div", { style: { display: "flex", gap: tokens.spacing.sm }, children: [
253
- allowUpload && /* @__PURE__ */ jsx("button", { "aria-label": "Upload files", style: {
254
- background: tokens.colors.interactive.default,
255
- color: tokens.colors.text.inverse,
256
- border: "none",
257
- borderRadius: tokens.borderRadius.md,
258
- padding: `${tokens.spacing.xs} ${tokens.spacing.smd}`,
259
- fontSize: tokens.typography.fontSize.xxs,
260
- cursor: "pointer",
261
- fontWeight: tokens.typography.fontWeight.medium,
262
- transition: "opacity 150ms ease"
263
- }, children: "Upload" }),
264
- allowDelete && selectedFiles.length > 0 && /* @__PURE__ */ jsxs(
265
- "button",
266
- {
267
- onClick: () => onFileDelete == null ? void 0 : onFileDelete(selectedFiles),
268
- "aria-label": `Delete ${selectedFiles.length} selected files`,
269
- style: {
270
- background: `${tokens.colors.status.critical}22`,
271
- color: tokens.colors.status.critical,
272
- border: `1px solid ${tokens.colors.status.critical}44`,
273
- borderRadius: tokens.borderRadius.md,
274
- padding: `${tokens.spacing.xs} ${tokens.spacing.smd}`,
275
- fontSize: tokens.typography.fontSize.xxs,
276
- cursor: "pointer",
277
- fontWeight: tokens.typography.fontWeight.medium,
278
- transition: "opacity 150ms ease"
279
- },
280
- children: [
281
- "Delete (",
282
- selectedFiles.length,
283
- ")"
284
- ]
285
- }
286
- )
287
- ] })
288
- ] }),
289
- (showSearch || showBreadcrumbs) && /* @__PURE__ */ jsxs("div", { style: {
290
- padding: `${tokens.spacing.sm} ${tokens.spacing.smd}`,
291
- borderBottom: `1px solid ${tokens.colors.border.muted}`,
292
- display: "flex",
293
- alignItems: "center",
294
- gap: tokens.spacing.sm,
295
- background: tokens.colors.background.surface
296
- }, children: [
297
- showBreadcrumbs && initialViewMode === "list" && /* @__PURE__ */ jsxs("nav", { "aria-label": "File path", style: { display: "flex", alignItems: "center", gap: tokens.spacing.xs, fontSize: tokens.typography.fontSize.xs, flex: 1 }, children: [
298
- /* @__PURE__ */ jsx(
299
- "span",
300
- {
301
- role: "button",
302
- tabIndex: 0,
303
- "aria-label": "Navigate to root",
304
- onClick: () => navigateTo(0),
305
- onKeyDown: (e) => {
306
- if (e.key === "Enter") navigateTo(0);
307
- },
308
- style: { cursor: "pointer", color: tokens.colors.interactive.default, fontWeight: tokens.typography.fontWeight.medium },
309
- children: "/"
310
- }
311
- ),
312
- currentPath.map((dir, idx) => /* @__PURE__ */ jsxs(React.Fragment, { children: [
313
- /* @__PURE__ */ jsx("span", { "aria-hidden": "true", style: { color: tokens.colors.text.muted }, children: "/" }),
314
- /* @__PURE__ */ jsx(
315
- "span",
316
- {
317
- role: "button",
318
- tabIndex: 0,
319
- "aria-label": `Navigate to ${dir}`,
320
- onClick: () => navigateTo(idx + 1),
321
- onKeyDown: (e) => {
322
- if (e.key === "Enter") navigateTo(idx + 1);
323
- },
324
- style: {
325
- cursor: "pointer",
326
- color: idx === currentPath.length - 1 ? tokens.colors.text.primary : tokens.colors.interactive.default,
327
- fontWeight: idx === currentPath.length - 1 ? tokens.typography.fontWeight.medium : tokens.typography.fontWeight.normal
328
- },
329
- children: dir
330
- }
331
- )
332
- ] }, idx))
333
- ] }),
334
- showSearch && /* @__PURE__ */ jsx(
335
- "input",
336
- {
337
- type: "text",
338
- value: searchQuery,
339
- onChange: (e) => setSearchQuery(e.target.value),
340
- placeholder: "Search files...",
341
- "aria-label": "Search files",
342
- style: {
343
- background: tokens.colors.background.base,
344
- color: tokens.colors.text.primary,
345
- border: `1px solid ${tokens.colors.border.muted}`,
346
- borderRadius: tokens.borderRadius.md,
347
- padding: `${tokens.spacing.xs} ${tokens.spacing.sm}`,
348
- fontSize: tokens.typography.fontSize.xs,
349
- outline: "none",
350
- minWidth: 150,
351
- transition: "border-color 150ms ease"
352
- }
353
- }
354
- )
355
- ] }),
356
- /* @__PURE__ */ jsxs("div", { role: "row", style: {
357
- display: "grid",
358
- gridTemplateColumns: showDetails ? "1fr auto auto" : "1fr",
359
- padding: `${tokens.spacing.xs} ${tokens.spacing.smd}`,
360
- borderBottom: `1px solid ${tokens.colors.border.muted}`,
361
- background: tokens.colors.background.surface,
362
- fontSize: tokens.typography.fontSize.xxs,
363
- color: tokens.colors.text.muted,
364
- fontWeight: tokens.typography.fontWeight.medium,
365
- textTransform: "uppercase",
366
- letterSpacing: "0.5px"
367
- }, children: [
368
- /* @__PURE__ */ jsxs("span", { role: "columnheader", tabIndex: 0, "aria-label": "Sort by name", onClick: () => handleSort("name"), onKeyDown: (e) => {
369
- if (e.key === "Enter") handleSort("name");
370
- }, style: { cursor: "pointer" }, children: [
371
- "Name ",
372
- sortBy === "name" && (sortDir === "asc" ? "▲" : "▼")
373
- ] }),
374
- showDetails && /* @__PURE__ */ jsxs(Fragment, { children: [
375
- /* @__PURE__ */ jsxs("span", { role: "columnheader", tabIndex: 0, "aria-label": "Sort by size", onClick: () => handleSort("size"), onKeyDown: (e) => {
376
- if (e.key === "Enter") handleSort("size");
377
- }, style: { cursor: "pointer", minWidth: 70, textAlign: "right" }, children: [
378
- "Size ",
379
- sortBy === "size" && (sortDir === "asc" ? "" : "▼")
380
- ] }),
381
- /* @__PURE__ */ jsxs("span", { role: "columnheader", tabIndex: 0, "aria-label": "Sort by modified date", onClick: () => handleSort("modified"), onKeyDown: (e) => {
382
- if (e.key === "Enter") handleSort("modified");
383
- }, style: { cursor: "pointer", minWidth: 140, textAlign: "right" }, children: [
384
- "Modified ",
385
- sortBy === "modified" && (sortDir === "asc" ? "▲" : "▼")
386
- ] })
387
- ] })
388
- ] }),
389
- /* @__PURE__ */ jsxs(
390
- "div",
391
- {
392
- ref: listRef,
393
- style: {
394
- flex: 1,
395
- overflow: "auto",
396
- position: "relative",
397
- border: isDragging ? `2px dashed ${tokens.colors.interactive.default}` : "2px solid transparent"
398
- },
399
- onScroll: (e) => setScrollTop(e.currentTarget.scrollTop),
400
- onDragOver: allowUpload ? (e) => {
401
- e.preventDefault();
402
- setIsDragging(true);
403
- } : void 0,
404
- onDragLeave: allowUpload ? () => setIsDragging(false) : void 0,
405
- onDrop: allowUpload ? handleDrop : void 0,
406
- children: [
407
- isDragging && /* @__PURE__ */ jsx("div", { style: {
408
- position: "absolute",
409
- inset: 0,
410
- background: `${tokens.colors.interactive.default}11`,
411
- display: "flex",
412
- alignItems: "center",
413
- justifyContent: "center",
414
- fontSize: tokens.typography.fontSize.sm,
415
- color: tokens.colors.interactive.default,
416
- fontWeight: tokens.typography.fontWeight.medium,
417
- zIndex: 10
418
- }, children: "Drop files to upload" }),
419
- visibleItems.length === 0 ? /* @__PURE__ */ jsx("div", { style: {
420
- display: "flex",
421
- alignItems: "center",
422
- justifyContent: "center",
423
- height: "100%",
424
- color: tokens.colors.text.muted,
425
- fontSize: tokens.typography.fontSize.sm
426
- }, children: searchQuery ? "No matching files" : "Empty directory" }) : /* @__PURE__ */ jsx("div", { style: { height: totalRows * rowHeightPx, position: "relative" }, children: /* @__PURE__ */ jsx("div", { style: { position: "absolute", top: startRow * rowHeightPx, left: 0, right: 0 }, children: virtualVisibleItems.map(({ file, depth }) => /* @__PURE__ */ jsxs(
427
- "div",
428
- {
429
- role: "treeitem",
430
- tabIndex: 0,
431
- "aria-label": `${file.isDirectory ? "Folder" : "File"}: ${file.name}`,
432
- "aria-selected": selected.has(file.path),
433
- onClick: () => handleFileClick(file),
434
- onDoubleClick: () => handleFileDoubleClick(file),
435
- onKeyDown: (e) => {
436
- if (e.key === "Enter") handleFileDoubleClick(file);
437
- if (e.key === " ") {
438
- e.preventDefault();
439
- handleFileClick(file);
440
- }
441
- },
442
- style: {
443
- display: "grid",
444
- gridTemplateColumns: showDetails ? "1fr auto auto" : "1fr",
445
- padding: `0 ${tokens.spacing.smd}`,
446
- paddingLeft: `calc(${tokens.spacing.smd} + ${depth * 20}px)`,
447
- height: tokens.elementSize.sm,
448
- alignItems: "center",
449
- borderBottom: `1px solid ${tokens.colors.border.muted}`,
450
- cursor: "pointer",
451
- background: selected.has(file.path) ? `${tokens.colors.interactive.default}15` : "transparent",
452
- transition: "background 150ms ease"
453
- },
454
- onMouseEnter: (e) => {
455
- if (!selected.has(file.path)) e.currentTarget.style.background = tokens.colors.background.surface;
456
- },
457
- onMouseLeave: (e) => {
458
- e.currentTarget.style.background = selected.has(file.path) ? `${tokens.colors.interactive.default}15` : "transparent";
459
- },
460
- children: [
461
- /* @__PURE__ */ jsxs("span", { style: { display: "flex", alignItems: "center", gap: tokens.spacing.sm, overflow: "hidden" }, children: [
462
- multiSelect && /* @__PURE__ */ jsx(
463
- "input",
464
- {
465
- type: "checkbox",
466
- checked: selected.has(file.path),
467
- onChange: () => toggleSelect(file.path),
468
- onClick: (e) => e.stopPropagation(),
469
- "aria-label": `Select ${file.name}`,
470
- style: { accentColor: tokens.colors.interactive.default }
471
- }
472
- ),
473
- initialViewMode === "tree" && file.isDirectory && /* @__PURE__ */ jsx("span", { "aria-hidden": "true", style: { fontSize: tokens.typography.fontSize.xxs, color: tokens.colors.text.muted, width: 12, textAlign: "center" }, children: expanded.has(file.path) ? "▼" : "▶" }),
474
- /* @__PURE__ */ jsx("span", { "aria-hidden": "true", style: { display: "inline-flex", alignItems: "center", fontSize: tokens.typography.fontSize.sm }, children: /* @__PURE__ */ jsx(AstroIcon, { name: getFileIconName(file), size: "small", label: "", style: { fontSize: "inherit" } }) }),
475
- /* @__PURE__ */ jsx("span", { style: {
476
- fontSize: tokens.typography.fontSize.xs,
477
- fontWeight: file.isDirectory ? tokens.typography.fontWeight.medium : tokens.typography.fontWeight.normal,
478
- color: file.isDirectory ? tokens.colors.interactive.default : tokens.colors.text.primary,
479
- overflow: "hidden",
480
- textOverflow: "ellipsis",
481
- whiteSpace: "nowrap"
482
- }, children: file.name })
483
- ] }),
484
- showDetails && /* @__PURE__ */ jsxs(Fragment, { children: [
485
- /* @__PURE__ */ jsx("span", { style: { fontSize: tokens.typography.fontSize.xs, color: tokens.colors.text.muted, textAlign: "right", minWidth: 70, fontFamily: tokens.typography.fontFamily.mono }, children: file.isDirectory ? "—" : formatFileSize(file.size) }),
486
- /* @__PURE__ */ jsx("span", { style: { fontSize: tokens.typography.fontSize.xs, color: tokens.colors.text.muted, textAlign: "right", minWidth: 140, fontFamily: tokens.typography.fontFamily.mono }, children: formatDate(file.modified) })
487
- ] })
488
- ]
489
- },
490
- file.path
491
- )) }) })
492
- ]
493
- }
494
- ),
495
- /* @__PURE__ */ jsxs("div", { style: {
496
- padding: `${tokens.spacing.xs} ${tokens.spacing.smd}`,
497
- borderTop: `1px solid ${tokens.colors.border.muted}`,
498
- background: tokens.colors.background.surface,
499
- fontSize: tokens.typography.fontSize.xxs,
500
- color: tokens.colors.text.muted,
501
- display: "flex",
502
- justifyContent: "space-between"
503
- }, children: [
504
- /* @__PURE__ */ jsxs("span", { children: [
505
- visibleItems.length,
506
- " items"
507
- ] }),
508
- selected.size > 0 && /* @__PURE__ */ jsxs("span", { children: [
509
- selected.size,
510
- " selected"
511
- ] })
512
- ] })
513
- ]
514
- }
515
- );
129
+ var FileExplorer = memo(function FileExplorer({ files, height = 500, title, viewMode: initialViewMode = "list", showSearch = true, showBreadcrumbs = true, showDetails = true, multiSelect = false, allowUpload = false, allowDelete = false, onFileOpen, onFileDownload: _onFileDownload, onFileDelete, onFileUpload, onSelectionChange: _onSelectionChange, className = "", bordered = true, style: styleProp }) {
130
+ const { tokens, theme } = useTheme();
131
+ const isTransparentTheme = theme === "transparent" || theme === "transparent-bold" || theme === "transparent-minimal";
132
+ const [expanded, setExpanded] = useState(/* @__PURE__ */ new Set());
133
+ const [selected, setSelected] = useState(/* @__PURE__ */ new Set());
134
+ const [currentPath, setCurrentPath] = useState([]);
135
+ const [searchQuery, setSearchQuery] = useState("");
136
+ const [sortBy, setSortBy] = useState("name");
137
+ const [sortDir, setSortDir] = useState("asc");
138
+ const [isDragging, setIsDragging] = useState(false);
139
+ const [scrollTop, setScrollTop] = useState(0);
140
+ const [viewportHeight, setViewportHeight] = useState(240);
141
+ const listRef = React.useRef(null);
142
+ const processedFiles = useMemo(() => {
143
+ let result = files;
144
+ if (searchQuery.trim()) result = filterFiles(result, searchQuery);
145
+ return sortFiles(result, sortBy, sortDir);
146
+ }, [
147
+ files,
148
+ searchQuery,
149
+ sortBy,
150
+ sortDir
151
+ ]);
152
+ const currentFiles = useMemo(() => {
153
+ let current = processedFiles;
154
+ for (const dir of currentPath) {
155
+ const found = current.find((f) => f.isDirectory && f.name === dir);
156
+ if (found && found.children) current = found.children;
157
+ else break;
158
+ }
159
+ return current;
160
+ }, [processedFiles, currentPath]);
161
+ const visibleItems = useMemo(() => {
162
+ if (initialViewMode === "tree") return flattenVisible(processedFiles, expanded);
163
+ return currentFiles.map((f) => ({
164
+ file: f,
165
+ depth: 0
166
+ }));
167
+ }, [
168
+ processedFiles,
169
+ expanded,
170
+ currentFiles,
171
+ initialViewMode
172
+ ]);
173
+ const toggleExpand = useCallback((path) => {
174
+ setExpanded((prev) => {
175
+ const next = new Set(prev);
176
+ if (next.has(path)) next.delete(path);
177
+ else next.add(path);
178
+ return next;
179
+ });
180
+ }, []);
181
+ const toggleSelect = useCallback((path) => {
182
+ setSelected((prev) => {
183
+ const next = new Set(prev);
184
+ if (next.has(path)) next.delete(path);
185
+ else {
186
+ if (!multiSelect) next.clear();
187
+ next.add(path);
188
+ }
189
+ return next;
190
+ });
191
+ }, [multiSelect]);
192
+ const handleFileClick = useCallback((file) => {
193
+ if (file.isDirectory) if (initialViewMode === "list") setCurrentPath((prev) => [...prev, file.name]);
194
+ else toggleExpand(file.path);
195
+ else toggleSelect(file.path);
196
+ }, [
197
+ initialViewMode,
198
+ toggleExpand,
199
+ toggleSelect
200
+ ]);
201
+ const handleFileDoubleClick = useCallback((file) => {
202
+ if (!file.isDirectory) onFileOpen?.(file);
203
+ }, [onFileOpen]);
204
+ const navigateTo = useCallback((idx) => {
205
+ setCurrentPath((prev) => prev.slice(0, idx));
206
+ }, []);
207
+ const handleDrop = useCallback((e) => {
208
+ e.preventDefault();
209
+ setIsDragging(false);
210
+ if (!allowUpload || !onFileUpload) return;
211
+ const droppedFiles = Array.from(e.dataTransfer.files);
212
+ if (droppedFiles.length > 0) onFileUpload(droppedFiles, "/" + currentPath.join("/"));
213
+ }, [
214
+ allowUpload,
215
+ onFileUpload,
216
+ currentPath
217
+ ]);
218
+ const handleSort = useCallback((col) => {
219
+ if (sortBy === col) setSortDir((d) => d === "asc" ? "desc" : "asc");
220
+ else {
221
+ setSortBy(col);
222
+ setSortDir("asc");
223
+ }
224
+ }, [sortBy]);
225
+ const selectedFiles = useMemo(() => visibleItems.filter((v) => selected.has(v.file.path)).map((v) => v.file), [visibleItems, selected]);
226
+ const rowHeightPx = Number.parseInt(String(tokens.elementSize.sm), 10) || 32;
227
+ const overscanRows = 12;
228
+ const totalRows = visibleItems.length;
229
+ const startRow = Math.max(0, Math.floor(scrollTop / rowHeightPx) - overscanRows);
230
+ const visibleRows = Math.ceil(viewportHeight / rowHeightPx) + overscanRows * 2;
231
+ const endRow = Math.min(totalRows, startRow + visibleRows);
232
+ const virtualVisibleItems = useMemo(() => visibleItems.slice(startRow, endRow), [
233
+ visibleItems,
234
+ startRow,
235
+ endRow
236
+ ]);
237
+ React.useEffect(() => {
238
+ const el = listRef.current;
239
+ if (!el) return void 0;
240
+ const updateHeight = () => setViewportHeight(Math.max(rowHeightPx * 4, el.clientHeight || 240));
241
+ updateHeight();
242
+ if (typeof ResizeObserver !== "undefined") {
243
+ const observer = new ResizeObserver(updateHeight);
244
+ observer.observe(el);
245
+ return () => observer.disconnect();
246
+ }
247
+ window.addEventListener("resize", updateHeight);
248
+ return () => window.removeEventListener("resize", updateHeight);
249
+ }, [rowHeightPx]);
250
+ return /* @__PURE__ */ jsxs("div", {
251
+ className: `file-explorer ${className}`,
252
+ style: {
253
+ height: typeof height === "number" ? height : void 0,
254
+ background: tokens.colors.background.base,
255
+ ...bordered ? tokens.colors.border.cardStyle ?? { border: `1px solid ${tokens.colors.border.muted}` } : { border: "none" },
256
+ borderRadius: tokens.borderRadius.lg,
257
+ overflow: "hidden",
258
+ display: "flex",
259
+ flexDirection: "column",
260
+ fontFamily: tokens.typography.fontFamily.primary,
261
+ color: tokens.colors.text.primary,
262
+ backdropFilter: isTransparentTheme ? "blur(10px)" : void 0,
263
+ WebkitBackdropFilter: isTransparentTheme ? "blur(10px)" : void 0,
264
+ ...styleProp
265
+ },
266
+ children: [
267
+ /* @__PURE__ */ jsxs("div", {
268
+ style: {
269
+ padding: `${tokens.spacing.sm} ${tokens.spacing.smd}`,
270
+ borderBottom: `1px solid ${tokens.colors.border.muted}`,
271
+ background: tokens.colors.background.surface,
272
+ backdropFilter: "blur(8px)",
273
+ display: "flex",
274
+ alignItems: "center",
275
+ justifyContent: "space-between"
276
+ },
277
+ children: [/* @__PURE__ */ jsx("span", {
278
+ style: {
279
+ fontWeight: tokens.typography.fontWeight.medium,
280
+ fontSize: tokens.typography.fontSize.sm
281
+ },
282
+ children: title || "File Explorer"
283
+ }), /* @__PURE__ */ jsxs("div", {
284
+ style: {
285
+ display: "flex",
286
+ gap: tokens.spacing.sm
287
+ },
288
+ children: [allowUpload && /* @__PURE__ */ jsx("button", {
289
+ "aria-label": "Upload files",
290
+ style: {
291
+ background: tokens.colors.interactive.default,
292
+ color: tokens.colors.text.inverse,
293
+ border: "none",
294
+ borderRadius: tokens.borderRadius.md,
295
+ padding: `${tokens.spacing.xs} ${tokens.spacing.smd}`,
296
+ fontSize: tokens.typography.fontSize.xxs,
297
+ cursor: "pointer",
298
+ fontWeight: tokens.typography.fontWeight.medium,
299
+ transition: "opacity 150ms ease"
300
+ },
301
+ children: "Upload"
302
+ }), allowDelete && selectedFiles.length > 0 && /* @__PURE__ */ jsxs("button", {
303
+ onClick: () => onFileDelete?.(selectedFiles),
304
+ "aria-label": `Delete ${selectedFiles.length} selected files`,
305
+ style: {
306
+ background: `${tokens.colors.status.critical}22`,
307
+ color: tokens.colors.status.critical,
308
+ border: `1px solid ${tokens.colors.status.critical}44`,
309
+ borderRadius: tokens.borderRadius.md,
310
+ padding: `${tokens.spacing.xs} ${tokens.spacing.smd}`,
311
+ fontSize: tokens.typography.fontSize.xxs,
312
+ cursor: "pointer",
313
+ fontWeight: tokens.typography.fontWeight.medium,
314
+ transition: "opacity 150ms ease"
315
+ },
316
+ children: [
317
+ "Delete (",
318
+ selectedFiles.length,
319
+ ")"
320
+ ]
321
+ })]
322
+ })]
323
+ }),
324
+ (showSearch || showBreadcrumbs) && /* @__PURE__ */ jsxs("div", {
325
+ style: {
326
+ padding: `${tokens.spacing.sm} ${tokens.spacing.smd}`,
327
+ borderBottom: `1px solid ${tokens.colors.border.muted}`,
328
+ display: "flex",
329
+ alignItems: "center",
330
+ gap: tokens.spacing.sm,
331
+ background: tokens.colors.background.surface
332
+ },
333
+ children: [showBreadcrumbs && initialViewMode === "list" && /* @__PURE__ */ jsxs("nav", {
334
+ "aria-label": "File path",
335
+ style: {
336
+ display: "flex",
337
+ alignItems: "center",
338
+ gap: tokens.spacing.xs,
339
+ fontSize: tokens.typography.fontSize.xs,
340
+ flex: 1
341
+ },
342
+ children: [/* @__PURE__ */ jsx("span", {
343
+ role: "button",
344
+ tabIndex: 0,
345
+ "aria-label": "Navigate to root",
346
+ onClick: () => navigateTo(0),
347
+ onKeyDown: (e) => {
348
+ if (e.key === "Enter") navigateTo(0);
349
+ },
350
+ style: {
351
+ cursor: "pointer",
352
+ color: tokens.colors.interactive.default,
353
+ fontWeight: tokens.typography.fontWeight.medium
354
+ },
355
+ children: "/"
356
+ }), currentPath.map((dir, idx) => /* @__PURE__ */ jsxs(React.Fragment, { children: [/* @__PURE__ */ jsx("span", {
357
+ "aria-hidden": "true",
358
+ style: { color: tokens.colors.text.muted },
359
+ children: "/"
360
+ }), /* @__PURE__ */ jsx("span", {
361
+ role: "button",
362
+ tabIndex: 0,
363
+ "aria-label": `Navigate to ${dir}`,
364
+ onClick: () => navigateTo(idx + 1),
365
+ onKeyDown: (e) => {
366
+ if (e.key === "Enter") navigateTo(idx + 1);
367
+ },
368
+ style: {
369
+ cursor: "pointer",
370
+ color: idx === currentPath.length - 1 ? tokens.colors.text.primary : tokens.colors.interactive.default,
371
+ fontWeight: idx === currentPath.length - 1 ? tokens.typography.fontWeight.medium : tokens.typography.fontWeight.normal
372
+ },
373
+ children: dir
374
+ })] }, idx))]
375
+ }), showSearch && /* @__PURE__ */ jsx("input", {
376
+ type: "text",
377
+ value: searchQuery,
378
+ onChange: (e) => setSearchQuery(e.target.value),
379
+ placeholder: "Search files...",
380
+ "aria-label": "Search files",
381
+ style: {
382
+ background: tokens.colors.background.base,
383
+ color: tokens.colors.text.primary,
384
+ border: `1px solid ${tokens.colors.border.muted}`,
385
+ borderRadius: tokens.borderRadius.md,
386
+ padding: `${tokens.spacing.xs} ${tokens.spacing.sm}`,
387
+ fontSize: tokens.typography.fontSize.xs,
388
+ outline: "none",
389
+ minWidth: 150,
390
+ transition: "border-color 150ms ease"
391
+ }
392
+ })]
393
+ }),
394
+ /* @__PURE__ */ jsxs("div", {
395
+ role: "row",
396
+ style: {
397
+ display: "grid",
398
+ gridTemplateColumns: showDetails ? "1fr auto auto" : "1fr",
399
+ padding: `${tokens.spacing.xs} ${tokens.spacing.smd}`,
400
+ borderBottom: `1px solid ${tokens.colors.border.muted}`,
401
+ background: tokens.colors.background.surface,
402
+ fontSize: tokens.typography.fontSize.xxs,
403
+ color: tokens.colors.text.muted,
404
+ fontWeight: tokens.typography.fontWeight.medium,
405
+ textTransform: "uppercase",
406
+ letterSpacing: "0.5px"
407
+ },
408
+ children: [/* @__PURE__ */ jsxs("span", {
409
+ role: "columnheader",
410
+ tabIndex: 0,
411
+ "aria-label": "Sort by name",
412
+ onClick: () => handleSort("name"),
413
+ onKeyDown: (e) => {
414
+ if (e.key === "Enter") handleSort("name");
415
+ },
416
+ style: { cursor: "pointer" },
417
+ children: ["Name ", sortBy === "name" && (sortDir === "asc" ? "▲" : "▼")]
418
+ }), showDetails && /* @__PURE__ */ jsxs(Fragment, { children: [/* @__PURE__ */ jsxs("span", {
419
+ role: "columnheader",
420
+ tabIndex: 0,
421
+ "aria-label": "Sort by size",
422
+ onClick: () => handleSort("size"),
423
+ onKeyDown: (e) => {
424
+ if (e.key === "Enter") handleSort("size");
425
+ },
426
+ style: {
427
+ cursor: "pointer",
428
+ minWidth: 70,
429
+ textAlign: "right"
430
+ },
431
+ children: [
432
+ "Size",
433
+ " ",
434
+ sortBy === "size" && (sortDir === "asc" ? "▲" : "▼")
435
+ ]
436
+ }), /* @__PURE__ */ jsxs("span", {
437
+ role: "columnheader",
438
+ tabIndex: 0,
439
+ "aria-label": "Sort by modified date",
440
+ onClick: () => handleSort("modified"),
441
+ onKeyDown: (e) => {
442
+ if (e.key === "Enter") handleSort("modified");
443
+ },
444
+ style: {
445
+ cursor: "pointer",
446
+ minWidth: 140,
447
+ textAlign: "right"
448
+ },
449
+ children: [
450
+ "Modified",
451
+ " ",
452
+ sortBy === "modified" && (sortDir === "asc" ? "▲" : "▼")
453
+ ]
454
+ })] })]
455
+ }),
456
+ /* @__PURE__ */ jsxs("div", {
457
+ ref: listRef,
458
+ style: {
459
+ flex: 1,
460
+ overflow: "auto",
461
+ position: "relative",
462
+ border: isDragging ? `2px dashed ${tokens.colors.interactive.default}` : "2px solid transparent"
463
+ },
464
+ onScroll: (e) => setScrollTop(e.currentTarget.scrollTop),
465
+ onDragOver: allowUpload ? (e) => {
466
+ e.preventDefault();
467
+ setIsDragging(true);
468
+ } : void 0,
469
+ onDragLeave: allowUpload ? () => setIsDragging(false) : void 0,
470
+ onDrop: allowUpload ? handleDrop : void 0,
471
+ children: [isDragging && /* @__PURE__ */ jsx("div", {
472
+ style: {
473
+ position: "absolute",
474
+ inset: 0,
475
+ background: `${tokens.colors.interactive.default}11`,
476
+ display: "flex",
477
+ alignItems: "center",
478
+ justifyContent: "center",
479
+ fontSize: tokens.typography.fontSize.sm,
480
+ color: tokens.colors.interactive.default,
481
+ fontWeight: tokens.typography.fontWeight.medium,
482
+ zIndex: 10
483
+ },
484
+ children: "Drop files to upload"
485
+ }), visibleItems.length === 0 ? /* @__PURE__ */ jsx("div", {
486
+ style: {
487
+ display: "flex",
488
+ alignItems: "center",
489
+ justifyContent: "center",
490
+ height: "100%",
491
+ color: tokens.colors.text.muted,
492
+ fontSize: tokens.typography.fontSize.sm
493
+ },
494
+ children: searchQuery ? "No matching files" : "Empty directory"
495
+ }) : /* @__PURE__ */ jsx("div", {
496
+ style: {
497
+ height: totalRows * rowHeightPx,
498
+ position: "relative"
499
+ },
500
+ children: /* @__PURE__ */ jsx("div", {
501
+ style: {
502
+ position: "absolute",
503
+ top: startRow * rowHeightPx,
504
+ left: 0,
505
+ right: 0
506
+ },
507
+ children: virtualVisibleItems.map(({ file, depth }) => /* @__PURE__ */ jsxs("div", {
508
+ role: "treeitem",
509
+ tabIndex: 0,
510
+ "aria-label": `${file.isDirectory ? "Folder" : "File"}: ${file.name}`,
511
+ "aria-selected": selected.has(file.path),
512
+ onClick: () => handleFileClick(file),
513
+ onDoubleClick: () => handleFileDoubleClick(file),
514
+ onKeyDown: (e) => {
515
+ if (e.key === "Enter") handleFileDoubleClick(file);
516
+ if (e.key === " ") {
517
+ e.preventDefault();
518
+ handleFileClick(file);
519
+ }
520
+ },
521
+ style: {
522
+ display: "grid",
523
+ gridTemplateColumns: showDetails ? "1fr auto auto" : "1fr",
524
+ padding: `0 ${tokens.spacing.smd}`,
525
+ paddingLeft: `calc(${tokens.spacing.smd} + ${depth * 20}px)`,
526
+ height: tokens.elementSize.sm,
527
+ alignItems: "center",
528
+ borderBottom: `1px solid ${tokens.colors.border.muted}`,
529
+ cursor: "pointer",
530
+ background: selected.has(file.path) ? `${tokens.colors.interactive.default}15` : "transparent",
531
+ transition: "background 150ms ease"
532
+ },
533
+ onMouseEnter: (e) => {
534
+ if (!selected.has(file.path)) e.currentTarget.style.background = tokens.colors.background.surface;
535
+ },
536
+ onMouseLeave: (e) => {
537
+ e.currentTarget.style.background = selected.has(file.path) ? `${tokens.colors.interactive.default}15` : "transparent";
538
+ },
539
+ children: [/* @__PURE__ */ jsxs("span", {
540
+ style: {
541
+ display: "flex",
542
+ alignItems: "center",
543
+ gap: tokens.spacing.sm,
544
+ overflow: "hidden"
545
+ },
546
+ children: [
547
+ multiSelect && /* @__PURE__ */ jsx("input", {
548
+ type: "checkbox",
549
+ checked: selected.has(file.path),
550
+ onChange: () => toggleSelect(file.path),
551
+ onClick: (e) => e.stopPropagation(),
552
+ "aria-label": `Select ${file.name}`,
553
+ style: { accentColor: tokens.colors.interactive.default }
554
+ }),
555
+ initialViewMode === "tree" && file.isDirectory && /* @__PURE__ */ jsx("span", {
556
+ "aria-hidden": "true",
557
+ style: {
558
+ fontSize: tokens.typography.fontSize.xxs,
559
+ color: tokens.colors.text.muted,
560
+ width: 12,
561
+ textAlign: "center"
562
+ },
563
+ children: expanded.has(file.path) ? "▼" : "▶"
564
+ }),
565
+ /* @__PURE__ */ jsx("span", {
566
+ "aria-hidden": "true",
567
+ style: {
568
+ display: "inline-flex",
569
+ alignItems: "center",
570
+ fontSize: tokens.typography.fontSize.sm
571
+ },
572
+ children: /* @__PURE__ */ jsx(AstroIcon, {
573
+ name: getFileIconName(file),
574
+ size: "small",
575
+ label: "",
576
+ style: { fontSize: "inherit" }
577
+ })
578
+ }),
579
+ /* @__PURE__ */ jsx("span", {
580
+ style: {
581
+ fontSize: tokens.typography.fontSize.xs,
582
+ fontWeight: file.isDirectory ? tokens.typography.fontWeight.medium : tokens.typography.fontWeight.normal,
583
+ color: file.isDirectory ? tokens.colors.interactive.default : tokens.colors.text.primary,
584
+ overflow: "hidden",
585
+ textOverflow: "ellipsis",
586
+ whiteSpace: "nowrap"
587
+ },
588
+ children: file.name
589
+ })
590
+ ]
591
+ }), showDetails && /* @__PURE__ */ jsxs(Fragment, { children: [/* @__PURE__ */ jsx("span", {
592
+ style: {
593
+ fontSize: tokens.typography.fontSize.xs,
594
+ color: tokens.colors.text.muted,
595
+ textAlign: "right",
596
+ minWidth: 70,
597
+ fontFamily: tokens.typography.fontFamily.mono
598
+ },
599
+ children: file.isDirectory ? "—" : formatFileSize(file.size)
600
+ }), /* @__PURE__ */ jsx("span", {
601
+ style: {
602
+ fontSize: tokens.typography.fontSize.xs,
603
+ color: tokens.colors.text.muted,
604
+ textAlign: "right",
605
+ minWidth: 140,
606
+ fontFamily: tokens.typography.fontFamily.mono
607
+ },
608
+ children: formatDate(file.modified)
609
+ })] })]
610
+ }, file.path))
611
+ })
612
+ })]
613
+ }),
614
+ /* @__PURE__ */ jsxs("div", {
615
+ style: {
616
+ padding: `${tokens.spacing.xs} ${tokens.spacing.smd}`,
617
+ borderTop: `1px solid ${tokens.colors.border.muted}`,
618
+ background: tokens.colors.background.surface,
619
+ fontSize: tokens.typography.fontSize.xxs,
620
+ color: tokens.colors.text.muted,
621
+ display: "flex",
622
+ justifyContent: "space-between"
623
+ },
624
+ children: [/* @__PURE__ */ jsxs("span", { children: [visibleItems.length, " items"] }), selected.size > 0 && /* @__PURE__ */ jsxs("span", { children: [selected.size, " selected"] })]
625
+ })
626
+ ]
627
+ });
516
628
  });
517
- export {
518
- FileExplorer
519
- };
520
- //# sourceMappingURL=FileExplorer.js.map
629
+ //#endregion
630
+ export { FileExplorer, FileExplorer as default };
631
+
632
+ //# sourceMappingURL=FileExplorer.js.map