@_davideast/stitch-mcp 0.4.0 → 0.5.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/chunk-25wakzyb.js +137 -0
- package/dist/chunk-25wakzyb.js.map +10 -0
- package/dist/chunk-2cetsfw4.js +16531 -0
- package/dist/chunk-2cetsfw4.js.map +95 -0
- package/dist/chunk-2fcdwvrm.js +54 -0
- package/dist/chunk-2fcdwvrm.js.map +10 -0
- package/dist/chunk-2k7n0w2x.js +3980 -0
- package/dist/chunk-2k7n0w2x.js.map +16 -0
- package/dist/chunk-2kyqsrg2.js +403 -0
- package/dist/chunk-2kyqsrg2.js.map +10 -0
- package/dist/chunk-384jmtpy.js +11057 -0
- package/dist/chunk-384jmtpy.js.map +238 -0
- package/dist/chunk-3at4pjgn.js +22 -0
- package/dist/chunk-3at4pjgn.js.map +9 -0
- package/dist/chunk-3sfn889r.js +492 -0
- package/dist/chunk-3sfn889r.js.map +13 -0
- package/dist/chunk-45wx7tn7.js +94 -0
- package/dist/chunk-45wx7tn7.js.map +10 -0
- package/dist/chunk-48d17n29.js +10 -0
- package/dist/chunk-48d17n29.js.map +9 -0
- package/dist/chunk-4jwmvjb4.js +839 -0
- package/dist/chunk-4jwmvjb4.js.map +11 -0
- package/dist/chunk-4jygt4d6.js +14 -0
- package/dist/chunk-4jygt4d6.js.map +10 -0
- package/dist/chunk-4vxy1qce.js +68 -0
- package/dist/chunk-4vxy1qce.js.map +10 -0
- package/dist/chunk-7tx0wn04.js +11 -0
- package/dist/chunk-7tx0wn04.js.map +9 -0
- package/dist/chunk-7xh1y383.js +45188 -0
- package/dist/chunk-7xh1y383.js.map +258 -0
- package/dist/chunk-8yrtq2qs.js +18 -0
- package/dist/chunk-8yrtq2qs.js.map +9 -0
- package/dist/chunk-985f11w6.js +21 -0
- package/dist/chunk-985f11w6.js.map +9 -0
- package/dist/chunk-9tvppjaf.js +250 -0
- package/dist/chunk-9tvppjaf.js.map +14 -0
- package/dist/chunk-9wyra8hs.js +32 -0
- package/dist/chunk-9wyra8hs.js.map +9 -0
- package/dist/chunk-cwkb2wbe.js +733 -0
- package/dist/chunk-cwkb2wbe.js.map +16 -0
- package/dist/chunk-djhzzcgj.js +362 -0
- package/dist/chunk-djhzzcgj.js.map +13 -0
- package/dist/chunk-edp6faw2.js +7 -0
- package/dist/chunk-edp6faw2.js.map +9 -0
- package/dist/chunk-ezmw2j8c.js +14 -0
- package/dist/chunk-ezmw2j8c.js.map +9 -0
- package/dist/chunk-f2hq6bfv.js +22 -0
- package/dist/chunk-f2hq6bfv.js.map +10 -0
- package/dist/chunk-fwb4fnkp.js +31 -0
- package/dist/chunk-fwb4fnkp.js.map +10 -0
- package/dist/chunk-h18jrqed.js +9517 -0
- package/dist/chunk-h18jrqed.js.map +99 -0
- package/dist/chunk-hb3c6f6a.js +42 -0
- package/dist/chunk-hb3c6f6a.js.map +9 -0
- package/dist/chunk-jy2d17pr.js +252 -0
- package/dist/chunk-jy2d17pr.js.map +11 -0
- package/dist/chunk-kbtqrkwh.js +24 -0
- package/dist/chunk-kbtqrkwh.js.map +10 -0
- package/dist/chunk-knbnsf6s.js +92 -0
- package/dist/chunk-knbnsf6s.js.map +10 -0
- package/dist/chunk-mv9ssgmx.js +446 -0
- package/dist/chunk-mv9ssgmx.js.map +17 -0
- package/dist/chunk-nq68kghz.js +1647 -0
- package/dist/chunk-nq68kghz.js.map +10 -0
- package/dist/chunk-nthabjd9.js +3138 -0
- package/dist/chunk-nthabjd9.js.map +34 -0
- package/dist/chunk-nxpzt33t.js +278 -0
- package/dist/chunk-nxpzt33t.js.map +10 -0
- package/dist/chunk-pfyjtfex.js +172 -0
- package/dist/chunk-pfyjtfex.js.map +10 -0
- package/dist/chunk-q1nd6g0y.js +392 -0
- package/dist/chunk-q1nd6g0y.js.map +20 -0
- package/dist/chunk-q4js8r0z.js +4708 -0
- package/dist/chunk-q4js8r0z.js.map +29 -0
- package/dist/chunk-qv44tmn6.js +289 -0
- package/dist/chunk-qv44tmn6.js.map +13 -0
- package/dist/chunk-r2sg2nxa.js +20 -0
- package/dist/chunk-r2sg2nxa.js.map +9 -0
- package/dist/chunk-rp8wjzht.js +16959 -0
- package/dist/chunk-rp8wjzht.js.map +26 -0
- package/dist/chunk-rpxnm86e.js +372 -0
- package/dist/chunk-rpxnm86e.js.map +17 -0
- package/dist/chunk-sdp429xd.js +914 -0
- package/dist/chunk-sdp429xd.js.map +24 -0
- package/dist/chunk-t85nbjjb.js +113 -0
- package/dist/chunk-t85nbjjb.js.map +10 -0
- package/dist/chunk-tz7wnw4s.js +211 -0
- package/dist/chunk-tz7wnw4s.js.map +11 -0
- package/dist/chunk-v7117ywx.js +1477 -0
- package/dist/chunk-v7117ywx.js.map +23 -0
- package/dist/chunk-w8q7nsm7.js +2098 -0
- package/dist/chunk-w8q7nsm7.js.map +44 -0
- package/dist/chunk-wa64nz8b.js +47 -0
- package/dist/chunk-wa64nz8b.js.map +10 -0
- package/dist/chunk-wz8d5vzb.js +234 -0
- package/dist/chunk-wz8d5vzb.js.map +11 -0
- package/dist/chunk-ycfxp056.js +677 -0
- package/dist/chunk-ycfxp056.js.map +17 -0
- package/dist/chunk-z9d2xc83.js +3256 -0
- package/dist/chunk-z9d2xc83.js.map +84 -0
- package/dist/cli.js +111 -126055
- package/dist/cli.js.map +19 -0
- package/dist/commands/autoload.d.ts +2 -0
- package/dist/commands/doctor/command.d.ts +2 -1
- package/dist/commands/doctor/command.js +82 -0
- package/dist/commands/doctor/command.js.map +11 -0
- package/dist/commands/doctor/spec.d.ts +16 -8
- package/dist/commands/init/command.d.ts +2 -1
- package/dist/commands/init/command.js +98 -0
- package/dist/commands/init/command.js.map +11 -0
- package/dist/commands/init/spec.d.ts +29 -9
- package/dist/commands/logout/command.d.ts +2 -1
- package/dist/commands/logout/command.js +79 -0
- package/dist/commands/logout/command.js.map +11 -0
- package/dist/commands/logout/spec.d.ts +11 -0
- package/dist/commands/proxy/command.d.ts +2 -1
- package/dist/commands/proxy/command.js +56 -0
- package/dist/commands/proxy/command.js.map +11 -0
- package/dist/commands/proxy/spec.d.ts +15 -0
- package/dist/commands/screens/command.d.ts +2 -1
- package/dist/commands/screens/command.js +61 -0
- package/dist/commands/screens/command.js.map +11 -0
- package/dist/commands/screens/spec.d.ts +9 -0
- package/dist/commands/serve/command.d.ts +2 -1
- package/dist/commands/serve/command.js +65 -0
- package/dist/commands/serve/command.js.map +11 -0
- package/dist/commands/serve/spec.d.ts +9 -0
- package/dist/commands/site/command.d.ts +2 -1
- package/dist/commands/site/command.js +53 -0
- package/dist/commands/site/command.js.map +11 -0
- package/dist/commands/site/spec.d.ts +15 -0
- package/dist/commands/snapshot/command.d.ts +2 -1
- package/dist/commands/snapshot/command.js +59 -0
- package/dist/commands/snapshot/command.js.map +11 -0
- package/dist/commands/tool/command.d.ts +2 -1
- package/dist/commands/tool/command.js +79 -0
- package/dist/commands/tool/command.js.map +11 -0
- package/dist/commands/tool/handler.d.ts +17 -0
- package/dist/commands/tool/spec.d.ts +17 -0
- package/dist/commands/view/command.d.ts +2 -1
- package/dist/commands/view/command.js +52 -0
- package/dist/commands/view/command.js.map +11 -0
- package/dist/commands/view/spec.d.ts +24 -0
- package/dist/framework/CommandDefinition.d.ts +2 -2
- package/dist/index.js +26 -21607
- package/dist/index.js.map +9 -0
- package/dist/lib/services/site/schemas.d.ts +8 -8
- package/dist/services/config/handler.d.ts +12 -0
- package/dist/services/config/spec.d.ts +82 -0
- package/dist/services/gcloud/auth.d.ts +28 -0
- package/dist/services/gcloud/core.d.ts +21 -0
- package/dist/services/gcloud/handler.d.ts +6 -18
- package/dist/services/gcloud/install.d.ts +23 -0
- package/dist/services/gcloud/projects.d.ts +15 -0
- package/dist/services/gcloud/spec.d.ts +32 -24
- package/dist/services/mcp-client/client.d.ts +0 -5
- package/dist/services/mcp-client/spec.d.ts +6 -6
- package/dist/services/mcp-config/spec.d.ts +12 -12
- package/dist/services/project/spec.d.ts +4 -4
- package/dist/services/proxy/spec.d.ts +3 -3
- package/dist/services/stitch/api.d.ts +10 -0
- package/dist/services/stitch/connection.d.ts +5 -0
- package/dist/services/stitch/handler.d.ts +5 -3
- package/dist/services/stitch/iam.d.ts +11 -0
- package/dist/services/stitch/spec.d.ts +6 -6
- package/dist/services/view/spec.d.ts +7 -7
- package/dist/src/cli.d.ts +1 -0
- package/dist/src/commands/doctor/handler.d.ts +9 -0
- package/dist/src/commands/doctor/handler.test.d.ts +1 -0
- package/dist/src/commands/doctor/spec.d.ts +130 -0
- package/dist/src/commands/doctor/spec.test.d.ts +1 -0
- package/dist/src/commands/init/handler.d.ts +17 -0
- package/dist/src/commands/init/handler.test.d.ts +1 -0
- package/dist/src/commands/init/spec.d.ts +88 -0
- package/dist/src/commands/init/spec.test.d.ts +1 -0
- package/dist/src/commands/proxy/handler.d.ts +7 -0
- package/dist/src/commands/proxy/handler.test.d.ts +1 -0
- package/dist/src/index.d.ts +13 -0
- package/dist/src/platform/detector.d.ts +29 -0
- package/dist/src/platform/paths.d.ts +20 -0
- package/dist/src/platform/shell.d.ts +26 -0
- package/dist/src/services/gcloud/handler.d.ts +48 -0
- package/dist/src/services/gcloud/handler.test.d.ts +1 -0
- package/dist/src/services/gcloud/spec.d.ts +405 -0
- package/dist/src/services/mcp-config/handler.d.ts +12 -0
- package/dist/src/services/mcp-config/handler.test.d.ts +1 -0
- package/dist/src/services/mcp-config/spec.d.ts +88 -0
- package/dist/src/services/mcp-config/spec.test.d.ts +1 -0
- package/dist/src/services/project/handler.d.ts +11 -0
- package/dist/src/services/project/handler.test.d.ts +1 -0
- package/dist/src/services/project/spec.d.ts +86 -0
- package/dist/src/services/project/spec.test.d.ts +1 -0
- package/dist/src/services/proxy/handler.d.ts +15 -0
- package/dist/src/services/proxy/handler.test.d.ts +1 -0
- package/dist/src/services/proxy/spec.d.ts +83 -0
- package/dist/src/services/proxy/spec.test.d.ts +1 -0
- package/dist/src/services/stitch/handler.d.ts +15 -0
- package/dist/src/services/stitch/handler.test.d.ts +1 -0
- package/dist/src/services/stitch/spec.d.ts +262 -0
- package/dist/src/services/stitch/spec.test.d.ts +1 -0
- package/dist/src/ui/spinner.d.ts +11 -0
- package/dist/src/ui/theme.d.ts +18 -0
- package/dist/src/ui/wizard.d.ts +24 -0
- package/dist/tests/mocks/shell.d.ts +2 -0
- package/dist/ui/JsonTree.d.ts +1 -1
- package/package.json +2 -2
- package/dist/commands/registry.d.ts +0 -2
- package/dist/ui/copy-behaviors/index.d.ts +0 -8
- package/dist/ui/serve-behaviors/index.d.ts +0 -7
- /package/dist/ui/navigation-behaviors/{index.d.ts → handler.d.ts} +0 -0
|
@@ -0,0 +1,677 @@
|
|
|
1
|
+
import {
|
|
2
|
+
require_jsx_dev_runtime
|
|
3
|
+
} from "./chunk-wz8d5vzb.js";
|
|
4
|
+
import {
|
|
5
|
+
Box_default,
|
|
6
|
+
Text,
|
|
7
|
+
use_app_default,
|
|
8
|
+
use_input_default
|
|
9
|
+
} from "./chunk-2cetsfw4.js";
|
|
10
|
+
import {
|
|
11
|
+
require_react
|
|
12
|
+
} from "./chunk-4jwmvjb4.js";
|
|
13
|
+
import {
|
|
14
|
+
copyJson,
|
|
15
|
+
copyText,
|
|
16
|
+
downloadAndCopyImage,
|
|
17
|
+
downloadAndCopyText
|
|
18
|
+
} from "./chunk-4vxy1qce.js";
|
|
19
|
+
import"./chunk-384jmtpy.js";
|
|
20
|
+
import"./chunk-mv9ssgmx.js";
|
|
21
|
+
import"./chunk-4jygt4d6.js";
|
|
22
|
+
import"./chunk-tz7wnw4s.js";
|
|
23
|
+
import"./chunk-3sfn889r.js";
|
|
24
|
+
import {
|
|
25
|
+
__toESM
|
|
26
|
+
} from "./chunk-9wyra8hs.js";
|
|
27
|
+
|
|
28
|
+
// src/ui/InteractiveViewer.tsx
|
|
29
|
+
var import_react2 = __toESM(require_react(), 1);
|
|
30
|
+
|
|
31
|
+
// src/ui/JsonTree.tsx
|
|
32
|
+
var import_react = __toESM(require_react(), 1);
|
|
33
|
+
import { spawn as spawn2 } from "child_process";
|
|
34
|
+
|
|
35
|
+
// src/ui/copy-behaviors/handlers.ts
|
|
36
|
+
var defaultCopyHandler = {
|
|
37
|
+
async copy(ctx) {
|
|
38
|
+
try {
|
|
39
|
+
await copyJson(ctx.value);
|
|
40
|
+
const preview = typeof ctx.value === "string" ? `"${ctx.value.slice(0, 50)}${ctx.value.length > 50 ? "..." : ""}"` : JSON.stringify(ctx.value).slice(0, 50);
|
|
41
|
+
return { success: true, message: `Copied: ${preview}` };
|
|
42
|
+
} catch (error) {
|
|
43
|
+
return { success: false, message: `Copy failed: ${error}` };
|
|
44
|
+
}
|
|
45
|
+
},
|
|
46
|
+
async copyExtended(ctx) {
|
|
47
|
+
try {
|
|
48
|
+
const obj = { [ctx.key]: ctx.value };
|
|
49
|
+
await copyJson(obj);
|
|
50
|
+
return { success: true, message: `Copied: { ${ctx.key}: ... }` };
|
|
51
|
+
} catch (error) {
|
|
52
|
+
return { success: false, message: `Copy failed: ${error}` };
|
|
53
|
+
}
|
|
54
|
+
}
|
|
55
|
+
};
|
|
56
|
+
var imageUrlCopyHandler = {
|
|
57
|
+
async copy(ctx) {
|
|
58
|
+
try {
|
|
59
|
+
if (typeof ctx.value !== "string") {
|
|
60
|
+
return { success: false, message: "Value is not a URL string" };
|
|
61
|
+
}
|
|
62
|
+
await copyText(ctx.value);
|
|
63
|
+
return { success: true, message: `Copied URL: ${ctx.value.slice(0, 60)}...` };
|
|
64
|
+
} catch (error) {
|
|
65
|
+
return { success: false, message: `Copy failed: ${error}` };
|
|
66
|
+
}
|
|
67
|
+
},
|
|
68
|
+
async copyExtended(ctx) {
|
|
69
|
+
try {
|
|
70
|
+
if (typeof ctx.value !== "string") {
|
|
71
|
+
return { success: false, message: "Value is not a URL string" };
|
|
72
|
+
}
|
|
73
|
+
ctx.onProgress?.("\uD83D\uDCF7 Downloading image...");
|
|
74
|
+
await downloadAndCopyImage(ctx.value);
|
|
75
|
+
return { success: true, message: "\uD83D\uDCF7 Image copied to clipboard!" };
|
|
76
|
+
} catch (error) {
|
|
77
|
+
return { success: false, message: `Image copy failed: ${error}` };
|
|
78
|
+
}
|
|
79
|
+
}
|
|
80
|
+
};
|
|
81
|
+
var htmlCodeCopyHandler = {
|
|
82
|
+
async copy(ctx) {
|
|
83
|
+
try {
|
|
84
|
+
if (typeof ctx.value !== "string") {
|
|
85
|
+
return { success: false, message: "Value is not a URL string" };
|
|
86
|
+
}
|
|
87
|
+
await copyText(ctx.value);
|
|
88
|
+
return { success: true, message: `Copied URL: ${ctx.value.slice(0, 60)}...` };
|
|
89
|
+
} catch (error) {
|
|
90
|
+
return { success: false, message: `Copy failed: ${error}` };
|
|
91
|
+
}
|
|
92
|
+
},
|
|
93
|
+
async copyExtended(ctx) {
|
|
94
|
+
try {
|
|
95
|
+
if (typeof ctx.value !== "string") {
|
|
96
|
+
return { success: false, message: "Value is not a URL string" };
|
|
97
|
+
}
|
|
98
|
+
ctx.onProgress?.("\uD83D\uDCDD Downloading HTML code...");
|
|
99
|
+
await downloadAndCopyText(ctx.value);
|
|
100
|
+
return { success: true, message: "\uD83D\uDCDD HTML code copied to clipboard!" };
|
|
101
|
+
} catch (error) {
|
|
102
|
+
return { success: false, message: `HTML copy failed: ${error}` };
|
|
103
|
+
}
|
|
104
|
+
}
|
|
105
|
+
};
|
|
106
|
+
|
|
107
|
+
// src/ui/copy-behaviors/registry.ts
|
|
108
|
+
var registrations = [];
|
|
109
|
+
function registerHandler(matcher, handler) {
|
|
110
|
+
registrations.push({ matcher, handler });
|
|
111
|
+
}
|
|
112
|
+
function getHandler(path) {
|
|
113
|
+
for (let i = registrations.length - 1;i >= 0; i--) {
|
|
114
|
+
const registration = registrations[i];
|
|
115
|
+
if (registration && registration.matcher(path)) {
|
|
116
|
+
return registration.handler;
|
|
117
|
+
}
|
|
118
|
+
}
|
|
119
|
+
return defaultCopyHandler;
|
|
120
|
+
}
|
|
121
|
+
function endsWith(suffix) {
|
|
122
|
+
return (path) => path.endsWith(suffix);
|
|
123
|
+
}
|
|
124
|
+
registerHandler(endsWith(".thumbnailScreenshot.downloadUrl"), imageUrlCopyHandler);
|
|
125
|
+
registerHandler(endsWith(".screenshot.downloadUrl"), imageUrlCopyHandler);
|
|
126
|
+
registerHandler(endsWith(".htmlCode.downloadUrl"), htmlCodeCopyHandler);
|
|
127
|
+
|
|
128
|
+
// src/ui/navigation-behaviors/handler.ts
|
|
129
|
+
function screenInstanceNavigationHandler(ctx) {
|
|
130
|
+
if (!ctx.path.includes("screenInstances")) {
|
|
131
|
+
return { shouldNavigate: false };
|
|
132
|
+
}
|
|
133
|
+
if (ctx.value && typeof ctx.value === "object" && ctx.value.sourceScreen) {
|
|
134
|
+
return {
|
|
135
|
+
shouldNavigate: true,
|
|
136
|
+
target: ctx.value.sourceScreen,
|
|
137
|
+
type: "screen"
|
|
138
|
+
};
|
|
139
|
+
}
|
|
140
|
+
if (ctx.key === "sourceScreen" && typeof ctx.value === "string") {
|
|
141
|
+
return {
|
|
142
|
+
shouldNavigate: true,
|
|
143
|
+
target: ctx.value,
|
|
144
|
+
type: "screen"
|
|
145
|
+
};
|
|
146
|
+
}
|
|
147
|
+
return { shouldNavigate: false };
|
|
148
|
+
}
|
|
149
|
+
var navigationHandlers = [
|
|
150
|
+
screenInstanceNavigationHandler
|
|
151
|
+
];
|
|
152
|
+
function getNavigationTarget(ctx) {
|
|
153
|
+
for (const handler of navigationHandlers) {
|
|
154
|
+
const result = handler(ctx);
|
|
155
|
+
if (result.shouldNavigate) {
|
|
156
|
+
return result;
|
|
157
|
+
}
|
|
158
|
+
}
|
|
159
|
+
return { shouldNavigate: false };
|
|
160
|
+
}
|
|
161
|
+
|
|
162
|
+
// src/ui/serve-behaviors/server.ts
|
|
163
|
+
import { createServer } from "node:http";
|
|
164
|
+
import { spawn } from "node:child_process";
|
|
165
|
+
async function serveHtmlInMemory(html, options) {
|
|
166
|
+
const timeout = options?.timeout ?? 5 * 60 * 1000;
|
|
167
|
+
const openBrowser = options?.openBrowser ?? true;
|
|
168
|
+
return new Promise((resolve, reject) => {
|
|
169
|
+
const server = createServer((req, res) => {
|
|
170
|
+
res.writeHead(200, {
|
|
171
|
+
"Content-Type": "text/html; charset=utf-8",
|
|
172
|
+
"Content-Security-Policy": "default-src 'self' 'unsafe-inline' 'unsafe-eval' data: https:;",
|
|
173
|
+
"X-Content-Type-Options": "nosniff",
|
|
174
|
+
"Referrer-Policy": "no-referrer"
|
|
175
|
+
});
|
|
176
|
+
res.end(html);
|
|
177
|
+
});
|
|
178
|
+
server.listen(0, "127.0.0.1", () => {
|
|
179
|
+
const address = server.address();
|
|
180
|
+
if (!address || typeof address === "string") {
|
|
181
|
+
reject(new Error("Failed to get server address"));
|
|
182
|
+
return;
|
|
183
|
+
}
|
|
184
|
+
const url = `http://127.0.0.1:${address.port}`;
|
|
185
|
+
const timer = setTimeout(() => server.close(), timeout);
|
|
186
|
+
const stop = () => {
|
|
187
|
+
clearTimeout(timer);
|
|
188
|
+
server.close();
|
|
189
|
+
};
|
|
190
|
+
if (openBrowser) {
|
|
191
|
+
const cmd = process.platform === "darwin" ? "open" : process.platform === "win32" ? "cmd" : "xdg-open";
|
|
192
|
+
const args = process.platform === "win32" ? ["/c", "start", url] : [url];
|
|
193
|
+
spawn(cmd, args, { detached: true, stdio: "ignore" }).unref();
|
|
194
|
+
}
|
|
195
|
+
resolve({ url, stop });
|
|
196
|
+
});
|
|
197
|
+
server.on("error", reject);
|
|
198
|
+
});
|
|
199
|
+
}
|
|
200
|
+
|
|
201
|
+
// src/ui/serve-behaviors/handlers.ts
|
|
202
|
+
var deps = {
|
|
203
|
+
serveHtmlInMemory
|
|
204
|
+
};
|
|
205
|
+
var htmlCodeServeHandler = {
|
|
206
|
+
async serve(ctx) {
|
|
207
|
+
try {
|
|
208
|
+
let url;
|
|
209
|
+
if (typeof ctx.value === "string") {
|
|
210
|
+
url = ctx.value;
|
|
211
|
+
} else if (typeof ctx.value === "object" && ctx.value?.downloadUrl) {
|
|
212
|
+
url = ctx.value.downloadUrl;
|
|
213
|
+
} else {
|
|
214
|
+
return { success: false, message: "No download URL found" };
|
|
215
|
+
}
|
|
216
|
+
ctx.onProgress?.("\uD83D\uDCE5 Downloading HTML...");
|
|
217
|
+
const response = await fetch(url);
|
|
218
|
+
if (!response.ok) {
|
|
219
|
+
return { success: false, message: `Download failed: ${response.status} ${response.statusText}` };
|
|
220
|
+
}
|
|
221
|
+
const html = await response.text();
|
|
222
|
+
ctx.onProgress?.("\uD83D\uDE80 Starting local server...");
|
|
223
|
+
const { url: serveUrl } = await deps.serveHtmlInMemory(html);
|
|
224
|
+
ctx.onProgress?.("\uD83C\uDF10 Opening browser...");
|
|
225
|
+
return { success: true, message: `\uD83C\uDF10 Preview at ${serveUrl} (auto-closes in 5 min)`, url: serveUrl };
|
|
226
|
+
} catch (error) {
|
|
227
|
+
return { success: false, message: `Serve failed: ${error instanceof Error ? error.message : String(error)}` };
|
|
228
|
+
}
|
|
229
|
+
}
|
|
230
|
+
};
|
|
231
|
+
|
|
232
|
+
// src/ui/serve-behaviors/registry.ts
|
|
233
|
+
var registrations2 = [];
|
|
234
|
+
function registerServeHandler(matcher, handler) {
|
|
235
|
+
registrations2.push({ matcher, handler });
|
|
236
|
+
}
|
|
237
|
+
function getServeHandler(path) {
|
|
238
|
+
for (let i = registrations2.length - 1;i >= 0; i--) {
|
|
239
|
+
const reg = registrations2[i];
|
|
240
|
+
if (reg && reg.matcher(path))
|
|
241
|
+
return reg.handler;
|
|
242
|
+
}
|
|
243
|
+
return null;
|
|
244
|
+
}
|
|
245
|
+
function endsWith2(suffix) {
|
|
246
|
+
return (path) => path.endsWith(suffix);
|
|
247
|
+
}
|
|
248
|
+
registerServeHandler(endsWith2(".htmlCode"), htmlCodeServeHandler);
|
|
249
|
+
registerServeHandler(endsWith2(".htmlCode.downloadUrl"), htmlCodeServeHandler);
|
|
250
|
+
|
|
251
|
+
// src/ui/JsonTree.tsx
|
|
252
|
+
var jsx_dev_runtime = __toESM(require_jsx_dev_runtime(), 1);
|
|
253
|
+
function getType(value) {
|
|
254
|
+
if (value === null)
|
|
255
|
+
return "null";
|
|
256
|
+
if (Array.isArray(value))
|
|
257
|
+
return "array";
|
|
258
|
+
return typeof value;
|
|
259
|
+
}
|
|
260
|
+
function buildVisibleTree(data, expandedIds, prefix = "", depth = 0, rootLabel) {
|
|
261
|
+
const nodes = [];
|
|
262
|
+
const type = getType(data);
|
|
263
|
+
if (rootLabel && prefix === "" && depth === 0) {
|
|
264
|
+
const isExpanded = expandedIds.has(rootLabel);
|
|
265
|
+
nodes.push({
|
|
266
|
+
id: rootLabel,
|
|
267
|
+
key: rootLabel,
|
|
268
|
+
value: data,
|
|
269
|
+
depth: 0,
|
|
270
|
+
isLeaf: false,
|
|
271
|
+
isExpanded,
|
|
272
|
+
hasChildren: true
|
|
273
|
+
});
|
|
274
|
+
if (isExpanded) {
|
|
275
|
+
nodes.push(...buildVisibleTree(data, expandedIds, rootLabel, 1));
|
|
276
|
+
}
|
|
277
|
+
return nodes;
|
|
278
|
+
}
|
|
279
|
+
if (type === "object" || type === "array") {
|
|
280
|
+
const keys = Object.keys(data);
|
|
281
|
+
for (const key of keys) {
|
|
282
|
+
const value = data[key];
|
|
283
|
+
const id = prefix ? `${prefix}.${key}` : key;
|
|
284
|
+
const valueType = getType(value);
|
|
285
|
+
const isLeaf = valueType !== "object" && valueType !== "array";
|
|
286
|
+
const hasChildren = !isLeaf && Object.keys(value).length > 0;
|
|
287
|
+
const isExpanded = expandedIds.has(id);
|
|
288
|
+
nodes.push({
|
|
289
|
+
id,
|
|
290
|
+
key,
|
|
291
|
+
value,
|
|
292
|
+
depth,
|
|
293
|
+
isLeaf,
|
|
294
|
+
isExpanded,
|
|
295
|
+
hasChildren
|
|
296
|
+
});
|
|
297
|
+
if (hasChildren && isExpanded) {
|
|
298
|
+
nodes.push(...buildVisibleTree(value, expandedIds, id, depth + 1));
|
|
299
|
+
}
|
|
300
|
+
}
|
|
301
|
+
}
|
|
302
|
+
return nodes;
|
|
303
|
+
}
|
|
304
|
+
var JsonTree = ({ data, rootLabel, onNavigate, onBack }) => {
|
|
305
|
+
const [expandedIds, setExpandedIds] = import_react.useState(() => {
|
|
306
|
+
const ids = new Set;
|
|
307
|
+
if (rootLabel) {
|
|
308
|
+
ids.add(rootLabel);
|
|
309
|
+
} else if (data && typeof data === "object") {
|
|
310
|
+
Object.keys(data).forEach((key) => ids.add(key));
|
|
311
|
+
}
|
|
312
|
+
return ids;
|
|
313
|
+
});
|
|
314
|
+
const [selectedIndex, setSelectedIndex] = import_react.useState(0);
|
|
315
|
+
const [feedbackMessage, setFeedbackMessage] = import_react.useState(null);
|
|
316
|
+
const lastCPressTime = import_react.useRef(0);
|
|
317
|
+
const feedbackTimeout = import_react.useRef(null);
|
|
318
|
+
const visibleNodes = import_react.useMemo(() => {
|
|
319
|
+
return buildVisibleTree(data, expandedIds, "", 0, rootLabel);
|
|
320
|
+
}, [data, expandedIds, rootLabel]);
|
|
321
|
+
const { exit } = use_app_default();
|
|
322
|
+
use_input_default((input, key) => {
|
|
323
|
+
if (input === "q") {
|
|
324
|
+
exit();
|
|
325
|
+
}
|
|
326
|
+
if (input === "c") {
|
|
327
|
+
const node = visibleNodes[selectedIndex];
|
|
328
|
+
if (!node)
|
|
329
|
+
return;
|
|
330
|
+
const now = Date.now();
|
|
331
|
+
const timeSinceLastC = now - lastCPressTime.current;
|
|
332
|
+
lastCPressTime.current = now;
|
|
333
|
+
const isDoubleTap = timeSinceLastC < 300;
|
|
334
|
+
const handler = getHandler(node.id);
|
|
335
|
+
const onProgress = (message) => {
|
|
336
|
+
if (feedbackTimeout.current)
|
|
337
|
+
clearTimeout(feedbackTimeout.current);
|
|
338
|
+
setFeedbackMessage(message);
|
|
339
|
+
};
|
|
340
|
+
const ctx = { key: node.key, value: node.value, path: node.id, onProgress };
|
|
341
|
+
const showFeedback = (result) => {
|
|
342
|
+
if (feedbackTimeout.current)
|
|
343
|
+
clearTimeout(feedbackTimeout.current);
|
|
344
|
+
setFeedbackMessage(result.message);
|
|
345
|
+
feedbackTimeout.current = setTimeout(() => setFeedbackMessage(null), 3000);
|
|
346
|
+
};
|
|
347
|
+
if (isDoubleTap) {
|
|
348
|
+
handler.copyExtended(ctx).then(showFeedback);
|
|
349
|
+
} else {
|
|
350
|
+
setTimeout(() => {
|
|
351
|
+
if (Date.now() - lastCPressTime.current >= 280) {
|
|
352
|
+
handler.copy(ctx).then(showFeedback);
|
|
353
|
+
}
|
|
354
|
+
}, 300);
|
|
355
|
+
}
|
|
356
|
+
return;
|
|
357
|
+
}
|
|
358
|
+
if (input === "s") {
|
|
359
|
+
const node = visibleNodes[selectedIndex];
|
|
360
|
+
if (!node)
|
|
361
|
+
return;
|
|
362
|
+
const handler = getServeHandler(node.id);
|
|
363
|
+
if (!handler) {
|
|
364
|
+
if (feedbackTimeout.current)
|
|
365
|
+
clearTimeout(feedbackTimeout.current);
|
|
366
|
+
setFeedbackMessage("⚠️ No preview available for this path");
|
|
367
|
+
feedbackTimeout.current = setTimeout(() => setFeedbackMessage(null), 3000);
|
|
368
|
+
return;
|
|
369
|
+
}
|
|
370
|
+
const onProgress = (message) => {
|
|
371
|
+
if (feedbackTimeout.current)
|
|
372
|
+
clearTimeout(feedbackTimeout.current);
|
|
373
|
+
setFeedbackMessage(message);
|
|
374
|
+
};
|
|
375
|
+
const ctx = { key: node.key, value: node.value, path: node.id, onProgress };
|
|
376
|
+
handler.serve(ctx).then((result) => {
|
|
377
|
+
if (feedbackTimeout.current)
|
|
378
|
+
clearTimeout(feedbackTimeout.current);
|
|
379
|
+
setFeedbackMessage(result.message);
|
|
380
|
+
feedbackTimeout.current = setTimeout(() => setFeedbackMessage(null), 1e4);
|
|
381
|
+
});
|
|
382
|
+
return;
|
|
383
|
+
}
|
|
384
|
+
if (input === "o") {
|
|
385
|
+
const node = visibleNodes[selectedIndex];
|
|
386
|
+
if (!node)
|
|
387
|
+
return;
|
|
388
|
+
let projectId;
|
|
389
|
+
const projectsMatch = node.id.match(/projects\.(\d+)/);
|
|
390
|
+
if (projectsMatch && projectsMatch[1]) {
|
|
391
|
+
const projectIndex = parseInt(projectsMatch[1], 10);
|
|
392
|
+
const project = data.projects?.[projectIndex];
|
|
393
|
+
if (project?.name) {
|
|
394
|
+
projectId = project.name.replace("projects/", "");
|
|
395
|
+
}
|
|
396
|
+
}
|
|
397
|
+
if (!projectId && typeof node.value === "object" && node.value?.name) {
|
|
398
|
+
const nameMatch = node.value.name.match(/projects\/(\d+)/);
|
|
399
|
+
if (nameMatch) {
|
|
400
|
+
projectId = nameMatch[1];
|
|
401
|
+
}
|
|
402
|
+
}
|
|
403
|
+
if (!projectId && node.key === "name" && typeof node.value === "string") {
|
|
404
|
+
const nameMatch = node.value.match(/projects\/(\d+)/);
|
|
405
|
+
if (nameMatch) {
|
|
406
|
+
projectId = nameMatch[1];
|
|
407
|
+
}
|
|
408
|
+
}
|
|
409
|
+
if (!projectId && (rootLabel === "screen" || rootLabel === "resource")) {
|
|
410
|
+
const nameMatch = data.name?.match(/projects\/(\d+)/);
|
|
411
|
+
if (nameMatch) {
|
|
412
|
+
projectId = nameMatch[1];
|
|
413
|
+
}
|
|
414
|
+
}
|
|
415
|
+
if (projectId) {
|
|
416
|
+
const url = `https://stitch.withgoogle.com/projects/${projectId}`;
|
|
417
|
+
const openCmd = process.platform === "darwin" ? "open" : process.platform === "win32" ? "start" : "xdg-open";
|
|
418
|
+
spawn2(openCmd, [url], { stdio: "ignore", detached: true }).unref();
|
|
419
|
+
if (feedbackTimeout.current)
|
|
420
|
+
clearTimeout(feedbackTimeout.current);
|
|
421
|
+
setFeedbackMessage(`\uD83D\uDD17 Opened project in browser`);
|
|
422
|
+
feedbackTimeout.current = setTimeout(() => setFeedbackMessage(null), 3000);
|
|
423
|
+
} else {
|
|
424
|
+
if (feedbackTimeout.current)
|
|
425
|
+
clearTimeout(feedbackTimeout.current);
|
|
426
|
+
setFeedbackMessage(`⚠️ No project found at this path`);
|
|
427
|
+
feedbackTimeout.current = setTimeout(() => setFeedbackMessage(null), 3000);
|
|
428
|
+
}
|
|
429
|
+
return;
|
|
430
|
+
}
|
|
431
|
+
if (key.upArrow) {
|
|
432
|
+
setSelectedIndex(Math.max(0, selectedIndex - 1));
|
|
433
|
+
}
|
|
434
|
+
if (key.downArrow) {
|
|
435
|
+
setSelectedIndex(Math.min(visibleNodes.length - 1, selectedIndex + 1));
|
|
436
|
+
}
|
|
437
|
+
if (key.rightArrow || key.return) {
|
|
438
|
+
const node = visibleNodes[selectedIndex];
|
|
439
|
+
if (node && node.hasChildren) {
|
|
440
|
+
if (!node.isExpanded) {
|
|
441
|
+
const newExpanded = new Set(expandedIds);
|
|
442
|
+
newExpanded.add(node.id);
|
|
443
|
+
setExpandedIds(newExpanded);
|
|
444
|
+
}
|
|
445
|
+
}
|
|
446
|
+
if (key.return && node && onNavigate) {
|
|
447
|
+
const navResult = getNavigationTarget({ path: node.id, value: node.value, key: node.key });
|
|
448
|
+
if (navResult.shouldNavigate) {
|
|
449
|
+
onNavigate(navResult);
|
|
450
|
+
return;
|
|
451
|
+
}
|
|
452
|
+
}
|
|
453
|
+
}
|
|
454
|
+
if ((key.delete || key.backspace) && onBack) {
|
|
455
|
+
onBack();
|
|
456
|
+
return;
|
|
457
|
+
}
|
|
458
|
+
if (key.leftArrow) {
|
|
459
|
+
const node = visibleNodes[selectedIndex];
|
|
460
|
+
if (node) {
|
|
461
|
+
if (node.isExpanded) {
|
|
462
|
+
const newExpanded = new Set(expandedIds);
|
|
463
|
+
newExpanded.delete(node.id);
|
|
464
|
+
setExpandedIds(newExpanded);
|
|
465
|
+
} else {
|
|
466
|
+
const lastDot = node.id.lastIndexOf(".");
|
|
467
|
+
if (lastDot !== -1) {
|
|
468
|
+
const parentId = node.id.substring(0, lastDot);
|
|
469
|
+
const parentIndex = visibleNodes.findIndex((n) => n.id === parentId);
|
|
470
|
+
if (parentIndex !== -1) {
|
|
471
|
+
setSelectedIndex(parentIndex);
|
|
472
|
+
}
|
|
473
|
+
} else {}
|
|
474
|
+
}
|
|
475
|
+
}
|
|
476
|
+
}
|
|
477
|
+
});
|
|
478
|
+
const viewportHeight = 20;
|
|
479
|
+
const startRow = Math.max(0, Math.min(selectedIndex - 2, visibleNodes.length - viewportHeight));
|
|
480
|
+
const endRow = Math.min(startRow + viewportHeight, visibleNodes.length);
|
|
481
|
+
const viewportNodes = visibleNodes.slice(startRow, endRow);
|
|
482
|
+
if (!data || typeof data !== "object") {
|
|
483
|
+
return /* @__PURE__ */ jsx_dev_runtime.jsxDEV(Text, {
|
|
484
|
+
children: [
|
|
485
|
+
"Invalid data: ",
|
|
486
|
+
String(data)
|
|
487
|
+
]
|
|
488
|
+
}, undefined, true, undefined, this);
|
|
489
|
+
}
|
|
490
|
+
if (Object.keys(data).length === 0) {
|
|
491
|
+
return /* @__PURE__ */ jsx_dev_runtime.jsxDEV(Text, {
|
|
492
|
+
children: "Empty object"
|
|
493
|
+
}, undefined, false, undefined, this);
|
|
494
|
+
}
|
|
495
|
+
return /* @__PURE__ */ jsx_dev_runtime.jsxDEV(Box_default, {
|
|
496
|
+
flexDirection: "column",
|
|
497
|
+
children: [
|
|
498
|
+
/* @__PURE__ */ jsx_dev_runtime.jsxDEV(Text, {
|
|
499
|
+
color: "blue",
|
|
500
|
+
bold: true,
|
|
501
|
+
children: "JSON Viewer (Use Arrows to Navigate, 'q' to Quit)"
|
|
502
|
+
}, undefined, false, undefined, this),
|
|
503
|
+
/* @__PURE__ */ jsx_dev_runtime.jsxDEV(Box_default, {
|
|
504
|
+
flexDirection: "column",
|
|
505
|
+
borderStyle: "single",
|
|
506
|
+
children: [
|
|
507
|
+
viewportNodes.map((node, index) => {
|
|
508
|
+
const absoluteIndex = startRow + index;
|
|
509
|
+
const isSelected = absoluteIndex === selectedIndex;
|
|
510
|
+
const indentation = " ".repeat(node.depth);
|
|
511
|
+
let prefixChar = " ";
|
|
512
|
+
if (node.hasChildren) {
|
|
513
|
+
prefixChar = node.isExpanded ? "▼" : "▶";
|
|
514
|
+
}
|
|
515
|
+
let valueDisplay = "";
|
|
516
|
+
if (node.isLeaf) {
|
|
517
|
+
const valType = getType(node.value);
|
|
518
|
+
if (valType === "string")
|
|
519
|
+
valueDisplay = `"${node.value}"`;
|
|
520
|
+
else
|
|
521
|
+
valueDisplay = String(node.value);
|
|
522
|
+
} else {
|
|
523
|
+
const type = Array.isArray(node.value) ? "[]" : "{}";
|
|
524
|
+
const itemCount = Object.keys(node.value).length;
|
|
525
|
+
const label = node.value.title || node.value.name || node.value.displayName || node.value.id || null;
|
|
526
|
+
if (label && typeof label === "string") {
|
|
527
|
+
valueDisplay = `${type} "${label}" (${itemCount})`;
|
|
528
|
+
} else {
|
|
529
|
+
valueDisplay = `${type} ${itemCount} items`;
|
|
530
|
+
}
|
|
531
|
+
}
|
|
532
|
+
return /* @__PURE__ */ jsx_dev_runtime.jsxDEV(Box_default, {
|
|
533
|
+
children: /* @__PURE__ */ jsx_dev_runtime.jsxDEV(Text, {
|
|
534
|
+
backgroundColor: isSelected ? "blue" : undefined,
|
|
535
|
+
color: isSelected ? "white" : undefined,
|
|
536
|
+
wrap: "truncate",
|
|
537
|
+
children: [
|
|
538
|
+
indentation,
|
|
539
|
+
/* @__PURE__ */ jsx_dev_runtime.jsxDEV(Text, {
|
|
540
|
+
color: "green",
|
|
541
|
+
children: [
|
|
542
|
+
prefixChar,
|
|
543
|
+
" ",
|
|
544
|
+
node.key
|
|
545
|
+
]
|
|
546
|
+
}, undefined, true, undefined, this),
|
|
547
|
+
/* @__PURE__ */ jsx_dev_runtime.jsxDEV(Text, {
|
|
548
|
+
children: ": "
|
|
549
|
+
}, undefined, false, undefined, this),
|
|
550
|
+
/* @__PURE__ */ jsx_dev_runtime.jsxDEV(Text, {
|
|
551
|
+
color: "yellow",
|
|
552
|
+
children: valueDisplay
|
|
553
|
+
}, undefined, false, undefined, this)
|
|
554
|
+
]
|
|
555
|
+
}, undefined, true, undefined, this)
|
|
556
|
+
}, node.id, false, undefined, this);
|
|
557
|
+
}),
|
|
558
|
+
visibleNodes.length > viewportHeight && /* @__PURE__ */ jsx_dev_runtime.jsxDEV(Text, {
|
|
559
|
+
color: "gray",
|
|
560
|
+
children: [
|
|
561
|
+
"... ",
|
|
562
|
+
visibleNodes.length - endRow,
|
|
563
|
+
" more items ..."
|
|
564
|
+
]
|
|
565
|
+
}, undefined, true, undefined, this)
|
|
566
|
+
]
|
|
567
|
+
}, undefined, true, undefined, this),
|
|
568
|
+
/* @__PURE__ */ jsx_dev_runtime.jsxDEV(Text, {
|
|
569
|
+
color: "gray",
|
|
570
|
+
children: [
|
|
571
|
+
"Selected Path: ",
|
|
572
|
+
visibleNodes[selectedIndex]?.id || "none",
|
|
573
|
+
" | 'c' copy, 'cc' extended, 's' preview"
|
|
574
|
+
]
|
|
575
|
+
}, undefined, true, undefined, this),
|
|
576
|
+
feedbackMessage && /* @__PURE__ */ jsx_dev_runtime.jsxDEV(Text, {
|
|
577
|
+
color: "cyan",
|
|
578
|
+
bold: true,
|
|
579
|
+
children: feedbackMessage
|
|
580
|
+
}, undefined, false, undefined, this)
|
|
581
|
+
]
|
|
582
|
+
}, undefined, true, undefined, this);
|
|
583
|
+
};
|
|
584
|
+
|
|
585
|
+
// src/ui/InteractiveViewer.tsx
|
|
586
|
+
var jsx_dev_runtime2 = __toESM(require_jsx_dev_runtime(), 1);
|
|
587
|
+
var InteractiveViewer = ({
|
|
588
|
+
initialData,
|
|
589
|
+
initialRootLabel,
|
|
590
|
+
initialHistory,
|
|
591
|
+
onFetch,
|
|
592
|
+
onExit
|
|
593
|
+
}) => {
|
|
594
|
+
const [history, setHistory] = import_react2.useState(() => {
|
|
595
|
+
if (initialHistory && initialHistory.length > 0) {
|
|
596
|
+
return [...initialHistory, { data: initialData, rootLabel: initialRootLabel }];
|
|
597
|
+
}
|
|
598
|
+
return [{ data: initialData, rootLabel: initialRootLabel }];
|
|
599
|
+
});
|
|
600
|
+
const [isLoading, setIsLoading] = import_react2.useState(false);
|
|
601
|
+
const [error, setError] = import_react2.useState(null);
|
|
602
|
+
const currentState = history[history.length - 1];
|
|
603
|
+
const handleNavigate = import_react2.useCallback(async (result) => {
|
|
604
|
+
if (!result.target)
|
|
605
|
+
return;
|
|
606
|
+
setIsLoading(true);
|
|
607
|
+
setError(null);
|
|
608
|
+
try {
|
|
609
|
+
const data = await onFetch(result.target);
|
|
610
|
+
let rootLabel;
|
|
611
|
+
if (result.type === "screen") {
|
|
612
|
+
rootLabel = "screen";
|
|
613
|
+
} else if (result.type === "project") {
|
|
614
|
+
rootLabel = "project";
|
|
615
|
+
} else {
|
|
616
|
+
rootLabel = "resource";
|
|
617
|
+
}
|
|
618
|
+
setHistory((prev) => [...prev, { data, rootLabel, resourcePath: result.target }]);
|
|
619
|
+
} catch (err) {
|
|
620
|
+
setError(`Navigation failed: ${err}`);
|
|
621
|
+
} finally {
|
|
622
|
+
setIsLoading(false);
|
|
623
|
+
}
|
|
624
|
+
}, [onFetch]);
|
|
625
|
+
const handleBack = import_react2.useCallback(() => {
|
|
626
|
+
if (history.length > 1) {
|
|
627
|
+
setHistory((prev) => prev.slice(0, -1));
|
|
628
|
+
setError(null);
|
|
629
|
+
}
|
|
630
|
+
}, [history.length]);
|
|
631
|
+
if (isLoading) {
|
|
632
|
+
return /* @__PURE__ */ jsx_dev_runtime2.jsxDEV(Box_default, {
|
|
633
|
+
flexDirection: "column",
|
|
634
|
+
children: /* @__PURE__ */ jsx_dev_runtime2.jsxDEV(Text, {
|
|
635
|
+
color: "blue",
|
|
636
|
+
children: "Loading..."
|
|
637
|
+
}, undefined, false, undefined, this)
|
|
638
|
+
}, undefined, false, undefined, this);
|
|
639
|
+
}
|
|
640
|
+
if (!currentState) {
|
|
641
|
+
return /* @__PURE__ */ jsx_dev_runtime2.jsxDEV(Text, {
|
|
642
|
+
color: "red",
|
|
643
|
+
children: "No data to display"
|
|
644
|
+
}, undefined, false, undefined, this);
|
|
645
|
+
}
|
|
646
|
+
return /* @__PURE__ */ jsx_dev_runtime2.jsxDEV(Box_default, {
|
|
647
|
+
flexDirection: "column",
|
|
648
|
+
children: [
|
|
649
|
+
history.length > 1 && /* @__PURE__ */ jsx_dev_runtime2.jsxDEV(Text, {
|
|
650
|
+
color: "gray",
|
|
651
|
+
dimColor: true,
|
|
652
|
+
children: [
|
|
653
|
+
"← Press Backspace to go back (",
|
|
654
|
+
history.length - 1,
|
|
655
|
+
" level",
|
|
656
|
+
history.length > 2 ? "s" : "",
|
|
657
|
+
" deep)"
|
|
658
|
+
]
|
|
659
|
+
}, undefined, true, undefined, this),
|
|
660
|
+
error && /* @__PURE__ */ jsx_dev_runtime2.jsxDEV(Text, {
|
|
661
|
+
color: "red",
|
|
662
|
+
children: error
|
|
663
|
+
}, undefined, false, undefined, this),
|
|
664
|
+
/* @__PURE__ */ jsx_dev_runtime2.jsxDEV(JsonTree, {
|
|
665
|
+
data: currentState.data,
|
|
666
|
+
rootLabel: currentState.rootLabel,
|
|
667
|
+
onNavigate: handleNavigate,
|
|
668
|
+
onBack: history.length > 1 ? handleBack : undefined
|
|
669
|
+
}, history.length, false, undefined, this)
|
|
670
|
+
]
|
|
671
|
+
}, undefined, true, undefined, this);
|
|
672
|
+
};
|
|
673
|
+
export {
|
|
674
|
+
InteractiveViewer
|
|
675
|
+
};
|
|
676
|
+
|
|
677
|
+
//# debugId=0B47EDFFF8DBA66964756E2164756E21
|