@loopstack/loopstack-studio 0.21.2 → 0.22.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 (89) hide show
  1. package/dist/api/auth.js +10 -0
  2. package/dist/api/client.js +13 -0
  3. package/dist/api/config.js +10 -0
  4. package/dist/api/dashboard.js +4 -0
  5. package/dist/api/documents.js +7 -0
  6. package/dist/api/index.js +24 -0
  7. package/dist/api/namespaces.js +7 -0
  8. package/dist/api/pipelines.js +13 -0
  9. package/dist/api/processor.js +4 -0
  10. package/dist/api/workflows.js +8 -0
  11. package/dist/api/workspaces.js +12 -0
  12. package/dist/app/EnvironmentEmbedRoot.js +33 -0
  13. package/dist/components/data-table/DataTableFilters.js +74 -63
  14. package/dist/components/layout/MainLayout.js +7 -4
  15. package/dist/components/page/PageBreadcrumbs.js +1 -1
  16. package/dist/components/ui/input.js +1 -1
  17. package/dist/components/ui/select.js +1 -1
  18. package/dist/components/ui/sidebar.js +359 -359
  19. package/dist/components/ui/textarea.js +1 -1
  20. package/dist/components/ui-widgets/UiActions.js +22 -15
  21. package/dist/components/ui-widgets/UiWidget.js +31 -26
  22. package/dist/components/ui-widgets/widgets/AiPromptInput.js +27 -27
  23. package/dist/components/ui-widgets/widgets/ButtonFullWidth.js +12 -12
  24. package/dist/components/ui-widgets/widgets/SandboxRun.js +32 -0
  25. package/dist/components/ui-widgets/widgets/SubmitButton.js +11 -11
  26. package/dist/features/code-explorer/utils/fileIcons.js +4 -7
  27. package/dist/features/oauth/OAuthPromptRenderer.js +1 -1
  28. package/dist/features/runs/Runs.js +197 -0
  29. package/dist/features/workbench/NavigationItems.js +1 -1
  30. package/dist/features/workbench/Workbench.js +109 -75
  31. package/dist/features/workbench/WorkflowItem.js +8 -11
  32. package/dist/features/workbench/WorkflowList.js +29 -20
  33. package/dist/features/workbench/components/DocumentList.js +20 -20
  34. package/dist/features/workbench/components/NewRunDialog.js +328 -0
  35. package/dist/features/workbench/components/WorkbenchFloatingPanel.js +88 -0
  36. package/dist/features/workbench/components/WorkbenchFlowPanel.js +48 -0
  37. package/dist/features/workbench/components/WorkbenchIconSidebar.js +68 -0
  38. package/dist/features/workbench/components/WorkbenchPreviewPanel.js +128 -0
  39. package/dist/features/workbench/components/WorkflowForms.js +7 -6
  40. package/dist/features/workbench/components/WorkflowHistoryItem.js +68 -63
  41. package/dist/features/workbench/components/buttons/WorkflowButtons.js +79 -61
  42. package/dist/features/workbench/components/document-renderer/DocumentFormRenderer.js +6 -5
  43. package/dist/features/workbench/providers/WorkbenchLayoutProvider.js +77 -0
  44. package/dist/features/workspaces/Workspaces.js +2 -2
  45. package/dist/features/workspaces/components/CreateWorkspace.js +164 -81
  46. package/dist/features/workspaces/components/EnvironmentSlotSelector.js +63 -0
  47. package/dist/features/workspaces/components/ExecutionTimeline.js +69 -68
  48. package/dist/features/workspaces/components/PipelineForm.js +4 -4
  49. package/dist/hooks/index.js +2 -0
  50. package/dist/hooks/useApi.js +9 -33
  51. package/dist/hooks/useAuth.js +18 -38
  52. package/dist/hooks/useConfig.js +31 -33
  53. package/dist/hooks/useDashboard.js +1 -4
  54. package/dist/hooks/useDocuments.js +4 -8
  55. package/dist/hooks/useFiles.js +31 -41
  56. package/dist/hooks/useNamespaces.js +5 -8
  57. package/dist/hooks/usePipelines.js +98 -108
  58. package/dist/hooks/useProcessor.js +1 -4
  59. package/dist/hooks/useWorkflows.js +25 -41
  60. package/dist/hooks/useWorkspaces.js +45 -72
  61. package/dist/index.d.ts +266 -48
  62. package/dist/index.js +10 -2
  63. package/dist/packages/contracts/dist/enums/index.js +25 -0
  64. package/dist/packages/contracts/dist/enums/pipeline-state.js +10 -0
  65. package/dist/packages/contracts/dist/enums/registry.enum.js +20 -0
  66. package/dist/packages/contracts/dist/enums/sort-order.enum.js +10 -0
  67. package/dist/packages/contracts/dist/enums/user-type.enum.js +10 -0
  68. package/dist/packages/contracts/dist/enums/workflow-state.enum.js +10 -0
  69. package/dist/pages/DebugPage.js +12 -14
  70. package/dist/pages/DebugWorkflowDetailsPage.js +1 -1
  71. package/dist/pages/DebugWorkflowsPage.js +3 -4
  72. package/dist/pages/EmbedWorkbenchPage.js +4 -3
  73. package/dist/pages/PipelineDebugPage.js +2 -2
  74. package/dist/pages/PreviewWorkbenchPage.js +416 -0
  75. package/dist/pages/RunsListPage.js +36 -0
  76. package/dist/pages/RunsPage.js +49 -0
  77. package/dist/pages/StudioLandingPage.js +145 -0
  78. package/dist/pages/WorkbenchPage.js +75 -51
  79. package/dist/providers/InvalidationEventsProvider.js +7 -7
  80. package/dist/providers/QueryProvider.js +21 -0
  81. package/dist/routing/LocalRouter.js +9 -0
  82. package/dist/services/createApiClient.js +4 -10
  83. package/dist/services/index.js +1 -1
  84. package/package.json +2 -3
  85. package/dist/features/code-explorer/CodeExplorer.js +0 -69
  86. package/dist/features/code-explorer/components/CodeExplorerTree.js +0 -43
  87. package/dist/features/code-explorer/components/CodeExplorerTreeNode.js +0 -82
  88. package/dist/features/workbench/components/WorkbenchSidebar.js +0 -109
  89. package/dist/features/workbench/providers/WorkbenchContextProvider.js +0 -3
