@tangle-network/sandbox-ui 0.134.10 → 0.134.12

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/terminal.js CHANGED
@@ -1,2 +1,2 @@
1
- import { n as TerminalView, t as DEFAULT_TERMINAL_THEME } from "./terminal-DmSUfGha.js";
1
+ import { n as TerminalView, t as DEFAULT_TERMINAL_THEME } from "./terminal-X6r5pjgv.js";
2
2
  export { DEFAULT_TERMINAL_THEME, TerminalView };
@@ -17,13 +17,18 @@ function createEmptyBatch() {
17
17
  */
18
18
  const WS_READY_TIMEOUT_MS = 1e4;
19
19
  /** Convert an http(s) base URL into the matching ws(s) URL. */
20
- function toWsUrl(apiUrl, sessionId) {
20
+ function toWsUrl(apiUrl, sessionId, defaultShell) {
21
21
  try {
22
22
  const base = typeof window !== "undefined" ? window.location.href : void 0;
23
23
  const url = new URL(`${apiUrl}/terminals/${sessionId}/ws`, base);
24
24
  if (url.protocol === "https:") url.protocol = "wss:";
25
25
  else if (url.protocol === "http:") url.protocol = "ws:";
26
26
  else return null;
27
+ if (defaultShell) {
28
+ url.searchParams.set("cols", String(defaultShell.cols));
29
+ url.searchParams.set("rows", String(defaultShell.rows));
30
+ url.searchParams.set("defaultShell", "1");
31
+ }
27
32
  return url.toString();
28
33
  } catch {
29
34
  return null;
@@ -215,7 +220,10 @@ function usePtySession({ enabled = true, apiUrl, token, onData, connectionId: pr
215
220
  resolve(false);
216
221
  return;
217
222
  }
218
- const wsUrl = toWsUrl(apiUrl, sessionId);
223
+ const wsUrl = toWsUrl(apiUrl, sessionId, options.initOnOpen && !exactAttachRequiredRef.current ? {
224
+ cols: colsRef.current,
225
+ rows: rowsRef.current
226
+ } : void 0);
219
227
  if (!wsUrl) {
220
228
  resolve(false);
221
229
  return;
@@ -1,6 +1,6 @@
1
1
  import { t as cn$1 } from "./utils-DzWbktWG.js";
2
- import { a as PortsList } from "./dashboard-CUFAz94r.js";
3
- import { n as TerminalView } from "./terminal-DmSUfGha.js";
2
+ import { a as PortsList } from "./dashboard-C1ALa6lw.js";
3
+ import { n as TerminalView } from "./terminal-X6r5pjgv.js";
4
4
  import { RichFileTree } from "./files.js";
5
5
  import { n as PreviewView } from "./embedded-app-view-CYb9hevq.js";
6
6
  import { Button, Skeleton, Textarea } from "@tangle-network/ui/primitives";
package/dist/workbench.js CHANGED
@@ -1,3 +1,3 @@
1
- import { a as computeDiffStats, c as BRAND_PRISM_THEME, d as DiffStatsBadge, f as GitStatusBadge, i as buildUnifiedPatch, l as CodeSurface, m as PillTabs, n as SandboxArtifactPane, o as CodeView, p as PanelHeader, r as DiffView, s as FileBreadcrumb, t as ChangesPane, u as resolveLanguage } from "./workbench-CUrZs0hy.js";
1
+ import { a as computeDiffStats, c as BRAND_PRISM_THEME, d as DiffStatsBadge, f as GitStatusBadge, i as buildUnifiedPatch, l as CodeSurface, m as PillTabs, n as SandboxArtifactPane, o as CodeView, p as PanelHeader, r as DiffView, s as FileBreadcrumb, t as ChangesPane, u as resolveLanguage } from "./workbench-BzXAYUId.js";
2
2
  import { n as PreviewView, t as EmbeddedAppView } from "./embedded-app-view-CYb9hevq.js";
3
3
  export { BRAND_PRISM_THEME, ChangesPane, CodeSurface, CodeView, DiffStatsBadge, DiffView, EmbeddedAppView, FileBreadcrumb, GitStatusBadge, PanelHeader, PillTabs, PreviewView, SandboxArtifactPane, buildUnifiedPatch, computeDiffStats, resolveLanguage };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@tangle-network/sandbox-ui",
3
- "version": "0.134.10",
3
+ "version": "0.134.12",
4
4
  "license": "MIT",
5
5
  "description": "Unified UI component library for Tangle Sandbox — primitives, chat, dashboard, terminal, editor, and workspace components",
6
6
  "repository": {
@@ -133,8 +133,8 @@
133
133
  "@hocuspocus/provider": ">=2.15.0 <5.0.0",
134
134
  "@nanostores/react": ">=0.8.4 <2.0.0",
135
135
  "@tangle-network/agent-interface": "^1.0.0 || ^2.0.0 || ^3.0.0 || ^5.2.0",
136
- "@tangle-network/brand": "^1.25.1",
137
- "@tangle-network/ui": "^11.38.1",
136
+ "@tangle-network/brand": "^1.26.0",
137
+ "@tangle-network/ui": "^11.40.1",
138
138
  "@tanstack/react-query": "^5.0.0",
139
139
  "@tiptap/core": ">=3.20.4 <4.0.0",
140
140
  "@tiptap/extension-collaboration": ">=3.20.4 <4.0.0",
@@ -223,8 +223,8 @@
223
223
  "@storybook/react-vite": "^10.6.0",
224
224
  "@tailwindcss/postcss": "^4.3.3",
225
225
  "@tangle-network/agent-interface": "5.2.0",
226
- "@tangle-network/brand": "1.25.1",
227
- "@tangle-network/ui": "11.38.1",
226
+ "@tangle-network/brand": "1.26.0",
227
+ "@tangle-network/ui": "11.40.1",
228
228
  "@tanstack/react-query": "^5.104.0",
229
229
  "@testing-library/dom": "^10.4.2",
230
230
  "@testing-library/jest-dom": "^7.0.1",
@@ -239,6 +239,7 @@
239
239
  "@types/react": "^19.3.0",
240
240
  "@types/react-dom": "^19.3.0",
241
241
  "@xterm/addon-fit": "^0.11.0",
242
+ "@xterm/addon-unicode-graphemes": "^0.4.0",
242
243
  "@xterm/addon-web-links": "^0.12.0",
243
244
  "@xterm/addon-webgl": "^0.19.0",
244
245
  "@xterm/xterm": "^6.0.0",
@@ -1,30 +0,0 @@
1
- import { Alert as Alert$1, AlertDescription, AlertDialog, AlertDialogAction, AlertDialogCancel, AlertDialogContent, AlertDialogDescription, AlertDialogFooter, AlertDialogHeader, AlertDialogOverlay, AlertDialogPortal, AlertDialogTitle, AlertDialogTrigger, AlertProps, AlertTitle, AlertTone, ArtifactPane as ArtifactPane$1, ArtifactPaneProps, Avatar as Avatar$1, AvatarFallback as AvatarFallback$1, AvatarImage as AvatarImage$1, Badge as Badge$1, BadgeProps, Button as Button$1, ButtonProps as ButtonProps$1, CATEGORY_TONES, Calendar, CalendarDate, CalendarProps, Card as Card$1, CardContent as CardContent$1, CardDescription as CardDescription$1, CardFooter, CardHeader as CardHeader$1, CardTitle as CardTitle$1, CardTitleProps, CategoryTone, Checkbox, Chip, ChipProps, CodeBlock, CodeBlockProps, Collapsible, CollapsibleContent, CollapsibleTrigger, ContextMenu, ContextMenuCheckboxItem, ContextMenuContent, ContextMenuGroup, ContextMenuItem, ContextMenuLabel, ContextMenuPortal, ContextMenuRadioGroup, ContextMenuRadioItem, ContextMenuSeparator, ContextMenuShortcut, ContextMenuSub, ContextMenuSubContent, ContextMenuSubTrigger, ContextMenuTrigger, CopyButton, DatePicker as DatePicker$1, DatePickerProps, Dialog as Dialog$1, DialogClose as DialogClose$1, DialogContent as DialogContent$1, DialogDescription as DialogDescription$1, DialogFooter as DialogFooter$1, DialogHeader as DialogHeader$1, DialogOverlay, DialogPortal, DialogTitle as DialogTitle$1, DialogTrigger as DialogTrigger$1, DropZone, DropZoneProps, DropdownMenu as DropdownMenu$1, DropdownMenuCheckboxItem, DropdownMenuContent as DropdownMenuContent$1, DropdownMenuGroup, DropdownMenuItem as DropdownMenuItem$1, DropdownMenuLabel as DropdownMenuLabel$1, DropdownMenuPortal, DropdownMenuRadioGroup, DropdownMenuRadioItem, DropdownMenuSeparator as DropdownMenuSeparator$1, DropdownMenuShortcut, DropdownMenuSub as DropdownMenuSub$1, DropdownMenuSubContent as DropdownMenuSubContent$1, DropdownMenuSubTrigger as DropdownMenuSubTrigger$1, DropdownMenuTrigger as DropdownMenuTrigger$1, EmptyState as EmptyState$1, EmptyStateProps, FilterField as FilterField$1, FilterFieldProps, Heading, HeadingVariant, HeadingVariant as HeadingVariant$1, HelpText, HelpTextProps, IconTile, IconTileProps, InlineCode, InlineCodeProps, Input as Input$1, InputProps, Label as Label$1, Metric, MetricProps, MetricStrip, MetricStripProps, PageHeader as PageHeader$1, PageHeaderProps, PageHeaderProps as PageHeaderProps$1, PageShell as PageShell$1, PageShellProps, Pagination, PaginationProps, Popover, PopoverAnchor, PopoverClose, PopoverContent, PopoverTrigger, Progress as Progress$1, RadioGroup, RadioGroupItem, SegmentedControl, SegmentedControlOption, SegmentedControlProps, Select as Select$1, SelectContent as SelectContent$1, SelectGroup, SelectItem as SelectItem$1, SelectLabel, SelectScrollDownButton, SelectScrollUpButton, SelectSeparator, SelectTrigger as SelectTrigger$1, SelectValue as SelectValue$1, Separator, Sheet as Sheet$1, SheetClose as SheetClose$1, SheetContent as SheetContent$1, SheetDescription, SheetFooter, SheetHeader, SheetOverlay, SheetPortal, SheetTitle as SheetTitle$1, SheetTrigger as SheetTrigger$1, SidebarDropZone, SidebarDropZoneProps, Skeleton as Skeleton$1, SkeletonCard as SkeletonCard$1, SkeletonTable, Slider, StatCard as StatCard$1, StatCardProps, StatusPill as StatusPill$1, StatusPillProps as StatusPillProps$1, StatusTone as StatusTone$1, Switch, TONE_CLASSES, Table, TableBody, TableCaption, TableCell, TableFooter, TableHead, TableHeader, TableProps, TableRow, Tabs as Tabs$1, TabsContent as TabsContent$1, TabsList as TabsList$1, TabsTrigger as TabsTrigger$1, Tag, TagProps, TerminalCursor, TerminalDisplay, TerminalInput, TerminalLine, TextShimmer, TextShimmerProps, Textarea as Textarea$1, TextareaProps, ThemeToggle, TimeSelect, TimeSelectProps, Toast, ToastContainer, ToastProvider, Tone, ToneClasses, Toolbar as Toolbar$1, ToolbarProps, Tooltip as Tooltip$1, TooltipContent as TooltipContent$1, TooltipProvider as TooltipProvider$1, TooltipTrigger as TooltipTrigger$1, UploadFile, UploadProgress, UploadProgressProps, Wizard, WizardProps, WizardStep, WizardStepProps, badgeVariants, buttonVariants, formatCalendarDate, initialsOf, localToday as localToday$1, parseCalendarDate, toneFor, useTheme, useToast } from "@tangle-network/ui/primitives";
2
- import { TangleKnot as TangleKnot$1 } from "@tangle-network/brand";
3
- import { ElementType, HTMLAttributes, ReactNode } from "react";
4
- //#region src/primitives/logo.d.ts
5
- interface LogoProps {
6
- variant?: "sandbox";
7
- size?: "sm" | "md" | "lg" | "xl";
8
- className?: string;
9
- iconOnly?: boolean;
10
- }
11
- /** Keep the Sandbox wordmark API while Brand owns the mark and layout. */
12
- declare function Logo$1({ variant, size, className, iconOnly }: LogoProps): import("react").JSX.Element;
13
- declare namespace Logo$1 {
14
- var displayName: string;
15
- }
16
- //#endregion
17
- //#region src/primitives/heading.d.ts
18
- /** Preserve the existing public type's required visual role and children.
19
- * The binding above remains UI's object, without a local render function.
20
- */
21
- interface HeadingProps extends Omit<HTMLAttributes<HTMLElement>, "role"> {
22
- role: HeadingVariant;
23
- as?: ElementType;
24
- children: ReactNode;
25
- }
26
- type SectionTitleProps = Pick<PageHeaderProps, "title" | "description" | "action" | "className">;
27
- /** Compatibility name for the canonical nested (h2) page header. */
28
- declare function SectionTitle(props: SectionTitleProps): import("react").JSX.Element;
29
- //#endregion
30
- export { ContextMenuRadioGroup as $, Table as $n, SectionTitle as $r, MetricProps as $t, Card$1 as A, Sheet$1 as An, Toolbar$1 as Ar, DropdownMenuRadioItem as At, ChipProps as B, SidebarDropZone as Bn, WizardProps as Br, FilterFieldProps as Bt, BadgeProps as C, SelectLabel as Cn, TimeSelect as Cr, DropdownMenuCheckboxItem as Ct, Calendar as D, SelectTrigger$1 as Dn, ToastProvider as Dr, DropdownMenuLabel$1 as Dt, CATEGORY_TONES as E, SelectSeparator as En, ToastContainer as Er, DropdownMenuItem$1 as Et, CardTitle$1 as F, SheetHeader as Fn, TooltipTrigger$1 as Fr, DropdownMenuSubTrigger$1 as Ft, CollapsibleTrigger as G, Slider as Gn, formatCalendarDate as Gr, IconTile as Gt, CodeBlockProps as H, Skeleton$1 as Hn, WizardStepProps as Hr, HeadingVariant$1 as Ht, CardTitleProps as I, SheetOverlay as In, UploadFile as Ir, DropdownMenuTrigger$1 as It, ContextMenuContent as J, StatusPill$1 as Jn, parseCalendarDate as Jr, InlineCodeProps as Jt, ContextMenu as K, StatCard$1 as Kn, initialsOf as Kr, IconTileProps as Kt, CategoryTone as L, SheetPortal as Ln, UploadProgress as Lr, EmptyState$1 as Lt, CardDescription$1 as M, SheetContent$1 as Mn, Tooltip$1 as Mr, DropdownMenuShortcut as Mt, CardFooter as N, SheetDescription as Nn, TooltipContent$1 as Nr, DropdownMenuSub$1 as Nt, CalendarDate as O, SelectValue$1 as On, Tone as Or, DropdownMenuPortal as Ot, CardHeader$1 as P, SheetFooter as Pn, TooltipProvider$1 as Pr, DropdownMenuSubContent$1 as Pt, ContextMenuPortal as Q, TONE_CLASSES as Qn, HeadingProps as Qr, Metric as Qt, Checkbox as R, SheetTitle$1 as Rn, UploadProgressProps as Rr, EmptyStateProps as Rt, Badge$1 as S, SelectItem$1 as Sn, ThemeToggle as Sr, DropdownMenu$1 as St, ButtonProps$1 as T, SelectScrollUpButton as Tn, Toast as Tr, DropdownMenuGroup as Tt, Collapsible as U, SkeletonCard$1 as Un, badgeVariants as Ur, HelpText as Ut, CodeBlock as V, SidebarDropZoneProps as Vn, WizardStep as Vr, Heading as Vt, CollapsibleContent as W, SkeletonTable as Wn, buttonVariants as Wr, HelpTextProps as Wt, ContextMenuItem as X, StatusTone$1 as Xn, useTheme as Xr, InputProps as Xt, ContextMenuGroup as Y, StatusPillProps$1 as Yn, toneFor as Yr, Input$1 as Yt, ContextMenuLabel as Z, Switch as Zn, useToast as Zr, Label$1 as Zt, ArtifactPane$1 as _, SegmentedControlOption as _n, TerminalLine as _r, DialogPortal as _t, AlertDialogCancel as a, PageShellProps as an, TableHeader as ar, ContextMenuSubTrigger as at, AvatarFallback$1 as b, SelectContent$1 as bn, Textarea$1 as br, DropZone as bt, AlertDialogFooter as c, Popover as cn, Tabs$1 as cr, DatePicker$1 as ct, AlertDialogPortal as d, PopoverContent as dn, TabsTrigger$1 as dr, DialogClose$1 as dt, SectionTitleProps as ei, MetricStrip as en, TableBody as er, ContextMenuRadioItem as et, AlertDialogTitle as f, PopoverTrigger as fn, Tag as fr, DialogContent$1 as ft, AlertTone as g, SegmentedControl as gn, TerminalInput as gr, DialogOverlay as gt, AlertTitle as h, RadioGroupItem as hn, TerminalDisplay as hr, DialogHeader$1 as ht, AlertDialogAction as i, PageShell$1 as in, TableHead as ir, ContextMenuSubContent as it, CardContent$1 as j, SheetClose$1 as jn, ToolbarProps as jr, DropdownMenuSeparator$1 as jt, CalendarProps as k, Separator as kn, ToneClasses as kr, DropdownMenuRadioGroup as kt, AlertDialogHeader as l, PopoverAnchor as ln, TabsContent$1 as lr, DatePickerProps as lt, AlertProps as m, RadioGroup as mn, TerminalCursor as mr, DialogFooter$1 as mt, AlertDescription as n, LogoProps as ni, PageHeader$1 as nn, TableCell as nr, ContextMenuShortcut as nt, AlertDialogContent as o, Pagination as on, TableProps as or, ContextMenuTrigger as ot, AlertDialogTrigger as p, Progress$1 as pn, TagProps as pr, DialogDescription$1 as pt, ContextMenuCheckboxItem as q, StatCardProps as qn, localToday$1 as qr, InlineCode as qt, AlertDialog as r, TangleKnot$1 as ri, PageHeaderProps$1 as rn, TableFooter as rr, ContextMenuSub as rt, AlertDialogDescription as s, PaginationProps as sn, TableRow as sr, CopyButton as st, Alert$1 as t, Logo$1 as ti, MetricStripProps as tn, TableCaption as tr, ContextMenuSeparator as tt, AlertDialogOverlay as u, PopoverClose as un, TabsList$1 as ur, Dialog$1 as ut, ArtifactPaneProps as v, SegmentedControlProps as vn, TextShimmer as vr, DialogTitle$1 as vt, Button$1 as w, SelectScrollDownButton as wn, TimeSelectProps as wr, DropdownMenuContent$1 as wt, AvatarImage$1 as x, SelectGroup as xn, TextareaProps as xr, DropZoneProps as xt, Avatar$1 as y, Select$1 as yn, TextShimmerProps as yr, DialogTrigger$1 as yt, Chip as z, SheetTrigger$1 as zn, Wizard as zr, FilterField$1 as zt };
@@ -1,25 +0,0 @@
1
- import { Alert as Alert$1, AlertDescription, AlertDialog, AlertDialogAction, AlertDialogCancel, AlertDialogContent, AlertDialogDescription, AlertDialogFooter, AlertDialogHeader, AlertDialogOverlay, AlertDialogPortal, AlertDialogTitle, AlertDialogTrigger, AlertTitle, ArtifactPane as ArtifactPane$1, Avatar as Avatar$1, AvatarFallback as AvatarFallback$1, AvatarImage as AvatarImage$1, Badge as Badge$1, Button as Button$1, CATEGORY_TONES, Calendar, Card as Card$1, CardContent as CardContent$1, CardDescription as CardDescription$1, CardFooter, CardHeader as CardHeader$1, CardTitle as CardTitle$1, Checkbox, Chip, CodeBlock, Collapsible, CollapsibleContent, CollapsibleTrigger, ContextMenu, ContextMenuCheckboxItem, ContextMenuContent, ContextMenuGroup, ContextMenuItem, ContextMenuLabel, ContextMenuPortal, ContextMenuRadioGroup, ContextMenuRadioItem, ContextMenuSeparator, ContextMenuShortcut, ContextMenuSub, ContextMenuSubContent, ContextMenuSubTrigger, ContextMenuTrigger, CopyButton, DatePicker as DatePicker$1, Dialog as Dialog$1, DialogClose as DialogClose$1, DialogContent as DialogContent$1, DialogDescription as DialogDescription$1, DialogFooter as DialogFooter$1, DialogHeader as DialogHeader$1, DialogOverlay, DialogPortal, DialogTitle as DialogTitle$1, DialogTrigger as DialogTrigger$1, DropZone, DropdownMenu as DropdownMenu$1, DropdownMenuCheckboxItem, DropdownMenuContent as DropdownMenuContent$1, DropdownMenuGroup, DropdownMenuItem as DropdownMenuItem$1, DropdownMenuLabel as DropdownMenuLabel$1, DropdownMenuPortal, DropdownMenuRadioGroup, DropdownMenuRadioItem, DropdownMenuSeparator as DropdownMenuSeparator$1, DropdownMenuShortcut, DropdownMenuSub as DropdownMenuSub$1, DropdownMenuSubContent as DropdownMenuSubContent$1, DropdownMenuSubTrigger as DropdownMenuSubTrigger$1, DropdownMenuTrigger as DropdownMenuTrigger$1, EmptyState as EmptyState$1, FilterField as FilterField$1, Heading, HelpText, IconTile, InlineCode, Input as Input$1, Label as Label$1, Metric, MetricStrip, PageHeader, PageHeader as PageHeader$1, PageShell as PageShell$1, Pagination, Popover, PopoverAnchor, PopoverClose, PopoverContent, PopoverTrigger, Progress as Progress$1, RadioGroup, RadioGroupItem, SegmentedControl, Select as Select$1, SelectContent as SelectContent$1, SelectGroup, SelectItem as SelectItem$1, SelectLabel, SelectScrollDownButton, SelectScrollUpButton, SelectSeparator, SelectTrigger as SelectTrigger$1, SelectValue as SelectValue$1, Separator, Sheet as Sheet$1, SheetClose as SheetClose$1, SheetContent as SheetContent$1, SheetDescription, SheetFooter, SheetHeader, SheetOverlay, SheetPortal, SheetTitle as SheetTitle$1, SheetTrigger as SheetTrigger$1, SidebarDropZone, Skeleton as Skeleton$1, SkeletonCard as SkeletonCard$1, SkeletonTable, Slider, StatCard as StatCard$1, StatusPill as StatusPill$1, Switch, TONE_CLASSES, Table, TableBody, TableCaption, TableCell, TableFooter, TableHead, TableHeader, TableRow, Tabs as Tabs$1, TabsContent as TabsContent$1, TabsList as TabsList$1, TabsTrigger as TabsTrigger$1, Tag, TerminalCursor, TerminalDisplay, TerminalInput, TerminalLine, TextShimmer, Textarea as Textarea$1, ThemeToggle, TimeSelect, ToastContainer, ToastProvider, Toolbar as Toolbar$1, Tooltip as Tooltip$1, TooltipContent as TooltipContent$1, TooltipProvider as TooltipProvider$1, TooltipTrigger as TooltipTrigger$1, UploadProgress, Wizard, WizardStep, badgeVariants, buttonVariants, formatCalendarDate, initialsOf, localToday as localToday$1, parseCalendarDate, toneFor, useTheme, useToast } from "@tangle-network/ui/primitives";
2
- import { Logo, TangleKnot as TangleKnot$1 } from "@tangle-network/brand";
3
- import { jsx } from "react/jsx-runtime";
4
- //#region src/primitives/logo.tsx
5
- /** Keep the Sandbox wordmark API while Brand owns the mark and layout. */
6
- function Logo$1({ variant = "sandbox", size = "md", className, iconOnly = false }) {
7
- return /* @__PURE__ */ jsx(Logo, {
8
- size,
9
- variant: iconOnly ? "icon" : "full",
10
- suffix: variant === "sandbox" ? "Sandbox" : null,
11
- className
12
- });
13
- }
14
- Logo$1.displayName = "Logo";
15
- //#endregion
16
- //#region src/primitives/heading.tsx
17
- /** Compatibility name for the canonical nested (h2) page header. */
18
- function SectionTitle(props) {
19
- return /* @__PURE__ */ jsx(PageHeader, {
20
- ...props,
21
- level: 2
22
- });
23
- }
24
- //#endregion
25
- export { DialogClose$1 as $, badgeVariants as $n, SelectSeparator as $t, Chip as A, Tabs$1 as An, Input$1 as At, ContextMenuLabel as B, Textarea$1 as Bn, PopoverContent as Bt, Card$1 as C, TableBody as Cn, DropdownMenuTrigger$1 as Ct, CardHeader$1 as D, TableHead as Dn, HelpText as Dt, CardFooter as E, TableFooter as En, Heading as Et, ContextMenu as F, TerminalCursor as Fn, PageShell$1 as Ft, ContextMenuShortcut as G, Toolbar$1 as Gn, SegmentedControl as Gt, ContextMenuRadioGroup as H, TimeSelect as Hn, Progress$1 as Ht, ContextMenuCheckboxItem as I, TerminalDisplay as In, Pagination as It, ContextMenuSubTrigger as J, TooltipProvider$1 as Jn, SelectGroup as Jt, ContextMenuSub as K, Tooltip$1 as Kn, Select$1 as Kt, ContextMenuContent as L, TerminalInput as Ln, Popover as Lt, Collapsible as M, TabsList$1 as Mn, Metric as Mt, CollapsibleContent as N, TabsTrigger$1 as Nn, MetricStrip as Nt, CardTitle$1 as O, TableHeader as On, IconTile as Ot, CollapsibleTrigger as P, Tag as Pn, PageHeader$1 as Pt, Dialog$1 as Q, WizardStep as Qn, SelectScrollUpButton as Qt, ContextMenuGroup as R, TerminalLine as Rn, PopoverAnchor as Rt, Calendar as S, Table as Sn, DropdownMenuSubTrigger$1 as St, CardDescription$1 as T, TableCell as Tn, FilterField$1 as Tt, ContextMenuRadioItem as U, ToastContainer as Un, RadioGroup as Ut, ContextMenuPortal as V, ThemeToggle as Vn, PopoverTrigger as Vt, ContextMenuSeparator as W, ToastProvider as Wn, RadioGroupItem as Wt, CopyButton as X, UploadProgress as Xn, SelectLabel as Xt, ContextMenuTrigger as Y, TooltipTrigger$1 as Yn, SelectItem$1 as Yt, DatePicker$1 as Z, Wizard as Zn, SelectScrollDownButton as Zt, AvatarFallback$1 as _, Slider as _n, DropdownMenuRadioItem as _t, AlertDialogCancel as a, SheetContent$1 as an, toneFor as ar, DialogPortal as at, Button$1 as b, Switch as bn, DropdownMenuSub$1 as bt, AlertDialogFooter as c, SheetHeader as cn, SectionTitle as cr, DropZone as ct, AlertDialogPortal as d, SheetTitle$1 as dn, DropdownMenuContent$1 as dt, SelectTrigger$1 as en, buttonVariants as er, DialogContent$1 as et, AlertDialogTitle as f, SheetTrigger$1 as fn, DropdownMenuGroup as ft, Avatar$1 as g, SkeletonTable as gn, DropdownMenuRadioGroup as gt, ArtifactPane$1 as h, SkeletonCard$1 as hn, DropdownMenuPortal as ht, AlertDialogAction as i, SheetClose$1 as in, parseCalendarDate as ir, DialogOverlay as it, CodeBlock as j, TabsContent$1 as jn, Label$1 as jt, Checkbox as k, TableRow as kn, InlineCode as kt, AlertDialogHeader as l, SheetOverlay as ln, Logo$1 as lr, DropdownMenu$1 as lt, AlertTitle as m, Skeleton$1 as mn, DropdownMenuLabel$1 as mt, AlertDescription as n, Separator as nn, initialsOf as nr, DialogFooter$1 as nt, AlertDialogContent as o, SheetDescription as on, useTheme as or, DialogTitle$1 as ot, AlertDialogTrigger as p, SidebarDropZone as pn, DropdownMenuItem$1 as pt, ContextMenuSubContent as q, TooltipContent$1 as qn, SelectContent$1 as qt, AlertDialog as r, Sheet$1 as rn, localToday$1 as rr, DialogHeader$1 as rt, AlertDialogDescription as s, SheetFooter as sn, useToast as sr, DialogTrigger$1 as st, Alert$1 as t, SelectValue$1 as tn, formatCalendarDate as tr, DialogDescription$1 as tt, AlertDialogOverlay as u, SheetPortal as un, TangleKnot$1 as ur, DropdownMenuCheckboxItem as ut, AvatarImage$1 as v, StatCard$1 as vn, DropdownMenuSeparator$1 as vt, CardContent$1 as w, TableCaption as wn, EmptyState$1 as wt, CATEGORY_TONES as x, TONE_CLASSES as xn, DropdownMenuSubContent$1 as xt, Badge$1 as y, StatusPill$1 as yn, DropdownMenuShortcut as yt, ContextMenuItem as z, TextShimmer as zn, PopoverClose as zt };
@@ -1,203 +0,0 @@
1
- import { t as usePtySession } from "./use-pty-session-Bf4hBLXJ.js";
2
- import { Fragment, jsx, jsxs } from "react/jsx-runtime";
3
- import { useCallback, useEffect, useMemo, useRef } from "react";
4
- import "@xterm/xterm/css/xterm.css";
5
- import { Terminal } from "@xterm/xterm";
6
- import { FitAddon } from "@xterm/addon-fit";
7
- import { WebLinksAddon } from "@xterm/addon-web-links";
8
- //#region src/terminal/terminal-view.tsx
9
- const DEFAULT_TERMINAL_THEME = {
10
- background: "#0c0c0e",
11
- foreground: "#d4d4d8",
12
- cursor: "#34d399",
13
- cursorAccent: "#0c0c0e",
14
- selectionBackground: "#7c3aed33",
15
- selectionForeground: "#d4d4d8",
16
- black: "#18181b",
17
- red: "#ef4444",
18
- green: "#34d399",
19
- yellow: "#fbbf24",
20
- blue: "#60a5fa",
21
- magenta: "#a78bfa",
22
- cyan: "#22d3ee",
23
- white: "#d4d4d8",
24
- brightBlack: "#52525b",
25
- brightRed: "#f87171",
26
- brightGreen: "#6ee7b7",
27
- brightYellow: "#fde68a",
28
- brightBlue: "#93c5fd",
29
- brightMagenta: "#c4b5fd",
30
- brightCyan: "#67e8f9",
31
- brightWhite: "#fafafa"
32
- };
33
- function TerminalView({ session, apiUrl, token, theme, title = "Terminal", subtitle = "Connected to PTY session", isActive = true, connectionId, incarnationId, control, fontSize = 13 }) {
34
- const resolvedTheme = useMemo(() => ({
35
- ...DEFAULT_TERMINAL_THEME,
36
- ...theme
37
- }), [theme]);
38
- const resolvedFontSize = Number.isFinite(fontSize) && fontSize > 0 ? fontSize : 13;
39
- const fontSizeRef = useRef(resolvedFontSize);
40
- fontSizeRef.current = resolvedFontSize;
41
- const containerRef = useRef(null);
42
- const termRef = useRef(null);
43
- const fitAddonRef = useRef(null);
44
- const pendingWritesRef = useRef([]);
45
- const writeRafRef = useRef(null);
46
- const onData = useCallback((data) => {
47
- if (!data) return;
48
- pendingWritesRef.current.push(data);
49
- if (writeRafRef.current !== null) return;
50
- writeRafRef.current = requestAnimationFrame(() => {
51
- writeRafRef.current = null;
52
- const chunks = pendingWritesRef.current;
53
- if (chunks.length === 0) return;
54
- pendingWritesRef.current = [];
55
- termRef.current?.write(chunks.length === 1 ? chunks[0] : chunks.join(""));
56
- });
57
- }, []);
58
- const usesCallerSession = session !== void 0;
59
- const shellSession = usePtySession({
60
- enabled: !usesCallerSession,
61
- apiUrl,
62
- token,
63
- onData,
64
- connectionId,
65
- incarnationId,
66
- control
67
- });
68
- const { isConnected, error, sendCommand, resizeTerminal, reconnect } = session ?? shellSession;
69
- const subscribeData = session?.subscribeData;
70
- useEffect(() => subscribeData?.(onData), [subscribeData, onData]);
71
- useEffect(() => {
72
- if (!containerRef.current) return;
73
- const term = new Terminal({
74
- theme: resolvedTheme,
75
- fontFamily: "\"JetBrains Mono\", \"Fira Code\", \"Cascadia Code\", Menlo, monospace",
76
- fontSize: fontSizeRef.current,
77
- lineHeight: 1.4,
78
- cursorBlink: true,
79
- cursorStyle: "bar",
80
- scrollback: 5e3,
81
- convertEol: true,
82
- allowProposedApi: true
83
- });
84
- const fitAddon = new FitAddon();
85
- const webLinksAddon = new WebLinksAddon();
86
- term.loadAddon(fitAddon);
87
- term.loadAddon(webLinksAddon);
88
- term.open(containerRef.current);
89
- let webglAddon = null;
90
- let webglCancelled = false;
91
- (async () => {
92
- try {
93
- const mod = await import("@xterm/addon-webgl");
94
- if (webglCancelled) return;
95
- try {
96
- const addon = new mod.WebglAddon();
97
- addon.onContextLoss(() => {
98
- webglAddon?.dispose();
99
- webglAddon = null;
100
- });
101
- webglAddon = addon;
102
- term.loadAddon(addon);
103
- } catch {}
104
- } catch {}
105
- })();
106
- requestAnimationFrame(() => {
107
- fitAddon.fit();
108
- });
109
- termRef.current = term;
110
- fitAddonRef.current = fitAddon;
111
- term.onData((data) => {
112
- if (!usesCallerSession && data === "\f") {
113
- termRef.current?.clear();
114
- sendCommand("\r").catch(console.error);
115
- return;
116
- }
117
- sendCommand(data).catch((err) => {
118
- termRef.current?.writeln(`\r\n\x1b[31m${err instanceof Error ? err.message : "Send failed"}\x1b[0m`);
119
- });
120
- });
121
- term.onResize(({ cols, rows }) => {
122
- resizeTerminal(cols, rows).catch(console.error);
123
- });
124
- const ro = new ResizeObserver(() => {
125
- requestAnimationFrame(() => {
126
- fitAddon.fit();
127
- });
128
- });
129
- ro.observe(containerRef.current);
130
- return () => {
131
- webglCancelled = true;
132
- ro.disconnect();
133
- if (writeRafRef.current !== null) {
134
- cancelAnimationFrame(writeRafRef.current);
135
- writeRafRef.current = null;
136
- }
137
- pendingWritesRef.current = [];
138
- webglAddon?.dispose();
139
- term.dispose();
140
- termRef.current = null;
141
- fitAddonRef.current = null;
142
- };
143
- }, [
144
- sendCommand,
145
- resizeTerminal,
146
- title,
147
- subtitle,
148
- usesCallerSession
149
- ]);
150
- useEffect(() => {
151
- if (termRef.current) termRef.current.options.theme = resolvedTheme;
152
- }, [resolvedTheme]);
153
- useEffect(() => {
154
- const term = termRef.current;
155
- if (!term || term.options.fontSize === resolvedFontSize) return;
156
- term.options.fontSize = resolvedFontSize;
157
- const rafId = requestAnimationFrame(() => fitAddonRef.current?.fit());
158
- return () => cancelAnimationFrame(rafId);
159
- }, [resolvedFontSize]);
160
- useEffect(() => {
161
- if (isConnected && termRef.current) {
162
- resizeTerminal(termRef.current.cols, termRef.current.rows).catch(console.error);
163
- if (isActive) termRef.current.focus();
164
- }
165
- }, [
166
- isConnected,
167
- resizeTerminal,
168
- isActive
169
- ]);
170
- useEffect(() => {
171
- if (isActive && termRef.current && fitAddonRef.current) setTimeout(() => {
172
- fitAddonRef.current?.fit();
173
- termRef.current?.focus();
174
- }, 50);
175
- }, [isActive]);
176
- return /* @__PURE__ */ jsxs("div", {
177
- className: "relative h-full w-full group cursor-text",
178
- onClick: () => termRef.current?.focus(),
179
- children: [/* @__PURE__ */ jsx("div", {
180
- ref: containerRef,
181
- className: "h-full w-full overflow-hidden relative z-0",
182
- style: { backgroundColor: resolvedTheme.background }
183
- }), (!isConnected || error) && /* @__PURE__ */ jsx("div", {
184
- className: "absolute inset-0 flex items-center justify-center bg-surface-container-lowest",
185
- children: /* @__PURE__ */ jsx("div", {
186
- className: "text-center",
187
- children: error ? /* @__PURE__ */ jsxs(Fragment, { children: [/* @__PURE__ */ jsx("p", {
188
- className: "text-sm text-[var(--surface-danger-text)] mb-3",
189
- children: error
190
- }), /* @__PURE__ */ jsx("button", {
191
- onClick: reconnect,
192
- className: "text-sm text-[var(--surface-success-text)] hover:opacity-80 underline cursor-pointer",
193
- children: "Retry connection"
194
- })] }) : /* @__PURE__ */ jsx("p", {
195
- className: "text-[13px] text-muted-foreground",
196
- children: "Connecting to terminal..."
197
- })
198
- })
199
- })]
200
- });
201
- }
202
- //#endregion
203
- export { TerminalView as n, DEFAULT_TERMINAL_THEME as t };