@tangle-network/sandbox-ui 0.6.1 → 0.9.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (68) hide show
  1. package/README.md +5 -6
  2. package/dist/auth.d.ts +10 -6
  3. package/dist/auth.js +3 -3
  4. package/dist/{chat-container-Cg-GwyiK.d.ts → chat-container-f4yEs6KN.d.ts} +9 -1
  5. package/dist/chat.d.ts +12 -2
  6. package/dist/chat.js +10 -10
  7. package/dist/{chunk-WBQ7VULC.js → chunk-34A66VBG.js} +7 -7
  8. package/dist/{chunk-JP725R4W.js → chunk-34I7UFSX.js} +2 -2
  9. package/dist/{chunk-CNWVHQFY.js → chunk-54SQQMMM.js} +6 -24
  10. package/dist/{chunk-DLCFZDGX.js → chunk-5UM2XMEJ.js} +39 -14
  11. package/dist/{chunk-YYGECNZZ.js → chunk-66EZOYZR.js} +3 -3
  12. package/dist/{chunk-6V4XVKFY.js → chunk-7YWFOGKQ.js} +344 -338
  13. package/dist/{chunk-DCPYTL4W.js → chunk-D4CZWJCD.js} +72 -148
  14. package/dist/{chunk-XTPAWK7L.js → chunk-DI3NZ5ZX.js} +15 -51
  15. package/dist/{chunk-MXRQ4MJE.js → chunk-DXMIEK4K.js} +34 -23
  16. package/dist/{chunk-ZMWWE5RF.js → chunk-EXSOPXIY.js} +141 -123
  17. package/dist/{chunk-GW4GRAWJ.js → chunk-GSZA3TSY.js} +18 -12
  18. package/dist/{chunk-W4LM3QYZ.js → chunk-HB5Y37YU.js} +8 -8
  19. package/dist/{chunk-RKXIRRKQ.js → chunk-JLKYXLFN.js} +70 -66
  20. package/dist/{chunk-BRBTD7RH.js → chunk-MA7YKRUP.js} +28 -18
  21. package/dist/{chunk-TSE423UF.js → chunk-MKTSMWVD.js} +6 -6
  22. package/dist/{chunk-MJUDMVRU.js → chunk-MT5FJ3ZT.js} +17 -17
  23. package/dist/{chunk-565V6JTN.js → chunk-OHPW55EV.js} +60 -99
  24. package/dist/chunk-OKLQVY3Y.js +139 -0
  25. package/dist/{chunk-OVNLOE3Y.js → chunk-PLTZB5BC.js} +41 -41
  26. package/dist/{chunk-E2XT3G52.js → chunk-QC4BJEG6.js} +136 -137
  27. package/dist/{chunk-KH5UDAJ2.js → chunk-QDH5GEGY.js} +58 -54
  28. package/dist/{chunk-33W2TLUL.js → chunk-QID2OOMG.js} +12 -3
  29. package/dist/{chunk-FJSVPBKY.js → chunk-S7OXQTST.js} +17 -3
  30. package/dist/chunk-T7HMZEVO.js +216 -0
  31. package/dist/{chunk-FNYJFCGU.js → chunk-U6QTHMY6.js} +145 -256
  32. package/dist/{chunk-YS66Q3RC.js → chunk-US6JKJKH.js} +2 -2
  33. package/dist/chunk-VX3XOUEB.js +63 -0
  34. package/dist/{chunk-TDYQBLL5.js → chunk-ZMNSRDMH.js} +6 -6
  35. package/dist/dashboard.d.ts +156 -4
  36. package/dist/dashboard.js +885 -8
  37. package/dist/{document-editor-pane-DWWUTTTZ.js → document-editor-pane-TLPVRBBU.js} +3 -3
  38. package/dist/editor.d.ts +9 -8
  39. package/dist/editor.js +3 -3
  40. package/dist/files.js +3 -3
  41. package/dist/globals.css +4787 -69
  42. package/dist/hooks.d.ts +1 -1
  43. package/dist/hooks.js +7 -7
  44. package/dist/index.d.ts +4 -4
  45. package/dist/index.js +28 -28
  46. package/dist/markdown.js +1 -1
  47. package/dist/openui.js +5 -5
  48. package/dist/pages.d.ts +114 -5
  49. package/dist/pages.js +1978 -365
  50. package/dist/primitives.d.ts +5 -2
  51. package/dist/primitives.js +10 -10
  52. package/dist/run.js +4 -4
  53. package/dist/sdk-hooks.d.ts +2 -3
  54. package/dist/sdk-hooks.js +5 -5
  55. package/dist/styles.css +4787 -69
  56. package/dist/template-card-BAtvcAkU.d.ts +18 -0
  57. package/dist/terminal.d.ts +3 -1
  58. package/dist/terminal.js +66 -32
  59. package/dist/tokens.css +289 -237
  60. package/dist/{usage-chart-XCoB_7Xu.d.ts → usage-chart-SSiOgeQI.d.ts} +3 -1
  61. package/dist/{use-pty-session-COzVkhtc.d.ts → use-pty-session-0AOuwXgq.d.ts} +2 -0
  62. package/dist/{index-BT_-ecpc.d.ts → variant-list-CsS6ydgm.d.ts} +16 -7
  63. package/dist/workspace.d.ts +2 -2
  64. package/dist/workspace.js +13 -13
  65. package/package.json +18 -3
  66. package/tailwind.config.cjs +3 -2
  67. package/dist/chunk-3HW53XTH.js +0 -228
  68. package/dist/chunk-OKCIKTXQ.js +0 -63
