@opengeni/react 7.4.0 → 7.5.0-canary.36927100590001
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.
- package/README.md +124 -27
- package/dist/artifacts-document.js +3 -2
- package/dist/artifacts-presentation.js +3 -2
- package/dist/artifacts-spreadsheet.js +2 -2
- package/dist/artifacts.d.ts +1 -0
- package/dist/artifacts.js +516 -1413
- package/dist/artifacts.js.map +1 -1
- package/dist/{browser-viewer-2E6R2Y4W.js → browser-viewer-Z7S7QEJL.js} +6 -5
- package/dist/chat-interactive-block-UGBTNB3L.js +11 -0
- package/dist/{chunk-Y3QTZN2F.js → chunk-2VFNCX4E.js} +6 -6
- package/dist/{chunk-UDD6DLLT.js → chunk-3IJJEYW4.js} +15 -3
- package/dist/chunk-3IJJEYW4.js.map +1 -0
- package/dist/chunk-4RVYOY4O.js +379 -0
- package/dist/chunk-4RVYOY4O.js.map +1 -0
- package/dist/chunk-5CVXZA3Y.js +292 -0
- package/dist/chunk-5CVXZA3Y.js.map +1 -0
- package/dist/{chunk-5YK2ZDIG.js → chunk-5J4FOW6Q.js} +2 -10
- package/dist/chunk-5J4FOW6Q.js.map +1 -0
- package/dist/{chunk-KVERXCFY.js → chunk-5KYZIQFY.js} +40 -3
- package/dist/chunk-5KYZIQFY.js.map +1 -0
- package/dist/{chunk-KNDIXZN6.js → chunk-7UAMYXJY.js} +25 -18
- package/dist/{chunk-KNDIXZN6.js.map → chunk-7UAMYXJY.js.map} +1 -1
- package/dist/{chunk-SEEVCT36.js → chunk-A4UJB2MM.js} +2 -2
- package/dist/{chunk-X4HIN6TV.js → chunk-AFLPWUQ7.js} +71 -162
- package/dist/chunk-AFLPWUQ7.js.map +1 -0
- package/dist/chunk-B3V6TG77.js +41 -0
- package/dist/chunk-B3V6TG77.js.map +1 -0
- package/dist/{chunk-XEJEOAOV.js → chunk-B7WMS3CS.js} +51 -40
- package/dist/chunk-B7WMS3CS.js.map +1 -0
- package/dist/{chunk-S5JQ4R22.js → chunk-BDKR6BAR.js} +54 -24
- package/dist/chunk-BDKR6BAR.js.map +1 -0
- package/dist/{chunk-4MDLEHXL.js → chunk-DYWBUX5Q.js} +24 -12
- package/dist/chunk-DYWBUX5Q.js.map +1 -0
- package/dist/{chunk-YZ3YYMOM.js → chunk-E3G7SAYZ.js} +252 -624
- package/dist/chunk-E3G7SAYZ.js.map +1 -0
- package/dist/chunk-JT4JW7BC.js +54 -0
- package/dist/chunk-JT4JW7BC.js.map +1 -0
- package/dist/{chunk-5AZSK6MV.js → chunk-LWNLETQT.js} +5 -5
- package/dist/{chunk-USXVQACU.js → chunk-M7LBYP63.js} +5 -4
- package/dist/{chunk-USXVQACU.js.map → chunk-M7LBYP63.js.map} +1 -1
- package/dist/{chunk-L4OSXQ6H.js → chunk-NBOHNRLJ.js} +1289 -1060
- package/dist/chunk-NBOHNRLJ.js.map +1 -0
- package/dist/chunk-RHREZ7BO.js +11 -0
- package/dist/chunk-RHREZ7BO.js.map +1 -0
- package/dist/chunk-SCOTPE2I.js +589 -0
- package/dist/chunk-SCOTPE2I.js.map +1 -0
- package/dist/chunk-WEHMPOXK.js +39 -0
- package/dist/chunk-WEHMPOXK.js.map +1 -0
- package/dist/chunk-WRHIZYZF.js +988 -0
- package/dist/chunk-WRHIZYZF.js.map +1 -0
- package/dist/{chunk-3E2AITTZ.js → chunk-WUISZ3WU.js} +32 -28
- package/dist/{chunk-3E2AITTZ.js.map → chunk-WUISZ3WU.js.map} +1 -1
- package/dist/chunk-XCHWDJ22.js +107 -0
- package/dist/chunk-XCHWDJ22.js.map +1 -0
- package/dist/{chunk-DUEBTL3N.js → chunk-Y2PRMYLC.js} +4 -3
- package/dist/{chunk-DUEBTL3N.js.map → chunk-Y2PRMYLC.js.map} +1 -1
- package/dist/chunk-YBXQDQFX.js +1772 -0
- package/dist/chunk-YBXQDQFX.js.map +1 -0
- package/dist/chunk-YV4L3ILF.js +9 -0
- package/dist/chunk-YV4L3ILF.js.map +1 -0
- package/dist/{chunk-V2ABIVYJ.js → chunk-ZXSEDZP7.js} +70 -6
- package/dist/chunk-ZXSEDZP7.js.map +1 -0
- package/dist/components/artifacts/artifact-chrome.d.ts +120 -0
- package/dist/components/artifacts/artifact-sandbox.d.ts +27 -0
- package/dist/components/artifacts/chat-interactive-block.d.ts +29 -0
- package/dist/components/artifacts/deferred-chat-media.d.ts +15 -0
- package/dist/components/artifacts/editable-artifact-ui.d.ts +2 -1
- package/dist/components/artifacts/editable-artifact-view.d.ts +46 -0
- package/dist/components/artifacts/index.d.ts +7 -0
- package/dist/components/artifacts/latest-task-runner.d.ts +15 -0
- package/dist/components/artifacts/session-artifact-viewer.d.ts +39 -0
- package/dist/components/artifacts/site-view.d.ts +23 -0
- package/dist/components/browser-select-control.d.ts +3 -1
- package/dist/components/code-editor.d.ts +1 -4
- package/dist/components/desktop-viewer.d.ts +1 -1
- package/dist/components/message-timeline.d.ts +20 -3
- package/dist/components/open-geni-links.d.ts +16 -0
- package/dist/components/session-conversation.d.ts +20 -1
- package/dist/components/timeline-pill-geometry.d.ts +8 -0
- package/dist/components/timeline-pill-placement.d.ts +24 -0
- package/dist/components/usage-limit-notice.d.ts +49 -0
- package/dist/components/usage-member-list.d.ts +91 -0
- package/dist/components/usage-meter.d.ts +73 -0
- package/dist/composer.js +5 -5
- package/dist/{computer-viewer-WMJE6OA3.js → computer-viewer-KJWLH3GI.js} +7 -5
- package/dist/connect.js +7 -6
- package/dist/connect.js.map +1 -1
- package/dist/conversation-timeline.d.ts +1 -1
- package/dist/desktop.d.ts +7 -0
- package/dist/desktop.js +26 -0
- package/dist/desktop.js.map +1 -0
- package/dist/editor.d.ts +7 -0
- package/dist/editor.js +21 -0
- package/dist/editor.js.map +1 -0
- package/dist/hooks/latest-question.d.ts +1 -1
- package/dist/hooks/use-composer.d.ts +4 -0
- package/dist/hooks/use-desktop-stream.d.ts +1 -1
- package/dist/hooks/use-usage.d.ts +40 -0
- package/dist/index.d.ts +7 -2
- package/dist/index.js +460 -1386
- package/dist/index.js.map +1 -1
- package/dist/interaction.js +8 -6
- package/dist/interaction.js.map +1 -1
- package/dist/{latest-question-QB4EUCW5.js → latest-question-IS445HOW.js} +3 -3
- package/dist/lib/format.d.ts +6 -1
- package/dist/lib/workbench-peers.d.ts +36 -0
- package/dist/machines.js +2 -2
- package/dist/{markdown-table-layout-PFUEZ2U4.js → markdown-table-layout-QXSLK4BY.js} +37 -5
- package/dist/markdown-table-layout-QXSLK4BY.js.map +1 -0
- package/dist/{queue-surface-implementation-IM2HD3SK.js → queue-surface-implementation-2CAQAIHM.js} +2 -2
- package/dist/realtime.js +3 -3
- package/dist/{sandbox-files-PXPIZAFG.js → sandbox-files-AEJTWGT4.js} +8 -5
- package/dist/sandbox-files-AEJTWGT4.js.map +1 -0
- package/dist/session-ui.d.ts +9 -2
- package/dist/session-ui.js +39 -20
- package/dist/session-ui.js.map +1 -1
- package/dist/session.js +4 -4
- package/dist/sites.js +4 -289
- package/dist/sites.js.map +1 -1
- package/dist/terminal.d.ts +8 -0
- package/dist/terminal.js +31 -0
- package/dist/terminal.js.map +1 -0
- package/dist/timeline/allowance-exhausted-row.d.ts +24 -0
- package/dist/timeline/genie-loading.d.ts +3 -1
- package/dist/timeline/types.d.ts +8 -1
- package/dist/{timeline-annotation-selection-ODLVF4OI.js → timeline-annotation-selection-DMLMM2TX.js} +6 -1
- package/dist/timeline-annotation-selection-DMLMM2TX.js.map +1 -0
- package/dist/timeline-pill-geometry-Z23V243M.js +110 -0
- package/dist/timeline-pill-geometry-Z23V243M.js.map +1 -0
- package/dist/usage/allowance-copy.d.ts +25 -0
- package/dist/usage/summary.d.ts +35 -0
- package/dist/usage.d.ts +13 -0
- package/dist/usage.js +1073 -0
- package/dist/usage.js.map +1 -0
- package/package.json +19 -3
- package/src/artifacts.ts +37 -0
- package/src/components/artifacts/artifact-chrome.tsx +413 -0
- package/src/components/artifacts/artifact-sandbox.tsx +185 -0
- package/src/components/artifacts/chat-interactive-block.tsx +260 -0
- package/src/components/artifacts/deferred-chat-media.tsx +67 -0
- package/src/components/artifacts/editable-artifact-ui.tsx +3 -1
- package/src/components/artifacts/editable-artifact-view.tsx +187 -0
- package/src/components/artifacts/editable-artifact-workbench.tsx +5 -2
- package/src/components/artifacts/editable-document.tsx +34 -36
- package/src/components/artifacts/editable-presentation.tsx +21 -16
- package/src/components/artifacts/index.ts +41 -0
- package/src/components/artifacts/latest-task-runner.ts +49 -0
- package/src/components/artifacts/session-artifact-viewer.tsx +376 -0
- package/src/components/artifacts/site-view.tsx +116 -0
- package/src/components/browser-select-control.tsx +4 -1
- package/src/components/browser-viewer.tsx +81 -22
- package/src/components/code-editor.tsx +13 -16
- package/src/components/computer-viewer.tsx +51 -23
- package/src/components/desktop-viewer.tsx +1 -1
- package/src/components/markdown-table-layout.ts +49 -5
- package/src/components/markdown.tsx +5 -2
- package/src/components/message-timeline.tsx +557 -516
- package/src/components/open-geni-links.tsx +24 -0
- package/src/components/sandbox-terminal.tsx +48 -11
- package/src/components/session-chrome.tsx +22 -3
- package/src/components/session-conversation.tsx +195 -102
- package/src/components/timeline-annotation-selection.tsx +7 -0
- package/src/components/timeline-pill-geometry.ts +169 -0
- package/src/components/timeline-pill-placement.ts +99 -0
- package/src/components/usage-limit-notice.tsx +179 -0
- package/src/components/usage-member-list.tsx +792 -0
- package/src/components/usage-meter.tsx +382 -0
- package/src/conversation-timeline.ts +10 -2
- package/src/desktop.ts +24 -0
- package/src/editor.ts +13 -0
- package/src/hooks/use-available-models.ts +1 -1
- package/src/hooks/use-composer.ts +57 -2
- package/src/hooks/use-desktop-stream.ts +19 -28
- package/src/hooks/use-usage.ts +100 -0
- package/src/index.ts +22 -0
- package/src/lib/format.ts +32 -6
- package/src/lib/workbench-peers.ts +62 -0
- package/src/session-ui.ts +22 -0
- package/src/terminal.ts +26 -0
- package/src/timeline/activity-rail.tsx +5 -3
- package/src/timeline/allowance-exhausted-row.tsx +86 -0
- package/src/timeline/genie-loading.tsx +16 -6
- package/src/timeline/projection.ts +78 -4
- package/src/timeline/types.ts +8 -0
- package/src/usage/allowance-copy.ts +64 -0
- package/src/usage/summary.ts +93 -0
- package/src/usage.ts +50 -0
- package/styles/compiled.css +325 -0
- package/dist/chunk-4MDLEHXL.js.map +0 -1
- package/dist/chunk-5YK2ZDIG.js.map +0 -1
- package/dist/chunk-KVERXCFY.js.map +0 -1
- package/dist/chunk-L4OSXQ6H.js.map +0 -1
- package/dist/chunk-S5JQ4R22.js.map +0 -1
- package/dist/chunk-UDD6DLLT.js.map +0 -1
- package/dist/chunk-UGMKPUEM.js +0 -299
- package/dist/chunk-UGMKPUEM.js.map +0 -1
- package/dist/chunk-V2ABIVYJ.js.map +0 -1
- package/dist/chunk-X4HIN6TV.js.map +0 -1
- package/dist/chunk-XEJEOAOV.js.map +0 -1
- package/dist/chunk-YZ3YYMOM.js.map +0 -1
- package/dist/markdown-table-layout-PFUEZ2U4.js.map +0 -1
- package/dist/timeline-annotation-selection-ODLVF4OI.js.map +0 -1
- /package/dist/{browser-viewer-2E6R2Y4W.js.map → browser-viewer-Z7S7QEJL.js.map} +0 -0
- /package/dist/{computer-viewer-WMJE6OA3.js.map → chat-interactive-block-UGBTNB3L.js.map} +0 -0
- /package/dist/{chunk-Y3QTZN2F.js.map → chunk-2VFNCX4E.js.map} +0 -0
- /package/dist/{chunk-SEEVCT36.js.map → chunk-A4UJB2MM.js.map} +0 -0
- /package/dist/{chunk-5AZSK6MV.js.map → chunk-LWNLETQT.js.map} +0 -0
- /package/dist/{sandbox-files-PXPIZAFG.js.map → computer-viewer-KJWLH3GI.js.map} +0 -0
- /package/dist/{latest-question-QB4EUCW5.js.map → latest-question-IS445HOW.js.map} +0 -0
- /package/dist/{queue-surface-implementation-IM2HD3SK.js.map → queue-surface-implementation-2CAQAIHM.js.map} +0 -0
|
@@ -1,6 +1,9 @@
|
|
|
1
1
|
import {
|
|
2
2
|
useThemeType
|
|
3
3
|
} from "./chunk-UK4TINKT.js";
|
|
4
|
+
import {
|
|
5
|
+
prefersReducedMotion
|
|
6
|
+
} from "./chunk-GIMRELBW.js";
|
|
4
7
|
import {
|
|
5
8
|
loadPierreDiffs,
|
|
6
9
|
pierreDiffsRevision,
|
|
@@ -11,34 +14,30 @@ import {
|
|
|
11
14
|
MENU_SEPARATOR_CLASS,
|
|
12
15
|
MENU_SURFACE_CLASS
|
|
13
16
|
} from "./chunk-K3HQAKQX.js";
|
|
14
|
-
import {
|
|
15
|
-
useOpenGeni
|
|
16
|
-
} from "./chunk-NEXLLTP4.js";
|
|
17
|
-
import {
|
|
18
|
-
prefersReducedMotion
|
|
19
|
-
} from "./chunk-GIMRELBW.js";
|
|
20
17
|
import {
|
|
21
18
|
usePortalTokenSource,
|
|
22
19
|
usePortalTokenStyle
|
|
23
20
|
} from "./chunk-VZTQ73XT.js";
|
|
21
|
+
import {
|
|
22
|
+
sandboxAcceptsLiveIo
|
|
23
|
+
} from "./chunk-YV4L3ILF.js";
|
|
24
|
+
import {
|
|
25
|
+
useOpenGeni
|
|
26
|
+
} from "./chunk-NEXLLTP4.js";
|
|
27
|
+
import {
|
|
28
|
+
CodeEditor
|
|
29
|
+
} from "./chunk-4RVYOY4O.js";
|
|
24
30
|
import {
|
|
25
31
|
cn
|
|
26
32
|
} from "./chunk-22KP6LR5.js";
|
|
27
33
|
|
|
28
34
|
// src/components/sandbox-files.tsx
|
|
29
35
|
import { FileCode2Icon, FileWarningIcon, LoaderCircleIcon } from "lucide-react";
|
|
30
|
-
import { useCallback as
|
|
36
|
+
import { useCallback as useCallback3, useEffect as useEffect5, useRef as useRef3, useState as useState4 } from "react";
|
|
31
37
|
import { Group, Panel, Separator } from "react-resizable-panels";
|
|
32
38
|
|
|
33
39
|
// src/hooks/use-sandbox-files.ts
|
|
34
40
|
import { useCallback, useEffect, useMemo, useRef, useState } from "react";
|
|
35
|
-
|
|
36
|
-
// src/lib/sandbox-liveness.ts
|
|
37
|
-
function sandboxAcceptsLiveIo(liveness) {
|
|
38
|
-
return liveness === "warm";
|
|
39
|
-
}
|
|
40
|
-
|
|
41
|
-
// src/hooks/use-sandbox-files.ts
|
|
42
41
|
var CapturedFileUnavailableError = class extends Error {
|
|
43
42
|
constructor(path, reason) {
|
|
44
43
|
super(
|
|
@@ -1086,374 +1085,6 @@ function filePathVisibility(nodes, path, predicate, parent = null, depth = 0) {
|
|
|
1086
1085
|
return "unknown";
|
|
1087
1086
|
}
|
|
1088
1087
|
|
|
1089
|
-
// src/components/code-editor.tsx
|
|
1090
|
-
import { Loader2Icon, SaveIcon } from "lucide-react";
|
|
1091
|
-
import {
|
|
1092
|
-
useCallback as useCallback2,
|
|
1093
|
-
useEffect as useEffect2,
|
|
1094
|
-
useMemo as useMemo2,
|
|
1095
|
-
useRef as useRef2,
|
|
1096
|
-
useState as useState2
|
|
1097
|
-
} from "react";
|
|
1098
|
-
import { jsx, jsxs } from "react/jsx-runtime";
|
|
1099
|
-
var LANGUAGE_LOADERS = {
|
|
1100
|
-
javascript: async () => (await import("@codemirror/lang-javascript")).javascript({ jsx: true, typescript: true }),
|
|
1101
|
-
json: async () => (await import("@codemirror/lang-json")).json(),
|
|
1102
|
-
python: async () => (await import("@codemirror/lang-python")).python(),
|
|
1103
|
-
markdown: async () => (await import("@codemirror/lang-markdown")).markdown(),
|
|
1104
|
-
css: async () => (await import("@codemirror/lang-css")).css(),
|
|
1105
|
-
html: async () => (await import("@codemirror/lang-html")).html()
|
|
1106
|
-
};
|
|
1107
|
-
function languageForPath(path) {
|
|
1108
|
-
const name = path.split("/").pop() ?? path;
|
|
1109
|
-
const ext = name.includes(".") ? (name.split(".").pop() ?? "").toLowerCase() : "";
|
|
1110
|
-
switch (ext) {
|
|
1111
|
-
case "js":
|
|
1112
|
-
case "jsx":
|
|
1113
|
-
case "ts":
|
|
1114
|
-
case "tsx":
|
|
1115
|
-
case "mjs":
|
|
1116
|
-
case "cjs":
|
|
1117
|
-
return "javascript";
|
|
1118
|
-
case "json":
|
|
1119
|
-
case "jsonc":
|
|
1120
|
-
return "json";
|
|
1121
|
-
case "py":
|
|
1122
|
-
case "pyi":
|
|
1123
|
-
return "python";
|
|
1124
|
-
case "md":
|
|
1125
|
-
case "markdown":
|
|
1126
|
-
case "mdx":
|
|
1127
|
-
return "markdown";
|
|
1128
|
-
case "css":
|
|
1129
|
-
case "scss":
|
|
1130
|
-
case "less":
|
|
1131
|
-
return "css";
|
|
1132
|
-
case "html":
|
|
1133
|
-
case "htm":
|
|
1134
|
-
case "xml":
|
|
1135
|
-
case "svg":
|
|
1136
|
-
case "vue":
|
|
1137
|
-
return "html";
|
|
1138
|
-
default:
|
|
1139
|
-
return null;
|
|
1140
|
-
}
|
|
1141
|
-
}
|
|
1142
|
-
function reconcileEditorBuffer(current, incoming) {
|
|
1143
|
-
if (current.path === incoming.path && current.value !== current.baseline) {
|
|
1144
|
-
return current;
|
|
1145
|
-
}
|
|
1146
|
-
if (current.path === incoming.path && current.value === incoming.contents && current.baseline === incoming.contents) {
|
|
1147
|
-
return current;
|
|
1148
|
-
}
|
|
1149
|
-
return {
|
|
1150
|
-
path: incoming.path,
|
|
1151
|
-
value: incoming.contents,
|
|
1152
|
-
baseline: incoming.contents
|
|
1153
|
-
};
|
|
1154
|
-
}
|
|
1155
|
-
function CodeEditor({
|
|
1156
|
-
path,
|
|
1157
|
-
initialContents,
|
|
1158
|
-
onSave,
|
|
1159
|
-
onOverwrite,
|
|
1160
|
-
onReload,
|
|
1161
|
-
onEditIntent,
|
|
1162
|
-
readOnly = false,
|
|
1163
|
-
themeType = "dark",
|
|
1164
|
-
loading,
|
|
1165
|
-
fallback,
|
|
1166
|
-
className
|
|
1167
|
-
}) {
|
|
1168
|
-
const [failed, setFailed] = useState2(false);
|
|
1169
|
-
const [bundle, setBundle] = useState2(null);
|
|
1170
|
-
const [buffer, setBuffer] = useState2(() => ({
|
|
1171
|
-
path,
|
|
1172
|
-
value: initialContents,
|
|
1173
|
-
baseline: initialContents
|
|
1174
|
-
}));
|
|
1175
|
-
const { value, baseline } = buffer;
|
|
1176
|
-
const [saving, setSaving] = useState2(false);
|
|
1177
|
-
const [saveError, setSaveError] = useState2(null);
|
|
1178
|
-
const [savedTick, setSavedTick] = useState2(false);
|
|
1179
|
-
const saveInFlightRef = useRef2(false);
|
|
1180
|
-
const dirty = value !== baseline;
|
|
1181
|
-
const saveConflict = saveError !== null && saveError.code === "file_write_conflict";
|
|
1182
|
-
const editIntentFiredRef = useRef2(false);
|
|
1183
|
-
useEffect2(() => {
|
|
1184
|
-
setBuffer((current) => reconcileEditorBuffer(current, { path, contents: initialContents }));
|
|
1185
|
-
}, [path, initialContents]);
|
|
1186
|
-
useEffect2(() => {
|
|
1187
|
-
editIntentFiredRef.current = false;
|
|
1188
|
-
setSaveError(null);
|
|
1189
|
-
setSavedTick(false);
|
|
1190
|
-
}, [path]);
|
|
1191
|
-
const noteEdit = useCallback2(
|
|
1192
|
-
(next) => {
|
|
1193
|
-
setBuffer((current) => ({ ...current, value: next }));
|
|
1194
|
-
setSavedTick(false);
|
|
1195
|
-
if (!editIntentFiredRef.current && next !== baseline) {
|
|
1196
|
-
editIntentFiredRef.current = true;
|
|
1197
|
-
onEditIntent?.();
|
|
1198
|
-
}
|
|
1199
|
-
},
|
|
1200
|
-
[baseline, onEditIntent]
|
|
1201
|
-
);
|
|
1202
|
-
const langKey = useMemo2(() => languageForPath(path), [path]);
|
|
1203
|
-
useEffect2(() => {
|
|
1204
|
-
let cancelled = false;
|
|
1205
|
-
void (async () => {
|
|
1206
|
-
try {
|
|
1207
|
-
const cmMod = await import("@uiw/react-codemirror");
|
|
1208
|
-
let languageExtension = null;
|
|
1209
|
-
if (langKey) {
|
|
1210
|
-
try {
|
|
1211
|
-
languageExtension = await LANGUAGE_LOADERS[langKey]?.() ?? null;
|
|
1212
|
-
} catch {
|
|
1213
|
-
languageExtension = null;
|
|
1214
|
-
}
|
|
1215
|
-
}
|
|
1216
|
-
if (cancelled) return;
|
|
1217
|
-
const saveKeymapExtension = (run) => cmMod.Prec.highest(
|
|
1218
|
-
cmMod.keymap.of([
|
|
1219
|
-
{
|
|
1220
|
-
key: "Mod-s",
|
|
1221
|
-
preventDefault: true,
|
|
1222
|
-
run: () => {
|
|
1223
|
-
run();
|
|
1224
|
-
return true;
|
|
1225
|
-
}
|
|
1226
|
-
}
|
|
1227
|
-
])
|
|
1228
|
-
);
|
|
1229
|
-
setBundle({
|
|
1230
|
-
Editor: cmMod.default,
|
|
1231
|
-
saveKeymapExtension,
|
|
1232
|
-
languageExtension
|
|
1233
|
-
});
|
|
1234
|
-
setFailed(false);
|
|
1235
|
-
} catch {
|
|
1236
|
-
if (!cancelled) setFailed(true);
|
|
1237
|
-
}
|
|
1238
|
-
})();
|
|
1239
|
-
return () => {
|
|
1240
|
-
cancelled = true;
|
|
1241
|
-
};
|
|
1242
|
-
}, [langKey]);
|
|
1243
|
-
const saveRef = useRef2(() => {
|
|
1244
|
-
});
|
|
1245
|
-
const save = useCallback2(async () => {
|
|
1246
|
-
if (readOnly || saveInFlightRef.current) return;
|
|
1247
|
-
const snapshot = value;
|
|
1248
|
-
if (snapshot === baseline) return;
|
|
1249
|
-
saveInFlightRef.current = true;
|
|
1250
|
-
setSaving(true);
|
|
1251
|
-
setSaveError(null);
|
|
1252
|
-
setSavedTick(false);
|
|
1253
|
-
try {
|
|
1254
|
-
await onSave(snapshot, baseline);
|
|
1255
|
-
setBuffer(
|
|
1256
|
-
(current) => current.path === path ? { ...current, baseline: snapshot } : current
|
|
1257
|
-
);
|
|
1258
|
-
setSavedTick(true);
|
|
1259
|
-
} catch (cause) {
|
|
1260
|
-
setSaveError(cause instanceof Error ? cause : new Error(String(cause)));
|
|
1261
|
-
} finally {
|
|
1262
|
-
saveInFlightRef.current = false;
|
|
1263
|
-
setSaving(false);
|
|
1264
|
-
}
|
|
1265
|
-
}, [readOnly, value, baseline, onSave, path]);
|
|
1266
|
-
const overwrite = useCallback2(async () => {
|
|
1267
|
-
if (readOnly || !onOverwrite || saveInFlightRef.current) return;
|
|
1268
|
-
const snapshot = value;
|
|
1269
|
-
if (snapshot === baseline) return;
|
|
1270
|
-
saveInFlightRef.current = true;
|
|
1271
|
-
setSaving(true);
|
|
1272
|
-
setSaveError(null);
|
|
1273
|
-
setSavedTick(false);
|
|
1274
|
-
try {
|
|
1275
|
-
await onOverwrite(snapshot);
|
|
1276
|
-
setBuffer(
|
|
1277
|
-
(current) => current.path === path ? { ...current, baseline: snapshot } : current
|
|
1278
|
-
);
|
|
1279
|
-
setSavedTick(true);
|
|
1280
|
-
} catch (cause) {
|
|
1281
|
-
setSaveError(cause instanceof Error ? cause : new Error(String(cause)));
|
|
1282
|
-
} finally {
|
|
1283
|
-
saveInFlightRef.current = false;
|
|
1284
|
-
setSaving(false);
|
|
1285
|
-
}
|
|
1286
|
-
}, [readOnly, onOverwrite, value, baseline, path]);
|
|
1287
|
-
saveRef.current = () => {
|
|
1288
|
-
void save();
|
|
1289
|
-
};
|
|
1290
|
-
useEffect2(() => {
|
|
1291
|
-
if (!savedTick) return;
|
|
1292
|
-
const t = setTimeout(() => setSavedTick(false), 1800);
|
|
1293
|
-
return () => clearTimeout(t);
|
|
1294
|
-
}, [savedTick]);
|
|
1295
|
-
const fileName = path.split("/").filter(Boolean).pop() ?? path;
|
|
1296
|
-
const cmExtensions = useMemo2(() => {
|
|
1297
|
-
if (!bundle) return [];
|
|
1298
|
-
const exts = [bundle.saveKeymapExtension(() => saveRef.current())];
|
|
1299
|
-
if (bundle.languageExtension) exts.push(bundle.languageExtension);
|
|
1300
|
-
return exts;
|
|
1301
|
-
}, [bundle]);
|
|
1302
|
-
const Editor = bundle?.Editor;
|
|
1303
|
-
const reload = useCallback2(() => {
|
|
1304
|
-
setBuffer({ path, value: initialContents, baseline: initialContents });
|
|
1305
|
-
editIntentFiredRef.current = false;
|
|
1306
|
-
setSaveError(null);
|
|
1307
|
-
setSavedTick(false);
|
|
1308
|
-
onReload?.();
|
|
1309
|
-
}, [initialContents, onReload, path]);
|
|
1310
|
-
return /* @__PURE__ */ jsxs(
|
|
1311
|
-
"div",
|
|
1312
|
-
{
|
|
1313
|
-
className: cn("flex h-full min-h-0 flex-col", className),
|
|
1314
|
-
"data-opengeni-code-editor": true,
|
|
1315
|
-
"data-opengeni-editor-dirty": dirty ? "true" : "false",
|
|
1316
|
-
style: editorVars,
|
|
1317
|
-
children: [
|
|
1318
|
-
/* @__PURE__ */ jsxs("div", { className: "flex min-h-9 shrink-0 items-center gap-2 border-b border-og-border bg-og-surface-1 px-2 py-1", children: [
|
|
1319
|
-
/* @__PURE__ */ jsx(
|
|
1320
|
-
"span",
|
|
1321
|
-
{
|
|
1322
|
-
className: cn(
|
|
1323
|
-
"size-1.5 shrink-0 rounded-full transition-colors",
|
|
1324
|
-
readOnly ? "bg-transparent" : dirty ? "bg-og-status-running" : "bg-og-status-idle"
|
|
1325
|
-
),
|
|
1326
|
-
title: readOnly ? "read-only" : dirty ? "unsaved changes" : "saved"
|
|
1327
|
-
}
|
|
1328
|
-
),
|
|
1329
|
-
/* @__PURE__ */ jsxs("span", { className: "truncate font-og-mono text-og-xs text-og-fg-muted", children: [
|
|
1330
|
-
fileName,
|
|
1331
|
-
dirty && !readOnly ? " \u2022" : ""
|
|
1332
|
-
] }),
|
|
1333
|
-
/* @__PURE__ */ jsxs("div", { className: "ml-auto flex shrink-0 items-center gap-2", children: [
|
|
1334
|
-
saveError && !saveConflict && /* @__PURE__ */ jsx(
|
|
1335
|
-
"span",
|
|
1336
|
-
{
|
|
1337
|
-
className: "max-w-[220px] truncate text-og-xs text-og-status-failed",
|
|
1338
|
-
title: saveError.message,
|
|
1339
|
-
children: saveError.message
|
|
1340
|
-
}
|
|
1341
|
-
),
|
|
1342
|
-
!saveError && savedTick && !dirty && /* @__PURE__ */ jsx("span", { className: "text-og-xs text-og-status-idle", children: "Saved" }),
|
|
1343
|
-
readOnly ? /* @__PURE__ */ jsx("span", { className: "text-og-xs uppercase tracking-wide text-og-fg-subtle", children: "Read-only" }) : !saveConflict ? /* @__PURE__ */ jsxs(
|
|
1344
|
-
"button",
|
|
1345
|
-
{
|
|
1346
|
-
type: "button",
|
|
1347
|
-
onClick: () => void save(),
|
|
1348
|
-
disabled: saving || !dirty,
|
|
1349
|
-
className: cn(
|
|
1350
|
-
"flex items-center gap-1 rounded-og-sm border border-og-border px-1.5 py-0.5 text-og-xs pointer-coarse:min-h-11",
|
|
1351
|
-
saving || !dirty ? "cursor-default text-og-fg-subtle opacity-60" : "text-og-fg hover:bg-og-accent-soft"
|
|
1352
|
-
),
|
|
1353
|
-
title: "Save (\u2318/Ctrl+S)",
|
|
1354
|
-
children: [
|
|
1355
|
-
saving ? /* @__PURE__ */ jsx(Loader2Icon, { className: "size-3 animate-spin" }) : /* @__PURE__ */ jsx(SaveIcon, { className: "size-3" }),
|
|
1356
|
-
"Save"
|
|
1357
|
-
]
|
|
1358
|
-
}
|
|
1359
|
-
) : null
|
|
1360
|
-
] })
|
|
1361
|
-
] }),
|
|
1362
|
-
saveConflict ? /* @__PURE__ */ jsxs(
|
|
1363
|
-
"div",
|
|
1364
|
-
{
|
|
1365
|
-
className: "flex shrink-0 flex-wrap items-center gap-x-3 gap-y-2 border-b border-og-status-failed/25 bg-og-status-failed/8 px-2 py-2",
|
|
1366
|
-
role: "alert",
|
|
1367
|
-
children: [
|
|
1368
|
-
/* @__PURE__ */ jsxs("div", { className: "min-w-[12rem] flex-1 text-og-xs text-og-fg-muted", children: [
|
|
1369
|
-
/* @__PURE__ */ jsx("span", { className: "font-medium text-og-status-failed", children: "File changed on machine." }),
|
|
1370
|
-
" ",
|
|
1371
|
-
"Reloading discards your edits; overwriting replaces the live version."
|
|
1372
|
-
] }),
|
|
1373
|
-
/* @__PURE__ */ jsxs("div", { className: "ml-auto flex shrink-0 items-center gap-1.5", children: [
|
|
1374
|
-
onReload ? /* @__PURE__ */ jsx(
|
|
1375
|
-
"button",
|
|
1376
|
-
{
|
|
1377
|
-
type: "button",
|
|
1378
|
-
onClick: () => {
|
|
1379
|
-
reload();
|
|
1380
|
-
},
|
|
1381
|
-
className: "min-h-8 rounded-og-sm border border-og-border bg-og-surface-1 px-2 text-og-xs font-medium text-og-fg hover:bg-og-surface-2 pointer-coarse:min-h-11",
|
|
1382
|
-
children: "Reload live"
|
|
1383
|
-
}
|
|
1384
|
-
) : null,
|
|
1385
|
-
onOverwrite ? /* @__PURE__ */ jsx(
|
|
1386
|
-
"button",
|
|
1387
|
-
{
|
|
1388
|
-
type: "button",
|
|
1389
|
-
onClick: () => void overwrite(),
|
|
1390
|
-
disabled: saving,
|
|
1391
|
-
className: "min-h-8 rounded-og-sm border border-og-status-failed/40 px-2 text-og-xs font-medium text-og-status-failed hover:bg-og-status-failed/10 disabled:opacity-50 pointer-coarse:min-h-11",
|
|
1392
|
-
children: "Overwrite"
|
|
1393
|
-
}
|
|
1394
|
-
) : null
|
|
1395
|
-
] })
|
|
1396
|
-
]
|
|
1397
|
-
}
|
|
1398
|
-
) : null,
|
|
1399
|
-
/* @__PURE__ */ jsx("div", { className: "min-h-0 flex-1 overflow-auto", children: failed ? fallback ?? /* @__PURE__ */ jsx(
|
|
1400
|
-
PlainTextarea,
|
|
1401
|
-
{
|
|
1402
|
-
value,
|
|
1403
|
-
readOnly,
|
|
1404
|
-
onChange: noteEdit,
|
|
1405
|
-
onSave: () => void save()
|
|
1406
|
-
}
|
|
1407
|
-
) : Editor ? /* @__PURE__ */ jsx(
|
|
1408
|
-
Editor,
|
|
1409
|
-
{
|
|
1410
|
-
value,
|
|
1411
|
-
theme: themeType === "light" ? "light" : "dark",
|
|
1412
|
-
editable: !readOnly,
|
|
1413
|
-
readOnly,
|
|
1414
|
-
basicSetup: true,
|
|
1415
|
-
extensions: cmExtensions,
|
|
1416
|
-
height: "100%",
|
|
1417
|
-
className: "og-cm-editor min-h-full text-og-sm",
|
|
1418
|
-
onChange: readOnly ? void 0 : noteEdit
|
|
1419
|
-
}
|
|
1420
|
-
) : loading ?? /* @__PURE__ */ jsx(EditorSkeleton, {}) })
|
|
1421
|
-
]
|
|
1422
|
-
}
|
|
1423
|
-
);
|
|
1424
|
-
}
|
|
1425
|
-
var editorVars = {
|
|
1426
|
-
"--og-cm-bg": "var(--og-color-bg)",
|
|
1427
|
-
fontFamily: "var(--og-font-mono)"
|
|
1428
|
-
};
|
|
1429
|
-
function PlainTextarea({
|
|
1430
|
-
value,
|
|
1431
|
-
readOnly,
|
|
1432
|
-
onChange,
|
|
1433
|
-
onSave
|
|
1434
|
-
}) {
|
|
1435
|
-
return /* @__PURE__ */ jsx(
|
|
1436
|
-
"textarea",
|
|
1437
|
-
{
|
|
1438
|
-
value,
|
|
1439
|
-
readOnly,
|
|
1440
|
-
spellCheck: false,
|
|
1441
|
-
onChange: (e) => onChange(e.target.value),
|
|
1442
|
-
onKeyDown: (event) => {
|
|
1443
|
-
if ((event.metaKey || event.ctrlKey) && event.key.toLowerCase() === "s") {
|
|
1444
|
-
event.preventDefault();
|
|
1445
|
-
onSave();
|
|
1446
|
-
}
|
|
1447
|
-
},
|
|
1448
|
-
"aria-label": "Plain text file editor",
|
|
1449
|
-
className: "h-full w-full resize-none bg-transparent p-2 font-og-mono text-og-sm text-og-fg outline-hidden"
|
|
1450
|
-
}
|
|
1451
|
-
);
|
|
1452
|
-
}
|
|
1453
|
-
function EditorSkeleton() {
|
|
1454
|
-
return /* @__PURE__ */ jsx("div", { className: "p-3 text-og-sm text-og-fg-subtle", children: "Loading editor\u2026" });
|
|
1455
|
-
}
|
|
1456
|
-
|
|
1457
1088
|
// src/components/file-browser.tsx
|
|
1458
1089
|
import {
|
|
1459
1090
|
ChevronRightIcon,
|
|
@@ -1467,24 +1098,24 @@ import {
|
|
|
1467
1098
|
Trash2Icon
|
|
1468
1099
|
} from "lucide-react";
|
|
1469
1100
|
import {
|
|
1470
|
-
useCallback as
|
|
1471
|
-
useEffect as
|
|
1101
|
+
useCallback as useCallback2,
|
|
1102
|
+
useEffect as useEffect3,
|
|
1472
1103
|
useId,
|
|
1473
1104
|
useLayoutEffect,
|
|
1474
|
-
useMemo as
|
|
1475
|
-
useRef as
|
|
1476
|
-
useState as
|
|
1105
|
+
useMemo as useMemo3,
|
|
1106
|
+
useRef as useRef2,
|
|
1107
|
+
useState as useState2
|
|
1477
1108
|
} from "react";
|
|
1478
1109
|
import { AlertDialog } from "radix-ui";
|
|
1479
1110
|
import { VList } from "virtua";
|
|
1480
1111
|
|
|
1481
1112
|
// src/lib/use-unicode-fonts.ts
|
|
1482
|
-
import { useEffect as
|
|
1113
|
+
import { useEffect as useEffect2, useMemo as useMemo2 } from "react";
|
|
1483
1114
|
var japaneseScript = /[\u3040-\u30ff\u3400-\u4dbf\u4e00-\u9fff\uf900-\ufaff]/u;
|
|
1484
1115
|
var arabicScript = /[\u0600-\u06ff\u0750-\u077f\u0870-\u08ff\ufb50-\ufdff\ufe70-\ufefc]/u;
|
|
1485
1116
|
function useUnicodeFallbackFonts(values) {
|
|
1486
|
-
const content =
|
|
1487
|
-
|
|
1117
|
+
const content = useMemo2(() => collectUnicodeContent(values), [values]);
|
|
1118
|
+
useEffect2(() => {
|
|
1488
1119
|
if (content.japanese) {
|
|
1489
1120
|
void import("./noto-sans-jp-loader.generated-HFGLYBR3.js").then(({ loadNotoSansJp }) => loadNotoSansJp(content.japanese)).catch(() => void 0);
|
|
1490
1121
|
}
|
|
@@ -1506,7 +1137,7 @@ function collectUnicodeContent(values) {
|
|
|
1506
1137
|
}
|
|
1507
1138
|
|
|
1508
1139
|
// src/components/file-browser.tsx
|
|
1509
|
-
import { Fragment, jsx
|
|
1140
|
+
import { Fragment, jsx, jsxs } from "react/jsx-runtime";
|
|
1510
1141
|
var STATUS_TINT = {
|
|
1511
1142
|
added: "text-og-status-idle",
|
|
1512
1143
|
modified: "text-og-status-running",
|
|
@@ -1514,7 +1145,7 @@ var STATUS_TINT = {
|
|
|
1514
1145
|
renamed: "text-og-accent",
|
|
1515
1146
|
untracked: "text-og-fg-subtle"
|
|
1516
1147
|
};
|
|
1517
|
-
var useBrowserLayoutEffect = typeof window === "undefined" ?
|
|
1148
|
+
var useBrowserLayoutEffect = typeof window === "undefined" ? useEffect3 : useLayoutEffect;
|
|
1518
1149
|
function parentOf2(path) {
|
|
1519
1150
|
const i = path.lastIndexOf("/");
|
|
1520
1151
|
return i <= 0 ? "" : path.slice(0, i);
|
|
@@ -1584,30 +1215,30 @@ function FileBrowser({
|
|
|
1584
1215
|
confirmDelete,
|
|
1585
1216
|
className
|
|
1586
1217
|
}) {
|
|
1587
|
-
const [expanded, setExpanded] =
|
|
1588
|
-
const [loadingPaths, setLoadingPaths] =
|
|
1589
|
-
const [active, setActive] =
|
|
1590
|
-
const [draftCreate, setDraftCreate] =
|
|
1591
|
-
const [draftRename, setDraftRename] =
|
|
1592
|
-
const [dragOver, setDragOver] =
|
|
1593
|
-
const [menu, setMenu] =
|
|
1594
|
-
const [pendingDelete, setPendingDelete] =
|
|
1595
|
-
const [busy, setBusy] =
|
|
1596
|
-
const [coarsePointer, setCoarsePointer] =
|
|
1597
|
-
const [revealRequest, setRevealRequest] =
|
|
1598
|
-
const handledRevealRequestRef =
|
|
1599
|
-
const attemptedRevealPathsRef =
|
|
1218
|
+
const [expanded, setExpanded] = useState2(/* @__PURE__ */ new Set());
|
|
1219
|
+
const [loadingPaths, setLoadingPaths] = useState2(/* @__PURE__ */ new Set());
|
|
1220
|
+
const [active, setActive] = useState2(null);
|
|
1221
|
+
const [draftCreate, setDraftCreate] = useState2(null);
|
|
1222
|
+
const [draftRename, setDraftRename] = useState2(null);
|
|
1223
|
+
const [dragOver, setDragOver] = useState2(null);
|
|
1224
|
+
const [menu, setMenu] = useState2(null);
|
|
1225
|
+
const [pendingDelete, setPendingDelete] = useState2(null);
|
|
1226
|
+
const [busy, setBusy] = useState2(false);
|
|
1227
|
+
const [coarsePointer, setCoarsePointer] = useState2(false);
|
|
1228
|
+
const [revealRequest, setRevealRequest] = useState2(null);
|
|
1229
|
+
const handledRevealRequestRef = useRef2(null);
|
|
1230
|
+
const attemptedRevealPathsRef = useRef2(/* @__PURE__ */ new Set());
|
|
1600
1231
|
const treeId = useId();
|
|
1601
1232
|
const container = usePortalTokenSource();
|
|
1602
1233
|
const containerRef = container.currentRef;
|
|
1603
|
-
const deleteReturnFocusRef =
|
|
1604
|
-
const vlistRef =
|
|
1234
|
+
const deleteReturnFocusRef = useRef2(null);
|
|
1235
|
+
const vlistRef = useRef2(null);
|
|
1605
1236
|
const portalTokenStyle = usePortalTokenStyle(container.source);
|
|
1606
|
-
const getTreeElement =
|
|
1237
|
+
const getTreeElement = useCallback2(
|
|
1607
1238
|
() => typeof document === "undefined" ? null : document.getElementById(treeId),
|
|
1608
1239
|
[treeId]
|
|
1609
1240
|
);
|
|
1610
|
-
const visibleTree =
|
|
1241
|
+
const visibleTree = useMemo3(
|
|
1611
1242
|
() => visibleFileTree(result.tree, isNodeVisible),
|
|
1612
1243
|
[isNodeVisible, result.tree]
|
|
1613
1244
|
);
|
|
@@ -1626,7 +1257,7 @@ function FileBrowser({
|
|
|
1626
1257
|
}
|
|
1627
1258
|
}, []);
|
|
1628
1259
|
const effectiveRevealRequestId = revealPath ? revealPathRequestId ?? revealPath : null;
|
|
1629
|
-
|
|
1260
|
+
useEffect3(() => {
|
|
1630
1261
|
if (!revealPath || effectiveRevealRequestId === null) {
|
|
1631
1262
|
setRevealRequest(null);
|
|
1632
1263
|
return;
|
|
@@ -1643,10 +1274,10 @@ function FileBrowser({
|
|
|
1643
1274
|
}, [effectiveRevealRequestId, revealPath]);
|
|
1644
1275
|
const visibleActive = active && findNode(visibleTree, active) ? active : null;
|
|
1645
1276
|
const cursor = visibleActive ?? (selectedPath && findNode(visibleTree, selectedPath) ? selectedPath : null);
|
|
1646
|
-
|
|
1277
|
+
useEffect3(() => {
|
|
1647
1278
|
if (active !== null && visibleActive === null) setActive(null);
|
|
1648
1279
|
}, [active, visibleActive]);
|
|
1649
|
-
const expand =
|
|
1280
|
+
const expand = useCallback2(
|
|
1650
1281
|
async (path) => {
|
|
1651
1282
|
const node = findNode(visibleTree, path);
|
|
1652
1283
|
if (node && node.kind === "dir" && node.children === void 0) {
|
|
@@ -1664,14 +1295,14 @@ function FileBrowser({
|
|
|
1664
1295
|
},
|
|
1665
1296
|
[result, visibleTree]
|
|
1666
1297
|
);
|
|
1667
|
-
const open =
|
|
1298
|
+
const open = useCallback2(
|
|
1668
1299
|
(path) => {
|
|
1669
1300
|
setExpanded((prev) => new Set(prev).add(path));
|
|
1670
1301
|
void expand(path);
|
|
1671
1302
|
},
|
|
1672
1303
|
[expand]
|
|
1673
1304
|
);
|
|
1674
|
-
|
|
1305
|
+
useEffect3(() => {
|
|
1675
1306
|
if (!revealRequest) return;
|
|
1676
1307
|
const trace = traceRevealPath(visibleTree, revealRequest.path);
|
|
1677
1308
|
if (trace.directories.length > 0) {
|
|
@@ -1693,7 +1324,7 @@ function FileBrowser({
|
|
|
1693
1324
|
attemptedRevealPathsRef.current.add(frontier);
|
|
1694
1325
|
void expand(frontier);
|
|
1695
1326
|
}, [expand, loadingPaths, result.expandingPaths, revealRequest, visibleTree]);
|
|
1696
|
-
const toggle =
|
|
1327
|
+
const toggle = useCallback2(
|
|
1697
1328
|
async (node) => {
|
|
1698
1329
|
if (node.kind !== "dir") return;
|
|
1699
1330
|
const isOpen = expanded.has(node.path);
|
|
@@ -1708,7 +1339,7 @@ function FileBrowser({
|
|
|
1708
1339
|
[expanded, expand]
|
|
1709
1340
|
);
|
|
1710
1341
|
const cold = result.source !== "live";
|
|
1711
|
-
const renderItems =
|
|
1342
|
+
const renderItems = useMemo3(() => {
|
|
1712
1343
|
const items = [];
|
|
1713
1344
|
if (draftCreate && draftCreate.parent === "") {
|
|
1714
1345
|
items.push({ type: "create", parent: "", kind: draftCreate.kind, depth: 0 });
|
|
@@ -1739,22 +1370,22 @@ function FileBrowser({
|
|
|
1739
1370
|
walk(visibleTree, 0);
|
|
1740
1371
|
return items;
|
|
1741
1372
|
}, [visibleTree, expanded, draftCreate, loadingPaths, result.expandingPaths, cold]);
|
|
1742
|
-
const unicodeFontPaths =
|
|
1373
|
+
const unicodeFontPaths = useMemo3(
|
|
1743
1374
|
() => renderItems.flatMap((item) => item.type === "node" ? [item.node.path] : []),
|
|
1744
1375
|
[renderItems]
|
|
1745
1376
|
);
|
|
1746
1377
|
useUnicodeFallbackFonts(unicodeFontPaths);
|
|
1747
|
-
const flatRows =
|
|
1378
|
+
const flatRows = useMemo3(
|
|
1748
1379
|
() => renderItems.flatMap(
|
|
1749
1380
|
(item) => item.type === "node" ? [{ node: item.node, depth: item.depth }] : []
|
|
1750
1381
|
),
|
|
1751
1382
|
[renderItems]
|
|
1752
1383
|
);
|
|
1753
|
-
const rowIndexByPath =
|
|
1384
|
+
const rowIndexByPath = useMemo3(
|
|
1754
1385
|
() => new Map(flatRows.map((row, index) => [row.node.path, index])),
|
|
1755
1386
|
[flatRows]
|
|
1756
1387
|
);
|
|
1757
|
-
const treePositionByPath =
|
|
1388
|
+
const treePositionByPath = useMemo3(() => {
|
|
1758
1389
|
const positions = /* @__PURE__ */ new Map();
|
|
1759
1390
|
const visit = (nodes) => {
|
|
1760
1391
|
nodes.forEach((node, index) => {
|
|
@@ -1768,7 +1399,7 @@ function FileBrowser({
|
|
|
1768
1399
|
const cursorIndex = cursor ? rowIndexByPath.get(cursor) ?? -1 : -1;
|
|
1769
1400
|
const activeDescendantId = cursorIndex >= 0 ? `${treeId}-item-${cursorIndex}` : void 0;
|
|
1770
1401
|
const supportsMutation = editable && result.source === "live" && result.error === null && !result.loading;
|
|
1771
|
-
const performDelete =
|
|
1402
|
+
const performDelete = useCallback2(
|
|
1772
1403
|
async (node) => {
|
|
1773
1404
|
if (!supportsMutation) return;
|
|
1774
1405
|
const recursive = node.kind === "dir";
|
|
@@ -1782,7 +1413,7 @@ function FileBrowser({
|
|
|
1782
1413
|
},
|
|
1783
1414
|
[supportsMutation, result]
|
|
1784
1415
|
);
|
|
1785
|
-
const runDelete =
|
|
1416
|
+
const runDelete = useCallback2(
|
|
1786
1417
|
async (node, returnFocus) => {
|
|
1787
1418
|
if (!supportsMutation) return;
|
|
1788
1419
|
setMenu(null);
|
|
@@ -1795,7 +1426,7 @@ function FileBrowser({
|
|
|
1795
1426
|
},
|
|
1796
1427
|
[supportsMutation, confirmDelete, performDelete]
|
|
1797
1428
|
);
|
|
1798
|
-
const closePendingDelete =
|
|
1429
|
+
const closePendingDelete = useCallback2(
|
|
1799
1430
|
(restoreTrigger) => {
|
|
1800
1431
|
const returnTarget = restoreTrigger ? deleteReturnFocusRef.current : getTreeElement();
|
|
1801
1432
|
deleteReturnFocusRef.current = null;
|
|
@@ -1809,7 +1440,7 @@ function FileBrowser({
|
|
|
1809
1440
|
},
|
|
1810
1441
|
[getTreeElement]
|
|
1811
1442
|
);
|
|
1812
|
-
const commitCreate =
|
|
1443
|
+
const commitCreate = useCallback2(
|
|
1813
1444
|
async (name) => {
|
|
1814
1445
|
const draft = draftCreate;
|
|
1815
1446
|
setDraftCreate(null);
|
|
@@ -1834,7 +1465,7 @@ function FileBrowser({
|
|
|
1834
1465
|
},
|
|
1835
1466
|
[draftCreate, supportsMutation, result, open, onSelectFile]
|
|
1836
1467
|
);
|
|
1837
|
-
const commitRename =
|
|
1468
|
+
const commitRename = useCallback2(
|
|
1838
1469
|
async (name) => {
|
|
1839
1470
|
const draft = draftRename;
|
|
1840
1471
|
setDraftRename(null);
|
|
@@ -1857,7 +1488,7 @@ function FileBrowser({
|
|
|
1857
1488
|
},
|
|
1858
1489
|
[draftRename, supportsMutation, result, selectedPath, active, onSelectFile, visibleTree]
|
|
1859
1490
|
);
|
|
1860
|
-
const startCreate =
|
|
1491
|
+
const startCreate = useCallback2(
|
|
1861
1492
|
(kind) => {
|
|
1862
1493
|
if (!supportsMutation) return;
|
|
1863
1494
|
const anchor = cursor ? findNode(visibleTree, cursor) : void 0;
|
|
@@ -1869,7 +1500,7 @@ function FileBrowser({
|
|
|
1869
1500
|
},
|
|
1870
1501
|
[supportsMutation, cursor, open, visibleTree]
|
|
1871
1502
|
);
|
|
1872
|
-
const startRename =
|
|
1503
|
+
const startRename = useCallback2(
|
|
1873
1504
|
(node) => {
|
|
1874
1505
|
if (!supportsMutation) return;
|
|
1875
1506
|
setDraftCreate(null);
|
|
@@ -1878,7 +1509,7 @@ function FileBrowser({
|
|
|
1878
1509
|
},
|
|
1879
1510
|
[supportsMutation]
|
|
1880
1511
|
);
|
|
1881
|
-
const onDropOnto =
|
|
1512
|
+
const onDropOnto = useCallback2(
|
|
1882
1513
|
async (targetDir, sourcePath) => {
|
|
1883
1514
|
setDragOver(null);
|
|
1884
1515
|
if (!supportsMutation || !sourcePath) return;
|
|
@@ -1902,7 +1533,7 @@ function FileBrowser({
|
|
|
1902
1533
|
},
|
|
1903
1534
|
[supportsMutation, result, selectedPath, active, onSelectFile, visibleTree]
|
|
1904
1535
|
);
|
|
1905
|
-
const onKeyDown =
|
|
1536
|
+
const onKeyDown = useCallback2(
|
|
1906
1537
|
(e) => {
|
|
1907
1538
|
if (draftCreate || draftRename) return;
|
|
1908
1539
|
if (flatRows.length === 0) return;
|
|
@@ -2021,7 +1652,7 @@ function FileBrowser({
|
|
|
2021
1652
|
treeId
|
|
2022
1653
|
]
|
|
2023
1654
|
);
|
|
2024
|
-
|
|
1655
|
+
useEffect3(() => {
|
|
2025
1656
|
if (!menu) return;
|
|
2026
1657
|
const close = () => setMenu(null);
|
|
2027
1658
|
window.addEventListener("click", close);
|
|
@@ -2041,7 +1672,7 @@ function FileBrowser({
|
|
|
2041
1672
|
const renderNodeRow = (node, depth) => {
|
|
2042
1673
|
const isOpen = expanded.has(node.path);
|
|
2043
1674
|
if (renderNode) {
|
|
2044
|
-
return /* @__PURE__ */
|
|
1675
|
+
return /* @__PURE__ */ jsx("div", { children: renderNode(node, depth, isOpen) });
|
|
2045
1676
|
}
|
|
2046
1677
|
const isDir = node.kind === "dir";
|
|
2047
1678
|
const isSelected = node.path === selectedPath || node.path === active;
|
|
@@ -2051,7 +1682,7 @@ function FileBrowser({
|
|
|
2051
1682
|
const isDropTarget = dragOver === (isDir ? node.path : parentOf2(node.path));
|
|
2052
1683
|
const dropDir = isDir ? node.path : parentOf2(node.path);
|
|
2053
1684
|
const treePosition = treePositionByPath.get(node.path);
|
|
2054
|
-
return /* @__PURE__ */
|
|
1685
|
+
return /* @__PURE__ */ jsx(
|
|
2055
1686
|
"div",
|
|
2056
1687
|
{
|
|
2057
1688
|
id: `${treeId}-item-${rowIndexByPath.get(node.path) ?? 0}`,
|
|
@@ -2077,7 +1708,7 @@ function FileBrowser({
|
|
|
2077
1708
|
const src = e.dataTransfer.getData("text/og-path");
|
|
2078
1709
|
void onDropOnto(dropDir, src);
|
|
2079
1710
|
} : void 0,
|
|
2080
|
-
children: isRenaming ? /* @__PURE__ */
|
|
1711
|
+
children: isRenaming ? /* @__PURE__ */ jsx(
|
|
2081
1712
|
InlineInput,
|
|
2082
1713
|
{
|
|
2083
1714
|
depth,
|
|
@@ -2086,7 +1717,7 @@ function FileBrowser({
|
|
|
2086
1717
|
onCommit: (name) => void commitRename(name),
|
|
2087
1718
|
onCancel: () => setDraftRename(null)
|
|
2088
1719
|
}
|
|
2089
|
-
) : /* @__PURE__ */
|
|
1720
|
+
) : /* @__PURE__ */ jsxs(
|
|
2090
1721
|
"button",
|
|
2091
1722
|
{
|
|
2092
1723
|
type: "button",
|
|
@@ -2120,7 +1751,7 @@ function FileBrowser({
|
|
|
2120
1751
|
),
|
|
2121
1752
|
style: { paddingLeft: `${depth * 12 + 4}px` },
|
|
2122
1753
|
children: [
|
|
2123
|
-
isDir ? /* @__PURE__ */
|
|
1754
|
+
isDir ? /* @__PURE__ */ jsx(
|
|
2124
1755
|
ChevronRightIcon,
|
|
2125
1756
|
{
|
|
2126
1757
|
className: cn(
|
|
@@ -2129,10 +1760,10 @@ function FileBrowser({
|
|
|
2129
1760
|
isLoading && "text-og-accent"
|
|
2130
1761
|
)
|
|
2131
1762
|
}
|
|
2132
|
-
) : /* @__PURE__ */
|
|
2133
|
-
isDir ? /* @__PURE__ */
|
|
2134
|
-
/* @__PURE__ */
|
|
2135
|
-
supportsMutation && /* @__PURE__ */
|
|
1763
|
+
) : /* @__PURE__ */ jsx("span", { className: "inline-block w-3 shrink-0" }),
|
|
1764
|
+
isDir ? /* @__PURE__ */ jsx(FolderIcon, { className: "size-3.5 shrink-0" }) : /* @__PURE__ */ jsx(FileIcon, { className: "size-3.5 shrink-0" }),
|
|
1765
|
+
/* @__PURE__ */ jsx("span", { className: "truncate", children: node.name }),
|
|
1766
|
+
supportsMutation && /* @__PURE__ */ jsx(
|
|
2136
1767
|
"span",
|
|
2137
1768
|
{
|
|
2138
1769
|
role: "button",
|
|
@@ -2160,7 +1791,7 @@ function FileBrowser({
|
|
|
2160
1791
|
case "node":
|
|
2161
1792
|
return renderNodeRow(item.node, item.depth);
|
|
2162
1793
|
case "create":
|
|
2163
|
-
return /* @__PURE__ */
|
|
1794
|
+
return /* @__PURE__ */ jsx(
|
|
2164
1795
|
InlineInput,
|
|
2165
1796
|
{
|
|
2166
1797
|
depth: item.depth,
|
|
@@ -2171,14 +1802,14 @@ function FileBrowser({
|
|
|
2171
1802
|
}
|
|
2172
1803
|
);
|
|
2173
1804
|
case "skeleton":
|
|
2174
|
-
return /* @__PURE__ */
|
|
1805
|
+
return /* @__PURE__ */ jsx(
|
|
2175
1806
|
"div",
|
|
2176
1807
|
{
|
|
2177
1808
|
role: "group",
|
|
2178
1809
|
"aria-hidden": true,
|
|
2179
1810
|
style: { paddingLeft: `${item.depth * 12 + 4}px` },
|
|
2180
1811
|
className: "space-y-1 py-1",
|
|
2181
|
-
children: [0, 1, 2].map((i) => /* @__PURE__ */
|
|
1812
|
+
children: [0, 1, 2].map((i) => /* @__PURE__ */ jsx(
|
|
2182
1813
|
"div",
|
|
2183
1814
|
{
|
|
2184
1815
|
className: "h-2.5 animate-pulse rounded-og-sm bg-og-surface-2",
|
|
@@ -2189,25 +1820,25 @@ function FileBrowser({
|
|
|
2189
1820
|
}
|
|
2190
1821
|
);
|
|
2191
1822
|
case "residue":
|
|
2192
|
-
return /* @__PURE__ */
|
|
1823
|
+
return /* @__PURE__ */ jsxs(
|
|
2193
1824
|
"div",
|
|
2194
1825
|
{
|
|
2195
1826
|
style: { paddingLeft: `${item.depth * 12 + 4}px` },
|
|
2196
1827
|
className: "flex items-center gap-1.5 py-0.5 pr-1 text-og-xs italic text-og-fg-subtle",
|
|
2197
1828
|
children: [
|
|
2198
|
-
/* @__PURE__ */
|
|
2199
|
-
/* @__PURE__ */
|
|
1829
|
+
/* @__PURE__ */ jsx("span", { className: "inline-block w-3 shrink-0" }),
|
|
1830
|
+
/* @__PURE__ */ jsx("span", { className: "min-w-0 truncate", children: "contents on machine \u2014 open when live" })
|
|
2200
1831
|
]
|
|
2201
1832
|
}
|
|
2202
1833
|
);
|
|
2203
1834
|
}
|
|
2204
1835
|
};
|
|
2205
|
-
|
|
1836
|
+
useEffect3(() => {
|
|
2206
1837
|
if (!cursor) return;
|
|
2207
1838
|
const index = renderItems.findIndex((it) => it.type === "node" && it.node.path === cursor);
|
|
2208
1839
|
if (index >= 0) vlistRef.current?.scrollToIndex(index);
|
|
2209
1840
|
}, [cursor, renderItems]);
|
|
2210
|
-
|
|
1841
|
+
useEffect3(() => {
|
|
2211
1842
|
if (!revealRequest) return;
|
|
2212
1843
|
const index = renderItems.findIndex(
|
|
2213
1844
|
(item) => item.type === "node" && item.node.path === revealRequest.path
|
|
@@ -2222,18 +1853,18 @@ function FileBrowser({
|
|
|
2222
1853
|
(current) => current?.path === revealRequest.path && current.requestId === revealRequest.requestId ? null : current
|
|
2223
1854
|
);
|
|
2224
1855
|
}, [renderItems, revealRequest, treeId, usesVirtualTree]);
|
|
2225
|
-
return /* @__PURE__ */
|
|
2226
|
-
showToolbar && /* @__PURE__ */
|
|
1856
|
+
return /* @__PURE__ */ jsxs("div", { className: cn("flex min-h-0 min-w-0 flex-col", className), children: [
|
|
1857
|
+
showToolbar && /* @__PURE__ */ jsxs(
|
|
2227
1858
|
"div",
|
|
2228
1859
|
{
|
|
2229
1860
|
role: "toolbar",
|
|
2230
1861
|
"aria-label": "File actions",
|
|
2231
1862
|
className: "flex shrink-0 flex-wrap items-center gap-0.5 border-b border-og-border px-1 py-1",
|
|
2232
1863
|
children: [
|
|
2233
|
-
supportsMutation ? /* @__PURE__ */
|
|
2234
|
-
/* @__PURE__ */
|
|
2235
|
-
/* @__PURE__ */
|
|
2236
|
-
/* @__PURE__ */
|
|
1864
|
+
supportsMutation ? /* @__PURE__ */ jsxs(Fragment, { children: [
|
|
1865
|
+
/* @__PURE__ */ jsx(ToolbarButton, { label: "New file", onClick: () => startCreate("file"), disabled: busy, children: /* @__PURE__ */ jsx(FilePlusIcon, { className: "size-3.5" }) }),
|
|
1866
|
+
/* @__PURE__ */ jsx(ToolbarButton, { label: "New folder", onClick: () => startCreate("dir"), disabled: busy, children: /* @__PURE__ */ jsx(FolderPlusIcon, { className: "size-3.5" }) }),
|
|
1867
|
+
/* @__PURE__ */ jsx(
|
|
2237
1868
|
ToolbarButton,
|
|
2238
1869
|
{
|
|
2239
1870
|
label: "Rename",
|
|
@@ -2242,10 +1873,10 @@ function FileBrowser({
|
|
|
2242
1873
|
if (node) startRename(node);
|
|
2243
1874
|
},
|
|
2244
1875
|
disabled: busy || !cursor,
|
|
2245
|
-
children: /* @__PURE__ */
|
|
1876
|
+
children: /* @__PURE__ */ jsx(PencilIcon, { className: "size-3.5" })
|
|
2246
1877
|
}
|
|
2247
1878
|
),
|
|
2248
|
-
/* @__PURE__ */
|
|
1879
|
+
/* @__PURE__ */ jsx(
|
|
2249
1880
|
ToolbarButton,
|
|
2250
1881
|
{
|
|
2251
1882
|
label: "Delete",
|
|
@@ -2254,24 +1885,24 @@ function FileBrowser({
|
|
|
2254
1885
|
if (node) void runDelete(node, event.currentTarget);
|
|
2255
1886
|
},
|
|
2256
1887
|
disabled: busy || !cursor,
|
|
2257
|
-
children: /* @__PURE__ */
|
|
1888
|
+
children: /* @__PURE__ */ jsx(Trash2Icon, { className: "size-3.5" })
|
|
2258
1889
|
}
|
|
2259
1890
|
)
|
|
2260
1891
|
] }) : null,
|
|
2261
|
-
/* @__PURE__ */
|
|
2262
|
-
/* @__PURE__ */
|
|
1892
|
+
/* @__PURE__ */ jsx("span", { className: "ml-auto" }),
|
|
1893
|
+
/* @__PURE__ */ jsx(
|
|
2263
1894
|
ToolbarButton,
|
|
2264
1895
|
{
|
|
2265
1896
|
label: "Refresh",
|
|
2266
1897
|
onClick: () => void result.refresh(),
|
|
2267
1898
|
disabled: busy || result.loading,
|
|
2268
|
-
children: /* @__PURE__ */
|
|
1899
|
+
children: /* @__PURE__ */ jsx(RefreshCwIcon, { className: cn("size-3.5", result.loading && "animate-spin") })
|
|
2269
1900
|
}
|
|
2270
1901
|
)
|
|
2271
1902
|
]
|
|
2272
1903
|
}
|
|
2273
1904
|
),
|
|
2274
|
-
showDegradedTree ? /* @__PURE__ */
|
|
1905
|
+
showDegradedTree ? /* @__PURE__ */ jsxs(
|
|
2275
1906
|
"div",
|
|
2276
1907
|
{
|
|
2277
1908
|
role: "status",
|
|
@@ -2279,9 +1910,9 @@ function FileBrowser({
|
|
|
2279
1910
|
"data-opengeni-files-degraded": true,
|
|
2280
1911
|
className: "flex shrink-0 items-center gap-2 border-b border-og-status-running/30 bg-og-status-running/10 px-2 py-1.5 text-og-xs text-og-fg-muted",
|
|
2281
1912
|
children: [
|
|
2282
|
-
/* @__PURE__ */
|
|
2283
|
-
/* @__PURE__ */
|
|
2284
|
-
/* @__PURE__ */
|
|
1913
|
+
/* @__PURE__ */ jsx(TriangleAlertIcon, { className: "size-3.5 shrink-0 text-og-status-running", "aria-hidden": true }),
|
|
1914
|
+
/* @__PURE__ */ jsx("span", { className: "min-w-0 flex-1", children: result.source === "capture" ? "Live files are temporarily unavailable. Showing the latest captured revision." : "Live refresh failed. Showing the last loaded files." }),
|
|
1915
|
+
/* @__PURE__ */ jsxs(
|
|
2285
1916
|
"button",
|
|
2286
1917
|
{
|
|
2287
1918
|
type: "button",
|
|
@@ -2289,7 +1920,7 @@ function FileBrowser({
|
|
|
2289
1920
|
disabled: result.loading,
|
|
2290
1921
|
className: "inline-flex min-h-7 shrink-0 items-center gap-1 rounded-og-sm border border-og-border bg-og-surface-1 px-2 font-medium text-og-fg transition-colors hover:border-og-border-strong focus-visible:outline-hidden focus-visible:ring-2 focus-visible:ring-og-accent disabled:cursor-not-allowed disabled:opacity-50 pointer-coarse:min-h-11",
|
|
2291
1922
|
children: [
|
|
2292
|
-
/* @__PURE__ */
|
|
1923
|
+
/* @__PURE__ */ jsx(
|
|
2293
1924
|
RefreshCwIcon,
|
|
2294
1925
|
{
|
|
2295
1926
|
className: cn("size-3", result.loading && "animate-spin motion-reduce:animate-none"),
|
|
@@ -2303,7 +1934,7 @@ function FileBrowser({
|
|
|
2303
1934
|
]
|
|
2304
1935
|
}
|
|
2305
1936
|
) : null,
|
|
2306
|
-
/* @__PURE__ */
|
|
1937
|
+
/* @__PURE__ */ jsx(
|
|
2307
1938
|
"div",
|
|
2308
1939
|
{
|
|
2309
1940
|
ref: container.ref,
|
|
@@ -2329,9 +1960,9 @@ function FileBrowser({
|
|
|
2329
1960
|
dragOver === "" && "ring-1 ring-inset ring-og-accent"
|
|
2330
1961
|
),
|
|
2331
1962
|
"data-opengeni-file-tree": true,
|
|
2332
|
-
children: showErrorEmpty ? /* @__PURE__ */
|
|
2333
|
-
/* @__PURE__ */
|
|
2334
|
-
/* @__PURE__ */
|
|
1963
|
+
children: showErrorEmpty ? /* @__PURE__ */ jsxs("div", { className: "flex flex-col items-start gap-2 p-2 text-og-sm text-og-fg-subtle", children: [
|
|
1964
|
+
/* @__PURE__ */ jsx("div", { children: fallback ?? `Could not load files: ${result.error?.message ?? "refresh the file list to try again"}` }),
|
|
1965
|
+
/* @__PURE__ */ jsxs(
|
|
2335
1966
|
"button",
|
|
2336
1967
|
{
|
|
2337
1968
|
type: "button",
|
|
@@ -2339,7 +1970,7 @@ function FileBrowser({
|
|
|
2339
1970
|
disabled: result.loading,
|
|
2340
1971
|
className: "inline-flex items-center gap-1.5 rounded-og-sm border border-og-border px-2 py-1 text-og-xs font-medium text-og-fg-muted transition-colors hover:border-og-border-strong hover:text-og-fg disabled:cursor-not-allowed disabled:opacity-50 pointer-coarse:min-h-11",
|
|
2341
1972
|
children: [
|
|
2342
|
-
/* @__PURE__ */
|
|
1973
|
+
/* @__PURE__ */ jsx(
|
|
2343
1974
|
RefreshCwIcon,
|
|
2344
1975
|
{
|
|
2345
1976
|
className: cn("size-3.5", result.loading && "animate-spin"),
|
|
@@ -2350,7 +1981,7 @@ function FileBrowser({
|
|
|
2350
1981
|
]
|
|
2351
1982
|
}
|
|
2352
1983
|
)
|
|
2353
|
-
] }) : showEmpty ? /* @__PURE__ */
|
|
1984
|
+
] }) : showEmpty ? /* @__PURE__ */ jsx("div", { className: "p-2 text-og-sm text-og-fg-subtle", children: emptyState ?? "This directory is empty" }) : !usesVirtualTree ? /* @__PURE__ */ jsx(
|
|
2354
1985
|
"div",
|
|
2355
1986
|
{
|
|
2356
1987
|
id: treeId,
|
|
@@ -2360,13 +1991,13 @@ function FileBrowser({
|
|
|
2360
1991
|
"aria-multiselectable": false,
|
|
2361
1992
|
tabIndex: 0,
|
|
2362
1993
|
className: "min-h-0 min-w-0 flex-1 overflow-auto outline-hidden focus-visible:ring-2 focus-visible:ring-inset focus-visible:ring-og-accent",
|
|
2363
|
-
children: renderItems.map((item) => /* @__PURE__ */
|
|
1994
|
+
children: renderItems.map((item) => /* @__PURE__ */ jsx("div", { className: "min-w-0", children: renderItem(item) }, itemKey(item)))
|
|
2364
1995
|
}
|
|
2365
1996
|
) : (
|
|
2366
1997
|
// Virtualized: only the rows in/near the viewport mount, so a 3k-node
|
|
2367
1998
|
// tree stays responsive. The flat item list already carries the
|
|
2368
1999
|
// expanded subtree + synthetic (create/skeleton/residue) rows.
|
|
2369
|
-
/* @__PURE__ */
|
|
2000
|
+
/* @__PURE__ */ jsx(
|
|
2370
2001
|
VList,
|
|
2371
2002
|
{
|
|
2372
2003
|
ref: vlistRef,
|
|
@@ -2379,13 +2010,13 @@ function FileBrowser({
|
|
|
2379
2010
|
className: "min-h-0 flex-1 outline-hidden focus-visible:ring-2 focus-visible:ring-inset focus-visible:ring-og-accent",
|
|
2380
2011
|
itemSize: coarsePointer ? 44 : 28,
|
|
2381
2012
|
ssrCount: Math.min(32, renderItems.length),
|
|
2382
|
-
children: renderItems.map((item) => /* @__PURE__ */
|
|
2013
|
+
children: renderItems.map((item) => /* @__PURE__ */ jsx("div", { className: "min-w-0", children: renderItem(item) }, itemKey(item)))
|
|
2383
2014
|
}
|
|
2384
2015
|
)
|
|
2385
2016
|
)
|
|
2386
2017
|
}
|
|
2387
2018
|
),
|
|
2388
|
-
menu && menu.node && /* @__PURE__ */
|
|
2019
|
+
menu && menu.node && /* @__PURE__ */ jsx(
|
|
2389
2020
|
ContextMenu,
|
|
2390
2021
|
{
|
|
2391
2022
|
node: menu.node,
|
|
@@ -2401,7 +2032,7 @@ function FileBrowser({
|
|
|
2401
2032
|
}
|
|
2402
2033
|
}
|
|
2403
2034
|
),
|
|
2404
|
-
pendingDelete ? /* @__PURE__ */
|
|
2035
|
+
pendingDelete ? /* @__PURE__ */ jsx(
|
|
2405
2036
|
DeleteDialog,
|
|
2406
2037
|
{
|
|
2407
2038
|
node: pendingDelete,
|
|
@@ -2424,11 +2055,11 @@ function DeleteDialog({
|
|
|
2424
2055
|
onCancel,
|
|
2425
2056
|
onConfirm
|
|
2426
2057
|
}) {
|
|
2427
|
-
const cancelRef =
|
|
2428
|
-
const [open, setOpen] =
|
|
2429
|
-
const closeIntentRef =
|
|
2430
|
-
const settledRef =
|
|
2431
|
-
const settleTimerRef =
|
|
2058
|
+
const cancelRef = useRef2(null);
|
|
2059
|
+
const [open, setOpen] = useState2(true);
|
|
2060
|
+
const closeIntentRef = useRef2("cancel");
|
|
2061
|
+
const settledRef = useRef2(false);
|
|
2062
|
+
const settleTimerRef = useRef2(null);
|
|
2432
2063
|
const settle = () => {
|
|
2433
2064
|
if (settledRef.current) return;
|
|
2434
2065
|
settledRef.current = true;
|
|
@@ -2445,13 +2076,13 @@ function DeleteDialog({
|
|
|
2445
2076
|
settle();
|
|
2446
2077
|
}, 0);
|
|
2447
2078
|
};
|
|
2448
|
-
|
|
2079
|
+
useEffect3(
|
|
2449
2080
|
() => () => {
|
|
2450
2081
|
if (settleTimerRef.current !== null) clearTimeout(settleTimerRef.current);
|
|
2451
2082
|
},
|
|
2452
2083
|
[]
|
|
2453
2084
|
);
|
|
2454
|
-
return /* @__PURE__ */
|
|
2085
|
+
return /* @__PURE__ */ jsx(
|
|
2455
2086
|
AlertDialog.Root,
|
|
2456
2087
|
{
|
|
2457
2088
|
open,
|
|
@@ -2461,9 +2092,9 @@ function DeleteDialog({
|
|
|
2461
2092
|
scheduleSettle();
|
|
2462
2093
|
}
|
|
2463
2094
|
},
|
|
2464
|
-
children: /* @__PURE__ */
|
|
2465
|
-
/* @__PURE__ */
|
|
2466
|
-
/* @__PURE__ */
|
|
2095
|
+
children: /* @__PURE__ */ jsxs(AlertDialog.Portal, { container: typeof document === "undefined" ? null : document.body, children: [
|
|
2096
|
+
/* @__PURE__ */ jsx(AlertDialog.Overlay, { className: "og-root fixed inset-0 z-[100] bg-black/45 backdrop-blur-[2px]" }),
|
|
2097
|
+
/* @__PURE__ */ jsxs(
|
|
2467
2098
|
AlertDialog.Content,
|
|
2468
2099
|
{
|
|
2469
2100
|
className: "og-root fixed left-1/2 top-1/2 z-[101] max-h-[calc(100dvh-2rem)] w-[calc(100%-2rem)] max-w-sm -translate-x-1/2 -translate-y-1/2 overflow-y-auto rounded-og-lg border border-og-border-strong bg-og-surface-1 p-4 text-og-fg shadow-2xl outline-hidden",
|
|
@@ -2485,22 +2116,22 @@ function DeleteDialog({
|
|
|
2485
2116
|
}
|
|
2486
2117
|
},
|
|
2487
2118
|
children: [
|
|
2488
|
-
/* @__PURE__ */
|
|
2489
|
-
/* @__PURE__ */
|
|
2490
|
-
/* @__PURE__ */
|
|
2491
|
-
/* @__PURE__ */
|
|
2119
|
+
/* @__PURE__ */ jsxs("div", { className: "flex items-start gap-3", children: [
|
|
2120
|
+
/* @__PURE__ */ jsx("span", { className: "flex size-9 shrink-0 items-center justify-center rounded-full bg-og-status-failed/12 text-og-status-failed", children: /* @__PURE__ */ jsx(Trash2Icon, { className: "size-4", "aria-hidden": true }) }),
|
|
2121
|
+
/* @__PURE__ */ jsxs("div", { className: "min-w-0", children: [
|
|
2122
|
+
/* @__PURE__ */ jsxs(AlertDialog.Title, { className: "text-og-sm font-semibold", children: [
|
|
2492
2123
|
"Delete ",
|
|
2493
2124
|
node.kind === "dir" ? "folder" : "file",
|
|
2494
2125
|
"?"
|
|
2495
2126
|
] }),
|
|
2496
|
-
/* @__PURE__ */
|
|
2497
|
-
/* @__PURE__ */
|
|
2127
|
+
/* @__PURE__ */ jsxs(AlertDialog.Description, { className: "mt-1 text-og-sm leading-relaxed text-og-fg-muted", children: [
|
|
2128
|
+
/* @__PURE__ */ jsx("span", { className: "break-all font-og-mono text-og-fg", children: node.path }),
|
|
2498
2129
|
node.kind === "dir" ? " and everything inside it will be permanently removed." : " will be permanently removed."
|
|
2499
2130
|
] })
|
|
2500
2131
|
] })
|
|
2501
2132
|
] }),
|
|
2502
|
-
/* @__PURE__ */
|
|
2503
|
-
/* @__PURE__ */
|
|
2133
|
+
/* @__PURE__ */ jsxs("div", { className: "mt-4 flex justify-end gap-2", children: [
|
|
2134
|
+
/* @__PURE__ */ jsx(AlertDialog.Cancel, { asChild: true, children: /* @__PURE__ */ jsx(
|
|
2504
2135
|
"button",
|
|
2505
2136
|
{
|
|
2506
2137
|
ref: cancelRef,
|
|
@@ -2513,7 +2144,7 @@ function DeleteDialog({
|
|
|
2513
2144
|
children: "Cancel"
|
|
2514
2145
|
}
|
|
2515
2146
|
) }),
|
|
2516
|
-
/* @__PURE__ */
|
|
2147
|
+
/* @__PURE__ */ jsx(AlertDialog.Action, { asChild: true, children: /* @__PURE__ */ jsx(
|
|
2517
2148
|
"button",
|
|
2518
2149
|
{
|
|
2519
2150
|
type: "button",
|
|
@@ -2539,7 +2170,7 @@ function ToolbarButton({
|
|
|
2539
2170
|
disabled,
|
|
2540
2171
|
children
|
|
2541
2172
|
}) {
|
|
2542
|
-
return /* @__PURE__ */
|
|
2173
|
+
return /* @__PURE__ */ jsx(
|
|
2543
2174
|
"button",
|
|
2544
2175
|
{
|
|
2545
2176
|
type: "button",
|
|
@@ -2563,10 +2194,10 @@ function InlineInput({
|
|
|
2563
2194
|
onCommit,
|
|
2564
2195
|
onCancel
|
|
2565
2196
|
}) {
|
|
2566
|
-
const [value, setValue] =
|
|
2567
|
-
const ref =
|
|
2568
|
-
const doneRef =
|
|
2569
|
-
|
|
2197
|
+
const [value, setValue] = useState2(initialValue);
|
|
2198
|
+
const ref = useRef2(null);
|
|
2199
|
+
const doneRef = useRef2(false);
|
|
2200
|
+
useEffect3(() => {
|
|
2570
2201
|
const el = ref.current;
|
|
2571
2202
|
if (!el) return;
|
|
2572
2203
|
el.focus();
|
|
@@ -2580,15 +2211,15 @@ function InlineInput({
|
|
|
2580
2211
|
if (commit) onCommit(value);
|
|
2581
2212
|
else onCancel();
|
|
2582
2213
|
};
|
|
2583
|
-
return /* @__PURE__ */
|
|
2214
|
+
return /* @__PURE__ */ jsxs(
|
|
2584
2215
|
"div",
|
|
2585
2216
|
{
|
|
2586
2217
|
className: "flex items-center gap-1 px-1 py-0.5",
|
|
2587
2218
|
style: { paddingLeft: `${depth * 12 + 4}px` },
|
|
2588
2219
|
children: [
|
|
2589
|
-
/* @__PURE__ */
|
|
2590
|
-
kind === "dir" ? /* @__PURE__ */
|
|
2591
|
-
/* @__PURE__ */
|
|
2220
|
+
/* @__PURE__ */ jsx("span", { className: "inline-block w-3 shrink-0" }),
|
|
2221
|
+
kind === "dir" ? /* @__PURE__ */ jsx(FolderIcon, { className: "size-3.5 shrink-0" }) : /* @__PURE__ */ jsx(FileIcon, { className: "size-3.5 shrink-0" }),
|
|
2222
|
+
/* @__PURE__ */ jsx(
|
|
2592
2223
|
"input",
|
|
2593
2224
|
{
|
|
2594
2225
|
ref,
|
|
@@ -2630,12 +2261,12 @@ function ContextMenu({
|
|
|
2630
2261
|
onClose
|
|
2631
2262
|
}) {
|
|
2632
2263
|
const isDir = node.kind === "dir";
|
|
2633
|
-
const menuRef =
|
|
2264
|
+
const menuRef = useRef2(null);
|
|
2634
2265
|
const vw = typeof window !== "undefined" ? window.innerWidth : 9999;
|
|
2635
2266
|
const vh = typeof window !== "undefined" ? window.innerHeight : 9999;
|
|
2636
2267
|
const left = Math.max(4, Math.min(x, vw - 180));
|
|
2637
2268
|
const top = Math.max(4, Math.min(y, vh - 160));
|
|
2638
|
-
|
|
2269
|
+
useEffect3(() => {
|
|
2639
2270
|
menuRef.current?.querySelector('[role="menuitem"]')?.focus();
|
|
2640
2271
|
}, []);
|
|
2641
2272
|
const onKeyDown = (event) => {
|
|
@@ -2660,7 +2291,7 @@ function ContextMenu({
|
|
|
2660
2291
|
event.stopPropagation();
|
|
2661
2292
|
items[next]?.focus();
|
|
2662
2293
|
};
|
|
2663
|
-
const item = (label, icon, onClick, danger) => /* @__PURE__ */
|
|
2294
|
+
const item = (label, icon, onClick, danger) => /* @__PURE__ */ jsxs(
|
|
2664
2295
|
"button",
|
|
2665
2296
|
{
|
|
2666
2297
|
type: "button",
|
|
@@ -2679,7 +2310,7 @@ function ContextMenu({
|
|
|
2679
2310
|
]
|
|
2680
2311
|
}
|
|
2681
2312
|
);
|
|
2682
|
-
return /* @__PURE__ */
|
|
2313
|
+
return /* @__PURE__ */ jsxs(
|
|
2683
2314
|
"div",
|
|
2684
2315
|
{
|
|
2685
2316
|
ref: menuRef,
|
|
@@ -2690,13 +2321,13 @@ function ContextMenu({
|
|
|
2690
2321
|
style: { left, top },
|
|
2691
2322
|
className: cn(MENU_SURFACE_CLASS, "fixed z-50 min-w-[180px] overflow-hidden"),
|
|
2692
2323
|
children: [
|
|
2693
|
-
isDir && /* @__PURE__ */
|
|
2694
|
-
item("New file", /* @__PURE__ */
|
|
2695
|
-
item("New folder", /* @__PURE__ */
|
|
2696
|
-
/* @__PURE__ */
|
|
2324
|
+
isDir && /* @__PURE__ */ jsxs(Fragment, { children: [
|
|
2325
|
+
item("New file", /* @__PURE__ */ jsx(FilePlusIcon, {}), onNewFile),
|
|
2326
|
+
item("New folder", /* @__PURE__ */ jsx(FolderPlusIcon, {}), onNewFolder),
|
|
2327
|
+
/* @__PURE__ */ jsx("div", { role: "separator", className: MENU_SEPARATOR_CLASS })
|
|
2697
2328
|
] }),
|
|
2698
|
-
item("Rename", /* @__PURE__ */
|
|
2699
|
-
item("Delete", /* @__PURE__ */
|
|
2329
|
+
item("Rename", /* @__PURE__ */ jsx(PencilIcon, {}), onRename),
|
|
2330
|
+
item("Delete", /* @__PURE__ */ jsx(Trash2Icon, {}), onDelete, true)
|
|
2700
2331
|
]
|
|
2701
2332
|
}
|
|
2702
2333
|
);
|
|
@@ -2706,11 +2337,11 @@ function ContextMenu({
|
|
|
2706
2337
|
import {
|
|
2707
2338
|
lazy,
|
|
2708
2339
|
Suspense,
|
|
2709
|
-
useEffect as
|
|
2710
|
-
useState as
|
|
2340
|
+
useEffect as useEffect4,
|
|
2341
|
+
useState as useState3,
|
|
2711
2342
|
useSyncExternalStore
|
|
2712
2343
|
} from "react";
|
|
2713
|
-
import { jsx as
|
|
2344
|
+
import { jsx as jsx2 } from "react/jsx-runtime";
|
|
2714
2345
|
var LazyFile = lazy(async () => {
|
|
2715
2346
|
const mod = await loadPierreDiffs();
|
|
2716
2347
|
return { default: mod.File };
|
|
@@ -2725,14 +2356,14 @@ function PierreFile({
|
|
|
2725
2356
|
fallback,
|
|
2726
2357
|
className
|
|
2727
2358
|
}) {
|
|
2728
|
-
const [failed, setFailed] =
|
|
2729
|
-
const [ready, setReady] =
|
|
2359
|
+
const [failed, setFailed] = useState3(false);
|
|
2360
|
+
const [ready, setReady] = useState3(false);
|
|
2730
2361
|
const loaderRevision = useSyncExternalStore(
|
|
2731
2362
|
subscribePierreDiffs,
|
|
2732
2363
|
pierreDiffsRevision,
|
|
2733
2364
|
pierreDiffsRevision
|
|
2734
2365
|
);
|
|
2735
|
-
|
|
2366
|
+
useEffect4(() => {
|
|
2736
2367
|
let cancelled = false;
|
|
2737
2368
|
setFailed(false);
|
|
2738
2369
|
loadPierreDiffs().then(
|
|
@@ -2749,7 +2380,7 @@ function PierreFile({
|
|
|
2749
2380
|
}, [loaderRevision]);
|
|
2750
2381
|
const name = path.split("/").filter(Boolean).pop() ?? path;
|
|
2751
2382
|
if (failed) {
|
|
2752
|
-
return /* @__PURE__ */
|
|
2383
|
+
return /* @__PURE__ */ jsx2("div", { className, children: fallback ?? /* @__PURE__ */ jsx2(PlainFile, { name, contents }) });
|
|
2753
2384
|
}
|
|
2754
2385
|
const options = {
|
|
2755
2386
|
overflow: "scroll",
|
|
@@ -2774,17 +2405,17 @@ function PierreFile({
|
|
|
2774
2405
|
"--diffs-font-size": "var(--og-code-font-size)",
|
|
2775
2406
|
"--diffs-line-height": "var(--og-code-line-height)"
|
|
2776
2407
|
};
|
|
2777
|
-
return /* @__PURE__ */
|
|
2408
|
+
return /* @__PURE__ */ jsx2("div", { className: cn("min-w-0", className), "data-opengeni-pierre-file": true, style: pierreVars, children: /* @__PURE__ */ jsx2(Suspense, { fallback: loading ?? /* @__PURE__ */ jsx2(FileSkeleton, {}), children: ready ? /* @__PURE__ */ jsx2(
|
|
2778
2409
|
LazyFile,
|
|
2779
2410
|
{
|
|
2780
2411
|
file: { name, contents },
|
|
2781
2412
|
options,
|
|
2782
2413
|
...disableWorkerPool !== void 0 ? { disableWorkerPool } : {}
|
|
2783
2414
|
}
|
|
2784
|
-
) : loading ?? /* @__PURE__ */
|
|
2415
|
+
) : loading ?? /* @__PURE__ */ jsx2(FileSkeleton, {}) }) });
|
|
2785
2416
|
}
|
|
2786
2417
|
function PlainFile({ name, contents }) {
|
|
2787
|
-
return /* @__PURE__ */
|
|
2418
|
+
return /* @__PURE__ */ jsx2(
|
|
2788
2419
|
"pre",
|
|
2789
2420
|
{
|
|
2790
2421
|
className: "overflow-auto whitespace-pre p-2 font-og-mono text-og-sm text-og-fg",
|
|
@@ -2794,11 +2425,11 @@ function PlainFile({ name, contents }) {
|
|
|
2794
2425
|
);
|
|
2795
2426
|
}
|
|
2796
2427
|
function FileSkeleton() {
|
|
2797
|
-
return /* @__PURE__ */
|
|
2428
|
+
return /* @__PURE__ */ jsx2("div", { className: "p-3 text-og-sm text-og-fg-subtle", children: "Loading file\u2026" });
|
|
2798
2429
|
}
|
|
2799
2430
|
|
|
2800
2431
|
// src/components/sandbox-files.tsx
|
|
2801
|
-
import { Fragment as Fragment2, jsx as
|
|
2432
|
+
import { Fragment as Fragment2, jsx as jsx3, jsxs as jsxs2 } from "react/jsx-runtime";
|
|
2802
2433
|
function SandboxFiles({
|
|
2803
2434
|
files,
|
|
2804
2435
|
git,
|
|
@@ -2821,17 +2452,17 @@ function SandboxFiles({
|
|
|
2821
2452
|
themeType,
|
|
2822
2453
|
className
|
|
2823
2454
|
}) {
|
|
2824
|
-
const [selected, setSelected] =
|
|
2825
|
-
const [editMode, setEditMode] =
|
|
2826
|
-
const [focusLine, setFocusLine] =
|
|
2827
|
-
const [treeRevealRequest, setTreeRevealRequest] =
|
|
2828
|
-
const [liveRequestedPath, setLiveRequestedPath] =
|
|
2829
|
-
const [viewReloadRevision, setViewReloadRevision] =
|
|
2830
|
-
const viewerScrollRef =
|
|
2831
|
-
const pendingRequestRef =
|
|
2832
|
-
const handledRequestRef =
|
|
2455
|
+
const [selected, setSelected] = useState4(() => initialSelectedPath ?? null);
|
|
2456
|
+
const [editMode, setEditMode] = useState4(false);
|
|
2457
|
+
const [focusLine, setFocusLine] = useState4(null);
|
|
2458
|
+
const [treeRevealRequest, setTreeRevealRequest] = useState4(null);
|
|
2459
|
+
const [liveRequestedPath, setLiveRequestedPath] = useState4(null);
|
|
2460
|
+
const [viewReloadRevision, setViewReloadRevision] = useState4(0);
|
|
2461
|
+
const viewerScrollRef = useRef3(null);
|
|
2462
|
+
const pendingRequestRef = useRef3(null);
|
|
2463
|
+
const handledRequestRef = useRef3(null);
|
|
2833
2464
|
const requestKey = requestedPath ? requestedPathRequestId ?? requestedPath : null;
|
|
2834
|
-
|
|
2465
|
+
useEffect5(() => {
|
|
2835
2466
|
if (!requestedPath || requestKey === null) {
|
|
2836
2467
|
pendingRequestRef.current = null;
|
|
2837
2468
|
handledRequestRef.current = null;
|
|
@@ -2877,9 +2508,9 @@ function SandboxFiles({
|
|
|
2877
2508
|
requestedPath,
|
|
2878
2509
|
requestedPathReady
|
|
2879
2510
|
]);
|
|
2880
|
-
const rootRef =
|
|
2881
|
-
const [wide, setWide] =
|
|
2882
|
-
|
|
2511
|
+
const rootRef = useRef3(null);
|
|
2512
|
+
const [wide, setWide] = useState4(false);
|
|
2513
|
+
useEffect5(() => {
|
|
2883
2514
|
const el = rootRef.current;
|
|
2884
2515
|
if (!el) return;
|
|
2885
2516
|
const update = () => setWide(el.getBoundingClientRect().width >= 720);
|
|
@@ -2902,7 +2533,7 @@ function SandboxFiles({
|
|
|
2902
2533
|
const selectedVisibility = selected ? filePathVisibility(files.tree, selected, isNodeVisible) : "unknown";
|
|
2903
2534
|
const visibilityPending = Boolean(isNodeVisible && files.loading && files.tree.length === 0);
|
|
2904
2535
|
const viewPath = selectedVisibility === "hidden" || visibilityPending ? null : selected;
|
|
2905
|
-
|
|
2536
|
+
useEffect5(() => {
|
|
2906
2537
|
if (selected === null || selectedVisibility !== "hidden") return;
|
|
2907
2538
|
setSelected(null);
|
|
2908
2539
|
onSelectedPathChange?.(null);
|
|
@@ -2916,12 +2547,12 @@ function SandboxFiles({
|
|
|
2916
2547
|
files.readFile,
|
|
2917
2548
|
`${files.contentRevision ?? 0}:${viewReloadRevision}`
|
|
2918
2549
|
);
|
|
2919
|
-
|
|
2550
|
+
useEffect5(() => {
|
|
2920
2551
|
if (focusLine === null && viewReloadRevision > 0 && viewerScrollRef.current) {
|
|
2921
2552
|
viewerScrollRef.current.scrollTop = 0;
|
|
2922
2553
|
}
|
|
2923
2554
|
}, [focusLine, viewReloadRevision]);
|
|
2924
|
-
const selectFile =
|
|
2555
|
+
const selectFile = useCallback3(
|
|
2925
2556
|
(path) => {
|
|
2926
2557
|
if (pendingRequestRef.current !== null) {
|
|
2927
2558
|
handledRequestRef.current = pendingRequestRef.current;
|
|
@@ -2942,45 +2573,45 @@ function SandboxFiles({
|
|
|
2942
2573
|
const captureFileUnavailable = fileView.error instanceof CapturedFileUnavailableError ? fileView.error : null;
|
|
2943
2574
|
const waitingForSelectedFile = !workspaceError && liveRequestedPath === viewPath && (!liveWorkspaceReady || files.loading) && captureFileUnavailable !== null;
|
|
2944
2575
|
if (workspaceError && !liveWorkspaceReady && files.source !== "capture") {
|
|
2945
|
-
return /* @__PURE__ */
|
|
2946
|
-
/* @__PURE__ */
|
|
2947
|
-
onWakeWorkspace ? /* @__PURE__ */
|
|
2576
|
+
return /* @__PURE__ */ jsxs2(Notice, { className, title: "Could not open live workspace", announce: "alert", children: [
|
|
2577
|
+
/* @__PURE__ */ jsx3("p", { children: workspaceError.message }),
|
|
2578
|
+
onWakeWorkspace ? /* @__PURE__ */ jsx3(WakeButton, { onClick: onWakeWorkspace, children: "Retry live workspace" }) : null
|
|
2948
2579
|
] });
|
|
2949
2580
|
}
|
|
2950
2581
|
if (workspaceResting || workspaceWaking) {
|
|
2951
|
-
return /* @__PURE__ */
|
|
2582
|
+
return /* @__PURE__ */ jsx3("div", { className: cn("h-full", className), "data-opengeni-workspace-resting": true, children: /* @__PURE__ */ jsxs2(
|
|
2952
2583
|
Notice,
|
|
2953
2584
|
{
|
|
2954
|
-
icon: workspaceWaking ? /* @__PURE__ */
|
|
2585
|
+
icon: workspaceWaking ? /* @__PURE__ */ jsx3(
|
|
2955
2586
|
LoaderCircleIcon,
|
|
2956
2587
|
{
|
|
2957
2588
|
className: "size-5 animate-spin motion-reduce:animate-none",
|
|
2958
2589
|
"aria-hidden": true
|
|
2959
2590
|
}
|
|
2960
|
-
) : /* @__PURE__ */
|
|
2591
|
+
) : /* @__PURE__ */ jsx3(FileCode2Icon, { className: "size-5", "aria-hidden": true }),
|
|
2961
2592
|
title: workspaceWaking ? "Waking workspace" : "Workspace is resting",
|
|
2962
2593
|
announce: "status",
|
|
2963
2594
|
children: [
|
|
2964
|
-
/* @__PURE__ */
|
|
2965
|
-
!workspaceWaking && onWakeWorkspace ? /* @__PURE__ */
|
|
2595
|
+
/* @__PURE__ */ jsx3("p", { children: workspaceWaking ? "Connecting to the live file system\u2026" : "No captured revision is available yet. Wake the sandbox to browse its current files." }),
|
|
2596
|
+
!workspaceWaking && onWakeWorkspace ? /* @__PURE__ */ jsx3(WakeButton, { onClick: onWakeWorkspace, children: "Open live workspace" }) : null
|
|
2966
2597
|
]
|
|
2967
2598
|
}
|
|
2968
2599
|
) });
|
|
2969
2600
|
}
|
|
2970
2601
|
if (!fileSystemAvailable) {
|
|
2971
|
-
return /* @__PURE__ */
|
|
2602
|
+
return /* @__PURE__ */ jsx3(
|
|
2972
2603
|
Notice,
|
|
2973
2604
|
{
|
|
2974
2605
|
className,
|
|
2975
|
-
icon: /* @__PURE__ */
|
|
2606
|
+
icon: /* @__PURE__ */ jsx3(FileWarningIcon, { className: "size-5", "aria-hidden": true }),
|
|
2976
2607
|
title: "Files unavailable",
|
|
2977
2608
|
announce: "alert",
|
|
2978
2609
|
children: "This sandbox does not expose a file system."
|
|
2979
2610
|
}
|
|
2980
2611
|
);
|
|
2981
2612
|
}
|
|
2982
|
-
return /* @__PURE__ */
|
|
2983
|
-
/* @__PURE__ */
|
|
2613
|
+
return /* @__PURE__ */ jsxs2("div", { ref: rootRef, className: cn("flex h-full min-h-0 min-w-0 flex-col", className), children: [
|
|
2614
|
+
/* @__PURE__ */ jsx3(
|
|
2984
2615
|
GitHeader,
|
|
2985
2616
|
{
|
|
2986
2617
|
loading: Boolean(files.loading || files.gitLoading || files.source === null || git?.loading) && files.gitSummary === null,
|
|
@@ -2994,13 +2625,13 @@ function SandboxFiles({
|
|
|
2994
2625
|
}
|
|
2995
2626
|
}
|
|
2996
2627
|
),
|
|
2997
|
-
/* @__PURE__ */
|
|
2628
|
+
/* @__PURE__ */ jsxs2(
|
|
2998
2629
|
Group,
|
|
2999
2630
|
{
|
|
3000
2631
|
orientation: wide ? "horizontal" : "vertical",
|
|
3001
2632
|
className: cn("min-h-0 flex-1", wide ? "flex-row" : "flex-col"),
|
|
3002
2633
|
children: [
|
|
3003
|
-
/* @__PURE__ */
|
|
2634
|
+
/* @__PURE__ */ jsx3(
|
|
3004
2635
|
Panel,
|
|
3005
2636
|
{
|
|
3006
2637
|
id: "sandbox-files-tree",
|
|
@@ -3008,7 +2639,7 @@ function SandboxFiles({
|
|
|
3008
2639
|
minSize: wide ? "180px" : "120px",
|
|
3009
2640
|
maxSize: wide ? "60%" : "70%",
|
|
3010
2641
|
className: "flex min-h-0 min-w-0 flex-col",
|
|
3011
|
-
children: /* @__PURE__ */
|
|
2642
|
+
children: /* @__PURE__ */ jsx3(
|
|
3012
2643
|
FileBrowser,
|
|
3013
2644
|
{
|
|
3014
2645
|
result: files,
|
|
@@ -3026,7 +2657,7 @@ function SandboxFiles({
|
|
|
3026
2657
|
)
|
|
3027
2658
|
}
|
|
3028
2659
|
),
|
|
3029
|
-
/* @__PURE__ */
|
|
2660
|
+
/* @__PURE__ */ jsx3(
|
|
3030
2661
|
Separator,
|
|
3031
2662
|
{
|
|
3032
2663
|
"aria-label": "Resize file tree",
|
|
@@ -3038,15 +2669,15 @@ function SandboxFiles({
|
|
|
3038
2669
|
)
|
|
3039
2670
|
}
|
|
3040
2671
|
),
|
|
3041
|
-
/* @__PURE__ */
|
|
2672
|
+
/* @__PURE__ */ jsxs2(
|
|
3042
2673
|
Panel,
|
|
3043
2674
|
{
|
|
3044
2675
|
id: "sandbox-files-viewer",
|
|
3045
2676
|
minSize: wide ? "240px" : "160px",
|
|
3046
2677
|
className: cn("flex min-h-0 min-w-0 flex-col", !wide && "border-t border-og-border"),
|
|
3047
2678
|
children: [
|
|
3048
|
-
/* @__PURE__ */
|
|
3049
|
-
/* @__PURE__ */
|
|
2679
|
+
/* @__PURE__ */ jsxs2("div", { className: "flex shrink-0 items-center justify-between gap-2 border-b border-og-border bg-og-surface-1 px-2 py-1", children: [
|
|
2680
|
+
/* @__PURE__ */ jsx3(
|
|
3050
2681
|
"span",
|
|
3051
2682
|
{
|
|
3052
2683
|
"data-opengeni-selected-file": true,
|
|
@@ -3054,7 +2685,7 @@ function SandboxFiles({
|
|
|
3054
2685
|
children: selected ? focusLine !== null ? `${selected}:${focusLine}` : selected : "No file selected"
|
|
3055
2686
|
}
|
|
3056
2687
|
),
|
|
3057
|
-
canEdit && /* @__PURE__ */
|
|
2688
|
+
canEdit && /* @__PURE__ */ jsx3(
|
|
3058
2689
|
Segmented,
|
|
3059
2690
|
{
|
|
3060
2691
|
options: [
|
|
@@ -3066,13 +2697,13 @@ function SandboxFiles({
|
|
|
3066
2697
|
}
|
|
3067
2698
|
)
|
|
3068
2699
|
] }),
|
|
3069
|
-
/* @__PURE__ */
|
|
2700
|
+
/* @__PURE__ */ jsx3(
|
|
3070
2701
|
"div",
|
|
3071
2702
|
{
|
|
3072
2703
|
ref: viewerScrollRef,
|
|
3073
2704
|
className: "min-h-0 flex-1 overflow-auto",
|
|
3074
2705
|
"data-opengeni-file-viewer-scroll": true,
|
|
3075
|
-
children: viewPath ? showEditor && fileView.content !== null ? /* @__PURE__ */
|
|
2706
|
+
children: viewPath ? showEditor && fileView.content !== null ? /* @__PURE__ */ jsx3(
|
|
3076
2707
|
CodeEditor,
|
|
3077
2708
|
{
|
|
3078
2709
|
path: viewPath,
|
|
@@ -3085,13 +2716,13 @@ function SandboxFiles({
|
|
|
3085
2716
|
className: "h-full"
|
|
3086
2717
|
},
|
|
3087
2718
|
viewPath
|
|
3088
|
-
) : workspaceError && (liveRequestedPath === viewPath || requestedPath === viewPath) && !liveWorkspaceReady ? /* @__PURE__ */
|
|
3089
|
-
/* @__PURE__ */
|
|
3090
|
-
onWakeWorkspace ? /* @__PURE__ */
|
|
3091
|
-
] }) : waitingForSelectedFile ? /* @__PURE__ */
|
|
2719
|
+
) : workspaceError && (liveRequestedPath === viewPath || requestedPath === viewPath) && !liveWorkspaceReady ? /* @__PURE__ */ jsxs2(Notice, { title: "Could not open live file", announce: "alert", children: [
|
|
2720
|
+
/* @__PURE__ */ jsx3("p", { children: workspaceError.message }),
|
|
2721
|
+
onWakeWorkspace ? /* @__PURE__ */ jsx3(WakeButton, { onClick: onWakeWorkspace, children: "Retry live file" }) : null
|
|
2722
|
+
] }) : waitingForSelectedFile ? /* @__PURE__ */ jsxs2(
|
|
3092
2723
|
Notice,
|
|
3093
2724
|
{
|
|
3094
|
-
icon: /* @__PURE__ */
|
|
2725
|
+
icon: /* @__PURE__ */ jsx3(
|
|
3095
2726
|
LoaderCircleIcon,
|
|
3096
2727
|
{
|
|
3097
2728
|
className: "size-5 animate-spin motion-reduce:animate-none",
|
|
@@ -3106,9 +2737,9 @@ function SandboxFiles({
|
|
|
3106
2737
|
" when the live file system is ready\u2026"
|
|
3107
2738
|
]
|
|
3108
2739
|
}
|
|
3109
|
-
) : captureFileUnavailable ? /* @__PURE__ */
|
|
3110
|
-
/* @__PURE__ */
|
|
3111
|
-
onWakeWorkspace ? /* @__PURE__ */
|
|
2740
|
+
) : captureFileUnavailable ? /* @__PURE__ */ jsxs2(Notice, { icon: /* @__PURE__ */ jsx3(FileCode2Icon, { className: "size-5", "aria-hidden": true }), title: "On machine", children: [
|
|
2741
|
+
/* @__PURE__ */ jsx3("p", { children: captureFileUnavailable.reason === "too-large" ? "This file is larger than the captured preview limit." : captureFileUnavailable.reason === "content-missing" ? "The captured copy is no longer available." : "This file was indexed, but it was not changed in the captured turn." }),
|
|
2742
|
+
onWakeWorkspace ? /* @__PURE__ */ jsx3(
|
|
3112
2743
|
WakeButton,
|
|
3113
2744
|
{
|
|
3114
2745
|
onClick: () => {
|
|
@@ -3119,64 +2750,64 @@ function SandboxFiles({
|
|
|
3119
2750
|
children: liveWorkspaceReady ? "Retry live file" : "Open live file"
|
|
3120
2751
|
}
|
|
3121
2752
|
) : null
|
|
3122
|
-
] }) : fileView.error ? /* @__PURE__ */
|
|
2753
|
+
] }) : fileView.error ? /* @__PURE__ */ jsxs2(Notice, { announce: "alert", children: [
|
|
3123
2754
|
"Could not open ",
|
|
3124
2755
|
viewPath,
|
|
3125
2756
|
": ",
|
|
3126
2757
|
fileView.error.message
|
|
3127
|
-
] }) : fileView.loading ? /* @__PURE__ */
|
|
2758
|
+
] }) : fileView.loading ? /* @__PURE__ */ jsxs2(Notice, { announce: "status", children: [
|
|
3128
2759
|
"Loading ",
|
|
3129
2760
|
viewPath,
|
|
3130
2761
|
"\u2026"
|
|
3131
|
-
] }) : fileView.imageUrl ? /* @__PURE__ */
|
|
2762
|
+
] }) : fileView.imageUrl ? /* @__PURE__ */ jsx3(
|
|
3132
2763
|
RasterFilePreview,
|
|
3133
2764
|
{
|
|
3134
2765
|
src: fileView.imageUrl,
|
|
3135
2766
|
path: viewPath
|
|
3136
2767
|
},
|
|
3137
2768
|
fileView.imageUrl
|
|
3138
|
-
) : fileView.isBinary ? /* @__PURE__ */
|
|
2769
|
+
) : fileView.isBinary ? /* @__PURE__ */ jsxs2(Notice, { children: [
|
|
3139
2770
|
viewPath,
|
|
3140
2771
|
" is a binary file (",
|
|
3141
2772
|
fileView.sizeBytes ?? 0,
|
|
3142
2773
|
" bytes)."
|
|
3143
|
-
] }) : fileView.content !== null ? /* @__PURE__ */
|
|
3144
|
-
fileView.truncated && /* @__PURE__ */
|
|
2774
|
+
] }) : fileView.content !== null ? /* @__PURE__ */ jsxs2(Fragment2, { children: [
|
|
2775
|
+
fileView.truncated && /* @__PURE__ */ jsxs2("div", { className: "border-b border-og-border bg-og-surface-1 px-2 py-1 text-og-xs text-og-status-running", children: [
|
|
3145
2776
|
"Large file \u2014 showing a truncated preview (",
|
|
3146
2777
|
fileView.sizeBytes ?? 0,
|
|
3147
2778
|
" bytes loaded). Editing is disabled to avoid corrupting the file."
|
|
3148
2779
|
] }),
|
|
3149
|
-
usePierre && focusLine === null ? /* @__PURE__ */
|
|
2780
|
+
usePierre && focusLine === null ? /* @__PURE__ */ jsx3(
|
|
3150
2781
|
PierreFile,
|
|
3151
2782
|
{
|
|
3152
2783
|
path: viewPath,
|
|
3153
2784
|
contents: fileView.content,
|
|
3154
2785
|
themeType: resolvedTheme,
|
|
3155
|
-
fallback: /* @__PURE__ */
|
|
2786
|
+
fallback: /* @__PURE__ */ jsx3("pre", { className: "overflow-auto whitespace-pre p-2 font-og-mono text-og-sm text-og-fg", children: fileView.content }),
|
|
3156
2787
|
className: "p-1"
|
|
3157
2788
|
},
|
|
3158
2789
|
`${viewPath}:${viewReloadRevision}`
|
|
3159
|
-
) : focusLine !== null ? /* @__PURE__ */
|
|
2790
|
+
) : focusLine !== null ? /* @__PURE__ */ jsx3(
|
|
3160
2791
|
LineNumberedFile,
|
|
3161
2792
|
{
|
|
3162
2793
|
path: viewPath,
|
|
3163
2794
|
contents: fileView.content,
|
|
3164
2795
|
focusLine
|
|
3165
2796
|
}
|
|
3166
|
-
) : /* @__PURE__ */
|
|
3167
|
-
] }) : /* @__PURE__ */
|
|
2797
|
+
) : /* @__PURE__ */ jsx3("pre", { className: "overflow-auto whitespace-pre p-2 font-og-mono text-og-sm text-og-fg", children: fileView.content })
|
|
2798
|
+
] }) : /* @__PURE__ */ jsxs2(Notice, { announce: "status", children: [
|
|
3168
2799
|
"Loading ",
|
|
3169
2800
|
viewPath,
|
|
3170
2801
|
"\u2026"
|
|
3171
2802
|
] }) : (
|
|
3172
2803
|
// Nothing selected — the tree shows the whole workspace; pick a file.
|
|
3173
|
-
requestedPath && !requestedPathReady ? workspaceError ? /* @__PURE__ */
|
|
3174
|
-
/* @__PURE__ */
|
|
3175
|
-
onWakeWorkspace ? /* @__PURE__ */
|
|
3176
|
-
] }) : /* @__PURE__ */
|
|
2804
|
+
requestedPath && !requestedPathReady ? workspaceError ? /* @__PURE__ */ jsxs2(Notice, { title: "Could not open live file", announce: "alert", children: [
|
|
2805
|
+
/* @__PURE__ */ jsx3("p", { children: workspaceError.message }),
|
|
2806
|
+
onWakeWorkspace ? /* @__PURE__ */ jsx3(WakeButton, { onClick: onWakeWorkspace, children: "Retry live file" }) : null
|
|
2807
|
+
] }) : /* @__PURE__ */ jsxs2(
|
|
3177
2808
|
Notice,
|
|
3178
2809
|
{
|
|
3179
|
-
icon: /* @__PURE__ */
|
|
2810
|
+
icon: /* @__PURE__ */ jsx3(
|
|
3180
2811
|
LoaderCircleIcon,
|
|
3181
2812
|
{
|
|
3182
2813
|
className: "size-5 animate-spin motion-reduce:animate-none",
|
|
@@ -3191,7 +2822,7 @@ function SandboxFiles({
|
|
|
3191
2822
|
" when the live workspace is ready\u2026"
|
|
3192
2823
|
]
|
|
3193
2824
|
}
|
|
3194
|
-
) : /* @__PURE__ */
|
|
2825
|
+
) : /* @__PURE__ */ jsx3(Notice, { icon: /* @__PURE__ */ jsx3(FileCode2Icon, { className: "size-5", "aria-hidden": true }), title: "Choose a file", children: "Select a file in the tree to preview it." })
|
|
3195
2826
|
)
|
|
3196
2827
|
}
|
|
3197
2828
|
)
|
|
@@ -3204,7 +2835,7 @@ function SandboxFiles({
|
|
|
3204
2835
|
] });
|
|
3205
2836
|
}
|
|
3206
2837
|
function WakeButton({ children, onClick }) {
|
|
3207
|
-
return /* @__PURE__ */
|
|
2838
|
+
return /* @__PURE__ */ jsx3(
|
|
3208
2839
|
"button",
|
|
3209
2840
|
{
|
|
3210
2841
|
type: "button",
|
|
@@ -3221,21 +2852,21 @@ function LineNumberedFile({
|
|
|
3221
2852
|
}) {
|
|
3222
2853
|
const lines = contents.split("\n");
|
|
3223
2854
|
const inRange = focusLine >= 1 && focusLine <= lines.length;
|
|
3224
|
-
const targetRef =
|
|
3225
|
-
|
|
2855
|
+
const targetRef = useRef3(null);
|
|
2856
|
+
useEffect5(() => {
|
|
3226
2857
|
targetRef.current?.scrollIntoView({
|
|
3227
2858
|
block: "center",
|
|
3228
2859
|
behavior: prefersReducedMotion() ? "auto" : "smooth"
|
|
3229
2860
|
});
|
|
3230
2861
|
}, [path, focusLine, contents]);
|
|
3231
|
-
return /* @__PURE__ */
|
|
2862
|
+
return /* @__PURE__ */ jsxs2(
|
|
3232
2863
|
"div",
|
|
3233
2864
|
{
|
|
3234
2865
|
className: "h-full min-h-0 overflow-auto font-og-mono text-og-sm text-og-fg",
|
|
3235
2866
|
role: "region",
|
|
3236
2867
|
"aria-label": inRange ? `${path} at line ${focusLine}` : path,
|
|
3237
2868
|
children: [
|
|
3238
|
-
!inRange ? /* @__PURE__ */
|
|
2869
|
+
!inRange ? /* @__PURE__ */ jsxs2(
|
|
3239
2870
|
"p",
|
|
3240
2871
|
{
|
|
3241
2872
|
className: "border-b border-og-border bg-og-surface-1 px-2 py-1 text-og-xs text-og-fg-muted",
|
|
@@ -3247,10 +2878,10 @@ function LineNumberedFile({
|
|
|
3247
2878
|
]
|
|
3248
2879
|
}
|
|
3249
2880
|
) : null,
|
|
3250
|
-
/* @__PURE__ */
|
|
2881
|
+
/* @__PURE__ */ jsx3("div", { children: lines.map((text, index) => {
|
|
3251
2882
|
const lineNumber = index + 1;
|
|
3252
2883
|
const focused = inRange && lineNumber === focusLine;
|
|
3253
|
-
return /* @__PURE__ */
|
|
2884
|
+
return /* @__PURE__ */ jsxs2(
|
|
3254
2885
|
"div",
|
|
3255
2886
|
{
|
|
3256
2887
|
ref: focused ? targetRef : void 0,
|
|
@@ -3259,8 +2890,8 @@ function LineNumberedFile({
|
|
|
3259
2890
|
"aria-current": focused ? "location" : void 0,
|
|
3260
2891
|
className: cn("flex gap-3 px-2 py-0.5 leading-6", focused && "bg-og-accent-soft"),
|
|
3261
2892
|
children: [
|
|
3262
|
-
/* @__PURE__ */
|
|
3263
|
-
/* @__PURE__ */
|
|
2893
|
+
/* @__PURE__ */ jsx3("span", { className: "w-11 shrink-0 select-none text-right tabular-nums text-og-fg-subtle", children: lineNumber }),
|
|
2894
|
+
/* @__PURE__ */ jsx3("pre", { className: "min-w-0 flex-1 whitespace-pre-wrap break-words", children: text || " " })
|
|
3264
2895
|
]
|
|
3265
2896
|
},
|
|
3266
2897
|
lineNumber
|
|
@@ -3272,28 +2903,28 @@ function LineNumberedFile({
|
|
|
3272
2903
|
}
|
|
3273
2904
|
function GitHeader({ git, loading }) {
|
|
3274
2905
|
if (loading) {
|
|
3275
|
-
return /* @__PURE__ */
|
|
2906
|
+
return /* @__PURE__ */ jsxs2(
|
|
3276
2907
|
"div",
|
|
3277
2908
|
{
|
|
3278
2909
|
className: "flex shrink-0 items-center gap-2 border-b border-og-border bg-og-surface-1 px-2 py-1 text-og-sm text-og-fg-muted",
|
|
3279
2910
|
role: "status",
|
|
3280
2911
|
"aria-live": "polite",
|
|
3281
2912
|
children: [
|
|
3282
|
-
/* @__PURE__ */
|
|
2913
|
+
/* @__PURE__ */ jsx3(
|
|
3283
2914
|
LoaderCircleIcon,
|
|
3284
2915
|
{
|
|
3285
2916
|
className: "size-3.5 shrink-0 animate-spin motion-reduce:animate-none",
|
|
3286
2917
|
"aria-hidden": true
|
|
3287
2918
|
}
|
|
3288
2919
|
),
|
|
3289
|
-
/* @__PURE__ */
|
|
2920
|
+
/* @__PURE__ */ jsx3("span", { children: "Loading repository\u2026" })
|
|
3290
2921
|
]
|
|
3291
2922
|
}
|
|
3292
2923
|
);
|
|
3293
2924
|
}
|
|
3294
2925
|
const dirty = git.dirtyCount > 0;
|
|
3295
|
-
return /* @__PURE__ */
|
|
3296
|
-
/* @__PURE__ */
|
|
2926
|
+
return /* @__PURE__ */ jsxs2("div", { className: "flex shrink-0 items-center gap-2 border-b border-og-border bg-og-surface-1 px-2 py-1 text-og-sm", children: [
|
|
2927
|
+
/* @__PURE__ */ jsx3(
|
|
3297
2928
|
"span",
|
|
3298
2929
|
{
|
|
3299
2930
|
"aria-hidden": "true",
|
|
@@ -3303,19 +2934,19 @@ function GitHeader({ git, loading }) {
|
|
|
3303
2934
|
)
|
|
3304
2935
|
}
|
|
3305
2936
|
),
|
|
3306
|
-
/* @__PURE__ */
|
|
3307
|
-
/* @__PURE__ */
|
|
3308
|
-
(git.ahead > 0 || git.behind > 0) && /* @__PURE__ */
|
|
3309
|
-
git.ahead > 0 && /* @__PURE__ */
|
|
2937
|
+
/* @__PURE__ */ jsx3("span", { className: "sr-only", children: dirty ? `Uncommitted changes in ${git.dirtyCount} files` : "No uncommitted changes" }),
|
|
2938
|
+
/* @__PURE__ */ jsx3("span", { className: "truncate font-og-mono text-og-fg", children: git.repoCount > 1 ? `${git.repoCount} repositories` : git.branch ?? (git.isRepo ? "(detached)" : "no repo") }),
|
|
2939
|
+
(git.ahead > 0 || git.behind > 0) && /* @__PURE__ */ jsxs2("span", { className: "flex shrink-0 items-center gap-1.5 text-og-xs text-og-fg-subtle", children: [
|
|
2940
|
+
git.ahead > 0 && /* @__PURE__ */ jsxs2("span", { "data-contrast-audited": true, children: [
|
|
3310
2941
|
"\u2191",
|
|
3311
2942
|
git.ahead
|
|
3312
2943
|
] }),
|
|
3313
|
-
git.behind > 0 && /* @__PURE__ */
|
|
2944
|
+
git.behind > 0 && /* @__PURE__ */ jsxs2("span", { "data-contrast-audited": true, children: [
|
|
3314
2945
|
"\u2193",
|
|
3315
2946
|
git.behind
|
|
3316
2947
|
] })
|
|
3317
2948
|
] }),
|
|
3318
|
-
dirty && /* @__PURE__ */
|
|
2949
|
+
dirty && /* @__PURE__ */ jsxs2(
|
|
3319
2950
|
"span",
|
|
3320
2951
|
{
|
|
3321
2952
|
"aria-hidden": "true",
|
|
@@ -3334,7 +2965,7 @@ function Segmented({
|
|
|
3334
2965
|
value,
|
|
3335
2966
|
onChange
|
|
3336
2967
|
}) {
|
|
3337
|
-
return /* @__PURE__ */
|
|
2968
|
+
return /* @__PURE__ */ jsx3("div", { className: "flex flex-wrap items-center rounded-og-sm border border-og-border p-0.5", children: options.map((opt) => /* @__PURE__ */ jsx3(
|
|
3338
2969
|
"button",
|
|
3339
2970
|
{
|
|
3340
2971
|
type: "button",
|
|
@@ -3349,8 +2980,8 @@ function Segmented({
|
|
|
3349
2980
|
)) });
|
|
3350
2981
|
}
|
|
3351
2982
|
function useFileView(path, readFile, reloadRevision = 0) {
|
|
3352
|
-
const previousPathRef =
|
|
3353
|
-
const [state, setState] =
|
|
2983
|
+
const previousPathRef = useRef3(null);
|
|
2984
|
+
const [state, setState] = useState4({
|
|
3354
2985
|
content: null,
|
|
3355
2986
|
isBinary: false,
|
|
3356
2987
|
truncated: false,
|
|
@@ -3358,7 +2989,7 @@ function useFileView(path, readFile, reloadRevision = 0) {
|
|
|
3358
2989
|
loading: false,
|
|
3359
2990
|
error: null
|
|
3360
2991
|
});
|
|
3361
|
-
|
|
2992
|
+
useEffect5(() => {
|
|
3362
2993
|
if (!path) {
|
|
3363
2994
|
previousPathRef.current = null;
|
|
3364
2995
|
setState({
|
|
@@ -3426,12 +3057,12 @@ function rasterImageUrl(path, content) {
|
|
|
3426
3057
|
return mime ? `data:${mime};base64,${content}` : null;
|
|
3427
3058
|
}
|
|
3428
3059
|
function RasterFilePreview({ src, path }) {
|
|
3429
|
-
const [failed, setFailed] =
|
|
3430
|
-
return failed ? /* @__PURE__ */
|
|
3060
|
+
const [failed, setFailed] = useState4(false);
|
|
3061
|
+
return failed ? /* @__PURE__ */ jsxs2(Notice, { title: "Image preview unavailable", announce: "alert", children: [
|
|
3431
3062
|
"Could not decode ",
|
|
3432
3063
|
path,
|
|
3433
3064
|
" as an image."
|
|
3434
|
-
] }) : /* @__PURE__ */
|
|
3065
|
+
] }) : /* @__PURE__ */ jsx3(
|
|
3435
3066
|
"img",
|
|
3436
3067
|
{
|
|
3437
3068
|
src,
|
|
@@ -3460,7 +3091,7 @@ function Notice({
|
|
|
3460
3091
|
title,
|
|
3461
3092
|
announce
|
|
3462
3093
|
}) {
|
|
3463
|
-
return /* @__PURE__ */
|
|
3094
|
+
return /* @__PURE__ */ jsx3(
|
|
3464
3095
|
"div",
|
|
3465
3096
|
{
|
|
3466
3097
|
role: announce,
|
|
@@ -3470,10 +3101,10 @@ function Notice({
|
|
|
3470
3101
|
"flex h-full items-center justify-center p-4 text-center text-og-sm text-og-fg-subtle",
|
|
3471
3102
|
className
|
|
3472
3103
|
),
|
|
3473
|
-
children: /* @__PURE__ */
|
|
3474
|
-
icon ? /* @__PURE__ */
|
|
3475
|
-
title ? /* @__PURE__ */
|
|
3476
|
-
/* @__PURE__ */
|
|
3104
|
+
children: /* @__PURE__ */ jsxs2("div", { className: "flex max-w-sm flex-col items-center gap-2.5", children: [
|
|
3105
|
+
icon ? /* @__PURE__ */ jsx3("span", { className: "grid size-10 place-items-center rounded-og-lg border border-og-border bg-og-surface-1 text-og-fg-muted shadow-sm", children: icon }) : null,
|
|
3106
|
+
title ? /* @__PURE__ */ jsx3("p", { className: "font-medium text-og-fg", children: title }) : null,
|
|
3107
|
+
/* @__PURE__ */ jsx3("div", { "data-contrast-audited": true, className: "leading-5", children })
|
|
3477
3108
|
] })
|
|
3478
3109
|
}
|
|
3479
3110
|
);
|
|
@@ -3482,15 +3113,12 @@ function Notice({
|
|
|
3482
3113
|
export {
|
|
3483
3114
|
visibleFileTree,
|
|
3484
3115
|
filePathVisibility,
|
|
3485
|
-
sandboxAcceptsLiveIo,
|
|
3486
3116
|
CapturedFileUnavailableError,
|
|
3487
3117
|
FileWriteConflictError,
|
|
3488
3118
|
useSandboxFiles,
|
|
3489
3119
|
useUnicodeFallbackFonts,
|
|
3490
3120
|
FileBrowser,
|
|
3491
3121
|
PierreFile,
|
|
3492
|
-
languageForPath,
|
|
3493
|
-
CodeEditor,
|
|
3494
3122
|
SandboxFiles
|
|
3495
3123
|
};
|
|
3496
|
-
//# sourceMappingURL=chunk-
|
|
3124
|
+
//# sourceMappingURL=chunk-E3G7SAYZ.js.map
|