@tangle-network/sandbox-ui 0.137.1 → 0.138.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/{WorkflowGraph-BcuJ0kgt.js → WorkflowGraph-DXmu60At.js} +4 -7
- package/dist/assets.d.ts +0 -18
- package/dist/assets.js +9 -17
- package/dist/{auth-CWe17Hly.js → auth-BDpoZ_2f.js} +1 -2
- package/dist/auth.d.ts +1 -1
- package/dist/auth.js +1 -2
- package/dist/{chat-_aHUfqtH.js → chat-BYTVLZQW.js} +9 -15
- package/dist/chat.d.ts +1 -1
- package/dist/chat.js +1 -2
- package/dist/{connections-C5DxYxvz.js → connections-DymjzHe_.js} +1 -2
- package/dist/connections.d.ts +1 -1
- package/dist/connections.js +1 -2
- package/dist/connectors.d.ts +0 -10
- package/dist/connectors.js +5 -9
- package/dist/{dashboard-SFakZEtu.js → dashboard-ClKA3opr.js} +31 -55
- package/dist/dashboard.d.ts +3 -3
- package/dist/dashboard.js +3 -3
- package/dist/diff-view-A0O0Z_SR.js +287 -0
- package/dist/diff-view-DDHWtR6X.d.ts +21 -0
- package/dist/editor.js +1 -2
- package/dist/{embedded-app-view-CYb9hevq.js → embedded-app-view-DXsoPale.js} +5 -8
- package/dist/{embedded-app-view-B_vMTtJn.d.ts → embedded-app-view-Ta5GI4hx.d.ts} +0 -4
- package/dist/files.js +1 -2
- package/dist/globals.css +43 -0
- package/dist/hooks.d.ts +3 -7
- package/dist/hooks.js +4 -6
- package/dist/{index-DsU8ts9f.d.ts → index-BAEvGqrn.d.ts} +0 -4
- package/dist/{index-DvmZLMT1.d.ts → index-BbfWVtZq.d.ts} +0 -2
- package/dist/index-C5h5T0nb.d.ts +91 -0
- package/dist/{index-ByzdHyte.d.ts → index-CvtEhIpk.d.ts} +25 -52
- package/dist/{index-ClRHbsoX.d.ts → index-DLX35YAa.d.ts} +0 -2
- package/dist/{index-AVDzT8Jw.d.ts → index-DRDtTgb0.d.ts} +2 -54
- package/dist/{index-C61CTrhx.d.ts → index-F42BOxUM.d.ts} +15 -37
- package/dist/{index-QBCEflyf.d.ts → index-ucJHuuVZ.d.ts} +2 -8
- package/dist/{index-DGil6iqm.d.ts → index-y2OPUSoY.d.ts} +0 -4
- package/dist/index.d.ts +17 -16
- package/dist/index.js +24 -20
- package/dist/integrations.d.ts +0 -14
- package/dist/integrations.js +6 -11
- package/dist/markdown.js +1 -2
- package/dist/{model-brand-B57CV8Lg.d.ts → model-brand-ZwVS49Fq.d.ts} +0 -2
- package/dist/{model-brand-BSr9on8C.js → model-brand-bTcMjQtB.js} +34 -67
- package/dist/{motion-D4njYpys.js → motion-Bn7ESHrj.js} +1 -2
- package/dist/{node-output-fuk0NV0V.js → node-output-udnwhShN.js} +9 -16
- package/dist/openui.js +1 -2
- package/dist/{page-layout-2IRtfx51.js → page-layout-CuOpvZys.js} +5 -9
- package/dist/pages.d.ts +2 -14
- package/dist/pages.js +9 -15
- package/dist/{primitives-CLOVnjWz.js → primitives-CiwDp4-0.js} +4 -7
- package/dist/primitives.d.ts +1 -1
- package/dist/primitives.js +1 -2
- package/dist/{provider-logo-BGCziCbM.js → provider-logo-CPKRPHcS.js} +1 -2
- package/dist/{rolldown-runtime-BBjsoOtd.js → rolldown-runtime-782esTHO.js} +1 -2
- package/dist/run-CliTxkfw.js +397 -0
- package/dist/run.d.ts +2 -2
- package/dist/run.js +1 -2
- package/dist/sdk-hooks.d.ts +1 -1
- package/dist/sdk-hooks.js +1 -1
- package/dist/{shell-header-CTh3oV_e.js → shell-header-CwqDzC4I.js} +2 -3
- package/dist/{sidecar-DgH_vQ6m.d.ts → sidecar-CNP4zXop.d.ts} +0 -2
- package/dist/stores.d.ts +0 -2
- package/dist/stores.js +1 -2
- package/dist/styles.css +43 -0
- package/dist/{terminal-X6r5pjgv.js → terminal-nUCznZRj.js} +3 -5
- package/dist/terminal.d.ts +1 -3
- package/dist/terminal.js +1 -2
- package/dist/{tree-data-DtoCNNBJ.js → tree-data-YXtcK6Ld.js} +2 -4
- package/dist/types.d.ts +1 -1
- package/dist/{usage-chart-BjM8ShvX.d.ts → usage-chart-BFpdkqNq.d.ts} +0 -6
- package/dist/{use-pty-session-B5Q_i9RI.js → use-pty-session-BHVQlSs-.js} +1 -2
- package/dist/{use-pty-session-DbAYO5uH.d.ts → use-pty-session-DSgtQyYX.d.ts} +0 -2
- package/dist/{use-sidecar-auth-CCTJcrq7.d.ts → use-sidecar-auth-CPevSSEj.d.ts} +0 -4
- package/dist/{use-sidecar-auth-DkdcufOz.js → use-sidecar-auth-DpG0aWQ3.js} +3 -6
- package/dist/utils-BER_bdgE.js +1 -0
- package/dist/utils.js +1 -2
- package/dist/vault-tree.d.ts +1 -1
- package/dist/vault-tree.js +1 -2
- package/dist/workbench/diff.d.ts +2 -0
- package/dist/workbench/diff.js +1 -0
- package/dist/workbench/embedded-app.d.ts +1 -1
- package/dist/workbench/embedded-app.js +1 -2
- package/dist/workbench-B3JL1qbt.js +892 -0
- package/dist/workbench.d.ts +4 -3
- package/dist/workbench.js +4 -3
- package/dist/workflows.d.ts +1 -13
- package/dist/workflows.js +4 -5
- package/dist/{workspace-cjk0axyT.js → workspace-DRhi6S3o.js} +325 -141
- package/dist/workspace.d.ts +1 -1
- package/dist/workspace.js +2 -2
- package/package.json +36 -28
- package/dist/utils-DzWbktWG.js +0 -2
- package/dist/workbench-DPZ6LXqf.js +0 -8136
|
@@ -1,9 +1,9 @@
|
|
|
1
|
-
import { r as Logo, t as primitives_exports } from "./primitives-
|
|
2
|
-
import { t as cn$1 } from "./utils-
|
|
3
|
-
import { r as ShellHeader } from "./shell-header-
|
|
4
|
-
import { n as MOTION_SURFACE, t as MOTION_CONTROL } from "./motion-
|
|
5
|
-
import { a as moonshot_default } from "./model-brand-
|
|
6
|
-
import "./page-layout-
|
|
1
|
+
import { r as Logo, t as primitives_exports } from "./primitives-CiwDp4-0.js";
|
|
2
|
+
import { t as cn$1 } from "./utils-BER_bdgE.js";
|
|
3
|
+
import { r as ShellHeader } from "./shell-header-CwqDzC4I.js";
|
|
4
|
+
import { n as MOTION_SURFACE, t as MOTION_CONTROL } from "./motion-Bn7ESHrj.js";
|
|
5
|
+
import { a as moonshot_default } from "./model-brand-bTcMjQtB.js";
|
|
6
|
+
import "./page-layout-CuOpvZys.js";
|
|
7
7
|
import { Avatar, AvatarFallback, AvatarImage, Dialog, DialogClose, DialogContent, DialogTitle, DialogTrigger, DropdownMenu, DropdownMenuContent, DropdownMenuItem, DropdownMenuLabel, DropdownMenuSeparator, DropdownMenuSub, DropdownMenuSubContent, DropdownMenuSubTrigger, DropdownMenuTrigger, Sheet, SheetClose, SheetContent, SheetTitle, SheetTrigger, Skeleton, StatCard, StatusPill } from "@tangle-network/ui/primitives";
|
|
8
8
|
import { Fragment, jsx, jsxs } from "react/jsx-runtime";
|
|
9
9
|
import * as React$1 from "react";
|
|
@@ -12,7 +12,7 @@ import { createPortal } from "react-dom";
|
|
|
12
12
|
import { Activity, ArrowRight, BarChart2, Bell, Bot, Box, Camera, Check, ChevronDown, ChevronLeft, ChevronRight, Clock, Code2, Copy, Cpu, DollarSign, ExternalLink, File, FileEdit, FilePlus, GitBranch, GitCommit, Globe, HardDrive, Key, Layers, MemoryStick, MessageSquare, Monitor, MoreHorizontal, MoreVertical, Network, PanelLeft, Play, Plug, Plus, Power, PowerOff, RotateCcw, Skull, Terminal, Trash2, User, Users } from "lucide-react";
|
|
13
13
|
import { focusField, focusRing, focusRingInset, timeAgo } from "@tangle-network/ui/utils";
|
|
14
14
|
import * as Select$1 from "@radix-ui/react-select";
|
|
15
|
-
|
|
15
|
+
// src/dashboard/sidebar-context.tsx
|
|
16
16
|
const PANEL_OPEN_KEY = "sandbox-sidebar-panel-open";
|
|
17
17
|
const RAIL_COLLAPSED_KEY = "sandbox-sidebar-rail-collapsed";
|
|
18
18
|
const SIDEBAR_MODE_KEY = "sandbox-sidebar-mode";
|
|
@@ -228,8 +228,7 @@ function RailTooltip({ label, description, children, disabled, className }) {
|
|
|
228
228
|
}), document.body)]
|
|
229
229
|
});
|
|
230
230
|
}
|
|
231
|
-
|
|
232
|
-
//#region src/dashboard/app-sidebar.tsx
|
|
231
|
+
// src/dashboard/app-sidebar.tsx
|
|
233
232
|
function DefaultLink$2({ href, to, className, children, ...rest }) {
|
|
234
233
|
return /* @__PURE__ */ jsx("a", {
|
|
235
234
|
href: href ?? to,
|
|
@@ -1109,8 +1108,7 @@ function ProfileAvatar({ user, isLoading = false, onLogout, onSettingsClick, set
|
|
|
1109
1108
|
]
|
|
1110
1109
|
})] });
|
|
1111
1110
|
}
|
|
1112
|
-
|
|
1113
|
-
//#region src/dashboard/out-of-credits.tsx
|
|
1111
|
+
// src/dashboard/out-of-credits.tsx
|
|
1114
1112
|
/**
|
|
1115
1113
|
* Canonical "out of credits" UX, shared across every Tangle product.
|
|
1116
1114
|
*
|
|
@@ -1195,8 +1193,7 @@ function OutOfCreditsModal({ balance, onClose, ctaLabel = "Add credits", classNa
|
|
|
1195
1193
|
})
|
|
1196
1194
|
});
|
|
1197
1195
|
}
|
|
1198
|
-
|
|
1199
|
-
//#region src/dashboard/resource-meter.tsx
|
|
1196
|
+
// src/dashboard/resource-meter.tsx
|
|
1200
1197
|
function getBarColor(percent) {
|
|
1201
1198
|
if (percent >= 90) return "bg-[var(--code-error)]";
|
|
1202
1199
|
if (percent >= 70) return "bg-[var(--surface-warning-text)]";
|
|
@@ -1230,8 +1227,7 @@ function ResourceMeter({ label, value, max = 100, unit, valueLabel, icon, classN
|
|
|
1230
1227
|
]
|
|
1231
1228
|
});
|
|
1232
1229
|
}
|
|
1233
|
-
|
|
1234
|
-
//#region src/dashboard/resource-snapshot.tsx
|
|
1230
|
+
// src/dashboard/resource-snapshot.tsx
|
|
1235
1231
|
/**
|
|
1236
1232
|
* Compact at-a-glance resource panel: a stack of {@link ResourceMeter}
|
|
1237
1233
|
* rows for an instantaneous CPU / memory / disk read. Time-series detail
|
|
@@ -1266,8 +1262,7 @@ function ResourceSnapshot({ title = "Resources", action, items, loading = false,
|
|
|
1266
1262
|
})]
|
|
1267
1263
|
});
|
|
1268
1264
|
}
|
|
1269
|
-
|
|
1270
|
-
//#region src/dashboard/activity-feed.tsx
|
|
1265
|
+
// src/dashboard/activity-feed.tsx
|
|
1271
1266
|
/**
|
|
1272
1267
|
* Newest-first list of recent sandbox activity (commits, snapshots,
|
|
1273
1268
|
* lifecycle events). Items are sorted by `timestamp` descending here so
|
|
@@ -1317,8 +1312,7 @@ function ActivityFeed({ title = "Recent activity", action, items, loading = fals
|
|
|
1317
1312
|
})]
|
|
1318
1313
|
});
|
|
1319
1314
|
}
|
|
1320
|
-
|
|
1321
|
-
//#region src/dashboard/sandbox-status.tsx
|
|
1315
|
+
// src/dashboard/sandbox-status.tsx
|
|
1322
1316
|
/**
|
|
1323
1317
|
* The one mapping from a sandbox's lifecycle state to a status tone and label.
|
|
1324
1318
|
* Cards, tables and products read it here, so a state cannot be green in one
|
|
@@ -1381,8 +1375,7 @@ function SandboxStatusPill({ status, ...props }) {
|
|
|
1381
1375
|
children: label
|
|
1382
1376
|
});
|
|
1383
1377
|
}
|
|
1384
|
-
|
|
1385
|
-
//#region src/dashboard/sandbox-card.tsx
|
|
1378
|
+
// src/dashboard/sandbox-card.tsx
|
|
1386
1379
|
function canAdminSandbox(sandbox) {
|
|
1387
1380
|
if (!sandbox.team) return true;
|
|
1388
1381
|
return sandbox.team.role === "owner" || sandbox.team.role === "admin";
|
|
@@ -1654,8 +1647,7 @@ function NewSandboxCard({ onClick, className }) {
|
|
|
1654
1647
|
]
|
|
1655
1648
|
});
|
|
1656
1649
|
}
|
|
1657
|
-
|
|
1658
|
-
//#region src/dashboard/sandbox-table.tsx
|
|
1650
|
+
// src/dashboard/sandbox-table.tsx
|
|
1659
1651
|
function isResumable(status) {
|
|
1660
1652
|
return status !== "running" && status !== "provisioning" && status !== "creating" && status !== "expired";
|
|
1661
1653
|
}
|
|
@@ -2035,8 +2027,7 @@ function SandboxTable({ sandboxes, page = 1, pageSize = 10, total, onPageChange,
|
|
|
2035
2027
|
})]
|
|
2036
2028
|
});
|
|
2037
2029
|
}
|
|
2038
|
-
|
|
2039
|
-
//#region src/dashboard/backend-selector.tsx
|
|
2030
|
+
// src/dashboard/backend-selector.tsx
|
|
2040
2031
|
function BackendSelector({ backends, selected, onChange, variant = "pill", label = "Model", placeholder = "Select a model", className, triggerClassName }) {
|
|
2041
2032
|
const current = backends.find((b) => b.type === selected);
|
|
2042
2033
|
const triggerText = current?.label ?? placeholder;
|
|
@@ -2119,8 +2110,7 @@ function BackendSelector({ backends, selected, onChange, variant = "pill", label
|
|
|
2119
2110
|
})]
|
|
2120
2111
|
});
|
|
2121
2112
|
}
|
|
2122
|
-
|
|
2123
|
-
//#region src/dashboard/harness-logo.tsx
|
|
2113
|
+
// src/dashboard/harness-logo.tsx
|
|
2124
2114
|
const HARNESS_BRAND = {
|
|
2125
2115
|
opencode: {
|
|
2126
2116
|
label: "OpenCode",
|
|
@@ -2144,7 +2134,7 @@ const HARNESS_BRAND = {
|
|
|
2144
2134
|
},
|
|
2145
2135
|
openclaw: {
|
|
2146
2136
|
label: "OpenClaw",
|
|
2147
|
-
logoUrl: "data:image/svg+xml,<svg fill=\"currentColor\" fill-rule=\"evenodd\" height=\"1em\" style=\"flex:none;line-height:1\" viewBox=\"0 0 24 24\" width=\"1em\" xmlns=\"http://www.w3.org/2000/svg\"><title>OpenClaw</title><g clip-path=\"url(%
|
|
2137
|
+
logoUrl: "data:image/svg+xml,<svg fill=\"currentColor\" fill-rule=\"evenodd\" height=\"1em\" style=\"flex:none;line-height:1\" viewBox=\"0 0 24 24\" width=\"1em\" xmlns=\"http://www.w3.org/2000/svg\"><title>OpenClaw</title><g clip-path=\"url(%23lobe-icons-open-claw-_R_0_)\"><path d=\"M9.046 7.104a.527.527 0 110 1.055.527.527 0 010-1.055z\"></path><path d=\"M15.376 7.104a.528.528 0 110 1.056.528.528 0 010-1.056z\"></path><path clip-rule=\"evenodd\" d=\"M16.877 1.912c.58-.27 1.14-.323 1.616-.037a.317.317 0 01-.326.542c-.227-.136-.547-.153-1.022.068-.352.165-.765.45-1.234.866 2.683 1.17 4.4 3.5 5.148 5.921a6.421 6.421 0 00-.704.184c-.578.016-1.174.204-1.502.735-.338.55-.268 1.276.072 2.069l.005.012.007.014c.523 1.045 1.318 1.91 2.2 2.284-.912 3.274-3.44 6.144-5.972 6.988v2.109h-2.11v-2.11c-1.043.417-2.086.01-2.11 0v2.11h-2.11v-2.11c-2.531-.843-5.061-3.713-5.973-6.987.882-.373 1.678-1.238 2.2-2.284l.007-.014.006-.012c.34-.793.41-1.518.071-2.069-.327-.531-.923-.719-1.503-.735a6.409 6.409 0 00-.704-.183c.749-2.421 2.466-4.751 5.149-5.922-.47-.416-.88-.701-1.234-.866-.474-.221-.794-.204-1.021-.068a.318.318 0 01-.435-.109.317.317 0 01.109-.433c.476-.286 1.036-.233 1.615.037.49.229 1.031.628 1.621 1.182A9.924 9.924 0 0112 2.568c1.199 0 2.284.19 3.256.526.59-.554 1.13-.953 1.62-1.182zM8.835 6.577a1.266 1.266 0 100 2.532 1.266 1.266 0 000-2.532zm6.33 0a1.267 1.267 0 100 2.533 1.267 1.267 0 000-2.533z\"></path><path d=\"M.395 13.118c-.966-1.932-.163-3.863 2.41-3.365v-.001l.05.01c.084.018.17.038.26.06.033.009.067.017.1.027.084.022.168.048.255.076l.09.027c.528 0 .95.158 1.16.501.212.343.212.87-.105 1.61-.085.17-.178.333-.276.489l-.01.017a4.967 4.967 0 01-.62.791l-.019.02c-1.092 1.117-2.496 1.336-3.295-.262z\"></path><path d=\"M21.193 9.753c2.574-.5 3.378 1.433 2.411 3.365-.58 1.159-1.476 1.361-2.342.96l-.011-.005a2.419 2.419 0 01-.114-.056l-.019-.01a2.751 2.751 0 01-.115-.067l-.023-.014c-.035-.022-.071-.044-.106-.068l-.05-.035c-.55-.388-1.062-1.007-1.44-1.76-.276-.647-.311-1.132-.174-1.472.176-.439.636-.639 1.23-.639.032-.011.066-.02.099-.03.08-.026.16-.05.238-.072l.117-.03a5.502 5.502 0 01.3-.067z\"></path></g><defs><clipPath id=\"lobe-icons-open-claw-_R_0_\"><path d=\"M0 0h24v24H0z\"></path></clipPath></defs></svg>"
|
|
2148
2138
|
},
|
|
2149
2139
|
hermes: {
|
|
2150
2140
|
label: "Hermes",
|
|
@@ -2208,8 +2198,7 @@ function HarnessLogo({ type, size = 16, className }) {
|
|
|
2208
2198
|
function cssUrl(url) {
|
|
2209
2199
|
return `url("${url.replace(/[\\"'#\n]/g, (char) => encodeURIComponent(char))}")`;
|
|
2210
2200
|
}
|
|
2211
|
-
|
|
2212
|
-
//#region src/dashboard/harness-picker.tsx
|
|
2201
|
+
// src/dashboard/harness-picker.tsx
|
|
2213
2202
|
/**
|
|
2214
2203
|
* Default option list with human-readable copy. Order is curated so the
|
|
2215
2204
|
* recommended choice (`opencode`) appears first; `cli-base` (no agent) last.
|
|
@@ -2314,8 +2303,7 @@ function HarnessPicker({ value, onChange, available, optionsOverride, label = "A
|
|
|
2314
2303
|
...rest
|
|
2315
2304
|
});
|
|
2316
2305
|
}
|
|
2317
|
-
|
|
2318
|
-
//#region src/dashboard/use-brand-theme-sync.ts
|
|
2306
|
+
// src/dashboard/use-brand-theme-sync.ts
|
|
2319
2307
|
/**
|
|
2320
2308
|
* Keep `<html>`'s `data-theme` attribute and `.light` class in lockstep with the
|
|
2321
2309
|
* `.dark` class.
|
|
@@ -2364,8 +2352,7 @@ function useBrandThemeSync() {
|
|
|
2364
2352
|
function isPlainTheme(value) {
|
|
2365
2353
|
return value === null || value === "" || value === "dark" || value === "light";
|
|
2366
2354
|
}
|
|
2367
|
-
|
|
2368
|
-
//#region src/dashboard/dashboard-layout.tsx
|
|
2355
|
+
// src/dashboard/dashboard-layout.tsx
|
|
2369
2356
|
function MenuIcon$1({ className }) {
|
|
2370
2357
|
return /* @__PURE__ */ jsxs("svg", {
|
|
2371
2358
|
xmlns: "http://www.w3.org/2000/svg",
|
|
@@ -2814,8 +2801,7 @@ function DashboardLayout({ defaultPanelOpen, defaultMode, labeledRail, defaultRa
|
|
|
2814
2801
|
})
|
|
2815
2802
|
});
|
|
2816
2803
|
}
|
|
2817
|
-
|
|
2818
|
-
//#region src/dashboard/sidebar-layout.tsx
|
|
2804
|
+
// src/dashboard/sidebar-layout.tsx
|
|
2819
2805
|
const HIDE_BELOW_CLASS = {
|
|
2820
2806
|
md: "max-md:hidden",
|
|
2821
2807
|
lg: "max-lg:hidden"
|
|
@@ -3180,8 +3166,7 @@ function SidebarLayout({ panelOpen, onPanelOpenChange, defaultPanelOpen, railCol
|
|
|
3180
3166
|
children: /* @__PURE__ */ jsx(SidebarLayoutInner, { ...props })
|
|
3181
3167
|
});
|
|
3182
3168
|
}
|
|
3183
|
-
|
|
3184
|
-
//#region src/dashboard/metric-area-chart.tsx
|
|
3169
|
+
// src/dashboard/metric-area-chart.tsx
|
|
3185
3170
|
const TONE_VARS = {
|
|
3186
3171
|
primary: "var(--brand-primary, hsl(var(--primary)))",
|
|
3187
3172
|
success: "var(--status-running, #22c55e)",
|
|
@@ -3327,8 +3312,7 @@ function MetricAreaChart({ points, label, formatValue, maxValue, detail, tone =
|
|
|
3327
3312
|
]
|
|
3328
3313
|
});
|
|
3329
3314
|
}
|
|
3330
|
-
|
|
3331
|
-
//#region src/dashboard/system-logs.tsx
|
|
3315
|
+
// src/dashboard/system-logs.tsx
|
|
3332
3316
|
function SystemLogsViewer({ apiUrl, token, className }) {
|
|
3333
3317
|
const [logs, setLogs] = useState([]);
|
|
3334
3318
|
const [error, setError] = useState(null);
|
|
@@ -3442,8 +3426,7 @@ function SystemLogsViewer({ apiUrl, token, className }) {
|
|
|
3442
3426
|
})]
|
|
3443
3427
|
});
|
|
3444
3428
|
}
|
|
3445
|
-
|
|
3446
|
-
//#region src/dashboard/usage-summary.tsx
|
|
3429
|
+
// src/dashboard/usage-summary.tsx
|
|
3447
3430
|
function UsageSummary({ data, loading = false, className }) {
|
|
3448
3431
|
if (loading || !data) return /* @__PURE__ */ jsx("div", {
|
|
3449
3432
|
className: cn$1("grid grid-cols-2 gap-4 lg:grid-cols-4", className),
|
|
@@ -3483,8 +3466,7 @@ function UsageSummary({ data, loading = false, className }) {
|
|
|
3483
3466
|
]
|
|
3484
3467
|
});
|
|
3485
3468
|
}
|
|
3486
|
-
|
|
3487
|
-
//#region src/dashboard/git-panel.tsx
|
|
3469
|
+
// src/dashboard/git-panel.tsx
|
|
3488
3470
|
function GitPanel({ status, log, loading = false, onRefresh, className }) {
|
|
3489
3471
|
if (loading) return /* @__PURE__ */ jsxs("div", {
|
|
3490
3472
|
className: cn$1("rounded-lg border border-[var(--md3-outline-variant)] bg-surface-container overflow-hidden", className),
|
|
@@ -3627,8 +3609,7 @@ function GitPanel({ status, log, loading = false, onRefresh, className }) {
|
|
|
3627
3609
|
]
|
|
3628
3610
|
});
|
|
3629
3611
|
}
|
|
3630
|
-
|
|
3631
|
-
//#region src/dashboard/ports-list.tsx
|
|
3612
|
+
// src/dashboard/ports-list.tsx
|
|
3632
3613
|
function PortsList({ ports, onExposePort, onRemovePort, isExposing = false, className }) {
|
|
3633
3614
|
const [newPort, setNewPort] = React$1.useState("");
|
|
3634
3615
|
const [copiedPort, setCopiedPort] = React$1.useState(null);
|
|
@@ -3795,8 +3776,7 @@ function PortsList({ ports, onExposePort, onRemovePort, isExposing = false, clas
|
|
|
3795
3776
|
]
|
|
3796
3777
|
});
|
|
3797
3778
|
}
|
|
3798
|
-
|
|
3799
|
-
//#region src/dashboard/template-card.tsx
|
|
3779
|
+
// src/dashboard/template-card.tsx
|
|
3800
3780
|
function TemplateCard({ template, onUseTemplate, className }) {
|
|
3801
3781
|
return /* @__PURE__ */ jsxs("div", {
|
|
3802
3782
|
className: cn$1("group relative flex flex-col justify-between rounded-xl border border-[var(--md3-outline-variant)] bg-surface-container p-6 transition-colors hover:border-[var(--border-accent)]", className),
|
|
@@ -3831,8 +3811,7 @@ function TemplateCard({ template, onUseTemplate, className }) {
|
|
|
3831
3811
|
})]
|
|
3832
3812
|
});
|
|
3833
3813
|
}
|
|
3834
|
-
|
|
3835
|
-
//#region src/dashboard/process-list.tsx
|
|
3814
|
+
// src/dashboard/process-list.tsx
|
|
3836
3815
|
function formatUptime(startedAt) {
|
|
3837
3816
|
if (!startedAt) return "-";
|
|
3838
3817
|
const ms = Date.now() - new Date(startedAt).getTime();
|
|
@@ -3971,8 +3950,7 @@ function ProcessList({ processes, onSpawn, onKill, loading = false, className })
|
|
|
3971
3950
|
]
|
|
3972
3951
|
});
|
|
3973
3952
|
}
|
|
3974
|
-
|
|
3975
|
-
//#region src/dashboard/snapshot-list.tsx
|
|
3953
|
+
// src/dashboard/snapshot-list.tsx
|
|
3976
3954
|
function formatBytes(bytes) {
|
|
3977
3955
|
if (bytes == null || bytes < 0) return "-";
|
|
3978
3956
|
if (bytes === 0) return "0 B";
|
|
@@ -4158,8 +4136,7 @@ function SnapshotList({ snapshots, onCreate, onRestore, onSaveAsTemplate, loadin
|
|
|
4158
4136
|
]
|
|
4159
4137
|
});
|
|
4160
4138
|
}
|
|
4161
|
-
|
|
4162
|
-
//#region src/dashboard/promo-banner.tsx
|
|
4139
|
+
// src/dashboard/promo-banner.tsx
|
|
4163
4140
|
function PromoBanner({ title, description, buttonLabel, href, onClick, icon, disabled = false, className }) {
|
|
4164
4141
|
const buttonClasses = cn$1("mt-6 inline-flex items-center gap-2 rounded-md border border-white/20 bg-[var(--btn-primary-bg)] px-4 py-2 text-sm font-medium text-[var(--btn-primary-text)] transition-colors", disabled ? "opacity-50 cursor-not-allowed" : "hover:bg-[var(--btn-primary-hover)]");
|
|
4165
4142
|
const buttonContent = /* @__PURE__ */ jsxs(Fragment, { children: [buttonLabel, /* @__PURE__ */ jsxs("svg", {
|
|
@@ -4215,5 +4192,4 @@ function PromoBanner({ title, description, buttonLabel, href, onClick, icon, dis
|
|
|
4215
4192
|
]
|
|
4216
4193
|
});
|
|
4217
4194
|
}
|
|
4218
|
-
//#endregion
|
|
4219
4195
|
export { useSidebar as $, parseInsufficientBalance as A, SidebarPanel as B, SandboxStatusPill as C, ResourceMeter as D, ResourceSnapshot as E, RailHeader as F, SidebarRailNav as G, SidebarPanelHeader as H, RailModeButton as I, SIDEBAR_PANEL_WIDTH as J, RailTooltip as K, RailSeparator as L, RailButton as M, RailExpandable as N, INSUFFICIENT_BALANCE_CODE as O, RailFlyout as P, SidebarProvider as Q, Sidebar as R, SANDBOX_STATUS as S, ActivityFeed as T, SidebarRail as U, SidebarPanelContent as V, SidebarRailFooter as W, SIDEBAR_RAIL_WIDTH as X, SIDEBAR_RAIL_LABELED_WIDTH as Y, SIDEBAR_TOTAL_WIDTH as Z, BackendSelector as _, PortsList as a, SandboxCard as b, SystemLogsViewer as c, DashboardLayout as d, HARNESS_OPTIONS as f, HarnessLogo as g, HARNESS_BRAND as h, TemplateCard as i, ProfileAvatar as j, OutOfCreditsModal as k, MetricAreaChart as l, chatCapableHarnesses as m, SnapshotList as n, GitPanel as o, HarnessPicker as p, SIDEBAR_MOBILE_WIDTH as q, ProcessList as r, UsageSummary as s, PromoBanner as t, SidebarLayout as u, SandboxTable as v, sandboxStatus as w, canAdminSandbox as x, NewSandboxCard as y, SidebarContent as z };
|
package/dist/dashboard.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { $ as SandboxTable, $t as Sidebar, A as MetricChartPoint, At as SIDEBAR_TOTAL_WIDTH, B as ProductVariant, Bt as RailButton, C as UsageSummary, Ct as OutOfCreditsModal, D as SystemLogsViewerProps, Dt as SIDEBAR_PANEL_WIDTH, E as SystemLogsViewer, Et as SIDEBAR_MOBILE_WIDTH, F as SidebarLayoutProps, Ft as RailTooltipProps, G as HARNESS_OPTIONS, Gt as RailFlyout, H as HarnessBrand, Ht as RailExpandable, I as DashboardLayout, It as McpServer, J as HarnessType, Jt as RailHeaderProps, K as HarnessPicker, Kt as RailFlyoutProps, L as DashboardLayoutProps, Lt as AppearanceController, M as SidebarLayout, Mt as SidebarProviderProps, N as SidebarLayoutFlyoutItem, Nt as useSidebar, O as MetricAreaChart, Ot as SIDEBAR_RAIL_LABELED_WIDTH, P as SidebarLayoutNavItem, Pt as RailTooltip, Q as BackendSelectorProps, Qt as RailSeparatorProps, R as DashboardUser, Rt as ProfileAvatar, S as GitStatusData, St as InsufficientBalance, T as UsageSummaryProps, Tt as parseInsufficientBalance, U as HarnessLogo, Ut as RailExpandableProps, V as HARNESS_BRAND, Vt as RailButtonProps, W as HarnessLogoProps, Wt as RailExpandableSubItem, X as Backend, Xt as RailModeButtonProps, Y as chatCapableHarnesses, Yt as RailModeButton, Z as BackendSelector, Zt as RailSeparator, _ as PortsList, _t as ResourceSnapshotItem, a as PromoBanner, an as SidebarPanelHeader, at as NewSandboxCard, b as GitPanel, bt as ResourceMeterProps, c as SnapshotList, cn as SidebarProps, ct as SandboxCardData, d as ProcessList, dn as SidebarRailFooterProps, dt as TeamRole, en as SidebarContent, et as SandboxTableProps, f as ProcessListProps, fn as SidebarRailNav, ft as canAdminSandbox, g as ExposedPort, gn as ThemeMode, gt as ResourceSnapshot, h as TemplateCardProps, hn as SidebarUser, ht as ActivityItem, i as SandboxPageShellProps, in as SidebarPanelContentProps, it as sandboxStatus, j as MetricChartTone, jt as SidebarProvider, k as MetricAreaChartProps, kt as SIDEBAR_RAIL_WIDTH, l as SnapshotListProps, ln as SidebarRail, lt as SandboxCardProps, m as TemplateCardData, mn as SidebarRailProps, mt as ActivityFeedProps, n as DashboardPageHeaderProps, nn as SidebarPanel, nt as SandboxStatusPill, o as PromoBannerProps, on as SidebarPanelHeaderProps, ot as NewSandboxCardProps, p as TemplateCard, pn as SidebarRailNavProps, pt as ActivityFeed, q as HarnessPickerProps, qt as RailHeader, r as SandboxPageShell, rn as SidebarPanelContent, rt as SandboxStatusPillProps, s as SnapshotInfo, sn as SidebarPanelProps, st as SandboxCard, t as DashboardPageHeader, tn as SidebarContentProps, tt as SANDBOX_STATUS, u as ProcessInfo, un as SidebarRailFooter, ut as SandboxStatus, v as PortsListProps, vt as ResourceSnapshotProps, w as UsageSummaryData, wt as OutOfCreditsModalProps, x as GitPanelProps, xt as INSUFFICIENT_BALANCE_CODE, y as GitCommitData, yt as ResourceMeter, z as NavItem, zt as ProfileAvatarProps } from "./index-
|
|
2
|
-
import { a as canonicalModelId, i as ProviderMark, n as ModelBrandStack, o as modelBrandFor, r as ModelInfo, t as ModelBrandIdentity } from "./model-brand-
|
|
3
|
-
import { a as PricingPageProps, c as BillingBalance, d as BillingSubscription, f as BillingUsage, i as PricingPage, l as BillingDashboard, n as UsageChartProps, o as PricingTier, r as UsageDataPoint, s as formatPrice, t as UsageChart, u as BillingDashboardProps } from "./usage-chart-
|
|
1
|
+
import { $ as SandboxTable, $t as Sidebar, A as MetricChartPoint, At as SIDEBAR_TOTAL_WIDTH, B as ProductVariant, Bt as RailButton, C as UsageSummary, Ct as OutOfCreditsModal, D as SystemLogsViewerProps, Dt as SIDEBAR_PANEL_WIDTH, E as SystemLogsViewer, Et as SIDEBAR_MOBILE_WIDTH, F as SidebarLayoutProps, Ft as RailTooltipProps, G as HARNESS_OPTIONS, Gt as RailFlyout, H as HarnessBrand, Ht as RailExpandable, I as DashboardLayout, It as McpServer, J as HarnessType, Jt as RailHeaderProps, K as HarnessPicker, Kt as RailFlyoutProps, L as DashboardLayoutProps, Lt as AppearanceController, M as SidebarLayout, Mt as SidebarProviderProps, N as SidebarLayoutFlyoutItem, Nt as useSidebar, O as MetricAreaChart, Ot as SIDEBAR_RAIL_LABELED_WIDTH, P as SidebarLayoutNavItem, Pt as RailTooltip, Q as BackendSelectorProps, Qt as RailSeparatorProps, R as DashboardUser, Rt as ProfileAvatar, S as GitStatusData, St as InsufficientBalance, T as UsageSummaryProps, Tt as parseInsufficientBalance, U as HarnessLogo, Ut as RailExpandableProps, V as HARNESS_BRAND, Vt as RailButtonProps, W as HarnessLogoProps, Wt as RailExpandableSubItem, X as Backend, Xt as RailModeButtonProps, Y as chatCapableHarnesses, Yt as RailModeButton, Z as BackendSelector, Zt as RailSeparator, _ as PortsList, _t as ResourceSnapshotItem, a as PromoBanner, an as SidebarPanelHeader, at as NewSandboxCard, b as GitPanel, bt as ResourceMeterProps, c as SnapshotList, cn as SidebarProps, ct as SandboxCardData, d as ProcessList, dn as SidebarRailFooterProps, dt as TeamRole, en as SidebarContent, et as SandboxTableProps, f as ProcessListProps, fn as SidebarRailNav, ft as canAdminSandbox, g as ExposedPort, gn as ThemeMode, gt as ResourceSnapshot, h as TemplateCardProps, hn as SidebarUser, ht as ActivityItem, i as SandboxPageShellProps, in as SidebarPanelContentProps, it as sandboxStatus, j as MetricChartTone, jt as SidebarProvider, k as MetricAreaChartProps, kt as SIDEBAR_RAIL_WIDTH, l as SnapshotListProps, ln as SidebarRail, lt as SandboxCardProps, m as TemplateCardData, mn as SidebarRailProps, mt as ActivityFeedProps, n as DashboardPageHeaderProps, nn as SidebarPanel, nt as SandboxStatusPill, o as PromoBannerProps, on as SidebarPanelHeaderProps, ot as NewSandboxCardProps, p as TemplateCard, pn as SidebarRailNavProps, pt as ActivityFeed, q as HarnessPickerProps, qt as RailHeader, r as SandboxPageShell, rn as SidebarPanelContent, rt as SandboxStatusPillProps, s as SnapshotInfo, sn as SidebarPanelProps, st as SandboxCard, t as DashboardPageHeader, tn as SidebarContentProps, tt as SANDBOX_STATUS, u as ProcessInfo, un as SidebarRailFooter, ut as SandboxStatus, v as PortsListProps, vt as ResourceSnapshotProps, w as UsageSummaryData, wt as OutOfCreditsModalProps, x as GitPanelProps, xt as INSUFFICIENT_BALANCE_CODE, y as GitCommitData, yt as ResourceMeter, z as NavItem, zt as ProfileAvatarProps } from "./index-DRDtTgb0.js";
|
|
2
|
+
import { a as canonicalModelId, i as ProviderMark, n as ModelBrandStack, o as modelBrandFor, r as ModelInfo, t as ModelBrandIdentity } from "./model-brand-ZwVS49Fq.js";
|
|
3
|
+
import { a as PricingPageProps, c as BillingBalance, d as BillingSubscription, f as BillingUsage, i as PricingPage, l as BillingDashboard, n as UsageChartProps, o as PricingTier, r as UsageDataPoint, s as formatPrice, t as UsageChart, u as BillingDashboardProps } from "./usage-chart-BFpdkqNq.js";
|
|
4
4
|
export { ActivityFeed, type ActivityFeedProps, type ActivityItem, type AppearanceController, type Backend, BackendSelector, type BackendSelectorProps, type BillingBalance, BillingDashboard, type BillingDashboardProps, type BillingSubscription, type BillingUsage, DashboardLayout, type DashboardLayoutProps, DashboardPageHeader, type DashboardPageHeaderProps, type SnapshotInfo as DashboardSnapshotInfo, type DashboardUser, type ExposedPort, type GitCommitData, GitPanel, type GitPanelProps, type GitStatusData, HARNESS_BRAND, HARNESS_OPTIONS, type HarnessBrand, HarnessLogo, type HarnessLogoProps, HarnessPicker, type HarnessPickerProps, type HarnessType, INSUFFICIENT_BALANCE_CODE, type InsufficientBalance, type McpServer, MetricAreaChart, type MetricAreaChartProps, type MetricChartPoint, type MetricChartTone, type ModelBrandIdentity, ModelBrandStack, type ModelInfo, type NavItem, NewSandboxCard, type NewSandboxCardProps, OutOfCreditsModal, type OutOfCreditsModalProps, PortsList, type PortsListProps, PricingPage, type PricingPageProps, type PricingTier, type ProcessInfo, ProcessList, type ProcessListProps, type ProductVariant, ProfileAvatar, type ProfileAvatarProps, PromoBanner, type PromoBannerProps, ProviderMark, RailButton, type RailButtonProps, RailExpandable, type RailExpandableProps, type RailExpandableSubItem, RailFlyout, type RailFlyoutProps, RailHeader, type RailHeaderProps, RailModeButton, type RailModeButtonProps, RailSeparator, type RailSeparatorProps, RailTooltip, type RailTooltipProps, ResourceMeter, type ResourceMeterProps, ResourceSnapshot, type ResourceSnapshotItem, type ResourceSnapshotProps, SANDBOX_STATUS, SIDEBAR_MOBILE_WIDTH, SIDEBAR_PANEL_WIDTH, SIDEBAR_RAIL_LABELED_WIDTH, SIDEBAR_RAIL_WIDTH, SIDEBAR_TOTAL_WIDTH, SandboxCard, type SandboxCardData, type SandboxCardProps, SandboxPageShell, type SandboxPageShellProps, type SandboxStatus, SandboxStatusPill, type SandboxStatusPillProps, SandboxTable, type SandboxTableProps, Sidebar, SidebarContent, type SidebarContentProps, SidebarLayout, type SidebarLayoutFlyoutItem, type SidebarLayoutNavItem, type SidebarLayoutProps, SidebarPanel, SidebarPanelContent, type SidebarPanelContentProps, SidebarPanelHeader, type SidebarPanelHeaderProps, type SidebarPanelProps, type SidebarProps, SidebarProvider, type SidebarProviderProps, SidebarRail, SidebarRailFooter, type SidebarRailFooterProps, SidebarRailNav, type SidebarRailNavProps, type SidebarRailProps, type SidebarUser, SnapshotList, type SnapshotListProps, SystemLogsViewer, type SystemLogsViewerProps, type TeamRole, TemplateCard, type TemplateCardData, type TemplateCardProps, type ThemeMode, UsageChart, type UsageChartProps, type UsageDataPoint, UsageSummary, type UsageSummaryData, type UsageSummaryProps, canAdminSandbox, canonicalModelId, chatCapableHarnesses, formatPrice, modelBrandFor, parseInsufficientBalance, sandboxStatus, useSidebar };
|
package/dist/dashboard.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { $ as useSidebar, A as parseInsufficientBalance, B as SidebarPanel, C as SandboxStatusPill, D as ResourceMeter, E as ResourceSnapshot, F as RailHeader, G as SidebarRailNav, H as SidebarPanelHeader, I as RailModeButton, J as SIDEBAR_PANEL_WIDTH, K as RailTooltip, L as RailSeparator, M as RailButton, N as RailExpandable, O as INSUFFICIENT_BALANCE_CODE, P as RailFlyout, Q as SidebarProvider, R as Sidebar, S as SANDBOX_STATUS, T as ActivityFeed, U as SidebarRail, V as SidebarPanelContent, W as SidebarRailFooter, X as SIDEBAR_RAIL_WIDTH, Y as SIDEBAR_RAIL_LABELED_WIDTH, Z as SIDEBAR_TOTAL_WIDTH, _ as BackendSelector, a as PortsList, b as SandboxCard, c as SystemLogsViewer, d as DashboardLayout, f as HARNESS_OPTIONS, g as HarnessLogo, h as HARNESS_BRAND, i as TemplateCard, j as ProfileAvatar, k as OutOfCreditsModal, l as MetricAreaChart, m as chatCapableHarnesses, n as SnapshotList, o as GitPanel, p as HarnessPicker, q as SIDEBAR_MOBILE_WIDTH, r as ProcessList, s as UsageSummary, t as PromoBanner, u as SidebarLayout, v as SandboxTable, w as sandboxStatus, x as canAdminSandbox, y as NewSandboxCard, z as SidebarContent } from "./dashboard-
|
|
2
|
-
import { i as modelBrandFor, n as ProviderMark, r as canonicalModelId, t as ModelBrandStack } from "./model-brand-
|
|
3
|
-
import { a as formatPrice, i as PricingPage, n as SandboxPageShell, o as BillingDashboard, r as UsageChart, t as DashboardPageHeader } from "./page-layout-
|
|
1
|
+
import { $ as useSidebar, A as parseInsufficientBalance, B as SidebarPanel, C as SandboxStatusPill, D as ResourceMeter, E as ResourceSnapshot, F as RailHeader, G as SidebarRailNav, H as SidebarPanelHeader, I as RailModeButton, J as SIDEBAR_PANEL_WIDTH, K as RailTooltip, L as RailSeparator, M as RailButton, N as RailExpandable, O as INSUFFICIENT_BALANCE_CODE, P as RailFlyout, Q as SidebarProvider, R as Sidebar, S as SANDBOX_STATUS, T as ActivityFeed, U as SidebarRail, V as SidebarPanelContent, W as SidebarRailFooter, X as SIDEBAR_RAIL_WIDTH, Y as SIDEBAR_RAIL_LABELED_WIDTH, Z as SIDEBAR_TOTAL_WIDTH, _ as BackendSelector, a as PortsList, b as SandboxCard, c as SystemLogsViewer, d as DashboardLayout, f as HARNESS_OPTIONS, g as HarnessLogo, h as HARNESS_BRAND, i as TemplateCard, j as ProfileAvatar, k as OutOfCreditsModal, l as MetricAreaChart, m as chatCapableHarnesses, n as SnapshotList, o as GitPanel, p as HarnessPicker, q as SIDEBAR_MOBILE_WIDTH, r as ProcessList, s as UsageSummary, t as PromoBanner, u as SidebarLayout, v as SandboxTable, w as sandboxStatus, x as canAdminSandbox, y as NewSandboxCard, z as SidebarContent } from "./dashboard-ClKA3opr.js";
|
|
2
|
+
import { i as modelBrandFor, n as ProviderMark, r as canonicalModelId, t as ModelBrandStack } from "./model-brand-bTcMjQtB.js";
|
|
3
|
+
import { a as formatPrice, i as PricingPage, n as SandboxPageShell, o as BillingDashboard, r as UsageChart, t as DashboardPageHeader } from "./page-layout-CuOpvZys.js";
|
|
4
4
|
export { ActivityFeed, BackendSelector, BillingDashboard, DashboardLayout, DashboardPageHeader, GitPanel, HARNESS_BRAND, HARNESS_OPTIONS, HarnessLogo, HarnessPicker, INSUFFICIENT_BALANCE_CODE, MetricAreaChart, ModelBrandStack, NewSandboxCard, OutOfCreditsModal, PortsList, PricingPage, ProcessList, ProfileAvatar, PromoBanner, ProviderMark, RailButton, RailExpandable, RailFlyout, RailHeader, RailModeButton, RailSeparator, RailTooltip, ResourceMeter, ResourceSnapshot, SANDBOX_STATUS, SIDEBAR_MOBILE_WIDTH, SIDEBAR_PANEL_WIDTH, SIDEBAR_RAIL_LABELED_WIDTH, SIDEBAR_RAIL_WIDTH, SIDEBAR_TOTAL_WIDTH, SandboxCard, SandboxPageShell, SandboxStatusPill, SandboxTable, Sidebar, SidebarContent, SidebarLayout, SidebarPanel, SidebarPanelContent, SidebarPanelHeader, SidebarProvider, SidebarRail, SidebarRailFooter, SidebarRailNav, SnapshotList, SystemLogsViewer, TemplateCard, UsageChart, UsageSummary, canAdminSandbox, canonicalModelId, chatCapableHarnesses, formatPrice, modelBrandFor, parseInsufficientBalance, sandboxStatus, useSidebar };
|
|
@@ -0,0 +1,287 @@
|
|
|
1
|
+
import { t as cn } from "./utils-BER_bdgE.js";
|
|
2
|
+
import { Button } from "@tangle-network/ui/primitives";
|
|
3
|
+
import { jsx, jsxs } from "react/jsx-runtime";
|
|
4
|
+
import * as React$1 from "react";
|
|
5
|
+
import { File, FileDiff, getSingularPatch } from "@pierre/diffs";
|
|
6
|
+
import { createTwoFilesPatch, diffLines } from "diff";
|
|
7
|
+
// src/workbench/syntax.tsx
|
|
8
|
+
/** The one code theme: CodeSurface and DiffView share @pierre/diffs' Shiki highlighter and these themes. */
|
|
9
|
+
const CODE_THEME = {
|
|
10
|
+
dark: "github-dark",
|
|
11
|
+
light: "github-light"
|
|
12
|
+
};
|
|
13
|
+
const CODE_FONT_FAMILY = "var(--font-mono, \"Geist Mono\", \"JetBrains Mono\", ui-monospace, monospace)";
|
|
14
|
+
const CONTAINER_TAG = "diffs-container";
|
|
15
|
+
/** Follow the host's Brand theme (`data-theme` or the `light` class on <html>) unless the caller fixes one. */
|
|
16
|
+
function useHostThemeType(explicit) {
|
|
17
|
+
const read = () => {
|
|
18
|
+
if (typeof document === "undefined") return "dark";
|
|
19
|
+
const root = document.documentElement;
|
|
20
|
+
return root.getAttribute("data-theme") === "light" || root.classList.contains("light") ? "light" : "dark";
|
|
21
|
+
};
|
|
22
|
+
const [host, setHost] = React$1.useState(read);
|
|
23
|
+
React$1.useEffect(() => {
|
|
24
|
+
if (explicit) return;
|
|
25
|
+
setHost(read());
|
|
26
|
+
const observer = new MutationObserver(() => setHost(read()));
|
|
27
|
+
observer.observe(document.documentElement, {
|
|
28
|
+
attributes: true,
|
|
29
|
+
attributeFilter: ["class", "data-theme"]
|
|
30
|
+
});
|
|
31
|
+
return () => observer.disconnect();
|
|
32
|
+
}, [explicit]);
|
|
33
|
+
return explicit ?? host;
|
|
34
|
+
}
|
|
35
|
+
/**
|
|
36
|
+
* Read-only code renderer on @pierre/diffs' `File`, the same Shiki highlighter and theme as DiffView. A new
|
|
37
|
+
* custom element per render survives StrictMode remounts; the surrounding element owns scrolling.
|
|
38
|
+
*/
|
|
39
|
+
function CodeSurface({ code, filename, language, showLineNumbers = true, wrap = false, line, themeType, className }) {
|
|
40
|
+
const theme = useHostThemeType(themeType);
|
|
41
|
+
const hostRef = React$1.useRef(null);
|
|
42
|
+
const instanceRef = React$1.useRef(null);
|
|
43
|
+
const containerRef = React$1.useRef(null);
|
|
44
|
+
const latestTheme = React$1.useRef(theme);
|
|
45
|
+
const appliedTheme = React$1.useRef(theme);
|
|
46
|
+
const pendingLine = React$1.useRef(line);
|
|
47
|
+
React$1.useLayoutEffect(() => {
|
|
48
|
+
latestTheme.current = theme;
|
|
49
|
+
}, [theme]);
|
|
50
|
+
const reveal = React$1.useCallback(() => {
|
|
51
|
+
const target = pendingLine.current;
|
|
52
|
+
const element = target ? containerRef.current?.shadowRoot?.querySelector(`[data-line="${target}"]`) : null;
|
|
53
|
+
if (!target || !element) return;
|
|
54
|
+
pendingLine.current = void 0;
|
|
55
|
+
instanceRef.current?.setSelectedLines({
|
|
56
|
+
start: target,
|
|
57
|
+
end: target
|
|
58
|
+
});
|
|
59
|
+
element.scrollIntoView({ block: "center" });
|
|
60
|
+
}, []);
|
|
61
|
+
React$1.useLayoutEffect(() => {
|
|
62
|
+
const host = hostRef.current;
|
|
63
|
+
if (host == null) return;
|
|
64
|
+
const container = document.createElement(CONTAINER_TAG);
|
|
65
|
+
container.style.setProperty("--diffs-font-family", CODE_FONT_FAMILY);
|
|
66
|
+
container.style.display = "block";
|
|
67
|
+
container.style.minWidth = "0";
|
|
68
|
+
container.style.maxWidth = "100%";
|
|
69
|
+
host.appendChild(container);
|
|
70
|
+
containerRef.current = container;
|
|
71
|
+
const instance = new File({
|
|
72
|
+
theme: CODE_THEME,
|
|
73
|
+
themeType: latestTheme.current,
|
|
74
|
+
overflow: wrap ? "wrap" : "scroll",
|
|
75
|
+
disableFileHeader: true,
|
|
76
|
+
disableLineNumbers: !showLineNumbers,
|
|
77
|
+
onPostRender: () => reveal()
|
|
78
|
+
});
|
|
79
|
+
instanceRef.current = instance;
|
|
80
|
+
appliedTheme.current = latestTheme.current;
|
|
81
|
+
instance.render({
|
|
82
|
+
file: {
|
|
83
|
+
name: filename,
|
|
84
|
+
contents: code,
|
|
85
|
+
...language ? { lang: language } : {}
|
|
86
|
+
},
|
|
87
|
+
fileContainer: container
|
|
88
|
+
});
|
|
89
|
+
return () => {
|
|
90
|
+
if (instanceRef.current === instance) instanceRef.current = null;
|
|
91
|
+
instance.cleanUp();
|
|
92
|
+
container.remove();
|
|
93
|
+
};
|
|
94
|
+
}, [
|
|
95
|
+
code,
|
|
96
|
+
filename,
|
|
97
|
+
language,
|
|
98
|
+
showLineNumbers,
|
|
99
|
+
wrap,
|
|
100
|
+
reveal
|
|
101
|
+
]);
|
|
102
|
+
React$1.useLayoutEffect(() => {
|
|
103
|
+
if (appliedTheme.current === theme) return;
|
|
104
|
+
instanceRef.current?.setThemeType(theme);
|
|
105
|
+
appliedTheme.current = theme;
|
|
106
|
+
}, [theme]);
|
|
107
|
+
React$1.useLayoutEffect(() => {
|
|
108
|
+
pendingLine.current = line;
|
|
109
|
+
reveal();
|
|
110
|
+
}, [line, reveal]);
|
|
111
|
+
return /* @__PURE__ */ jsx("div", {
|
|
112
|
+
ref: hostRef,
|
|
113
|
+
"data-code-surface": "",
|
|
114
|
+
role: "region",
|
|
115
|
+
"aria-label": filename,
|
|
116
|
+
tabIndex: 0,
|
|
117
|
+
className,
|
|
118
|
+
style: {
|
|
119
|
+
height: "100%",
|
|
120
|
+
minWidth: 0,
|
|
121
|
+
overflow: "auto",
|
|
122
|
+
fontSize: "var(--code-font-size, 0.8125rem)"
|
|
123
|
+
}
|
|
124
|
+
});
|
|
125
|
+
}
|
|
126
|
+
// src/workbench/diff-utils.ts
|
|
127
|
+
/**
|
|
128
|
+
* Count added / removed lines between two file revisions.
|
|
129
|
+
*
|
|
130
|
+
* Ported from blueprint-agent's `computeDiffStats`: normalize CRLF, short-
|
|
131
|
+
* circuit on equality, then `diffLines` with `ignoreWhitespace` so pure
|
|
132
|
+
* reindentation does not inflate the counts. `newlineIsToken:false` keeps a
|
|
133
|
+
* line (not its trailing newline) as the unit, matching the +/- a reader
|
|
134
|
+
* counts by eye.
|
|
135
|
+
*/
|
|
136
|
+
function computeDiffStats(original, current) {
|
|
137
|
+
if (original === current) return {
|
|
138
|
+
added: 0,
|
|
139
|
+
removed: 0
|
|
140
|
+
};
|
|
141
|
+
const a = original.replace(/\r\n/g, "\n");
|
|
142
|
+
const b = current.replace(/\r\n/g, "\n");
|
|
143
|
+
if (a === b) return {
|
|
144
|
+
added: 0,
|
|
145
|
+
removed: 0
|
|
146
|
+
};
|
|
147
|
+
const changes = diffLines(a, b, {
|
|
148
|
+
newlineIsToken: false,
|
|
149
|
+
ignoreWhitespace: true
|
|
150
|
+
});
|
|
151
|
+
let added = 0;
|
|
152
|
+
let removed = 0;
|
|
153
|
+
for (const part of changes) {
|
|
154
|
+
if (!part.added && !part.removed) continue;
|
|
155
|
+
const count = part.count ?? part.value.split("\n").length;
|
|
156
|
+
if (part.added) added += count;
|
|
157
|
+
else if (part.removed) removed += count;
|
|
158
|
+
}
|
|
159
|
+
return {
|
|
160
|
+
added,
|
|
161
|
+
removed
|
|
162
|
+
};
|
|
163
|
+
}
|
|
164
|
+
/**
|
|
165
|
+
* Build a single-file unified patch (baseline → current) for `@pierre/diffs`'
|
|
166
|
+
* `PatchDiff`. `context: Infinity` would print the whole file; the default
|
|
167
|
+
* 4-line context keeps hunks compact while preserving locality. Equal inputs
|
|
168
|
+
* yield an empty string so callers can treat "" as "no diff".
|
|
169
|
+
*/
|
|
170
|
+
function buildUnifiedPatch(filename, baseline, current) {
|
|
171
|
+
if (baseline === current) return "";
|
|
172
|
+
return createTwoFilesPatch(filename, filename, baseline, current, "", "");
|
|
173
|
+
}
|
|
174
|
+
// src/workbench/diff-view.tsx
|
|
175
|
+
const DIFF_OPTIONS = {
|
|
176
|
+
diffStyle: "unified",
|
|
177
|
+
diffIndicators: "classic",
|
|
178
|
+
lineDiffType: "word",
|
|
179
|
+
hunkSeparators: "simple",
|
|
180
|
+
expandUnchanged: false,
|
|
181
|
+
theme: CODE_THEME,
|
|
182
|
+
stickyHeader: true
|
|
183
|
+
};
|
|
184
|
+
const DIFF_CONTAINER_TAG = "diffs-container";
|
|
185
|
+
/**
|
|
186
|
+
* Keep the maintained renderer for hunking, word diffs and highlighting. A new
|
|
187
|
+
* custom element per effect survives StrictMode remounts without hydrating stale
|
|
188
|
+
* shadow content. Wrapping is a renderer option, not a CSS patch into its shadow
|
|
189
|
+
* root; the plain patch disclosure is the accessible, engine-independent view.
|
|
190
|
+
*/
|
|
191
|
+
function DiffView({ filename, baseline, current, showFileHeader = true, defaultWrap = true, themeType = "dark", className }) {
|
|
192
|
+
const patch = React$1.useMemo(() => buildUnifiedPatch(filename, baseline, current), [
|
|
193
|
+
filename,
|
|
194
|
+
baseline,
|
|
195
|
+
current
|
|
196
|
+
]);
|
|
197
|
+
const [wrap, setWrap] = React$1.useState(defaultWrap);
|
|
198
|
+
const hostRef = React$1.useRef(null);
|
|
199
|
+
const instanceRef = React$1.useRef(null);
|
|
200
|
+
const latestThemeType = React$1.useRef(themeType);
|
|
201
|
+
const appliedThemeType = React$1.useRef(themeType);
|
|
202
|
+
React$1.useLayoutEffect(() => {
|
|
203
|
+
latestThemeType.current = themeType;
|
|
204
|
+
}, [themeType]);
|
|
205
|
+
React$1.useLayoutEffect(() => {
|
|
206
|
+
const host = hostRef.current;
|
|
207
|
+
if (host == null || !patch) return;
|
|
208
|
+
const container = document.createElement(DIFF_CONTAINER_TAG);
|
|
209
|
+
container.style.setProperty("--diffs-font-family", CODE_FONT_FAMILY);
|
|
210
|
+
container.style.display = "block";
|
|
211
|
+
container.style.minWidth = "0";
|
|
212
|
+
container.style.maxWidth = "100%";
|
|
213
|
+
host.appendChild(container);
|
|
214
|
+
const instance = new FileDiff({
|
|
215
|
+
...DIFF_OPTIONS,
|
|
216
|
+
themeType: latestThemeType.current,
|
|
217
|
+
overflow: wrap ? "wrap" : "scroll",
|
|
218
|
+
disableFileHeader: !showFileHeader
|
|
219
|
+
}, void 0);
|
|
220
|
+
instanceRef.current = instance;
|
|
221
|
+
appliedThemeType.current = latestThemeType.current;
|
|
222
|
+
instance.hydrate({
|
|
223
|
+
fileDiff: getSingularPatch(patch),
|
|
224
|
+
fileContainer: container
|
|
225
|
+
});
|
|
226
|
+
return () => {
|
|
227
|
+
if (instanceRef.current === instance) instanceRef.current = null;
|
|
228
|
+
instance.cleanUp();
|
|
229
|
+
container.remove();
|
|
230
|
+
};
|
|
231
|
+
}, [
|
|
232
|
+
patch,
|
|
233
|
+
showFileHeader,
|
|
234
|
+
wrap
|
|
235
|
+
]);
|
|
236
|
+
React$1.useLayoutEffect(() => {
|
|
237
|
+
if (appliedThemeType.current === themeType) return;
|
|
238
|
+
instanceRef.current?.setThemeType(themeType);
|
|
239
|
+
appliedThemeType.current = themeType;
|
|
240
|
+
}, [themeType]);
|
|
241
|
+
if (!patch) return /* @__PURE__ */ jsx("div", {
|
|
242
|
+
className: cn("flex h-full min-w-0 items-center justify-center bg-surface-container", className),
|
|
243
|
+
children: /* @__PURE__ */ jsx("p", {
|
|
244
|
+
className: "text-sm text-muted-foreground",
|
|
245
|
+
children: "No changes — baseline and working copy are identical."
|
|
246
|
+
})
|
|
247
|
+
});
|
|
248
|
+
return /* @__PURE__ */ jsxs("div", {
|
|
249
|
+
className: cn("flex h-full min-h-0 min-w-0 max-w-full flex-col overflow-hidden bg-surface-container", className),
|
|
250
|
+
children: [
|
|
251
|
+
/* @__PURE__ */ jsx("div", {
|
|
252
|
+
className: "flex shrink-0 flex-wrap items-center gap-2 border-b border-border px-3 py-2",
|
|
253
|
+
children: /* @__PURE__ */ jsx(Button, {
|
|
254
|
+
type: "button",
|
|
255
|
+
variant: "outline",
|
|
256
|
+
size: "sm",
|
|
257
|
+
"aria-pressed": wrap,
|
|
258
|
+
onClick: () => setWrap((value) => !value),
|
|
259
|
+
children: "Wrap lines"
|
|
260
|
+
})
|
|
261
|
+
}),
|
|
262
|
+
/* @__PURE__ */ jsx("div", {
|
|
263
|
+
ref: hostRef,
|
|
264
|
+
"data-testid": "diff-view",
|
|
265
|
+
role: "region",
|
|
266
|
+
"aria-label": `Diff for ${filename}`,
|
|
267
|
+
tabIndex: 0,
|
|
268
|
+
className: "min-h-0 min-w-0 max-w-full flex-1 overflow-auto text-[13px]"
|
|
269
|
+
}),
|
|
270
|
+
/* @__PURE__ */ jsxs("details", {
|
|
271
|
+
className: "max-h-[40%] shrink-0 overflow-auto border-t border-border",
|
|
272
|
+
children: [/* @__PURE__ */ jsx("summary", {
|
|
273
|
+
className: "cursor-pointer px-3 py-2 text-sm",
|
|
274
|
+
children: "Read plain-text diff"
|
|
275
|
+
}), /* @__PURE__ */ jsx("pre", {
|
|
276
|
+
role: "region",
|
|
277
|
+
tabIndex: 0,
|
|
278
|
+
"aria-label": `Plain-text diff for ${filename}`,
|
|
279
|
+
className: "m-0 whitespace-pre-wrap p-3 font-mono text-xs leading-relaxed",
|
|
280
|
+
style: { overflowWrap: "anywhere" },
|
|
281
|
+
children: patch
|
|
282
|
+
})]
|
|
283
|
+
})
|
|
284
|
+
]
|
|
285
|
+
});
|
|
286
|
+
}
|
|
287
|
+
export { CodeSurface as a, CODE_THEME as i, buildUnifiedPatch as n, computeDiffStats as r, DiffView as t };
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
import * as React$1 from "react";
|
|
2
|
+
interface DiffViewProps {
|
|
3
|
+
filename: string;
|
|
4
|
+
baseline: string;
|
|
5
|
+
current: string;
|
|
6
|
+
/** Hide when the surrounding PanelHeader already identifies the file. */
|
|
7
|
+
showFileHeader?: boolean;
|
|
8
|
+
/** Start wrapped so narrow review panes never conceal the end of a line. */
|
|
9
|
+
defaultWrap?: boolean;
|
|
10
|
+
/** Match the host app's selected theme. Defaults to dark for existing consumers. */
|
|
11
|
+
themeType?: "light" | "dark";
|
|
12
|
+
className?: string;
|
|
13
|
+
}
|
|
14
|
+
/**
|
|
15
|
+
* Keep the maintained renderer for hunking, word diffs and highlighting. A new
|
|
16
|
+
* custom element per effect survives StrictMode remounts without hydrating stale
|
|
17
|
+
* shadow content. Wrapping is a renderer option, not a CSS patch into its shadow
|
|
18
|
+
* root; the plain patch disclosure is the accessible, engine-independent view.
|
|
19
|
+
*/
|
|
20
|
+
declare function DiffView({ filename, baseline, current, showFileHeader, defaultWrap, themeType, className }: DiffViewProps): React$1.JSX.Element;
|
|
21
|
+
export { DiffViewProps as n, DiffView as t };
|
package/dist/editor.js
CHANGED
|
@@ -1,2 +1 @@
|
|
|
1
|
-
|
|
2
|
-
export { CollaboratorsList, DocumentEditorPane, EditorProvider, EditorToolbar, TiptapEditor, useAwareness, useCollaboratorPresence, useCollaborators, useDocumentChanges, useEditorConnection, useEditorContext, useYjsState };
|
|
1
|
+
export { CollaboratorsList, DocumentEditorPane, EditorProvider, EditorToolbar, TiptapEditor, useAwareness, useCollaboratorPresence, useCollaborators, useDocumentChanges, useEditorConnection, useEditorContext, useYjsState } from "@tangle-network/ui/editor";
|