@loopstack/loopstack-studio 0.23.0 → 0.23.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 (35) hide show
  1. package/dist/components/dynamic-form/Form.js +50 -27
  2. package/dist/components/dynamic-form/InputController.js +3 -1
  3. package/dist/components/dynamic-form/fields/MarkdownViewField.js +20 -0
  4. package/dist/features/code-explorer/components/CodeExplorerTreeNode.js +80 -4
  5. package/dist/features/code-explorer/components/FileTabsBar.js +3 -190
  6. package/dist/features/code-explorer/components/FileTabsBarBase.js +190 -0
  7. package/dist/features/code-explorer/index.js +2 -2
  8. package/dist/features/code-explorer/providers/CodeExplorerProvider.js +2 -162
  9. package/dist/features/code-explorer/utils/fileIcons.js +7 -4
  10. package/dist/features/debug/components/PipelineFlowViewer.js +46 -45
  11. package/dist/features/debug/components/pipeline-flow/WorkflowGraph.js +19 -19
  12. package/dist/features/documents/DocumentRenderer.js +20 -15
  13. package/dist/features/documents/renderers/ClaudeMessage.js +96 -0
  14. package/dist/features/workbench/Workbench.js +64 -80
  15. package/dist/features/workbench/WorkflowItem.js +5 -5
  16. package/dist/features/workbench/components/RemoteFileTabsBar.js +18 -0
  17. package/dist/features/workbench/components/RemoteFileTree.js +90 -0
  18. package/dist/features/workbench/components/WorkbenchFilesPanel.js +60 -0
  19. package/dist/features/workbench/components/WorkbenchFlowPanel.js +2 -2
  20. package/dist/features/workbench/components/WorkbenchIconSidebar.js +37 -29
  21. package/dist/features/workbench/hooks/useWorkflowData.js +4 -4
  22. package/dist/features/workbench/providers/RemoteFileExplorerProvider.js +145 -0
  23. package/dist/features/workbench/providers/WorkbenchLayoutProvider.js +46 -43
  24. package/dist/features/workspaces/components/PipelineForm.js +1 -1
  25. package/dist/features/workspaces/components/WorkspaceHomePage.js +93 -0
  26. package/dist/hooks/useFiles.js +1 -43
  27. package/dist/index.d.ts +6 -0
  28. package/dist/index.js +2 -1
  29. package/dist/node_modules/@xyflow/react/dist/esm/index.js +1 -1
  30. package/dist/pages/PipelineDebugPage.js +1 -1
  31. package/dist/pages/PreviewWorkbenchPage.js +167 -70
  32. package/dist/pages/WorkspacePage.js +102 -50
  33. package/dist/pages/WorkspaceRunsPage.js +71 -0
  34. package/dist/routing/LocalRouter.js +6 -0
  35. package/package.json +2 -2
@@ -1,35 +1,58 @@
1
1
  import { FormElementHeader } from "./FormElementHeader.js";
2
2
  import FormBody_default from "./FormBody.js";
3
3
  import { c } from "react/compiler-runtime";
4
- import React from "react";
4
+ import React, { useEffect } from "react";
5
5
  import { jsx, jsxs } from "react/jsx-runtime";
