@powerhousedao/desktop 6.2.3-dev.70 → 6.2.3-dev.72
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/index.d.mts +65 -17
- package/dist/index.d.mts.map +1 -1
- package/dist/index.mjs +19 -2
- package/dist/index.mjs.map +1 -1
- package/dist/runner.d.mts +311 -106
- package/dist/runner.d.mts.map +1 -1
- package/dist/runner.mjs +100 -31
- package/dist/runner.mjs.map +1 -1
- package/dist/{shell-DbRGck6R.mjs → shell-C6KfHzBa.mjs} +309 -22
- package/dist/shell-C6KfHzBa.mjs.map +1 -0
- package/package.json +5 -3
- package/dist/shell-DbRGck6R.mjs.map +0 -1
|
@@ -1,8 +1,10 @@
|
|
|
1
1
|
import { createRequire } from "node:module";
|
|
2
|
+
import { colorVariants, imageVariants, layerStyleText, normalizeBackground, validateBackground } from "@powerhousedao/shared/connect";
|
|
2
3
|
import fs from "node:fs";
|
|
3
4
|
import path from "node:path";
|
|
4
5
|
import { z } from "zod";
|
|
5
6
|
import { execSync, spawn, spawnSync } from "node:child_process";
|
|
7
|
+
import { isPassthroughImageRef } from "@powerhousedao/shared/connect/image-ref";
|
|
6
8
|
import { pathToFileURL } from "node:url";
|
|
7
9
|
//#region src/app-json.ts
|
|
8
10
|
/**
|
|
@@ -17,8 +19,72 @@ const windowSchema = z.strictObject({
|
|
|
17
19
|
title: z.string().min(1).optional(),
|
|
18
20
|
width: z.number().int().positive().optional(),
|
|
19
21
|
height: z.number().int().positive().optional(),
|
|
20
|
-
resizable: z.boolean().optional()
|
|
22
|
+
resizable: z.boolean().optional(),
|
|
23
|
+
/** Smallest size the window can be dragged to (logical pixels). */
|
|
24
|
+
minWidth: z.number().int().positive().optional(),
|
|
25
|
+
minHeight: z.number().int().positive().optional()
|
|
21
26
|
}).optional();
|
|
27
|
+
const cssColorSchema = z.string().regex(/^#(?:[0-9a-fA-F]{3,4}|[0-9a-fA-F]{6}|[0-9a-fA-F]{8})$/, "use a hex color (#rgb, #rgba, #rrggbb or #rrggbbaa)");
|
|
28
|
+
/** The loading page's colors. */
|
|
29
|
+
const loadingColorsSchema = z.strictObject({
|
|
30
|
+
/** Page background (default #0f1115). */
|
|
31
|
+
background: cssColorSchema.nullable().optional(),
|
|
32
|
+
/** Status text color (default #e6e8eb). */
|
|
33
|
+
color: cssColorSchema.nullable().optional(),
|
|
34
|
+
/** The pulsing status dot (default #4ade80). */
|
|
35
|
+
accent: cssColorSchema.nullable().optional()
|
|
36
|
+
});
|
|
37
|
+
/** The loading page's look, so the window opens in the app's own colors
|
|
38
|
+
* instead of the default dark page. Every field is optional, and `null`
|
|
39
|
+
* means the default (the scaffold lists the fields that way). */
|
|
40
|
+
const loadingSchema = loadingColorsSchema.extend({
|
|
41
|
+
/** Status line under the art (default "Starting <productName>…"). */
|
|
42
|
+
message: z.string().min(1).nullable().optional(),
|
|
43
|
+
/** Colors for `prefers-color-scheme: dark`; without it the page keeps
|
|
44
|
+
* the light colors in both schemes. */
|
|
45
|
+
dark: loadingColorsSchema.nullable().optional(),
|
|
46
|
+
/** Deprecated: a decoration pinned to the bottom-right corner, relative
|
|
47
|
+
* to app.json, with `artDark` its dark-scheme counterpart. Superseded by
|
|
48
|
+
* the top-level `background`, which ignores these when set. */
|
|
49
|
+
art: z.string().min(1).nullable().optional(),
|
|
50
|
+
artDark: z.string().min(1).nullable().optional()
|
|
51
|
+
}).nullable().optional();
|
|
52
|
+
const imageRefSchema = z.string().min(1);
|
|
53
|
+
const schemedImageSchema = z.union([imageRefSchema, z.strictObject({
|
|
54
|
+
light: imageRefSchema,
|
|
55
|
+
dark: imageRefSchema.nullable().optional()
|
|
56
|
+
})]);
|
|
57
|
+
const lengthSchema = z.union([z.number(), z.string().min(1)]).nullable().optional();
|
|
58
|
+
const edgesSchema = z.strictObject({
|
|
59
|
+
top: lengthSchema,
|
|
60
|
+
right: lengthSchema,
|
|
61
|
+
bottom: lengthSchema,
|
|
62
|
+
left: lengthSchema
|
|
63
|
+
}).nullable().optional();
|
|
64
|
+
const backgroundLayerSchema = z.strictObject({
|
|
65
|
+
src: schemedImageSchema,
|
|
66
|
+
position: edgesSchema,
|
|
67
|
+
width: lengthSchema,
|
|
68
|
+
height: lengthSchema,
|
|
69
|
+
minWidth: lengthSchema,
|
|
70
|
+
minHeight: lengthSchema,
|
|
71
|
+
maxWidth: lengthSchema,
|
|
72
|
+
maxHeight: lengthSchema,
|
|
73
|
+
opacity: z.number().min(0).max(1).nullable().optional(),
|
|
74
|
+
fade: edgesSchema
|
|
75
|
+
});
|
|
76
|
+
const backgroundSchema = z.union([imageRefSchema, z.strictObject({
|
|
77
|
+
color: z.union([z.string().min(1), z.strictObject({
|
|
78
|
+
light: z.string().min(1),
|
|
79
|
+
dark: z.string().min(1).nullable().optional()
|
|
80
|
+
})]).nullable().optional(),
|
|
81
|
+
layers: z.array(backgroundLayerSchema)
|
|
82
|
+
})]).superRefine((background, ctx) => {
|
|
83
|
+
for (const problem of validateBackground(background, "background")) ctx.addIssue({
|
|
84
|
+
code: "custom",
|
|
85
|
+
message: problem
|
|
86
|
+
});
|
|
87
|
+
}).nullable().optional();
|
|
22
88
|
const fileAssociationSchema = z.strictObject({
|
|
23
89
|
/** Extensions WITHOUT the leading dot ("phd", not ".phd"). */
|
|
24
90
|
ext: z.array(z.string().min(1).regex(/^[^.]/, "drop the leading dot")).min(1),
|
|
@@ -44,6 +110,18 @@ const appJsonSchema = z.strictObject({
|
|
|
44
110
|
/** Single source image (square PNG, 1024×1024 recommended); the icon set
|
|
45
111
|
* for every platform is generated from it via `tauri icon`. */
|
|
46
112
|
icon: z.string().min(1),
|
|
113
|
+
/** The loading page's background: images positioned and sized over a
|
|
114
|
+
* page colour (`{ color, layers }`), or one image pinned bottom-right.
|
|
115
|
+
* The status line stays centred above them. `ph generate desktop-shell`
|
|
116
|
+
* copies Connect's `connect.branding.homeBackground` here. null or
|
|
117
|
+
* omitted: the app icon (or `splash`) above the status line. */
|
|
118
|
+
background: backgroundSchema,
|
|
119
|
+
/** Deprecated in favour of `background`: a wide splash image shown above
|
|
120
|
+
* the status line instead of the square icon. Relative to this file. */
|
|
121
|
+
splash: z.string().min(1).nullable().optional(),
|
|
122
|
+
/** Deprecated with `splash`: its `prefers-color-scheme: dark` variant. */
|
|
123
|
+
splashDark: z.string().min(1).nullable().optional(),
|
|
124
|
+
loading: loadingSchema,
|
|
47
125
|
window: windowSchema,
|
|
48
126
|
fileAssociations: z.array(fileAssociationSchema).optional(),
|
|
49
127
|
shell: shellSourceSchema
|
|
@@ -79,6 +157,25 @@ function appSlug(app) {
|
|
|
79
157
|
}
|
|
80
158
|
//#endregion
|
|
81
159
|
//#region src/bundle-stack.ts
|
|
160
|
+
/**
|
|
161
|
+
* P6.3 — stage the shippable STACK into the shell project: everything the
|
|
162
|
+
* installed app needs to run `ph run desktop` with no environment at all
|
|
163
|
+
* (D6.c). The shell's resources map `../dist-stack` → `stack`, and its
|
|
164
|
+
* uniform-runners mode falls back to `resources/stack` when the env pair is
|
|
165
|
+
* absent. Layout:
|
|
166
|
+
*
|
|
167
|
+
* dist-stack/
|
|
168
|
+
* hosts/ the project's host files
|
|
169
|
+
* agents/ when present
|
|
170
|
+
* powerhouse.config.json
|
|
171
|
+
* package.json minimal, names the project
|
|
172
|
+
* dist/ the package's build (ph build)
|
|
173
|
+
* .ph/connect-build/dist/ the BUILT Connect (ph run connect build)
|
|
174
|
+
* node_modules/ vendored @powerhousedao/ph-cli (hoisted,
|
|
175
|
+
* real files — computed-specifier imports and
|
|
176
|
+
* PGlite wasm forbid bundling)
|
|
177
|
+
*/
|
|
178
|
+
const CONNECT_BUILD_DIR = path.join(".ph", "connect-build", "dist");
|
|
82
179
|
function copyIfExists(from, to) {
|
|
83
180
|
if (!fs.existsSync(from)) return false;
|
|
84
181
|
fs.cpSync(from, to, { recursive: true });
|
|
@@ -105,6 +202,54 @@ function copyDirFiltered(src, dest, excludes) {
|
|
|
105
202
|
walk(src, dest);
|
|
106
203
|
return true;
|
|
107
204
|
}
|
|
205
|
+
/** The npm spec of each tarball in `dir`, by the package name inside it. */
|
|
206
|
+
function readLocalPackages(dir) {
|
|
207
|
+
const root = path.resolve(dir);
|
|
208
|
+
const tarballs = fs.existsSync(root) ? fs.readdirSync(root).filter((f) => f.endsWith(".tgz")) : [];
|
|
209
|
+
if (tarballs.length === 0) throw new Error(`bundle-stack: no package tarballs (*.tgz) in ${root}`);
|
|
210
|
+
const specs = {};
|
|
211
|
+
for (const file of tarballs.sort()) {
|
|
212
|
+
const tarball = path.join(root, file);
|
|
213
|
+
const manifest = spawnSync("tar", [
|
|
214
|
+
"-xzOf",
|
|
215
|
+
tarball,
|
|
216
|
+
"package/package.json"
|
|
217
|
+
], {
|
|
218
|
+
encoding: "utf8",
|
|
219
|
+
windowsHide: true
|
|
220
|
+
});
|
|
221
|
+
if (manifest.status !== 0) throw new Error(`bundle-stack: ${tarball} has no package/package.json: ${manifest.stderr}`);
|
|
222
|
+
const { name } = JSON.parse(manifest.stdout);
|
|
223
|
+
if (specs[name]) throw new Error(`bundle-stack: two tarballs for ${name} in ${root} (a stale pack?): ${specs[name].slice(5)} and ${tarball}`);
|
|
224
|
+
specs[name] = `file:${tarball}`;
|
|
225
|
+
}
|
|
226
|
+
return specs;
|
|
227
|
+
}
|
|
228
|
+
/**
|
|
229
|
+
* The staged stack's package.json. With local packages, every one is an
|
|
230
|
+
* override (so transitive dependents get it too) and the direct dependencies
|
|
231
|
+
* name the same spec: npm rejects an override that contradicts one.
|
|
232
|
+
*/
|
|
233
|
+
function stackManifest(options) {
|
|
234
|
+
const local = options.local ?? {};
|
|
235
|
+
const spec = (pkg, fallback) => local[pkg] ?? fallback;
|
|
236
|
+
return {
|
|
237
|
+
name: options.name,
|
|
238
|
+
private: true,
|
|
239
|
+
type: "module",
|
|
240
|
+
dependencies: {
|
|
241
|
+
"@powerhousedao/ph-cli": spec("@powerhousedao/ph-cli", options.phCliSpec ?? options.version),
|
|
242
|
+
"@powerhousedao/host-core": spec("@powerhousedao/host-core", options.version)
|
|
243
|
+
},
|
|
244
|
+
...Object.keys(local).length > 0 ? { overrides: local } : {}
|
|
245
|
+
};
|
|
246
|
+
}
|
|
247
|
+
/** A vendored tree installed from local tarballs: the same version numbers
|
|
248
|
+
* as the registry's, so npm would take either for the other. */
|
|
249
|
+
function vendoredFromLocal(stackDir) {
|
|
250
|
+
const lock = path.join(stackDir, "package-lock.json");
|
|
251
|
+
return fs.existsSync(lock) && fs.readFileSync(lock, "utf8").includes("\"resolved\": \"file:");
|
|
252
|
+
}
|
|
108
253
|
function bundleStack(options) {
|
|
109
254
|
const log = options.logger ?? console.log;
|
|
110
255
|
const stackDir = path.join(options.shellProjectDir, "dist-stack");
|
|
@@ -112,6 +257,7 @@ function bundleStack(options) {
|
|
|
112
257
|
"hosts",
|
|
113
258
|
"agents",
|
|
114
259
|
"dist",
|
|
260
|
+
".ph",
|
|
115
261
|
"powerhouse.config.json",
|
|
116
262
|
"package.json"
|
|
117
263
|
]) fs.rmSync(path.join(stackDir, entry), {
|
|
@@ -120,7 +266,11 @@ function bundleStack(options) {
|
|
|
120
266
|
});
|
|
121
267
|
fs.mkdirSync(stackDir, { recursive: true });
|
|
122
268
|
log(` hosts/ ${copyDirFiltered(path.join(options.projectRoot, "hosts"), path.join(stackDir, "hosts"), options.excludeDirs ?? []) ? "staged" : "absent — skipped"}`);
|
|
123
|
-
for (const dir of [
|
|
269
|
+
for (const dir of [
|
|
270
|
+
"agents",
|
|
271
|
+
"dist",
|
|
272
|
+
CONNECT_BUILD_DIR
|
|
273
|
+
]) log(` ${dir}/ ${copyIfExists(path.join(options.projectRoot, dir), path.join(stackDir, dir)) ? "staged" : "absent — skipped"}`);
|
|
124
274
|
const stagedDesktopHost = path.join(stackDir, "hosts", "desktop", "host.js");
|
|
125
275
|
if (fs.existsSync(stagedDesktopHost)) {
|
|
126
276
|
const source = fs.readFileSync(stagedDesktopHost, "utf8");
|
|
@@ -136,16 +286,28 @@ function bundleStack(options) {
|
|
|
136
286
|
}
|
|
137
287
|
const sourcePkg = JSON.parse(fs.readFileSync(path.join(options.projectRoot, "package.json"), "utf8"));
|
|
138
288
|
const version = options.phCliVersion ?? "dev";
|
|
139
|
-
|
|
140
|
-
|
|
289
|
+
const name = sourcePkg.name ?? "powerhouse-desktop-stack";
|
|
290
|
+
const vendor = options.vendor !== false;
|
|
291
|
+
const local = options.localPackagesDir ? readLocalPackages(options.localPackagesDir) : void 0;
|
|
292
|
+
if (vendor && (local || vendoredFromLocal(stackDir))) for (const entry of ["node_modules", "package-lock.json"]) fs.rmSync(path.join(stackDir, entry), {
|
|
293
|
+
recursive: true,
|
|
294
|
+
force: true
|
|
295
|
+
});
|
|
296
|
+
fs.writeFileSync(path.join(stackDir, "package.json"), `${JSON.stringify(local ? stackManifest({
|
|
297
|
+
name,
|
|
298
|
+
version,
|
|
299
|
+
phCliSpec: options.phCliSpec,
|
|
300
|
+
local
|
|
301
|
+
}) : {
|
|
302
|
+
name,
|
|
141
303
|
private: true,
|
|
142
304
|
type: "module",
|
|
143
305
|
dependencies: { "@powerhousedao/ph-cli": version }
|
|
144
306
|
}, null, 2)}\n`);
|
|
145
307
|
let vendored = false;
|
|
146
|
-
if (
|
|
147
|
-
const specs = `"${options.phCliSpec ?? `@powerhousedao/ph-cli@${version}`}" "@powerhousedao/host-core@${version}"`;
|
|
148
|
-
log(` vendoring ${specs} (hoisted, real files)…`);
|
|
308
|
+
if (vendor) {
|
|
309
|
+
const specs = local ? "" : `"${options.phCliSpec ?? `@powerhousedao/ph-cli@${version}`}" "@powerhousedao/host-core@${version}"`;
|
|
310
|
+
log(local ? ` vendoring ${Object.keys(local).length} local packages from ${options.localPackagesDir} (hoisted, real files)…` : ` vendoring ${specs} (hoisted, real files)…`);
|
|
149
311
|
const result = spawnSync(`npm install ${specs} --install-strategy=hoisted --omit=dev --no-audit --no-fund`, {
|
|
150
312
|
cwd: stackDir,
|
|
151
313
|
stdio: "pipe",
|
|
@@ -237,6 +399,11 @@ const BUILD_RS = `// GENERATED — mirrors the reference shell. Connect is serve
|
|
|
237
399
|
// need an explicit ACL; declaring the command manifest here generates the
|
|
238
400
|
// allow-<command> permissions that capabilities/*.json grant.
|
|
239
401
|
fn main() {
|
|
402
|
+
// The icon set is a COMPILE-TIME input (the Windows resource icon here,
|
|
403
|
+
// and the tray/window icon tauri::generate_context! embeds), but
|
|
404
|
+
// tauri-build registers no rerun trigger for it: without this line a
|
|
405
|
+
// regenerated icon set leaves the old icon compiled into the binary.
|
|
406
|
+
println!("cargo:rerun-if-changed=icons");
|
|
240
407
|
tauri_build::try_build(tauri_build::Attributes::new().app_manifest(
|
|
241
408
|
tauri_build::AppManifest::new().commands(&[
|
|
242
409
|
"take_launch_files",
|
|
@@ -251,26 +418,68 @@ fn main() {
|
|
|
251
418
|
* beside ui/index.html — not one of the downsampled `tauri icon` outputs, so
|
|
252
419
|
* it stays sharp on HiDPI screens. Generated, like the rest of ui/. */
|
|
253
420
|
const LOADING_LOGO = "logo.png";
|
|
421
|
+
/** The loading page's splash (app.json `splash`), copied beside it; shown
|
|
422
|
+
* instead of the square logo when set. Generated, like the rest of ui/. */
|
|
423
|
+
const LOADING_SPLASH = "splash.png";
|
|
424
|
+
/** Dark-scheme splash (app.json `splashDark`), beside the light one. */
|
|
425
|
+
const LOADING_SPLASH_DARK = "splash-dark.png";
|
|
254
426
|
/** CSS size of the logo; the 1024² source keeps it crisp up to 8x DPR. */
|
|
255
427
|
const LOGO_CSS_PX = 128;
|
|
256
|
-
function loadingHtml(
|
|
257
|
-
const
|
|
258
|
-
const
|
|
259
|
-
|
|
428
|
+
function loadingHtml(app, art) {
|
|
429
|
+
const escape = (text) => text.replace(/[<&]/g, (c) => c === "<" ? "<" : "&");
|
|
430
|
+
const name = escape(app.productName);
|
|
431
|
+
const loading = app.loading;
|
|
432
|
+
const message = loading?.message ? escape(loading.message) : `Starting ${name}…`;
|
|
433
|
+
const pageColor = art.background?.color ?? null;
|
|
434
|
+
const background = pageColor?.light ?? loading?.background ?? "#0f1115";
|
|
435
|
+
const color = loading?.color ?? "#e6e8eb";
|
|
436
|
+
const accent = loading?.accent ?? "#4ade80";
|
|
437
|
+
const dark = loading?.dark;
|
|
438
|
+
const darkBackground = pageColor?.dark ?? dark?.background;
|
|
439
|
+
const darkVars = dark || darkBackground ? `
|
|
440
|
+
@media (prefers-color-scheme: dark) {
|
|
441
|
+
:root {
|
|
442
|
+
--bg: ${darkBackground ?? background};
|
|
443
|
+
--fg: ${dark?.color ?? color};
|
|
444
|
+
--accent: ${dark?.accent ?? accent};
|
|
445
|
+
}
|
|
446
|
+
}` : "";
|
|
447
|
+
const attr = (text) => text.replace(/&/g, "&").replace(/"/g, """);
|
|
448
|
+
const layersTag = art.background && art.background.layers.length > 0 ? `<div class="layers" aria-hidden="true">
|
|
449
|
+
${art.background.layers.map((layer) => layer.dark ? `<picture>
|
|
450
|
+
<source srcset="${attr(layer.dark)}" media="(prefers-color-scheme: dark)" />
|
|
451
|
+
<img src="${attr(layer.light)}" alt="" style="${attr(layer.style)}" />
|
|
452
|
+
</picture>` : `<img src="${attr(layer.light)}" alt="" style="${attr(layer.style)}" />`).join("\n ")}
|
|
453
|
+
</div>
|
|
454
|
+
` : "";
|
|
455
|
+
const picture = (cls, file, darkFile, attrs = "") => darkFile ? `<picture>
|
|
456
|
+
<source srcset="./${darkFile}" media="(prefers-color-scheme: dark)" />
|
|
457
|
+
<img class="${cls}" src="./${file}" alt=""${attrs} />
|
|
458
|
+
</picture>
|
|
459
|
+
` : `<img class="${cls}" src="./${file}" alt=""${attrs} />
|
|
460
|
+
`;
|
|
461
|
+
const main = art.main;
|
|
462
|
+
const logoTag = main?.kind === "splash" ? picture("splash", main.file, main.dark) : main ? picture("logo", main.file, main.dark, ` width="${LOGO_CSS_PX}" height="${LOGO_CSS_PX}"`) : "";
|
|
463
|
+
const cornerTag = art.corner ? `<div class="corner" aria-hidden="true">${picture("art", art.corner.file, art.corner.dark)}</div>
|
|
464
|
+
` : "";
|
|
260
465
|
return `<!doctype html>
|
|
261
466
|
<html lang="en">
|
|
262
467
|
<head>
|
|
263
468
|
<meta charset="utf-8" />
|
|
264
469
|
<title>${name}</title>
|
|
265
470
|
<style>
|
|
266
|
-
:root {
|
|
471
|
+
:root {
|
|
472
|
+
color-scheme: light dark;
|
|
473
|
+
--bg: ${background}; --fg: ${color}; --accent: ${accent};
|
|
474
|
+
}${darkVars}
|
|
267
475
|
body {
|
|
268
|
-
margin: 0; height: 100vh;
|
|
476
|
+
margin: 0; height: 100vh; overflow: hidden;
|
|
269
477
|
display: flex; align-items: center; justify-content: center;
|
|
270
478
|
font: 15px/1.5 ui-sans-serif, system-ui, -apple-system, "Segoe UI", sans-serif;
|
|
271
|
-
background:
|
|
479
|
+
background: var(--bg); color: var(--fg);
|
|
272
480
|
}
|
|
273
481
|
.box {
|
|
482
|
+
position: relative; z-index: 1;
|
|
274
483
|
text-align: center;
|
|
275
484
|
display: flex; flex-direction: column; align-items: center; gap: 20px;
|
|
276
485
|
}
|
|
@@ -278,9 +487,19 @@ function loadingHtml(productName, logo) {
|
|
|
278
487
|
width: ${LOGO_CSS_PX}px; height: ${LOGO_CSS_PX}px;
|
|
279
488
|
object-fit: contain; display: block;
|
|
280
489
|
}
|
|
490
|
+
.splash {
|
|
491
|
+
width: min(720px, 80vw); max-height: 65vh;
|
|
492
|
+
object-fit: contain; display: block;
|
|
493
|
+
}
|
|
494
|
+
.corner {
|
|
495
|
+
position: fixed; right: 0; bottom: 0; z-index: 0;
|
|
496
|
+
width: clamp(220px, 30vw, 520px); line-height: 0; pointer-events: none;
|
|
497
|
+
}
|
|
498
|
+
.layers { position: fixed; inset: 0; z-index: 0; }
|
|
499
|
+
.art { width: 100%; height: auto; display: block; }
|
|
281
500
|
.dot {
|
|
282
501
|
width: 10px; height: 10px; border-radius: 50%;
|
|
283
|
-
background:
|
|
502
|
+
background: var(--accent); display: inline-block; margin-right: 8px;
|
|
284
503
|
animation: pulse 1.2s ease-in-out infinite;
|
|
285
504
|
}
|
|
286
505
|
@keyframes pulse { 0%,100% { opacity: .35 } 50% { opacity: 1 } }
|
|
@@ -289,9 +508,9 @@ function loadingHtml(productName, logo) {
|
|
|
289
508
|
</head>
|
|
290
509
|
<body>
|
|
291
510
|
<div class="box">
|
|
292
|
-
${logoTag}<div><span class="dot"></span
|
|
511
|
+
${logoTag}<div><span class="dot"></span>${message}</div>
|
|
293
512
|
</div>
|
|
294
|
-
|
|
513
|
+
${layersTag}${cornerTag}</body>
|
|
295
514
|
</html>
|
|
296
515
|
`;
|
|
297
516
|
}
|
|
@@ -316,6 +535,8 @@ function tauriConf(input) {
|
|
|
316
535
|
width: win.width ?? 1440,
|
|
317
536
|
height: win.height ?? 900,
|
|
318
537
|
resizable: win.resizable ?? true,
|
|
538
|
+
...win.minWidth ? { minWidth: win.minWidth } : {},
|
|
539
|
+
...win.minHeight ? { minHeight: win.minHeight } : {},
|
|
319
540
|
visible: true,
|
|
320
541
|
dragDropEnabled: false,
|
|
321
542
|
create: false
|
|
@@ -393,6 +614,11 @@ const GITIGNORE = `# Generated tauri shell — only Cargo.lock and app-icon.png
|
|
|
393
614
|
/gen
|
|
394
615
|
/icons
|
|
395
616
|
/ui/logo.png
|
|
617
|
+
/ui/splash.png
|
|
618
|
+
/ui/splash-dark.png
|
|
619
|
+
/ui/art.*
|
|
620
|
+
/ui/art-dark.*
|
|
621
|
+
/ui/bg-*
|
|
396
622
|
/dist-stack
|
|
397
623
|
/binaries
|
|
398
624
|
`;
|
|
@@ -419,12 +645,63 @@ function projectShell(input) {
|
|
|
419
645
|
const shellDir = path.join(hostDir, SHELL_DIR);
|
|
420
646
|
const iconSrc = path.resolve(hostDir, app.icon);
|
|
421
647
|
const iconBytes = fs.existsSync(iconSrc) ? fs.readFileSync(iconSrc) : null;
|
|
648
|
+
const readRel = (rel) => {
|
|
649
|
+
if (!rel) return null;
|
|
650
|
+
const abs = path.resolve(hostDir, rel);
|
|
651
|
+
return fs.existsSync(abs) ? fs.readFileSync(abs) : null;
|
|
652
|
+
};
|
|
653
|
+
const splashBytes = readRel(app.splash);
|
|
654
|
+
const splashDarkBytes = readRel(app.splashDark);
|
|
655
|
+
const artBytes = readRel(app.loading?.art);
|
|
656
|
+
const artDarkBytes = readRel(app.loading?.artDark);
|
|
657
|
+
const artExt = (rel) => rel ? path.extname(rel).toLowerCase() || ".png" : ".png";
|
|
658
|
+
const artFile = `art${artExt(app.loading?.art)}`;
|
|
659
|
+
const artDarkFile = `art-dark${artExt(app.loading?.artDark)}`;
|
|
660
|
+
const background = normalizeBackground(app.background);
|
|
661
|
+
const staged = [];
|
|
662
|
+
const stage = (ref, stem) => {
|
|
663
|
+
if (isPassthroughImageRef(ref)) return ref;
|
|
664
|
+
const abs = path.resolve(hostDir, ref);
|
|
665
|
+
if (!fs.existsSync(abs)) return void 0;
|
|
666
|
+
const file = `${stem}${artExt(ref)}`;
|
|
667
|
+
staged.push([path.join(shellDir, "ui", file), fs.readFileSync(abs)]);
|
|
668
|
+
return `./${file}`;
|
|
669
|
+
};
|
|
670
|
+
const layers = (background?.layers ?? []).flatMap((layer, index) => {
|
|
671
|
+
const variants = imageVariants(layer.src);
|
|
672
|
+
const light = stage(variants.light, `bg-${index}`);
|
|
673
|
+
if (!light) return [];
|
|
674
|
+
const dark = variants.dark ? stage(variants.dark, `bg-${index}-dark`) : void 0;
|
|
675
|
+
return [{
|
|
676
|
+
light,
|
|
677
|
+
...dark ? { dark } : {},
|
|
678
|
+
style: layerStyleText(layer)
|
|
679
|
+
}];
|
|
680
|
+
});
|
|
681
|
+
const art = {
|
|
682
|
+
main: background ? null : splashBytes ? {
|
|
683
|
+
kind: "splash",
|
|
684
|
+
file: LOADING_SPLASH,
|
|
685
|
+
...splashDarkBytes ? { dark: LOADING_SPLASH_DARK } : {}
|
|
686
|
+
} : iconBytes ? {
|
|
687
|
+
kind: "logo",
|
|
688
|
+
file: LOADING_LOGO
|
|
689
|
+
} : null,
|
|
690
|
+
corner: !background && artBytes ? {
|
|
691
|
+
file: artFile,
|
|
692
|
+
...artDarkBytes ? { dark: artDarkFile } : {}
|
|
693
|
+
} : null,
|
|
694
|
+
background: background ? {
|
|
695
|
+
color: colorVariants(background.color),
|
|
696
|
+
layers
|
|
697
|
+
} : null
|
|
698
|
+
};
|
|
422
699
|
const files = [
|
|
423
700
|
["Cargo.toml", cargoToml(app, binName)],
|
|
424
701
|
["src/main.rs", MAIN_RS],
|
|
425
702
|
["build.rs", BUILD_RS],
|
|
426
703
|
["tauri.conf.json", tauriConf(input)],
|
|
427
|
-
["ui/index.html", loadingHtml(app
|
|
704
|
+
["ui/index.html", loadingHtml(app, art)],
|
|
428
705
|
["capabilities/default.json", defaultCapability()],
|
|
429
706
|
["capabilities/connect.json", connectCapability(connectPort)],
|
|
430
707
|
[".gitignore", GITIGNORE],
|
|
@@ -432,10 +709,20 @@ function projectShell(input) {
|
|
|
432
709
|
];
|
|
433
710
|
let changed = false;
|
|
434
711
|
for (const [rel, content] of files) if (writeIfChanged(path.join(shellDir, rel), content)) changed = true;
|
|
435
|
-
|
|
436
|
-
|
|
712
|
+
const copies = [
|
|
713
|
+
[path.join(shellDir, ICON_SOURCE), iconBytes],
|
|
714
|
+
[path.join(shellDir, "ui", LOADING_LOGO), iconBytes],
|
|
715
|
+
[path.join(shellDir, "ui", LOADING_SPLASH), splashBytes],
|
|
716
|
+
[path.join(shellDir, "ui", LOADING_SPLASH_DARK), splashDarkBytes],
|
|
717
|
+
[path.join(shellDir, "ui", artFile), artBytes],
|
|
718
|
+
[path.join(shellDir, "ui", artDarkFile), artDarkBytes],
|
|
719
|
+
...staged
|
|
720
|
+
];
|
|
721
|
+
for (const [dest, bytes] of copies) {
|
|
722
|
+
if (!bytes) continue;
|
|
723
|
+
if (!fs.existsSync(dest) || !fs.readFileSync(dest).equals(bytes)) {
|
|
437
724
|
fs.mkdirSync(path.dirname(dest), { recursive: true });
|
|
438
|
-
fs.writeFileSync(dest,
|
|
725
|
+
fs.writeFileSync(dest, bytes);
|
|
439
726
|
changed = true;
|
|
440
727
|
}
|
|
441
728
|
}
|
|
@@ -671,4 +958,4 @@ function launchShell(shell, envVars, options) {
|
|
|
671
958
|
//#endregion
|
|
672
959
|
export { loadAppJson as S, bundleStack as _, tauriConfigPatch as a, appJsonSchema as b, nodeSidecarTarget as c, runTauriIcon as d, tauriBundlesForHost as f, projectShell as g, SHELL_DIR as h, shellEnv as i, preflightOrThrow as l, ICON_SOURCE as m, resolvePhCliEntry as n, detectToolchain as o, tauriSpawn as p, resolveShell as r, fetchNodeSidecar as s, launchShell as t, resolveTauriCommand as u, APP_JSON_FILE as v, appSlug as x, DEFAULT_SHELL_CRATE_VERSION as y };
|
|
673
960
|
|
|
674
|
-
//# sourceMappingURL=shell-
|
|
961
|
+
//# sourceMappingURL=shell-C6KfHzBa.mjs.map
|