treesap 0.1.6 → 0.1.7
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/components/Terminal.d.ts +2 -2
- package/dist/components/Terminal.d.ts.map +1 -1
- package/dist/components/Terminal.js +10 -4
- package/dist/components/Terminal.js.map +1 -1
- package/dist/pages/Code.d.ts.map +1 -1
- package/dist/pages/Code.js +1 -1
- package/dist/pages/Code.js.map +1 -1
- package/dist/pages/Welcome.d.ts.map +1 -1
- package/dist/pages/Welcome.js +1 -1
- package/dist/pages/Welcome.js.map +1 -1
- package/dist/static/components/Terminal.js +66 -40
- package/dist/static/components/TerminalTabs.js +353 -0
- package/dist/static/signals/TerminalSignal.js +138 -0
- package/dist/static/styles/main.css +127 -65
- package/package.json +1 -1
- package/src/components/Terminal.tsx +13 -7
- package/src/pages/Code.tsx +83 -16
- package/src/pages/Welcome.tsx +44 -19
- package/src/static/components/Terminal.js +66 -40
- package/src/static/components/TerminalTabs.js +353 -0
- package/src/static/signals/TerminalSignal.js +138 -0
- package/src/static/styles/main.css +127 -65
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
interface TerminalProps {
|
|
2
2
|
id?: string;
|
|
3
|
-
|
|
3
|
+
index?: number;
|
|
4
4
|
}
|
|
5
|
-
export declare function Terminal({ id,
|
|
5
|
+
export declare function Terminal({ id, index }: TerminalProps): import("hono/jsx/jsx-dev-runtime").JSX.Element;
|
|
6
6
|
export {};
|
|
7
7
|
//# sourceMappingURL=Terminal.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Terminal.d.ts","sourceRoot":"","sources":["../../src/components/Terminal.tsx"],"names":[],"mappings":"AAAA,UAAU,aAAa;IACrB,EAAE,CAAC,EAAE,MAAM,CAAC;IACZ,
|
|
1
|
+
{"version":3,"file":"Terminal.d.ts","sourceRoot":"","sources":["../../src/components/Terminal.tsx"],"names":[],"mappings":"AAAA,UAAU,aAAa;IACrB,EAAE,CAAC,EAAE,MAAM,CAAC;IACZ,KAAK,CAAC,EAAE,MAAM,CAAC;CAChB;AAED,wBAAgB,QAAQ,CAAC,EAAE,EAAE,EAAE,KAAS,EAAE,EAAE,aAAa,kDAkCxD"}
|
|
@@ -1,8 +1,14 @@
|
|
|
1
1
|
import { jsx as _jsx, jsxs as _jsxs } from "hono/jsx/jsx-runtime";
|
|
2
|
-
export function Terminal({ id =
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
2
|
+
export function Terminal({ id, index = 1 }) {
|
|
3
|
+
const terminalId = id || `terminal-${index}`;
|
|
4
|
+
const sessionId = `terminal-${index}`;
|
|
5
|
+
return (_jsxs("sapling-island", { loading: "visible", children: [_jsxs("template", { children: [_jsx("link", { href: "https://cdn.jsdelivr.net/npm/@xterm/xterm@5.5.0/css/xterm.min.css", rel: "stylesheet" }), _jsx("script", { type: "module", src: "/components/Terminal.js" })] }), _jsx("div", { id: terminalId, class: "h-full bg-gray-900 flex font-sans overflow-hidden", children: _jsx("div", { class: "w-full flex flex-col bg-gray-900 relative", children: _jsx("div", { id: `${terminalId}-container`, class: "h-full flex flex-col", children: _jsx("div", { class: "flex-1 overflow-hidden", children: _jsx("div", { id: `${terminalId}-xterm`, class: "h-full w-full" }) }) }) }) }), _jsx("script", { dangerouslySetInnerHTML: { __html: `
|
|
6
|
+
// Pass terminal data to JavaScript
|
|
7
|
+
window.terminalData_${terminalId.replace(/-/g, '_')} = {
|
|
8
|
+
terminalId: '${terminalId}',
|
|
9
|
+
sessionId: '${sessionId}',
|
|
10
|
+
index: ${index}
|
|
11
|
+
};
|
|
6
12
|
` } })] }));
|
|
7
13
|
}
|
|
8
14
|
//# sourceMappingURL=Terminal.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Terminal.js","sourceRoot":"","sources":["../../src/components/Terminal.tsx"],"names":[],"mappings":";AAKA,MAAM,UAAU,QAAQ,CAAC,EAAE,EAAE,GAAG,UAAU,EAAE,SAAS,
|
|
1
|
+
{"version":3,"file":"Terminal.js","sourceRoot":"","sources":["../../src/components/Terminal.tsx"],"names":[],"mappings":";AAKA,MAAM,UAAU,QAAQ,CAAC,EAAE,EAAE,EAAE,KAAK,GAAG,CAAC,EAAiB;IACvD,MAAM,UAAU,GAAG,EAAE,IAAI,YAAY,KAAK,EAAE,CAAC;IAC7C,MAAM,SAAS,GAAG,YAAY,KAAK,EAAE,CAAC;IACtC,OAAO,CACL,0BAAgB,OAAO,EAAC,SAAS,aAC/B,+BACE,eAAM,IAAI,EAAC,mEAAmE,EAAC,GAAG,EAAC,YAAY,GAAG,EAClG,iBAAQ,IAAI,EAAC,QAAQ,EAAC,GAAG,EAAC,yBAAyB,GAAU,IACpD,EAEX,cAAK,EAAE,EAAE,UAAU,EAAE,KAAK,EAAC,mDAAmD,YAE5E,cAAK,KAAK,EAAC,2CAA2C,YAEpD,cAAK,EAAE,EAAE,GAAG,UAAU,YAAY,EAAE,KAAK,EAAC,sBAAsB,YAG9D,cAAK,KAAK,EAAC,wBAAwB,YACjC,cAAK,EAAE,EAAE,GAAG,UAAU,QAAQ,EAAE,KAAK,EAAC,eAAe,GAAO,GACxD,GACF,GACF,GACF,EAEN,iBAAQ,uBAAuB,EAAE,EAAC,MAAM,EAAE;;8BAElB,UAAU,CAAC,OAAO,CAAC,IAAI,EAAE,GAAG,CAAC;yBAClC,UAAU;wBACX,SAAS;mBACd,KAAK;;OAEjB,EAAC,GAAW,IACE,CAClB,CAAC;AACJ,CAAC"}
|
package/dist/pages/Code.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Code.d.ts","sourceRoot":"","sources":["../../src/pages/Code.tsx"],"names":[],"mappings":"AAIA,UAAU,aAAa;IACrB,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,gBAAgB,CAAC,EAAE,MAAM,CAAC;CAC3B;AAED,wBAAgB,IAAI,CAAC,EAAE,WAAkB,EAAE,gBAAgB,EAAE,EAAE,aAAa,
|
|
1
|
+
{"version":3,"file":"Code.d.ts","sourceRoot":"","sources":["../../src/pages/Code.tsx"],"names":[],"mappings":"AAIA,UAAU,aAAa;IACrB,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,gBAAgB,CAAC,EAAE,MAAM,CAAC;CAC3B;AAED,wBAAgB,IAAI,CAAC,EAAE,WAAkB,EAAE,gBAAgB,EAAE,EAAE,aAAa,kDAuJ3E"}
|
package/dist/pages/Code.js
CHANGED
|
@@ -3,6 +3,6 @@ import Layout from "../layouts/Layout.js";
|
|
|
3
3
|
import { Terminal as TerminalComponent } from "../components/Terminal.js";
|
|
4
4
|
import { SimpleLivePreview } from "../components/SimpleLivePreview.js";
|
|
5
5
|
export function Code({ previewPort = 1234, workingDirectory }) {
|
|
6
|
-
return (
|
|
6
|
+
return (_jsxs(Layout, { title: "Code Editor", children: [_jsxs("div", { id: "code-container", class: "h-screen flex bg-[#1e1e1e]", children: [_jsxs("div", { id: "sidebar-pane", class: "w-2/5-plus border-r border-[#3c3c3c] transition-all duration-300 flex flex-col bg-[#252526]", children: [_jsx("div", { class: "p-3 border-b border-[#3c3c3c] bg-[#2d2d30]", children: _jsxs("div", { class: "flex items-center gap-2", children: [_jsx("a", { href: "/", class: "p-2 hover:bg-[#3c3c3c] rounded-md transition-colors flex-shrink-0 text-[#cccccc] hover:text-white", title: "Back to Home", children: _jsx("iconify-icon", { icon: "tabler:arrow-left", width: "16", height: "16" }) }), _jsx("button", { type: "button", id: "live-preview-refresh-btn", class: "p-2 hover:bg-[#3c3c3c] rounded-md transition-colors flex-shrink-0 text-[#cccccc] hover:text-white", title: "Reload", children: _jsx("iconify-icon", { icon: "tabler:refresh", width: "16", height: "16" }) }), _jsxs("div", { class: "flex-1 flex items-center bg-[#1e1e1e] border border-[#3c3c3c] rounded px-3 py-2 hover:border-[#0e639c] focus-within:border-[#0e639c] transition-all", children: [_jsx("iconify-icon", { icon: "tabler:world", width: "16", height: "16", class: "text-[#cccccc] mr-2" }), _jsxs("span", { class: "text-[#cccccc] text-sm", children: ["localhost:", previewPort, "/"] }), _jsx("input", { id: "live-preview-url-input", type: "text", placeholder: "path", defaultValue: "", class: "flex-1 bg-transparent text-sm focus:outline-none text-[#cccccc] ml-1" }), _jsx("button", { type: "button", id: "live-preview-load-btn", class: "ml-2 p-1 hover:bg-[#3c3c3c] rounded transition-colors flex-shrink-0 text-[#cccccc] hover:text-white", title: "Go", children: _jsx("iconify-icon", { icon: "tabler:chevron-right", width: "16", height: "16" }) })] })] }) }), _jsxs("div", { class: "flex py-2", children: [_jsx("button", { class: "px-3 py-2 text-[#cccccc] disabled:opacity-50 cursor-not-allowed flex items-center justify-center", children: _jsx("iconify-icon", { icon: "tabler:folder", width: "20", height: "20" }) }), _jsx("button", { class: "px-3 py-2 text-[#cccccc] disabled:opacity-50 cursor-not-allowed flex items-center justify-center", children: _jsx("iconify-icon", { icon: "tabler:search", width: "20", height: "20" }) }), _jsx("button", { class: "px-3 py-2 text-white flex items-center justify-center", children: _jsx("iconify-icon", { icon: "tabler:terminal", width: "20", height: "20" }) }), _jsx("button", { class: "px-3 py-2 text-[#cccccc] disabled:opacity-50 cursor-not-allowed flex items-center justify-center", children: _jsx("iconify-icon", { icon: "tabler:git-merge", width: "20", height: "20" }) })] }), _jsx("div", { class: "flex-1 overflow-hidden bg-[#1e1e1e]", children: _jsxs("div", { class: "h-full flex flex-col", children: [_jsx("div", { class: "border-b border-[#3c3c3c] bg-[#252526] px-3 py-1", children: _jsxs("div", { class: "flex items-center gap-1", children: [_jsxs("button", { id: "terminal-tab-1", class: "terminal-tab flex items-center px-3 py-1 text-sm text-white bg-[#1e1e1e] border-t-2 border-[#0e639c] rounded-t-sm hover:bg-[#2d2d30] transition-colors", "data-terminal-index": "1", children: [_jsx("iconify-icon", { icon: "tabler:terminal-2", width: "14", height: "14", class: "mr-1" }), "Terminal 1", _jsx("button", { class: "ml-2 hover:bg-[#3c3c3c] rounded p-0.5 text-[#cccccc] hover:text-white terminal-close-btn", "data-terminal-index": "1", style: "display: none;", children: _jsx("iconify-icon", { icon: "tabler:x", width: "12", height: "12" }) })] }), _jsxs("button", { id: "terminal-tab-2", class: "terminal-tab flex items-center px-3 py-1 text-sm text-[#cccccc] hover:text-white hover:bg-[#2d2d30] transition-colors rounded-t-sm", "data-terminal-index": "2", style: "display: none;", children: [_jsx("iconify-icon", { icon: "tabler:terminal-2", width: "14", height: "14", class: "mr-1" }), "Terminal 2", _jsx("button", { class: "ml-2 hover:bg-[#3c3c3c] rounded p-0.5 text-[#cccccc] hover:text-white terminal-close-btn", "data-terminal-index": "2", children: _jsx("iconify-icon", { icon: "tabler:x", width: "12", height: "12" }) })] }), _jsxs("button", { id: "terminal-tab-3", class: "terminal-tab flex items-center px-3 py-1 text-sm text-[#cccccc] hover:text-white hover:bg-[#2d2d30] transition-colors rounded-t-sm", "data-terminal-index": "3", style: "display: none;", children: [_jsx("iconify-icon", { icon: "tabler:terminal-2", width: "14", height: "14", class: "mr-1" }), "Terminal 3", _jsx("button", { class: "ml-2 hover:bg-[#3c3c3c] rounded p-0.5 text-[#cccccc] hover:text-white terminal-close-btn", "data-terminal-index": "3", children: _jsx("iconify-icon", { icon: "tabler:x", width: "12", height: "12" }) })] }), _jsx("button", { id: "add-terminal-btn", class: "flex items-center px-2 py-1 text-sm text-[#cccccc] hover:text-white hover:bg-[#2d2d30] transition-colors rounded", title: "New Terminal", children: _jsx("iconify-icon", { icon: "tabler:plus", width: "14", height: "14" }) })] }) }), _jsxs("div", { class: "flex-1 overflow-hidden relative", children: [_jsx("div", { id: "terminal-container-1", class: "h-full p-4 terminal-container", "data-terminal-index": "1", children: _jsx(TerminalComponent, { index: 1 }) }), _jsx("div", { id: "terminal-container-2", class: "h-full p-4 terminal-container", "data-terminal-index": "2", style: "display: none;", children: _jsx(TerminalComponent, { index: 2 }) }), _jsx("div", { id: "terminal-container-3", class: "h-full p-4 terminal-container", "data-terminal-index": "3", style: "display: none;", children: _jsx(TerminalComponent, { index: 3 }) })] })] }) })] }), _jsx(SimpleLivePreview, { id: "live-preview", previewPort: previewPort })] }), _jsx("script", { type: "module", src: "/components/TerminalTabs.js" })] }));
|
|
7
7
|
}
|
|
8
8
|
//# sourceMappingURL=Code.js.map
|
package/dist/pages/Code.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Code.js","sourceRoot":"","sources":["../../src/pages/Code.tsx"],"names":[],"mappings":";AAAA,OAAO,MAAM,MAAM,sBAAsB,CAAC;AAC1C,OAAO,EAAE,QAAQ,IAAI,iBAAiB,EAAE,MAAM,2BAA2B,CAAC;AAC1E,OAAO,EAAE,iBAAiB,EAAE,MAAM,oCAAoC,CAAC;AAOvE,MAAM,UAAU,IAAI,CAAC,EAAE,WAAW,GAAG,IAAI,EAAE,gBAAgB,EAAiB;IAC1E,OAAO,CACL,
|
|
1
|
+
{"version":3,"file":"Code.js","sourceRoot":"","sources":["../../src/pages/Code.tsx"],"names":[],"mappings":";AAAA,OAAO,MAAM,MAAM,sBAAsB,CAAC;AAC1C,OAAO,EAAE,QAAQ,IAAI,iBAAiB,EAAE,MAAM,2BAA2B,CAAC;AAC1E,OAAO,EAAE,iBAAiB,EAAE,MAAM,oCAAoC,CAAC;AAOvE,MAAM,UAAU,IAAI,CAAC,EAAE,WAAW,GAAG,IAAI,EAAE,gBAAgB,EAAiB;IAC1E,OAAO,CACL,MAAC,MAAM,IAAC,KAAK,EAAC,aAAa,aACzB,eAAK,EAAE,EAAC,gBAAgB,EAAC,KAAK,EAAC,4BAA4B,aAEzD,eAAK,EAAE,EAAC,cAAc,EAAC,KAAK,EAAC,6FAA6F,aAExH,cAAK,KAAK,EAAC,4CAA4C,YACrD,eAAK,KAAK,EAAC,yBAAyB,aAClC,YACE,IAAI,EAAC,GAAG,EACR,KAAK,EAAC,mGAAmG,EACzG,KAAK,EAAC,cAAc,YAEpB,uBAAc,IAAI,EAAC,mBAAmB,EAAC,KAAK,EAAC,IAAI,EAAC,MAAM,EAAC,I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,uBAAc,IAAI,EAAC,UAAU,EAAC,KAAK,EAAC,IAAI,EAAC,MAAM,EAAC,IAAI,GAAgB,GAC7D,IACF,EAGT,iBACE,EAAE,EAAC,kBAAkB,EACrB,KAAK,EAAC,kHAAkH,EACxH,KAAK,EAAC,cAAc,YAEpB,uBAAc,IAAI,EAAC,aAAa,EAAC,KAAK,EAAC,IAAI,EAAC,MAAM,EAAC,IAAI,GAAgB,GAChE,IACL,GACF,EAGN,eAAK,KAAK,EAAC,iCAAiC,aAE1C,cAAK,EAAE,EAAC,sBAAsB,EAAC,KAAK,EAAC,+BAA+B,yBAAqB,GAAG,YAC1F,KAAC,iBAAiB,IAAC,KAAK,EAAE,CAAC,GAAI,GAC3B,EAGN,cAAK,EAAE,EAAC,sBAAsB,EAAC,KAAK,EAAC,+BAA+B,yBAAqB,GAAG,EAAC,KAAK,EAAC,gBAAgB,YACjH,KAAC,iBAAiB,IAAC,KAAK,EAAE,CAAC,GAAI,GAC3B,EAGN,cAAK,EAAE,EAAC,sBAAsB,EAAC,KAAK,EAAC,+BAA+B,yBAAqB,GAAG,EAAC,KAAK,EAAC,gBAAgB,YACjH,KAAC,iBAAiB,IAAC,KAAK,EAAE,CAAC,GAAI,GAC3B,IACF,IACF,GACF,IACF,EAGN,KAAC,iBAAiB,IAAC,EAAE,EAAC,cAAc,EAAC,WAAW,EAAE,WAAW,GAAI,IAC7D,EAGN,iBAAQ,IAAI,EAAC,QAAQ,EAAC,GAAG,EAAC,6BAA6B,GAAU,IAC1D,CACV,CAAC;AACJ,CAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Welcome.d.ts","sourceRoot":"","sources":["../../src/pages/Welcome.tsx"],"names":[],"mappings":"AAEA,wBAAgB,OAAO,
|
|
1
|
+
{"version":3,"file":"Welcome.d.ts","sourceRoot":"","sources":["../../src/pages/Welcome.tsx"],"names":[],"mappings":"AAEA,wBAAgB,OAAO,mDAqDtB"}
|
package/dist/pages/Welcome.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { jsx as _jsx, jsxs as _jsxs } from "hono/jsx/jsx-runtime";
|
|
2
2
|
import Layout from "../layouts/Layout.js";
|
|
3
3
|
export function Welcome() {
|
|
4
|
-
return (_jsx(Layout, { title: "Welcome to Treesap", children:
|
|
4
|
+
return (_jsx(Layout, { title: "Welcome to Treesap", children: _jsxs("div", { class: "h-screen flex flex-col items-center justify-center bg-[#1e1e1e] text-white p-8", children: [_jsx("div", { class: "text-center mb-12", children: _jsxs("div", { class: "flex items-center justify-center mb-4", children: [_jsx("div", { class: "w-12 h-12 bg-gradient-to-br from-green-400 to-green-600 rounded-lg flex items-center justify-center mr-4", children: _jsx("span", { class: "text-2xl", children: "\uD83C\uDF33" }) }), _jsxs("div", { class: "text-left", children: [_jsx("h1", { class: "text-3xl font-semibold text-white", children: "Treesap" }), _jsx("p", { class: "text-gray-400 text-sm", children: "Free \u2022 Development Environment" })] })] }) }), _jsxs("div", { class: "flex gap-8 mb-16", children: [_jsxs("a", { href: "/code", class: "flex flex-col items-center p-6 bg-[#2a2a2a] hover:bg-[#3a3a3a] rounded-lg transition-colors group min-w-[140px]", children: [_jsx("div", { class: "w-8 h-8 mb-3 text-gray-300 group-hover:text-white transition-colors", children: _jsx("iconify-icon", { icon: "tabler:folder-open", width: "32", height: "32" }) }), _jsx("span", { class: "text-gray-300 group-hover:text-white transition-colors", children: "Open project" })] }), _jsxs("button", { class: "flex flex-col items-center p-6 bg-[#2a2a2a] hover:bg-[#3a3a3a] rounded-lg transition-colors group min-w-[140px] opacity-50 cursor-not-allowed", disabled: true, children: [_jsx("div", { class: "w-8 h-8 mb-3 text-gray-500", children: _jsx("iconify-icon", { icon: "tabler:git-branch", width: "32", height: "32" }) }), _jsx("span", { class: "text-gray-500", children: "Clone repo" })] }), _jsxs("button", { class: "flex flex-col items-center p-6 bg-[#2a2a2a] hover:bg-[#3a3a3a] rounded-lg transition-colors group min-w-[140px] opacity-50 cursor-not-allowed", disabled: true, children: [_jsx("div", { class: "w-8 h-8 mb-3 text-gray-500", children: _jsx("iconify-icon", { icon: "tabler:terminal", width: "32", height: "32" }) }), _jsx("span", { class: "text-gray-500", children: "Connect via SSH" })] })] })] }) }));
|
|
5
5
|
}
|
|
6
6
|
//# sourceMappingURL=Welcome.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Welcome.js","sourceRoot":"","sources":["../../src/pages/Welcome.tsx"],"names":[],"mappings":";AAAA,OAAO,MAAM,MAAM,sBAAsB,CAAC;AAE1C,MAAM,UAAU,OAAO;IACrB,OAAO,CACL,KAAC,MAAM,IAAC,KAAK,EAAC,oBAAoB,YAChC,cAAK,KAAK,EAAC,
|
|
1
|
+
{"version":3,"file":"Welcome.js","sourceRoot":"","sources":["../../src/pages/Welcome.tsx"],"names":[],"mappings":";AAAA,OAAO,MAAM,MAAM,sBAAsB,CAAC;AAE1C,MAAM,UAAU,OAAO;IACrB,OAAO,CACL,KAAC,MAAM,IAAC,KAAK,EAAC,oBAAoB,YAChC,eAAK,KAAK,EAAC,gFAAgF,aAEzF,cAAK,KAAK,EAAC,mBAAmB,YAC5B,eAAK,KAAK,EAAC,uCAAuC,aAChD,cAAK,KAAK,EAAC,0GAA0G,YACnH,eAAM,KAAK,EAAC,UAAU,6BAAU,GAC5B,EACN,eAAK,KAAK,EAAC,WAAW,aACpB,aAAI,KAAK,EAAC,mCAAmC,wBAAa,EAC1D,YAAG,KAAK,EAAC,uBAAuB,oDAAmC,IAC/D,IACF,GACF,EAGN,eAAK,KAAK,EAAC,kBAAkB,aAC3B,aACE,IAAI,EAAC,OAAO,EACZ,KAAK,EAAC,iHAAiH,aAEvH,cAAK,KAAK,EAAC,qEAAqE,YAC9E,uBAAc,IAAI,EAAC,oBAAoB,EAAC,KAAK,EAAC,IAAI,EAAC,MAAM,EAAC,IAAI,GAAgB,GAC1E,EACN,eAAM,KAAK,EAAC,wDAAwD,6BAAoB,IACtF,EAEJ,kBACE,KAAK,EAAC,+IAA+I,EACrJ,QAAQ,mBAER,cAAK,KAAK,EAAC,4BAA4B,YACrC,uBAAc,IAAI,EAAC,mBAAmB,EAAC,KAAK,EAAC,IAAI,EAAC,MAAM,EAAC,IAAI,GAAgB,GACzE,EACN,eAAM,KAAK,EAAC,eAAe,2BAAkB,IACtC,EAET,kBACE,KAAK,EAAC,+IAA+I,EACrJ,QAAQ,mBAER,cAAK,KAAK,EAAC,4BAA4B,YACrC,uBAAc,IAAI,EAAC,iBAAiB,EAAC,KAAK,EAAC,IAAI,EAAC,MAAM,EAAC,IAAI,GAAgB,GACvE,EACN,eAAM,KAAK,EAAC,eAAe,gCAAuB,IAC3C,IACL,IAEF,GACC,CACV,CAAC;AACJ,CAAC"}
|
|
@@ -1,41 +1,44 @@
|
|
|
1
1
|
// Terminal component JavaScript using Xterm.js
|
|
2
2
|
import { Terminal } from 'https://cdn.jsdelivr.net/npm/@xterm/xterm@5.5.0/+esm';
|
|
3
|
+
import { terminalStore } from '/signals/TerminalSignal.js';
|
|
3
4
|
class TerminalManager {
|
|
4
|
-
constructor(
|
|
5
|
-
this.
|
|
6
|
-
this.container = document.getElementById(
|
|
7
|
-
this.xtermContainer = document.getElementById(`${
|
|
8
|
-
this.resetBtn = document.getElementById(`${
|
|
9
|
-
this.status = document.getElementById(`${
|
|
5
|
+
constructor(terminalId) {
|
|
6
|
+
this.terminalId = terminalId;
|
|
7
|
+
this.container = document.getElementById(terminalId);
|
|
8
|
+
this.xtermContainer = document.getElementById(`${terminalId}-xterm`);
|
|
9
|
+
this.resetBtn = document.getElementById(`${terminalId}-reset-btn`);
|
|
10
|
+
this.status = document.getElementById(`${terminalId}-status`);
|
|
10
11
|
|
|
11
|
-
//
|
|
12
|
-
const
|
|
13
|
-
|
|
14
|
-
|
|
12
|
+
// Get terminal data from window
|
|
13
|
+
const terminalData = window[`terminalData_${terminalId.replace(/-/g, '_')}`];
|
|
14
|
+
if (!terminalData) {
|
|
15
|
+
console.error(`No terminal data found for ${terminalId}`);
|
|
16
|
+
return;
|
|
17
|
+
}
|
|
18
|
+
|
|
19
|
+
this.sessionId = terminalData.sessionId;
|
|
20
|
+
this.index = terminalData.index;
|
|
21
|
+
|
|
22
|
+
console.log(`Terminal ${terminalId} initialized with:`, terminalData);
|
|
23
|
+
|
|
24
|
+
// Register terminal in store
|
|
25
|
+
terminalStore.addTerminal(this.index);
|
|
26
|
+
terminalStore.updateTerminalStatus(terminalId, 'connecting');
|
|
15
27
|
|
|
16
28
|
this.eventSource = null;
|
|
17
29
|
this.terminal = null;
|
|
18
30
|
|
|
19
|
-
// Share session ID globally for Claude Controller
|
|
20
|
-
if (typeof window !== 'undefined') {
|
|
21
|
-
window.sharedTerminalSessionId = this.sessionId;
|
|
22
|
-
console.log('Terminal session ID shared:', this.sessionId);
|
|
23
|
-
}
|
|
24
|
-
|
|
25
31
|
this.init();
|
|
26
32
|
}
|
|
27
33
|
|
|
28
|
-
generateSessionId() {
|
|
29
|
-
return 'terminal_' + Math.random().toString(36).substr(2, 9);
|
|
30
|
-
}
|
|
31
|
-
|
|
32
34
|
init() {
|
|
33
|
-
console.log('Terminal init called with ID:', this.
|
|
35
|
+
console.log('Terminal init called with ID:', this.terminalId);
|
|
34
36
|
console.log('Container found:', !!this.container);
|
|
35
37
|
console.log('Xterm container found:', !!this.xtermContainer);
|
|
36
38
|
|
|
37
39
|
if (!this.container || !this.xtermContainer) {
|
|
38
|
-
console.error('Terminal containers not found! Looking for ID:', this.
|
|
40
|
+
console.error('Terminal containers not found! Looking for ID:', this.terminalId);
|
|
41
|
+
terminalStore.updateTerminalStatus(this.terminalId, 'error');
|
|
39
42
|
return;
|
|
40
43
|
}
|
|
41
44
|
|
|
@@ -106,10 +109,20 @@ class TerminalManager {
|
|
|
106
109
|
|
|
107
110
|
fitTerminal() {
|
|
108
111
|
if (this.terminal && this.xtermContainer) {
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
112
|
+
// Wait a moment to ensure container is properly sized
|
|
113
|
+
setTimeout(() => {
|
|
114
|
+
const containerRect = this.xtermContainer.getBoundingClientRect();
|
|
115
|
+
if (containerRect.width > 0 && containerRect.height > 0) {
|
|
116
|
+
const cols = Math.floor(containerRect.width / 7.2); // Approximate character width for 12px font
|
|
117
|
+
const rows = Math.floor(containerRect.height / 14.4); // Approximate line height for 12px font
|
|
118
|
+
console.log(`Fitting terminal ${this.terminalId}: ${cols}x${rows} (container: ${containerRect.width}x${containerRect.height})`);
|
|
119
|
+
this.terminal.resize(cols, rows);
|
|
120
|
+
} else {
|
|
121
|
+
console.warn(`Terminal ${this.terminalId} container has zero dimensions, retrying...`);
|
|
122
|
+
// Retry after a short delay
|
|
123
|
+
setTimeout(() => this.fitTerminal(), 100);
|
|
124
|
+
}
|
|
125
|
+
}, 10);
|
|
113
126
|
}
|
|
114
127
|
}
|
|
115
128
|
|
|
@@ -147,6 +160,7 @@ class TerminalManager {
|
|
|
147
160
|
|
|
148
161
|
this.eventSource.onopen = () => {
|
|
149
162
|
this.updateStatus('Ready');
|
|
163
|
+
terminalStore.updateTerminalStatus(this.terminalId, 'connected');
|
|
150
164
|
};
|
|
151
165
|
|
|
152
166
|
this.eventSource.onmessage = (event) => {
|
|
@@ -172,10 +186,12 @@ class TerminalManager {
|
|
|
172
186
|
this.eventSource.onerror = (error) => {
|
|
173
187
|
console.error('Terminal stream error:', error);
|
|
174
188
|
this.updateStatus('Disconnected');
|
|
189
|
+
terminalStore.updateTerminalStatus(this.terminalId, 'disconnected');
|
|
175
190
|
|
|
176
191
|
// Attempt to reconnect after a delay
|
|
177
192
|
setTimeout(() => {
|
|
178
193
|
if (this.eventSource.readyState === EventSource.CLOSED) {
|
|
194
|
+
terminalStore.updateTerminalStatus(this.terminalId, 'connecting');
|
|
179
195
|
this.connectToTerminal();
|
|
180
196
|
}
|
|
181
197
|
}, 3000);
|
|
@@ -203,42 +219,52 @@ class TerminalManager {
|
|
|
203
219
|
if (this.terminal) {
|
|
204
220
|
this.terminal.dispose();
|
|
205
221
|
}
|
|
222
|
+
// Remove from store
|
|
223
|
+
terminalStore.removeTerminal(this.terminalId);
|
|
206
224
|
}
|
|
207
225
|
}
|
|
208
226
|
|
|
209
227
|
// Auto-initialize when script loads
|
|
210
|
-
console.log('Terminal.js loaded, looking for terminal
|
|
211
|
-
let
|
|
228
|
+
console.log('Terminal.js loaded, looking for terminal containers...');
|
|
229
|
+
let terminalManagers = new Map();
|
|
212
230
|
|
|
213
|
-
function
|
|
214
|
-
// Look for all sapling-islands and find the
|
|
231
|
+
function initializeTerminals() {
|
|
232
|
+
// Look for all sapling-islands and find the ones with terminal content
|
|
215
233
|
const saplingIslands = document.querySelectorAll('sapling-island');
|
|
216
|
-
let terminalId = 'terminal'; // default
|
|
217
234
|
|
|
218
235
|
for (const island of saplingIslands) {
|
|
219
236
|
// Look for a div with bg-gray-900 class (terminal styling)
|
|
220
237
|
const terminalDiv = island.querySelector('div.bg-gray-900[id]');
|
|
221
|
-
if (terminalDiv && terminalDiv.id) {
|
|
222
|
-
terminalId = terminalDiv.id;
|
|
238
|
+
if (terminalDiv && terminalDiv.id && terminalDiv.id.startsWith('terminal-')) {
|
|
239
|
+
const terminalId = terminalDiv.id;
|
|
223
240
|
console.log('Found terminal component with ID:', terminalId);
|
|
224
|
-
|
|
241
|
+
|
|
242
|
+
// Check if we already have a manager for this terminal
|
|
243
|
+
if (!terminalManagers.has(terminalId)) {
|
|
244
|
+
const manager = new TerminalManager(terminalId);
|
|
245
|
+
terminalManagers.set(terminalId, manager);
|
|
246
|
+
}
|
|
225
247
|
}
|
|
226
248
|
}
|
|
227
249
|
|
|
228
|
-
console.log(
|
|
229
|
-
terminalManager = new TerminalManager(terminalId);
|
|
250
|
+
console.log(`Initialized ${terminalManagers.size} terminal(s)`);
|
|
230
251
|
}
|
|
231
252
|
|
|
232
253
|
// Try immediate initialization
|
|
233
254
|
if (document.readyState === 'loading') {
|
|
234
|
-
document.addEventListener('DOMContentLoaded',
|
|
255
|
+
document.addEventListener('DOMContentLoaded', initializeTerminals);
|
|
235
256
|
} else {
|
|
236
|
-
|
|
257
|
+
initializeTerminals();
|
|
237
258
|
}
|
|
238
259
|
|
|
260
|
+
// Make available globally
|
|
261
|
+
window.terminalManagers = terminalManagers;
|
|
262
|
+
window.TerminalManager = TerminalManager;
|
|
263
|
+
window.initializeTerminals = initializeTerminals;
|
|
264
|
+
|
|
239
265
|
// Cleanup on page unload
|
|
240
266
|
window.addEventListener('beforeunload', () => {
|
|
241
|
-
|
|
242
|
-
|
|
267
|
+
for (const manager of terminalManagers.values()) {
|
|
268
|
+
manager.destroy();
|
|
243
269
|
}
|
|
244
270
|
});
|