@@ -1,101 +1,135 @@
1
1
  import { useWorkspace } from "../../hooks/useWorkspaces.js";
2
- import { SidebarInsetDiv, SidebarProvider, SidebarTrigger } from "../../components/ui/sidebar.js";
2
+ import PageBreadcrumbs_default from "../../components/page/PageBreadcrumbs.js";
3
3
  import { FileContentViewer } from "../code-explorer/components/FileContentViewer.js";
4
4
  import { CodeExplorerProvider, useCodeExplorerContext } from "../code-explorer/providers/CodeExplorerProvider.js";
5
5
  import { FileTabsBar } from "../code-explorer/components/FileTabsBar.js";
6
- import { useNamespaceTree } from "../../hooks/useNamespaceTree.js";
7
- import { WorkbenchContextProvider } from "./providers/WorkbenchContextProvider.js";
6
+ import { WorkbenchContextProvider, WorkbenchLayoutProvider, useWorkbenchLayout } from "./providers/WorkbenchLayoutProvider.js";
8
7
  import WorkflowList_default from "./WorkflowList.js";
9
8
  import { ScrollProvider } from "./providers/ScrollProvider.js";
10
- import WorkbenchSidebar_default from "./components/WorkbenchSidebar.js";
9
+ import { WorkbenchFloatingPanel } from "./components/WorkbenchFloatingPanel.js";
10
+ import { WorkbenchFlowPanel } from "./components/WorkbenchFlowPanel.js";
11
+ import { WorkbenchIconSidebar } from "./components/WorkbenchIconSidebar.js";
12
+ import { WorkbenchPreviewPanel } from "./components/WorkbenchPreviewPanel.js";
11
13
  import { c } from "react/compiler-runtime";
12
- import { useCallback, useMemo, useState } from "react";
14
+ import { useMemo } from "react";
13
15
  import { jsx, jsxs } from "react/jsx-runtime";