6
- var Form_default = (a) => {
7
- let o = c(20), { form: s, schema: l, ui: u, mimeType: d, disabled: f, viewOnly: p, actions: m } = a, h = u, g = h?.form?.title, _ = h?.form?.description, v;
8
- o[0] !== f || o[1] !== g || o[2] !== _ ? (v = /* @__PURE__ */ jsx(FormElementHeader, {
9
- title: g,
10
- description: _,
11
- disabled: f
12
- }), o[0] = f, o[1] = g, o[2] = _, o[3] = v) : v = o[3];
13
- let y = l, b = u?.form, x;
14
- o[4] !== f || o[5] !== s || o[6] !== d || o[7] !== y || o[8] !== b || o[9] !== p ? (x = /* @__PURE__ */ jsx(FormBody_default, {
15
- form: s,
16
- mimeType: d,
17
- schema: y,
18
- ui: b,
19
- disabled: f,
20
- viewOnly: p
21
- }), o[4] = f, o[5] = s, o[6] = d, o[7] = y, o[8] = b, o[9] = p, o[10] = x) : x = o[10];
22
- let S;
23
- o[11] !== m || o[12] !== p ? (S = !p && !!m && /* @__PURE__ */ jsx("div", {
6
+ function extractSchemaDefaults(e) {
7
+ if (e.default !== void 0) return e.default;
8
+ if (e.properties) {
9
+ let i = {}, a = !1;
10
+ for (let [o, s] of Object.entries(e.properties)) if (s.default !== void 0) i[o] = s.default, a = !0;
11
+ else if (s.type === "object" && s.properties) {
12
+ let e = extractSchemaDefaults(s);
13
+ e !== void 0 && (i[o] = e, a = !0);
14
+ }
15
+ return a ? i : void 0;
16
+ }
17
+ }
18
+ var Form_default = (o) => {
19
+ let l = c(25), { form: u, schema: d, ui: f, mimeType: p, disabled: m, viewOnly: h, actions: g } = o, _ = f, v = d, y;
20
+ l[0] !== u || l[1] !== v ? (y = () => {
21
+ let e = extractSchemaDefaults(v);
22
+ if (e) {
23
+ let i = u.getValues(), a = { ...e };
24
+ for (let [e, o] of Object.entries(i)) o !== void 0 && o !== "" && o !== null && (a[e] = o);
25
+ u.reset(a);
26
+ }
27
+ }, l[0] = u, l[1] = v, l[2] = y) : y = l[2];
28
+ let b;
29
+ l[3] === d ? b = l[4] : (b = [d], l[3] = d, l[4] = b), useEffect(y, b);
30
+ let x = _?.form?.title, S = _?.form?.description, C;
31
+ l[5] !== m || l[6] !== x || l[7] !== S ? (C = /* @__PURE__ */ jsx(FormElementHeader, {
32
+ title: x,
33
+ description: S,
34
+ disabled: m
35
+ }), l[5] = m, l[6] = x, l[7] = S, l[8] = C) : C = l[8];
36
+ let w = d, T = f?.form, E;
37
+ l[9] !== m || l[10] !== u || l[11] !== p || l[12] !== w || l[13] !== T || l[14] !== h ? (E = /* @__PURE__ */ jsx(FormBody_default, {
38
+ form: u,
39
+ mimeType: p,
40
+ schema: w,
41
+ ui: T,
42
+ disabled: m,
43
+ viewOnly: h
44
+ }), l[9] = m, l[10] = u, l[11] = p, l[12] = w, l[13] = T, l[14] = h, l[15] = E) : E = l[15];
45
+ let D;
46
+ l[16] !== g || l[17] !== h ? (D = !h && !!g && /* @__PURE__ */ jsx("div", {
24
47
  className: "mt-4 flex w-full justify-end",
25
- children: m
26
- }), o[11] = m, o[12] = p, o[13] = S) : S = o[13];
27
- let C;
28
- o[14] !== x || o[15] !== S ? (C = /* @__PURE__ */ jsxs("form", { children: [x, S] }), o[14] = x, o[15] = S, o[16] = C) : C = o[16];
29
- let w;
30
- return o[17] !== v || o[18] !== C ? (w = /* @__PURE__ */ jsxs("div", {
48
+ children: g
49
+ }), l[16] = g, l[17] = h, l[18] = D) : D = l[18];
50
+ let O;
51
+ l[19] !== E || l[20] !== D ? (O = /* @__PURE__ */ jsxs("form", { children: [E, D] }), l[19] = E, l[20] = D, l[21] = O) : O = l[21];
52
+ let k;
53
+ return l[22] !== O || l[23] !== C ? (k = /* @__PURE__ */ jsxs("div", {
31
54
  className: "container mx-auto",
32
- children: [v, C]
33
- }), o[17] = v, o[18] = C, o[19] = w) : w = o[19], w;
55
+ children: [C, O]
56
+ }), l[22] = O, l[23] = C, l[24] = k) : k = l[24], k;
34
57
  };
35
58
  export { Form_default as default };
@@ -2,6 +2,7 @@ import { InputField } from "./fields/InputField.js";
2
2
  import { TextareaField } from "./fields/TextareaField.js";
3
3
  import { CheckboxField } from "./fields/CheckboxField.js";
4
4
  import { CodeViewField } from "./fields/CodeViewField.js";
5
+ import { MarkdownViewField } from "./fields/MarkdownViewField.js";
5
6
  import { RadioField } from "./fields/RadioField.js";
6
7
  import { SelectField } from "./fields/SelectField.js";
7
8
  import { SliderField } from "./fields/SliderField.js";
@@ -17,7 +18,8 @@ var WIDGET_REGISTRY = {
17
18
  slider: SliderField,
18
19
  text: InputField,
19
20
  textarea: TextareaField,
20
- "code-view": CodeViewField
21
+ "code-view": CodeViewField,
22
+ "markdown-view": MarkdownViewField
21
23
  }, WIDGET_NAMES = Object.keys(WIDGET_REGISTRY), resolveWidgetType = (e, o) => {
22
24
  if (o && WIDGET_NAMES.includes(o)) return o;
23
25
  let s = e;
@@ -0,0 +1,20 @@
1
+ import MarkdownContent_default from "../MarkdownContent.js";
2
+ import { useFieldConfig } from "../hooks/useFieldConfig.js";
3
+ import { c } from "react/compiler-runtime";
4
+ import React from "react";
5
+ import { jsx } from "react/jsx-runtime";
6
+ import { Controller } from "react-hook-form";
7
+ const MarkdownViewField = (e) => {
8
+ let o = c(4), { name: s, schema: l, ui: u, form: d, disabled: f } = e, p = useFieldConfig(s, l, u, f).defaultValue || "", m;
9
+ return o[0] !== d.control || o[1] !== s || o[2] !== p ? (m = /* @__PURE__ */ jsx(Controller, {
10
+ name: s,
11
+ control: d.control,
12
+ defaultValue: p,
13
+ render: _temp
14
+ }), o[0] = d.control, o[1] = s, o[2] = p, o[3] = m) : m = o[3], m;
15
+ };
16
+ function _temp(i) {
17
+ let { field: a } = i;
18
+ return /* @__PURE__ */ jsx(MarkdownContent_default, { content: String(a.value ?? "") });
19
+ }
20
+ export { MarkdownViewField };
@@ -1,6 +1,82 @@
1
- import "../../../lib/utils.js";
2
- import "../../../components/ui/button.js";
3
- import "../../../components/ui/collapsible.js";
4
- import "../utils/fileIcons.js";
1
+ import { cn } from "../../../lib/utils.js";
2
+ import { Button } from "../../../components/ui/button.js";
3
+ import { Collapsible, CollapsibleContent, CollapsibleTrigger } from "../../../components/ui/collapsible.js";
4
+ import { getFileIcon, getFolderIcon } from "../utils/fileIcons.js";
5
5
  import { jsx, jsxs } from "react/jsx-runtime";
6
6
  import { ChevronDown, ChevronRight, X } from "lucide-react";
7
+ var INDENT_PX = 16, BASE_PADDING_PX = 8;
8
+ function CodeExplorerTreeNode({ node: h, depth: g, onSelectFile: _, onClearSelection: v, onCloseFile: y, isSelected: b = !1, selectedFileId: x, expandedFolders: S = /* @__PURE__ */ new Set(), toggleFolder: C }) {
9
+ let w = S.has(h.id), T = g * INDENT_PX + BASE_PADDING_PX, E = x === h.id || b;
10
+ if (h.type === "file") {
11
+ let m = getFileIcon(h.name);
12
+ return /* @__PURE__ */ jsxs("div", {
13
+ className: cn("flex w-full min-w-0 items-center gap-2 rounded-sm py-1 group", "text-muted-foreground", E && "bg-muted"),
14
+ style: { paddingLeft: T },
15
+ children: [/* @__PURE__ */ jsxs("button", {
16
+ type: "button",
17
+ className: cn("flex flex-1 min-w-0 items-center gap-2 rounded-sm text-left text-sm hover:bg-muted/50", "focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring"),
18
+ onClick: () => _?.(h),
19
+ "aria-label": `Select file ${h.name}`,
20
+ children: [/* @__PURE__ */ jsx(m, {
21
+ className: "h-4 w-4 shrink-0 text-muted-foreground",
22
+ "aria-hidden": !0
23
+ }), /* @__PURE__ */ jsx("span", {
24
+ className: "truncate",
25
+ children: h.name
26
+ })]
27
+ }), E && (y || v) && /* @__PURE__ */ jsx(Button, {
28
+ variant: "ghost",
29
+ size: "icon",
30
+ className: "h-6 w-6 shrink-0 opacity-0 group-hover:opacity-100 transition-opacity",
31
+ onClick: (e) => {
32
+ e.stopPropagation(), y ? y(h) : v && v();
33
+ },
34
+ "aria-label": "Close file",
35
+ children: /* @__PURE__ */ jsx(X, { className: "h-3.5 w-3.5" })
36
+ })]
37
+ });
38
+ }
39
+ let D = h.children && h.children.length > 0, O = getFolderIcon(w);
40
+ return /* @__PURE__ */ jsxs(Collapsible, {
41
+ open: w,
42
+ onOpenChange: () => {
43
+ C && C(h.id);
44
+ },
45
+ children: [/* @__PURE__ */ jsxs(CollapsibleTrigger, {
46
+ className: cn("flex w-full min-w-0 items-center gap-1 rounded-sm py-1 text-left text-sm hover:bg-muted", "text-muted-foreground focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring", "disabled:cursor-default disabled:opacity-50"),
47
+ style: { paddingLeft: T },
48
+ disabled: !D,
49
+ "aria-label": `${w ? "Collapse" : "Expand"} folder ${h.name}`,
50
+ children: [
51
+ D ? jsx(w ? ChevronDown : ChevronRight, {
52
+ className: "h-4 w-4 shrink-0",
53
+ "aria-hidden": !0
54
+ }) : /* @__PURE__ */ jsx("span", {
55
+ className: "w-4 shrink-0",
56
+ "aria-hidden": !0
57
+ }),
58
+ /* @__PURE__ */ jsx(O, {
59
+ className: "h-4 w-4 shrink-0 text-muted-foreground",
60
+ "aria-hidden": !0
61
+ }),
62
+ /* @__PURE__ */ jsx("span", {
63
+ className: "truncate",
64
+ children: h.name
65
+ })
66
+ ]
67
+ }), D && /* @__PURE__ */ jsx(CollapsibleContent, {
68
+ className: "h-full",
69
+ children: h.children.map((e) => /* @__PURE__ */ jsx(CodeExplorerTreeNode, {
70
+ node: e,
71
+ depth: g + 1,
72
+ onSelectFile: _,
73
+ onClearSelection: v,
74
+ onCloseFile: y,
75
+ selectedFileId: x,
76
+ expandedFolders: S,
77
+ toggleFolder: C
78
+ }, e.id))
79
+ })]
80
+ });
81
+ }
82
+ export { CodeExplorerTreeNode };
@@ -1,191 +1,4 @@
1
- import { cn } from "../../../lib/utils.js";
2
- import { Button } from "../../../components/ui/button.js";
3
- import { DropdownMenu, DropdownMenuContent, DropdownMenuItem, DropdownMenuSeparator, DropdownMenuTrigger } from "../../../components/ui/dropdown-menu.js";
4
- import { ScrollArea, ScrollBar } from "../../../components/ui/scroll-area.js";
5
- import { useCodeExplorerContext } from "../providers/CodeExplorerProvider.js";
6
- import { getFileIcon } from "../utils/fileIcons.js";
7
- import { ContextMenu, ContextMenuContent, ContextMenuItem, ContextMenuSeparator, ContextMenuTrigger } from "../../../components/ui/context-menu.js";
1
+ import "../providers/CodeExplorerProvider.js";
2
+ import "./FileTabsBarBase.js";
8
3
  import { c } from "react/compiler-runtime";
9
- import { useEffect, useRef } from "react";
10
- import { jsx, jsxs } from "react/jsx-runtime";
11
- import { ClipboardCopy, MoreHorizontal, X, XCircle } from "lucide-react";
12
- function FileTabsBar() {
13
- let g = c(50), { openFiles: _, selectedFile: v, selectFile: y, closeFile: b, closeAll: x, closeOthers: S, closeToLeft: C, closeToRight: w } = useCodeExplorerContext(), T = useRef(null), E = useRef(_.length), D, O;
14
- g[0] === _.length ? (D = g[1], O = g[2]) : (D = () => {
15
- if (_.length > E.current && T.current) {
16
- let e = T.current.closest("[data-slot=\"scroll-area-viewport\"]");
17
- e && requestAnimationFrame(() => {
18
- e.scrollTo({
19
- left: e.scrollWidth,
20
- behavior: "smooth"
21
- });
22
- });
23
- }
24
- E.current = _.length;
25
- }, O = [_.length], g[0] = _.length, g[1] = D, g[2] = O), useEffect(D, O);
26
- let k, A;
27
- if (g[3] === v ? (k = g[4], A = g[5]) : (k = () => {
28
- if (v && T.current) {
29
- let e = T.current.querySelector(`[data-tab-path="${v.path}"]`);
30
- e && requestAnimationFrame(() => {
31
- e.scrollIntoView({
32
- behavior: "smooth",
33
- block: "nearest",
34
- inline: "nearest"
35
- });
36
- });
37
- }
38
- }, A = [v], g[3] = v, g[4] = k, g[5] = A), useEffect(k, A), _.length === 0) return null;
39
- let j;
40
- g[6] === y ? j = g[7] : (j = (e) => {
41
- y(e);
42
- }, g[6] = y, g[7] = j);
43
- let M = j, N;
44
- g[8] === b ? N = g[9] : (N = (e, l) => {
45
- e.stopPropagation(), b(l);
46
- }, g[8] = b, g[9] = N);
47
- let P = N, F = _temp2, I;
48
- g[10] === Symbol.for("react.memo_cache_sentinel") ? (I = { width: "max-content" }, g[10] = I) : I = g[10];
49
- let L;
50
- g[11] !== x || g[12] !== b || g[13] !== S || g[14] !== C || g[15] !== w || g[16] !== P || g[17] !== M || g[18] !== _ || g[19] !== v?.path ? (L = _.map((u) => {
51
- let d = getFileIcon(u.name), f = v?.path === u.path, p = _.findIndex((e) => e.path === u.path), m = p > 0, h = p < _.length - 1;
52
- return /* @__PURE__ */ jsxs(ContextMenu, { children: [/* @__PURE__ */ jsx(ContextMenuTrigger, {
53
- asChild: !0,
54
- children: /* @__PURE__ */ jsxs("button", {
55
- type: "button",
56
- "data-tab-path": u.path,
57
- onClick: () => M(u),
58
- className: cn("group relative flex h-9 min-w-[140px] max-w-[280px] shrink-0 items-center gap-2 border-r border-border/50 px-3 text-sm transition-all", "hover:bg-muted/70", f ? "bg-background text-foreground border-b-2 border-b-primary shadow-sm" : "text-muted-foreground bg-muted/30"),
59
- "aria-selected": f,
60
- "aria-label": `Tab: ${u.name}`,
61
- children: [
62
- /* @__PURE__ */ jsx(d, {
63
- className: "h-3.5 w-3.5 shrink-0",
64
- "aria-hidden": !0
65
- }),
66
- /* @__PURE__ */ jsx("span", {
67
- className: "truncate flex-1 text-left font-medium",
68
- children: u.name
69
- }),
70
- /* @__PURE__ */ jsx(Button, {
71
- variant: "ghost",
72
- size: "icon",
73
- className: cn("h-5 w-5 shrink-0 rounded opacity-0 group-hover:opacity-100 transition-opacity", "hover:bg-destructive/10 hover:text-destructive", f && "opacity-70"),
74
- onClick: (e) => P(e, u),
75
- "aria-label": `Close ${u.name}`,
76
- children: /* @__PURE__ */ jsx(X, { className: "h-3.5 w-3.5" })
77
- })
78
- ]
79
- })
80
- }), /* @__PURE__ */ jsxs(ContextMenuContent, {
81
- className: "min-w-[180px]",
82
- children: [
83
- /* @__PURE__ */ jsx(ContextMenuItem, {
84
- onClick: () => b(u),
85
- children: "Close"
86
- }),
87
- /* @__PURE__ */ jsx(ContextMenuItem, {
88
- onClick: () => S(u),
89
- disabled: _.length <= 1,
90
- children: "Close Others"
91
- }),
92
- /* @__PURE__ */ jsx(ContextMenuItem, {
93
- onClick: () => C(u),
94
- disabled: !m,
95
- children: "Close to the Left"
96
- }),
97
- /* @__PURE__ */ jsx(ContextMenuItem, {
98
- onClick: () => w(u),
99
- disabled: !h,
100
- children: "Close to the Right"
101
- }),
102
- /* @__PURE__ */ jsx(ContextMenuSeparator, {}),
103
- /* @__PURE__ */ jsx(ContextMenuItem, {
104
- onClick: x,
105
- children: "Close All"
106
- }),
107
- /* @__PURE__ */ jsx(ContextMenuSeparator, {}),
108
- /* @__PURE__ */ jsxs(ContextMenuItem, {
109
- onClick: () => F(u.path),
110
- children: [/* @__PURE__ */ jsx(ClipboardCopy, { className: "h-4 w-4" }), "Copy Path"]
111
- })
112
- ]
113
- })] }, u.path);
114
- }), g[11] = x, g[12] = b, g[13] = S, g[14] = C, g[15] = w, g[16] = P, g[17] = M, g[18] = _, g[19] = v?.path, g[20] = L) : L = g[20];
115
- let R;
116
- g[21] === L ? R = g[22] : (R = /* @__PURE__ */ jsx("div", {
117
- ref: T,
118
- className: "flex h-9 items-center",
119
- style: I,
120
- children: L
121
- }), g[21] = L, g[22] = R);
122
- let z;
123
- g[23] === Symbol.for("react.memo_cache_sentinel") ? (z = /* @__PURE__ */ jsx(ScrollBar, { orientation: "horizontal" }), g[23] = z) : z = g[23];
124
- let B;
125
- g[24] === R ? B = g[25] : (B = /* @__PURE__ */ jsxs(ScrollArea, {
126
- className: "flex-1 min-w-0",
127
- children: [R, z]
128
- }), g[24] = R, g[25] = B);
129
- let V;
130
- g[26] === Symbol.for("react.memo_cache_sentinel") ? (V = /* @__PURE__ */ jsx(DropdownMenuTrigger, {
131
- asChild: !0,
132
- children: /* @__PURE__ */ jsx(Button, {
133
- variant: "ghost",
134
- size: "icon",
135
- className: "h-9 w-9 rounded-none text-muted-foreground hover:bg-muted/70 hover:text-foreground",
136
- "aria-label": "Tab actions",
137
- children: /* @__PURE__ */ jsx(MoreHorizontal, { className: "h-4 w-4" })
138
- })
139
- }), g[26] = V) : V = g[26];
140
- let H;
141
- g[27] !== b || g[28] !== v ? (H = () => v && b(v), g[27] = b, g[28] = v, g[29] = H) : H = g[29];
142
- let U = !v, W;
143
- g[30] !== H || g[31] !== U ? (W = /* @__PURE__ */ jsx(DropdownMenuItem, {
144
- onClick: H,
145
- disabled: U,
146
- children: "Close Active Tab"
147
- }), g[30] = H, g[31] = U, g[32] = W) : W = g[32];
148
- let G;
149
- g[33] !== S || g[34] !== v ? (G = () => v && S(v), g[33] = S, g[34] = v, g[35] = G) : G = g[35];
150
- let K = !v || _.length <= 1, q;
151
- g[36] !== G || g[37] !== K ? (q = /* @__PURE__ */ jsx(DropdownMenuItem, {
152
- onClick: G,
153
- disabled: K,
154
- children: "Close Other Tabs"
155
- }), g[36] = G, g[37] = K, g[38] = q) : q = g[38];
156
- let J;
157
- g[39] === Symbol.for("react.memo_cache_sentinel") ? (J = /* @__PURE__ */ jsx(DropdownMenuSeparator, {}), g[39] = J) : J = g[39];
158
- let Y;
159
- g[40] === Symbol.for("react.memo_cache_sentinel") ? (Y = /* @__PURE__ */ jsx(XCircle, { className: "h-4 w-4" }), g[40] = Y) : Y = g[40];
160
- let Z;
161
- g[41] === x ? Z = g[42] : (Z = /* @__PURE__ */ jsxs(DropdownMenuItem, {
162
- onClick: x,
163
- children: [Y, "Close All Tabs"]
164
- }), g[41] = x, g[42] = Z);
165
- let Q;
166
- g[43] !== W || g[44] !== q || g[45] !== Z ? (Q = /* @__PURE__ */ jsx("div", {
167
- className: "shrink-0 border-l border-border/50 bg-muted/30 h-9 flex items-center",
168
- children: /* @__PURE__ */ jsxs(DropdownMenu, { children: [V, /* @__PURE__ */ jsxs(DropdownMenuContent, {
169
- align: "end",
170
- className: "min-w-[180px]",
171
- children: [
172
- W,
173
- q,
174
- J,
175
- Z
176
- ]
177
- })] })
178
- }), g[43] = W, g[44] = q, g[45] = Z, g[46] = Q) : Q = g[46];
179
- let $;
180
- return g[47] !== B || g[48] !== Q ? ($ = /* @__PURE__ */ jsxs("div", {
181
- className: "shrink-0 border-b bg-muted/50 flex items-center overflow-hidden",
182
- children: [B, Q]
183
- }), g[47] = B, g[48] = Q, g[49] = $) : $ = g[49], $;
184
- }
185
- function _temp2(e) {
186
- navigator.clipboard.writeText(e).catch(_temp);
187
- }
188
- function _temp(e) {
189
- console.error("Failed to copy path:", e);
190
- }
191
- export { FileTabsBar };
4
+ import { jsx } from "react/jsx-runtime";
@@ -0,0 +1,190 @@
1
+ import { cn } from "../../../lib/utils.js";
2
+ import { Button } from "../../../components/ui/button.js";
3
+ import { DropdownMenu, DropdownMenuContent, DropdownMenuItem, DropdownMenuSeparator, DropdownMenuTrigger } from "../../../components/ui/dropdown-menu.js";
4
+ import { ScrollArea, ScrollBar } from "../../../components/ui/scroll-area.js";
5
+ import { getFileIcon } from "../utils/fileIcons.js";
6
+ import { ContextMenu, ContextMenuContent, ContextMenuItem, ContextMenuSeparator, ContextMenuTrigger } from "../../../components/ui/context-menu.js";
7
+ import { c } from "react/compiler-runtime";
8
+ import { useEffect, useRef } from "react";
9
+ import { jsx, jsxs } from "react/jsx-runtime";
10
+ import { ClipboardCopy, MoreHorizontal, X, XCircle } from "lucide-react";
11
+ function FileTabsBarBase(h) {
12
+ let g = c(50), { openFiles: _, selectedFile: v, selectFile: y, closeFile: b, closeAll: x, closeOthers: S, closeToLeft: C, closeToRight: w } = h, T = useRef(null), E = useRef(_.length), D, O;
13
+ g[0] === _.length ? (D = g[1], O = g[2]) : (D = () => {
14
+ if (_.length > E.current && T.current) {
15
+ let e = T.current.closest("[data-slot=\"scroll-area-viewport\"]");
16
+ e && requestAnimationFrame(() => {
17
+ e.scrollTo({
18
+ left: e.scrollWidth,
19
+ behavior: "smooth"
20
+ });
21
+ });
22
+ }
23
+ E.current = _.length;
24
+ }, O = [_.length], g[0] = _.length, g[1] = D, g[2] = O), useEffect(D, O);
25
+ let k, A;
26
+ if (g[3] === v ? (k = g[4], A = g[5]) : (k = () => {
27
+ if (v && T.current) {
28
+ let e = T.current.querySelector(`[data-tab-path="${v.path}"]`);
29
+ e && requestAnimationFrame(() => {
30
+ e.scrollIntoView({
31
+ behavior: "smooth",
32
+ block: "nearest",
33
+ inline: "nearest"
34
+ });
35
+ });
36
+ }
37
+ }, A = [v], g[3] = v, g[4] = k, g[5] = A), useEffect(k, A), _.length === 0) return null;
38
+ let j;
39
+ g[6] === y ? j = g[7] : (j = (e) => {
40
+ y(e);
41
+ }, g[6] = y, g[7] = j);
42
+ let M = j, N;
43
+ g[8] === b ? N = g[9] : (N = (e, s) => {
44
+ e.stopPropagation(), b(s);
45
+ }, g[8] = b, g[9] = N);
46
+ let P = N, F = _temp2, I;
47
+ g[10] === Symbol.for("react.memo_cache_sentinel") ? (I = { width: "max-content" }, g[10] = I) : I = g[10];
48
+ let L;
49
+ g[11] !== x || g[12] !== b || g[13] !== S || g[14] !== C || g[15] !== w || g[16] !== P || g[17] !== M || g[18] !== _ || g[19] !== v?.path ? (L = _.map((l) => {
50
+ let u = getFileIcon(l.name), d = v?.path === l.path, f = _.findIndex((e) => e.path === l.path), p = f > 0, m = f < _.length - 1;
51
+ return /* @__PURE__ */ jsxs(ContextMenu, { children: [/* @__PURE__ */ jsx(ContextMenuTrigger, {
52
+ asChild: !0,
53
+ children: /* @__PURE__ */ jsxs("button", {
54
+ type: "button",
55
+ "data-tab-path": l.path,
56
+ onClick: () => M(l),
57
+ className: cn("group relative flex h-9 min-w-[140px] max-w-[280px] shrink-0 items-center gap-2 border-r border-border/50 px-3 text-sm transition-all", "hover:bg-muted/70", d ? "bg-background text-foreground border-b-2 border-b-primary shadow-sm" : "text-muted-foreground bg-muted/30"),
58
+ "aria-selected": d,
59
+ "aria-label": `Tab: ${l.name}`,
60
+ children: [
61
+ /* @__PURE__ */ jsx(u, {
62
+ className: "h-3.5 w-3.5 shrink-0",
63
+ "aria-hidden": !0
64
+ }),
65
+ /* @__PURE__ */ jsx("span", {
66
+ className: "truncate flex-1 text-left font-medium",
67
+ children: l.name
68
+ }),
69
+ /* @__PURE__ */ jsx(Button, {
70
+ variant: "ghost",
71
+ size: "icon",
72
+ className: cn("h-5 w-5 shrink-0 rounded opacity-0 group-hover:opacity-100 transition-opacity", "hover:bg-destructive/10 hover:text-destructive", d && "opacity-70"),
73
+ onClick: (e) => P(e, l),
74
+ "aria-label": `Close ${l.name}`,
75
+ children: /* @__PURE__ */ jsx(X, { className: "h-3.5 w-3.5" })
76
+ })
77
+ ]
78
+ })
79
+ }), /* @__PURE__ */ jsxs(ContextMenuContent, {
80
+ className: "min-w-[180px]",
81
+ children: [
82
+ /* @__PURE__ */ jsx(ContextMenuItem, {
83
+ onClick: () => b(l),
84
+ children: "Close"
85
+ }),
86
+ /* @__PURE__ */ jsx(ContextMenuItem, {
87
+ onClick: () => S(l),
88
+ disabled: _.length <= 1,
89
+ children: "Close Others"
90
+ }),
91
+ /* @__PURE__ */ jsx(ContextMenuItem, {
92
+ onClick: () => C(l),
93
+ disabled: !p,
94
+ children: "Close to the Left"
95
+ }),
96
+ /* @__PURE__ */ jsx(ContextMenuItem, {
97
+ onClick: () => w(l),
98
+ disabled: !m,
99
+ children: "Close to the Right"
100
+ }),
101
+ /* @__PURE__ */ jsx(ContextMenuSeparator, {}),
102
+ /* @__PURE__ */ jsx(ContextMenuItem, {
103
+ onClick: x,
104
+ children: "Close All"
105
+ }),
106
+ /* @__PURE__ */ jsx(ContextMenuSeparator, {}),
107
+ /* @__PURE__ */ jsxs(ContextMenuItem, {
108
+ onClick: () => F(l.path),
109
+ children: [/* @__PURE__ */ jsx(ClipboardCopy, { className: "h-4 w-4" }), "Copy Path"]
110
+ })
111
+ ]
112
+ })] }, l.path);
113
+ }), g[11] = x, g[12] = b, g[13] = S, g[14] = C, g[15] = w, g[16] = P, g[17] = M, g[18] = _, g[19] = v?.path, g[20] = L) : L = g[20];
114
+ let R;
115
+ g[21] === L ? R = g[22] : (R = /* @__PURE__ */ jsx("div", {
116
+ ref: T,
117
+ className: "flex h-9 items-center",
118
+ style: I,
119
+ children: L
120
+ }), g[21] = L, g[22] = R);
121
+ let z;
122
+ g[23] === Symbol.for("react.memo_cache_sentinel") ? (z = /* @__PURE__ */ jsx(ScrollBar, { orientation: "horizontal" }), g[23] = z) : z = g[23];
123
+ let B;
124
+ g[24] === R ? B = g[25] : (B = /* @__PURE__ */ jsxs(ScrollArea, {
125
+ className: "flex-1 min-w-0",
126
+ children: [R, z]
127
+ }), g[24] = R, g[25] = B);
128
+ let V;
129
+ g[26] === Symbol.for("react.memo_cache_sentinel") ? (V = /* @__PURE__ */ jsx(DropdownMenuTrigger, {
130
+ asChild: !0,
131
+ children: /* @__PURE__ */ jsx(Button, {
132
+ variant: "ghost",
133
+ size: "icon",
134
+ className: "h-9 w-9 rounded-none text-muted-foreground hover:bg-muted/70 hover:text-foreground",
135
+ "aria-label": "Tab actions",
136
+ children: /* @__PURE__ */ jsx(MoreHorizontal, { className: "h-4 w-4" })
137
+ })
138
+ }), g[26] = V) : V = g[26];
139
+ let H;
140
+ g[27] !== b || g[28] !== v ? (H = () => v && b(v), g[27] = b, g[28] = v, g[29] = H) : H = g[29];
141
+ let U = !v, W;
142
+ g[30] !== H || g[31] !== U ? (W = /* @__PURE__ */ jsx(DropdownMenuItem, {
143
+ onClick: H,
144
+ disabled: U,
145
+ children: "Close Active Tab"
146
+ }), g[30] = H, g[31] = U, g[32] = W) : W = g[32];
147
+ let G;
148
+ g[33] !== S || g[34] !== v ? (G = () => v && S(v), g[33] = S, g[34] = v, g[35] = G) : G = g[35];
149
+ let K = !v || _.length <= 1, q;
150
+ g[36] !== G || g[37] !== K ? (q = /* @__PURE__ */ jsx(DropdownMenuItem, {
151
+ onClick: G,
152
+ disabled: K,
153
+ children: "Close Other Tabs"
154
+ }), g[36] = G, g[37] = K, g[38] = q) : q = g[38];
155
+ let J;
156
+ g[39] === Symbol.for("react.memo_cache_sentinel") ? (J = /* @__PURE__ */ jsx(DropdownMenuSeparator, {}), g[39] = J) : J = g[39];
157
+ let Y;
158
+ g[40] === Symbol.for("react.memo_cache_sentinel") ? (Y = /* @__PURE__ */ jsx(XCircle, { className: "h-4 w-4" }), g[40] = Y) : Y = g[40];
159
+ let Z;
160
+ g[41] === x ? Z = g[42] : (Z = /* @__PURE__ */ jsxs(DropdownMenuItem, {
161
+ onClick: x,
162
+ children: [Y, "Close All Tabs"]
163
+ }), g[41] = x, g[42] = Z);
164
+ let Q;
165
+ g[43] !== W || g[44] !== q || g[45] !== Z ? (Q = /* @__PURE__ */ jsx("div", {
166
+ className: "shrink-0 border-l border-border/50 bg-muted/30 h-9 flex items-center",
167
+ children: /* @__PURE__ */ jsxs(DropdownMenu, { children: [V, /* @__PURE__ */ jsxs(DropdownMenuContent, {
168
+ align: "end",
169
+ className: "min-w-[180px]",
170
+ children: [
171
+ W,
172
+ q,
173
+ J,
174
+ Z
175
+ ]
176
+ })] })
177
+ }), g[43] = W, g[44] = q, g[45] = Z, g[46] = Q) : Q = g[46];
178
+ let $;
179
+ return g[47] !== B || g[48] !== Q ? ($ = /* @__PURE__ */ jsxs("div", {
180
+ className: "shrink-0 border-b bg-muted/50 flex items-center overflow-hidden",
181
+ children: [B, Q]
182
+ }), g[47] = B, g[48] = Q, g[49] = $) : $ = g[49], $;
183
+ }
184
+ function _temp2(e) {
185
+ navigator.clipboard.writeText(e).catch(_temp);
186
+ }
187
+ function _temp(e) {
188
+ console.error("Failed to copy path:", e);
189
+ }
190
+ export { FileTabsBarBase };
@@ -1,4 +1,4 @@
1
- import { CodeExplorerProvider, useCodeExplorerContext } from "./providers/CodeExplorerProvider.js";
1
+ import "./providers/CodeExplorerProvider.js";
2
2
  import "./CodeExplorer.js";
3
3
  import { FileContentViewer } from "./components/FileContentViewer.js";
4
- import { FileTabsBar } from "./components/FileTabsBar.js";
4
+ import "./components/FileTabsBar.js";