@1agh/maude 2.1.0 → 2.1.2
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/access/request.ts +1 -0
- package/apps/studio/actions/agents.ts +45 -42
- package/apps/studio/actions/defs/app.ts +28 -1
- package/apps/studio/actions/defs/sync.ts +4 -0
- package/apps/studio/actions/verbs.ts +49 -0
- package/apps/studio/actions.manifest.json +162 -20
- package/apps/studio/actions.parity.json +13 -1
- 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/_curl-local.mjs +7 -4
- 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 +169 -26
- package/apps/studio/client/app.jsx +16 -4
- 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 +112 -0
- package/apps/studio/client/home/ProjectRows.jsx +514 -0
- package/apps/studio/client/home/home-accounts-model.js +234 -76
- package/apps/studio/client/home/home-api.js +10 -2
- package/apps/studio/client/home/home-app.jsx +151 -394
- package/apps/studio/client/home/home-icons.jsx +8 -0
- package/apps/studio/client/home/home-model.js +149 -1
- package/apps/studio/client/home/home-where-model.js +105 -0
- package/apps/studio/client/home/home.css +621 -53
- package/apps/studio/client/home/use-account-fix.js +123 -0
- package/apps/studio/client/hooks/use-palette-and-panels.jsx +3 -1
- package/apps/studio/client/hooks/use-tabs.jsx +11 -4
- package/apps/studio/client/panels/TeamProjects.jsx +137 -134
- package/apps/studio/client/share-link.js +12 -0
- package/apps/studio/client/styles/_index.css +4 -0
- package/apps/studio/client/v2/assets/generate-ask.jsx +3 -1
- package/apps/studio/client/v2/diagnostics/diagnostics-host.jsx +1 -0
- package/apps/studio/client/v2/diagnostics/diagnostics-model.js +32 -2
- package/apps/studio/client/v2/diagnostics/diagnostics-sheet.jsx +35 -8
- package/apps/studio/client/v2/diagnostics/diagnostics.css +34 -0
- package/apps/studio/client/v2/diagnostics/sync-details/sync-details-model.js +94 -3
- package/apps/studio/client/v2/diagnostics/sync-details/sync-details.jsx +187 -4
- 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/link-server/LinkServerDialog.jsx +492 -0
- package/apps/studio/client/v2/link-server/LinkServerHost.jsx +42 -0
- package/apps/studio/client/v2/link-server/link-server-api.js +142 -0
- package/apps/studio/client/v2/link-server/link-server-model.js +438 -0
- package/apps/studio/client/v2/link-server/link-server.css +109 -0
- package/apps/studio/client/v2/onboarding/AdvancedSheets.jsx +31 -86
- package/apps/studio/client/v2/onboarding/onboarding-model.js +1 -18
- package/apps/studio/client/v2/search/search-keywords.js +3 -2
- package/apps/studio/client/v2/settings/account.jsx +4 -2
- package/apps/studio/client/v2/settings/advanced-section.jsx +245 -148
- package/apps/studio/client/v2/settings/connection-row.jsx +3 -59
- package/apps/studio/client/v2/settings/connections-section.jsx +118 -425
- package/apps/studio/client/v2/settings/general-section.jsx +138 -43
- package/apps/studio/client/v2/settings/project-sync-settings.jsx +4 -3
- package/apps/studio/client/v2/settings/reset-section.jsx +14 -3
- package/apps/studio/client/v2/settings/settings-card.jsx +142 -0
- package/apps/studio/client/v2/settings/settings-cards.js +220 -0
- package/apps/studio/client/v2/settings/settings-handlers.js +7 -6
- package/apps/studio/client/v2/settings/settings-model.js +91 -31
- package/apps/studio/client/v2/settings/settings-sheet.jsx +25 -6
- package/apps/studio/client/v2/settings/settings.css +374 -64
- package/apps/studio/client/v2/settings/this-project-card.jsx +730 -0
- package/apps/studio/client/v2/settings/this-project-model.js +172 -0
- package/apps/studio/client/v2/settings/use-connections.js +3 -2
- package/apps/studio/client/v2/settings/use-open-card.js +37 -0
- package/apps/studio/client/v2/shell/connection-state.js +197 -0
- package/apps/studio/client/v2/shell/menu-runner.js +7 -2
- package/apps/studio/client/v2/shell/occlusion-insets.js +37 -9
- package/apps/studio/client/v2/shell/project-account-bus.js +36 -0
- package/apps/studio/client/v2/shell/project-account-card.jsx +357 -148
- package/apps/studio/client/v2/shell/project-account-model.js +272 -149
- package/apps/studio/client/v2/shell/project-account-toast.js +66 -0
- package/apps/studio/client/v2/shell/project-account.css +237 -0
- package/apps/studio/client/v2/shell/share-cluster-host.jsx +166 -83
- package/apps/studio/client/v2/shell/shell-parity.js +3 -2
- package/apps/studio/client/v2/shell/shell-parity.json +40 -26
- package/apps/studio/client/v2/shell/use-account.js +2 -0
- package/apps/studio/client/v2/shell/use-occluded-insets.js +13 -3
- package/apps/studio/client/v2/signin/use-signin.js +1 -1
- package/apps/studio/cloud/endpoints.ts +29 -4
- package/apps/studio/collab/room.ts +21 -7
- package/apps/studio/dist/client.bundle.js +886 -886
- 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/home/accounts.ts +30 -11
- package/apps/studio/home/cloud.ts +6 -1
- package/apps/studio/home/hub-health.ts +76 -0
- package/apps/studio/home/routes.ts +9 -3
- package/apps/studio/http.ts +14 -2
- package/apps/studio/migrate/hub.ts +8 -1
- package/apps/studio/routes/agent.ts +6 -2
- package/apps/studio/routes/hub-link-folder.ts +334 -0
- package/apps/studio/routes/hub-signin.ts +78 -1
- package/apps/studio/routes/index.ts +4 -0
- package/apps/studio/routes/project-undo.ts +10 -0
- package/apps/studio/routes/sync.ts +22 -4
- package/apps/studio/server.ts +25 -0
- package/apps/studio/shell/api-key.ts +11 -0
- package/apps/studio/shell/cli-yield.ts +48 -11
- package/apps/studio/sync/accepted-cold-start.ts +144 -8
- package/apps/studio/sync/action-stage.ts +18 -1
- package/apps/studio/sync/ctl-heal.ts +58 -0
- package/apps/studio/sync/file-ledger.ts +38 -4
- package/apps/studio/sync/file-plane.ts +226 -19
- package/apps/studio/sync/held-deletes.ts +86 -5
- package/apps/studio/sync/hub-link.ts +8 -0
- package/apps/studio/sync/index.ts +68 -4
- package/apps/studio/sync/link-consent.ts +22 -75
- package/apps/studio/sync/link-survey.ts +252 -0
- package/apps/studio/sync/local-kernel.ts +16 -1
- package/apps/studio/sync/seed-progress.ts +12 -0
- package/apps/studio/sync/source-recovery.ts +18 -2
- package/apps/studio/sync/status.ts +11 -1
- package/apps/studio/sync/writer-registry.ts +5 -0
- package/apps/studio/whats-new.json +36 -0
- package/cli/commands/design.mjs +74 -16
- package/cli/lib/bash-guard.mjs +23 -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 +9 -8
- package/apps/studio/client/home/HomeAccounts.jsx +0 -262
- package/apps/studio/client/v2/onboarding/HubSheet.jsx +0 -212
- package/apps/studio/client/v2/shell/account-card-model.js +0 -114
- package/apps/studio/client/v2/shell/account-card.jsx +0 -189
|
@@ -31,12 +31,15 @@ import {
|
|
|
31
31
|
type ToolId,
|
|
32
32
|
} from './canvas-modes.ts';
|
|
33
33
|
import { acceptFromShell } from './dgn-protocol.ts';
|
|
34
|
-
import { type Insets, ZERO_INSETS } from './occlusion.ts';
|
|
34
|
+
import { type Insets, type TopBand, ZERO_INSETS } from './occlusion.ts';
|
|
35
35
|
|
|
36
36
|
export interface CanvasModeSnapshot {
|
|
37
37
|
readonly insets: Readonly<Insets>;
|
|
38
38
|
/** The `seq` of the applied `occluded-insets` (-1 = none yet). */
|
|
39
39
|
readonly insetsSeq: number;
|
|
40
|
+
/** #217 — the free top band between the shell's top islands (iframe px), with the insets; null when the
|
|
41
|
+
* shell sent none (an older shell, Present, no room) — the top-centre pill then centres on the frame. */
|
|
42
|
+
readonly topBand: Readonly<TopBand> | null;
|
|
40
43
|
/** Governed (V2-4.3b): the shell's mode; null until the first applied `set-mode`. */
|
|
41
44
|
readonly mode: CanvasModeV2 | null;
|
|
42
45
|
readonly present: PresentSpec | null;
|
|
@@ -86,6 +89,7 @@ export function canvasModeStore(win: Window): CanvasModeStore {
|
|
|
86
89
|
let snap: CanvasModeSnapshot = {
|
|
87
90
|
insets: ZERO_INSETS,
|
|
88
91
|
insetsSeq: -1,
|
|
92
|
+
topBand: null,
|
|
89
93
|
mode: null,
|
|
90
94
|
present: null,
|
|
91
95
|
caps: null,
|
|
@@ -176,7 +180,12 @@ export function canvasModeStore(win: Window): CanvasModeStore {
|
|
|
176
180
|
}
|
|
177
181
|
if (m?.dgn !== 'occluded-insets') return;
|
|
178
182
|
if (m.seq <= snap.insetsSeq) return; // I4 — an older (or repeated) seq is dropped
|
|
179
|
-
snap = {
|
|
183
|
+
snap = {
|
|
184
|
+
...snap,
|
|
185
|
+
insets: Object.freeze({ ...m.insets }),
|
|
186
|
+
insetsSeq: m.seq,
|
|
187
|
+
topBand: m.topBand ? Object.freeze({ ...m.topBand }) : null,
|
|
188
|
+
};
|
|
180
189
|
for (const fn of subs) fn(snap);
|
|
181
190
|
});
|
|
182
191
|
Object.defineProperty(store, 'doc', { value: win.document });
|
|
@@ -32,7 +32,7 @@ import {
|
|
|
32
32
|
TOOL_IDS,
|
|
33
33
|
type ToolId,
|
|
34
34
|
} from './canvas-modes.ts';
|
|
35
|
-
import { clampInsets, type Insets } from './occlusion.ts';
|
|
35
|
+
import { clampInsets, clampTopBand, type Insets, type TopBand } from './occlusion.ts';
|
|
36
36
|
import { parsePasteData } from './paste-data.ts';
|
|
37
37
|
import { stillImageBytes } from './still-webp.ts';
|
|
38
38
|
|
|
@@ -743,7 +743,9 @@ export interface ShellToCanvas {
|
|
|
743
743
|
tool?: ToolId;
|
|
744
744
|
caps: ModeCaps;
|
|
745
745
|
};
|
|
746
|
-
|
|
746
|
+
// #217 — `topBand`: the free stretch of the top edge between the top islands (iframe px); the canvas
|
|
747
|
+
// centres its top-centre pill there. Absent from an older shell (the pill centres on the frame).
|
|
748
|
+
'occluded-insets': { seq: number; insets: Insets; topBand?: TopBand };
|
|
747
749
|
'present-step': { to: number | 'next' | 'prev' };
|
|
748
750
|
// S3.7a — the follower page tells its canvas which session to follow (`sid: null` = the first
|
|
749
751
|
// presenter seen), whether it is live, and whether it is the locked audience window.
|
|
@@ -1069,6 +1071,9 @@ const sid: V = (v) => (typeof v === 'string' && PRESENT_SID.test(v) ? v : BAD);
|
|
|
1069
1071
|
export const PRESENT_NAME_MAX = 64;
|
|
1070
1072
|
const presenterName: V = (v) => (typeof v === 'string' && v.length <= PRESENT_NAME_MAX ? v : BAD);
|
|
1071
1073
|
const insets: V = (v) => clampInsets(v) ?? BAD;
|
|
1074
|
+
/** #217 — an optional cosmetic hint: a bad band is dropped (the pill centres on the frame), never the insets
|
|
1075
|
+
* the camera needs. */
|
|
1076
|
+
const topBand: V = (v) => (v === undefined ? undefined : (clampTopBand(v) ?? undefined));
|
|
1072
1077
|
/** S10.4 — a designRoot-relative `.css` path; the same rule as the shell's `DS_CSS_REL` (no URL, no `..`). */
|
|
1073
1078
|
const DS_CSS_REL = /^(?!\/)(?!.*\.\.)[A-Za-z0-9_][A-Za-z0-9 ._/-]{0,255}\.css$/;
|
|
1074
1079
|
const dsCssPath: V = (v) => (typeof v === 'string' && DS_CSS_REL.test(v) ? v : BAD);
|
|
@@ -2685,7 +2690,7 @@ const s2c: S2C = {
|
|
|
2685
2690
|
gate: 'parent',
|
|
2686
2691
|
status: 'new',
|
|
2687
2692
|
owner: 'bridge/canvas-mode-store',
|
|
2688
|
-
parse: p({ seq: num, insets }),
|
|
2693
|
+
parse: p({ seq: num, insets, topBand }),
|
|
2689
2694
|
},
|
|
2690
2695
|
// S3.1 — live: the shell lane's `step` sends it; canvas-mode-store keeps it for the Present stage.
|
|
2691
2696
|
'present-step': {
|
|
@@ -106,3 +106,48 @@ export function revealViewBox(host: Box, ins: Insets | null | undefined): Box {
|
|
|
106
106
|
bottom: host.top + v.y + v.h,
|
|
107
107
|
};
|
|
108
108
|
}
|
|
109
|
+
|
|
110
|
+
/** #217 — the free stretch of the top edge between the top islands, in iframe px from its left edge
|
|
111
|
+
* (`left` = the left island's right edge, `right` = the right cluster's left edge). The canvas centres
|
|
112
|
+
* its top-centre pill (canvas-theme-pill.tsx) in it instead of in the whole frame. */
|
|
113
|
+
export interface TopBand {
|
|
114
|
+
left: number;
|
|
115
|
+
right: number;
|
|
116
|
+
}
|
|
117
|
+
|
|
118
|
+
/** Validate an untrusted top band: both edges finite, 0 ≤ left < right ≤ 8192, rounded; else null. */
|
|
119
|
+
export function clampTopBand(raw: unknown): TopBand | null {
|
|
120
|
+
if (!raw || typeof raw !== 'object' || Array.isArray(raw)) return null;
|
|
121
|
+
const { left, right } = raw as Record<string, unknown>;
|
|
122
|
+
if (typeof left !== 'number' || typeof right !== 'number') return null;
|
|
123
|
+
if (!Number.isFinite(left) || !Number.isFinite(right)) return null;
|
|
124
|
+
const l = Math.round(left);
|
|
125
|
+
const r = Math.round(right);
|
|
126
|
+
if (l < 0 || r > MAX_INSET_PX || !(l < r)) return null;
|
|
127
|
+
return { left: l, right: r };
|
|
128
|
+
}
|
|
129
|
+
|
|
130
|
+
/** Shell side: the top band the `top` islands leave free on the frame. An island whose centre is left of
|
|
131
|
+
* the frame's centre bounds the band on the left (its right edge), any other on the right (its left
|
|
132
|
+
* edge). Hidden islands, other edges and islands off the frame count for nothing. Null when no room is
|
|
133
|
+
* left. */
|
|
134
|
+
export function topBandFromIslands(
|
|
135
|
+
frame: Box,
|
|
136
|
+
islands: ReadonlyArray<{ rect: Box; edge: IslandEdge }>
|
|
137
|
+
): TopBand | null {
|
|
138
|
+
if (!(frame.right > frame.left)) return null;
|
|
139
|
+
const mid = (frame.left + frame.right) / 2;
|
|
140
|
+
let lo = frame.left;
|
|
141
|
+
let hi = frame.right;
|
|
142
|
+
for (const { rect: r, edge } of islands) {
|
|
143
|
+
if (edge !== 'top' || !(r.right > r.left && r.bottom > r.top)) continue;
|
|
144
|
+
const ix = Math.min(r.right, frame.right) - Math.max(r.left, frame.left);
|
|
145
|
+
const iy = Math.min(r.bottom, frame.bottom) - Math.max(r.top, frame.top);
|
|
146
|
+
if (ix <= 0 || iy <= 0) continue; // off the frame (docked beside it)
|
|
147
|
+
if ((r.left + r.right) / 2 <= mid) lo = Math.max(lo, r.right);
|
|
148
|
+
else hi = Math.min(hi, r.left);
|
|
149
|
+
}
|
|
150
|
+
const left = Math.ceil(lo - frame.left);
|
|
151
|
+
const right = Math.floor(hi - frame.left);
|
|
152
|
+
return left < right ? { left, right } : null;
|
|
153
|
+
}
|
|
@@ -10,17 +10,33 @@
|
|
|
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:8px;height:44px;padding:
|
|
35
|
+
.dc-theme-pill{position:fixed;left:50%;top:16px;translate:-50% 0;z-index:2147483000;box-sizing:border-box;display:flex;align-items:center;gap:8px;min-width:0;min-height:44px;padding:4px 8px 4px 12px;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>:not(.dc-theme-pill-text){flex:none}
|
|
22
37
|
.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
|
|
38
|
+
.dc-theme-pill-text{display:flex;flex-direction:column;justify-content:center;align-items:flex-start;min-width:0;flex:0 1 auto}
|
|
39
|
+
.dc-theme-pill-title{display:block;max-width:100%;overflow:hidden;text-overflow:ellipsis;font-weight:600;line-height:16px}
|
|
24
40
|
.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
41
|
.dc-theme-pill-seg:first-child{margin-left:0}
|
|
26
42
|
.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 +44,8 @@ const PILL_CSS = `
|
|
|
28
44
|
.dc-theme-pill-b:disabled{opacity:.4;cursor:default}
|
|
29
45
|
.dc-theme-pill-b--ic{display:grid;place-items:center;padding:4px 7px}
|
|
30
46
|
.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:
|
|
47
|
+
.dc-theme-pill-path{appearance:none;display:block;border:0;border-radius:var(--maude-hud-radius-xs,4px);padding:0 2px;margin:0 -2px;background:transparent;color:var(--maude-chrome-fg-2);font:inherit;font-size:var(--maude-hud-type-xs,11px);line-height:14px;font-family:var(--maude-chrome-font-mono,ui-monospace,monospace);text-align:left;cursor:pointer;max-width:calc(100% + 4px);overflow:hidden;text-overflow:ellipsis;white-space:nowrap}
|
|
48
|
+
.dc-theme-pill[data-path="hidden"] .dc-theme-pill-path{position:absolute;visibility:hidden;pointer-events:none}
|
|
32
49
|
.dc-theme-pill-path:hover{background:var(--maude-chrome-bg-3);color:var(--maude-chrome-fg-0)}
|
|
33
50
|
.dc-theme-pill-path:focus-visible{outline:2px solid var(--maude-hud-focus-ring);outline-offset:1px}
|
|
34
51
|
.dc-theme-pill-b:focus-visible{outline:2px solid var(--maude-hud-focus-ring);outline-offset:1px}
|
|
@@ -53,6 +70,79 @@ export function shortenCanvasPath(path: string, max = PATH_MAX): string {
|
|
|
53
70
|
return `…/${out}`;
|
|
54
71
|
}
|
|
55
72
|
|
|
73
|
+
/** #217 — the room the pill keeps from each top island, and from the frame's edges with no band. */
|
|
74
|
+
export const PILL_BAND_GAP = 12;
|
|
75
|
+
/** #217 — the path line stays while it can show at least this much (an ellipsis eats the rest); narrower, it goes. */
|
|
76
|
+
export const PATH_MIN_PX = 96;
|
|
77
|
+
|
|
78
|
+
/**
|
|
79
|
+
* #217 — where the pill sits: centred in the shell's free top band (clamped to the frame), never wider than the band
|
|
80
|
+
* less a gap on each side. No band (an older shell, nothing usable) ⇒ the frame's centre, as before.
|
|
81
|
+
* @returns `left` (px from the frame's left edge, the pill's centre) and `maxWidth` (px, ≥ 0)
|
|
82
|
+
*/
|
|
83
|
+
export function pillPlacement(
|
|
84
|
+
band: Readonly<TopBand> | null,
|
|
85
|
+
viewportWidth: number
|
|
86
|
+
): { left: number; maxWidth: number; banded: boolean } {
|
|
87
|
+
const vw = Math.max(0, viewportWidth);
|
|
88
|
+
if (band) {
|
|
89
|
+
const l = Math.max(0, band.left);
|
|
90
|
+
const r = Math.min(vw, band.right);
|
|
91
|
+
if (r > l)
|
|
92
|
+
return {
|
|
93
|
+
left: Math.round((l + r) / 2),
|
|
94
|
+
maxWidth: Math.max(0, Math.floor(r - l - 2 * PILL_BAND_GAP)),
|
|
95
|
+
banded: true,
|
|
96
|
+
};
|
|
97
|
+
}
|
|
98
|
+
return { left: Math.round(vw / 2), maxWidth: Math.max(0, vw - 2 * PILL_BAND_GAP), banded: false };
|
|
99
|
+
}
|
|
100
|
+
|
|
101
|
+
/**
|
|
102
|
+
* #217 — does the path line stay? `avail` is the width the two-line text column may take (the pill's max width
|
|
103
|
+
* less its icon, Light | Dark and the rest); `title` / `path` are the lines' natural widths. The path goes first:
|
|
104
|
+
* it stays only while the name fits whole AND the path can show at least PATH_MIN_PX (or all of itself).
|
|
105
|
+
*/
|
|
106
|
+
export function showPathLine(avail: number, title: number, path: number): boolean {
|
|
107
|
+
if (!(path > 0)) return false;
|
|
108
|
+
return avail >= Math.max(title, Math.min(path, PATH_MIN_PX));
|
|
109
|
+
}
|
|
110
|
+
|
|
111
|
+
const noSub = () => () => {};
|
|
112
|
+
|
|
113
|
+
/** The laid-out width of an element's text, overflow or not (0 without layout). */
|
|
114
|
+
function textWidthOf(el: Element): number {
|
|
115
|
+
try {
|
|
116
|
+
const r = el.ownerDocument.createRange();
|
|
117
|
+
r.selectNodeContents(el);
|
|
118
|
+
return r.getBoundingClientRect().width;
|
|
119
|
+
} catch {
|
|
120
|
+
return 0;
|
|
121
|
+
}
|
|
122
|
+
}
|
|
123
|
+
|
|
124
|
+
/** The shell's top band, live (null outside a browser document or before the shell sent one). */
|
|
125
|
+
function useTopBand(): Readonly<TopBand> | null {
|
|
126
|
+
const s = typeof window === 'undefined' ? null : canvasModeStore(window);
|
|
127
|
+
return useSyncExternalStore(
|
|
128
|
+
s ? s.subscribe : noSub,
|
|
129
|
+
() => s?.get().topBand ?? null,
|
|
130
|
+
() => null
|
|
131
|
+
);
|
|
132
|
+
}
|
|
133
|
+
|
|
134
|
+
/** The frame's width, live (the fallback centring and the band's clamp read it). */
|
|
135
|
+
function useViewportWidth(): number {
|
|
136
|
+
const [w, setW] = useState(() => (typeof window === 'undefined' ? 0 : window.innerWidth));
|
|
137
|
+
useEffect(() => {
|
|
138
|
+
if (typeof window === 'undefined') return undefined;
|
|
139
|
+
const on = () => setW(window.innerWidth);
|
|
140
|
+
window.addEventListener('resize', on);
|
|
141
|
+
return () => window.removeEventListener('resize', on);
|
|
142
|
+
}, []);
|
|
143
|
+
return w;
|
|
144
|
+
}
|
|
145
|
+
|
|
56
146
|
/** The canvas's project-relative path (`.design/ui/v2/02 Onboarding.tsx`), as the shell stored it on the frame. */
|
|
57
147
|
function canvasFilePath(): string | null {
|
|
58
148
|
if (typeof window === 'undefined') return null;
|
|
@@ -109,40 +199,93 @@ export function CanvasThemePill({
|
|
|
109
199
|
};
|
|
110
200
|
const both = bothThemes();
|
|
111
201
|
const name = getCanvasThemeSystemName();
|
|
202
|
+
// #217 — placed in the shell's free top band; the path line goes first when the band is short
|
|
203
|
+
const band = useTopBand();
|
|
204
|
+
const vw = useViewportWidth();
|
|
205
|
+
const place = pillPlacement(band, vw);
|
|
206
|
+
const pillRef = useRef<HTMLDivElement>(null);
|
|
207
|
+
const textRef = useRef<HTMLSpanElement>(null);
|
|
208
|
+
const titleRef = useRef<HTMLElement>(null);
|
|
209
|
+
const pathRef = useRef<HTMLButtonElement>(null);
|
|
210
|
+
const [pathShown, setPathShown] = useState(true);
|
|
211
|
+
// how many characters of the path fit: it loses its leading folders first, never its file name
|
|
212
|
+
const [pathChars, setPathChars] = useState(PATH_MAX);
|
|
213
|
+
// biome-ignore lint/correctness/useExhaustiveDependencies: name, file and copied change the lines' natural widths
|
|
214
|
+
useLayoutEffect(() => {
|
|
215
|
+
const pill = pillRef.current;
|
|
216
|
+
if (!pill) return undefined;
|
|
217
|
+
const fit = () => {
|
|
218
|
+
// the column is the only part that shrinks (the rest is flex: none), so the pill less the column is fixed
|
|
219
|
+
const fixed =
|
|
220
|
+
pill.getBoundingClientRect().width - (textRef.current?.getBoundingClientRect().width ?? 0);
|
|
221
|
+
const avail = place.maxWidth - fixed;
|
|
222
|
+
const btn = pathRef.current;
|
|
223
|
+
let pathW = btn?.scrollWidth ?? 0;
|
|
224
|
+
let chars = PATH_MAX;
|
|
225
|
+
const shown = btn?.textContent ?? '';
|
|
226
|
+
const textW = btn && file && copied === 'no' && shown ? textWidthOf(btn) : 0;
|
|
227
|
+
if (btn && file && textW > 0) {
|
|
228
|
+
// the path is set in a monospace face: one character's width prices the whole path and what fits
|
|
229
|
+
const charW = textW / shown.length;
|
|
230
|
+
const pad = Math.max(0, btn.scrollWidth - textW);
|
|
231
|
+
pathW = charW * shortenCanvasPath(file).length + pad;
|
|
232
|
+
chars = Math.max(8, Math.min(PATH_MAX, Math.floor((avail - pad) / charW)));
|
|
233
|
+
}
|
|
234
|
+
const next = showPathLine(avail, titleRef.current?.scrollWidth ?? 0, pathW);
|
|
235
|
+
setPathShown((cur) => (cur === next ? cur : next));
|
|
236
|
+
setPathChars((cur) => (cur === chars ? cur : chars));
|
|
237
|
+
};
|
|
238
|
+
fit();
|
|
239
|
+
if (typeof ResizeObserver !== 'function') return undefined;
|
|
240
|
+
const ro = new ResizeObserver(fit); // Light | Dark and Canvas | Pages may change width after first paint
|
|
241
|
+
ro.observe(pill);
|
|
242
|
+
return () => ro.disconnect();
|
|
243
|
+
}, [place.maxWidth, name, file, copied]);
|
|
112
244
|
return (
|
|
113
245
|
<>
|
|
114
246
|
<style data-dc-theme-pill-css="">{PILL_CSS}</style>
|
|
115
247
|
<div
|
|
248
|
+
ref={pillRef}
|
|
116
249
|
className="dc-theme-pill"
|
|
117
250
|
data-dc-overlay=""
|
|
118
251
|
data-testid="canvas-theme-pill"
|
|
252
|
+
data-band={place.banded ? 'band' : 'frame'}
|
|
253
|
+
data-path={file ? (pathShown ? 'shown' : 'hidden') : undefined}
|
|
254
|
+
style={{ left: `${place.left}px`, maxWidth: `${place.maxWidth}px` }}
|
|
119
255
|
role="toolbar"
|
|
120
256
|
aria-label="Canvas theme"
|
|
121
257
|
>
|
|
122
258
|
{name ? (
|
|
123
|
-
|
|
124
|
-
<
|
|
125
|
-
|
|
126
|
-
</span>
|
|
127
|
-
<b>{name}</b>
|
|
128
|
-
</>
|
|
259
|
+
<span className="dc-theme-pill-ic" aria-hidden="true">
|
|
260
|
+
<DsIcon name="system" size={14} />
|
|
261
|
+
</span>
|
|
129
262
|
) : null}
|
|
130
|
-
{file ? (
|
|
131
|
-
<
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
263
|
+
{name || file ? (
|
|
264
|
+
<span ref={textRef} className="dc-theme-pill-text" data-testid="canvas-theme-text">
|
|
265
|
+
{name ? (
|
|
266
|
+
<b ref={titleRef} className="dc-theme-pill-title" data-testid="canvas-theme-title">
|
|
267
|
+
{name}
|
|
268
|
+
</b>
|
|
269
|
+
) : null}
|
|
270
|
+
{file ? (
|
|
271
|
+
<button
|
|
272
|
+
ref={pathRef}
|
|
273
|
+
type="button"
|
|
274
|
+
className="dc-theme-pill-path"
|
|
275
|
+
data-testid="canvas-theme-path"
|
|
276
|
+
title={`Copy relative path — ${file}`}
|
|
277
|
+
aria-label={`Copy relative path ${file}`}
|
|
278
|
+
aria-live="polite"
|
|
279
|
+
onClick={copyPath}
|
|
280
|
+
>
|
|
281
|
+
{copied === 'ok'
|
|
282
|
+
? 'Copied'
|
|
283
|
+
: copied === 'failed'
|
|
284
|
+
? 'Couldn’t copy'
|
|
285
|
+
: shortenCanvasPath(file, pathChars)}
|
|
286
|
+
</button>
|
|
287
|
+
) : null}
|
|
288
|
+
</span>
|
|
146
289
|
) : null}
|
|
147
290
|
<fieldset className="dc-theme-pill-seg" aria-label="Show every artboard in">
|
|
148
291
|
{(['light', 'dark'] as const).map((m) => (
|
|
@@ -238,7 +238,9 @@ import { CornerIcons } from './v2/shell/corner-icons.jsx';
|
|
|
238
238
|
import ShellErrorBoundary from './v2/shell/shell-error-boundary.jsx';
|
|
239
239
|
import { expectServedFrom, setServedFrom } from './v2/shell/served-routes.js';
|
|
240
240
|
import { cutCopyPaste, createMenuHandlers, menuRunner } from './v2/shell/menu-runner.js';
|
|
241
|
+
import { openAccountMenu } from './v2/shell/project-account-bus.js';
|
|
241
242
|
import DiagnosticsHost from './v2/diagnostics/diagnostics-host.jsx';
|
|
243
|
+
import LinkServerHost from './v2/link-server/LinkServerHost.jsx';
|
|
242
244
|
import { useDiagnosticsMenu } from './v2/diagnostics/use-diagnostics-menu.js';
|
|
243
245
|
import { menuCtx, moveDestinations } from './v2/shell/project-menu-model.js';
|
|
244
246
|
import { usePagesView } from './v2/shell/use-canvas-mode-lane.js';
|
|
@@ -1773,7 +1775,7 @@ function ShellProjectPill() {
|
|
|
1773
1775
|
onQuickSetup: () => setQuickSetupOpen(true),
|
|
1774
1776
|
onIntro: () => setIntroOpen(true),
|
|
1775
1777
|
onWhatsNew: whatsNew.openPanel,
|
|
1776
|
-
onShare: () => showShare(),
|
|
1778
|
+
onShare: (opts) => showShare(undefined, opts),
|
|
1777
1779
|
onReload: reloadActive,
|
|
1778
1780
|
onCloseCanvas: () => activePath && closeTab(activePath),
|
|
1779
1781
|
onAssembleVideo: assembleVideo,
|
|
@@ -1830,11 +1832,19 @@ function ShellProjectPill() {
|
|
|
1830
1832
|
form.submit();
|
|
1831
1833
|
return;
|
|
1832
1834
|
}
|
|
1835
|
+
// 2.1.1 T4 — the desktop: the avatar menu's Switch account list (accounts already on this Mac,
|
|
1836
|
+
// "No account — this Mac only"). It never moves the project to a fresh, empty account.
|
|
1837
|
+
openAccountMenu('switch');
|
|
1838
|
+
},
|
|
1839
|
+
// 2.1.1 T4 — "Add a Maude Cloud account…": V2-3.8's prepare (a profile already signed in to Maude
|
|
1840
|
+
// Cloud is never re-signed: the project moves to a profile of its own and reloads), then the cloud
|
|
1841
|
+
// sign-in where it lives, Settings › Connections.
|
|
1842
|
+
onAddCloudAccount: () => {
|
|
1833
1843
|
cloudSignInPrepare().then(
|
|
1834
1844
|
(moved) => {
|
|
1835
|
-
if (!moved)
|
|
1845
|
+
if (!moved) setSettingsOpen('connections');
|
|
1836
1846
|
},
|
|
1837
|
-
(e) => shellToast(String(e?.message || e || 'Could not
|
|
1847
|
+
(e) => shellToast(String(e?.message || e || 'Could not add an account.'))
|
|
1838
1848
|
);
|
|
1839
1849
|
},
|
|
1840
1850
|
onCutPaste: (kind) => cutCopyPaste(kind, openerRef.current, { postToActiveCanvas }),
|
|
@@ -1906,7 +1916,7 @@ function ShellProjectPill() {
|
|
|
1906
1916
|
window.removeEventListener(OPEN_ASSETS_EVENT, onAttachAssets);
|
|
1907
1917
|
};
|
|
1908
1918
|
}, [openRightPanel, openTab, cfg?.designRel]);
|
|
1909
|
-
// S1.22c: the native tab menu's "
|
|
1919
|
+
// S1.22c: the native tab menu's "Switch account…" arrives as `menu://action
|
|
1910
1920
|
// {id:'account.switch'}` (tabs.rs TabMenuItem::SwitchAccount); it is not a palette row, so the
|
|
1911
1921
|
// palette's menu://action listener never runs it — the menu handler does.
|
|
1912
1922
|
useEffect(() => {
|
|
@@ -3217,6 +3227,8 @@ function ShellTree() {
|
|
|
3217
3227
|
<ShellProjectPill />
|
|
3218
3228
|
{/* V2-4.7b — Menu › Diagnostics: Logs · Server · AI setup · Sync (today's Sync panel, whole). */}
|
|
3219
3229
|
<DiagnosticsHost toast={shellToast} />
|
|
3230
|
+
{/* 2.1.1 T5 — `account.link-server`: the one "Link your server" dialog (avatar, Settings, Sync). */}
|
|
3231
|
+
<LinkServerHost />
|
|
3220
3232
|
{/* V2-4.3a — the Share cluster, top-right: faces, status word, comments, Exports, Hide panels, Share. */}
|
|
3221
3233
|
<ShellShareCluster />
|
|
3222
3234
|
{/* S2.20 — Menu › Edit › Undo history… (the ⌘Z projection's popover). */}
|
|
@@ -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
|
+
}
|