create-opentray 0.0.0 → 0.19.1
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/README.md +163 -0
- package/dist/assets/create-openspec-template-iOS-Dark-1024@1x.png +0 -0
- package/dist/assets/create-openspec-template-iOS-Default-1024@1x.png +0 -0
- package/dist/bin-B9VeXatR.mjs +3830 -0
- package/dist/bin-B9VeXatR.mjs.map +1 -0
- package/dist/bin-CeFW1wxR.d.mts +15 -0
- package/dist/bin-CeFW1wxR.d.mts.map +1 -0
- package/dist/bin.d.mts +2 -0
- package/dist/bin.mjs +3 -0
- package/dist/icon-codec-BQ3cGV1n.mjs +13 -0
- package/dist/icon-codec-BQ3cGV1n.mjs.map +1 -0
- package/dist/index.d.mts +557 -0
- package/dist/index.d.mts.map +1 -0
- package/dist/index.mjs +2 -0
- package/dist/shell/assets/__vite-browser-external-2447137e.js +1 -0
- package/dist/shell/assets/browse.js +1 -0
- package/dist/shell/assets/ghostty-web.js +13 -0
- package/dist/shell/assets/index.css +1 -0
- package/dist/shell/assets/index.js +9 -0
- package/dist/shell/assets/input.js +1 -0
- package/dist/shell/assets/main.js +43 -0
- package/dist/shell/assets/terminal-pane.js +2 -0
- package/dist/shell/assets/terminal.js +1 -0
- package/dist/shell/browse.html +15 -0
- package/dist/shell/ghostty-vt.wasm +0 -0
- package/dist/shell/index.html +15 -0
- package/dist/shell/terminal.html +15 -0
- package/dist/webui/assets/__vite-browser-external-2447137e.js +1 -0
- package/dist/webui/assets/browse.js +1 -0
- package/dist/webui/assets/ghostty-web.js +13 -0
- package/dist/webui/assets/index.css +1 -0
- package/dist/webui/assets/index.js +9 -0
- package/dist/webui/assets/input.js +1 -0
- package/dist/webui/assets/main.js +43 -0
- package/dist/webui/assets/terminal-pane.js +2 -0
- package/dist/webui/assets/terminal.js +1 -0
- package/dist/webui/browse.html +15 -0
- package/dist/webui/ghostty-vt.wasm +0 -0
- package/dist/webui/index.html +16 -0
- package/dist/webui/terminal.html +15 -0
- package/dist/webui/vendor/ghostty-vt.wasm +0 -0
- package/dist/webui/vendor/ghostty-web.js +2963 -0
- package/package.json +45 -5
- package/index.js +0 -1
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
//#region src/bin.d.ts
|
|
2
|
+
interface WizardCliOptions {
|
|
3
|
+
readonly open: boolean;
|
|
4
|
+
readonly port: number | undefined;
|
|
5
|
+
readonly pm: "npm" | "pnpm" | "bun" | undefined;
|
|
6
|
+
readonly skipInstall: boolean;
|
|
7
|
+
readonly force: boolean;
|
|
8
|
+
readonly targetDir: string | undefined;
|
|
9
|
+
}
|
|
10
|
+
declare const parseWizardCli: (argv: readonly string[]) => WizardCliOptions;
|
|
11
|
+
declare const openBrowser: (url: string) => Promise<void>;
|
|
12
|
+
declare const main: (argv: readonly string[]) => Promise<number>;
|
|
13
|
+
//#endregion
|
|
14
|
+
export { parseWizardCli as i, main as n, openBrowser as r, WizardCliOptions as t };
|
|
15
|
+
//# sourceMappingURL=bin-CeFW1wxR.d.mts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"bin-CeFW1wxR.d.mts","names":[],"sources":["../src/bin.ts"],"mappings":";UAkBiB,gBAAA;EAAA,SACN,IAAA;EAAA,SACA,IAAA;EAAA,SACA,EAAA;EAAA,SACA,WAAA;EAAA,SACA,KAAA;EAAA,SACA,SAAA;AAAA;AAAA,cAIE,cAAA,GAAkB,IAAA,wBAA0B,gBAmDxD;AAAA,cAgCY,WAAA,GAAqB,GAAA,aAAc,OAAO;AAAA,cAU1C,IAAA,GAAc,IAAA,wBAA0B,OAAO"}
|
package/dist/bin.d.mts
ADDED
package/dist/bin.mjs
ADDED
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
//#region src/icon-codec.ts
|
|
2
|
+
const toPngBuffer = async (rgba, width, height, channels) => {
|
|
3
|
+
const sharp = (await import("sharp")).default;
|
|
4
|
+
return sharp(rgba, { raw: {
|
|
5
|
+
width,
|
|
6
|
+
height,
|
|
7
|
+
channels
|
|
8
|
+
} }).png().toBuffer();
|
|
9
|
+
};
|
|
10
|
+
//#endregion
|
|
11
|
+
export { toPngBuffer };
|
|
12
|
+
|
|
13
|
+
//# sourceMappingURL=icon-codec-BQ3cGV1n.mjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"icon-codec-BQ3cGV1n.mjs","names":[],"sources":["../src/icon-codec.ts"],"sourcesContent":["// Thin image-encoding seam (raw pixels → PNG via sharp). Kept as its own\n// module so tests can stub encoding without stubbing all of sharp.\nexport const toPngBuffer = async (\n rgba: Buffer,\n width: number,\n height: number,\n channels: 3 | 4,\n): Promise<Buffer> => {\n const sharpModule = await import(\"sharp\");\n const sharp = sharpModule.default;\n return sharp(rgba, {\n raw: { width, height, channels },\n })\n .png()\n .toBuffer();\n};\n"],"mappings":";AAEA,MAAa,cAAc,OACzB,MACA,OACA,QACA,aACoB;CAEpB,MAAM,SAAQ,MADY,OAAO,SAAA,CACP;CAC1B,OAAO,MAAM,MAAM,EACjB,KAAK;EAAE;EAAO;EAAQ;CAAS,EACjC,CAAC,CAAC,CACC,IAAI,CAAC,CACL,SAAS;AACd"}
|
package/dist/index.d.mts
ADDED
|
@@ -0,0 +1,557 @@
|
|
|
1
|
+
import { i as parseWizardCli, n as main, t as WizardCliOptions } from "./bin-CeFW1wxR.mjs";
|
|
2
|
+
import { generateOpenTrayAppIcon } from "@opentray/vite-plugin";
|
|
3
|
+
import { IncomingMessage } from "node:http";
|
|
4
|
+
|
|
5
|
+
//#region src/port-scan.d.ts
|
|
6
|
+
interface DiscoveredService {
|
|
7
|
+
readonly port: number;
|
|
8
|
+
readonly url: string;
|
|
9
|
+
readonly firstSeenAt: number;
|
|
10
|
+
title?: string;
|
|
11
|
+
}
|
|
12
|
+
type ListenersRunner = (platform: NodeJS.Platform) => Promise<ReadonlySet<number>>;
|
|
13
|
+
/** Listener snapshot with process ownership: port -> owning PIDs. */
|
|
14
|
+
type ListenerOwners = ReadonlyMap<number, ReadonlySet<number>>;
|
|
15
|
+
/** Loopback service URL for a discovered port. */
|
|
16
|
+
declare const serviceUrl: (port: number) => string;
|
|
17
|
+
declare const parseLsofPorts: (stdout: string) => ReadonlySet<number>;
|
|
18
|
+
/** Parses `netstat -ano -p tcp` output; keeps LISTENING rows. */
|
|
19
|
+
declare const parseNetstatPorts: (stdout: string) => ReadonlySet<number>;
|
|
20
|
+
declare const parsePowerShellPorts: (stdout: string) => ReadonlySet<number>;
|
|
21
|
+
/** TCP-connect probe used by the generated app and discovery verification. */
|
|
22
|
+
declare const waitForTcpPort: (port: number, timeoutMs: number, intervalMs?: number, host?: string) => Promise<boolean>;
|
|
23
|
+
/** Verify a port answers with an HTTP response (any status counts). */
|
|
24
|
+
declare const verifyHttpService: (port: number, timeoutMs?: number) => Promise<boolean>;
|
|
25
|
+
interface PortDiscoveryOptions {
|
|
26
|
+
readonly platform?: NodeJS.Platform;
|
|
27
|
+
readonly baseline: ReadonlySet<number>;
|
|
28
|
+
readonly listListeners?: ListenersRunner;
|
|
29
|
+
readonly verifyHttp?: (port: number) => Promise<boolean>;
|
|
30
|
+
/** Resolves the PIDs whose listeners count as services (preview process tree). */
|
|
31
|
+
readonly resolveOwnerPids?: () => Promise<ReadonlySet<number>>;
|
|
32
|
+
readonly listOwners?: () => Promise<ListenerOwners>;
|
|
33
|
+
readonly intervalMs?: number;
|
|
34
|
+
}
|
|
35
|
+
interface PortDiscoverySession {
|
|
36
|
+
/** Known new services, first-seen order. */
|
|
37
|
+
services(): readonly DiscoveredService[];
|
|
38
|
+
/** One polling pass; resolves to services discovered during this pass. */
|
|
39
|
+
poll(): Promise<readonly DiscoveredService[]>;
|
|
40
|
+
stop(): void;
|
|
41
|
+
}
|
|
42
|
+
/**
|
|
43
|
+
* Diff-based port discovery. Each poll re-enumerates listeners, keeps ports
|
|
44
|
+
* absent from the baseline, and adds HTTP-verified ones in first-seen order.
|
|
45
|
+
*/
|
|
46
|
+
declare const createPortDiscovery: (options: PortDiscoveryOptions) => PortDiscoverySession;
|
|
47
|
+
//#endregion
|
|
48
|
+
//#region src/command-run.d.ts
|
|
49
|
+
interface CommandRunEvent {
|
|
50
|
+
readonly type: "stdout" | "stderr" | "exit" | "spawn-error" | "pty-ready" | "pty-unavailable";
|
|
51
|
+
/** The PTY binding's output chunk, verbatim; rendering is the frontend's job. */
|
|
52
|
+
readonly chunk?: string;
|
|
53
|
+
readonly code?: number | null;
|
|
54
|
+
readonly message?: string;
|
|
55
|
+
}
|
|
56
|
+
interface CommandRunTerminalSize {
|
|
57
|
+
readonly cols: number;
|
|
58
|
+
readonly rows: number;
|
|
59
|
+
}
|
|
60
|
+
interface CommandRunOptions {
|
|
61
|
+
readonly tokens: readonly string[];
|
|
62
|
+
readonly cwd?: string;
|
|
63
|
+
readonly env?: NodeJS.ProcessEnv;
|
|
64
|
+
readonly ringLimit?: number;
|
|
65
|
+
/** Attach through a PTY when available; defaults to true. */
|
|
66
|
+
readonly pty?: boolean;
|
|
67
|
+
readonly terminalSize?: CommandRunTerminalSize;
|
|
68
|
+
readonly onEvent: (event: CommandRunEvent) => void;
|
|
69
|
+
}
|
|
70
|
+
interface CommandRun {
|
|
71
|
+
readonly pid: number | undefined;
|
|
72
|
+
readonly pty: boolean;
|
|
73
|
+
readonly exited: Promise<{
|
|
74
|
+
code: number | null;
|
|
75
|
+
spawnError?: string;
|
|
76
|
+
}>;
|
|
77
|
+
readonly output: readonly string[];
|
|
78
|
+
/** Write terminal input bytes to the command's stdin (PTY mode only). */
|
|
79
|
+
write(data: string): void;
|
|
80
|
+
/** Resize the pseudo-terminal (PTY mode only). */
|
|
81
|
+
resize(size: CommandRunTerminalSize): void;
|
|
82
|
+
kill(): Promise<void>;
|
|
83
|
+
}
|
|
84
|
+
declare const startCommandRun: (options: CommandRunOptions) => Promise<CommandRun>;
|
|
85
|
+
//#endregion
|
|
86
|
+
//#region src/scrape.d.ts
|
|
87
|
+
/** Variant tag: the original art, or a solid-color silhouette derived from it. */
|
|
88
|
+
type IconVariant = "original" | "solid-black" | "solid-white";
|
|
89
|
+
/** One scraped icon candidate, ranked and deduplicated. */
|
|
90
|
+
interface ScrapedIcon {
|
|
91
|
+
/** Index within the candidate list (stable for /api/icon-data/:port/:index). */
|
|
92
|
+
readonly index: number;
|
|
93
|
+
/** Absolute URL the bytes came from (variants inherit their source URL). */
|
|
94
|
+
readonly url: string;
|
|
95
|
+
/** Absolute temp file holding the icon bytes. */
|
|
96
|
+
readonly path: string;
|
|
97
|
+
/** True pixel clarity (largest dimension; SVG uses intrinsic or 512). */
|
|
98
|
+
readonly width: number;
|
|
99
|
+
readonly height: number;
|
|
100
|
+
/** png | svg | jpeg | webp | gif | ico (ico payloads are extracted to png). */
|
|
101
|
+
readonly format: string;
|
|
102
|
+
/** Which art this entry carries (originals feed the app-icon picker; the
|
|
103
|
+
* advanced tray picker also shows solid variants). */
|
|
104
|
+
readonly variant: IconVariant;
|
|
105
|
+
/** Index of the original candidate a variant was derived from. */
|
|
106
|
+
readonly variantOf?: number;
|
|
107
|
+
}
|
|
108
|
+
interface ScrapeResult {
|
|
109
|
+
readonly ok: boolean;
|
|
110
|
+
readonly title: string | undefined;
|
|
111
|
+
/** Absolute temp file holding the chosen (clearest) favicon bytes, when found. */
|
|
112
|
+
readonly iconPath: string | undefined;
|
|
113
|
+
readonly iconUrl?: string;
|
|
114
|
+
/** All viable candidates ranked by clarity, near-duplicates removed. */
|
|
115
|
+
readonly icons: readonly ScrapedIcon[];
|
|
116
|
+
}
|
|
117
|
+
interface FaviconCandidate {
|
|
118
|
+
readonly href: string;
|
|
119
|
+
readonly rel: string;
|
|
120
|
+
readonly sizes?: string;
|
|
121
|
+
}
|
|
122
|
+
/** Extract `<title>` text from HTML. */
|
|
123
|
+
declare const extractTitle: (html: string) => string | undefined;
|
|
124
|
+
/** Extract `<link rel=... href=...>` favicon candidates from HTML head. */
|
|
125
|
+
declare const extractFaviconCandidates: (html: string) => readonly FaviconCandidate[];
|
|
126
|
+
/** Largest dimension of a `sizes` attribute value such as `32x32` or `any`. */
|
|
127
|
+
declare const faviconCandidateSize: (candidate: FaviconCandidate) => number;
|
|
128
|
+
/** Resolve a favicon href against the service origin. */
|
|
129
|
+
declare const resolveFaviconUrl: (href: string, origin: string) => string | undefined;
|
|
130
|
+
/** Order candidates: declared-size icons descending, then apple-touch-icon, then others. */
|
|
131
|
+
declare const rankFaviconCandidates: (candidates: readonly FaviconCandidate[]) => readonly FaviconCandidate[];
|
|
132
|
+
interface ScrapePage {
|
|
133
|
+
readonly ok: boolean;
|
|
134
|
+
readonly status: number;
|
|
135
|
+
readonly body: string;
|
|
136
|
+
readonly headers: Record<string, string>;
|
|
137
|
+
}
|
|
138
|
+
interface ScrapeBytes {
|
|
139
|
+
readonly ok: boolean;
|
|
140
|
+
readonly status: number;
|
|
141
|
+
readonly bytes: Buffer;
|
|
142
|
+
readonly contentType: string;
|
|
143
|
+
}
|
|
144
|
+
interface ScrapeFetch {
|
|
145
|
+
page(url: string, timeoutMs?: number): Promise<ScrapePage>;
|
|
146
|
+
bytes(url: string, timeoutMs?: number): Promise<ScrapeBytes>;
|
|
147
|
+
}
|
|
148
|
+
/**
|
|
149
|
+
* Scrape title and ALL icon candidates from a service port. Never throws:
|
|
150
|
+
* failures return `ok: false` with whatever partial identity was found.
|
|
151
|
+
*/
|
|
152
|
+
declare const scrapeService: (port: number, options?: {
|
|
153
|
+
fetch?: ScrapeFetch;
|
|
154
|
+
tempDir?: string;
|
|
155
|
+
}) => Promise<ScrapeResult>;
|
|
156
|
+
//#endregion
|
|
157
|
+
//#region src/icon-compose.d.ts
|
|
158
|
+
type IconBackground = "black" | "white" | "transparent";
|
|
159
|
+
//#endregion
|
|
160
|
+
//#region src/launch-vector.d.ts
|
|
161
|
+
interface LaunchVector {
|
|
162
|
+
readonly command: string;
|
|
163
|
+
readonly args: readonly string[];
|
|
164
|
+
readonly cwd: string;
|
|
165
|
+
/** Optional explicit env overlay merged over the runtime environment. */
|
|
166
|
+
readonly env?: Readonly<Record<string, string>>;
|
|
167
|
+
}
|
|
168
|
+
interface ResolveLaunchVectorOptions {
|
|
169
|
+
readonly tokens: readonly string[];
|
|
170
|
+
readonly cwd: string;
|
|
171
|
+
readonly platform?: NodeJS.Platform;
|
|
172
|
+
readonly pathEnv?: string;
|
|
173
|
+
readonly accessFile?: (path: string) => Promise<void>;
|
|
174
|
+
readonly firstLine?: (path: string) => Promise<string | undefined>;
|
|
175
|
+
}
|
|
176
|
+
/** Resolve a bare command name against PATH; returns undefined when absent. */
|
|
177
|
+
declare const resolveOnPath: (command: string, options: Pick<ResolveLaunchVectorOptions, "platform" | "pathEnv" | "accessFile">) => Promise<string | undefined>;
|
|
178
|
+
/** Read a `#!/usr/bin/env <interpreter>` shebang; undefined for other files. */
|
|
179
|
+
declare const parseShebangInterpreter: (firstLine: string | undefined) => {
|
|
180
|
+
interpreter: string;
|
|
181
|
+
args: readonly string[];
|
|
182
|
+
} | undefined;
|
|
183
|
+
/**
|
|
184
|
+
* Resolve the user's command tokens to a PATH-independent vector:
|
|
185
|
+
* - absolute-ize bare executables through PATH lookup;
|
|
186
|
+
* - resolve relative script paths against cwd;
|
|
187
|
+
* - when the executable is an `env <interpreter>` shebang script, run the
|
|
188
|
+
* interpreter directly with the script as its first argument.
|
|
189
|
+
* The persisted descriptor never includes an environment map.
|
|
190
|
+
*/
|
|
191
|
+
declare const resolveLaunchVector: (options: ResolveLaunchVectorOptions) => Promise<LaunchVector>;
|
|
192
|
+
//#endregion
|
|
193
|
+
//#region src/scaffold.d.ts
|
|
194
|
+
interface ScaffoldAppConfig {
|
|
195
|
+
readonly schemaVersion: 1;
|
|
196
|
+
readonly appId: string;
|
|
197
|
+
readonly appName: string;
|
|
198
|
+
readonly command: LaunchVector;
|
|
199
|
+
readonly service: {
|
|
200
|
+
readonly port: number;
|
|
201
|
+
};
|
|
202
|
+
readonly window: {
|
|
203
|
+
readonly width: number;
|
|
204
|
+
readonly height: number;
|
|
205
|
+
};
|
|
206
|
+
/** Tray icon asset (written by materialize); omitted → text-only tray. */
|
|
207
|
+
readonly trayIcon?: {
|
|
208
|
+
readonly path: string;
|
|
209
|
+
readonly template: boolean;
|
|
210
|
+
};
|
|
211
|
+
/** Generated-app shell (startup terminal / address-bar tabs). */
|
|
212
|
+
readonly shell?: {
|
|
213
|
+
readonly showTerminal: boolean;
|
|
214
|
+
readonly showAddressBar: boolean;
|
|
215
|
+
};
|
|
216
|
+
}
|
|
217
|
+
interface ScaffoldOptions {
|
|
218
|
+
readonly config: ScaffoldAppConfig;
|
|
219
|
+
readonly targetDir: string;
|
|
220
|
+
/** opentray/@opentray/ext-webview version range written into package.json. */
|
|
221
|
+
readonly dependencyRange: string;
|
|
222
|
+
/** Whether install will be skipped; only affects README guidance text. */
|
|
223
|
+
readonly skipInstall?: boolean;
|
|
224
|
+
/** Directory holding the prebuilt shell UI (copied to app-shell/ when the
|
|
225
|
+
* shell is enabled). */
|
|
226
|
+
readonly shellAssetsDir?: string;
|
|
227
|
+
}
|
|
228
|
+
interface ScaffoldResult {
|
|
229
|
+
readonly projectDir: string;
|
|
230
|
+
readonly entryPath: string;
|
|
231
|
+
readonly configPath: string;
|
|
232
|
+
readonly appIconDir: string;
|
|
233
|
+
readonly writtenFiles: readonly string[];
|
|
234
|
+
}
|
|
235
|
+
declare const writeScaffold: (options: ScaffoldOptions) => Promise<ScaffoldResult>;
|
|
236
|
+
//#endregion
|
|
237
|
+
//#region src/materialize.d.ts
|
|
238
|
+
type MaterializeLogEvent = {
|
|
239
|
+
readonly type: "step";
|
|
240
|
+
readonly step: string;
|
|
241
|
+
readonly message: string;
|
|
242
|
+
} | {
|
|
243
|
+
readonly type: "log";
|
|
244
|
+
readonly message: string;
|
|
245
|
+
};
|
|
246
|
+
interface MaterializeInput {
|
|
247
|
+
readonly config: ScaffoldAppConfig;
|
|
248
|
+
readonly targetDir: string;
|
|
249
|
+
readonly dependencyRange: string;
|
|
250
|
+
readonly iconSourcePath: string | undefined;
|
|
251
|
+
/** True when the tray source is a solid silhouette (darwin template). */
|
|
252
|
+
readonly trayIconIsSolid?: boolean;
|
|
253
|
+
/** Icon composition (owner round-12): background + foreground scale. */
|
|
254
|
+
readonly iconBackground?: IconBackground;
|
|
255
|
+
readonly iconScale?: number;
|
|
256
|
+
/** Tray icon source; defaults to the app icon source when omitted. */
|
|
257
|
+
readonly trayIconSourcePath?: string;
|
|
258
|
+
/** Generated-app shell options (startup terminal / address bar). */
|
|
259
|
+
readonly shell?: {
|
|
260
|
+
showTerminal: boolean;
|
|
261
|
+
showAddressBar: boolean;
|
|
262
|
+
};
|
|
263
|
+
readonly packageManager: "npm" | "pnpm" | "bun";
|
|
264
|
+
readonly skipInstall: boolean;
|
|
265
|
+
readonly force: boolean;
|
|
266
|
+
}
|
|
267
|
+
interface MaterializeResult {
|
|
268
|
+
readonly scaffold: ScaffoldResult;
|
|
269
|
+
readonly projectDir: string;
|
|
270
|
+
readonly bundlePath: string | undefined;
|
|
271
|
+
/** Absent under --skip-install (no node_modules → no first launch). */
|
|
272
|
+
readonly firstLaunch?: {
|
|
273
|
+
readonly pid: number;
|
|
274
|
+
};
|
|
275
|
+
}
|
|
276
|
+
interface MaterializeContext {
|
|
277
|
+
readonly log: (event: MaterializeLogEvent) => void;
|
|
278
|
+
readonly generateIcon?: typeof generateOpenTrayAppIcon;
|
|
279
|
+
readonly runInstall?: (options: RunInstallOptions) => Promise<void>;
|
|
280
|
+
readonly firstLaunchEntry?: (projectDir: string) => Promise<FirstLaunchHandle> | FirstLaunchHandle;
|
|
281
|
+
readonly platform?: NodeJS.Platform;
|
|
282
|
+
readonly waitMs?: (ms: number) => Promise<void>;
|
|
283
|
+
readonly bundleTimeoutMs?: number;
|
|
284
|
+
}
|
|
285
|
+
interface RunInstallOptions {
|
|
286
|
+
readonly projectDir: string;
|
|
287
|
+
readonly packageManager: "npm" | "pnpm" | "bun";
|
|
288
|
+
readonly log: (message: string) => void;
|
|
289
|
+
}
|
|
290
|
+
interface FirstLaunchHandle {
|
|
291
|
+
readonly pid: number;
|
|
292
|
+
/** Resolves when the entry prints its ready marker; rejects on early exit. */
|
|
293
|
+
readonly ready: Promise<void>;
|
|
294
|
+
}
|
|
295
|
+
/** True when the directory exists and contains anything beyond ignorable files. */
|
|
296
|
+
declare const isDirectoryOccupied: (dir: string) => Promise<boolean>;
|
|
297
|
+
/** Detect package manager from lockfiles then npm_config_user_agent. */
|
|
298
|
+
declare const detectPackageManager: (files: readonly string[], userAgent: string | undefined) => "npm" | "pnpm" | "bun";
|
|
299
|
+
/** Expected stable Darwin bundle path for the generated project's identity. */
|
|
300
|
+
declare const expectedDarwinBundlePath: (config: {
|
|
301
|
+
appName: string;
|
|
302
|
+
appId: string;
|
|
303
|
+
}) => string;
|
|
304
|
+
declare const materialize: (input: MaterializeInput, context: MaterializeContext) => Promise<MaterializeResult>;
|
|
305
|
+
//#endregion
|
|
306
|
+
//#region src/wizard.d.ts
|
|
307
|
+
interface WizardEnvEntry {
|
|
308
|
+
readonly key: string;
|
|
309
|
+
readonly value: string;
|
|
310
|
+
}
|
|
311
|
+
/** App-icon composition (owner round-12): foreground over black/white/
|
|
312
|
+
* transparent background; the wizard derives the auto suggestion. */
|
|
313
|
+
type WizardIconBackground = "black" | "white" | "transparent";
|
|
314
|
+
interface WizardIconComposition {
|
|
315
|
+
readonly key: string;
|
|
316
|
+
readonly compositePath: string;
|
|
317
|
+
readonly macOSPath: string;
|
|
318
|
+
readonly background: WizardIconBackground;
|
|
319
|
+
}
|
|
320
|
+
interface WizardIconAnalysis {
|
|
321
|
+
readonly luminance: number | undefined;
|
|
322
|
+
readonly coverage: number;
|
|
323
|
+
readonly suggested: WizardIconBackground;
|
|
324
|
+
}
|
|
325
|
+
/** Command execution options (advanced): working directory, custom env, and
|
|
326
|
+
* the input mode — array mode takes argv elements verbatim (no string
|
|
327
|
+
* splitting), string mode tokenizes one command line. */
|
|
328
|
+
interface WizardCommandOptions {
|
|
329
|
+
/** Empty = the wizard's working directory. */
|
|
330
|
+
readonly cwd: string;
|
|
331
|
+
readonly env: readonly WizardEnvEntry[];
|
|
332
|
+
readonly argsMode: "string" | "array";
|
|
333
|
+
}
|
|
334
|
+
type WizardState = "idle" | "running" | "discovered" | "failed" | "frozen" | "materializing" | "success";
|
|
335
|
+
interface WizardFormValues {
|
|
336
|
+
readonly appId: string;
|
|
337
|
+
readonly appName: string;
|
|
338
|
+
readonly iconPath: string;
|
|
339
|
+
/** Icon composition (owner round-12). */
|
|
340
|
+
readonly iconBackground: WizardIconBackground;
|
|
341
|
+
readonly iconScale: number;
|
|
342
|
+
/** Empty = follow the app icon choice (default). */
|
|
343
|
+
readonly trayIconPath: string;
|
|
344
|
+
readonly pm: "npm" | "pnpm" | "bun";
|
|
345
|
+
/** Wipe an existing non-empty target directory before materializing. */
|
|
346
|
+
readonly force: boolean;
|
|
347
|
+
/** Advanced: render the command PTY in the generated app (default false). */
|
|
348
|
+
readonly showStartupTerminal: boolean;
|
|
349
|
+
/** Advanced: address-bar service tabs in the generated app (default false). */
|
|
350
|
+
readonly showAddressBar: boolean;
|
|
351
|
+
}
|
|
352
|
+
/** Placeholder suggestions shown in the form; empty fields resolve to these. */
|
|
353
|
+
interface WizardFormDefaults {
|
|
354
|
+
readonly appId: string;
|
|
355
|
+
readonly appName: string;
|
|
356
|
+
/** Resolved project directory the app will be generated into. */
|
|
357
|
+
readonly targetDir: string;
|
|
358
|
+
/**
|
|
359
|
+
* Effective default icon source (the clearest scraped candidate). The form
|
|
360
|
+
* value stays empty until the user picks/upload; composition must follow
|
|
361
|
+
* this default too, or the preview would never appear without a click.
|
|
362
|
+
*/
|
|
363
|
+
readonly iconPath: string;
|
|
364
|
+
}
|
|
365
|
+
type WizardEvent = {
|
|
366
|
+
readonly type: "state";
|
|
367
|
+
readonly state: WizardState;
|
|
368
|
+
readonly reason?: string;
|
|
369
|
+
} | {
|
|
370
|
+
readonly type: "log";
|
|
371
|
+
readonly stream: "stdout" | "stderr";
|
|
372
|
+
readonly chunk: string;
|
|
373
|
+
} | {
|
|
374
|
+
readonly type: "term-mode";
|
|
375
|
+
readonly interactive: boolean;
|
|
376
|
+
readonly message?: string;
|
|
377
|
+
} | {
|
|
378
|
+
readonly type: "run-status";
|
|
379
|
+
readonly running: boolean;
|
|
380
|
+
readonly code?: number | null;
|
|
381
|
+
} | {
|
|
382
|
+
readonly type: "command-display";
|
|
383
|
+
readonly command: string;
|
|
384
|
+
} | {
|
|
385
|
+
readonly type: "command-options";
|
|
386
|
+
readonly options: WizardCommandOptions;
|
|
387
|
+
readonly defaultCwd: string;
|
|
388
|
+
} | {
|
|
389
|
+
readonly type: "services";
|
|
390
|
+
readonly services: readonly DiscoveredService[];
|
|
391
|
+
readonly selectedPort: number | undefined;
|
|
392
|
+
} | {
|
|
393
|
+
readonly type: "scrape";
|
|
394
|
+
readonly port: number;
|
|
395
|
+
readonly title?: string;
|
|
396
|
+
readonly hasIcon: boolean;
|
|
397
|
+
} | {
|
|
398
|
+
readonly type: "icons";
|
|
399
|
+
readonly port: number;
|
|
400
|
+
readonly icons: readonly ScrapedIcon[];
|
|
401
|
+
} | {
|
|
402
|
+
readonly type: "form";
|
|
403
|
+
readonly values: WizardFormValues;
|
|
404
|
+
readonly defaults: WizardFormDefaults;
|
|
405
|
+
readonly targetDirExists: boolean;
|
|
406
|
+
} | {
|
|
407
|
+
readonly type: "materialize-log";
|
|
408
|
+
readonly message: string;
|
|
409
|
+
} | {
|
|
410
|
+
readonly type: "materialize-step";
|
|
411
|
+
readonly step: string;
|
|
412
|
+
readonly message: string;
|
|
413
|
+
} | {
|
|
414
|
+
readonly type: "success";
|
|
415
|
+
readonly projectDir: string;
|
|
416
|
+
readonly bundlePath?: string;
|
|
417
|
+
readonly pinHint: string;
|
|
418
|
+
};
|
|
419
|
+
interface WizardOptions {
|
|
420
|
+
readonly cwd: string;
|
|
421
|
+
/**
|
|
422
|
+
* USER_HOME anchor: the command-execution default cwd AND the root of the
|
|
423
|
+
* default generated-project location (~/.opentray/create/<name>).
|
|
424
|
+
*/
|
|
425
|
+
readonly homeDir?: string;
|
|
426
|
+
/** Explicit project directory (CLI positional); default: the create root. */
|
|
427
|
+
readonly targetDir?: string | undefined;
|
|
428
|
+
readonly skipInstall: boolean;
|
|
429
|
+
/** Seed the 强制覆盖 toggle (CLI --force); the form owns the live value. */
|
|
430
|
+
readonly force?: boolean | undefined;
|
|
431
|
+
readonly packageManager?: "npm" | "pnpm" | "bun";
|
|
432
|
+
readonly dependencyRange: string;
|
|
433
|
+
readonly emit: (event: WizardEvent) => void;
|
|
434
|
+
readonly spawnRun?: typeof startCommandRun;
|
|
435
|
+
readonly listListeners?: () => Promise<ReadonlySet<number>>;
|
|
436
|
+
readonly verifyHttp?: (port: number) => Promise<boolean>;
|
|
437
|
+
/** Test/embedding seam for listener ownership. */
|
|
438
|
+
readonly listPortOwners?: () => Promise<ListenerOwners>;
|
|
439
|
+
readonly scrape?: typeof scrapeService;
|
|
440
|
+
readonly resolveVector?: typeof resolveLaunchVector;
|
|
441
|
+
/** Test/embedding seam for the materialize pipeline. */
|
|
442
|
+
readonly materializeContext?: Partial<MaterializeContext>;
|
|
443
|
+
readonly platform?: NodeJS.Platform;
|
|
444
|
+
readonly pollIntervalMs?: number;
|
|
445
|
+
readonly scrapeIntervalMs?: number;
|
|
446
|
+
}
|
|
447
|
+
interface WizardSession {
|
|
448
|
+
readonly state: WizardState;
|
|
449
|
+
readonly services: readonly DiscoveredService[];
|
|
450
|
+
readonly selectedPort: number | undefined;
|
|
451
|
+
/** True while the preview process is alive (Run button shows Interrupt). */
|
|
452
|
+
readonly runAlive: boolean;
|
|
453
|
+
/** Latest scraped icon candidates for the selected service, ranked by clarity. */
|
|
454
|
+
readonly iconCandidates: readonly ScrapedIcon[];
|
|
455
|
+
/** Persist an uploaded image into the session temp dir; returns its path. */
|
|
456
|
+
saveIconUpload(bytes: Buffer): Promise<string>;
|
|
457
|
+
/** Candidate lookup scoped to the port it was scraped from. */
|
|
458
|
+
iconCandidate(port: number, index: number): ScrapedIcon | undefined;
|
|
459
|
+
/** Select a scraped candidate as the icon source (marks the field touched). */
|
|
460
|
+
selectIconCandidate(port: number, index: number): boolean;
|
|
461
|
+
/** Select a candidate (original or solid variant) as the TRAY icon. */
|
|
462
|
+
selectTrayIconCandidate(port: number, index: number): boolean;
|
|
463
|
+
/** Test/extension seam: replace the scraped candidate set for a port. */
|
|
464
|
+
replaceIconCandidates(port: number, icons: readonly ScrapedIcon[]): void;
|
|
465
|
+
/** Compose the app icon preview/asset for the current foreground. */
|
|
466
|
+
composeIcon(options: {
|
|
467
|
+
foregroundPath: string;
|
|
468
|
+
background?: WizardIconBackground;
|
|
469
|
+
scale?: number;
|
|
470
|
+
}): Promise<WizardIconComposition>;
|
|
471
|
+
/** Register a composition for token-scoped byte serving (server seam). */
|
|
472
|
+
trackIconComposition(composition: WizardIconComposition): void;
|
|
473
|
+
/** Look up a registered composition by cache key. */
|
|
474
|
+
iconComposition(key: string): WizardIconComposition | undefined;
|
|
475
|
+
/** Wizard-owned icon source roots (containment for icon routes). */
|
|
476
|
+
iconSourceRoots(): readonly string[];
|
|
477
|
+
/** Auto-suggestion for the foreground (background + reason). */
|
|
478
|
+
analyzeIconForeground(foregroundPath: string): Promise<WizardIconAnalysis>;
|
|
479
|
+
readonly form: WizardFormValues;
|
|
480
|
+
readonly result: MaterializeResult | undefined;
|
|
481
|
+
/** String form is tokenized; array form is taken as argv verbatim (array
|
|
482
|
+
* input mode — no string splitting is ever applied to it). */
|
|
483
|
+
submitCommand(command: string | readonly string[]): Promise<void>;
|
|
484
|
+
/** Derive placeholder defaults from command text without spawning anything. */
|
|
485
|
+
prime(command: string | readonly string[]): void;
|
|
486
|
+
readonly commandOptions: WizardCommandOptions;
|
|
487
|
+
updateCommandOptions(patch: Partial<WizardCommandOptions>): void;
|
|
488
|
+
selectService(port: number): void;
|
|
489
|
+
updateForm(patch: Partial<WizardFormValues>): void;
|
|
490
|
+
terminalInput(data: string): void;
|
|
491
|
+
terminalResize(size: {
|
|
492
|
+
cols: number;
|
|
493
|
+
rows: number;
|
|
494
|
+
}): void;
|
|
495
|
+
confirm(): void;
|
|
496
|
+
create(): Promise<void>;
|
|
497
|
+
stop(): Promise<void>;
|
|
498
|
+
}
|
|
499
|
+
declare const createWizardSession: (options: WizardOptions) => WizardSession;
|
|
500
|
+
//#endregion
|
|
501
|
+
//#region src/server.d.ts
|
|
502
|
+
interface WizardServerHandle {
|
|
503
|
+
readonly url: string;
|
|
504
|
+
readonly port: number;
|
|
505
|
+
readonly token: string;
|
|
506
|
+
readonly session: WizardSession;
|
|
507
|
+
close(): Promise<void>;
|
|
508
|
+
}
|
|
509
|
+
declare const createWizardServer: (createSession: (emit: (event: WizardEvent) => void) => WizardSession, options?: {
|
|
510
|
+
readonly port?: number;
|
|
511
|
+
}) => Promise<WizardServerHandle>;
|
|
512
|
+
declare const isAuthorized: (request: IncomingMessage, url: URL, token: string) => boolean;
|
|
513
|
+
declare const isLoopbackHost: (request: IncomingMessage) => boolean;
|
|
514
|
+
//#endregion
|
|
515
|
+
//#region src/tokenize.d.ts
|
|
516
|
+
interface TokenizeResult {
|
|
517
|
+
readonly ok: boolean;
|
|
518
|
+
readonly tokens: readonly string[];
|
|
519
|
+
readonly error: string | undefined;
|
|
520
|
+
}
|
|
521
|
+
/**
|
|
522
|
+
* Shell-style tokenizer for the wizard command input. Supports single quotes,
|
|
523
|
+
* double quotes, and backslash escapes outside quotes. It never executes
|
|
524
|
+
* anything; it only produces the argv that will be spawned.
|
|
525
|
+
*/
|
|
526
|
+
declare const tokenizeCommandLine: (input: string) => TokenizeResult;
|
|
527
|
+
//#endregion
|
|
528
|
+
//#region src/app-id.d.ts
|
|
529
|
+
/**
|
|
530
|
+
* Default appId derivation. `npx somecommand start --xx` keeps the pre-option
|
|
531
|
+
* tokens `["npx", "somecommand", "start"]`, reverses them, and dot-joins:
|
|
532
|
+
* `start.somecommand.npx`.
|
|
533
|
+
*/
|
|
534
|
+
declare const deriveDefaultAppId: (tokens: readonly string[]) => string;
|
|
535
|
+
/** Human display name from the appId derivation: `Somecommand Start`. */
|
|
536
|
+
declare const deriveDefaultAppName: (tokens: readonly string[]) => string;
|
|
537
|
+
/** Directory-safe project name from an appId (mirrors packaging normalizeAppId semantics). */
|
|
538
|
+
declare const toProjectDirectoryName: (appId: string) => string;
|
|
539
|
+
/** True when the appId has the shape consumers expect for stable identity. */
|
|
540
|
+
declare const isValidAppId: (appId: string) => boolean;
|
|
541
|
+
//#endregion
|
|
542
|
+
//#region src/open-app.d.ts
|
|
543
|
+
interface OpenAppInput {
|
|
544
|
+
readonly projectDir: string;
|
|
545
|
+
readonly bundlePath: string | undefined;
|
|
546
|
+
readonly platform?: NodeJS.Platform | undefined;
|
|
547
|
+
}
|
|
548
|
+
interface OpenAppResult {
|
|
549
|
+
readonly ok: boolean;
|
|
550
|
+
readonly detail: string;
|
|
551
|
+
}
|
|
552
|
+
declare const openMaterializedApp: (input: OpenAppInput) => Promise<OpenAppResult>;
|
|
553
|
+
/** Platform-truthful pinning hint; makes no Windows persistence claim. */
|
|
554
|
+
declare const pinningHint: (platform?: NodeJS.Platform) => string;
|
|
555
|
+
//#endregion
|
|
556
|
+
export { type DiscoveredService, type FaviconCandidate, type LaunchVector, type MaterializeContext, type MaterializeInput, type MaterializeLogEvent, type MaterializeResult, type ScaffoldAppConfig, type ScaffoldOptions, type ScaffoldResult, type ScrapeResult, type TokenizeResult, type WizardCliOptions, type WizardEvent, type WizardFormValues, type WizardServerHandle, type WizardSession, type WizardState, createPortDiscovery, createWizardServer, createWizardSession, deriveDefaultAppId, deriveDefaultAppName, detectPackageManager, expectedDarwinBundlePath, extractFaviconCandidates, extractTitle, faviconCandidateSize, isAuthorized, isDirectoryOccupied, isLoopbackHost, isValidAppId, materialize, openMaterializedApp, parseLsofPorts, parseNetstatPorts, parsePowerShellPorts, parseShebangInterpreter, parseWizardCli, pinningHint, rankFaviconCandidates, resolveFaviconUrl, resolveLaunchVector, resolveOnPath, main as runWizardMain, scrapeService, serviceUrl, toProjectDirectoryName, tokenizeCommandLine, verifyHttpService, waitForTcpPort, writeScaffold };
|
|
557
|
+
//# sourceMappingURL=index.d.mts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.mts","names":[],"sources":["../src/port-scan.ts","../src/command-run.ts","../src/scrape.ts","../src/icon-compose.ts","../src/launch-vector.ts","../src/scaffold.ts","../src/materialize.ts","../src/wizard.ts","../src/server.ts","../src/tokenize.ts","../src/app-id.ts","../src/open-app.ts"],"mappings":";;;;;UASiB,iBAAA;EAAA,SACN,IAAA;EAAA,SACA,GAAA;EAAA,SACA,WAAA;EACT,KAAA;AAAA;AAAA,KAGU,eAAA,IAAmB,QAAA,EAAU,MAAA,CAAO,QAAA,KAAa,OAAA,CAAQ,WAAA;;KAGzD,cAAA,GAAiB,WAAW,SAAS,WAAA;;cAGpC,UAAA,GAAc,IAAY;AAAA,cA8G1B,cAAA,GAAkB,MAAA,aAAiB,WAAW;;cA8B9C,iBAAA,GAAqB,MAAA,aAAiB,WAAW;AAAA,cAkCjD,oBAAA,GAAwB,MAAA,aAAiB,WAAW;;cAYpD,cAAA,GACX,IAAA,UACA,SAAA,UACA,UAAA,WACA,IAAA,cACC,OAAO;;cA0BG,iBAAA,GAA2B,IAAA,UAAc,SAAA,cAAoB,OAAO;AAAA,UAiDhE,oBAAA;EAAA,SACN,QAAA,GAAW,MAAA,CAAO,QAAA;EAAA,SAClB,QAAA,EAAU,WAAA;EAAA,SACV,aAAA,GAAgB,eAAA;EAAA,SAChB,UAAA,IAAc,IAAA,aAAiB,OAAA;;WAE/B,gBAAA,SAAyB,OAAA,CAAQ,WAAA;EAAA,SACjC,UAAA,SAAmB,OAAA,CAAQ,cAAA;EAAA,SAC3B,UAAA;AAAA;AAAA,UAGM,oBAAA;EAzIiB;EA2IhC,QAAA,aAAqB,iBAAA;EAzGV;EA2GX,IAAA,IAAQ,OAAA,UAAiB,iBAAA;EACzB,IAAA;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KAAa;;;UC5CzB,YAAA;EAAA,SACN,UAAA;EAAA,SACA,UAAA;EAAA,SACA,QAAA,GAAW,MAAA,CAAO,QAAQ;AAAA;AAAA,UAGpB,aAAA;EAAA,SACN,EAAA;EAAA,SACA,MAAM;AAAA;AAAA,cAGJ,mBAAA,GAA6B,KAAA,EAAO,YAAA,KAAe,OAAA,CAAQ,aAAA;;cAsC3D,WAAA,GAAe,QAAA,GAAU,MAAA,CAAO,QAA2B"}
|
package/dist/index.mjs
ADDED
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
import { A as verifyHttpService, C as resolveFaviconUrl, D as parseNetstatPorts, E as parseLsofPorts, F as toProjectDirectoryName, M as deriveDefaultAppId, N as deriveDefaultAppName, O as parsePowerShellPorts, P as isValidAppId, S as rankFaviconCandidates, T as createPortDiscovery, _ as writeScaffold, a as isAuthorized, b as extractTitle, c as openMaterializedApp, d as resolveLaunchVector, f as resolveOnPath, g as materialize, h as isDirectoryOccupied, i as createWizardServer, j as waitForTcpPort, k as serviceUrl, l as pinningHint, m as expectedDarwinBundlePath, o as isLoopbackHost, p as detectPackageManager, r as parseWizardCli, s as createWizardSession, t as main, u as parseShebangInterpreter, v as tokenizeCommandLine, w as scrapeService, x as faviconCandidateSize, y as extractFaviconCandidates } from "./bin-B9VeXatR.mjs";
|
|
2
|
+
export { createPortDiscovery, createWizardServer, createWizardSession, deriveDefaultAppId, deriveDefaultAppName, detectPackageManager, expectedDarwinBundlePath, extractFaviconCandidates, extractTitle, faviconCandidateSize, isAuthorized, isDirectoryOccupied, isLoopbackHost, isValidAppId, materialize, openMaterializedApp, parseLsofPorts, parseNetstatPorts, parsePowerShellPorts, parseShebangInterpreter, parseWizardCli, pinningHint, rankFaviconCandidates, resolveFaviconUrl, resolveLaunchVector, resolveOnPath, main as runWizardMain, scrapeService, serviceUrl, toProjectDirectoryName, tokenizeCommandLine, verifyHttpService, waitForTcpPort, writeScaffold };
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
const e={};export{e as default};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{r as a,j as r,R as L,a as C}from"./index.js";import{B as m,A as N,a as U,R as z,G as B,I}from"./input.js";const A=()=>typeof window<"u"&&"navigation"in window?window.navigation:void 0,v=c=>{const s=c.trim();if(s.length!==0)try{return new URL(/^https?:\/\//iu.test(s)?s:`http://${s}`).href}catch{return}},T=c=>`${location.pathname}?url=${encodeURIComponent(c)}`,D=()=>{const c=new URLSearchParams(location.search).get("url");return v(c??"")??"about:blank"};function P(){const c=a.useRef(D()),[s,x]=a.useState(c.current),[g,b]=a.useState(c.current),o=a.useRef([c.current]),t=a.useRef(0),i=a.useRef(A()),h=a.useRef(null),[$,y]=a.useState(0),d=a.useCallback(e=>{b(e),x(e)},[]);a.useEffect(()=>{const e=i.current;if(e===void 0)return;const n=u=>{!u.canIntercept||u.hashChange||u.intercept({handler:()=>{const p=new URLSearchParams(new URL(u.destination.url).search).get("url");if(p===null)return;const w=v(p);w!==void 0&&d(w)}})},l=()=>y(u=>u+1);return e.addEventListener("navigate",n),e.addEventListener("currententrychange",l),()=>{e.removeEventListener("navigate",n),e.removeEventListener("currententrychange",l)}},[]);const R=e=>{const n=i.current;if(n!==void 0)try{n.navigate(T(e));return}catch{}o.current=[...o.current.slice(0,t.current+1),e],t.current=o.current.length-1,d(e)},j=()=>{const e=i.current;if(e!==void 0&&e.currentEntry!==null&&e.currentEntry.index>0){const n=e.entries()[e.currentEntry.index-1];if(n!==void 0)try{e.traverseTo(n.key);return}catch{}}t.current>0&&(t.current-=1,d(o.current[t.current]))},E=()=>{const e=i.current;if(e!==void 0&&e.currentEntry!==null){const l=e.entries()[e.currentEntry.index+1];if(l!==void 0)try{e.traverseTo(l.key);return}catch{}}t.current<o.current.length-1&&(t.current+=1,d(o.current[t.current]))},f=i.current?.currentEntry??null,k=f!==null?f.index>0:t.current>0,S=f!==null?f.index<(i.current?.entries().length??1)-1:t.current<o.current.length-1;return r.jsxs("div",{className:"flex h-screen flex-col overflow-hidden",children:[r.jsxs("div",{className:"flex h-11 shrink-0 items-center gap-2 border-b border-border bg-card px-3",children:[r.jsx(m,{variant:"ghost",size:"iconSm",disabled:!k,onClick:j,"aria-label":"后退",children:r.jsx(N,{})}),r.jsx(m,{variant:"ghost",size:"iconSm",disabled:!S,onClick:E,"aria-label":"前进",children:r.jsx(U,{})}),r.jsx(m,{variant:"ghost",size:"iconSm",onClick:()=>{h.current!==null&&(h.current.src=g)},"aria-label":"重新加载",children:r.jsx(z,{})}),r.jsx(B,{className:"size-4 shrink-0 text-muted-foreground"}),r.jsx(I,{className:"h-7 font-mono text-xs",value:s,placeholder:"输入 URL 跳转",onChange:e=>x(e.target.value),onKeyDown:e=>{if(e.key!=="Enter")return;const n=v(s);n!==void 0&&R(n)}})]}),r.jsx("iframe",{ref:h,title:"service",src:g,className:"min-h-0 flex-1 border-0 bg-white",sandbox:"allow-same-origin allow-scripts allow-forms"})]})}L.createRoot(document.getElementById("root")).render(r.jsx(C.StrictMode,{children:r.jsx(P,{})}));
|