@1agh/maude 2.1.1 → 2.2.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/apps/studio/actions/agents.ts +18 -42
- package/apps/studio/actions/verbs.ts +49 -0
- package/apps/studio/actions.manifest.json +103 -19
- package/apps/studio/ai/create-claim.ts +1 -1
- package/apps/studio/bin/_asset-file.mjs +117 -0
- package/apps/studio/bin/_canvas-file.mjs +146 -0
- package/apps/studio/bin/_footage.mjs +123 -0
- package/apps/studio/bin/_pdf-playwright.mjs +14 -0
- package/apps/studio/bin/_png-playwright.mjs +15 -1
- package/apps/studio/bin/_pw-launch.mjs +98 -0
- package/apps/studio/bin/_retry-save.mjs +49 -0
- package/apps/studio/bin/_sync.mjs +145 -2
- package/apps/studio/bin/asset-rename.sh +12 -0
- package/apps/studio/bin/asset-trash.sh +12 -0
- package/apps/studio/bin/canvas-move.sh +12 -0
- package/apps/studio/bin/canvas-new.sh +12 -0
- package/apps/studio/bin/footage.sh +12 -0
- package/apps/studio/bin/generate.sh +7 -0
- package/apps/studio/bin/retry-save.sh +13 -0
- package/apps/studio/bridge/canvas-mode-store.ts +11 -2
- package/apps/studio/bridge/dgn-protocol.ts +8 -3
- package/apps/studio/bridge/occlusion.ts +45 -0
- package/apps/studio/canvas-theme-pill.tsx +182 -38
- package/apps/studio/client/export-center.jsx +32 -3
- package/apps/studio/client/home/HomeAccountBanner.jsx +61 -0
- package/apps/studio/client/home/HomeAccountsChip.jsx +404 -0
- package/apps/studio/client/home/HomeConnection.jsx +4 -3
- package/apps/studio/client/home/ProjectRows.jsx +514 -0
- package/apps/studio/client/home/home-accounts-model.js +148 -99
- package/apps/studio/client/home/home-api.js +4 -0
- package/apps/studio/client/home/home-app.jsx +127 -432
- package/apps/studio/client/home/home-icons.jsx +8 -0
- package/apps/studio/client/home/home-model.js +109 -0
- package/apps/studio/client/home/home.css +447 -111
- package/apps/studio/client/home/use-account-fix.js +123 -0
- package/apps/studio/client/v2/assets/generate-ask.jsx +3 -1
- package/apps/studio/client/v2/export/done-toast.jsx +2 -5
- package/apps/studio/client/v2/export/export-sheet.jsx +9 -2
- package/apps/studio/client/v2/export/export.css +9 -0
- package/apps/studio/client/v2/export/exports-model.js +16 -3
- package/apps/studio/client/v2/export/file-rows.jsx +81 -5
- package/apps/studio/client/v2/export/native-save.js +33 -0
- package/apps/studio/client/v2/export/sections/print-copy.js +3 -0
- package/apps/studio/client/v2/export/sections/print.jsx +37 -20
- package/apps/studio/client/v2/shell/occlusion-insets.js +37 -9
- package/apps/studio/client/v2/shell/use-occluded-insets.js +13 -3
- package/apps/studio/collab/room.ts +21 -7
- package/apps/studio/dist/client.bundle.js +692 -692
- package/apps/studio/dist/comment-mount.js +2 -2
- package/apps/studio/dist/styles.css +1 -1
- package/apps/studio/exporters/ghostscript.ts +78 -1
- package/apps/studio/exporters/pdf-fonts.ts +31 -4
- package/apps/studio/generation/jobs.ts +6 -0
- package/apps/studio/http.ts +6 -2
- package/apps/studio/routes/agent.ts +6 -2
- package/apps/studio/routes/project-undo.ts +10 -0
- package/apps/studio/server.ts +25 -0
- package/apps/studio/shell/cli-yield.ts +48 -11
- package/apps/studio/whats-new.json +18 -0
- package/cli/commands/design.mjs +74 -16
- package/cli/lib/bash-guard.mjs +4 -4
- package/cli/lib/confine-read.mjs +2 -0
- package/cli/lib/design-help.gen.mjs +15 -2
- package/cli/lib/design-hook.mjs +1 -1
- package/cli/lib/desktop-locate.mjs +36 -8
- package/cli/lib/studio-locate.mjs +8 -2
- package/cli/lib/sub-verbs.mjs +13 -1
- package/package.json +8 -8
- package/plugins/flow/.claude-plugin/config.schema.json +11 -1
- package/apps/studio/client/home/HomeAccounts.jsx +0 -262
- package/apps/studio/client/home/HomeAccountsRow.jsx +0 -221
|
@@ -0,0 +1,123 @@
|
|
|
1
|
+
// client/home/use-account-fix.js — 2.1.2 HB1: one account's "Sign in again" / "Sign in", shared by the
|
|
2
|
+
// banner on top of Home (artboard 16) and the accounts list behind the chip (artboard 17), so both show
|
|
3
|
+
// the same "Waiting…" and the same plain-words error. Moved here from the 2.1.1 accounts row (B4):
|
|
4
|
+
// cloud-signin Home's own Maude Cloud sign-in for THAT profile (`onCloudSignIn`, home-app drops a
|
|
5
|
+
// dead credential first)
|
|
6
|
+
// hub-signin the team-server sign-in with the address filled in: start → open the browser → poll
|
|
7
|
+
// until the server vouched → `onChanged` (Home reloads)
|
|
8
|
+
// A person's click starts it; nothing here retries on its own.
|
|
9
|
+
|
|
10
|
+
import { useCallback, useEffect, useRef, useState } from 'react';
|
|
11
|
+
|
|
12
|
+
import {
|
|
13
|
+
hubSignInCancel,
|
|
14
|
+
hubSignInPoll,
|
|
15
|
+
hubSignInStart,
|
|
16
|
+
openTeamServerSignIn,
|
|
17
|
+
} from './home-api.js';
|
|
18
|
+
|
|
19
|
+
const POLL_MS = 1200;
|
|
20
|
+
export const SIGNIN_WORDS = Object.freeze({
|
|
21
|
+
unreachable: 'Couldn’t reach that server. Check the address, or whether it’s online.',
|
|
22
|
+
noBrowser: 'The browser didn’t open. Nothing changed — try again.',
|
|
23
|
+
refused: 'That sign-in page can’t be opened from here. Nothing changed.',
|
|
24
|
+
});
|
|
25
|
+
/** The fix button while the browser has the sign-in (short: it sits on a narrow line). */
|
|
26
|
+
export const WAITING_WORD = 'Waiting…';
|
|
27
|
+
|
|
28
|
+
/**
|
|
29
|
+
* @param {{ onCloudSignIn: (card: object) => unknown, onChanged?: () => unknown, pollMs?: number }} in
|
|
30
|
+
* @returns {{ busy: string|null, error: string|null, clearError: () => void,
|
|
31
|
+
* fix: (card: object) => Promise<void> }}
|
|
32
|
+
*/
|
|
33
|
+
export function useAccountFix({ onCloudSignIn, onChanged, pollMs = POLL_MS }) {
|
|
34
|
+
const [busy, setBusy] = useState(null); // the card key whose sign-in waits on the browser
|
|
35
|
+
const [error, setError] = useState(null);
|
|
36
|
+
const attempt = useRef(null); // { id, stop }
|
|
37
|
+
|
|
38
|
+
// leaving Home ends the attempt that waits
|
|
39
|
+
useEffect(
|
|
40
|
+
() => () => {
|
|
41
|
+
const a = attempt.current;
|
|
42
|
+
attempt.current = null;
|
|
43
|
+
if (a) {
|
|
44
|
+
a.stop();
|
|
45
|
+
void hubSignInCancel(a.id);
|
|
46
|
+
}
|
|
47
|
+
},
|
|
48
|
+
[]
|
|
49
|
+
);
|
|
50
|
+
|
|
51
|
+
const waitForBrowser = useCallback(
|
|
52
|
+
(id) =>
|
|
53
|
+
new Promise((resolve) => {
|
|
54
|
+
let timer = null;
|
|
55
|
+
const stop = () => {
|
|
56
|
+
clearTimeout(timer);
|
|
57
|
+
resolve({ ok: false, cancelled: true });
|
|
58
|
+
};
|
|
59
|
+
attempt.current = { id, stop };
|
|
60
|
+
const tick = async () => {
|
|
61
|
+
const p = await hubSignInPoll(id);
|
|
62
|
+
if (attempt.current?.id !== id) return;
|
|
63
|
+
if (p.json?.pending) {
|
|
64
|
+
timer = setTimeout(tick, pollMs);
|
|
65
|
+
return;
|
|
66
|
+
}
|
|
67
|
+
attempt.current = null;
|
|
68
|
+
resolve(
|
|
69
|
+
p.ok && p.json?.ok
|
|
70
|
+
? { ok: true }
|
|
71
|
+
: { ok: false, error: p.json?.error || SIGNIN_WORDS.unreachable }
|
|
72
|
+
);
|
|
73
|
+
};
|
|
74
|
+
timer = setTimeout(tick, 0);
|
|
75
|
+
}),
|
|
76
|
+
[pollMs]
|
|
77
|
+
);
|
|
78
|
+
|
|
79
|
+
const fixServer = useCallback(
|
|
80
|
+
async (card) => {
|
|
81
|
+
setError(null);
|
|
82
|
+
setBusy(card.key);
|
|
83
|
+
const s = await hubSignInStart(card.fix.profile, card.fix.url);
|
|
84
|
+
if (!s.ok || !s.json?.ok) {
|
|
85
|
+
setBusy(null);
|
|
86
|
+
setError(s.json?.error || SIGNIN_WORDS.unreachable);
|
|
87
|
+
return;
|
|
88
|
+
}
|
|
89
|
+
const id = s.json.id;
|
|
90
|
+
const opened = await openTeamServerSignIn(s.json.signInUrl);
|
|
91
|
+
if (opened !== 'ok') {
|
|
92
|
+
void hubSignInCancel(id);
|
|
93
|
+
setBusy(null);
|
|
94
|
+
setError(opened === 'refused' ? SIGNIN_WORDS.refused : SIGNIN_WORDS.noBrowser);
|
|
95
|
+
return;
|
|
96
|
+
}
|
|
97
|
+
const done = await waitForBrowser(id);
|
|
98
|
+
setBusy(null);
|
|
99
|
+
if (done.cancelled) return;
|
|
100
|
+
if (!done.ok) {
|
|
101
|
+
setError(done.error);
|
|
102
|
+
return;
|
|
103
|
+
}
|
|
104
|
+
await onChanged?.();
|
|
105
|
+
},
|
|
106
|
+
[onChanged, waitForBrowser]
|
|
107
|
+
);
|
|
108
|
+
|
|
109
|
+
const fix = useCallback(
|
|
110
|
+
async (card) => {
|
|
111
|
+
if (!card?.fix || busy) return;
|
|
112
|
+
if (card.fix.path === 'cloud-signin') {
|
|
113
|
+
setError(null);
|
|
114
|
+
await onCloudSignIn(card);
|
|
115
|
+
return;
|
|
116
|
+
}
|
|
117
|
+
await fixServer(card);
|
|
118
|
+
},
|
|
119
|
+
[busy, onCloudSignIn, fixServer]
|
|
120
|
+
);
|
|
121
|
+
|
|
122
|
+
return { busy, error, clearError: () => setError(null), fix };
|
|
123
|
+
}
|
|
@@ -25,7 +25,9 @@ const POLL_LIMIT_MS = 10 * 60 * 1000;
|
|
|
25
25
|
const KEY_POLL_MS = 2000;
|
|
26
26
|
const KEY_WAIT_LIMIT_MS = 10 * 60 * 1000;
|
|
27
27
|
// The provider the key sheet names ("Connect a Google key?"). A key that lands is only ever quoted on this one.
|
|
28
|
-
|
|
28
|
+
// The registry id of Google's adapter (generation/adapters/gemini.ts) — 'google' named no provider, so the waiting
|
|
29
|
+
// prompt never saw a key added in Settings (#218; test/218-key-sheet-provider.test.ts).
|
|
30
|
+
export const SHEET_PROVIDER = 'gemini';
|
|
29
31
|
|
|
30
32
|
export const ASK_WORDS = {
|
|
31
33
|
title: 'Generate an image',
|
|
@@ -13,15 +13,12 @@ import { isNativeApp } from '../../github.js';
|
|
|
13
13
|
import { DegradedNote, ProgressBar } from './job-row.jsx';
|
|
14
14
|
import { progressPct, toastWords } from './exports-model.js';
|
|
15
15
|
|
|
16
|
-
const folderOf = (p) =>
|
|
17
|
-
typeof p === 'string' && p ? (p.split(/[\\/]/).filter(Boolean).slice(-2, -1)[0] ?? null) : null;
|
|
18
|
-
|
|
19
16
|
function JobNotice({ job, center, say, native }) {
|
|
20
17
|
const saving = center.savingIds.has(job.id);
|
|
21
18
|
const pending = job.status === 'queued' || job.status === 'running';
|
|
22
19
|
const id = `export-${job.id}`;
|
|
23
|
-
|
|
24
|
-
const w = toastWords(job, { native,
|
|
20
|
+
// fix-bulk B5: the file this Mac wrote — its own name (a clash makes "name (2).pdf") and its folder
|
|
21
|
+
const w = toastWords(job, { native, saved: center.savedPaths?.get(job.id) ?? null });
|
|
25
22
|
|
|
26
23
|
useEffect(() => {
|
|
27
24
|
const act = () => {
|
|
@@ -49,8 +49,9 @@ import {
|
|
|
49
49
|
FILE_NAMES_TEMPLATE,
|
|
50
50
|
FOLDERS_OPTIONS,
|
|
51
51
|
FileRows,
|
|
52
|
+
effectiveSaveTo,
|
|
52
53
|
fileNamesPick,
|
|
53
|
-
|
|
54
|
+
useSaveFolder,
|
|
54
55
|
} from './file-rows.jsx';
|
|
55
56
|
import { fitBox, Pic, PreviewColumn, sizeLine, useBoardPicture } from './preview.jsx';
|
|
56
57
|
import { AccessLine, exportAccess } from './access-line.jsx';
|
|
@@ -216,6 +217,8 @@ export function ExportSheet({
|
|
|
216
217
|
|
|
217
218
|
const [busy, setBusy] = useState(false);
|
|
218
219
|
const [status, setStatus] = useState(null); // { ok, msg }
|
|
220
|
+
// fix-bulk B5: Save to › the project's folder and Choose a folder… (the Mac app; a browser tab downloads)
|
|
221
|
+
const place = useSaveFolder();
|
|
219
222
|
// S8.5 — a video's Render row: cloud or this Mac (Suggest each time / always, export-lane.js)
|
|
220
223
|
const online = useOnline();
|
|
221
224
|
const [pickedLane, setPickedLane] = useState(null);
|
|
@@ -369,7 +372,10 @@ export function ExportSheet({
|
|
|
369
372
|
body: {
|
|
370
373
|
v: 2,
|
|
371
374
|
spec: withRenderLane(
|
|
372
|
-
withSaveTo(
|
|
375
|
+
withSaveTo(
|
|
376
|
+
waitForAi ? { ...spec, wait: 'ai' } : spec,
|
|
377
|
+
effectiveSaveTo(state.saveTo, place)
|
|
378
|
+
),
|
|
373
379
|
render
|
|
374
380
|
),
|
|
375
381
|
},
|
|
@@ -508,6 +514,7 @@ export function ExportSheet({
|
|
|
508
514
|
onName={single ? (stem) => set({ adv: { ...(state.adv ?? {}), nameTemplate: stem } }) : null}
|
|
509
515
|
saveTo={state.saveTo}
|
|
510
516
|
onSaveTo={(saveTo) => set({ saveTo })}
|
|
517
|
+
place={place}
|
|
511
518
|
folders={
|
|
512
519
|
batch ? (
|
|
513
520
|
state.scope === 'selection' ? (
|
|
@@ -626,6 +626,15 @@
|
|
|
626
626
|
margin: -3px 0;
|
|
627
627
|
color: var(--accent-text);
|
|
628
628
|
}
|
|
629
|
+
/* fix-bulk B6: the print warnings' slot holds a two-line warning's height before one arrives (the safe-margin
|
|
630
|
+
line wraps beside Show on canvas), so the preflight answering does not grow the centred sheet and move
|
|
631
|
+
the Export button under the pointer */
|
|
632
|
+
.ex-print-warns {
|
|
633
|
+
display: flex;
|
|
634
|
+
flex-direction: column;
|
|
635
|
+
gap: var(--space-1, 4px);
|
|
636
|
+
min-height: calc(2 * var(--space-2, 8px) + 2 * var(--lh-sm, 1.4) * var(--type-sm, 13px));
|
|
637
|
+
}
|
|
629
638
|
/* 09 ex-huge: the Include row's ticks sit side by side */
|
|
630
639
|
.ex-checks.ex-checks--row {
|
|
631
640
|
flex-direction: row;
|
|
@@ -307,7 +307,20 @@ export function fileNames(job) {
|
|
|
307
307
|
* @returns {{ kind: 'info'|'success'|'warning'|'error', title: string, text: string,
|
|
308
308
|
* action: 'reveal'|'download'|'retry'|'open', label: string }}
|
|
309
309
|
*/
|
|
310
|
-
|
|
310
|
+
/** The file a save wrote, as `{ name, folder }` (`/a/Downloads/x (2).pdf` → `x (2).pdf`, `Downloads`). */
|
|
311
|
+
export function savedParts(path) {
|
|
312
|
+
if (typeof path !== 'string' || !path) return { name: null, folder: null };
|
|
313
|
+
const parts = path.split(/[\\/]/).filter(Boolean);
|
|
314
|
+
return { name: parts.at(-1) ?? null, folder: parts.at(-2) ?? null };
|
|
315
|
+
}
|
|
316
|
+
|
|
317
|
+
/**
|
|
318
|
+
* @param saved the path this Mac saved the job to (fix-bulk B5): the toast names the file it became — a clash in
|
|
319
|
+
* the folder makes `name (2).pdf` — and the folder it went to.
|
|
320
|
+
*/
|
|
321
|
+
export function toastWords(job, { native = false, folder: folderIn = null, saved = null } = {}) {
|
|
322
|
+
const got = savedParts(saved);
|
|
323
|
+
const folder = got.folder ?? folderIn;
|
|
311
324
|
const fmt = formatLabel(job);
|
|
312
325
|
if (isActive(job)) {
|
|
313
326
|
return {
|
|
@@ -354,8 +367,8 @@ export function toastWords(job, { native = false, folder = null } = {}) {
|
|
|
354
367
|
};
|
|
355
368
|
}
|
|
356
369
|
const n = fileNames(job).length;
|
|
357
|
-
const
|
|
358
|
-
|
|
370
|
+
const name = got.name ?? job?.filename;
|
|
371
|
+
const what = n > 1 ? `Exported ${n} files` : `Exported ${name ? `“${stemOf(name)}”` : fmt}`;
|
|
359
372
|
return {
|
|
360
373
|
kind: 'success',
|
|
361
374
|
title: 'Export ready',
|
|
@@ -4,9 +4,17 @@
|
|
|
4
4
|
// The name is what the file will be called — the SERVER's own naming (`renderStem`) run on this export's names, so the
|
|
5
5
|
// field shows exactly what lands on disk. One file: the field is editable (what you type becomes the pattern); several:
|
|
6
6
|
// it shows the first name and "and N more", and the pattern stays under Advanced › File names. Save to is the spec's
|
|
7
|
-
// `options.saveTo`: Downloads, or ask each time.
|
|
7
|
+
// `options.saveTo`: Downloads, the project's own folder, or ask each time.
|
|
8
|
+
//
|
|
9
|
+
// fix-bulk B5 — the Mac app saves into ANY folder: "Choose a folder…" opens the shell's folder picker
|
|
10
|
+
// (`pick_export_folder`, which checks the folder and keeps it per project in the app's own state, never in the
|
|
11
|
+
// project), and the folder picked is the `remembered` choice, named by its own name. The next sheet opens on it.
|
|
12
|
+
// The path never travels to the server: the shell writes the file (export_save.rs), so no page origin can name a
|
|
13
|
+
// folder. A browser tab can only download — it offers Downloads alone.
|
|
8
14
|
|
|
15
|
+
import { useEffect, useState } from 'react';
|
|
9
16
|
import { Select } from './advanced/fields.jsx';
|
|
17
|
+
import { nativeSave } from './native-save.js';
|
|
10
18
|
import { Row } from './parts.jsx';
|
|
11
19
|
|
|
12
20
|
export const SAVE_TO_OPTIONS = [
|
|
@@ -14,6 +22,58 @@ export const SAVE_TO_OPTIONS = [
|
|
|
14
22
|
['ask', 'Ask each time'],
|
|
15
23
|
];
|
|
16
24
|
export const SAVE_TO_DEFAULT = 'downloads';
|
|
25
|
+
/** The Select's "Choose a folder…" value: an action, never a `saveTo`. */
|
|
26
|
+
export const SAVE_TO_CHOOSE = 'choose';
|
|
27
|
+
export const CHOOSE_FOLDER = 'Choose a folder…';
|
|
28
|
+
export const LAST_FOLDER = 'Last folder';
|
|
29
|
+
|
|
30
|
+
const folderName = (p) =>
|
|
31
|
+
String(p ?? '')
|
|
32
|
+
.split(/[\\/]/)
|
|
33
|
+
.filter(Boolean)
|
|
34
|
+
.at(-1) ?? null;
|
|
35
|
+
|
|
36
|
+
/** Save to's choices: a browser tab downloads; the Mac app adds the project's folder, Choose a folder… and Ask. */
|
|
37
|
+
export function saveToOptions({ native = false, folder = null, value = null } = {}) {
|
|
38
|
+
if (!native) return [['downloads', 'Downloads']];
|
|
39
|
+
const out = [['downloads', 'Downloads']];
|
|
40
|
+
if (folder || value === 'remembered')
|
|
41
|
+
out.push(['remembered', (folder && folderName(folder)) || LAST_FOLDER]);
|
|
42
|
+
out.push([SAVE_TO_CHOOSE, CHOOSE_FOLDER], ['ask', 'Ask each time']);
|
|
43
|
+
return out;
|
|
44
|
+
}
|
|
45
|
+
|
|
46
|
+
/** What the sheet sends: the person's pick, else the project's folder when it has one, else Downloads. */
|
|
47
|
+
export function effectiveSaveTo(picked, { native = false, folder = null } = {}) {
|
|
48
|
+
if (!native) return SAVE_TO_DEFAULT;
|
|
49
|
+
if (picked) return picked;
|
|
50
|
+
return folder ? 'remembered' : SAVE_TO_DEFAULT;
|
|
51
|
+
}
|
|
52
|
+
|
|
53
|
+
/**
|
|
54
|
+
* The project's save folder and the picker, for the sheet. `doors` is `nativeSave()` (a test hands its own).
|
|
55
|
+
* @returns {{ native: boolean, folder: string|null, choose: () => Promise<boolean> }}
|
|
56
|
+
*/
|
|
57
|
+
export function useSaveFolder(doors) {
|
|
58
|
+
const [d] = useState(() => doors ?? nativeSave());
|
|
59
|
+
const [folder, setFolder] = useState(null);
|
|
60
|
+
useEffect(() => {
|
|
61
|
+
if (!d.available) return undefined;
|
|
62
|
+
let alive = true;
|
|
63
|
+
d.folder().then((f) => {
|
|
64
|
+
if (alive) setFolder(f);
|
|
65
|
+
});
|
|
66
|
+
return () => {
|
|
67
|
+
alive = false;
|
|
68
|
+
};
|
|
69
|
+
}, [d]);
|
|
70
|
+
const choose = async () => {
|
|
71
|
+
const r = await d.pickFolder();
|
|
72
|
+
if (r.ok) setFolder(r.path);
|
|
73
|
+
return r.ok === true;
|
|
74
|
+
};
|
|
75
|
+
return { native: d.available, folder, choose };
|
|
76
|
+
}
|
|
17
77
|
|
|
18
78
|
/** 09 ex-batch-pick — the "File names" row of several picked artboards: the pattern, by its two plain readings. */
|
|
19
79
|
export const FILE_NAMES_OPTIONS = [
|
|
@@ -40,9 +100,25 @@ const extOf = (file) => /(\.[A-Za-z0-9]{2,5})$/.exec(String(file ?? ''))?.[1] ??
|
|
|
40
100
|
* @param more how many files beyond the first this export makes
|
|
41
101
|
* @param onName (pattern) => void — only for a single file
|
|
42
102
|
* @param folders a batch's `Folders` row, drawn instead of `File name` (a select + the path it makes)
|
|
103
|
+
* @param place `useSaveFolder()` — the Mac app's folder and picker (absent: Downloads / Ask, as before)
|
|
43
104
|
*/
|
|
44
|
-
export function FileRows({
|
|
105
|
+
export function FileRows({
|
|
106
|
+
file,
|
|
107
|
+
more = 0,
|
|
108
|
+
onName,
|
|
109
|
+
saveTo,
|
|
110
|
+
onSaveTo,
|
|
111
|
+
folders = null,
|
|
112
|
+
place = null,
|
|
113
|
+
}) {
|
|
45
114
|
const single = more === 0 && typeof onName === 'function';
|
|
115
|
+
const value = place ? effectiveSaveTo(saveTo, place) : (saveTo ?? SAVE_TO_DEFAULT);
|
|
116
|
+
const options = place ? saveToOptions({ ...place, value }) : SAVE_TO_OPTIONS;
|
|
117
|
+
const pick = async (v) => {
|
|
118
|
+
if (v !== SAVE_TO_CHOOSE) return onSaveTo(v);
|
|
119
|
+
// the folder picked becomes this project's folder; a cancelled picker leaves Save to as it was
|
|
120
|
+
if (await place?.choose?.()) onSaveTo('remembered');
|
|
121
|
+
};
|
|
46
122
|
return (
|
|
47
123
|
<>
|
|
48
124
|
{folders ?? (
|
|
@@ -74,9 +150,9 @@ export function FileRows({ file, more = 0, onName, saveTo, onSaveTo, folders = n
|
|
|
74
150
|
<Select
|
|
75
151
|
label="Save to"
|
|
76
152
|
testid="export-save-to"
|
|
77
|
-
value={
|
|
78
|
-
options={
|
|
79
|
-
onChange={
|
|
153
|
+
value={value}
|
|
154
|
+
options={options}
|
|
155
|
+
onChange={pick}
|
|
80
156
|
/>
|
|
81
157
|
</Row>
|
|
82
158
|
</>
|
|
@@ -30,6 +30,9 @@ export const SAVE_COMMANDS = Object.freeze({
|
|
|
30
30
|
reveal: 'reveal_export',
|
|
31
31
|
copyPng: 'clipboard_write_png',
|
|
32
32
|
copyText: 'clipboard_write_text',
|
|
33
|
+
// fix-bulk B5: Save to › the project's last folder, and Choose a folder… (export_save.rs)
|
|
34
|
+
folder: 'export_folder',
|
|
35
|
+
pickFolder: 'pick_export_folder',
|
|
33
36
|
});
|
|
34
37
|
|
|
35
38
|
/** Mirrors export_save.rs `MAX_CLIPBOARD_TEXT` (UTF-8 bytes). */
|
|
@@ -120,6 +123,36 @@ export function nativeSave(win = typeof window !== 'undefined' ? window : null,
|
|
|
120
123
|
}
|
|
121
124
|
},
|
|
122
125
|
|
|
126
|
+
/**
|
|
127
|
+
* fix-bulk B5 — the folder `saveTo: 'remembered'` writes into for this project (app-state, never the
|
|
128
|
+
* project), or null: none yet, a browser tab, or the shell refused. Never throws.
|
|
129
|
+
*/
|
|
130
|
+
async folder() {
|
|
131
|
+
if (!invoke) return null;
|
|
132
|
+
try {
|
|
133
|
+
const p = await invoke(SAVE_COMMANDS.folder, {});
|
|
134
|
+
return typeof p === 'string' && p ? p : null;
|
|
135
|
+
} catch {
|
|
136
|
+
return null;
|
|
137
|
+
}
|
|
138
|
+
},
|
|
139
|
+
|
|
140
|
+
/**
|
|
141
|
+
* fix-bulk B5 — Choose a folder…: the native folder picker; the shell checks the folder and keeps it as the
|
|
142
|
+
* project's. `{ ok:true, path }`, `{ ok:false, reason:'cancelled' }`, or a refusal in the shell's words.
|
|
143
|
+
*/
|
|
144
|
+
async pickFolder() {
|
|
145
|
+
if (!invoke) return { ok: false, reason: 'browser' };
|
|
146
|
+
try {
|
|
147
|
+
const p = await invoke(SAVE_COMMANDS.pickFolder, {});
|
|
148
|
+
return typeof p === 'string' && p
|
|
149
|
+
? { ok: true, path: p }
|
|
150
|
+
: { ok: false, reason: 'cancelled' };
|
|
151
|
+
} catch (e) {
|
|
152
|
+
return { ok: false, reason: 'refused', error: words(e) };
|
|
153
|
+
}
|
|
154
|
+
},
|
|
155
|
+
|
|
123
156
|
async reveal(path) {
|
|
124
157
|
if (!invoke) return { ok: false, reason: 'browser' };
|
|
125
158
|
if (typeof path !== 'string' || path === '') {
|
|
@@ -13,6 +13,9 @@ export const BLEED_LABEL = 'Bleed';
|
|
|
13
13
|
export const CROP_LABEL = 'Crop marks';
|
|
14
14
|
export const CROP_SUB = 'where to cut — outside the bleed';
|
|
15
15
|
export const BACK_SUB = 'page 2 — the back of this artboard';
|
|
16
|
+
// fix-bulk B4 — Advanced › Text's "Turn text into shapes", as a tick of its own
|
|
17
|
+
export const OUTLINE_LABEL = 'Text as shapes';
|
|
18
|
+
export const OUTLINE_SUB = 'prints the same everywhere — no font needs to embed';
|
|
16
19
|
export const COLOUR_ROW = 'Colour';
|
|
17
20
|
/** The one colour line. Print is RGB; the shop converts (09 ex-print). */
|
|
18
21
|
export const COLOUR_LINE = 'RGB — the print shop converts to CMYK.';
|
|
@@ -26,6 +26,8 @@ import {
|
|
|
26
26
|
CROP_LABEL,
|
|
27
27
|
CROP_SUB,
|
|
28
28
|
LEGEND,
|
|
29
|
+
OUTLINE_LABEL,
|
|
30
|
+
OUTLINE_SUB,
|
|
29
31
|
PAPER_NONE,
|
|
30
32
|
PAPER_PENDING,
|
|
31
33
|
PRINT_FORMATS,
|
|
@@ -238,29 +240,44 @@ export function PrintSection({
|
|
|
238
240
|
{backLabel(c.back)}
|
|
239
241
|
</Check>
|
|
240
242
|
) : null}
|
|
243
|
+
{/* fix-bulk B4: Advanced › Text's `outline`, here because it is the most common print ask */}
|
|
244
|
+
<Check
|
|
245
|
+
checked={c.outlines}
|
|
246
|
+
sub={OUTLINE_SUB}
|
|
247
|
+
testid="export-print-outline"
|
|
248
|
+
onChange={(on) => setAdv({ text: on ? 'outline' : 'keep' })}
|
|
249
|
+
>
|
|
250
|
+
{OUTLINE_LABEL}
|
|
251
|
+
</Check>
|
|
241
252
|
</span>
|
|
242
253
|
</Row>
|
|
243
254
|
) : null}
|
|
244
|
-
{c.printPdf
|
|
245
|
-
|
|
246
|
-
|
|
247
|
-
|
|
248
|
-
|
|
249
|
-
|
|
250
|
-
|
|
251
|
-
|
|
252
|
-
|
|
253
|
-
|
|
254
|
-
|
|
255
|
-
|
|
256
|
-
|
|
257
|
-
|
|
258
|
-
|
|
259
|
-
|
|
260
|
-
|
|
261
|
-
|
|
262
|
-
|
|
263
|
-
|
|
255
|
+
{c.printPdf ? (
|
|
256
|
+
// fix-bulk B6: one slot for the print warnings, there (at one warning's height) before any arrives, so a
|
|
257
|
+
// warning that comes with the preflight does not grow the sheet and move the Export button
|
|
258
|
+
<div className="ex-print-warns" data-testid="export-print-warns">
|
|
259
|
+
{safeLine ? (
|
|
260
|
+
<Hint
|
|
261
|
+
icon="problem"
|
|
262
|
+
tone="warn"
|
|
263
|
+
testid="export-print-safe-warn"
|
|
264
|
+
action={SHOW_ON_CANVAS}
|
|
265
|
+
onAction={() => onShowOnCanvas?.(findings[0])}
|
|
266
|
+
>
|
|
267
|
+
{safeLine}
|
|
268
|
+
</Hint>
|
|
269
|
+
) : null}
|
|
270
|
+
{fonts ? (
|
|
271
|
+
<Hint icon="type" tone="warn" testid="export-print-font-warn">
|
|
272
|
+
{fonts}
|
|
273
|
+
</Hint>
|
|
274
|
+
) : null}
|
|
275
|
+
{c.outlines && (preflight?.fonts ?? []).some((f) => !f.embeddable) ? (
|
|
276
|
+
<Hint icon="type" testid="export-print-font-ok">
|
|
277
|
+
{OUTLINES_ON}
|
|
278
|
+
</Hint>
|
|
279
|
+
) : null}
|
|
280
|
+
</div>
|
|
264
281
|
) : null}
|
|
265
282
|
<Row k={COLOUR_ROW} testid="export-row-colour">
|
|
266
283
|
<span className="ex-val" data-testid="export-print-colour">
|
|
@@ -11,7 +11,7 @@
|
|
|
11
11
|
// Pure and DOM-free on purpose (the hook in use-occluded-insets.js owns the observers): `measure`,
|
|
12
12
|
// `send` and `schedule` are injected, so the pump is exercised headlessly.
|
|
13
13
|
|
|
14
|
-
import { insetsFromIslands, ZERO_INSETS } from '../../../bridge/occlusion.ts';
|
|
14
|
+
import { insetsFromIslands, topBandFromIslands, ZERO_INSETS } from '../../../bridge/occlusion.ts';
|
|
15
15
|
|
|
16
16
|
const EDGES = new Set(['top', 'right', 'bottom', 'left']);
|
|
17
17
|
|
|
@@ -44,9 +44,23 @@ const boxOf = (el) => {
|
|
|
44
44
|
* @param opts.presenting Present mode hides all chrome and the canvas uses 0 there — send zeros
|
|
45
45
|
*/
|
|
46
46
|
export function measureShellInsets(frameEl, root, { presenting = false } = {}) {
|
|
47
|
-
|
|
47
|
+
const m = frameAndIslands(frameEl, root, presenting);
|
|
48
|
+
return m ? insetsFromIslands(m.frame, m.islands) : { ...ZERO_INSETS };
|
|
49
|
+
}
|
|
50
|
+
|
|
51
|
+
/**
|
|
52
|
+
* #217 — the free top band between the top islands (project pill on the left, the Share cluster on the right),
|
|
53
|
+
* in frame px; the canvas centres its top-centre pill there. Null in Present, with no frame, or with no room.
|
|
54
|
+
*/
|
|
55
|
+
export function measureShellTopBand(frameEl, root, { presenting = false } = {}) {
|
|
56
|
+
const m = frameAndIslands(frameEl, root, presenting);
|
|
57
|
+
return m ? topBandFromIslands(m.frame, m.islands) : null;
|
|
58
|
+
}
|
|
59
|
+
|
|
60
|
+
function frameAndIslands(frameEl, root, presenting) {
|
|
61
|
+
if (presenting || !frameEl || !root) return null;
|
|
48
62
|
const frame = boxOf(frameEl);
|
|
49
|
-
if (!frame || !(frame.right > frame.left && frame.bottom > frame.top)) return
|
|
63
|
+
if (!frame || !(frame.right > frame.left && frame.bottom > frame.top)) return null;
|
|
50
64
|
const islands = [];
|
|
51
65
|
for (const el of root.querySelectorAll('[data-occludes]')) {
|
|
52
66
|
const edge = el.getAttribute('data-occludes');
|
|
@@ -54,7 +68,7 @@ export function measureShellInsets(frameEl, root, { presenting = false } = {}) {
|
|
|
54
68
|
const rect = boxOf(el);
|
|
55
69
|
if (rect) islands.push({ rect, edge });
|
|
56
70
|
}
|
|
57
|
-
return
|
|
71
|
+
return { frame, islands };
|
|
58
72
|
}
|
|
59
73
|
|
|
60
74
|
/**
|
|
@@ -92,26 +106,38 @@ export function seedOnLadder(pump, to, { alive = () => true, setTimer, clearTime
|
|
|
92
106
|
|
|
93
107
|
const same = (a, b) =>
|
|
94
108
|
a.top === b.top && a.right === b.right && a.bottom === b.bottom && a.left === b.left;
|
|
109
|
+
const sameBand = (a, b) => (a && b ? a.left === b.left && a.right === b.right : a === b);
|
|
95
110
|
|
|
96
111
|
/**
|
|
97
112
|
* @param measure () => Insets the current insets
|
|
98
|
-
* @param
|
|
113
|
+
* @param measureBand () => TopBand | null #217 — the free top band (optional; absent ⇒ never sent)
|
|
114
|
+
* @param send (seq, insets, to?, topBand?) => void `to` is undefined for "every canvas", a target for a
|
|
115
|
+
* seed; `topBand` is the band, or null when there is none to send
|
|
99
116
|
* @param schedule (fn) => handle requestAnimationFrame in the browser
|
|
100
117
|
* @param cancel (handle) => void
|
|
101
118
|
*/
|
|
102
|
-
export function createInsetsPump({
|
|
119
|
+
export function createInsetsPump({
|
|
120
|
+
measure,
|
|
121
|
+
measureBand = () => null,
|
|
122
|
+
send,
|
|
123
|
+
schedule,
|
|
124
|
+
cancel = () => {},
|
|
125
|
+
}) {
|
|
103
126
|
let seq = 0;
|
|
104
127
|
let last = { ...ZERO_INSETS }; // what the canvases hold: the canvas default is all zero (seq -1)
|
|
128
|
+
let lastBand = null; // …and no band
|
|
105
129
|
let handle = null;
|
|
106
130
|
let disposed = false;
|
|
107
131
|
const flush = () => {
|
|
108
132
|
handle = null;
|
|
109
133
|
if (disposed) return;
|
|
110
134
|
const next = measure();
|
|
111
|
-
|
|
135
|
+
const band = measureBand();
|
|
136
|
+
if (same(next, last) && sameBand(band, lastBand)) return;
|
|
112
137
|
last = next;
|
|
138
|
+
lastBand = band;
|
|
113
139
|
seq += 1;
|
|
114
|
-
send(seq, next);
|
|
140
|
+
send(seq, next, undefined, band);
|
|
115
141
|
};
|
|
116
142
|
return {
|
|
117
143
|
/** Ask for a re-measure; any number of calls in one frame make one send. */
|
|
@@ -132,9 +158,11 @@ export function createInsetsPump({ measure, send, schedule, cancel = () => {} })
|
|
|
132
158
|
seed(to) {
|
|
133
159
|
if (disposed) return;
|
|
134
160
|
const next = measure();
|
|
161
|
+
const band = measureBand();
|
|
135
162
|
last = next;
|
|
163
|
+
lastBand = band;
|
|
136
164
|
seq += 1;
|
|
137
|
-
send(seq, next, to);
|
|
165
|
+
send(seq, next, to, band);
|
|
138
166
|
},
|
|
139
167
|
dispose() {
|
|
140
168
|
disposed = true;
|
|
@@ -5,7 +5,12 @@
|
|
|
5
5
|
import { useEffect, useRef } from 'react';
|
|
6
6
|
import { postToCanvas } from '../../../bridge/dgn-protocol.ts';
|
|
7
7
|
import { setShellInsets } from './insets-now.js';
|
|
8
|
-
import {
|
|
8
|
+
import {
|
|
9
|
+
createInsetsPump,
|
|
10
|
+
measureShellInsets,
|
|
11
|
+
measureShellTopBand,
|
|
12
|
+
seedOnLadder,
|
|
13
|
+
} from './occlusion-insets.js';
|
|
9
14
|
|
|
10
15
|
/** V2-4.3b — the live pump's synchronous flush, for the mode lane (insets before `set-mode`). A no-op
|
|
11
16
|
* until the hook has mounted. */
|
|
@@ -28,13 +33,18 @@ export function useOccludedInsets({ bodyRef, iframesRef, presenting, layoutKey }
|
|
|
28
33
|
const frameEl = () => body.querySelector(':scope > .main');
|
|
29
34
|
const measure = () =>
|
|
30
35
|
measureShellInsets(frameEl(), body, { presenting: presentingRef.current });
|
|
36
|
+
// #217 — the free top band, so the canvas's top-centre pill sits between the islands, not under them
|
|
37
|
+
const measureBand = () =>
|
|
38
|
+
measureShellTopBand(frameEl(), body, { presenting: presentingRef.current });
|
|
31
39
|
const frames = () => [...(iframesRef.current?.values() ?? [])];
|
|
32
40
|
const pump = createInsetsPump({
|
|
33
41
|
measure,
|
|
34
|
-
|
|
42
|
+
measureBand,
|
|
43
|
+
send(seq, insets, to, topBand) {
|
|
35
44
|
setShellInsets(insets); // P8 C5: shell surfaces that centre on the free canvas read the same value
|
|
36
45
|
const targets = to ? [to] : frames().map((f) => f.contentWindow);
|
|
37
|
-
|
|
46
|
+
const msg = topBand ? { seq, insets, topBand } : { seq, insets };
|
|
47
|
+
for (const win of targets) postToCanvas(win, 'occluded-insets', msg, '*');
|
|
38
48
|
},
|
|
39
49
|
schedule: (fn) => requestAnimationFrame(fn),
|
|
40
50
|
cancel: (h) => cancelAnimationFrame(h),
|