@@ -0,0 +1,18 @@
1
+ import * as react_jsx_runtime from 'react/jsx-runtime';
2
+ import * as React from 'react';
3
+
4
+ interface TemplateCardData {
5
+ id: string;
6
+ name: string;
7
+ description: string;
8
+ icon?: React.ReactNode;
9
+ tags?: string[];
10
+ }
11
+ interface TemplateCardProps {
12
+ template: TemplateCardData;
13
+ onUseTemplate: (templateId: string) => void;
14
+ className?: string;
15
+ }
16
+ declare function TemplateCard({ template, onUseTemplate, className }: TemplateCardProps): react_jsx_runtime.JSX.Element;
17
+
18
+ export { type TemplateCardData as T, TemplateCard as a, type TemplateCardProps as b };
@@ -37,8 +37,10 @@ interface TerminalViewProps {
37
37
  subtitle?: string;
38
38
  /** @deprecated No longer used — the PTY provides its own prompt. */
39
39
  prompt?: string;
40
+ /** Whether the terminal tab is currently active and visible. */
41
+ isActive?: boolean;
40
42
  }
41
43
  declare const DEFAULT_TERMINAL_THEME: TerminalTheme;
42
- declare function TerminalView({ apiUrl, token, theme, title, subtitle, }: TerminalViewProps): react_jsx_runtime.JSX.Element;
44
+ declare function TerminalView({ apiUrl, token, theme, title, subtitle, isActive, }: TerminalViewProps): react_jsx_runtime.JSX.Element;
43
45
 
44
46
  export { DEFAULT_TERMINAL_THEME, type TerminalTheme, TerminalView, type TerminalViewProps };
package/dist/terminal.js CHANGED
@@ -1,10 +1,10 @@
1
1
  import {
2
2
  usePtySession
3
- } from "./chunk-DLCFZDGX.js";
3
+ } from "./chunk-5UM2XMEJ.js";
4
4
 
5
5
  // src/terminal/terminal-view.tsx
6
6
  import "@xterm/xterm/css/xterm.css";
7
- import { useEffect, useRef, useCallback } from "react";
7
+ import { useEffect, useRef, useCallback, useMemo } from "react";
8
8
  import { Terminal } from "@xterm/xterm";
9
9
  import { FitAddon } from "@xterm/addon-fit";
10
10
  import { WebLinksAddon } from "@xterm/addon-web-links";
