@parallelworks/ui 0.18.0 → 0.19.1

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 (349) hide show
  1. package/README.md +86 -6
  2. package/dist/ai/adapter/memoryStore.d.ts +8 -0
  3. package/dist/ai/adapter/memoryStore.js +152 -0
  4. package/dist/ai/adapter/mock/index.d.ts +2 -0
  5. package/dist/ai/adapter/mock/index.js +3 -0
  6. package/dist/ai/adapter/mock/mockAdapter.d.ts +4 -0
  7. package/dist/ai/adapter/mock/mockAdapter.js +81 -0
  8. package/dist/ai/adapter/openai/createOpenAIStream.d.ts +9 -0
  9. package/dist/ai/adapter/openai/createOpenAIStream.js +33 -0
  10. package/dist/ai/adapter/openai/errors.d.ts +3 -0
  11. package/dist/ai/adapter/openai/errors.js +37 -0
  12. package/dist/ai/adapter/openai/index.d.ts +6 -0
  13. package/dist/ai/adapter/openai/index.js +6 -0
  14. package/dist/ai/adapter/openai/openaiAdapter.d.ts +9 -0
  15. package/dist/ai/adapter/openai/openaiAdapter.js +54 -0
  16. package/dist/ai/adapter/openai/responses.d.ts +4 -0
  17. package/dist/ai/adapter/openai/responses.js +108 -0
  18. package/dist/ai/adapter/openai/sse.d.ts +24 -0
  19. package/dist/ai/adapter/openai/sse.js +112 -0
  20. package/dist/ai/adapter/openai/wire.d.ts +40 -0
  21. package/dist/ai/adapter/types.d.ts +131 -0
  22. package/dist/ai/adapter/types.js +11 -0
  23. package/dist/ai/agent/classifier.d.ts +2 -0
  24. package/dist/ai/agent/classifier.js +12 -0
  25. package/dist/ai/agent/diff.d.ts +35 -0
  26. package/dist/ai/agent/diff.js +223 -0
  27. package/dist/ai/agent/diffHighlight.d.ts +6 -0
  28. package/dist/ai/agent/diffHighlight.js +101 -0
  29. package/dist/ai/agent/index.d.ts +6 -0
  30. package/dist/ai/agent/permissions.d.ts +11 -0
  31. package/dist/ai/agent/permissions.js +29 -0
  32. package/dist/ai/agent/toolfmt.d.ts +18 -0
  33. package/dist/ai/agent/toolfmt.js +383 -0
  34. package/dist/ai/agent/transcript.d.ts +38 -0
  35. package/dist/ai/agent/transcript.js +127 -0
  36. package/dist/ai/ai.css +325 -0
  37. package/dist/ai/components/AllocationSelector.d.ts +4 -0
  38. package/dist/ai/components/AllocationSelector.js +56 -0
  39. package/dist/ai/components/AttachmentManager.d.ts +1 -0
  40. package/dist/ai/components/AttachmentManager.js +144 -0
  41. package/dist/ai/components/AttachmentUpload.d.ts +24 -0
  42. package/dist/ai/components/AttachmentUpload.js +179 -0
  43. package/dist/ai/components/BlockedGroupBanner.d.ts +1 -0
  44. package/dist/ai/components/BlockedGroupBanner.js +29 -0
  45. package/dist/ai/components/BranchNavigator.d.ts +8 -0
  46. package/dist/ai/components/BranchNavigator.js +57 -0
  47. package/dist/ai/components/ChatEmptyState.d.ts +3 -0
  48. package/dist/ai/components/ChatEmptyState.js +171 -0
  49. package/dist/ai/components/ChatInput.d.ts +45 -0
  50. package/dist/ai/components/ChatInput.js +265 -0
  51. package/dist/ai/components/ChatLayout.d.ts +5 -0
  52. package/dist/ai/components/ChatLayout.js +15 -0
  53. package/dist/ai/components/ChatMessage.d.ts +24 -0
  54. package/dist/ai/components/ChatMessage.js +338 -0
  55. package/dist/ai/components/ChatMessageList.d.ts +35 -0
  56. package/dist/ai/components/ChatMessageList.js +301 -0
  57. package/dist/ai/components/ChatSidebar.d.ts +5 -0
  58. package/dist/ai/components/ChatSidebar.js +345 -0
  59. package/dist/ai/components/ChatThread.d.ts +3 -0
  60. package/dist/ai/components/ChatThread.js +198 -0
  61. package/dist/ai/components/ComposerChrome.d.ts +18 -0
  62. package/dist/ai/components/ComposerChrome.js +50 -0
  63. package/dist/ai/components/ComposerFrame.d.ts +16 -0
  64. package/dist/ai/components/ComposerFrame.js +33 -0
  65. package/dist/ai/components/DragOverlay.d.ts +5 -0
  66. package/dist/ai/components/DragOverlay.js +20 -0
  67. package/dist/ai/components/ModelSelector.d.ts +6 -0
  68. package/dist/ai/components/ModelSelector.js +343 -0
  69. package/dist/ai/components/ShareDialog.d.ts +11 -0
  70. package/dist/ai/components/ShareDialog.js +260 -0
  71. package/dist/ai/components/SlashMenu.d.ts +28 -0
  72. package/dist/ai/components/SlashMenu.js +91 -0
  73. package/dist/ai/components/agent/ActivityLine.d.ts +21 -0
  74. package/dist/ai/components/agent/ActivityLine.js +151 -0
  75. package/dist/ai/components/agent/AgentMessageParts.d.ts +54 -0
  76. package/dist/ai/components/agent/AgentMessageParts.js +721 -0
  77. package/dist/ai/components/agent/PermissionPicker.d.ts +11 -0
  78. package/dist/ai/components/agent/PermissionPicker.js +38 -0
  79. package/dist/ai/components/attachmentKeys.d.ts +4 -0
  80. package/dist/ai/components/attachmentKeys.js +10 -0
  81. package/dist/ai/core/ChatProvider.d.ts +66 -0
  82. package/dist/ai/core/ChatProvider.js +848 -0
  83. package/dist/ai/core/KeyboardShortcutsProvider.d.ts +5 -0
  84. package/dist/ai/core/KeyboardShortcutsProvider.js +9 -0
  85. package/dist/ai/core/chatReducer.d.ts +114 -0
  86. package/dist/ai/core/chatReducer.js +223 -0
  87. package/dist/ai/core/config.d.ts +47 -0
  88. package/dist/ai/core/config.js +45 -0
  89. package/dist/ai/core/events.d.ts +1 -0
  90. package/dist/ai/core/events.js +4 -0
  91. package/dist/ai/core/exportConversation.d.ts +4 -0
  92. package/dist/ai/core/exportConversation.js +42 -0
  93. package/dist/ai/core/greeting.d.ts +3 -0
  94. package/dist/ai/core/greeting.js +38 -0
  95. package/dist/ai/core/parts.d.ts +11 -0
  96. package/dist/ai/core/parts.js +84 -0
  97. package/dist/ai/core/useDragDrop.d.ts +14 -0
  98. package/dist/ai/core/useDragDrop.js +36 -0
  99. package/dist/ai/core/useKeyboardShortcuts.d.ts +12 -0
  100. package/dist/ai/core/useKeyboardShortcuts.js +77 -0
  101. package/dist/ai/core/useSSEStream.d.ts +34 -0
  102. package/dist/ai/core/useSSEStream.js +98 -0
  103. package/dist/ai/index.d.ts +40 -0
  104. package/dist/ai/index.js +44 -0
  105. package/dist/ai/strings.d.ts +167 -0
  106. package/dist/ai/strings.js +175 -0
  107. package/dist/ai/types.d.ts +236 -0
  108. package/dist/ai/ui/Avatar.d.ts +8 -0
  109. package/dist/ai/ui/Avatar.js +35 -0
  110. package/dist/ai/ui/Dropdown.d.ts +31 -0
  111. package/dist/ai/ui/Dropdown.js +110 -0
  112. package/dist/ai/ui/Markdown.d.ts +8 -0
  113. package/dist/ai/ui/Markdown.js +79 -0
  114. package/dist/ai/ui/Notice.d.ts +21 -0
  115. package/dist/ai/ui/Notice.js +77 -0
  116. package/dist/ai/ui/buttons.d.ts +1 -0
  117. package/dist/ai/ui/codeBreaks.d.ts +16 -0
  118. package/dist/ai/ui/codeBreaks.js +36 -0
  119. package/dist/ai/ui/prose.d.ts +1 -0
  120. package/dist/ai/ui/prose.js +13 -0
  121. package/dist/ai/ui/sidebar.d.ts +81 -0
  122. package/dist/ai/ui/sidebar.js +148 -0
  123. package/dist/ai/utils.d.ts +4 -0
  124. package/dist/ai/utils.js +23 -0
  125. package/dist/assets/{editor.worker-CuBRIwi-.js → editor.worker-BmHUIVG4.js} +194 -163
  126. package/dist/assets/{json.worker-8ytS02vz.js → json.worker-D8bJ92nw.js} +384 -338
  127. package/dist/assets/{yaml.worker-DJC-VUcv.js → yaml.worker-C4gyGAko.js} +15657 -13823
  128. package/dist/components/AddMenu.js +46 -0
  129. package/dist/components/Avatar.d.ts +1 -1
  130. package/dist/components/Avatar.js +46 -0
  131. package/dist/{chunks/BareModal-BtRiQezg.js → components/BareModal.js} +1 -1
  132. package/dist/components/Breadcrumbs.d.ts +1 -1
  133. package/dist/components/Breadcrumbs.js +83 -0
  134. package/dist/components/Button.js +83 -0
  135. package/dist/components/Callout.js +23 -0
  136. package/dist/components/Card.js +31 -0
  137. package/dist/components/CollapsiblePanel.js +77 -0
  138. package/dist/components/ConfirmModal.js +74 -0
  139. package/dist/components/CopyToClipboard.js +81 -0
  140. package/dist/{chunks/CreateModal-BY6DLmur.js → components/CreateModal.js} +10 -189
  141. package/dist/components/DescriptionList.js +42 -0
  142. package/dist/components/Dropdown.d.ts +1 -1
  143. package/dist/components/Dropdown.js +349 -0
  144. package/dist/components/EmptyState.d.ts +1 -1
  145. package/dist/components/EmptyState.js +27 -0
  146. package/dist/components/Filter.js +32 -0
  147. package/dist/components/FilterPill.js +13 -0
  148. package/dist/components/IconButton.js +34 -0
  149. package/dist/components/Indicator.d.ts +2 -2
  150. package/dist/{chunks/Indicator-hBSIxOPK.js → components/Indicator.js} +1 -1
  151. package/dist/components/Input.d.ts +1 -1
  152. package/dist/components/Input.js +88 -0
  153. package/dist/components/LetterBadge.d.ts +1 -1
  154. package/dist/components/LetterBadge.js +13 -0
  155. package/dist/components/Listbox.js +123 -0
  156. package/dist/{chunks/Loader-BXoXTZGc.js → components/Loader.js} +1 -1
  157. package/dist/components/Markdown.js +15 -0
  158. package/dist/components/MarkdownImpl.d.ts +1 -1
  159. package/dist/components/MultiSelect.js +171 -0
  160. package/dist/components/Overview.js +39 -0
  161. package/dist/components/PageHeader.js +194 -0
  162. package/dist/components/Pagination.js +35 -0
  163. package/dist/components/Provider.d.ts +16 -65
  164. package/dist/{chunks/Provider-Ghua9PkN.js → components/Provider.js} +54 -20
  165. package/dist/{chunks/RequiredMark-DfLdYbYZ.js → components/RequiredMark.js} +1 -1
  166. package/dist/components/SectionHeader.js +11 -0
  167. package/dist/components/SettingModeOption.js +30 -0
  168. package/dist/components/SettingRow.d.ts +1 -1
  169. package/dist/components/SettingRow.js +35 -0
  170. package/dist/components/SettingsCard.js +31 -0
  171. package/dist/components/SettingsGroup.d.ts +1 -1
  172. package/dist/components/SettingsGroup.js +17 -0
  173. package/dist/components/Sort.js +42 -0
  174. package/dist/components/StatusBadge.js +63 -0
  175. package/dist/components/SwitchToggle.js +59 -0
  176. package/dist/{chunks/SwitchToggleSmall-FcsaYSTs.js → components/SwitchToggleSmall.js} +1 -1
  177. package/dist/{chunks/Table-4OHjdKdO.js → components/Table.js} +7 -5
  178. package/dist/components/Toggle.js +20 -0
  179. package/dist/{chunks/Tooltip-Crxo_eU_.js → components/Tooltip.js} +6 -4
  180. package/dist/{chunks/StatusBadge-C1Blx_cW.js → components/dropdownUtils.js} +2 -63
  181. package/dist/components/focus.d.ts +2 -0
  182. package/dist/components/focus.js +7 -0
  183. package/dist/components/ghostButton.js +7 -0
  184. package/dist/components/inputClasses.js +4 -0
  185. package/dist/components/keys.d.ts +12 -0
  186. package/dist/components/keys.js +27 -0
  187. package/dist/components/relativeTime.js +32 -0
  188. package/dist/{chunks/useCssIsDark-DHr05dG2.js → components/useCssIsDark.js} +1 -1
  189. package/dist/duration.d.ts +3 -0
  190. package/dist/duration.js +17 -0
  191. package/dist/editor/Editor.js +13 -0
  192. package/dist/editor/EditorField.js +53 -0
  193. package/dist/editor/FormCodePanel.js +173 -0
  194. package/dist/editor/Monaco.d.ts +1 -20
  195. package/dist/editor/Monaco.js +112 -0
  196. package/dist/editor/index.d.ts +2 -1
  197. package/dist/editor/index.js +7 -2
  198. package/dist/editor/themes.js +91 -0
  199. package/dist/editor/workers.js +29 -0
  200. package/dist/editor/yaml.d.ts +5 -0
  201. package/dist/editor/yaml.js +15 -0
  202. package/dist/engine.d.ts +98 -0
  203. package/dist/file-explorer/FileExplorer.d.ts +11 -2
  204. package/dist/file-explorer/FileExplorer.js +1402 -0
  205. package/dist/file-explorer/FileExplorerContext.d.ts +1 -1
  206. package/dist/file-explorer/FileExplorerContext.js +370 -0
  207. package/dist/file-explorer/FilePreview/CodePreviewEditor.d.ts +1 -1
  208. package/dist/{chunks/CodePreviewEditor-4lx3kE-w.js → file-explorer/FilePreview/CodePreviewEditor.js} +3 -2
  209. package/dist/file-explorer/FilePreview/Inline.js +45 -0
  210. package/dist/file-explorer/FilePreview/StreamedBadge.js +16 -0
  211. package/dist/file-explorer/FilePreview/Viewer.js +526 -0
  212. package/dist/file-explorer/FilePreview/index.js +266 -0
  213. package/dist/file-explorer/FilePreview/parse.js +63 -0
  214. package/dist/file-explorer/FilePreview/previewCache.js +98 -0
  215. package/dist/file-explorer/FilePreview/previewType.d.ts +1 -1
  216. package/dist/file-explorer/FilePreview/previewType.js +151 -0
  217. package/dist/file-explorer/FilePreview/readCappedBytes.js +196 -0
  218. package/dist/file-explorer/FilePreview/useObjectBlobUrl.js +95 -0
  219. package/dist/file-explorer/FilePreview/useObjectText.js +109 -0
  220. package/dist/file-explorer/FilePreview/usePresignedUrl.js +73 -0
  221. package/dist/file-explorer/FileRow.d.ts +1 -1
  222. package/dist/file-explorer/FileRow.js +165 -0
  223. package/dist/file-explorer/FileRowsWindow.js +92 -0
  224. package/dist/file-explorer/FileTable.js +172 -0
  225. package/dist/file-explorer/FileTableHeaders.js +49 -0
  226. package/dist/file-explorer/LoadMoreRow.js +46 -0
  227. package/dist/file-explorer/TreeView.js +376 -0
  228. package/dist/file-explorer/helpers.d.ts +4 -4
  229. package/dist/file-explorer/helpers.js +537 -0
  230. package/dist/file-explorer/index.d.ts +3 -3
  231. package/dist/file-explorer/index.js +7 -5705
  232. package/dist/file-explorer/lib/batch.js +39 -0
  233. package/dist/file-explorer/lib/errors.js +9 -0
  234. package/dist/file-explorer/lib/paging.js +124 -0
  235. package/dist/file-explorer/lib/types.d.ts +6 -1
  236. package/dist/file-explorer/lib/utils.d.ts +1 -3
  237. package/dist/file-explorer/lib/utils.js +322 -0
  238. package/dist/file-explorer/toasts.js +400 -0
  239. package/dist/file-explorer/treeRows.js +73 -0
  240. package/dist/file-explorer/useNearEnd.d.ts +1 -1
  241. package/dist/file-explorer/useNearEnd.js +27 -0
  242. package/dist/form/FieldWrapper.d.ts +2 -2
  243. package/dist/form/FieldWrapper.js +54 -0
  244. package/dist/form/Fields/BooleanField.js +51 -0
  245. package/dist/form/Fields/CheckboxGroupField.js +72 -0
  246. package/dist/form/Fields/ColorField.js +33 -0
  247. package/dist/form/Fields/DropdownField.js +49 -0
  248. package/dist/form/Fields/DurationField.js +130 -0
  249. package/dist/form/Fields/LabelField.js +19 -0
  250. package/dist/form/Fields/MultiDropdownField.js +40 -0
  251. package/dist/form/Fields/NumberField.js +51 -0
  252. package/dist/form/Fields/ObjectField.js +54 -0
  253. package/dist/form/Fields/RadioField.js +49 -0
  254. package/dist/form/Fields/RangeField.js +58 -0
  255. package/dist/form/Fields/ResourceOptionIcon.d.ts +1 -1
  256. package/dist/form/Fields/ResourceOptionIcon.js +21 -0
  257. package/dist/form/Fields/StepField.js +6 -0
  258. package/dist/form/Fields/StringField.js +37 -0
  259. package/dist/form/Fields/TextAreaField.js +31 -0
  260. package/dist/form/Fields/durationValidity.js +11 -0
  261. package/dist/form/Form.d.ts +4 -21
  262. package/dist/form/Form.js +643 -0
  263. package/dist/form/SpecialTypes/DropdownWrapper.js +30 -0
  264. package/dist/form/SpecialTypes/FormikCustomDropdown.js +122 -0
  265. package/dist/form/SpecialTypes/FormikCustomInput.js +111 -0
  266. package/dist/form/SpecialTypes/FormikMultiSelectDropdown.js +31 -0
  267. package/dist/form/SpecialTypes/FormikNumericInput.js +60 -0
  268. package/dist/form/Wizard/WizardContainer.js +138 -0
  269. package/dist/form/Wizard/WizardNavigation.js +92 -0
  270. package/dist/form/Wizard/WizardStepContent.js +35 -0
  271. package/dist/form/Wizard/WizardStepIndicator.js +108 -0
  272. package/dist/form/Wizard/useWizardState.js +118 -0
  273. package/dist/form/Wizard/utils.js +34 -0
  274. package/dist/form/fieldContext.js +26 -0
  275. package/dist/form/fieldRegistry.js +50 -0
  276. package/dist/form/index.d.ts +11 -12
  277. package/dist/form/index.js +18 -2445
  278. package/dist/form/lib.d.ts +6 -1
  279. package/dist/{chunks/FieldWrapper-Bef01EWO.js → form/lib.js} +5 -104
  280. package/dist/form/types/fieldComponentTypes.d.ts +3 -2
  281. package/dist/form/types/fieldTypes.d.ts +6 -20
  282. package/dist/form/useParsedOpts.d.ts +1 -1
  283. package/dist/form/useParsedOpts.js +62 -0
  284. package/dist/form/usePrevious.js +11 -0
  285. package/dist/form/utils/checkShowIfObject.js +14 -0
  286. package/dist/form/utils/{slurmDuration.d.ts → duration.d.ts} +2 -2
  287. package/dist/form/utils/duration.js +69 -0
  288. package/dist/form/utils/getParentValue.js +23 -0
  289. package/dist/form/utils/getPlaceholder.js +9 -0
  290. package/dist/form/utils/getValueUsingPath.js +23 -0
  291. package/dist/form/utils/secondaryField.js +22 -0
  292. package/dist/graph/AnnotationBanner.js +141 -0
  293. package/dist/graph/Collapse.js +41 -0
  294. package/dist/{workflow/index.js → graph/DependencyGraph.js} +76 -1163
  295. package/dist/graph/JobSummary.js +104 -0
  296. package/dist/{workflow → graph}/MatrixGroup.d.ts +2 -2
  297. package/dist/graph/MatrixGroup.js +107 -0
  298. package/dist/graph/Reveal.js +57 -0
  299. package/dist/graph/TreeView.js +711 -0
  300. package/dist/{workflow → graph}/index.d.ts +1 -1
  301. package/dist/graph/index.js +2 -0
  302. package/dist/{workflow → graph}/types.d.ts +3 -3
  303. package/dist/graph/types.js +6 -0
  304. package/dist/icons.d.ts +20 -21
  305. package/dist/index.d.ts +38 -40
  306. package/dist/index.js +47 -599
  307. package/dist/list/ActionToolbar.js +184 -0
  308. package/dist/list/HoverCard.js +73 -0
  309. package/dist/list/ListPage.js +145 -0
  310. package/dist/list/ListPager.js +59 -0
  311. package/dist/list/ListTable.d.ts +1 -1
  312. package/dist/list/ListTable.js +163 -0
  313. package/dist/list/ListViewControls.d.ts +2 -2
  314. package/dist/list/ListViewControls.js +372 -0
  315. package/dist/list/RowContextMenu.js +350 -0
  316. package/dist/list/UserHoverCard.js +117 -0
  317. package/dist/list/index.d.ts +9 -9
  318. package/dist/list/index.js +11 -2
  319. package/dist/list/listSearch.js +137 -0
  320. package/dist/list/listView.js +210 -0
  321. package/dist/list/textEntry.js +10 -0
  322. package/dist/logviewer/LogViewer.d.ts +1 -1
  323. package/dist/logviewer/LogViewer.js +750 -0
  324. package/dist/logviewer/index.d.ts +1 -0
  325. package/dist/logviewer/index.js +3 -742
  326. package/dist/logviewer/segments.d.ts +9 -0
  327. package/dist/logviewer/segments.js +80 -0
  328. package/dist/styles/fonts.css +4 -4
  329. package/dist/styles/theme.css +6 -4
  330. package/dist/styles.css +1 -1
  331. package/dist/theme/index.js +2 -2
  332. package/package.json +38 -14
  333. package/LICENSE +0 -202
  334. package/dist/chunks/Monaco-C1POOdVv.js +0 -1046
  335. package/dist/chunks/PageHeader-l49p1nM9.js +0 -690
  336. package/dist/chunks/SwitchToggle-CHPP8uZQ.js +0 -755
  337. package/dist/chunks/editor-9_uVtUyy.js +0 -347
  338. package/dist/chunks/list-qrojZZNv.js +0 -1411
  339. package/dist/editor/usesGitlab.d.ts +0 -97
  340. package/dist/form/Fields/BucketReadOnlyField.d.ts +0 -7
  341. package/dist/form/types/workflow-schema.d.ts +0 -1145
  342. package/dist/form/utils/pwResolver.d.ts +0 -18
  343. package/dist/{chunks/MarkdownImpl-Bq4QhrtA.js → components/MarkdownImpl.js} +1 -1
  344. /package/dist/{workflow → graph}/AnnotationBanner.d.ts +0 -0
  345. /package/dist/{workflow → graph}/Collapse.d.ts +0 -0
  346. /package/dist/{workflow → graph}/DependencyGraph.d.ts +0 -0
  347. /package/dist/{workflow → graph}/JobSummary.d.ts +0 -0
  348. /package/dist/{workflow → graph}/Reveal.d.ts +0 -0
  349. /package/dist/{workflow → graph}/TreeView.d.ts +0 -0