14
16
  function WorkbenchContent(e) {
15
- let a = c(11), { pipeline: o } = e, { openFiles: s, selectedFile: u, fileContent: p, workflowConfig: m, isContentLoading: _ } = useCodeExplorerContext(), v;
16
- a[0] === o ? v = a[1] : (v = /* @__PURE__ */ jsx("div", {
17
- className: "flex-1 overflow-hidden",
18
- children: /* @__PURE__ */ jsx(ScrollProvider, { children: /* @__PURE__ */ jsx("div", {
19
- className: "flex h-full flex-col",
20
- children: /* @__PURE__ */ jsx("div", {
21
- className: "flex-1 overflow-hidden",
22
- children: /* @__PURE__ */ jsx(WorkflowList_default, { pipeline: o })
23
- })
24
- }) })
25
- }), a[0] = o, a[1] = v);
26
- let y;
27
- a[2] !== p || a[3] !== _ || a[4] !== s.length || a[5] !== u || a[6] !== m ? (y = s.length > 0 && /* @__PURE__ */ jsxs("div", {
17
+ let a = c(16), { pipeline: l, breadcrumbData: u } = e, { openFiles: d, selectedFile: m, fileContent: h, workflowConfig: g, isContentLoading: _ } = useCodeExplorerContext(), v;
18
+ a[0] === u ? v = a[1] : (v = /* @__PURE__ */ jsx("div", {
19
+ className: "border-b flex h-12 shrink-0 items-center",
20
+ children: u ? /* @__PURE__ */ jsx(PageBreadcrumbs_default, { breadcrumbData: u }) : /* @__PURE__ */ jsx("span", {
21
+ className: "px-3 text-sm font-medium",
22
+ children: "Workflows"
23
+ })
24
+ }), a[0] = u, a[1] = v);
25
+ let b;
26
+ a[2] === l ? b = a[3] : (b = /* @__PURE__ */ jsx(ScrollProvider, { children: /* @__PURE__ */ jsx("div", {
27
+ className: "flex-1 overflow-auto",
28
+ children: /* @__PURE__ */ jsx(WorkflowList_default, { pipeline: l })
29
+ }) }), a[2] = l, a[3] = b);
30
+ let x;
31
+ a[4] !== v || a[5] !== b ? (x = /* @__PURE__ */ jsxs("div", {
32
+ className: "flex flex-1 flex-col overflow-hidden",
33
+ children: [v, b]
34
+ }), a[4] = v, a[5] = b, a[6] = x) : x = a[6];
35
+ let S;
36
+ a[7] !== h || a[8] !== _ || a[9] !== d.length || a[10] !== m || a[11] !== g ? (S = d.length > 0 && /* @__PURE__ */ jsxs("div", {
28
37
  className: "w-full md:w-1/2 shrink-0 overflow-hidden flex flex-col",
29
38
  children: [/* @__PURE__ */ jsx(FileTabsBar, {}), /* @__PURE__ */ jsx("div", {
30
39
  className: "flex-1 overflow-hidden",
31
40
  children: /* @__PURE__ */ jsx(FileContentViewer, {
32
- selectedFile: u,
33
- content: p,
34
- workflowConfig: m,
41
+ selectedFile: m,
42
+ content: h,
43
+ workflowConfig: g,
35
44
  isLoading: _,
36
45
  className: "h-full"
37
46
  })
38
47
  })]
39
- }), a[2] = p, a[3] = _, a[4] = s.length, a[5] = u, a[6] = m, a[7] = y) : y = a[7];
40
- let b;
41
- return a[8] !== v || a[9] !== y ? (b = /* @__PURE__ */ jsx("div", {
48
+ }), a[7] = h, a[8] = _, a[9] = d.length, a[10] = m, a[11] = g, a[12] = S) : S = a[12];
49
+ let C;
50
+ return a[13] !== x || a[14] !== S ? (C = /* @__PURE__ */ jsx("div", {
42
51
  className: "flex h-full flex-col",
43
52
  children: /* @__PURE__ */ jsxs("div", {
44
53
  className: "flex flex-1 gap-4 overflow-hidden md:flex-row flex-col",
45
- children: [v, y]
54
+ children: [x, S]
46
55
  })
47
- }), a[8] = v, a[9] = y, a[10] = b) : b = a[10], b;
56
+ }), a[13] = x, a[14] = S, a[15] = C) : C = a[15], C;
48
57
  }
