@morscherlab/mint-sdk 1.4.0-beta.8 → 1.4.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 (353) hide show
  1. package/README.md +14 -3
  2. package/dist/{ActionMenu-CScINahU.js → AlertBox-DwgNTEqf.js} +40 -209
  3. package/dist/AlertBox-DwgNTEqf.js.map +1 -0
  4. package/dist/{AppSidebar-BmiiPfz9.js → AppSidebar-CZZaxni0.js} +1249 -239
  5. package/dist/AppSidebar-CZZaxni0.js.map +1 -0
  6. package/dist/{ConfirmDialog-CJ7hqYUP.js → ConfirmDialog-CjWoxAD1.js} +2 -2
  7. package/dist/{ConfirmDialog-CJ7hqYUP.js.map → ConfirmDialog-CjWoxAD1.js.map} +1 -1
  8. package/dist/ExperimentPopover-DujiuQIO.js +337 -0
  9. package/dist/ExperimentPopover-DujiuQIO.js.map +1 -0
  10. package/dist/{ExperimentSelectorModal-D-9z7cNx.js → ExperimentSelectorModal-B4j4eUOJ.js} +244 -211
  11. package/dist/ExperimentSelectorModal-B4j4eUOJ.js.map +1 -0
  12. package/dist/{SegmentedControl-DERBN-Xd.js → SegmentedControl-DyUPH3I5.js} +2 -2
  13. package/dist/{SegmentedControl-DERBN-Xd.js.map → SegmentedControl-DyUPH3I5.js.map} +1 -1
  14. package/dist/{SettingsModal-CSLE31yg.js → SettingsModal-D2MOOtuO.js} +28 -27
  15. package/dist/SettingsModal-D2MOOtuO.js.map +1 -0
  16. package/dist/__stories__/experiment-helpers.d.ts +10 -0
  17. package/dist/__tests__/components/AppTopBarOnboarding.test.d.ts +1 -0
  18. package/dist/__tests__/components/FloatingPanelsInModal.test.d.ts +1 -0
  19. package/dist/__tests__/composables/useFloatingPanel.test.d.ts +1 -0
  20. package/dist/__tests__/composables/useOnboarding.test.d.ts +1 -0
  21. package/dist/__tests__/styles/paletteTokens.test.d.ts +1 -0
  22. package/dist/__tests__/styles/v2AuditRules.test.d.ts +1 -0
  23. package/dist/components/AppSidebar.vue.d.ts +1 -1
  24. package/dist/components/AppTopBar.vue.d.ts +20 -5
  25. package/dist/components/ArtifactSaveDialog.vue.d.ts +9 -1
  26. package/dist/components/AuditTrail.vue.d.ts +1 -1
  27. package/dist/components/BaseButton.vue.d.ts +4 -2
  28. package/dist/components/BaseSelect.vue.d.ts +2 -2
  29. package/dist/components/ChartContainer.vue.d.ts +2 -0
  30. package/dist/components/DatePicker.vue.d.ts +1 -1
  31. package/dist/components/ExperimentPopover.vue.d.ts +18 -0
  32. package/dist/components/ExperimentSelectorModal.vue.d.ts +15 -5
  33. package/dist/components/FilePicker.vue.d.ts +1 -1
  34. package/dist/components/FileUploader.vue.d.ts +2 -2
  35. package/dist/components/JobsStatusTray.vue.d.ts +15 -4
  36. package/dist/components/PluginIcon.vue.d.ts +2 -2
  37. package/dist/components/PluginWorkspaceView.props.d.ts +3 -0
  38. package/dist/components/PluginWorkspaceView.vue.d.ts +3 -0
  39. package/dist/components/SampleSelector.vue.d.ts +6 -6
  40. package/dist/components/SequenceProgressBar.vue.d.ts +3 -0
  41. package/dist/components/SmartGroupFieldRecipe.vue.d.ts +3 -3
  42. package/dist/components/StepWizard.vue.d.ts +3 -0
  43. package/dist/components/internal/AppTopBarOnboardingInternal.vue.d.ts +7 -0
  44. package/dist/components/internal/AppTopBarPageSelectorInternal.vue.d.ts +2 -1
  45. package/dist/components/internal/AutoGroupModalInternal.vue.d.ts +3 -3
  46. package/dist/components/internal/DatePickerTimeInternal.vue.d.ts +1 -1
  47. package/dist/components/internal/OnboardingLayerInternal.vue.d.ts +7 -0
  48. package/dist/components/internal/ResourcePickerListInternal.vue.d.ts +2 -7
  49. package/dist/components/internal/SelectMultipleInternal.vue.d.ts +4 -0
  50. package/dist/components/internal/WorkspaceShellInternal.vue.d.ts +8 -0
  51. package/dist/composables/createClient.d.ts +2 -0
  52. package/dist/composables/index.d.ts +1 -0
  53. package/dist/composables/pluginIdentity.d.ts +24 -0
  54. package/dist/composables/pluginWorkspaceModel.d.ts +2 -2
  55. package/dist/composables/useAppExperiment.d.ts +8 -0
  56. package/dist/composables/useCalendarGrid.d.ts +1 -1
  57. package/dist/composables/useExperimentSelector.d.ts +6 -2
  58. package/dist/composables/useFileImport.d.ts +7 -0
  59. package/dist/composables/useFloatingPanel.d.ts +29 -0
  60. package/dist/composables/useJobCenter.d.ts +41 -3
  61. package/dist/composables/useOnboarding.d.ts +119 -0
  62. package/dist/composables/usePlatform.d.ts +1 -0
  63. package/dist/{controlSchemaModel-CP5-_nAj.js → controlSchemaModel-Bsg0t5Ab.js} +2 -2
  64. package/dist/{controlSchemaModel-CP5-_nAj.js.map → controlSchemaModel-Bsg0t5Ab.js.map} +1 -1
  65. package/dist/{data-C2PwI_dn.js → data-Boeh4uPI.js} +180 -125
  66. package/dist/data-Boeh4uPI.js.map +1 -0
  67. package/dist/data.d.ts +1 -1
  68. package/dist/data.js +9 -9
  69. package/dist/{experiment-43OJtH7R.js → experiment-DyO54FQB.js} +25 -61
  70. package/dist/experiment-DyO54FQB.js.map +1 -0
  71. package/dist/{experimentStatus-BZmU4czV.js → experimentStatus-DCn2QKG7.js} +3 -3
  72. package/dist/{experimentStatus-BZmU4czV.js.map → experimentStatus-DCn2QKG7.js.map} +1 -1
  73. package/dist/index.js +20 -20
  74. package/dist/{install-DAID6c2-.js → install-BEHp7Mo-.js} +15 -14
  75. package/dist/{install-DAID6c2-.js.map → install-BEHp7Mo-.js.map} +1 -1
  76. package/dist/install.js +1 -1
  77. package/dist/{lab-DLwRl_Ql.js → lab-D61eaX6f.js} +136 -148
  78. package/dist/lab-D61eaX6f.js.map +1 -0
  79. package/dist/lab.js +4 -3
  80. package/dist/{records-BzTcxekG.js → records-D4aQXyZu.js} +647 -389
  81. package/dist/records-D4aQXyZu.js.map +1 -0
  82. package/dist/{runtime-D6gVat6r.js → runtime-q-R0CNLh.js} +417 -54
  83. package/dist/runtime-q-R0CNLh.js.map +1 -0
  84. package/dist/runtime.d.ts +1 -1
  85. package/dist/runtime.js +7 -7
  86. package/dist/{shell-5ju97nOS.js → shell-6CGFvUUw.js} +10 -5
  87. package/dist/{shell-5ju97nOS.js.map → shell-6CGFvUUw.js.map} +1 -1
  88. package/dist/shell.d.ts +1 -0
  89. package/dist/shell.js +6 -6
  90. package/dist/stores/index.d.ts +1 -1
  91. package/dist/stores/index.js +2 -2
  92. package/dist/stores/settings.d.ts +4 -12
  93. package/dist/styles.css +2753 -2101
  94. package/dist/types/componentWorkflowTypes.d.ts +2 -0
  95. package/dist/types/components.d.ts +2 -0
  96. package/dist/types/generated/platformContext.d.ts +1 -0
  97. package/dist/types/generated-ui.d.ts +4 -0
  98. package/dist/types/index.d.ts +1 -1
  99. package/dist/types/jobs.d.ts +9 -0
  100. package/dist/types/platform.d.ts +1 -1
  101. package/dist/{BaseModal-DfRIuVoj.js → useDropdownState-uFIz6Yv8.js} +75 -5
  102. package/dist/useDropdownState-uFIz6Yv8.js.map +1 -0
  103. package/dist/{useExperimentSamples-CxcnxZ8h.js → useExperimentSamples-QEFoq4tf.js} +48 -6
  104. package/dist/useExperimentSamples-QEFoq4tf.js.map +1 -0
  105. package/dist/{useListReorder-CcbEYxX-.js → useListReorder-DsuzwWGS.js} +219 -437
  106. package/dist/useListReorder-DsuzwWGS.js.map +1 -0
  107. package/dist/{useRackEditor-BD5NIo5s.js → useRackEditor-KpZ4iJ6o.js} +85 -81
  108. package/dist/useRackEditor-KpZ4iJ6o.js.map +1 -0
  109. package/dist/useRealtime-B58Lo-Tm.js +508 -0
  110. package/dist/useRealtime-B58Lo-Tm.js.map +1 -0
  111. package/dist/useRequest-BuDmW8Jc.js +215 -0
  112. package/dist/useRequest-BuDmW8Jc.js.map +1 -0
  113. package/dist/utils/time.d.ts +7 -0
  114. package/package.json +3 -2
  115. package/src/__stories__/experiment-helpers.ts +3 -3
  116. package/src/__tests__/components/ActionMenu.test.ts +2 -2
  117. package/src/__tests__/components/AppTopBar.test.ts +257 -3
  118. package/src/__tests__/components/AppTopBarOnboarding.test.ts +160 -0
  119. package/src/__tests__/components/AppTopBarPageSelector.test.ts +125 -9
  120. package/src/__tests__/components/AppTopBarPillNav.test.ts +35 -0
  121. package/src/__tests__/components/ArtifactSaveDialog.test.ts +78 -0
  122. package/src/__tests__/components/BaseButton.test.ts +19 -0
  123. package/src/__tests__/components/BaseModal.test.ts +13 -0
  124. package/src/__tests__/components/BaseSelect.multiple.test.ts +87 -32
  125. package/src/__tests__/components/BaseSelect.test.ts +2 -1
  126. package/src/__tests__/components/BatchProgressList.test.ts +16 -0
  127. package/src/__tests__/components/CalendarGridPanel.test.ts +2 -2
  128. package/src/__tests__/components/ChartContainer.test.ts +11 -0
  129. package/src/__tests__/components/ChemicalFormula.test.ts +6 -3
  130. package/src/__tests__/components/DatePicker.datetime.test.ts +6 -0
  131. package/src/__tests__/components/DatePicker.test.ts +21 -0
  132. package/src/__tests__/components/DatePicker.time.test.ts +2 -2
  133. package/src/__tests__/components/EmptyState.test.ts +1 -1
  134. package/src/__tests__/components/ExperimentPopover.test.ts +125 -16
  135. package/src/__tests__/components/ExperimentSelectorModal.test.ts +153 -14
  136. package/src/__tests__/components/FloatingPanelsInModal.test.ts +94 -0
  137. package/src/__tests__/components/GeneratedPluginView.test.ts +23 -2
  138. package/src/__tests__/components/InstrumentStateBadge.test.ts +4 -4
  139. package/src/__tests__/components/JobsStatusTray.test.ts +373 -71
  140. package/src/__tests__/components/PluginWorkspaceView.test.ts +63 -1
  141. package/src/__tests__/components/ResourcePickerListInternal.test.ts +0 -20
  142. package/src/__tests__/components/SampleSelector.test.ts +33 -8
  143. package/src/__tests__/components/SequenceProgressBar.test.ts +12 -0
  144. package/src/__tests__/components/SettingsModal.test.ts +9 -2
  145. package/src/__tests__/components/StepWizard.test.ts +11 -0
  146. package/src/__tests__/components/WellPlate.decoration.test.ts +11 -4
  147. package/src/__tests__/components/deprecationTags.test.ts +1 -1
  148. package/src/__tests__/composables/useAppExperiment.test.ts +27 -1
  149. package/src/__tests__/composables/useCalendarGrid.test.ts +4 -2
  150. package/src/__tests__/composables/useExperimentSelector.test.ts +111 -0
  151. package/src/__tests__/composables/useFileImport.test.ts +36 -0
  152. package/src/__tests__/composables/useFloatingPanel.test.ts +68 -0
  153. package/src/__tests__/composables/useJobCenter.test.ts +262 -3
  154. package/src/__tests__/composables/useOnboarding.test.ts +317 -0
  155. package/src/__tests__/docs/frontendDocsCatalog.test.ts +4 -3
  156. package/src/__tests__/fixtures/table-import/cells.xlsx +0 -0
  157. package/src/__tests__/fixtures/table-import/samples.xlsx +0 -0
  158. package/src/__tests__/stores/settings.test.ts +21 -21
  159. package/src/__tests__/styles/baseControlsRules.test.ts +6 -2
  160. package/src/__tests__/styles/controlRefreshRules.test.ts +0 -6
  161. package/src/__tests__/styles/cssTokens.test.ts +6 -3
  162. package/src/__tests__/styles/menusShellRefresh.test.ts +22 -12
  163. package/src/__tests__/styles/paletteTokens.test.ts +44 -0
  164. package/src/__tests__/styles/v2AuditRules.test.ts +104 -0
  165. package/src/__tests__/utils/plotlyTemplate.test.ts +4 -4
  166. package/src/__tests__/utils/time.test.ts +18 -1
  167. package/src/components/ActionMenu.vue +6 -37
  168. package/src/components/AdductText.story.vue +7 -0
  169. package/src/components/AdductText.vue +1 -1
  170. package/src/components/AlertBox.story.vue +2 -2
  171. package/src/components/AlertBox.vue +18 -16
  172. package/src/components/AppSidebar.story.vue +0 -28
  173. package/src/components/AppTopBar.onboarding.story.vue +69 -0
  174. package/src/components/AppTopBar.story.vue +105 -15
  175. package/src/components/AppTopBar.vue +248 -122
  176. package/src/components/ArtifactSaveDialog.story.vue +23 -0
  177. package/src/components/ArtifactSaveDialog.vue +102 -12
  178. package/src/components/AuditTrail.story.vue +2 -1
  179. package/src/components/AuditTrail.vue +2 -21
  180. package/src/components/Avatar.vue +10 -14
  181. package/src/components/BaseButton.vue +16 -2
  182. package/src/components/BaseModal.vue +2 -1
  183. package/src/components/BaseSelect.multiple.story.vue +13 -2
  184. package/src/components/BaseSelect.vue +4 -3
  185. package/src/components/BatchProgressList.vue +35 -25
  186. package/src/components/ChartContainer.story.vue +2 -1
  187. package/src/components/ChartContainer.vue +8 -6
  188. package/src/components/ConfirmDialog.story.vue +1 -1
  189. package/src/components/EmptyState.vue +1 -1
  190. package/src/components/ExperimentPopover.story.vue +165 -53
  191. package/src/components/ExperimentPopover.vue +169 -187
  192. package/src/components/ExperimentSelectorModal.story.vue +73 -31
  193. package/src/components/ExperimentSelectorModal.vue +144 -111
  194. package/src/components/FormField.story.vue +8 -48
  195. package/src/components/GeneratedPluginView.vue +11 -10
  196. package/src/components/GeneratedResultRenderer.vue +3 -4
  197. package/src/components/InstrumentStateBadge.vue +1 -1
  198. package/src/components/JobsStatusTray.story.vue +97 -43
  199. package/src/components/JobsStatusTray.vue +287 -290
  200. package/src/components/LayoutResizeHandle.story.vue +65 -4
  201. package/src/components/LoadingSpinner.vue +1 -1
  202. package/src/components/NumberInput.vue +3 -6
  203. package/src/components/PluginIcon.story.vue +2 -10
  204. package/src/components/PluginIcon.vue +2 -2
  205. package/src/components/PluginWorkspaceView.props.ts +3 -0
  206. package/src/components/PluginWorkspaceView.story.vue +1 -1
  207. package/src/components/PluginWorkspaceView.vue +17 -0
  208. package/src/components/RuntimeUpdateNotice.vue +1 -1
  209. package/src/components/SampleSelector.story.vue +22 -7
  210. package/src/components/SampleSelector.vue +34 -37
  211. package/src/components/SampleSelectorGroupNode.vue +1 -1
  212. package/src/components/SectionCard.story.vue +35 -2
  213. package/src/components/SequenceProgressBar.story.vue +9 -0
  214. package/src/components/SequenceProgressBar.vue +6 -1
  215. package/src/components/SettingsModal.schema.ts +1 -1
  216. package/src/components/SettingsModal.vue +9 -14
  217. package/src/components/SmartGroupFieldRecipe.story.vue +1 -1
  218. package/src/components/SmartGroupManual.story.vue +1 -1
  219. package/src/components/StepWizard.story.vue +33 -0
  220. package/src/components/StepWizard.vue +8 -1
  221. package/src/components/Tooltip.vue +9 -32
  222. package/src/components/WellPlate.story.vue +3 -1
  223. package/src/components/WellPlate.vue +7 -0
  224. package/src/components/internal/AppTopBarOnboardingInternal.vue +172 -0
  225. package/src/components/internal/AppTopBarPageSelectorInternal.vue +140 -72
  226. package/src/components/internal/AppTopBarPillNavInternal.vue +33 -2
  227. package/src/components/internal/DatePickerDateInternal.vue +23 -85
  228. package/src/components/internal/DatePickerDateTimeInternal.vue +10 -14
  229. package/src/components/internal/DatePickerTimeInternal.vue +13 -9
  230. package/src/components/internal/NumberUnitInputInternal.vue +4 -18
  231. package/src/components/internal/OnboardingLayerInternal.vue +173 -0
  232. package/src/components/internal/ResourcePickerListInternal.vue +45 -85
  233. package/src/components/internal/SelectMultipleInternal.vue +187 -65
  234. package/src/components/internal/SelectSearchableInternal.vue +8 -4
  235. package/src/components/internal/WellEditPopupInternal.vue +11 -22
  236. package/src/components/internal/WorkspaceShellInternal.vue +12 -0
  237. package/src/composables/createClient.ts +2 -0
  238. package/src/composables/index.ts +1 -0
  239. package/src/composables/pluginIdentity.ts +31 -0
  240. package/src/composables/pluginWorkspaceModel.ts +2 -2
  241. package/src/composables/useAppExperiment.ts +20 -0
  242. package/src/composables/useCalendarGrid.ts +4 -3
  243. package/src/composables/useExperimentSelector.ts +77 -31
  244. package/src/composables/useFileImport.ts +51 -1
  245. package/src/composables/useFloatingPanel.ts +107 -0
  246. package/src/composables/useJobCenter.ts +188 -6
  247. package/src/composables/useOnboarding.ts +465 -0
  248. package/src/composables/usePluginWorkspace.ts +1 -1
  249. package/src/data.ts +1 -0
  250. package/src/runtime.ts +2 -1
  251. package/src/shell.ts +17 -0
  252. package/src/stores/index.ts +0 -2
  253. package/src/stores/settings.ts +20 -50
  254. package/src/styles/components/action-menu.css +1 -1
  255. package/src/styles/components/adduct-text.css +13 -5
  256. package/src/styles/components/alert-box.css +39 -58
  257. package/src/styles/components/app-layout.css +10 -6
  258. package/src/styles/components/app-page-selector.css +121 -44
  259. package/src/styles/components/app-pill-nav.css +11 -12
  260. package/src/styles/components/app-sidebar.css +9 -18
  261. package/src/styles/components/app-top-bar.css +219 -55
  262. package/src/styles/components/artifact-save-dialog.css +153 -2
  263. package/src/styles/components/audit-trail.css +16 -19
  264. package/src/styles/components/avatar.css +6 -4
  265. package/src/styles/components/batch-progress-list.css +38 -36
  266. package/src/styles/components/button.css +36 -59
  267. package/src/styles/components/calendar.css +12 -12
  268. package/src/styles/components/chart-container.css +34 -23
  269. package/src/styles/components/checkbox.css +2 -12
  270. package/src/styles/components/collapsible-card.css +27 -29
  271. package/src/styles/components/confirm-dialog.css +13 -14
  272. package/src/styles/components/dataframe.css +13 -5
  273. package/src/styles/components/date-picker.css +84 -94
  274. package/src/styles/components/datetime-picker.css +35 -47
  275. package/src/styles/components/divider.css +20 -20
  276. package/src/styles/components/dose-calculator.css +3 -3
  277. package/src/styles/components/empty-state.css +20 -17
  278. package/src/styles/components/experiment-code-badge.css +2 -0
  279. package/src/styles/components/experiment-popover.css +174 -329
  280. package/src/styles/components/experiment-selector-modal.css +88 -56
  281. package/src/styles/components/file-picker.css +3 -3
  282. package/src/styles/components/file-uploader.css +38 -49
  283. package/src/styles/components/form-builder.css +3 -3
  284. package/src/styles/components/formula-input.css +1 -1
  285. package/src/styles/components/icon-button.css +18 -24
  286. package/src/styles/components/input.css +5 -4
  287. package/src/styles/components/instrument-monitor.css +13 -15
  288. package/src/styles/components/jobs-status-tray.css +140 -296
  289. package/src/styles/components/layout-resize-handle.css +59 -16
  290. package/src/styles/components/modal.css +5 -7
  291. package/src/styles/components/molecule-input.css +2 -2
  292. package/src/styles/components/multi-select.css +65 -117
  293. package/src/styles/components/number-input.css +26 -19
  294. package/src/styles/components/onboarding.css +368 -0
  295. package/src/styles/components/pill.css +3 -2
  296. package/src/styles/components/plate-editor.css +0 -1
  297. package/src/styles/components/plugin-icon.css +26 -23
  298. package/src/styles/components/popover.css +2 -2
  299. package/src/styles/components/presence-avatars.css +1 -1
  300. package/src/styles/components/progress-bar.css +3 -3
  301. package/src/styles/components/protocol-step-editor.css +1 -3
  302. package/src/styles/components/resource-card.css +2 -2
  303. package/src/styles/components/resource-picker-list.css +6 -57
  304. package/src/styles/components/sample-hierarchy-tree.css +4 -4
  305. package/src/styles/components/sample-selector.css +138 -79
  306. package/src/styles/components/schedule-calendar.css +8 -8
  307. package/src/styles/components/searchable-select.css +15 -19
  308. package/src/styles/components/section-card.css +54 -49
  309. package/src/styles/components/segmented-control.css +18 -15
  310. package/src/styles/components/select.css +3 -3
  311. package/src/styles/components/sequence-input.css +2 -2
  312. package/src/styles/components/sequence-progress-bar.css +17 -8
  313. package/src/styles/components/settings-modal.css +7 -2
  314. package/src/styles/components/smart-group.css +18 -18
  315. package/src/styles/components/step-wizard.css +52 -16
  316. package/src/styles/components/tabs.css +2 -2
  317. package/src/styles/components/textarea.css +3 -3
  318. package/src/styles/components/time-picker.css +37 -25
  319. package/src/styles/components/toast.css +13 -11
  320. package/src/styles/components/toggle.css +1 -11
  321. package/src/styles/components/tooltip.css +12 -11
  322. package/src/styles/components/unit-input.css +9 -8
  323. package/src/styles/components/well-edit-popup.css +2 -2
  324. package/src/styles/components/well-plate.css +9 -2
  325. package/src/styles/index.css +1 -0
  326. package/src/styles/variables.css +247 -78
  327. package/src/types/componentWorkflowTypes.ts +2 -0
  328. package/src/types/components.ts +2 -0
  329. package/src/types/generated/platformContext.ts +1 -0
  330. package/src/types/generated-ui.ts +4 -0
  331. package/src/types/index.ts +1 -0
  332. package/src/types/jobs.ts +10 -0
  333. package/src/types/platform.ts +1 -1
  334. package/src/utils/time.ts +21 -0
  335. package/dist/ActionMenu-CScINahU.js.map +0 -1
  336. package/dist/AppSidebar-BmiiPfz9.js.map +0 -1
  337. package/dist/BaseModal-DfRIuVoj.js.map +0 -1
  338. package/dist/ExperimentPopover-C4sGw-is.js +0 -359
  339. package/dist/ExperimentPopover-C4sGw-is.js.map +0 -1
  340. package/dist/ExperimentSelectorModal-D-9z7cNx.js.map +0 -1
  341. package/dist/SettingsModal-CSLE31yg.js.map +0 -1
  342. package/dist/data-C2PwI_dn.js.map +0 -1
  343. package/dist/experiment-43OJtH7R.js.map +0 -1
  344. package/dist/lab-DLwRl_Ql.js.map +0 -1
  345. package/dist/records-BzTcxekG.js.map +0 -1
  346. package/dist/runtime-D6gVat6r.js.map +0 -1
  347. package/dist/useExperimentSamples-CxcnxZ8h.js.map +0 -1
  348. package/dist/useListReorder-CcbEYxX-.js.map +0 -1
  349. package/dist/useRackEditor-BD5NIo5s.js.map +0 -1
  350. package/dist/useRealtime-PalKue84.js +0 -696
  351. package/dist/useRealtime-PalKue84.js.map +0 -1
  352. package/dist/useRequest-D5JDfsgZ.js +0 -76
  353. package/dist/useRequest-D5JDfsgZ.js.map +0 -1