@@ -0,0 +1,711 @@
1
+ import { useRunFile, useSlots, useWorkflowEngine } from "../components/Provider.js";
2
+ import { ChevronRightIcon, LoaderIcon } from "../icons.js";
3
+ import { Indicator } from "../components/Indicator.js";
4
+ import { LogViewer } from "../logviewer/LogViewer.js";
5
+ import { toAbsHumanDuration } from "../duration.js";
6
+ import cx from "classnames";
7
+ import { useCallback, useId, useMemo, useState } from "react";
8
+ import { jsx, jsxs } from "react/jsx-runtime";
9
+ import { DateTime } from "luxon";
10
+ import { AnimatePresence, motion } from "framer-motion";
11
+ //#region src/graph/TreeView.tsx
12
+ function getStepDuration(step) {
13
+ if (!step.startedAt) return "";
14
+ const start = DateTime.fromISO(step.startedAt);
15
+ const end = step.completedAt ? DateTime.fromISO(step.completedAt) : DateTime.now();
16
+ return toAbsHumanDuration(start, end);
17
+ }
18
+ function getJobDuration(job) {
19
+ if (!job.startedAt) return "";
20
+ const start = DateTime.fromISO(job.startedAt);
21
+ const end = job.completedAt ? DateTime.fromISO(job.completedAt) : DateTime.now();
22
+ return toAbsHumanDuration(start, end);
23
+ }
24
+ function formatJobLabel(jobName, job) {
25
+ const matrix = job?._matrix;
26
+ if (matrix?.originaljob) return `${matrix.originaljob[0].toUpperCase() + matrix.originaljob.slice(1)} (${(matrix.index ?? 0) + 1}/${matrix.totalingroup ?? "?"})`;
27
+ return (jobName[0].toUpperCase() + jobName.slice(1)).replace(/_/g, " ");
28
+ }
29
+ function InlineLogViewer({ slug, jobName, stepIndex }) {
30
+ const logPath = useWorkflowEngine().stepLogPath("", jobName, stepIndex);
31
+ const { data: logs, isLoading, error } = useRunFile(slug, logPath, { refreshInterval: 2e3 });
32
+ if (isLoading && !logs) return /* @__PURE__ */ jsxs("div", {
33
+ className: "flex items-center gap-2 px-5 py-4 text-sm text-[var(--theme-muted-text-color)]",
34
+ children: [/* @__PURE__ */ jsx(LoaderIcon, { className: "w-4 h-4" }), /* @__PURE__ */ jsx("span", { children: "Loading logs..." })]
35
+ });
36
+ if (error || !logs) return /* @__PURE__ */ jsx("div", {
37
+ className: "px-5 py-4 text-sm text-[var(--theme-muted-text-color)] italic",
38
+ children: "No logs available"
39
+ });
40
+ return /* @__PURE__ */ jsx("div", {
41
+ className: "border-t border-[var(--theme-border)] ",
42
+ children: /* @__PURE__ */ jsx(LogViewer, {
43
+ log: logs,
44
+ width: "100%",
45
+ height: "unset",
46
+ inline: true,
47
+ contentClassName: "bg-[var(--theme-app-bg)]",
48
+ enableWorkflowCommands: true
49
+ })
50
+ });
51
+ }
52
+ function JobRow({ jobName, job, isExpanded, onToggle, dependencies, workflowName, runNumber, slug, expandedJobs, onJobToggle, expandedSteps, onStepToggle }) {
53
+ const hasSteps = job.steps && job.steps.length > 0;
54
+ const duration = getJobDuration(job);
55
+ const panelId = useId();
56
+ return /* @__PURE__ */ jsxs("div", {
57
+ className: "border-b border-[var(--theme-border)] last:border-b-0",
58
+ children: [/* @__PURE__ */ jsxs("button", {
59
+ type: "button",
60
+ "aria-expanded": isExpanded,
61
+ "aria-controls": hasSteps ? panelId : void 0,
62
+ className: cx("flex items-center gap-3 px-5 py-3 transition-colors w-full text-left", job.status === "skipped" || job.status === "skipped-failed" ? "cursor-default" : "cursor-pointer", isExpanded && "bg-[var(--theme-panel-bg)]"),
63
+ onClick: onToggle,
64
+ children: [
65
+ /* @__PURE__ */ jsx(motion.div, {
66
+ animate: { rotate: isExpanded ? 90 : 0 },
67
+ transition: { duration: .15 },
68
+ className: cx("flex-shrink-0", hasSteps ? "text-[var(--theme-muted-text-color)]" : "invisible"),
69
+ children: /* @__PURE__ */ jsx(ChevronRightIcon, { className: cx("w-4 h-4", isExpanded && "text-[var(--theme-element)]") })
70
+ }),
71
+ /* @__PURE__ */ jsx(Indicator, { status: job.status }),
72
+ /* @__PURE__ */ jsxs("div", {
73
+ className: "flex flex-col gap-1 min-w-0 flex-1",
74
+ children: [/* @__PURE__ */ jsx("span", {
75
+ className: "font-mono text-sm text-[var(--theme-app)] truncate",
76
+ children: formatJobLabel(jobName, job)
77
+ }), dependencies && dependencies.length > 0 && /* @__PURE__ */ jsxs("div", {
78
+ className: "flex items-center gap-1.5",
79
+ children: [/* @__PURE__ */ jsx("span", {
80
+ className: "text-[10px] text-[var(--theme-muted-text-color)]",
81
+ children: "depends on:"
82
+ }), dependencies.map((dep) => /* @__PURE__ */ jsx("span", {
83
+ className: "text-[10px] px-1.5 py-0.5 rounded bg-[var(--theme-muted-panel-bg)] text-[var(--theme-muted-text-color)]",
84
+ children: formatJobLabel(dep)
85
+ }, dep))]
86
+ })]
87
+ }),
88
+ /* @__PURE__ */ jsx("div", { className: "flex-1" }),
89
+ duration && /* @__PURE__ */ jsx("span", {
90
+ className: "font-mono text-xs text-[var(--theme-muted-text-color)] flex-shrink-0",
91
+ children: duration
92
+ })
93
+ ]
94
+ }), /* @__PURE__ */ jsx(AnimatePresence, {
95
+ initial: false,
96
+ children: isExpanded && hasSteps && /* @__PURE__ */ jsx(motion.div, {
97
+ initial: {
98
+ height: 0,
99
+ opacity: 0
100
+ },
101
+ animate: {
102
+ height: "auto",
103
+ opacity: 1
104
+ },
105
+ exit: {
106
+ height: 0,
107
+ opacity: 0
108
+ },
109
+ transition: {
110
+ duration: .2,
111
+ ease: [
112
+ .25,
113
+ .1,
114
+ .25,
115
+ 1
116
+ ]
117
+ },
118
+ className: "overflow-hidden",
119
+ id: panelId,
120
+ children: /* @__PURE__ */ jsx("div", {
121
+ className: "ml-[38px] border-l-2 border-[var(--theme-border)]",
122
+ children: job.steps.map((step, index) => {
123
+ const stepKey = `${jobName}:${index}`;
124
+ const isStepExpanded = expandedSteps.has(stepKey);
125
+ return /* @__PURE__ */ jsx(StepRow, {
126
+ step,
127
+ index,
128
+ isExpanded: isStepExpanded,
129
+ onToggle: () => onStepToggle(stepKey),
130
+ workflowName,
131
+ runNumber,
132
+ slug,
133
+ jobName,
134
+ expandedJobs,
135
+ onJobToggle,
136
+ expandedSteps,
137
+ onStepToggle
138
+ }, stepKey);
139
+ })
140
+ })
141
+ })
142
+ })]
143
+ });
144
+ }
145
+ function StepRow({ step, index, isExpanded, onToggle, workflowName, runNumber, slug, jobName, expandedJobs, onJobToggle, expandedSteps, onStepToggle, depth = 0 }) {
146
+ const engine = useWorkflowEngine();
147
+ const slots = useSlots();
148
+ const duration = getStepDuration(step);
149
+ const label = engine.stepLabel(step, index);
150
+ const isSubworkflow = !!step.subworkflow;
151
+ const panelId = useId();
152
+ const subworkflowJobs = step.subworkflow?.jobs ?? null;
153
+ const subworkflowJobNames = subworkflowJobs ? Object.keys(subworkflowJobs).filter((name) => subworkflowJobs[name]?.if !== false) : [];
154
+ const subworkflowDependenciesMap = useMemo(() => {
155
+ if (!subworkflowJobs) return {};
156
+ const map = {};
157
+ for (const subJobName of subworkflowJobNames) {
158
+ const job = subworkflowJobs[subJobName];
159
+ if (job?.needs && Array.isArray(job.needs) && job.needs.length > 0) map[subJobName] = job.needs;
160
+ }
161
+ return map;
162
+ }, [subworkflowJobs, subworkflowJobNames]);
163
+ return /* @__PURE__ */ jsxs("div", { children: [
164
+ /* @__PURE__ */ jsxs("button", {
165
+ type: "button",
166
+ "aria-expanded": isExpanded,
167
+ "aria-controls": panelId,
168
+ className: cx("flex items-center gap-3 px-5 py-2.5 cursor-pointer transition-colors w-full text-left", isExpanded ? "" : "hover:bg-[var(--theme-hover)]"),
169
+ onClick: onToggle,
170
+ children: [
171
+ /* @__PURE__ */ jsx(motion.div, {
172
+ animate: { rotate: isExpanded ? 90 : 0 },
173
+ transition: { duration: .15 },
174
+ className: "flex-shrink-0 text-[var(--theme-muted-text-color)]",
175
+ children: /* @__PURE__ */ jsx(ChevronRightIcon, { className: cx("w-4 h-4", isExpanded && "text-[var(--theme-element)]") })
176
+ }),
177
+ /* @__PURE__ */ jsx(Indicator, { status: step.status }),
178
+ isSubworkflow && slots.workflowIcon?.({
179
+ image: step.subworkflow?.image,
180
+ type: step.subworkflow?.type,
181
+ className: "h-4 w-4 flex-shrink-0"
182
+ }),
183
+ /* @__PURE__ */ jsxs("span", {
184
+ className: "font-mono text-sm text-[var(--theme-app)] truncate flex-1",
185
+ children: [label, isSubworkflow && /* @__PURE__ */ jsx("span", {
186
+ className: "ml-2 text-xs text-[var(--theme-muted-text-color)]",
187
+ children: "(subworkflow)"
188
+ })]
189
+ }),
190
+ duration && /* @__PURE__ */ jsx("span", {
191
+ className: "font-mono text-xs text-[var(--theme-muted-text-color)] flex-shrink-0",
192
+ children: duration
193
+ })
194
+ ]
195
+ }),
196
+ /* @__PURE__ */ jsx(AnimatePresence, {
197
+ initial: false,
198
+ children: isExpanded && !isSubworkflow && /* @__PURE__ */ jsx(motion.div, {
199
+ initial: {
200
+ height: 0,
201
+ opacity: 0
202
+ },
203
+ animate: {
204
+ height: "auto",
205
+ opacity: 1
206
+ },
207
+ exit: {
208
+ height: 0,
209
+ opacity: 0
210
+ },
211
+ transition: {
212
+ duration: .2,
213
+ ease: [
214
+ .25,
215
+ .1,
216
+ .25,
217
+ 1
218
+ ]
219
+ },
220
+ className: "overflow-hidden",
221
+ id: panelId,
222
+ children: /* @__PURE__ */ jsx(InlineLogViewer, {
223
+ slug,
224
+ jobName,
225
+ stepIndex: index
226
+ })
227
+ })
228
+ }),
229
+ /* @__PURE__ */ jsx(AnimatePresence, {
230
+ initial: false,
231
+ children: isExpanded && isSubworkflow && subworkflowJobNames.length > 0 && /* @__PURE__ */ jsx(motion.div, {
232
+ initial: {
233
+ height: 0,
234
+ opacity: 0
235
+ },
236
+ animate: {
237
+ height: "auto",
238
+ opacity: 1
239
+ },
240
+ exit: {
241
+ height: 0,
242
+ opacity: 0
243
+ },
244
+ transition: {
245
+ duration: .2,
246
+ ease: [
247
+ .25,
248
+ .1,
249
+ .25,
250
+ 1
251
+ ]
252
+ },
253
+ className: "overflow-hidden",
254
+ id: panelId,
255
+ children: /* @__PURE__ */ jsx("div", {
256
+ className: "ml-[38px] border-l-2 border-[var(--theme-border)]",
257
+ children: subworkflowJobNames.map((subJobName) => {
258
+ const subJob = subworkflowJobs?.[subJobName];
259
+ if (!subJob) return null;
260
+ const subJobKey = `${jobName}:${index}:${subJobName}`;
261
+ const isSubJobExpanded = expandedJobs.has(subJobKey);
262
+ return /* @__PURE__ */ jsx(SubworkflowJobRow, {
263
+ jobName: subJobName,
264
+ job: subJob,
265
+ isExpanded: isSubJobExpanded,
266
+ onToggle: () => onJobToggle(subJobKey),
267
+ dependencies: subworkflowDependenciesMap[subJobName],
268
+ slug,
269
+ parentJobName: jobName,
270
+ parentStepIndex: index,
271
+ expandedJobs,
272
+ onJobToggle,
273
+ expandedSteps,
274
+ onStepToggle,
275
+ depth: depth + 1
276
+ }, subJobName);
277
+ })
278
+ })
279
+ })
280
+ })
281
+ ] });
282
+ }
283
+ function SubworkflowJobRow({ jobName, job, isExpanded, onToggle, dependencies, slug, parentJobName, parentStepIndex, subworkflowPrefix, expandedJobs, onJobToggle, expandedSteps, onStepToggle, depth }) {
284
+ const hasSteps = job.steps && job.steps.length > 0;
285
+ const duration = getJobDuration(job);
286
+ const nestedSubworkflowPrefix = `${subworkflowPrefix || ""}subworkflows/${parentJobName}/step_${parentStepIndex}/`;
287
+ const panelId = useId();
288
+ return /* @__PURE__ */ jsxs("div", {
289
+ className: "border-b border-[var(--theme-border)] last:border-b-0",
290
+ children: [/* @__PURE__ */ jsxs("button", {
291
+ type: "button",
292
+ "aria-expanded": isExpanded,
293
+ "aria-controls": hasSteps ? panelId : void 0,
294
+ className: cx("flex items-center gap-3 px-5 py-3 transition-colors w-full text-left", job.status === "skipped" || job.status === "skipped-failed" ? "cursor-default" : "cursor-pointer", isExpanded && "bg-[var(--theme-panel-bg)]"),
295
+ onClick: onToggle,
296
+ children: [
297
+ /* @__PURE__ */ jsx(motion.div, {
298
+ animate: { rotate: isExpanded ? 90 : 0 },
299
+ transition: { duration: .15 },
300
+ className: cx("flex-shrink-0", hasSteps ? "text-[var(--theme-muted-text-color)]" : "invisible"),
301
+ children: /* @__PURE__ */ jsx(ChevronRightIcon, { className: cx("w-4 h-4", isExpanded && "text-[var(--theme-element)]") })
302
+ }),
303
+ /* @__PURE__ */ jsx(Indicator, { status: job.status }),
304
+ /* @__PURE__ */ jsxs("div", {
305
+ className: "flex flex-col gap-1 min-w-0 flex-1",
306
+ children: [/* @__PURE__ */ jsx("span", {
307
+ className: "font-mono text-sm text-[var(--theme-app)] truncate",
308
+ children: formatJobLabel(jobName, job)
309
+ }), dependencies && dependencies.length > 0 && /* @__PURE__ */ jsxs("div", {
310
+ className: "flex items-center gap-1.5",
311
+ children: [/* @__PURE__ */ jsx("span", {
312
+ className: "text-[10px] text-[var(--theme-muted-text-color)]",
313
+ children: "depends on:"
314
+ }), dependencies.map((dep) => /* @__PURE__ */ jsx("span", {
315
+ className: "text-[10px] px-1.5 py-0.5 rounded bg-[var(--theme-muted-panel-bg)] text-[var(--theme-muted-text-color)]",
316
+ children: formatJobLabel(dep)
317
+ }, dep))]
318
+ })]
319
+ }),
320
+ /* @__PURE__ */ jsx("div", { className: "flex-1" }),
321
+ duration && /* @__PURE__ */ jsx("span", {
322
+ className: "font-mono text-xs text-[var(--theme-muted-text-color)] flex-shrink-0",
323
+ children: duration
324
+ })
325
+ ]
326
+ }), /* @__PURE__ */ jsx(AnimatePresence, {
327
+ initial: false,
328
+ children: isExpanded && hasSteps && /* @__PURE__ */ jsx(motion.div, {
329
+ initial: {
330
+ height: 0,
331
+ opacity: 0
332
+ },
333
+ animate: {
334
+ height: "auto",
335
+ opacity: 1
336
+ },
337
+ exit: {
338
+ height: 0,
339
+ opacity: 0
340
+ },
341
+ transition: {
342
+ duration: .2,
343
+ ease: [
344
+ .25,
345
+ .1,
346
+ .25,
347
+ 1
348
+ ]
349
+ },
350
+ className: "overflow-hidden",
351
+ id: panelId,
352
+ children: /* @__PURE__ */ jsx("div", {
353
+ className: "ml-[38px] border-l-2 border-[var(--theme-border)]",
354
+ children: job.steps.map((step, index) => {
355
+ const stepKey = `${nestedSubworkflowPrefix}${jobName}:${index}`;
356
+ const isStepExpanded = expandedSteps.has(stepKey);
357
+ return /* @__PURE__ */ jsx(SubworkflowStepRow, {
358
+ step,
359
+ index,
360
+ isExpanded: isStepExpanded,
361
+ onToggle: () => onStepToggle(stepKey),
362
+ slug,
363
+ subworkflowPrefix: nestedSubworkflowPrefix,
364
+ jobName,
365
+ expandedJobs,
366
+ onJobToggle,
367
+ expandedSteps,
368
+ onStepToggle,
369
+ depth
370
+ }, stepKey);
371
+ })
372
+ })
373
+ })
374
+ })]
375
+ });
376
+ }
377
+ function SubworkflowStepRow({ step, index, isExpanded, onToggle, slug, subworkflowPrefix, jobName, expandedJobs, onJobToggle, expandedSteps, onStepToggle, depth }) {
378
+ const engine = useWorkflowEngine();
379
+ const slots = useSlots();
380
+ const duration = getStepDuration(step);
381
+ const label = engine.stepLabel(step, index);
382
+ const isSubworkflow = !!step.subworkflow;
383
+ const panelId = useId();
384
+ const subworkflowJobs = step.subworkflow?.jobs ?? null;
385
+ const subworkflowJobNames = subworkflowJobs ? Object.keys(subworkflowJobs).filter((name) => subworkflowJobs[name]?.if !== false) : [];
386
+ const subworkflowDependenciesMap = useMemo(() => {
387
+ if (!subworkflowJobs) return {};
388
+ const map = {};
389
+ for (const subJobName of subworkflowJobNames) {
390
+ const job = subworkflowJobs[subJobName];
391
+ if (job?.needs && Array.isArray(job.needs) && job.needs.length > 0) map[subJobName] = job.needs;
392
+ }
393
+ return map;
394
+ }, [subworkflowJobs, subworkflowJobNames]);
395
+ return /* @__PURE__ */ jsxs("div", { children: [
396
+ /* @__PURE__ */ jsxs("button", {
397
+ type: "button",
398
+ "aria-expanded": isExpanded,
399
+ "aria-controls": panelId,
400
+ className: cx("flex items-center gap-3 px-5 py-2.5 cursor-pointer transition-colors w-full text-left", isExpanded ? "" : "hover:bg-[var(--theme-hover)]"),
401
+ onClick: onToggle,
402
+ children: [
403
+ /* @__PURE__ */ jsx(motion.div, {
404
+ animate: { rotate: isExpanded ? 90 : 0 },
405
+ transition: { duration: .15 },
406
+ className: "flex-shrink-0 text-[var(--theme-muted-text-color)]",
407
+ children: /* @__PURE__ */ jsx(ChevronRightIcon, { className: cx("w-4 h-4", isExpanded && "text-[var(--theme-element)]") })
408
+ }),
409
+ /* @__PURE__ */ jsx(Indicator, { status: step.status }),
410
+ isSubworkflow && slots.workflowIcon?.({
411
+ image: step.subworkflow?.image,
412
+ type: step.subworkflow?.type,
413
+ className: "h-4 w-4 flex-shrink-0"
414
+ }),
415
+ /* @__PURE__ */ jsxs("span", {
416
+ className: "font-mono text-sm text-[var(--theme-app)] truncate flex-1",
417
+ children: [label, isSubworkflow && /* @__PURE__ */ jsx("span", {
418
+ className: "ml-2 text-xs text-[var(--theme-muted-text-color)]",
419
+ children: "(subworkflow)"
420
+ })]
421
+ }),
422
+ duration && /* @__PURE__ */ jsx("span", {
423
+ className: "font-mono text-xs text-[var(--theme-muted-text-color)] flex-shrink-0",
424
+ children: duration
425
+ })
426
+ ]
427
+ }),
428
+ /* @__PURE__ */ jsx(AnimatePresence, {
429
+ initial: false,
430
+ children: isExpanded && !isSubworkflow && /* @__PURE__ */ jsx(motion.div, {
431
+ initial: {
432
+ height: 0,
433
+ opacity: 0
434
+ },
435
+ animate: {
436
+ height: "auto",
437
+ opacity: 1
438
+ },
439
+ exit: {
440
+ height: 0,
441
+ opacity: 0
442
+ },
443
+ transition: {
444
+ duration: .2,
445
+ ease: [
446
+ .25,
447
+ .1,
448
+ .25,
449
+ 1
450
+ ]
451
+ },
452
+ className: "overflow-hidden",
453
+ id: panelId,
454
+ children: /* @__PURE__ */ jsx(SubworkflowInlineLogViewer, {
455
+ slug,
456
+ subworkflowPrefix,
457
+ jobName,
458
+ stepIndex: index
459
+ })
460
+ })
461
+ }),
462
+ /* @__PURE__ */ jsx(AnimatePresence, {
463
+ initial: false,
464
+ children: isExpanded && isSubworkflow && subworkflowJobNames.length > 0 && /* @__PURE__ */ jsx(motion.div, {
465
+ initial: {
466
+ height: 0,
467
+ opacity: 0
468
+ },
469
+ animate: {
470
+ height: "auto",
471
+ opacity: 1
472
+ },
473
+ exit: {
474
+ height: 0,
475
+ opacity: 0
476
+ },
477
+ transition: {
478
+ duration: .2,
479
+ ease: [
480
+ .25,
481
+ .1,
482
+ .25,
483
+ 1
484
+ ]
485
+ },
486
+ className: "overflow-hidden",
487
+ id: panelId,
488
+ children: /* @__PURE__ */ jsx("div", {
489
+ className: "ml-[38px] border-l-2 border-[var(--theme-border)]",
490
+ children: subworkflowJobNames.map((subJobName) => {
491
+ const subJob = subworkflowJobs?.[subJobName];
492
+ if (!subJob) return null;
493
+ const subJobKey = `${subworkflowPrefix}${jobName}:${index}:${subJobName}`;
494
+ const isSubJobExpanded = expandedJobs.has(subJobKey);
495
+ return /* @__PURE__ */ jsx(SubworkflowJobRow, {
496
+ jobName: subJobName,
497
+ job: subJob,
498
+ isExpanded: isSubJobExpanded,
499
+ onToggle: () => onJobToggle(subJobKey),
500
+ dependencies: subworkflowDependenciesMap[subJobName],
501
+ slug,
502
+ parentJobName: jobName,
503
+ parentStepIndex: index,
504
+ subworkflowPrefix,
505
+ expandedJobs,
506
+ onJobToggle,
507
+ expandedSteps,
508
+ onStepToggle,
509
+ depth: depth + 1
510
+ }, subJobName);
511
+ })
512
+ })
513
+ })
514
+ })
515
+ ] });
516
+ }
517
+ function SubworkflowInlineLogViewer({ slug, subworkflowPrefix, jobName, stepIndex }) {
518
+ const logPath = useWorkflowEngine().stepLogPath(subworkflowPrefix, jobName, stepIndex);
519
+ const { data: logs, isLoading, error } = useRunFile(slug, logPath, { refreshInterval: 2e3 });
520
+ if (isLoading && !logs) return /* @__PURE__ */ jsxs("div", {
521
+ className: "flex items-center gap-2 px-5 py-4 text-sm text-[var(--theme-muted-text-color)]",
522
+ children: [/* @__PURE__ */ jsx(LoaderIcon, { className: "w-4 h-4" }), /* @__PURE__ */ jsx("span", { children: "Loading logs..." })]
523
+ });
524
+ if (error || !logs) return /* @__PURE__ */ jsx("div", {
525
+ className: "px-5 py-4 text-sm text-[var(--theme-muted-text-color)] italic",
526
+ children: "No logs available"
527
+ });
528
+ return /* @__PURE__ */ jsx("div", {
529
+ className: "border-t border-[var(--theme-border)]",
530
+ children: /* @__PURE__ */ jsx(LogViewer, {
531
+ log: logs,
532
+ width: "100%",
533
+ height: "unset",
534
+ inline: true,
535
+ contentClassName: "bg-[var(--theme-app-bg)]",
536
+ enableWorkflowCommands: true
537
+ })
538
+ });
539
+ }
540
+ function TreeView({ jobs, workflowName, runNumber, slug, expandedJobs, setExpandedJobs }) {
541
+ const engine = useWorkflowEngine();
542
+ const visibleJobNames = useMemo(() => {
543
+ return Object.keys(jobs).filter((jobName) => jobs[jobName]?.if !== false);
544
+ }, [jobs]);
545
+ const [expandedSteps, setExpandedSteps] = useState(/* @__PURE__ */ new Set());
546
+ const [expandedSubworkflowJobs, setExpandedSubworkflowJobs] = useState(/* @__PURE__ */ new Set());
547
+ const toggleJob = useCallback((jobName) => {
548
+ const newExpanded = new Set(expandedJobs);
549
+ if (newExpanded.has(jobName)) newExpanded.delete(jobName);
550
+ else {
551
+ const status = jobs[jobName]?.status;
552
+ if (status === "skipped" || status === "skipped-failed") return;
553
+ newExpanded.add(jobName);
554
+ }
555
+ setExpandedJobs(newExpanded);
556
+ }, [
557
+ expandedJobs,
558
+ setExpandedJobs,
559
+ jobs
560
+ ]);
561
+ const toggleSubworkflowJob = useCallback((jobKey) => {
562
+ setExpandedSubworkflowJobs((prev) => {
563
+ const newSet = new Set(prev);
564
+ if (newSet.has(jobKey)) newSet.delete(jobKey);
565
+ else newSet.add(jobKey);
566
+ return newSet;
567
+ });
568
+ }, []);
569
+ const toggleStep = useCallback((stepKey) => {
570
+ setExpandedSteps((prev) => {
571
+ const newSet = new Set(prev);
572
+ if (newSet.has(stepKey)) newSet.delete(stepKey);
573
+ else newSet.add(stepKey);
574
+ return newSet;
575
+ });
576
+ }, []);
577
+ const expandAll = useCallback(() => {
578
+ setExpandedJobs(new Set(visibleJobNames));
579
+ }, [visibleJobNames, setExpandedJobs]);
580
+ const collapseAll = useCallback(() => {
581
+ setExpandedJobs(/* @__PURE__ */ new Set());
582
+ setExpandedSteps(/* @__PURE__ */ new Set());
583
+ setExpandedSubworkflowJobs(/* @__PURE__ */ new Set());
584
+ }, [setExpandedJobs]);
585
+ const allExpanded = expandedJobs.size === visibleJobNames.length;
586
+ const dependenciesMap = useMemo(() => {
587
+ const map = {};
588
+ for (const jobName of visibleJobNames) {
589
+ const job = jobs[jobName];
590
+ if (job?.needs && Array.isArray(job.needs) && job.needs.length > 0) map[jobName] = job.needs;
591
+ }
592
+ return map;
593
+ }, [jobs, visibleJobNames]);
594
+ return /* @__PURE__ */ jsxs("div", {
595
+ className: "flex flex-col",
596
+ children: [/* @__PURE__ */ jsx("div", {
597
+ className: "flex justify-end px-4 py-2 border-b border-[var(--theme-border)]",
598
+ children: /* @__PURE__ */ jsx("button", {
599
+ type: "button",
600
+ onClick: allExpanded ? collapseAll : expandAll,
601
+ className: "text-xs font-mono text-[var(--theme-muted-text-color)] hover:text-[var(--theme-app)] transition-colors px-3 py-1.5 border border-[var(--theme-border)] rounded",
602
+ children: allExpanded ? "Collapse all" : "Expand all"
603
+ })
604
+ }), /* @__PURE__ */ jsx("div", { children: (() => {
605
+ const matrixGroups = {};
606
+ for (const jobName of visibleJobNames) {
607
+ const matrix = jobs[jobName]?._matrix;
608
+ if (matrix?.originaljob) {
609
+ let group = matrixGroups[matrix.originaljob];
610
+ if (!group) {
611
+ group = {
612
+ originaljob: matrix.originaljob,
613
+ members: []
614
+ };
615
+ matrixGroups[matrix.originaljob] = group;
616
+ }
617
+ group.members.push(jobName);
618
+ }
619
+ }
620
+ for (const group of Object.values(matrixGroups)) group.members.sort((a, b) => (jobs[a]?._matrix?.index ?? 0) - (jobs[b]?._matrix?.index ?? 0));
621
+ const rendered = [];
622
+ const seenMatrixGroups = /* @__PURE__ */ new Set();
623
+ for (const jobName of visibleJobNames) {
624
+ const matrixOrigin = jobs[jobName]?._matrix?.originaljob;
625
+ if (matrixOrigin) {
626
+ if (seenMatrixGroups.has(matrixOrigin)) continue;
627
+ seenMatrixGroups.add(matrixOrigin);
628
+ const group = matrixGroups[matrixOrigin];
629
+ if (!group) continue;
630
+ const isGroupExpanded = expandedJobs.has(`matrix:${matrixOrigin}`);
631
+ const { aggStatus } = engine.matrixStatus(group.members.map((m) => jobs[m]?.status));
632
+ rendered.push(/* @__PURE__ */ jsxs("div", {
633
+ className: "border-b border-[var(--theme-border)]",
634
+ children: [/* @__PURE__ */ jsxs("button", {
635
+ type: "button",
636
+ "aria-expanded": isGroupExpanded,
637
+ "aria-controls": `matrix-panel-${matrixOrigin}`,
638
+ className: "flex items-center gap-3 px-5 py-3 cursor-pointer transition-colors w-full text-left",
639
+ onClick: () => toggleJob(`matrix:${matrixOrigin}`),
640
+ children: [
641
+ /* @__PURE__ */ jsx(motion.div, {
642
+ animate: { rotate: isGroupExpanded ? 90 : 0 },
643
+ transition: { duration: .15 },
644
+ className: "flex-shrink-0 text-[var(--theme-muted-text-color)]",
645
+ children: /* @__PURE__ */ jsx(ChevronRightIcon, { className: cx("w-4 h-4", isGroupExpanded && "text-[var(--theme-element)]") })
646
+ }),
647
+ /* @__PURE__ */ jsx(Indicator, { status: aggStatus }),
648
+ /* @__PURE__ */ jsxs("span", {
649
+ className: "font-mono text-sm text-[var(--theme-app)]",
650
+ children: [
651
+ "Matrix: ",
652
+ matrixOrigin,
653
+ " (",
654
+ group.members.length,
655
+ " jobs)"
656
+ ]
657
+ })
658
+ ]
659
+ }), /* @__PURE__ */ jsx(AnimatePresence, { children: isGroupExpanded && /* @__PURE__ */ jsx(motion.div, {
660
+ initial: {
661
+ height: 0,
662
+ opacity: 0
663
+ },
664
+ animate: {
665
+ height: "auto",
666
+ opacity: 1
667
+ },
668
+ exit: {
669
+ height: 0,
670
+ opacity: 0
671
+ },
672
+ transition: { duration: .15 },
673
+ className: "overflow-hidden pl-4",
674
+ id: `matrix-panel-${matrixOrigin}`,
675
+ children: group.members.map((memberName) => /* @__PURE__ */ jsx(JobRow, {
676
+ jobName: memberName,
677
+ job: jobs[memberName],
678
+ isExpanded: expandedJobs.has(memberName),
679
+ onToggle: () => toggleJob(memberName),
680
+ dependencies: dependenciesMap[memberName],
681
+ workflowName,
682
+ runNumber,
683
+ slug,
684
+ expandedJobs: expandedSubworkflowJobs,
685
+ onJobToggle: toggleSubworkflowJob,
686
+ expandedSteps,
687
+ onStepToggle: toggleStep
688
+ }, memberName))
689
+ }) })]
690
+ }, `matrix-${matrixOrigin}`));
691
+ } else rendered.push(/* @__PURE__ */ jsx(JobRow, {
692
+ jobName,
693
+ job: jobs[jobName],
694
+ isExpanded: expandedJobs.has(jobName),
695
+ onToggle: () => toggleJob(jobName),
696
+ dependencies: dependenciesMap[jobName],
697
+ workflowName,
698
+ runNumber,
699
+ slug,
700
+ expandedJobs: expandedSubworkflowJobs,
701
+ onJobToggle: toggleSubworkflowJob,
702
+ expandedSteps,
703
+ onStepToggle: toggleStep
704
+ }, jobName));
705
+ }
706
+ return rendered;
707
+ })() })]
708
+ });
709
+ }
710
+ //#endregion
711
+ export { TreeView as default };