@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
|
@@ -10,17 +10,34 @@
|
|
|
10
10
|
// canvas (which draws its own bar over the same mode). It also steps aside while a people pill holds the same spot
|
|
11
11
|
// ("Following …" / "Everyone here is following you … Stop", presence/canvas-presence.tsx): the pill sat on top of it and
|
|
12
12
|
// took the Stop click.
|
|
13
|
+
//
|
|
14
|
+
// #217 — a dynamic island between the shell's top islands (Michal): two lines, the system's name over the canvas's path
|
|
15
|
+
// (smaller, grey), centred in the free band the shell reports with its `occluded-insets` (`topBand`, the stretch
|
|
16
|
+
// between the project pill and the Share cluster) and never wider than it. Short of room the path line goes first,
|
|
17
|
+
// then the name truncates. An older shell sends no band: the pill centres on the frame, as before.
|
|
13
18
|
|
|
14
|
-
import {
|
|
19
|
+
import {
|
|
20
|
+
type ReactNode,
|
|
21
|
+
useEffect,
|
|
22
|
+
useLayoutEffect,
|
|
23
|
+
useRef,
|
|
24
|
+
useState,
|
|
25
|
+
useSyncExternalStore,
|
|
26
|
+
} from 'react';
|
|
27
|
+
import { canvasModeStore } from './bridge/canvas-mode-store.ts';
|
|
28
|
+
import type { TopBand } from './bridge/occlusion.ts';
|
|
15
29
|
import { DsIcon } from './canvas-ds-icons.tsx';
|
|
16
30
|
import { getCanvasThemeSystemName, setCanvasTheme, useCanvasTheme } from './canvas-theme.ts';
|
|
17
31
|
import { THEME_WORD, ThemeIcon } from './canvas-theme-icons.tsx';
|
|
18
32
|
|
|
19
33
|
/** The pill's chrome. Kept in step with the `.ds-bar` block of ds/board/board.css (same pill, other canvases). */
|
|
20
34
|
const PILL_CSS = `
|
|
21
|
-
.dc-theme-pill{position:fixed;left:50%;top:16px;translate:-50% 0;z-index:2147483000;display:flex;align-items:center;gap:
|
|
35
|
+
.dc-theme-pill{position:fixed;left:50%;top:16px;translate:-50% 0;z-index:2147483000;box-sizing:border-box;display:flex;flex-direction:column;align-items:center;gap:5px;min-width:0;min-height:44px;padding:4px 8px 5px;overflow:hidden;border-radius:var(--maude-hud-radius-lg,14px);background:var(--maude-hud-island-bg);color:var(--maude-chrome-fg-0);-webkit-backdrop-filter:saturate(1.4) blur(18px);backdrop-filter:saturate(1.4) blur(18px);box-shadow:var(--maude-hud-island-shadow),inset 0 0 0 .5px var(--maude-hud-island-edge);font:400 var(--maude-hud-type-sm,12px)/1 var(--maude-chrome-font-body);white-space:nowrap}
|
|
36
|
+
.dc-theme-pill-row{display:flex;align-items:center;gap:8px;min-width:0;max-width:100%;padding-left:4px}
|
|
37
|
+
.dc-theme-pill-row>:not(.dc-theme-pill-text){flex:none}
|
|
22
38
|
.dc-theme-pill-ic{display:grid;place-items:center;width:24px;height:24px;border-radius:var(--maude-hud-radius-xs,4px);background:var(--maude-hud-accent-muted);color:var(--maude-hud-accent-text)}
|
|
23
|
-
.dc-theme-pill
|
|
39
|
+
.dc-theme-pill-text{display:flex;align-items:center;min-width:0;flex:0 1 auto}
|
|
40
|
+
.dc-theme-pill-title{display:block;max-width:100%;overflow:hidden;text-overflow:ellipsis;font-weight:600;line-height:16px}
|
|
24
41
|
.dc-theme-pill-seg{display:inline-flex;margin:0 0 0 8px;min-width:0;border:0;padding:2px;border-radius:var(--maude-hud-radius-md,10px);background:var(--maude-chrome-bg-3)}
|
|
25
42
|
.dc-theme-pill-seg:first-child{margin-left:0}
|
|
26
43
|
.dc-theme-pill-b{appearance:none;border:0;border-radius:calc(var(--maude-hud-radius-md,10px) - 2px);padding:4px 12px;background:transparent;color:var(--maude-chrome-fg-1);font:inherit;font-size:var(--maude-hud-type-xs,11px);cursor:pointer}
|
|
@@ -28,7 +45,8 @@ const PILL_CSS = `
|
|
|
28
45
|
.dc-theme-pill-b:disabled{opacity:.4;cursor:default}
|
|
29
46
|
.dc-theme-pill-b--ic{display:grid;place-items:center;padding:4px 7px}
|
|
30
47
|
.dc-theme-pill-sr{position:absolute;width:1px;height:1px;margin:-1px;padding:0;overflow:hidden;clip:rect(0 0 0 0);white-space:nowrap;border:0}
|
|
31
|
-
.dc-theme-pill-path{appearance:none;border:0;border-radius:var(--maude-hud-radius-xs,4px);padding:4px
|
|
48
|
+
.dc-theme-pill-path{appearance:none;display:block;border:0;border-radius:var(--maude-hud-radius-xs,4px);padding:0 4px;margin:0;background:transparent;color:var(--maude-chrome-fg-2);font:inherit;font-size:var(--maude-hud-type-2xs,10px);line-height:13px;font-family:var(--maude-chrome-font-mono,ui-monospace,monospace);text-align:center;cursor:pointer;max-width:100%;overflow:hidden;text-overflow:ellipsis;white-space:nowrap}
|
|
49
|
+
.dc-theme-pill[data-path="hidden"] .dc-theme-pill-path{position:absolute;visibility:hidden;pointer-events:none}
|
|
32
50
|
.dc-theme-pill-path:hover{background:var(--maude-chrome-bg-3);color:var(--maude-chrome-fg-0)}
|
|
33
51
|
.dc-theme-pill-path:focus-visible{outline:2px solid var(--maude-hud-focus-ring);outline-offset:1px}
|
|
34
52
|
.dc-theme-pill-b:focus-visible{outline:2px solid var(--maude-hud-focus-ring);outline-offset:1px}
|
|
@@ -53,6 +71,79 @@ export function shortenCanvasPath(path: string, max = PATH_MAX): string {
|
|
|
53
71
|
return `…/${out}`;
|
|
54
72
|
}
|
|
55
73
|
|
|
74
|
+
/** #217 — the room the pill keeps from each top island, and from the frame's edges with no band. */
|
|
75
|
+
export const PILL_BAND_GAP = 12;
|
|
76
|
+
/** #217 — the path line stays while it can show at least this much (an ellipsis eats the rest); narrower, it goes. */
|
|
77
|
+
export const PATH_MIN_PX = 96;
|
|
78
|
+
|
|
79
|
+
/**
|
|
80
|
+
* #217 — where the pill sits: centred in the shell's free top band (clamped to the frame), never wider than the band
|
|
81
|
+
* less a gap on each side. No band (an older shell, nothing usable) ⇒ the frame's centre, as before.
|
|
82
|
+
* @returns `left` (px from the frame's left edge, the pill's centre) and `maxWidth` (px, ≥ 0)
|
|
83
|
+
*/
|
|
84
|
+
export function pillPlacement(
|
|
85
|
+
band: Readonly<TopBand> | null,
|
|
86
|
+
viewportWidth: number
|
|
87
|
+
): { left: number; maxWidth: number; banded: boolean } {
|
|
88
|
+
const vw = Math.max(0, viewportWidth);
|
|
89
|
+
if (band) {
|
|
90
|
+
const l = Math.max(0, band.left);
|
|
91
|
+
const r = Math.min(vw, band.right);
|
|
92
|
+
if (r > l)
|
|
93
|
+
return {
|
|
94
|
+
left: Math.round((l + r) / 2),
|
|
95
|
+
maxWidth: Math.max(0, Math.floor(r - l - 2 * PILL_BAND_GAP)),
|
|
96
|
+
banded: true,
|
|
97
|
+
};
|
|
98
|
+
}
|
|
99
|
+
return { left: Math.round(vw / 2), maxWidth: Math.max(0, vw - 2 * PILL_BAND_GAP), banded: false };
|
|
100
|
+
}
|
|
101
|
+
|
|
102
|
+
/**
|
|
103
|
+
* #217 — does the path line stay? `avail` is the width the two-line text column may take (the pill's max width
|
|
104
|
+
* less its icon, Light | Dark and the rest); `title` / `path` are the lines' natural widths. The path goes first:
|
|
105
|
+
* it stays only while the name fits whole AND the path can show at least PATH_MIN_PX (or all of itself).
|
|
106
|
+
*/
|
|
107
|
+
export function showPathLine(avail: number, title: number, path: number): boolean {
|
|
108
|
+
if (!(path > 0)) return false;
|
|
109
|
+
return avail >= Math.max(title, Math.min(path, PATH_MIN_PX));
|
|
110
|
+
}
|
|
111
|
+
|
|
112
|
+
const noSub = () => () => {};
|
|
113
|
+
|
|
114
|
+
/** The laid-out width of an element's text, overflow or not (0 without layout). */
|
|
115
|
+
function textWidthOf(el: Element): number {
|
|
116
|
+
try {
|
|
117
|
+
const r = el.ownerDocument.createRange();
|
|
118
|
+
r.selectNodeContents(el);
|
|
119
|
+
return r.getBoundingClientRect().width;
|
|
120
|
+
} catch {
|
|
121
|
+
return 0;
|
|
122
|
+
}
|
|
123
|
+
}
|
|
124
|
+
|
|
125
|
+
/** The shell's top band, live (null outside a browser document or before the shell sent one). */
|
|
126
|
+
function useTopBand(): Readonly<TopBand> | null {
|
|
127
|
+
const s = typeof window === 'undefined' ? null : canvasModeStore(window);
|
|
128
|
+
return useSyncExternalStore(
|
|
129
|
+
s ? s.subscribe : noSub,
|
|
130
|
+
() => s?.get().topBand ?? null,
|
|
131
|
+
() => null
|
|
132
|
+
);
|
|
133
|
+
}
|
|
134
|
+
|
|
135
|
+
/** The frame's width, live (the fallback centring and the band's clamp read it). */
|
|
136
|
+
function useViewportWidth(): number {
|
|
137
|
+
const [w, setW] = useState(() => (typeof window === 'undefined' ? 0 : window.innerWidth));
|
|
138
|
+
useEffect(() => {
|
|
139
|
+
if (typeof window === 'undefined') return undefined;
|
|
140
|
+
const on = () => setW(window.innerWidth);
|
|
141
|
+
window.addEventListener('resize', on);
|
|
142
|
+
return () => window.removeEventListener('resize', on);
|
|
143
|
+
}, []);
|
|
144
|
+
return w;
|
|
145
|
+
}
|
|
146
|
+
|
|
56
147
|
/** The canvas's project-relative path (`.design/ui/v2/02 Onboarding.tsx`), as the shell stored it on the frame. */
|
|
57
148
|
function canvasFilePath(): string | null {
|
|
58
149
|
if (typeof window === 'undefined') return null;
|
|
@@ -109,26 +200,65 @@ export function CanvasThemePill({
|
|
|
109
200
|
};
|
|
110
201
|
const both = bothThemes();
|
|
111
202
|
const name = getCanvasThemeSystemName();
|
|
203
|
+
// #217 — placed in the shell's free top band; the path line goes first when the band is short
|
|
204
|
+
const band = useTopBand();
|
|
205
|
+
const vw = useViewportWidth();
|
|
206
|
+
const place = pillPlacement(band, vw);
|
|
207
|
+
const pillRef = useRef<HTMLDivElement>(null);
|
|
208
|
+
const textRef = useRef<HTMLSpanElement>(null);
|
|
209
|
+
const titleRef = useRef<HTMLElement>(null);
|
|
210
|
+
const pathRef = useRef<HTMLButtonElement>(null);
|
|
211
|
+
const [pathShown, setPathShown] = useState(true);
|
|
212
|
+
// how many characters of the path fit: it loses its leading folders first, never its file name
|
|
213
|
+
const [pathChars, setPathChars] = useState(PATH_MAX);
|
|
214
|
+
// biome-ignore lint/correctness/useExhaustiveDependencies: name, file and copied change the lines' natural widths
|
|
215
|
+
useLayoutEffect(() => {
|
|
216
|
+
const pill = pillRef.current;
|
|
217
|
+
if (!pill) return undefined;
|
|
218
|
+
const fit = () => {
|
|
219
|
+
// the path has its own line under the controls (Michal, #217): it may take the pill's whole inner width
|
|
220
|
+
const cs = getComputedStyle(pill);
|
|
221
|
+
const avail =
|
|
222
|
+
place.maxWidth - (parseFloat(cs.paddingLeft) || 0) - (parseFloat(cs.paddingRight) || 0);
|
|
223
|
+
const btn = pathRef.current;
|
|
224
|
+
let pathW = btn?.scrollWidth ?? 0;
|
|
225
|
+
let chars = PATH_MAX;
|
|
226
|
+
const shown = btn?.textContent ?? '';
|
|
227
|
+
const textW = btn && file && copied === 'no' && shown ? textWidthOf(btn) : 0;
|
|
228
|
+
if (btn && file && textW > 0) {
|
|
229
|
+
// the path is set in a monospace face: one character's width prices the whole path and what fits
|
|
230
|
+
const charW = textW / shown.length;
|
|
231
|
+
const pad = Math.max(0, btn.scrollWidth - textW);
|
|
232
|
+
pathW = charW * shortenCanvasPath(file).length + pad;
|
|
233
|
+
chars = Math.max(8, Math.min(PATH_MAX, Math.floor((avail - pad) / charW)));
|
|
234
|
+
}
|
|
235
|
+
const next = showPathLine(avail, 0, pathW);
|
|
236
|
+
setPathShown((cur) => (cur === next ? cur : next));
|
|
237
|
+
setPathChars((cur) => (cur === chars ? cur : chars));
|
|
238
|
+
};
|
|
239
|
+
fit();
|
|
240
|
+
if (typeof ResizeObserver !== 'function') return undefined;
|
|
241
|
+
const ro = new ResizeObserver(fit); // Light | Dark and Canvas | Pages may change width after first paint
|
|
242
|
+
ro.observe(pill);
|
|
243
|
+
return () => ro.disconnect();
|
|
244
|
+
}, [place.maxWidth, name, file, copied]);
|
|
112
245
|
return (
|
|
113
246
|
<>
|
|
114
247
|
<style data-dc-theme-pill-css="">{PILL_CSS}</style>
|
|
115
248
|
<div
|
|
249
|
+
ref={pillRef}
|
|
116
250
|
className="dc-theme-pill"
|
|
117
251
|
data-dc-overlay=""
|
|
118
252
|
data-testid="canvas-theme-pill"
|
|
253
|
+
data-band={place.banded ? 'band' : 'frame'}
|
|
254
|
+
data-path={file ? (pathShown ? 'shown' : 'hidden') : undefined}
|
|
255
|
+
style={{ left: `${place.left}px`, maxWidth: `${place.maxWidth}px` }}
|
|
119
256
|
role="toolbar"
|
|
120
257
|
aria-label="Canvas theme"
|
|
121
258
|
>
|
|
122
|
-
{name ? (
|
|
123
|
-
<>
|
|
124
|
-
<span className="dc-theme-pill-ic" aria-hidden="true">
|
|
125
|
-
<DsIcon name="system" size={14} />
|
|
126
|
-
</span>
|
|
127
|
-
<b>{name}</b>
|
|
128
|
-
</>
|
|
129
|
-
) : null}
|
|
130
259
|
{file ? (
|
|
131
260
|
<button
|
|
261
|
+
ref={pathRef}
|
|
132
262
|
type="button"
|
|
133
263
|
className="dc-theme-pill-path"
|
|
134
264
|
data-testid="canvas-theme-path"
|
|
@@ -141,34 +271,48 @@ export function CanvasThemePill({
|
|
|
141
271
|
? 'Copied'
|
|
142
272
|
: copied === 'failed'
|
|
143
273
|
? 'Couldn’t copy'
|
|
144
|
-
: shortenCanvasPath(file)}
|
|
274
|
+
: shortenCanvasPath(file, pathChars)}
|
|
145
275
|
</button>
|
|
146
276
|
) : null}
|
|
147
|
-
<
|
|
148
|
-
{
|
|
149
|
-
<
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
277
|
+
<div className="dc-theme-pill-row" data-testid="canvas-theme-row">
|
|
278
|
+
{name ? (
|
|
279
|
+
<span className="dc-theme-pill-ic" aria-hidden="true">
|
|
280
|
+
<DsIcon name="system" size={14} />
|
|
281
|
+
</span>
|
|
282
|
+
) : null}
|
|
283
|
+
{name ? (
|
|
284
|
+
<span ref={textRef} className="dc-theme-pill-text" data-testid="canvas-theme-text">
|
|
285
|
+
<b ref={titleRef} className="dc-theme-pill-title" data-testid="canvas-theme-title">
|
|
286
|
+
{name}
|
|
287
|
+
</b>
|
|
288
|
+
</span>
|
|
289
|
+
) : null}
|
|
290
|
+
<fieldset className="dc-theme-pill-seg" aria-label="Show every artboard in">
|
|
291
|
+
{(['light', 'dark'] as const).map((m) => (
|
|
292
|
+
<button
|
|
293
|
+
key={m}
|
|
294
|
+
type="button"
|
|
295
|
+
className="dc-theme-pill-b dc-theme-pill-b--ic"
|
|
296
|
+
data-testid={`canvas-theme-mode-${m}`}
|
|
297
|
+
aria-pressed={mode === m}
|
|
298
|
+
aria-label={THEME_WORD[m]}
|
|
299
|
+
disabled={!both && mode !== m}
|
|
300
|
+
// 2.0.7 — icons only (Michal): the name is the tooltip; a theme the canvas lacks says so there
|
|
301
|
+
title={!both && mode !== m ? `This canvas has no ${THEME_WORD[m]}` : THEME_WORD[m]}
|
|
302
|
+
onClick={() => setCanvasTheme(m)}
|
|
303
|
+
>
|
|
304
|
+
<ThemeIcon mode={m} />
|
|
305
|
+
</button>
|
|
306
|
+
))}
|
|
307
|
+
</fieldset>
|
|
308
|
+
{!both ? (
|
|
309
|
+
// read by a screen reader only; the greyed button's tooltip says the same to everyone else
|
|
310
|
+
<span className="dc-theme-pill-sr" data-testid="canvas-theme-note">
|
|
311
|
+
{`This canvas has no ${mode === 'light' ? 'Dark' : 'Light'}`}
|
|
312
|
+
</span>
|
|
313
|
+
) : null}
|
|
314
|
+
{extra}
|
|
315
|
+
</div>
|
|
172
316
|
</div>
|
|
173
317
|
</>
|
|
174
318
|
);
|
|
@@ -103,7 +103,14 @@ export function useExportCenter({ enabled = true } = {}) {
|
|
|
103
103
|
startToastShownRef.current.add(job.id);
|
|
104
104
|
hydratedRef.current.add(job.id);
|
|
105
105
|
}
|
|
106
|
-
|
|
106
|
+
// Merge, never replace: a live push that landed while this GET was in flight is newer than the
|
|
107
|
+
// snapshot, and replacing the map dropped it — its row, its toast and its save (fix-bulk B5).
|
|
108
|
+
setJobs((prev) => {
|
|
109
|
+
if (prev.size === 0) return m;
|
|
110
|
+
const next = new Map(m);
|
|
111
|
+
for (const [id, live] of prev) next.set(id, live);
|
|
112
|
+
return next;
|
|
113
|
+
});
|
|
107
114
|
})
|
|
108
115
|
.catch(() => {
|
|
109
116
|
/* offline / restart — the badge just stays empty until a push arrives */
|
|
@@ -359,18 +366,40 @@ export function useExportCenter({ enabled = true } = {}) {
|
|
|
359
366
|
|
|
360
367
|
// A spec that names where to save (Downloads, or the remembered folder) saves itself on this Mac the
|
|
361
368
|
// moment it is done — no dialog. Any other waits for Show in Finder, which asks once.
|
|
369
|
+
//
|
|
370
|
+
// fix-bulk B5 — a done job must always reach its folder. This ran only on a `jobs` change, and skipped a job
|
|
371
|
+
// that finished while the window was in the background, so a long Print PDF the person waited for in Finder
|
|
372
|
+
// was never saved and its bytes were later swept. Now: Downloads never shows a panel, so it saves whenever this
|
|
373
|
+
// tab is the visible one; the remembered folder may have to ask once, so it waits for the window — and both are
|
|
374
|
+
// tried again each time the window comes back (`comeBack`).
|
|
375
|
+
const [comeBack, setComeBack] = useState(0);
|
|
376
|
+
useEffect(() => {
|
|
377
|
+
if (!isNativeApp()) return undefined;
|
|
378
|
+
const again = () => {
|
|
379
|
+
if (document.visibilityState !== 'hidden') setComeBack((n) => n + 1);
|
|
380
|
+
};
|
|
381
|
+
window.addEventListener('focus', again);
|
|
382
|
+
document.addEventListener('visibilitychange', again);
|
|
383
|
+
return () => {
|
|
384
|
+
window.removeEventListener('focus', again);
|
|
385
|
+
document.removeEventListener('visibilitychange', again);
|
|
386
|
+
};
|
|
387
|
+
}, []);
|
|
362
388
|
useEffect(() => {
|
|
363
389
|
if (!isNativeApp()) return;
|
|
390
|
+
void comeBack;
|
|
391
|
+
if (document.visibilityState === 'hidden') return; // a background tab: the shell refuses its save
|
|
364
392
|
for (const job of jobs.values()) {
|
|
365
393
|
if (job.status !== 'done' || !job.filename || job.deliveredInBrowser) continue;
|
|
366
394
|
const to = job.spec?.options?.saveTo;
|
|
367
395
|
if (to !== 'downloads' && to !== 'remembered') continue;
|
|
368
396
|
if (hydratedRef.current.has(job.id) || autoSavedRef.current.has(job.id)) continue;
|
|
369
|
-
if (finalizedRef.current.has(job.id)
|
|
397
|
+
if (finalizedRef.current.has(job.id)) continue;
|
|
398
|
+
if (to === 'remembered' && !document.hasFocus()) continue;
|
|
370
399
|
autoSavedRef.current.add(job.id);
|
|
371
400
|
void save(job);
|
|
372
401
|
}
|
|
373
|
-
}, [jobs, save]);
|
|
402
|
+
}, [jobs, save, comeBack]);
|
|
374
403
|
|
|
375
404
|
const toastJobId = panelOpen ? null : (toastQueue[0] ?? null);
|
|
376
405
|
|
|
@@ -0,0 +1,61 @@
|
|
|
1
|
+
// client/home/HomeAccountBanner.jsx — 2.1.2 HB1 (canvas 17, artboard 16): the one banner on top of Home,
|
|
2
|
+
// only for a sign-in the person can fix. One problem: what broke, which projects' changes wait on this
|
|
3
|
+
// Mac, and the line's own fix (Sign in again / Sign in, `useAccountFix` — the same attempt the accounts
|
|
4
|
+
// list shows). Two or more: "2 sign-ins stopped working" and Review, which opens the accounts list. A
|
|
5
|
+
// server that does not answer never raises it (`homeAccountBanner`).
|
|
6
|
+
|
|
7
|
+
import { BrokenLink } from './HomeConnection.jsx';
|
|
8
|
+
import { WAITING_WORD } from './use-account-fix.js';
|
|
9
|
+
|
|
10
|
+
/**
|
|
11
|
+
* @param {{ banner: ReturnType<typeof import('./home-accounts-model.js').homeAccountBanner>,
|
|
12
|
+
* native: boolean, fixer: { busy: string|null, error: string|null,
|
|
13
|
+
* fix: (card: object) => unknown }, onReview: () => void }} props
|
|
14
|
+
*/
|
|
15
|
+
export function HomeAccountBanner({ banner, native, fixer, onReview }) {
|
|
16
|
+
if (!banner) return null;
|
|
17
|
+
const one = banner.kind === 'one';
|
|
18
|
+
const waiting = one && fixer.busy === banner.card.key;
|
|
19
|
+
return (
|
|
20
|
+
<div
|
|
21
|
+
className="home-acb"
|
|
22
|
+
role="alert"
|
|
23
|
+
data-kind={banner.kind}
|
|
24
|
+
data-testid="home-account-banner"
|
|
25
|
+
>
|
|
26
|
+
<span className="home-acb-ic" aria-hidden="true">
|
|
27
|
+
<BrokenLink size={12} />
|
|
28
|
+
</span>
|
|
29
|
+
<span className="home-acb-t">
|
|
30
|
+
<strong>{banner.title}</strong>
|
|
31
|
+
{banner.body ? <span>{banner.body}</span> : null}
|
|
32
|
+
{one && fixer.error ? (
|
|
33
|
+
<span className="home-acb-err" data-testid="home-account-banner-error">
|
|
34
|
+
{fixer.error}
|
|
35
|
+
</span>
|
|
36
|
+
) : null}
|
|
37
|
+
</span>
|
|
38
|
+
{one ? (
|
|
39
|
+
<button
|
|
40
|
+
type="button"
|
|
41
|
+
className="btn btn--primary btn--sm"
|
|
42
|
+
data-testid="home-account-banner-fix"
|
|
43
|
+
disabled={!native || waiting}
|
|
44
|
+
title={native ? undefined : 'Sign in from the Maude app on your Mac.'}
|
|
45
|
+
onClick={() => fixer.fix(banner.card)}
|
|
46
|
+
>
|
|
47
|
+
{waiting ? WAITING_WORD : banner.action}
|
|
48
|
+
</button>
|
|
49
|
+
) : (
|
|
50
|
+
<button
|
|
51
|
+
type="button"
|
|
52
|
+
className="btn btn--primary btn--sm"
|
|
53
|
+
data-testid="home-account-banner-review"
|
|
54
|
+
onClick={onReview}
|
|
55
|
+
>
|
|
56
|
+
{banner.action}
|
|
57
|
+
</button>
|
|
58
|
+
)}
|
|
59
|
+
</div>
|
|
60
|
+
);
|
|
61
|
+
}
|