@1agh/maude 0.60.5 → 0.60.7
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/annotations-layer.tsx +21 -12
- package/apps/studio/canvas-comment-mount.tsx +7 -1
- package/apps/studio/canvas-icons.tsx +30 -2
- package/apps/studio/canvas-lib.tsx +25 -3
- package/apps/studio/canvas-shell.tsx +5 -4
- package/apps/studio/client/app.jsx +20 -13
- package/apps/studio/dist/client.bundle.js +1 -1
- package/apps/studio/dist/comment-mount.js +2 -2
- package/apps/studio/hmr-broadcast.ts +40 -2
- package/apps/studio/sync/asset-push.ts +65 -0
- package/apps/studio/sync/index.ts +100 -2
- package/apps/studio/test/canvas-wheel-delta.test.ts +42 -0
- package/apps/studio/test/comment-mount.test.ts +10 -1
- package/apps/studio/test/hmr-broadcast.test.ts +6 -4
- package/apps/studio/test/hmr-classify.test.ts +18 -1
- package/apps/studio/test/mode-toggle.test.tsx +226 -0
- package/apps/studio/test/sync-asset-push.test.ts +115 -4
- package/apps/studio/test/use-tool-mode.test.tsx +33 -3
- package/apps/studio/tool-palette.tsx +86 -24
- package/apps/studio/use-tool-mode.tsx +113 -14
- package/apps/studio/whats-new.json +36 -0
- package/package.json +8 -8
- package/plugins/design/templates/_shell.html +31 -0
|
@@ -44,14 +44,42 @@ export interface ToolDescriptor {
|
|
|
44
44
|
*/
|
|
45
45
|
export type ShapeKind = 'square' | 'rounded' | 'circle' | 'diamond' | 'triangle' | 'triangle-down';
|
|
46
46
|
|
|
47
|
+
/**
|
|
48
|
+
* DDR-223 (issue #93) — the binary canvas mode over the tool set. `preview`
|
|
49
|
+
* rests on `browse` (pure pass-through, the mock is alive; annotation tools
|
|
50
|
+
* stay usable); `edit` rests on `move` (the Figma select ladder). The mode is
|
|
51
|
+
* a store-level layer — `classify()` and every `tool === 'move'` gate are
|
|
52
|
+
* untouched (DDR-187's decomposition stands).
|
|
53
|
+
*/
|
|
54
|
+
export type CanvasMode = 'preview' | 'edit';
|
|
55
|
+
|
|
56
|
+
/** The resting tool each mode arms (and returns to via `resetTool`). */
|
|
57
|
+
export const MODE_DEFAULT_TOOL: Readonly<Record<CanvasMode, Tool>> = Object.freeze({
|
|
58
|
+
preview: 'browse',
|
|
59
|
+
edit: 'move',
|
|
60
|
+
});
|
|
61
|
+
|
|
62
|
+
/**
|
|
63
|
+
* Mode implied by arming a mode-exclusive resting tool. `browse` and `move`
|
|
64
|
+
* are the only mode-carrying tools; everything else (comment, draw set) is
|
|
65
|
+
* mode-NEUTRAL — arming pen in preview keeps you in preview (the issue-#93
|
|
66
|
+
* "annotations work in preview" contract).
|
|
67
|
+
*/
|
|
68
|
+
function modeForTool(t: Tool): CanvasMode | null {
|
|
69
|
+
if (t === 'browse') return 'preview';
|
|
70
|
+
if (t === 'move') return 'edit';
|
|
71
|
+
return null;
|
|
72
|
+
}
|
|
73
|
+
|
|
47
74
|
// Phase 21 — every tool ships a custom 32×32 SVG cursor (canvas-cursors.ts)
|
|
48
75
|
// with a white outline halo so the glyph reads on any background. The native
|
|
49
76
|
// crosshair/text/cell were thin + tiny ("pen almost invisible"); these mirror
|
|
50
77
|
// the tool-palette icons. `move` keeps the system arrow on purpose.
|
|
51
78
|
export const DEFAULT_TOOLS: readonly ToolDescriptor[] = Object.freeze([
|
|
52
|
-
// feature-4 — Browse is the
|
|
53
|
-
//
|
|
54
|
-
//
|
|
79
|
+
// feature-4 — Browse is the pure pass-through tool: the mock is alive
|
|
80
|
+
// (buttons click). Since DDR-223 it is the PREVIEW mode's resting tool (the
|
|
81
|
+
// boot default moved to edit/`move`); no letter shortcut — it's armed via
|
|
82
|
+
// the Preview toggle / Esc-in-preview.
|
|
55
83
|
{ id: 'browse', label: 'Browse', shortcut: '', cursor: TOOL_CURSORS.browse },
|
|
56
84
|
{ id: 'move', label: 'Select', shortcut: 'V', cursor: TOOL_CURSORS.move },
|
|
57
85
|
{ id: 'hand', label: 'Hand', shortcut: 'H', cursor: TOOL_CURSORS.hand },
|
|
@@ -91,6 +119,14 @@ interface ToolContextValue {
|
|
|
91
119
|
tool: Tool;
|
|
92
120
|
setTool: (t: Tool) => void;
|
|
93
121
|
tools: readonly ToolDescriptor[];
|
|
122
|
+
/** DDR-223 — the binary canvas mode. Kept coherent with `tool` (arming
|
|
123
|
+
* `move`/`browse` moves the mode; `setMode` arms the mode's resting tool). */
|
|
124
|
+
mode: CanvasMode;
|
|
125
|
+
setMode: (m: CanvasMode) => void;
|
|
126
|
+
/** Arm the current mode's resting tool — the Esc / post-draw-commit flip.
|
|
127
|
+
* `move` in edit (byte-identical to the pre-DDR-223 hardcode), `browse` in
|
|
128
|
+
* preview (drawing an annotation never silently exits the alive posture). */
|
|
129
|
+
resetTool: () => void;
|
|
94
130
|
/** T19 — sticky-tool double-click lock. When `sticky.locked === true` AND
|
|
95
131
|
* `sticky.tool === tool`, draw tools stay armed after each shape commit
|
|
96
132
|
* (T18 auto-flip is suppressed). Single-click on any other tool clears
|
|
@@ -111,23 +147,33 @@ const ToolContext = createContext<ToolContextValue | null>(null);
|
|
|
111
147
|
export function ToolProvider({
|
|
112
148
|
children,
|
|
113
149
|
tools: toolsProp = DEFAULT_TOOLS,
|
|
114
|
-
//
|
|
115
|
-
//
|
|
116
|
-
//
|
|
117
|
-
//
|
|
118
|
-
|
|
150
|
+
// DDR-223 (issue #93, supersedes DDR-187's boot half) — authoring surfaces
|
|
151
|
+
// boot into EDIT with `move` (V) armed: click-selects from the first frame,
|
|
152
|
+
// Preview (the alive pass-through posture) is one always-visible toggle
|
|
153
|
+
// away. Read-only canvases (cloud viewers) keep the DDR-187 posture and
|
|
154
|
+
// boot preview/`browse` — a viewer's job is to use the live mock. The
|
|
155
|
+
// comment-mount layer passes `initial='browse'` explicitly so bare DS
|
|
156
|
+
// specimens stay alive too.
|
|
157
|
+
initial,
|
|
158
|
+
initialMode,
|
|
119
159
|
}: {
|
|
120
160
|
children: ReactNode;
|
|
121
161
|
tools?: readonly ToolDescriptor[];
|
|
122
162
|
initial?: Tool;
|
|
163
|
+
initialMode?: CanvasMode;
|
|
123
164
|
}) {
|
|
124
165
|
// Cloud Phase 25 C2 — a read-only canvas keeps only navigate/inspect tools.
|
|
125
166
|
// Filtering HERE covers every consumer at once: the palette renders from
|
|
126
167
|
// `tools`, the input router's letter shortcuts resolve against `tools`, and
|
|
127
168
|
// `setTool` below refuses anything outside the list (the shell `tool-set`
|
|
128
169
|
// postMessage lane included).
|
|
129
|
-
const
|
|
130
|
-
const
|
|
170
|
+
const readOnly = isReadOnlyCanvas();
|
|
171
|
+
const tools = useMemo(() => filterToolsForReadOnly(toolsProp, readOnly), [toolsProp, readOnly]);
|
|
172
|
+
const bootTool: Tool = initial ?? (readOnly ? 'browse' : 'move');
|
|
173
|
+
const bootMode: CanvasMode =
|
|
174
|
+
initialMode ?? modeForTool(bootTool) ?? (readOnly ? 'preview' : 'edit');
|
|
175
|
+
const [tool, setToolState] = useState<Tool>(bootTool);
|
|
176
|
+
const [mode, setModeState] = useState<CanvasMode>(bootMode);
|
|
131
177
|
const [sticky, setSticky] = useState<{ tool: Tool | null; locked: boolean }>(() => ({
|
|
132
178
|
tool: null,
|
|
133
179
|
locked: false,
|
|
@@ -138,12 +184,39 @@ export function ToolProvider({
|
|
|
138
184
|
// shortcut or postMessage can't arm a tool the palette doesn't show.
|
|
139
185
|
if (!tools.some((d) => d.id === t)) return;
|
|
140
186
|
setToolState(t);
|
|
187
|
+
// DDR-223 — mode⇄tool invariant: arming a resting tool moves the mode
|
|
188
|
+
// with it, so V, the menubar `tool-set` lane, and the Cmd+click-in-
|
|
189
|
+
// browse escape hatch all land in EDIT coherently (and arming browse
|
|
190
|
+
// lands in PREVIEW). Annotation tools leave the mode alone. This is
|
|
191
|
+
// also what keeps `move` structurally unreachable inside preview — the
|
|
192
|
+
// moment it arms, the mode is edit, so no `tool === 'move'` gate can
|
|
193
|
+
// ever fire while the UI claims preview.
|
|
194
|
+
const m = modeForTool(t);
|
|
195
|
+
if (m) setModeState(m);
|
|
141
196
|
// Single-click on a different tool clears any sticky lock — sticky is
|
|
142
197
|
// a per-tool flag, not global.
|
|
143
198
|
setSticky((prev) => (prev.locked && prev.tool === t ? prev : { tool: null, locked: false }));
|
|
144
199
|
},
|
|
145
200
|
[tools]
|
|
146
201
|
);
|
|
202
|
+
const setMode = useCallback(
|
|
203
|
+
(m: CanvasMode) => {
|
|
204
|
+
// Switching mode arms its resting tool (Figma-style: the toggle IS the
|
|
205
|
+
// posture). Read-only keeps both browse+move on its allowlist, so the
|
|
206
|
+
// guard below never fires there; it exists for exotic custom `tools`.
|
|
207
|
+
const rest = MODE_DEFAULT_TOOL[m];
|
|
208
|
+
if (!tools.some((d) => d.id === rest)) return;
|
|
209
|
+
setModeState(m);
|
|
210
|
+
setToolState(rest);
|
|
211
|
+
setSticky((prev) =>
|
|
212
|
+
prev.locked && prev.tool === rest ? prev : { tool: null, locked: false }
|
|
213
|
+
);
|
|
214
|
+
},
|
|
215
|
+
[tools]
|
|
216
|
+
);
|
|
217
|
+
const resetTool = useCallback(() => {
|
|
218
|
+
setTool(MODE_DEFAULT_TOOL[mode]);
|
|
219
|
+
}, [mode, setTool]);
|
|
147
220
|
const toggleSticky = useCallback((t: Tool) => {
|
|
148
221
|
setSticky((prev) => {
|
|
149
222
|
if (prev.locked && prev.tool === t) return { tool: null, locked: false };
|
|
@@ -227,8 +300,20 @@ export function ToolProvider({
|
|
|
227
300
|
}, [tool, tools]);
|
|
228
301
|
|
|
229
302
|
const value = useMemo<ToolContextValue>(
|
|
230
|
-
() => ({
|
|
231
|
-
|
|
303
|
+
() => ({
|
|
304
|
+
tool,
|
|
305
|
+
setTool,
|
|
306
|
+
tools,
|
|
307
|
+
mode,
|
|
308
|
+
setMode,
|
|
309
|
+
resetTool,
|
|
310
|
+
sticky,
|
|
311
|
+
toggleSticky,
|
|
312
|
+
clearSticky,
|
|
313
|
+
shapeKind,
|
|
314
|
+
setShapeKind,
|
|
315
|
+
}),
|
|
316
|
+
[tool, setTool, tools, mode, setMode, resetTool, sticky, toggleSticky, clearSticky, shapeKind]
|
|
232
317
|
);
|
|
233
318
|
|
|
234
319
|
return <ToolContext.Provider value={value}>{children}</ToolContext.Provider>;
|
|
@@ -240,10 +325,24 @@ export function ToolProvider({
|
|
|
240
325
|
* `DesignCanvas` consumes that instance instead of double-mounting. The hook
|
|
241
326
|
* is called unconditionally; only the returned tree branches (hook rules).
|
|
242
327
|
*/
|
|
243
|
-
export function MaybeToolProvider({
|
|
328
|
+
export function MaybeToolProvider({
|
|
329
|
+
children,
|
|
330
|
+
initial,
|
|
331
|
+
initialMode,
|
|
332
|
+
}: {
|
|
333
|
+
children: ReactNode;
|
|
334
|
+
/** DDR-223 — forwarded so the comment-mount layer can pin bare DS
|
|
335
|
+
* specimens to the preview/`browse` posture (see canvas-comment-mount). */
|
|
336
|
+
initial?: Tool;
|
|
337
|
+
initialMode?: CanvasMode;
|
|
338
|
+
}) {
|
|
244
339
|
const outer = useContext(ToolContext);
|
|
245
340
|
if (outer) return <>{children}</>;
|
|
246
|
-
return
|
|
341
|
+
return (
|
|
342
|
+
<ToolProvider initial={initial} initialMode={initialMode}>
|
|
343
|
+
{children}
|
|
344
|
+
</ToolProvider>
|
|
345
|
+
);
|
|
247
346
|
}
|
|
248
347
|
|
|
249
348
|
// ─────────────────────────────────────────────────────────────────────────────
|
|
@@ -1,6 +1,42 @@
|
|
|
1
1
|
{
|
|
2
2
|
"$schema": "./whats-new.schema.json",
|
|
3
3
|
"entries": [
|
|
4
|
+
{
|
|
5
|
+
"id": "instant-asset-sync",
|
|
6
|
+
"version": "0.60.7",
|
|
7
|
+
"date": "2026-08-16",
|
|
8
|
+
"kind": "improvement",
|
|
9
|
+
"title": "Pictures sync in seconds",
|
|
10
|
+
"summary": "A picture you drop on a canvas is pushed by itself the moment it lands, and the other side fetches it the moment the reference arrives — seconds end to end, instead of waiting for the next full sweep or polling tick.",
|
|
11
|
+
"surface": "design-ui"
|
|
12
|
+
},
|
|
13
|
+
{
|
|
14
|
+
"id": "assets-arrive-and-heal",
|
|
15
|
+
"version": "0.60.6",
|
|
16
|
+
"date": "2026-08-15",
|
|
17
|
+
"kind": "fix",
|
|
18
|
+
"title": "Dropped images reach every machine, live",
|
|
19
|
+
"summary": "A picture added on one machine now arrives on your others while you watch: the cloud serves it the moment it has it, and a broken-image frame heals in place when the file lands — no reload needed.",
|
|
20
|
+
"surface": "design-ui"
|
|
21
|
+
},
|
|
22
|
+
{
|
|
23
|
+
"id": "preview-edit-mode-toggle",
|
|
24
|
+
"version": "0.60.6",
|
|
25
|
+
"date": "2026-08-15",
|
|
26
|
+
"kind": "feature",
|
|
27
|
+
"title": "Preview, Edit and Present in one switch",
|
|
28
|
+
"summary": "Canvases open in Edit — clicking selects right away, like Figma. A new three-way switch in the toolbar flips to Preview (the mock is live and clickable; comments and drawing still work) or straight into Presentation.",
|
|
29
|
+
"surface": "design-ui"
|
|
30
|
+
},
|
|
31
|
+
{
|
|
32
|
+
"id": "desktop-splash-recovers-itself",
|
|
33
|
+
"version": "0.60.6",
|
|
34
|
+
"date": "2026-08-15",
|
|
35
|
+
"kind": "fix",
|
|
36
|
+
"title": "No more getting stuck on “Starting…”",
|
|
37
|
+
"summary": "The desktop app could go black and sit on the startup screen for good — often right after a command finished — with a force-quit as the only way out. It now finds its way back on its own, in about a second, and keeps your session instead of losing it.",
|
|
38
|
+
"surface": "desktop"
|
|
39
|
+
},
|
|
4
40
|
{
|
|
5
41
|
"id": "annotations-survive-cold-start",
|
|
6
42
|
"version": "0.60.5",
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@1agh/maude",
|
|
3
|
-
"version": "0.60.
|
|
3
|
+
"version": "0.60.7",
|
|
4
4
|
"description": "Marketplace of Claude Code plugins by Michal Dovrtěl: `design` (canvas-first design iteration) + `flow` (generic agentic workflow loop with .ai second brain). Ships the `maude` CLI (with `mdcc` legacy alias) to scaffold workspace, run the design dev server, and manage configs.",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"engines": {
|
|
@@ -54,13 +54,13 @@
|
|
|
54
54
|
"test:e2e:desktop:parity:cloud": "pnpm --filter @maude/desktop-e2e e2e:parity:cloud"
|
|
55
55
|
},
|
|
56
56
|
"optionalDependencies": {
|
|
57
|
-
"@1agh/maude-darwin-arm64": "0.60.
|
|
58
|
-
"@1agh/maude-darwin-x64": "0.60.
|
|
59
|
-
"@1agh/maude-linux-arm64": "0.60.
|
|
60
|
-
"@1agh/maude-linux-arm64-musl": "0.60.
|
|
61
|
-
"@1agh/maude-linux-x64": "0.60.
|
|
62
|
-
"@1agh/maude-linux-x64-musl": "0.60.
|
|
63
|
-
"@1agh/maude-win32-x64": "0.60.
|
|
57
|
+
"@1agh/maude-darwin-arm64": "0.60.7",
|
|
58
|
+
"@1agh/maude-darwin-x64": "0.60.7",
|
|
59
|
+
"@1agh/maude-linux-arm64": "0.60.7",
|
|
60
|
+
"@1agh/maude-linux-arm64-musl": "0.60.7",
|
|
61
|
+
"@1agh/maude-linux-x64": "0.60.7",
|
|
62
|
+
"@1agh/maude-linux-x64-musl": "0.60.7",
|
|
63
|
+
"@1agh/maude-win32-x64": "0.60.7"
|
|
64
64
|
},
|
|
65
65
|
"files": [
|
|
66
66
|
"cli",
|
|
@@ -463,6 +463,37 @@
|
|
|
463
463
|
.catch(() => {
|
|
464
464
|
/* network blip — next interaction will retry */
|
|
465
465
|
});
|
|
466
|
+
} else if (msg.mode === 'asset') {
|
|
467
|
+
// 2026-08-15 annotations-assets RCA — a synced-down media file
|
|
468
|
+
// just landed on disk. Any <img> / SVG <image> that already
|
|
469
|
+
// 404'd on it shows the broken glyph FOREVER (browsers never
|
|
470
|
+
// retry a failed load), so the heal was invisible: the bytes
|
|
471
|
+
// arrived, the canvas stayed broken until a manual reload.
|
|
472
|
+
// Re-point matching, still-broken elements at a cache-busted
|
|
473
|
+
// URL — no reload, no React state loss. A later React render
|
|
474
|
+
// restoring the clean URL refetches it fresh (the file exists
|
|
475
|
+
// now), so both URLs converge on the good bytes.
|
|
476
|
+
const assetName = (msg.file || '').split('/').pop();
|
|
477
|
+
if (!assetName) return;
|
|
478
|
+
const v = msg.version || Date.now();
|
|
479
|
+
const nameMatches = function (u) {
|
|
480
|
+
if (!u) return false;
|
|
481
|
+
return u.indexOf(assetName) !== -1 || u.indexOf(encodeURIComponent(assetName)) !== -1;
|
|
482
|
+
};
|
|
483
|
+
for (const img of document.querySelectorAll('img')) {
|
|
484
|
+
const src = img.getAttribute('src');
|
|
485
|
+
if (!nameMatches(src)) continue;
|
|
486
|
+
// Already rendering fine — don't churn a working image.
|
|
487
|
+
if (img.complete && img.naturalWidth > 0) continue;
|
|
488
|
+
img.setAttribute('src', src.split('?')[0] + '?v=' + v);
|
|
489
|
+
}
|
|
490
|
+
for (const el of document.querySelectorAll('image')) {
|
|
491
|
+
const href = el.getAttribute('href') || el.getAttribute('xlink:href');
|
|
492
|
+
if (!nameMatches(href)) continue;
|
|
493
|
+
// SVG <image> exposes no broken-state flag — re-pointing a
|
|
494
|
+
// working one is a cheap refetch of now-cached bytes.
|
|
495
|
+
el.setAttribute('href', href.split('?')[0] + '?v=' + v);
|
|
496
|
+
}
|
|
466
497
|
}
|
|
467
498
|
} catch (e) {
|
|
468
499
|
console.warn('[canvas-shell] HMR message parse error', e);
|