@@ -38,16 +38,20 @@ function TerminalView({
38
38
  token,
39
39
  theme,
40
40
  title = "Terminal",
41
- subtitle = "Connected to PTY session"
41
+ subtitle = "Connected to PTY session",
42
+ isActive = true
42
43
  }) {
43
- const resolvedTheme = { ...DEFAULT_TERMINAL_THEME, ...theme };
44
+ const resolvedTheme = useMemo(
45
+ () => ({ ...DEFAULT_TERMINAL_THEME, ...theme }),
46
+ [theme]
47
+ );
44
48
  const containerRef = useRef(null);
45
49
  const termRef = useRef(null);
46
50
  const fitAddonRef = useRef(null);
47
51
  const onData = useCallback((data) => {
48
52
  termRef.current?.write(data);
49
53
  }, []);
50
- const { isConnected, error, sendCommand, reconnect } = usePtySession({
54
+ const { isConnected, error, sendCommand, resizeTerminal, reconnect } = usePtySession({
51
55
  apiUrl,
52
56
  token,
53
57
  onData
@@ -75,13 +79,12 @@ function TerminalView({
75
79
  });
76
80
  termRef.current = term;
77
81
  fitAddonRef.current = fitAddon;
78
- const padTitle = title.padEnd(37);
79
- const padSubtitle = subtitle.padEnd(37);
80
- term.writeln(`\x1B[38;5;48m\u256D${"\u2500".repeat(41)}\u256E\x1B[0m`);
81
- term.writeln(`\x1B[38;5;48m\u2502\x1B[0m \x1B[1m${padTitle}\x1B[0m\x1B[38;5;48m\u2502\x1B[0m`);
82
- term.writeln(`\x1B[38;5;48m\u2502\x1B[0m ${padSubtitle}\x1B[38;5;48m\u2502\x1B[0m`);
83
- term.writeln(`\x1B[38;5;48m\u2570${"\u2500".repeat(41)}\u256F\x1B[0m`);
84
82
  term.onData((data) => {
83
+ if (data === "\f") {
84
+ termRef.current?.clear();
85
+ sendCommand("\r").catch(console.error);
86
+ return;
87
+ }
85
88
  sendCommand(data).catch((err) => {
86
89
  termRef.current?.writeln(
87
90
  `\r
@@ -89,6 +92,9 @@ function TerminalView({
89
92
  );
90
93
  });
91
94
  });
95
+ term.onResize(({ cols, rows }) => {
96
+ resizeTerminal(cols, rows).catch(console.error);
97
+ });
92
98
  const ro = new ResizeObserver(() => {
93
99
  requestAnimationFrame(() => {
94
100
  fitAddon.fit();
@@ -101,28 +107,56 @@ function TerminalView({
101
107
  termRef.current = null;
102
108
  fitAddonRef.current = null;
103
109
  };
104
- }, [sendCommand, resolvedTheme, title, subtitle]);
105
- return /* @__PURE__ */ jsxs("div", { className: "relative h-full w-full", children: [
106
- /* @__PURE__ */ jsx(
107
- "div",
108
- {
109
- ref: containerRef,
110
- className: "h-full w-full rounded-lg overflow-hidden",
111
- style: { backgroundColor: resolvedTheme.background }
110
+ }, [sendCommand, resizeTerminal, title, subtitle]);
111
+ useEffect(() => {
112
+ if (termRef.current) {
113
+ termRef.current.options.theme = resolvedTheme;
114
+ }
115
+ }, [resolvedTheme]);
116
+ useEffect(() => {
117
+ if (isConnected && termRef.current) {
118
+ resizeTerminal(termRef.current.cols, termRef.current.rows).catch(console.error);
119
+ if (isActive) {
120
+ termRef.current.focus();
112
121
  }
113
- ),
114
- (!isConnected || error) && /* @__PURE__ */ jsx("div", { className: "absolute inset-0 flex items-center justify-center bg-[var(--depth-1)] rounded-lg", children: /* @__PURE__ */ jsx("div", { className: "text-center", children: error ? /* @__PURE__ */ jsxs(Fragment, { children: [
115
- /* @__PURE__ */ jsx("p", { className: "text-sm text-[var(--surface-danger-text)] mb-3", children: error }),
116
- /* @__PURE__ */ jsx(
117
- "button",
118
- {
119
- onClick: reconnect,
120
- className: "text-sm text-[var(--surface-success-text)] hover:opacity-80 underline cursor-pointer",
121
- children: "Retry connection"
122
- }
123
- )
124
- ] }) : /* @__PURE__ */ jsx("p", { className: "text-sm text-[var(--text-muted)]", children: "Connecting to terminal..." }) }) })
125
- ] });
122
+ }
123
+ }, [isConnected, resizeTerminal, isActive]);
124
+ useEffect(() => {
125
+ if (isActive && termRef.current && fitAddonRef.current) {
126
+ setTimeout(() => {
127
+ fitAddonRef.current?.fit();
128
+ termRef.current?.focus();
129
+ }, 50);
130
+ }
131
+ }, [isActive]);
132
+ return /* @__PURE__ */ jsxs(
133
+ "div",
134
+ {
135
+ className: "relative h-full w-full group cursor-text",
136
+ onClick: () => termRef.current?.focus(),
137
+ children: [
138
+ /* @__PURE__ */ jsx(
139
+ "div",
140
+ {
141
+ ref: containerRef,
142
+ className: "h-full w-full overflow-hidden relative z-0",
143
+ style: { backgroundColor: resolvedTheme.background }
144
+ }
145
+ ),
146
+ (!isConnected || error) && /* @__PURE__ */ jsx("div", { className: "absolute inset-0 flex items-center justify-center bg-background", children: /* @__PURE__ */ jsx("div", { className: "text-center", children: error ? /* @__PURE__ */ jsxs(Fragment, { children: [
147
+ /* @__PURE__ */ jsx("p", { className: "text-sm text-[var(--surface-danger-text)] mb-3", children: error }),
148
+ /* @__PURE__ */ jsx(
149
+ "button",
150
+ {
151
+ onClick: reconnect,
152
+ className: "text-sm text-[var(--surface-success-text)] hover:opacity-80 underline cursor-pointer",
153
+ children: "Retry connection"
154
+ }
155
+ )
156
+ ] }) : /* @__PURE__ */ jsx("p", { className: "text-[13px] text-muted-foreground", children: "Connecting to terminal..." }) }) })
157
+ ]
158
+ }
159
+ );
126
160
  }
127
161
  export {
128
162
  DEFAULT_TERMINAL_THEME,