@@ -1,696 +0,0 @@
1
- import { d as normalizeJobState, l as jobStatusLabel, s as isActiveJobStatus, u as normalizeJobPercent } from "./records-BzTcxekG.js";
2
- import { Fragment, Teleport, Transition, computed, createBlock, createCommentVNode, createElementBlock, createElementVNode, createTextVNode, createVNode, defineComponent, getCurrentScope, nextTick, normalizeClass, normalizeStyle, onMounted, onScopeDispose, onUnmounted, openBlock, readonly, ref, renderList, renderSlot, shallowRef, toDisplayString, toRef, toValue, unref, useId, watch, withCtx } from "vue";
3
- //#region src/composables/useJobCenter.ts
4
- /**
5
- * Combines independent job runtimes without copying their reactive state.
6
- *
7
- * Job ids must be globally unique across the sources. A duplicate id throws
8
- * when jobs are read or an id-routed action is requested, rather than silently
9
- * dispatching a mutation to the wrong owner.
10
- */
11
- function combinePluginJobSources(sources) {
12
- const jobs = computed(() => {
13
- const combined = [];
14
- const owners = /* @__PURE__ */ new Set();
15
- for (const source of sources) for (const job of toValue(source.jobs)) {
16
- if (owners.has(job.job_id)) throw duplicatePluginJobId(job.job_id);
17
- owners.add(job.job_id);
18
- combined.push(job);
19
- }
20
- return combined;
21
- });
22
- function ownerFor(jobId) {
23
- let owner;
24
- for (const source of sources) {
25
- if (!toValue(source.jobs).some((job) => job.job_id === jobId)) continue;
26
- if (owner) throw duplicatePluginJobId(jobId);
27
- owner = source;
28
- }
29
- if (!owner) throw new Error(`Unknown plugin job id: ${jobId}`);
30
- return owner;
31
- }
32
- const combined = { jobs };
33
- if (sources.some((source) => source.refresh)) combined.refresh = async () => {
34
- await Promise.all(sources.map((source) => source.refresh?.()));
35
- return jobs.value;
36
- };
37
- if (sources.some((source) => source.cancel)) combined.cancel = async (jobId) => {
38
- const owner = ownerFor(jobId);
39
- if (!owner.cancel) throw new Error(`Job ${jobId} cannot be cancelled by its source`);
40
- return owner.cancel(jobId);
41
- };
42
- if (sources.length > 0 && sources.every((source) => source.delete)) combined.delete = async (jobId) => {
43
- const owner = ownerFor(jobId);
44
- if (!owner.delete) throw new Error(`Job ${jobId} cannot be deleted by its source`);
45
- return owner.delete(jobId);
46
- };
47
- if (sources.length > 0 && sources.every((source) => source.clear)) combined.clear = async () => {
48
- const results = await Promise.all(sources.map((source) => source.clear()));
49
- return results.every((result) => typeof result === "number") ? results.reduce((total, result) => total + result, 0) : void 0;
50
- };
51
- if (sources.some((source) => source.dispose)) combined.dispose = () => {
52
- const errors = [];
53
- for (const source of sources) try {
54
- source.dispose?.();
55
- } catch (cause) {
56
- errors.push(cause);
57
- }
58
- if (errors.length === 1) throw errors[0];
59
- if (errors.length > 1) throw new PluginJobSourceDisposeError(errors);
60
- };
61
- return combined;
62
- }
63
- var PluginJobSourceDisposeError = class extends Error {
64
- cause;
65
- errors;
66
- constructor(errors) {
67
- super("Failed to dispose plugin job sources");
68
- this.name = "PluginJobSourceDisposeError";
69
- this.cause = errors[0];
70
- this.errors = Object.freeze([...errors]);
71
- }
72
- };
73
- function duplicatePluginJobId(jobId) {
74
- return /* @__PURE__ */ new Error(`Duplicate plugin job id across combined sources: ${jobId}`);
75
- }
76
- function errorMessage(error, fallback) {
77
- return error instanceof Error ? error.message : fallback;
78
- }
79
- /**
80
- * Headless controller for plugin job presentation and actions.
81
- *
82
- * Every job list is derived directly from the source. The controller never
83
- * mirrors source jobs into another ref.
84
- */
85
- function useJobCenter(options = {}) {
86
- const isOpen = ref(false);
87
- const activeTab = ref("active");
88
- const isLoading = ref(false);
89
- const error = shallowRef(null);
90
- const pendingJobIds = ref(/* @__PURE__ */ new Set());
91
- let requestGeneration = 0;
92
- let active = true;
93
- const source = computed(() => toValue(options.source));
94
- const jobs = computed(() => {
95
- const currentSource = source.value;
96
- return currentSource ? [...toValue(currentSource.jobs)].map(normalizeJobState) : [];
97
- });
98
- const activeJobs = computed(() => jobs.value.filter((job) => isActiveJobStatus(job.status)));
99
- const historyJobs = computed(() => jobs.value.filter((job) => !isActiveJobStatus(job.status)));
100
- const deletableJobs = computed(() => historyJobs.value.filter((job) => job.can_delete));
101
- const featuredJob = computed(() => activeJobs.value[0] ?? historyJobs.value[0] ?? null);
102
- const canRefresh = computed(() => Boolean(source.value?.refresh));
103
- const canCancel = computed(() => Boolean(source.value?.cancel));
104
- const canDelete = computed(() => Boolean(source.value?.delete));
105
- const canClearFinished = computed(() => Boolean(source.value?.clear || source.value?.delete));
106
- function setPending(jobId, pending) {
107
- const next = new Set(pendingJobIds.value);
108
- if (pending) next.add(jobId);
109
- else next.delete(jobId);
110
- pendingJobIds.value = next;
111
- }
112
- async function refresh() {
113
- const listJobs = source.value?.refresh;
114
- if (!listJobs) return false;
115
- const generation = ++requestGeneration;
116
- isLoading.value = true;
117
- error.value = null;
118
- try {
119
- await listJobs();
120
- return active && generation === requestGeneration;
121
- } catch (cause) {
122
- if (active && generation === requestGeneration) error.value = errorMessage(cause, "Failed to load jobs");
123
- return false;
124
- } finally {
125
- if (active && generation === requestGeneration) isLoading.value = false;
126
- }
127
- }
128
- async function cancelJob(job) {
129
- const sourceCancel = source.value?.cancel;
130
- if (!job.can_cancel || !sourceCancel || pendingJobIds.value.has(job.job_id)) return false;
131
- setPending(job.job_id, true);
132
- error.value = null;
133
- try {
134
- await sourceCancel(job.job_id);
135
- return active;
136
- } catch (cause) {
137
- if (active) error.value = errorMessage(cause, "Failed to cancel job");
138
- return false;
139
- } finally {
140
- if (active) setPending(job.job_id, false);
141
- }
142
- }
143
- async function deleteJob(job) {
144
- const sourceDelete = source.value?.delete;
145
- if (!job.can_delete || !sourceDelete || pendingJobIds.value.has(job.job_id)) return false;
146
- setPending(job.job_id, true);
147
- error.value = null;
148
- try {
149
- const deleted = await sourceDelete(job.job_id);
150
- return active && deleted !== false;
151
- } catch (cause) {
152
- if (active) error.value = errorMessage(cause, "Failed to delete job");
153
- return false;
154
- } finally {
155
- if (active) setPending(job.job_id, false);
156
- }
157
- }
158
- async function clearFinished() {
159
- const targets = deletableJobs.value;
160
- if (targets.length === 0) return false;
161
- error.value = null;
162
- try {
163
- const currentSource = source.value;
164
- if (currentSource?.clear) {
165
- const deleted = await currentSource.clear();
166
- if (!active) return false;
167
- return typeof deleted !== "number" || deleted === targets.length;
168
- }
169
- if (!currentSource?.delete) return false;
170
- return (await Promise.all(targets.map((job) => deleteJob(job)))).every(Boolean);
171
- } catch (cause) {
172
- if (active) error.value = errorMessage(cause, "Failed to clear jobs");
173
- return false;
174
- }
175
- }
176
- onMounted(() => {
177
- if (options.loadOnMount !== false) refresh();
178
- });
179
- onUnmounted(() => {
180
- active = false;
181
- requestGeneration += 1;
182
- });
183
- return {
184
- jobs,
185
- activeJobs,
186
- historyJobs,
187
- deletableJobs,
188
- featuredJob,
189
- canRefresh,
190
- canCancel,
191
- canDelete,
192
- canClearFinished,
193
- isOpen,
194
- activeTab,
195
- isLoading,
196
- error,
197
- pendingJobIds,
198
- open: () => {
199
- isOpen.value = true;
200
- },
201
- close: () => {
202
- isOpen.value = false;
203
- },
204
- toggle: () => {
205
- isOpen.value = !isOpen.value;
206
- },
207
- refresh,
208
- cancelJob,
209
- deleteJob,
210
- clearFinished,
211
- isPending: (job) => pendingJobIds.value.has(job.job_id)
212
- };
213
- }
214
- //#endregion
215
- //#region src/components/JobsStatusTray.vue?vue&type=script&setup=true&lang.ts
216
- var _hoisted_1 = { class: "mint-jobs-tray" };
217
- var _hoisted_2 = ["aria-expanded"];
218
- var _hoisted_3 = { class: "mint-jobs-tray__trigger-label" };
219
- var _hoisted_4 = {
220
- key: 0,
221
- class: "mint-jobs-tray__count",
222
- "aria-live": "polite"
223
- };
224
- var _hoisted_5 = { class: "mint-jobs-tray__header" };
225
- var _hoisted_6 = { class: "mint-jobs-tray__subtitle" };
226
- var _hoisted_7 = { class: "mint-jobs-tray__header-actions" };
227
- var _hoisted_8 = ["disabled"];
228
- var _hoisted_9 = {
229
- class: "mint-jobs-tray__tabs",
230
- role: "tablist",
231
- "aria-label": "Job groups"
232
- };
233
- var _hoisted_10 = ["aria-selected"];
234
- var _hoisted_11 = { class: "mint-jobs-tray__tab-count" };
235
- var _hoisted_12 = ["aria-selected"];
236
- var _hoisted_13 = { class: "mint-jobs-tray__tab-count" };
237
- var _hoisted_14 = {
238
- key: 0,
239
- class: "mint-jobs-tray__error",
240
- role: "alert"
241
- };
242
- var _hoisted_15 = { class: "mint-jobs-tray__body" };
243
- var _hoisted_16 = {
244
- key: 0,
245
- class: "mint-jobs-tray__empty"
246
- };
247
- var _hoisted_17 = { class: "mint-jobs-tray__job-heading" };
248
- var _hoisted_18 = { class: "mint-jobs-tray__job-identity" };
249
- var _hoisted_19 = ["onClick"];
250
- var _hoisted_20 = { class: "mint-jobs-tray__kind" };
251
- var _hoisted_21 = {
252
- key: 0,
253
- class: "mint-jobs-tray__percent"
254
- };
255
- var _hoisted_22 = ["aria-valuenow"];
256
- var _hoisted_23 = { class: "mint-jobs-tray__job-footer" };
257
- var _hoisted_24 = { class: "mint-jobs-tray__job-actions" };
258
- var _hoisted_25 = ["disabled", "onClick"];
259
- var _hoisted_26 = ["disabled", "onClick"];
260
- var _hoisted_27 = {
261
- key: 0,
262
- class: "mint-jobs-tray__clear-row"
263
- };
264
- var _hoisted_28 = {
265
- key: 1,
266
- class: "mint-jobs-tray__empty"
267
- };
268
- var _hoisted_29 = { class: "mint-jobs-tray__job-heading" };
269
- var _hoisted_30 = { class: "mint-jobs-tray__job-identity" };
270
- var _hoisted_31 = ["onClick"];
271
- var _hoisted_32 = { class: "mint-jobs-tray__kind" };
272
- var _hoisted_33 = { class: "mint-jobs-tray__job-footer" };
273
- var _hoisted_34 = { class: "mint-jobs-tray__job-actions" };
274
- var _hoisted_35 = ["disabled", "onClick"];
275
- //#endregion
276
- //#region src/components/JobsStatusTray.vue
277
- var JobsStatusTray_default = /* @__PURE__ */ defineComponent({
278
- __name: "JobsStatusTray",
279
- props: {
280
- source: {},
281
- loadOnMount: {
282
- type: Boolean,
283
- default: true
284
- },
285
- title: { default: "Analysis jobs" },
286
- teleportTo: {
287
- type: [String, Boolean],
288
- default: "body"
289
- }
290
- },
291
- emits: ["select", "error"],
292
- setup(__props, { emit: __emit }) {
293
- /**
294
- * Floating, source-driven job status tray for plugin and platform workflows.
295
- *
296
- * @example Recommended
297
- * ```vue
298
- * <JobsStatusTray :source="jobs" />
299
- * ```
300
- */
301
- const props = __props;
302
- const emit = __emit;
303
- const panelId = `mint-jobs-tray-${useId().replace(/:/g, "")}`;
304
- const titleId = `${panelId}-title`;
305
- const triggerRef = ref(null);
306
- const panelRef = ref(null);
307
- const teleportTarget = computed(() => props.teleportTo || "body");
308
- const tray = useJobCenter({
309
- source: toRef(props, "source"),
310
- loadOnMount: props.loadOnMount
311
- });
312
- const activeRows = computed(() => [...tray.activeJobs.value.filter((job) => job.status === "awaiting_input"), ...tray.activeJobs.value.filter((job) => job.status !== "awaiting_input")]);
313
- const subtitle = computed(() => {
314
- const count = (status) => tray.activeJobs.value.filter((job) => job.status === status).length;
315
- const parts = [
316
- [count("running"), "running"],
317
- [count("queued"), "queued"],
318
- [count("awaiting_input"), "waiting"]
319
- ].filter(([n]) => n).map(([n, word]) => `${n} ${word}`);
320
- return parts.length ? parts.join(" · ") : `${tray.jobs.value.length} total`;
321
- });
322
- const canClear = computed(() => tray.deletableJobs.value.length > 0 && tray.canClearFinished.value);
323
- async function openTray() {
324
- tray.open();
325
- await nextTick();
326
- panelRef.value?.focus();
327
- }
328
- async function closeTray() {
329
- tray.close();
330
- await nextTick();
331
- triggerRef.value?.focus();
332
- }
333
- async function toggleTray() {
334
- if (tray.isOpen.value) await closeTray();
335
- else await openTray();
336
- }
337
- function onPanelKeydown(event) {
338
- if (event.key === "Escape") {
339
- closeTray();
340
- return;
341
- }
342
- if (event.key !== "Tab" || !panelRef.value) return;
343
- const focusable = Array.from(panelRef.value.querySelectorAll("button:not([disabled]), [href], input:not([disabled]), select:not([disabled]), textarea:not([disabled]), [tabindex]:not([tabindex=\"-1\"])"));
344
- if (focusable.length === 0) {
345
- event.preventDefault();
346
- panelRef.value.focus();
347
- return;
348
- }
349
- const first = focusable[0];
350
- const last = focusable[focusable.length - 1];
351
- const activeElement = document.activeElement;
352
- if (!activeElement || !focusable.includes(activeElement)) {
353
- event.preventDefault();
354
- if (event.shiftKey) last?.focus();
355
- else first?.focus();
356
- } else if (event.shiftKey && activeElement === first) {
357
- event.preventDefault();
358
- last?.focus();
359
- } else if (!event.shiftKey && activeElement === last) {
360
- event.preventDefault();
361
- first?.focus();
362
- }
363
- }
364
- function progressText(job) {
365
- if (job.status === "awaiting_input") return job.progress.message || "Waiting for external input";
366
- if (job.status === "queued" && job.queue_position > 0) return `Queue position ${job.queue_position}`;
367
- return job.progress.message || job.progress.stage || jobStatusLabel(job.status);
368
- }
369
- function formatTimestamp(value) {
370
- if (!value) return "";
371
- const date = new Date(value);
372
- return Number.isNaN(date.getTime()) ? "" : new Intl.DateTimeFormat(void 0, {
373
- dateStyle: "medium",
374
- timeStyle: "short"
375
- }).format(date);
376
- }
377
- function statusClass(job) {
378
- return `mint-jobs-tray__status--${job.status.replace("_", "-")}`;
379
- }
380
- function jobPercent(job) {
381
- return Math.round(normalizeJobPercent(job.progress.percent));
382
- }
383
- async function cancelJob(job) {
384
- if (!await tray.cancelJob(job) && tray.error.value) emit("error", tray.error.value);
385
- }
386
- async function deleteJob(job) {
387
- if (!await tray.deleteJob(job) && tray.error.value) emit("error", tray.error.value);
388
- }
389
- async function clearFinished() {
390
- if (!await tray.clearFinished() && tray.error.value) emit("error", tray.error.value);
391
- }
392
- return (_ctx, _cache) => {
393
- return openBlock(), createBlock(Teleport, {
394
- to: teleportTarget.value,
395
- disabled: __props.teleportTo === false
396
- }, [createElementVNode("div", _hoisted_1, [
397
- createElementVNode("button", {
398
- ref_key: "triggerRef",
399
- ref: triggerRef,
400
- type: "button",
401
- class: "mint-jobs-tray__trigger",
402
- "aria-haspopup": "dialog",
403
- "aria-expanded": unref(tray).isOpen.value,
404
- "aria-controls": panelId,
405
- onClick: toggleTray
406
- }, [
407
- (openBlock(), createElementBlock("svg", {
408
- class: normalizeClass(["mint-jobs-tray__trigger-icon", { "mint-jobs-tray__trigger-icon--active": unref(tray).activeJobs.value.length > 0 }]),
409
- viewBox: "0 0 24 24",
410
- fill: "none",
411
- stroke: "currentColor",
412
- "aria-hidden": "true"
413
- }, [..._cache[3] || (_cache[3] = [createElementVNode("path", { d: "M9 5H7a2 2 0 0 0-2 2v12a2 2 0 0 0 2 2h10a2 2 0 0 0 2-2V7a2 2 0 0 0-2-2h-2" }, null, -1), createElementVNode("path", { d: "M9 5a3 3 0 0 1 6 0v2H9V5Z" }, null, -1)])], 2)),
414
- createElementVNode("span", _hoisted_3, toDisplayString(unref(tray).featuredJob.value ? unref(jobStatusLabel)(unref(tray).featuredJob.value.status) : "Jobs"), 1),
415
- unref(tray).activeJobs.value.length > 0 ? (openBlock(), createElementBlock("span", _hoisted_4, toDisplayString(unref(tray).activeJobs.value.length), 1)) : createCommentVNode("", true)
416
- ], 8, _hoisted_2),
417
- createVNode(Transition, { name: "mint-jobs-tray-fade" }, {
418
- default: withCtx(() => [unref(tray).isOpen.value ? (openBlock(), createElementBlock("div", {
419
- key: 0,
420
- class: "mint-jobs-tray__backdrop",
421
- "aria-hidden": "true",
422
- onClick: closeTray
423
- })) : createCommentVNode("", true)]),
424
- _: 1
425
- }),
426
- createVNode(Transition, { name: "mint-jobs-tray-slide" }, {
427
- default: withCtx(() => [unref(tray).isOpen.value ? (openBlock(), createElementBlock("section", {
428
- key: 0,
429
- id: panelId,
430
- ref_key: "panelRef",
431
- ref: panelRef,
432
- class: "mint-jobs-tray__panel",
433
- role: "dialog",
434
- "aria-modal": "true",
435
- "aria-labelledby": titleId,
436
- tabindex: "-1",
437
- onKeydown: onPanelKeydown
438
- }, [
439
- createElementVNode("header", _hoisted_5, [createElementVNode("div", null, [createElementVNode("h2", {
440
- id: titleId,
441
- class: "mint-jobs-tray__title"
442
- }, toDisplayString(__props.title), 1), createElementVNode("p", _hoisted_6, toDisplayString(subtitle.value), 1)]), createElementVNode("div", _hoisted_7, [unref(tray).canRefresh.value ? (openBlock(), createElementBlock("button", {
443
- key: 0,
444
- type: "button",
445
- class: "mint-jobs-tray__icon-button",
446
- "aria-label": "Refresh jobs",
447
- disabled: unref(tray).isLoading.value,
448
- onClick: _cache[0] || (_cache[0] = (...args) => unref(tray).refresh && unref(tray).refresh(...args))
449
- }, [..._cache[4] || (_cache[4] = [createElementVNode("svg", {
450
- viewBox: "0 0 24 24",
451
- fill: "none",
452
- stroke: "currentColor",
453
- "aria-hidden": "true"
454
- }, [createElementVNode("path", { d: "M20 6v5h-5M4 18v-5h5" }), createElementVNode("path", { d: "M18.4 9A7 7 0 0 0 6.1 6.1L4 8m2 7a7 7 0 0 0 11.9 2.9L20 16" })], -1)])], 8, _hoisted_8)) : createCommentVNode("", true), createElementVNode("button", {
455
- type: "button",
456
- class: "mint-jobs-tray__icon-button",
457
- "aria-label": "Close jobs",
458
- onClick: closeTray
459
- }, [..._cache[5] || (_cache[5] = [createElementVNode("svg", {
460
- viewBox: "0 0 24 24",
461
- fill: "none",
462
- stroke: "currentColor",
463
- "aria-hidden": "true"
464
- }, [createElementVNode("path", { d: "m6 6 12 12M18 6 6 18" })], -1)])])])]),
465
- createElementVNode("div", _hoisted_9, [createElementVNode("button", {
466
- type: "button",
467
- role: "tab",
468
- "data-tab": "active",
469
- class: normalizeClass(["mint-jobs-tray__tab", { "mint-jobs-tray__tab--active": unref(tray).activeTab.value === "active" }]),
470
- "aria-selected": unref(tray).activeTab.value === "active",
471
- onClick: _cache[1] || (_cache[1] = ($event) => unref(tray).activeTab.value = "active")
472
- }, [_cache[6] || (_cache[6] = createTextVNode(" Active ", -1)), createElementVNode("span", _hoisted_11, toDisplayString(unref(tray).activeJobs.value.length), 1)], 10, _hoisted_10), createElementVNode("button", {
473
- type: "button",
474
- role: "tab",
475
- "data-tab": "history",
476
- class: normalizeClass(["mint-jobs-tray__tab", { "mint-jobs-tray__tab--active": unref(tray).activeTab.value === "history" }]),
477
- "aria-selected": unref(tray).activeTab.value === "history",
478
- onClick: _cache[2] || (_cache[2] = ($event) => unref(tray).activeTab.value = "history")
479
- }, [_cache[7] || (_cache[7] = createTextVNode(" History ", -1)), createElementVNode("span", _hoisted_13, toDisplayString(unref(tray).historyJobs.value.length), 1)], 10, _hoisted_12)]),
480
- unref(tray).error.value ? (openBlock(), createElementBlock("p", _hoisted_14, toDisplayString(unref(tray).error.value), 1)) : createCommentVNode("", true),
481
- createElementVNode("div", _hoisted_15, [unref(tray).activeTab.value === "active" ? (openBlock(), createElementBlock(Fragment, { key: 0 }, [unref(tray).activeJobs.value.length === 0 ? (openBlock(), createElementBlock("p", _hoisted_16, " No active jobs ")) : createCommentVNode("", true), (openBlock(true), createElementBlock(Fragment, null, renderList(activeRows.value, (job) => {
482
- return openBlock(), createElementBlock("article", {
483
- key: job.job_id,
484
- class: normalizeClass(["mint-jobs-tray__job", { "mint-jobs-tray__job--awaiting-input": job.status === "awaiting_input" }])
485
- }, [
486
- createElementVNode("div", _hoisted_17, [
487
- createElementVNode("div", _hoisted_18, [createElementVNode("button", {
488
- type: "button",
489
- class: "mint-jobs-tray__job-select",
490
- onClick: ($event) => emit("select", job)
491
- }, toDisplayString(job.name), 9, _hoisted_19), createElementVNode("span", _hoisted_20, toDisplayString(job.kind), 1)]),
492
- createElementVNode("span", { class: normalizeClass(["mint-jobs-tray__status", statusClass(job)]) }, [_cache[8] || (_cache[8] = createElementVNode("span", {
493
- class: "mint-jobs-tray__status-dot",
494
- "aria-hidden": "true"
495
- }, null, -1)), createTextVNode(" " + toDisplayString(unref(jobStatusLabel)(job.status)), 1)], 2),
496
- job.status === "running" ? (openBlock(), createElementBlock("span", _hoisted_21, toDisplayString(jobPercent(job)) + "%", 1)) : createCommentVNode("", true)
497
- ]),
498
- job.status === "running" ? (openBlock(), createElementBlock("div", {
499
- key: 0,
500
- class: "mint-jobs-tray__progress",
501
- role: "progressbar",
502
- "aria-label": "Job progress",
503
- "aria-valuemin": "0",
504
- "aria-valuemax": "100",
505
- "aria-valuenow": jobPercent(job)
506
- }, [createElementVNode("span", { style: normalizeStyle({ width: `${jobPercent(job)}%` }) }, null, 4)], 8, _hoisted_22)) : createCommentVNode("", true),
507
- createElementVNode("div", _hoisted_23, [createElementVNode("span", null, toDisplayString(progressText(job)), 1), createElementVNode("div", _hoisted_24, [
508
- renderSlot(_ctx.$slots, "job-actions", { job }),
509
- job.can_cancel && unref(tray).canCancel.value ? (openBlock(), createElementBlock("button", {
510
- key: 0,
511
- type: "button",
512
- class: "mint-jobs-tray__action mint-jobs-tray__action--danger",
513
- "aria-label": "Cancel job",
514
- disabled: unref(tray).isPending(job),
515
- onClick: ($event) => cancelJob(job)
516
- }, " Cancel ", 8, _hoisted_25)) : createCommentVNode("", true),
517
- job.can_delete && unref(tray).canDelete.value ? (openBlock(), createElementBlock("button", {
518
- key: 1,
519
- type: "button",
520
- class: "mint-jobs-tray__icon-button mint-jobs-tray__icon-button--danger",
521
- "aria-label": "Delete job",
522
- disabled: unref(tray).isPending(job),
523
- onClick: ($event) => deleteJob(job)
524
- }, [..._cache[9] || (_cache[9] = [createElementVNode("svg", {
525
- viewBox: "0 0 24 24",
526
- fill: "none",
527
- stroke: "currentColor",
528
- "aria-hidden": "true"
529
- }, [createElementVNode("path", { d: "M4 7h16M9 7V4h6v3m-8 0 1 13h8l1-13M10 11v5M14 11v5" })], -1)])], 8, _hoisted_26)) : createCommentVNode("", true)
530
- ])])
531
- ], 2);
532
- }), 128))], 64)) : (openBlock(), createElementBlock(Fragment, { key: 1 }, [
533
- canClear.value ? (openBlock(), createElementBlock("div", _hoisted_27, [createElementVNode("button", {
534
- type: "button",
535
- class: "mint-jobs-tray__action mint-jobs-tray__action--danger",
536
- onClick: clearFinished
537
- }, " Clear finished ")])) : createCommentVNode("", true),
538
- unref(tray).historyJobs.value.length === 0 ? (openBlock(), createElementBlock("p", _hoisted_28, " No job history ")) : createCommentVNode("", true),
539
- (openBlock(true), createElementBlock(Fragment, null, renderList(unref(tray).historyJobs.value, (job) => {
540
- return openBlock(), createElementBlock("article", {
541
- key: job.job_id,
542
- class: "mint-jobs-tray__job"
543
- }, [createElementVNode("div", _hoisted_29, [createElementVNode("div", _hoisted_30, [createElementVNode("button", {
544
- type: "button",
545
- class: "mint-jobs-tray__job-select",
546
- onClick: ($event) => emit("select", job)
547
- }, toDisplayString(job.name), 9, _hoisted_31), createElementVNode("span", _hoisted_32, toDisplayString(job.kind), 1)]), createElementVNode("span", { class: normalizeClass(["mint-jobs-tray__status", statusClass(job)]) }, [_cache[10] || (_cache[10] = createElementVNode("span", {
548
- class: "mint-jobs-tray__status-dot",
549
- "aria-hidden": "true"
550
- }, null, -1)), createTextVNode(" " + toDisplayString(unref(jobStatusLabel)(job.status)), 1)], 2)]), createElementVNode("div", _hoisted_33, [createElementVNode("span", null, toDisplayString(formatTimestamp(job.completed_at || job.created_at)), 1), createElementVNode("div", _hoisted_34, [renderSlot(_ctx.$slots, "job-actions", { job }), job.can_delete && unref(tray).canDelete.value ? (openBlock(), createElementBlock("button", {
551
- key: 0,
552
- type: "button",
553
- class: "mint-jobs-tray__icon-button mint-jobs-tray__icon-button--danger",
554
- "aria-label": "Delete job",
555
- disabled: unref(tray).isPending(job),
556
- onClick: ($event) => deleteJob(job)
557
- }, [..._cache[11] || (_cache[11] = [createElementVNode("svg", {
558
- viewBox: "0 0 24 24",
559
- fill: "none",
560
- stroke: "currentColor",
561
- "aria-hidden": "true"
562
- }, [createElementVNode("path", { d: "M4 7h16M9 7V4h6v3m-8 0 1 13h8l1-13M10 11v5M14 11v5" })], -1)])], 8, _hoisted_35)) : createCommentVNode("", true)])])]);
563
- }), 128))
564
- ], 64))])
565
- ], 544)) : createCommentVNode("", true)]),
566
- _: 3
567
- })
568
- ])], 8, ["to", "disabled"]);
569
- };
570
- }
571
- });
572
- //#endregion
573
- //#region src/composables/useRealtime.ts
574
- var EVENTS_URL = "/api/events";
575
- var RECONNECT_BASE_MS = 1e3;
576
- var RECONNECT_MAX_MS = 3e4;
577
- /** Merges the subscriptions of components that mount together into one connection. */
578
- var TOPIC_DEBOUNCE_MS = 50;
579
- var RESYNC = { type: "resync" };
580
- var listeners = /* @__PURE__ */ new Set();
581
- /** The last `presence.changed` of each topic of the open stream; the server sends one per topic at open. */
582
- var presence = /* @__PURE__ */ new Map();
583
- var connected = ref(false);
584
- var source = null;
585
- var sourceTopics = "";
586
- var failures = 0;
587
- var syncTimer = null;
588
- var retryTimer = null;
589
- function dispatch(event) {
590
- const isPresence = event.type === "presence.changed";
591
- if (isPresence && event.topic) presence.set(event.topic, event);
592
- for (const listener of [...listeners]) {
593
- if (isPresence && !listener.presence) continue;
594
- if (event.type === "resync" || event.topic && listener.topics().includes(event.topic)) listener.handler(event);
595
- }
596
- }
597
- function close() {
598
- source?.close();
599
- source = null;
600
- sourceTopics = "";
601
- presence.clear();
602
- connected.value = false;
603
- }
604
- function open(topics) {
605
- const stream = new EventSource(`${EVENTS_URL}?topics=${encodeURIComponent(topics)}`);
606
- source = stream;
607
- sourceTopics = topics;
608
- stream.onopen = () => {
609
- connected.value = true;
610
- dispatch(RESYNC);
611
- failures = 0;
612
- };
613
- stream.onmessage = (message) => {
614
- dispatch(JSON.parse(message.data));
615
- };
616
- stream.onerror = () => {
617
- if (source !== stream) return;
618
- close();
619
- if (syncTimer !== null) clearTimeout(syncTimer);
620
- syncTimer = null;
621
- retryTimer = setTimeout(() => {
622
- retryTimer = null;
623
- sync();
624
- }, Math.min(RECONNECT_MAX_MS, RECONNECT_BASE_MS * 2 ** failures));
625
- failures += 1;
626
- };
627
- }
628
- function sync() {
629
- syncTimer = null;
630
- const topics = [...new Set([...listeners].flatMap((listener) => listener.topics()))].sort().join(",");
631
- if (source && topics === sourceTopics) return;
632
- close();
633
- if (topics) open(topics);
634
- }
635
- function schedule() {
636
- if (retryTimer !== null) return;
637
- if (syncTimer !== null) clearTimeout(syncTimer);
638
- syncTimer = setTimeout(sync, TOPIC_DEBOUNCE_MS);
639
- }
640
- /**
641
- * Subscribe to topics of the platform's realtime stream.
642
- *
643
- * Every caller in a tab shares one `EventSource`, opened on the union of
644
- * their topics and reopened when that union changes. `handler` receives the
645
- * write events of the caller's own topics (not `presence.changed`, which goes
646
- * to `usePresence`) plus every `resync`: one comes from the
647
- * server when this tab fell behind, and one follows each open of the stream:
648
- * the first open, each reconnect (backoff from 1 s to 30 s) and each reopen for
649
- * a changed topic union. On `resync`, refetch. The union of all callers' topics
650
- * in a tab may hold at most 50 topics; the platform refuses a larger stream.
651
- *
652
- * The stream authenticates with the session cookie, so it works in the
653
- * platform and in plugin frontends served by it. It exists only when the
654
- * platform's `realtime` feature flag is on; check that flag first.
655
- *
656
- * A plugin topic reaches a caller whose role may use the plugin; an
657
- * experiment plugin topic also needs a caller who may view the experiment.
658
- *
659
- * @example
660
- * useRealtime(() => [`experiment:${id.value}`], () => refetch())
661
- * @example
662
- * useRealtime(['plugin:drp'], (event) => {
663
- * if (event.type === 'drp.run.progress') progress.value = event.payload as RunProgress
664
- * })
665
- */
666
- function useRealtime(topics, handler) {
667
- return subscribeRealtime(topics, handler, false);
668
- }
669
- /** The last `presence.changed` of `topic` while the open stream views it (for `usePresence`). */
670
- function currentPresence(topic) {
671
- return presence.get(topic);
672
- }
673
- /** `useRealtime`, and with `withPresence` also the `presence.changed` events (for `usePresence`). */
674
- function subscribeRealtime(topics, handler, withPresence) {
675
- const listener = {
676
- topics: () => toValue(topics),
677
- handler,
678
- presence: withPresence
679
- };
680
- listeners.add(listener);
681
- const stopWatch = watch(() => listener.topics().join(","), () => schedule());
682
- schedule();
683
- function stop() {
684
- stopWatch();
685
- if (listeners.delete(listener)) schedule();
686
- }
687
- if (getCurrentScope()) onScopeDispose(stop);
688
- return {
689
- connected: readonly(connected),
690
- stop
691
- };
692
- }
693
- //#endregion
694
- export { combinePluginJobSources as a, JobsStatusTray_default as i, subscribeRealtime as n, useJobCenter as o, useRealtime as r, currentPresence as t };
695
-
696
- //# sourceMappingURL=useRealtime-PalKue84.js.map