49
- function Workbench(l) {
50
- let d = c(23), { pipeline: f } = l, h = useNamespaceTree(f?.id), g = f?.workspaceId, v = useWorkspace(g), y;
51
- d[0] === Symbol.for("react.memo_cache_sentinel") ? (y = { activeSectionId: null }, d[0] = y) : y = d[0];
52
- let [x, S] = useState(y), C;
53
- d[1] === Symbol.for("react.memo_cache_sentinel") ? (C = (e) => {
54
- S({ activeSectionId: e });
55
- }, d[1] = C) : C = d[1];
56
- let w = C, T;
57
- d[2] === x ? T = d[3] : (T = {
58
- state: x,
59
- setActiveSectionId: w
60
- }, d[2] = x, d[3] = T);
61
- let E = T, D = v.data?.features?.fileExplorer?.enabled ?? !1, O = f?.id, k;
62
- d[4] === Symbol.for("react.memo_cache_sentinel") ? (k = /* @__PURE__ */ jsx(SidebarTrigger, { className: "fixed top-0 right-0 z-40 flex h-8 w-8 items-center justify-center p-8 hover:cursor-pointer md:hidden" }), d[4] = k) : k = d[4];
63
- let A;
64
- d[5] === f ? A = d[6] : (A = /* @__PURE__ */ jsx(SidebarInsetDiv, { children: /* @__PURE__ */ jsx("div", {
65
- className: "flex-1",
66
- children: /* @__PURE__ */ jsx(WorkbenchContent, { pipeline: f })
67
- }) }), d[5] = f, d[6] = A);
68
- let j;
69
- d[7] === v.data ? j = d[8] : (j = v.data ? {
70
- volumes: v.data.volumes,
71
- features: v.data.features
72
- } : void 0, d[7] = v.data, d[8] = j);
73
- let M;
74
- d[9] !== h || d[10] !== f || d[11] !== j ? (M = /* @__PURE__ */ jsx(WorkbenchSidebar_default, {
75
- namespaceTree: h,
76
- pipeline: f,
77
- workspaceConfig: j
78
- }), d[9] = h, d[10] = f, d[11] = j, d[12] = M) : M = d[12];
79
- let N;
80
- d[13] !== A || d[14] !== M ? (N = /* @__PURE__ */ jsxs(SidebarProvider, {
81
- defaultOpen: !0,
82
- className: "workbench-sidebar min-h-0",
58
+ function WorkbenchInner(e) {
59
+ let r = c(26), { pipeline: i, breadcrumbData: a } = e, { activeSidePanel: o, activeSectionId: s, setActiveSectionId: u } = useWorkbenchLayout(), f;
60
+ r[0] === s ? f = r[1] : (f = { activeSectionId: s }, r[0] = s, r[1] = f);
61
+ let p;
62
+ r[2] !== u || r[3] !== f ? (p = {
63
+ state: f,
64
+ setActiveSectionId: u
65
+ }, r[2] = u, r[3] = f, r[4] = p) : p = r[4];
66
+ let v = p, x = o ? "w-1/2 overflow-hidden" : "w-full overflow-hidden", S;
67
+ r[5] !== a || r[6] !== i ? (S = /* @__PURE__ */ jsx(WorkbenchContent, {
68
+ pipeline: i,
69
+ breadcrumbData: a
70
+ }), r[5] = a, r[6] = i, r[7] = S) : S = r[7];
71
+ let C;
72
+ r[8] !== x || r[9] !== S ? (C = /* @__PURE__ */ jsx("div", {
73
+ className: x,
74
+ children: S
75
+ }), r[8] = x, r[9] = S, r[10] = C) : C = r[10];
76
+ let w;
77
+ r[11] === o ? w = r[12] : (w = o === "preview" && /* @__PURE__ */ jsx(WorkbenchPreviewPanel, {}), r[11] = o, r[12] = w);
78
+ let T;
79
+ r[13] === o ? T = r[14] : (T = o === "flow" && /* @__PURE__ */ jsx(WorkbenchFlowPanel, {}), r[13] = o, r[14] = T);
80
+ let E;
81
+ r[15] === Symbol.for("react.memo_cache_sentinel") ? (E = /* @__PURE__ */ jsx(WorkbenchFloatingPanel, {}), r[15] = E) : E = r[15];
82
+ let D;
83
+ r[16] !== C || r[17] !== w || r[18] !== T ? (D = /* @__PURE__ */ jsxs("div", {
84
+ className: "relative flex flex-1 overflow-hidden",
83
85
  children: [
84
- k,
85
- A,
86
- M
86
+ C,
87
+ w,
88
+ T,
89
+ E
87
90
  ]
88
- }), d[13] = A, d[14] = M, d[15] = N) : N = d[15];
89
- let P;
90
- d[16] !== D || d[17] !== O || d[18] !== N ? (P = /* @__PURE__ */ jsx(CodeExplorerProvider, {
91
- pipelineId: O,
92
- fileExplorerEnabled: D,
93
- children: N
94
- }), d[16] = D, d[17] = O, d[18] = N, d[19] = P) : P = d[19];
95
- let F;
96
- return d[20] !== E || d[21] !== P ? (F = /* @__PURE__ */ jsx(WorkbenchContextProvider.Provider, {
97
- value: E,
98
- children: P
99
- }), d[20] = E, d[21] = P, d[22] = F) : F = d[22], F;
91
+ }), r[16] = C, r[17] = w, r[18] = T, r[19] = D) : D = r[19];
92
+ let O;
93
+ r[20] === Symbol.for("react.memo_cache_sentinel") ? (O = /* @__PURE__ */ jsx(WorkbenchIconSidebar, {}), r[20] = O) : O = r[20];
94
+ let k;
95
+ r[21] === D ? k = r[22] : (k = /* @__PURE__ */ jsxs("div", {
96
+ className: "flex h-full w-full",
97
+ children: [D, O]
98
+ }), r[21] = D, r[22] = k);
99
+ let A;
100
+ return r[23] !== v || r[24] !== k ? (A = /* @__PURE__ */ jsx(WorkbenchContextProvider.Provider, {
101
+ value: v,
102
+ children: k
103
+ }), r[23] = v, r[24] = k, r[25] = A) : A = r[25], A;
104
+ }
105
+ function Workbench(r) {
106
+ let i = c(19), { pipeline: o, breadcrumbData: s, previewPanelOpen: l, onPreviewPanelOpenChange: d, isDeveloperMode: f, getPreviewUrl: p, getEnvironmentPreviewUrl: m, environments: h } = r, g = o?.workspaceId, _ = useWorkspace(g), v = _.data?.features?.fileExplorer?.enabled ?? !1, y;
107
+ i[0] === _.data ? y = i[1] : (y = _.data ? {
108
+ volumes: _.data.volumes,
109
+ features: _.data.features
110
+ } : void 0, i[0] = _.data, i[1] = y);
111
+ let b = y, S = h ?? _.data?.environments, C = o?.id, w;
112
+ i[2] !== s || i[3] !== o ? (w = /* @__PURE__ */ jsx(WorkbenchInner, {
113
+ pipeline: o,
114
+ breadcrumbData: s
115
+ }), i[2] = s, i[3] = o, i[4] = w) : w = i[4];
116
+ let T;
117
+ i[5] !== v || i[6] !== C || i[7] !== w ? (T = /* @__PURE__ */ jsx(CodeExplorerProvider, {
118
+ pipelineId: C,
119
+ fileExplorerEnabled: v,
120
+ children: w
121
+ }), i[5] = v, i[6] = C, i[7] = w, i[8] = T) : T = i[8];
122
+ let E;
123
+ return i[9] !== m || i[10] !== p || i[11] !== f || i[12] !== d || i[13] !== o || i[14] !== l || i[15] !== S || i[16] !== T || i[17] !== b ? (E = /* @__PURE__ */ jsx(WorkbenchLayoutProvider, {
124
+ pipeline: o,
125
+ isDeveloperMode: f,
126
+ workspaceConfig: b,
127
+ getPreviewUrl: p,
128
+ getEnvironmentPreviewUrl: m,
129
+ environments: S,
130
+ previewPanelOpen: l,
131
+ onPreviewPanelOpenChange: d,
132
+ children: T
133
+ }), i[9] = m, i[10] = p, i[11] = f, i[12] = d, i[13] = o, i[14] = l, i[15] = S, i[16] = T, i[17] = b, i[18] = E) : E = i[18], E;
100
134
  }
101
135
  export { Workbench as default };
@@ -3,15 +3,15 @@ import { useWorkflow } from "../../hooks/useWorkflows.js";
3
3
  import { cn } from "../../lib/utils.js";
4
4
  import ErrorSnackbar_default from "../../components/snackbars/ErrorSnackbar.js";
5
5
  import LoadingCentered_default from "../../components/LoadingCentered.js";
6
+ import { require_enums } from "../../packages/contracts/dist/enums/index.js";
6
7
  import { useRunPipeline } from "../../hooks/useProcessor.js";
7
8
  import DocumentList_default from "./components/DocumentList.js";
8
9
  import WorkflowForms_default from "./components/WorkflowForms.js";
9
10
  import ErrorAlert_default from "../../components/content/ErrorAlert.js";
10
- import WorkflowButtons_default from "./components/buttons/WorkflowButtons.js";
11
11
  import React, { useCallback, useEffect, useMemo } from "react";
12
12
  import { jsx, jsxs } from "react/jsx-runtime";
13
13
  import { useParams } from "react-router-dom";
14
- var WorkflowItem_default = ({ pipeline: g, workflowId: _, scrollTo: v, settings: y, embed: b }) => {
14
+ var import_enums = require_enums(), WorkflowItem_default = ({ pipeline: g, workflowId: _, scrollTo: v, settings: y, embed: b }) => {
15
15
  let { workflowId: x, clickId: S } = useParams(), C = useWorkflow(_), w = useFilterDocuments(_);
16
16
  useEffect(() => {
17
17
  x === _ && C.isSuccess && w.isSuccess && v(_);
@@ -35,9 +35,9 @@ var WorkflowItem_default = ({ pipeline: g, workflowId: _, scrollTo: v, settings:
35
35
  payload: p
36
36
  } }
37
37
  });
38
- }, k = D.isPending || C.data?.status === "running";
38
+ }, k = D.isPending || C.data?.status === import_enums.WorkflowState.Running;
39
39
  return /* @__PURE__ */ jsxs("div", {
40
- className: cn("flex flex-col", b ? "p-0" : "min-h-[calc(100vh-16rem)] p-4"),
40
+ className: cn("flex flex-col", b ? "p-0" : "p-4"),
41
41
  children: [
42
42
  /* @__PURE__ */ jsx(LoadingCentered_default, { loading: C.isLoading || w.isLoading }),
43
43
  /* @__PURE__ */ jsx(ErrorSnackbar_default, { error: w.error }),
@@ -51,15 +51,12 @@ var WorkflowItem_default = ({ pipeline: g, workflowId: _, scrollTo: v, settings:
51
51
  isLoading: k
52
52
  }),
53
53
  /* @__PURE__ */ jsx(LoadingCentered_default, { loading: k }),
54
- !!C.data && !b && /* @__PURE__ */ jsxs("div", {
55
- className: "mt-auto flex flex-col gap-6 pt-12",
56
- children: [/* @__PURE__ */ jsx(WorkflowForms_default, {
54
+ !!C.data && !b && /* @__PURE__ */ jsx("div", {
55
+ className: "mt-6",
56
+ children: /* @__PURE__ */ jsx(WorkflowForms_default, {
57
57
  workflow: C.data,
58
58
  onSubmit: O
59
- }), /* @__PURE__ */ jsx(WorkflowButtons_default, {
60
- pipeline: g,
61
- workflow: C.data
62
- })]
59
+ })
63
60
  })
64
61
  ]
65
62
  });
@@ -3,16 +3,17 @@ import { cn } from "../../lib/utils.js";
3
3
  import { Button } from "../../components/ui/button.js";
4
4
  import ErrorSnackbar_default from "../../components/snackbars/ErrorSnackbar.js";
5
5
  import LoadingCentered_default from "../../components/LoadingCentered.js";
6
+ import { WorkbenchContextProvider } from "./providers/WorkbenchLayoutProvider.js";
6
7
  import WorkflowItem_default from "./WorkflowItem.js";
7
8
  import { useScrollToBottom } from "./hooks/useAutoScrollBottom.js";
8
9
  import { useIntersectionObserver } from "./hooks/useIntersectionObserver.js";
9
10
  import { useScrollToListItem } from "./hooks/useScrollToListItem.js";
10
- import { WorkbenchContextProvider } from "./providers/WorkbenchContextProvider.js";
11
11
  import WorkbenchSettingsModal_default from "./components/WorkbenchSettingsModal.js";
12
+ import WorkflowButtons_default from "./components/buttons/WorkflowButtons.js";
12
13
  import { c } from "react/compiler-runtime";
13
14
  import React, { useContext, useEffect, useState } from "react";
14
15
  import { jsx, jsxs } from "react/jsx-runtime";
15
- import { ArrowDownIcon, ChevronDownIcon, ChevronRightIcon, LayersIcon } from "lucide-react";
16
+ import { ArrowDownIcon, ChevronRightIcon, Play } from "lucide-react";
16
17
  var WorkflowList_default = (S) => {
17
18
  let C = c(33), { pipeline: w } = S, T = useFetchWorkflowsByPipeline(w.id), [E, D] = useState(!1), O;
18
19
  C[0] === Symbol.for("react.memo_cache_sentinel") ? (O = {}, C[0] = O) : O = C[0];
@@ -31,18 +32,18 @@ var WorkflowList_default = (S) => {
31
32
  let U, W;
32
33
  C[6] !== P || C[7] !== T.data ? (U = () => {
33
34
  if (T.data && T.data.length > 0) {
34
- let t = T.data.length - 1, y = T.data[t], b = `section-${y.index}-${y.id}`;
35
+ let t = T.data.length - 1, _ = T.data[t], v = `section-${_.index}-${_.id}`;
35
36
  A({
36
- [b]: !0,
37
- ...P && P !== b ? { [P]: !0 } : {}
37
+ [v]: !0,
38
+ ...P && P !== v ? { [P]: !0 } : {}
38
39
  });
39
40
  }
40
41
  }, W = [T.data, P], C[6] = P, C[7] = T.data, C[8] = U, C[9] = W) : (U = C[8], W = C[9]), useEffect(U, W);
41
42
  let G;
42
43
  C[10] === Symbol.for("react.memo_cache_sentinel") ? (G = (t) => {
43
- A((y) => ({
44
- ...y,
45
- [t]: !y[t]
44
+ A((_) => ({
45
+ ..._,
46
+ [t]: !_[t]
46
47
  }));
47
48
  }, C[10] = G) : G = C[10];
48
49
  let K = G, q;
@@ -62,33 +63,41 @@ var WorkflowList_default = (S) => {
62
63
  className: "mb-10",
63
64
  ref: I,
64
65
  children: /* @__PURE__ */ jsx("div", { children: T.data.map((t) => {
65
- let b = `section-${t.index}-${t.id}`, x = P === b;
66
+ let v = `section-${t.index}-${t.id}`, y = P === v, b = T.data.length === 1, x = b || k[v];
66
67
  return /* @__PURE__ */ jsxs("div", {
67
68
  ref: (t) => F(t),
68
- "data-id": b,
69
- className: "space-y-0",
69
+ "data-id": v,
70
70
  children: [/* @__PURE__ */ jsx("div", {
71
71
  className: "bg-background/95 supports-[backdrop-filter]:bg-background/60 sticky top-0 z-10 backdrop-blur",
72
72
  children: /* @__PURE__ */ jsxs("div", {
73
- className: "mb-4 flex items-center gap-2 py-2 px-3 cursor-pointer border-b border-border bg-muted/50 rounded-t-sm",
74
- onClick: () => K(b),
73
+ role: "button",
74
+ tabIndex: b ? void 0 : 0,
75
+ className: cn("flex w-full items-center gap-2 rounded-md p-2 px-3 text-left text-sm font-medium", !b && "hover:bg-accent hover:text-accent-foreground cursor-pointer", b && "cursor-default"),
76
+ onClick: b ? void 0 : () => K(v),
77
+ onKeyDown: b ? void 0 : (t) => {
78
+ (t.key === "Enter" || t.key === " ") && (t.preventDefault(), K(v));
79
+ },
75
80
  children: [
76
- k[b] ? /* @__PURE__ */ jsx(ChevronDownIcon, { className: cn("size-4", x ? "text-primary" : "text-muted-foreground") }) : /* @__PURE__ */ jsx(ChevronRightIcon, { className: cn("size-4", x ? "text-primary" : "text-muted-foreground") }),
77
- /* @__PURE__ */ jsx(LayersIcon, { className: cn("size-4", x ? "text-primary" : "text-muted-foreground") }),
81
+ /* @__PURE__ */ jsx(Play, { className: "text-primary h-3.5 w-3.5 fill-current" }),
78
82
  /* @__PURE__ */ jsx("span", {
79
- className: cn("text-base font-medium transition-colors flex-1", x ? "text-primary" : "text-muted-foreground text-gray-400"),
83
+ className: "flex-1 truncate text-sm",
80
84
  children: t.title ?? t.blockName
81
85
  }),
82
- x && /* @__PURE__ */ jsx(WorkbenchSettingsModal_default, {
86
+ /* @__PURE__ */ jsx(WorkflowButtons_default, {
87
+ pipeline: w,
88
+ workflowId: t.id
89
+ }),
90
+ y && /* @__PURE__ */ jsx(WorkbenchSettingsModal_default, {
83
91
  settings: M,
84
92
  onSettingsChange: N,
85
93
  open: E,
86
94
  onOpenChange: D
87
- })
95
+ }),
96
+ !b && /* @__PURE__ */ jsx(ChevronRightIcon, { className: cn("text-muted-foreground h-3.5 w-3.5 transition-transform", x && "rotate-90") })
88
97
  ]
89
98
  })
90
- }), k[b] && /* @__PURE__ */ jsx("div", {
91
- className: "max-w-4xl pl-9",
99
+ }), x && /* @__PURE__ */ jsx("div", {
100
+ className: "max-w-4xl py-1",
92
101
  children: /* @__PURE__ */ jsx(WorkflowItem_default, {
93
102
  pipeline: w,
94
103
  workflowId: t.id,
@@ -1,40 +1,40 @@
1
+ import { require_enums } from "../../../packages/contracts/dist/enums/index.js";
1
2
  import DocumentItem_default from "./DocumentItem.js";
2
3
  import { c } from "react/compiler-runtime";
3
4
  import React, { useEffect } from "react";
4
- import { WorkflowState } from "@loopstack/api-client";
5
5
  import { jsx } from "react/jsx-runtime";
6
6
  import { useParams } from "react-router-dom";
7
- var DocumentList_default = (i) => {
8
- let s = c(23), { pipeline: l, workflow: u, documents: d, scrollTo: f, settings: p } = i, { workflowId: m, clickId: h } = useParams(), g;
9
- s[0] !== m || s[1] !== f || s[2] !== u.id ? (g = () => {
7
+ var import_enums = require_enums(), DocumentList_default = (e) => {
8
+ let o = c(23), { pipeline: l, workflow: u, documents: d, scrollTo: f, settings: p } = e, { workflowId: m, clickId: h } = useParams(), g;
9
+ o[0] !== m || o[1] !== f || o[2] !== u.id ? (g = () => {
10
10
  m === u.id && f(u.id);
11
- }, s[0] = m, s[1] = f, s[2] = u.id, s[3] = g) : g = s[3];
11
+ }, o[0] = m, o[1] = f, o[2] = u.id, o[3] = g) : g = o[3];
12
12
  let _;
13
- s[4] !== h || s[5] !== m || s[6] !== f || s[7] !== u.id ? (_ = [
13
+ o[4] !== h || o[5] !== m || o[6] !== f || o[7] !== u.id ? (_ = [
14
14
  u.id,
15
15
  m,
16
16
  h,
17
17
  f
18
- ], s[4] = h, s[5] = m, s[6] = f, s[7] = u.id, s[8] = _) : _ = s[8], useEffect(g, _);
19
- let v = u.status === WorkflowState.Waiting, y;
20
- if (s[9] !== d || s[10] !== v || s[11] !== l || s[12] !== p || s[13] !== u) {
21
- let r;
22
- s[15] !== d.length || s[16] !== v || s[17] !== l || s[18] !== p || s[19] !== u ? (r = (r, i) => {
23
- let a = r, o = r.place === u.place || !!a.meta?.enableAtPlaces?.includes(u.place);
18
+ ], o[4] = h, o[5] = m, o[6] = f, o[7] = u.id, o[8] = _) : _ = o[8], useEffect(g, _);
19
+ let v = u.status === import_enums.WorkflowState.Waiting, y;
20
+ if (o[9] !== d || o[10] !== v || o[11] !== l || o[12] !== p || o[13] !== u) {
21
+ let e;
22
+ o[15] !== d.length || o[16] !== v || o[17] !== l || o[18] !== p || o[19] !== u ? (e = (e, a) => {
23
+ let o = e, s = e.place === u.place || !!o.meta?.enableAtPlaces?.includes(u.place);
24
24
  return /* @__PURE__ */ jsx(DocumentItem_default, {
25
- document: r,
25
+ document: e,
26
26
  workflow: u,
27
27
  pipeline: l,
28
- isActive: v && o,
29
- isLastItem: i === d.length - 1,
28
+ isActive: v && s,
29
+ isLastItem: a === d.length - 1,
30
30
  settings: p
31
- }, r.id);
32
- }, s[15] = d.length, s[16] = v, s[17] = l, s[18] = p, s[19] = u, s[20] = r) : r = s[20], y = d.map(r), s[9] = d, s[10] = v, s[11] = l, s[12] = p, s[13] = u, s[14] = y;
33
- } else y = s[14];
31
+ }, e.id);
32
+ }, o[15] = d.length, o[16] = v, o[17] = l, o[18] = p, o[19] = u, o[20] = e) : e = o[20], y = d.map(e), o[9] = d, o[10] = v, o[11] = l, o[12] = p, o[13] = u, o[14] = y;
33
+ } else y = o[14];
34
34
  let b;
35
- return s[21] === y ? b = s[22] : (b = /* @__PURE__ */ jsx("div", {
35
+ return o[21] === y ? b = o[22] : (b = /* @__PURE__ */ jsx("div", {
36
36
  className: "flex flex-col gap-6",
37
37
  children: y
38
- }), s[21] = y, s[22] = b), b;
38
+ }), o[21] = y, o[22] = b), b;
39
39
  };
40
40
  export { DocumentList_default as default };