@1agh/maude 1.8.1 → 1.9.1

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.
Files changed (73) hide show
  1. package/apps/studio/acp/bridge.ts +14 -2
  2. package/apps/studio/acp/probe.ts +51 -1
  3. package/apps/studio/api.ts +19 -4
  4. package/apps/studio/bin/_curl-local.mjs +7 -0
  5. package/apps/studio/bin/annotate.mjs +16 -7
  6. package/apps/studio/bin/read-annotations.mjs +62 -4
  7. package/apps/studio/client/app.jsx +428 -15977
  8. package/apps/studio/client/dialogs/asset-picker.jsx +331 -0
  9. package/apps/studio/client/dialogs/command-palette.jsx +112 -0
  10. package/apps/studio/client/dialogs/export-dialog.jsx +782 -0
  11. package/apps/studio/client/dialogs/help-modal.jsx +324 -0
  12. package/apps/studio/client/dialogs/shortcuts-overlay.jsx +144 -0
  13. package/apps/studio/client/hooks/use-canvas-bridge.jsx +2150 -0
  14. package/apps/studio/client/hooks/use-git-actions.jsx +236 -0
  15. package/apps/studio/client/hooks/use-keyboard-shortcuts.jsx +297 -0
  16. package/apps/studio/client/hooks/use-palette-and-panels.jsx +474 -0
  17. package/apps/studio/client/hooks/use-photo-and-timeline.jsx +901 -0
  18. package/apps/studio/client/hooks/use-project-data.jsx +90 -0
  19. package/apps/studio/client/hooks/use-shell-core.jsx +1212 -0
  20. package/apps/studio/client/hooks/use-tabs.jsx +723 -0
  21. package/apps/studio/client/hooks/use-web-socket.jsx +13 -0
  22. package/apps/studio/client/inspector/artboard-knobs.jsx +456 -0
  23. package/apps/studio/client/inspector/color-picker.jsx +196 -0
  24. package/apps/studio/client/inspector/color.js +92 -0
  25. package/apps/studio/client/inspector/css-knobs.jsx +1720 -0
  26. package/apps/studio/client/inspector/css-vocab.jsx +131 -0
  27. package/apps/studio/client/inspector/ds-tokens.js +90 -0
  28. package/apps/studio/client/inspector/grid-tracks-editor.jsx +97 -0
  29. package/apps/studio/client/inspector/inspect-computed.jsx +68 -0
  30. package/apps/studio/client/inspector/inspector-panel.jsx +769 -0
  31. package/apps/studio/client/inspector/layers.jsx +322 -0
  32. package/apps/studio/client/inspector/selection.js +65 -0
  33. package/apps/studio/client/inspector/token-popover.jsx +301 -0
  34. package/apps/studio/client/menus/menubar.jsx +856 -0
  35. package/apps/studio/client/selection-scope.js +40 -0
  36. package/apps/studio/client/shell/banners.jsx +272 -0
  37. package/apps/studio/client/shell/collapsed-rail.jsx +23 -0
  38. package/apps/studio/client/shell/comments-panel.jsx +177 -0
  39. package/apps/studio/client/shell/constants.js +60 -0
  40. package/apps/studio/client/shell/dock.jsx +131 -0
  41. package/apps/studio/client/shell/icons.jsx +370 -0
  42. package/apps/studio/client/shell/status-bar.jsx +215 -0
  43. package/apps/studio/client/shell/util.js +332 -0
  44. package/apps/studio/client/shell/viewport.jsx +254 -0
  45. package/apps/studio/client/system/system-view.jsx +255 -0
  46. package/apps/studio/client/tree/tree.jsx +1243 -0
  47. package/apps/studio/comments-overlay.tsx +6 -4
  48. package/apps/studio/config.schema.json +5 -0
  49. package/apps/studio/context.ts +13 -0
  50. package/apps/studio/dist/client.bundle.js +1337 -1337
  51. package/apps/studio/dist/comment-mount.js +2 -2
  52. package/apps/studio/exporters/_browser-bundles.ts +21 -2
  53. package/apps/studio/exporters/jobs.ts +75 -15
  54. package/apps/studio/exporters/scope.ts +15 -12
  55. package/apps/studio/format.ts +296 -0
  56. package/apps/studio/http.ts +217 -23
  57. package/apps/studio/server.ts +141 -30
  58. package/apps/studio/sync/accepted-link.ts +6 -0
  59. package/apps/studio/sync/agent.ts +9 -1
  60. package/apps/studio/sync/cold-start-apply.ts +29 -4
  61. package/apps/studio/sync/cold-start.ts +78 -0
  62. package/apps/studio/sync/file-plane.ts +61 -1
  63. package/apps/studio/sync/format-sync.ts +160 -0
  64. package/apps/studio/sync/index.ts +134 -10
  65. package/apps/studio/sync/journal-client.ts +25 -5
  66. package/apps/studio/sync/migrate-seed.ts +8 -1
  67. package/apps/studio/sync/status.ts +2 -0
  68. package/apps/studio/sync/transaction-client.ts +130 -13
  69. package/apps/studio/ui-prefs.ts +95 -10
  70. package/apps/studio/whats-new.json +9 -0
  71. package/apps/studio/ws.ts +19 -4
  72. package/cli/bin/claude-design-server.mjs +0 -0
  73. package/package.json +10 -8
@@ -0,0 +1,40 @@
1
+ // selection-scope.js — which selection belongs to which canvas (V2-2.8 P2).
2
+ //
3
+ // The shell keeps ONE `selected` value while the person switches canvases, so two consumers must
4
+ // ask "is this selection about the canvas I am looking at?":
5
+ // • the server's `selected` restore after our own select: an ECHO is only a restore for the
6
+ // same canvas file — a restore for another canvas (or none, after a switch) must apply, or the
7
+ // previous canvas's selection stays in the shell;
8
+ // • the Export dialog: it may scope to the selected artboard/element only when that selection is
9
+ // on the active canvas — otherwise Export targeted the previous canvas's artboard.
10
+
11
+ const first = (sel) => (Array.isArray(sel) ? sel[0] : sel) ?? null;
12
+
13
+ /** Is this incoming `selected` frame the echo of our own recent select (to be dropped)?
14
+ * `local` = `{ at, sel, file }`: what THIS shell selected (or cleared), when, and on which canvas
15
+ * file — recorded at the select itself, because the rendered selection lags the server's
16
+ * loopback echo. Inside the window everything about the SAME canvas is dropped, exactly as v1
17
+ * did (an echo of an older select must not overwrite a newer drill or multi-select). Only a
18
+ * frame about ANOTHER canvas applies (the restore that follows a canvas switch), and so does a
19
+ * null after a non-null select of ours (a canvas with nothing parked; our select was never null). */
20
+ export function isOwnSelectEcho(incoming, local, now = Date.now()) {
21
+ if (!local || now - local.at >= 2000) return false;
22
+ const one = first(incoming);
23
+ if (one == null) return first(local.sel) == null;
24
+ return one.file === local.file;
25
+ }
26
+
27
+ /** The `local` record for a select (or clear) THIS shell just made on `activePath`. */
28
+ export function localSelectRecord(sel, activePath, now = Date.now()) {
29
+ return { at: now, sel: sel ?? null, file: first(sel)?.file ?? activePath ?? null };
30
+ }
31
+
32
+ /** The Export dialog's selection inputs, scoped to the active canvas. */
33
+ export function exportSelectionFor(selected, activePath, canvasActiveArtboard) {
34
+ const sel = first(selected);
35
+ const onActive = sel != null && sel.file === activePath;
36
+ return {
37
+ activeArtboardId: (onActive ? sel.artboardId : null) ?? canvasActiveArtboard ?? null,
38
+ selection: onActive && sel.selector ? { selector: sel.selector, file: sel.file } : null,
39
+ };
40
+ }
@@ -0,0 +1,272 @@
1
+ // shell/banners.jsx — moved verbatim out of client/app.jsx (Maude v2 plan V2-0.2, move-only split).
2
+
3
+ import { useState } from 'react';
4
+ import { isNativeApp, restartToUpdate } from '../github.js';
5
+
6
+ // ---------- Sync banner (Phase 9 Task 8 — hub-down offline mode) ----------
7
+
8
+ // Renders nothing when online with no flash (the common case). Yellow strip
9
+ // while offline (with queued-edit count), red when offline > 24h, green flash
10
+ // for 3s right after a reconnect. Driven entirely by the 'sync:status' payload
11
+ // the dev-server's linked-mode sync runtime broadcasts.
12
+ // Phase 32 (Task 1) — auto-update notice. Shown after the shell has downloaded +
13
+ // staged a newer build in the background. Non-blocking: "Restart now" applies it,
14
+ // "Later" dismisses (the next focus/4h check re-stages and re-surfaces it).
15
+ /**
16
+ * What this role can do, said once, where a teammate lands — Cloud Phase 27 C3.
17
+ *
18
+ * A browser tab arrives with none of the context a desktop has: no window
19
+ * title, no app the person chose to install, and — for a viewer — a set of
20
+ * controls that will refuse them without explaining why. One line, dismissible,
21
+ * remembered per role. It re-appears if the role CHANGES, because "you can edit
22
+ * this now" is worth saying exactly as much as the first sentence was.
23
+ *
24
+ * Copy comes from the role the cell vouched (`role-matrix.mjs` is the authority
25
+ * on what each one means; this is its sentence, not a second opinion).
26
+ */
27
+ export const ROLE_LINE = {
28
+ owner: 'You own this project — edit, invite and export.',
29
+ member: 'You can edit this project, comment and export.',
30
+ viewer: 'You can look at this project, comment and download it, but not change it.',
31
+ };
32
+
33
+ export function CloudRoleBanner({ cloud }) {
34
+ const role = cloud?.role || null;
35
+ // Dismissal is READ AT RENDER, not seeded into state. `cfg.cloud` is
36
+ // `undefined` until `/_config` lands, so a `useState` initializer runs while
37
+ // there is no role yet — and whatever it decided then would stick forever,
38
+ // which on the first attempt meant the banner never appeared at all. Found by
39
+ // opening it in a browser; no test in this repo would have said a word.
40
+ const [dismissedNow, setDismissedNow] = useState(false);
41
+ if (!role || dismissedNow) return null;
42
+ const storageKey = `maude-cloud-role-seen:${role}`;
43
+ let alreadySeen = false;
44
+ try {
45
+ alreadySeen = localStorage.getItem(storageKey) === '1';
46
+ } catch {
47
+ /* private mode / storage disabled — show it, saying it twice beats never */
48
+ }
49
+ if (alreadySeen) return null;
50
+ const line = ROLE_LINE[role];
51
+ if (!line) return null;
52
+ return (
53
+ <div
54
+ role="status"
55
+ aria-live="polite"
56
+ className="st-banner st-banner--info"
57
+ data-testid="cloud-role-banner"
58
+ >
59
+ <span className="st-banner-dot" aria-hidden="true" />
60
+ <span>{line}</span>
61
+ <button
62
+ type="button"
63
+ className="btn btn--ghost btn--sm"
64
+ data-testid="cloud-role-banner-dismiss"
65
+ onClick={() => {
66
+ setDismissedNow(true);
67
+ try {
68
+ localStorage.setItem(storageKey, '1');
69
+ } catch {}
70
+ }}
71
+ >
72
+ Got it
73
+ </button>
74
+ </div>
75
+ );
76
+ }
77
+
78
+ /**
79
+ * V2-1.12 §5.8 — the 1.x side of a project that moved to Maude 2. The words
80
+ * are the contract's (CONTRACT §4 voice; "Update Maude to edit" is the signed
81
+ * A17 wording) and match `format.ts` FORMAT_COPY (test/format-gate-banner.test.ts).
82
+ */
83
+ export const FORMAT_GATE_LINE = {
84
+ newer: "This project now uses Maude 2. It's open here to look at — nothing in it is lost.",
85
+ action: 'Update Maude to edit',
86
+ noBuild: "This project now uses Maude 2, which isn't out yet. It stays open here to look at.",
87
+ cloud: "This project now uses Maude 2. It's open here to look at.",
88
+ };
89
+
90
+ /** Where a browser shell sends someone to get the newer app. */
91
+ export const DOWNLOAD_URL = 'https://maude.sh/download';
92
+
93
+ /**
94
+ * What the format banner says and offers — pure, so every variant is tested.
95
+ *
96
+ * • not gated, or gated by an OLDER project (v2's own dialog owns that) → null
97
+ * • a cloud tab: the cell runs the compat build; look only, no action (§9 Q2)
98
+ * • the desktop app: a staged update → restart into it; none staged once the
99
+ * person asked → the "isn't out yet" line, no action (§9 Q1 — the updater
100
+ * already checks at boot, on focus and every 4 h, so no newer build staged
101
+ * means none on this channel)
102
+ * • a browser shell: the download page
103
+ */
104
+ export function formatGateBannerState({ cfg, native, updateReady, askedForUpdate }) {
105
+ const gate = cfg?.formatGate;
106
+ if (!gate || !(gate.projectFormat > gate.supported)) return null;
107
+ if (cfg?.cloud) return { line: FORMAT_GATE_LINE.cloud, action: null };
108
+ if (native) {
109
+ if (updateReady) return { line: FORMAT_GATE_LINE.newer, action: 'restart' };
110
+ if (askedForUpdate) return { line: FORMAT_GATE_LINE.noBuild, action: null };
111
+ return { line: FORMAT_GATE_LINE.newer, action: 'check' };
112
+ }
113
+ return { line: FORMAT_GATE_LINE.newer, action: 'download' };
114
+ }
115
+
116
+ /**
117
+ * Not dismissible while gated: the project stays view only for as long as this
118
+ * build is older than it, and a banner that can be closed makes every refused
119
+ * edit after it look like a bug. A ShellTree child; ShellTree passes `cfg` and
120
+ * `updateReady` (1.x has no shell store — on feat/maude-v2 it reads the V2-2.3
121
+ * store instead).
122
+ */
123
+ export function FormatGateBanner({ cfg, updateReady }) {
124
+ const [askedForUpdate, setAskedForUpdate] = useState(false);
125
+ const [restarting, setRestarting] = useState(false);
126
+ const state = formatGateBannerState({
127
+ cfg,
128
+ native: isNativeApp(),
129
+ updateReady,
130
+ askedForUpdate,
131
+ });
132
+ if (!state) return null;
133
+ const onAction = () => {
134
+ if (state.action === 'restart') {
135
+ setRestarting(true);
136
+ restartToUpdate().catch(() => setRestarting(false));
137
+ } else if (state.action === 'check') {
138
+ setAskedForUpdate(true);
139
+ } else if (state.action === 'download') {
140
+ window.open(DOWNLOAD_URL, '_blank', 'noopener,noreferrer');
141
+ }
142
+ };
143
+ return (
144
+ <div
145
+ role="status"
146
+ aria-live="polite"
147
+ className="st-banner st-banner--info"
148
+ data-testid="format-gate-banner"
149
+ >
150
+ <span className="st-banner-dot" aria-hidden="true" />
151
+ <span>{state.line}</span>
152
+ {state.action && (
153
+ <button
154
+ type="button"
155
+ className="btn btn--primary btn--sm"
156
+ data-testid="format-gate-update"
157
+ disabled={restarting}
158
+ onClick={onAction}
159
+ >
160
+ {restarting ? 'Restarting…' : FORMAT_GATE_LINE.action}
161
+ </button>
162
+ )}
163
+ </div>
164
+ );
165
+ }
166
+
167
+ export function UpdateBanner({ update, onDismiss }) {
168
+ const [restarting, setRestarting] = useState(false);
169
+ if (!update) return null;
170
+ const ver = update.version ? ` (v${update.version})` : '';
171
+ return (
172
+ <div role="status" aria-live="polite" className="st-banner st-banner--info">
173
+ <span className="st-banner-dot" aria-hidden="true" />
174
+ <span>Maude updated{ver} · restart to apply</span>
175
+ <button
176
+ type="button"
177
+ className="btn btn--primary btn--sm"
178
+ disabled={restarting}
179
+ onClick={() => {
180
+ setRestarting(true);
181
+ restartToUpdate().catch(() => setRestarting(false));
182
+ }}
183
+ >
184
+ {restarting ? 'Restarting…' : 'Restart now'}
185
+ </button>
186
+ <button type="button" className="btn btn--ghost btn--sm" onClick={onDismiss}>
187
+ Later
188
+ </button>
189
+ </div>
190
+ );
191
+ }
192
+
193
+ export function SyncBanner({ status }) {
194
+ // Plan C follow-up — the banner overlapped the menubar and wasn't dismissable.
195
+ // Dismissal is keyed on the connection state, so a transition (reconnect flash,
196
+ // escalation to offline-long) re-surfaces it; a stable state stays hidden.
197
+ const [dismissedKey, setDismissedKey] = useState(null);
198
+ if (!status || status.linked === false) return null;
199
+ // DDR-060 / 9.1-D — the "linked but 0 syncable" state is surfaced in the
200
+ // status bar (sb-sync slot), NOT as a floating banner. This component owns
201
+ // the transient offline / reconnect-flash banner (Task 8) plus the DDR-102
202
+ // rejected-docs chip and divergence-resolution toast.
203
+ if (status.notSyncable) return null;
204
+ const { state, queuedOps, flash, conflicts } = status;
205
+ const showFlash = flash === 'synced';
206
+ const offline = state === 'offline' || state === 'offline-long';
207
+ // DDR-102 — per-doc rollup + the latest divergence notice (additive fields;
208
+ // an old payload without them renders exactly the pre-DDR-102 banner).
209
+ const rejected = status.docs?.rejected ?? 0;
210
+ const lastDiverged = Array.isArray(conflicts)
211
+ ? [...conflicts].reverse().find((c) => c.kind === 'cold-start-diverged')
212
+ : null;
213
+ if (!offline && !showFlash && !lastDiverged && rejected === 0) return null;
214
+
215
+ // One banner at a time — priority: reconnect flash > offline > divergence
216
+ // toast > rejected chip. Dismissal is keyed per state so a new event
217
+ // (another conflict, a changed rejected count) re-surfaces it.
218
+ let variant;
219
+ let text;
220
+ let dismissKey;
221
+ if (showFlash) {
222
+ variant = 'success';
223
+ text = 'Synced with hub';
224
+ dismissKey = `${state}:flash`;
225
+ } else if (offline) {
226
+ const conflictNote =
227
+ conflicts && conflicts.length > 0 ? ` (${conflicts.length} conflict notice(s))` : '';
228
+ if (state === 'offline-long') {
229
+ variant = 'error';
230
+ text = `Long offline — ${queuedOps} edit(s) queued. Consider \`git commit && git push\` as backup.${conflictNote}`;
231
+ } else {
232
+ variant = 'warn';
233
+ text = `Working offline · ${queuedOps} edit(s) queued · will sync when the hub reconnects.${conflictNote}`;
234
+ }
235
+ dismissKey = `${state}:offline`;
236
+ } else if (lastDiverged) {
237
+ // DDR-102 fail-closed: a snapshotFailed conflict means the hub-wins overwrite
238
+ // was REFUSED (local kept) because _history couldn't be written — surface it
239
+ // as an error, not a routine "kept newest" notice.
240
+ if (lastDiverged.snapshotFailed) {
241
+ variant = 'error';
242
+ text = `Diverged on ${lastDiverged.slug}: kept local — the history snapshot FAILED, so the overwrite was refused. Check disk space / .design/_history write access.`;
243
+ } else {
244
+ variant = 'warn';
245
+ text = `Diverged on ${lastDiverged.slug}: kept the ${
246
+ lastDiverged.winner === 'local' ? 'local (newer)' : 'hub'
247
+ } version — the other is snapshotted in history → /design:rollback ${lastDiverged.slug}`;
248
+ }
249
+ dismissKey = `diverged:${lastDiverged.slug}:${lastDiverged.at}`;
250
+ } else {
251
+ variant = 'warn';
252
+ text = `${rejected} canvas(es) not syncing — the hub rejected auth. Details: maude design status`;
253
+ dismissKey = `rejected:${rejected}`;
254
+ }
255
+ if (dismissedKey === dismissKey) return null;
256
+
257
+ return (
258
+ <div role="status" aria-live="polite" className={`st-banner st-banner--${variant}`}>
259
+ <span className="st-banner-dot" aria-hidden="true" />
260
+ <span>{text}</span>
261
+ <button
262
+ type="button"
263
+ className="st-banner-close"
264
+ aria-label="Dismiss"
265
+ title="Dismiss"
266
+ onClick={() => setDismissedKey(dismissKey)}
267
+ >
268
+ ×
269
+ </button>
270
+ </div>
271
+ );
272
+ }
@@ -0,0 +1,23 @@
1
+ // shell/collapsed-rail.jsx — moved verbatim out of client/app.jsx (Maude v2 plan V2-0.2, move-only split).
2
+
3
+ import { StIcon } from './icons.jsx';
4
+
5
+ // Collapsed rail — a thin strip shown when the sidebar is collapsed, with a
6
+ // re-open affordance + quick search/files shortcuts (mockup CollapsedRail).
7
+ export function CollapsedRail({ shown, onExpand, onSearch }) {
8
+ return (
9
+ <div className={'st-rail' + (shown ? ' is-shown' : '')}>
10
+ <div className="st-rail-inner">
11
+ <button type="button" className="st-iconbtn" aria-label="Expand sidebar" title="Expand sidebar (T)" onClick={onExpand}>
12
+ <StIcon name="panel-left" size={15} />
13
+ </button>
14
+ <button type="button" className="st-iconbtn" aria-label="Search" title="Search (/)" onClick={onSearch}>
15
+ <StIcon name="search" size={15} />
16
+ </button>
17
+ <button type="button" className="st-iconbtn" aria-label="Files" title="Files" onClick={onExpand}>
18
+ <StIcon name="folder" size={15} />
19
+ </button>
20
+ </div>
21
+ </div>
22
+ );
23
+ }
@@ -0,0 +1,177 @@
1
+ // shell/comments-panel.jsx — moved verbatim out of client/app.jsx (Maude v2 plan V2-0.2, move-only split).
2
+
3
+ import { basename, displayName, timeAgo, totalCounts } from './util.js';
4
+ import { Kbd, StIcon } from './icons.jsx';
5
+ import { Fragment } from 'react';
6
+
7
+ // ---------- Right sidebar — Comments panel ----------
8
+
9
+ export function CommentsPanel({
10
+ commentsByFile,
11
+ filter,
12
+ setFilter,
13
+ activePath,
14
+ focusedId,
15
+ onJump,
16
+ onResolve,
17
+ onReopen,
18
+ onDelete,
19
+ width,
20
+ resizing,
21
+ }) {
22
+ const counts = totalCounts(commentsByFile);
23
+ // Build groups: [{ file, comments: filtered }]
24
+ const files = Object.keys(commentsByFile || {}).sort();
25
+ const groups = [];
26
+ for (const f of files) {
27
+ const all = commentsByFile[f] || [];
28
+ const filtered = all.filter((c) => {
29
+ if (filter === 'open') return c.status !== 'resolved';
30
+ if (filter === 'resolved') return c.status === 'resolved';
31
+ return true;
32
+ });
33
+ if (filtered.length === 0) continue;
34
+ // Number is fixed by all-list order so it matches pin numbers (which are based on position in the array of selector-having comments)
35
+ const numberedAll = all.filter((c) => c.selector);
36
+ groups.push({
37
+ file: f,
38
+ comments: filtered.map((c) => ({
39
+ ...c,
40
+ n: numberedAll.findIndex((x) => x.id === c.id) + 1,
41
+ })),
42
+ });
43
+ }
44
+
45
+ return (
46
+ <aside
47
+ className={'st-rpanel' + (resizing ? ' is-resizing' : '')}
48
+ style={width ? { width, flexBasis: width } : undefined}
49
+ aria-label="Comments"
50
+ >
51
+ <div className="st-rp-tabs st-rp-tabs--filters">
52
+ <div className="st-cm-filters" role="tablist">
53
+ <button
54
+ type="button"
55
+ className={'st-cm-filter' + (filter === 'all' ? ' is-active' : '')}
56
+ role="tab"
57
+ data-testid="comment-filter-all"
58
+ aria-selected={filter === 'all'}
59
+ onClick={() => setFilter('all')}
60
+ >
61
+ All · {counts.all}
62
+ </button>
63
+ <button
64
+ type="button"
65
+ className={'st-cm-filter' + (filter === 'open' ? ' is-active' : '')}
66
+ role="tab"
67
+ data-testid="comment-filter-open"
68
+ aria-selected={filter === 'open'}
69
+ onClick={() => setFilter('open')}
70
+ >
71
+ Open · {counts.open}
72
+ </button>
73
+ <button
74
+ type="button"
75
+ className={'st-cm-filter' + (filter === 'resolved' ? ' is-active' : '')}
76
+ role="tab"
77
+ data-testid="comment-filter-resolved"
78
+ aria-selected={filter === 'resolved'}
79
+ onClick={() => setFilter('resolved')}
80
+ >
81
+ Resolved · {counts.resolved}
82
+ </button>
83
+ </div>
84
+ </div>
85
+ <div className="st-rp-body" style={{ gap: 'var(--space-4)' }}>
86
+ {groups.length === 0 ? (
87
+ <div className="st-rp-empty">
88
+ <p>No comments {filter !== 'all' ? `with status “${filter}”` : 'yet'}.</p>
89
+ <p>
90
+ Open a canvas, hold <Kbd>⌘</Kbd> and click an element, then press <Kbd>C</Kbd> — or
91
+ hold <Kbd>⌘⇧</Kbd> and click directly.
92
+ </p>
93
+ </div>
94
+ ) : (
95
+ groups.map((g) => (
96
+ <Fragment key={g.file}>
97
+ <button
98
+ type="button"
99
+ className="st-cm-group-hd"
100
+ onClick={() => onJump(g.file, null)}
101
+ title={g.file}
102
+ >
103
+ <span>{displayName(basename(g.file))}</span>
104
+ <span className="st-mono">{g.comments.length}</span>
105
+ </button>
106
+ {g.comments.map((c) => (
107
+ <div
108
+ key={c.id}
109
+ data-testid={`comment-item-${c.id}`}
110
+ className={
111
+ 'st-comment' +
112
+ (c.status === 'resolved' ? ' is-resolved' : '') +
113
+ (c.id === focusedId ? ' is-active' : '')
114
+ }
115
+ onClick={() => onJump(g.file, c.id)}
116
+ >
117
+ <div className="st-comment-hd">
118
+ <span className="st-pin st-pin--inline">{c.n || '·'}</span>
119
+ <span className="st-comment-time">{timeAgo(c.created)}</span>
120
+ </div>
121
+ <div className="st-comment-txt">{c.text}</div>
122
+ <div className="st-comment-foot">
123
+ <span className="st-comment-sel" title={(c.dom_path || []).join(' > ')}>
124
+ {c.selector || '—'}
125
+ </span>
126
+ {/* Cloud Phase 25 C2 — absent handlers (viewer) ⇒ no
127
+ mutating actions; the thread stays readable. */}
128
+ {onResolve && onReopen && onDelete ? (
129
+ <span className="st-mini-act">
130
+ {c.status === 'resolved' ? (
131
+ <button
132
+ type="button"
133
+ className="st-iconbtn"
134
+ aria-label="Reopen"
135
+ onClick={(e) => {
136
+ e.stopPropagation();
137
+ onReopen(c.id);
138
+ }}
139
+ >
140
+ <StIcon name="reopen" size={14} />
141
+ </button>
142
+ ) : (
143
+ <button
144
+ type="button"
145
+ className="st-iconbtn"
146
+ aria-label="Resolve"
147
+ onClick={(e) => {
148
+ e.stopPropagation();
149
+ onResolve(c.id);
150
+ }}
151
+ >
152
+ <StIcon name="resolve" size={14} />
153
+ </button>
154
+ )}
155
+ <button
156
+ type="button"
157
+ className="st-iconbtn"
158
+ aria-label="Delete"
159
+ onClick={(e) => {
160
+ e.stopPropagation();
161
+ onDelete(c.id);
162
+ }}
163
+ >
164
+ <StIcon name="x" size={14} />
165
+ </button>
166
+ </span>
167
+ ) : null}
168
+ </div>
169
+ </div>
170
+ ))}
171
+ </Fragment>
172
+ ))
173
+ )}
174
+ </div>
175
+ </aside>
176
+ );
177
+ }
@@ -0,0 +1,60 @@
1
+ // shell/constants.js — moved verbatim out of client/app.jsx (Maude v2 plan V2-0.2, move-only split).
2
+
3
+ export const USAGE_TOUR_STORE = 'mdcc-usage-tour-seen';
4
+
5
+ // Phase 29 (E4) — the collab "rychlý kurz" is offered once after onboarding.
6
+ export const COLLAB_TOUR_STORE = 'mdcc-collab-tour-seen';
7
+
8
+ export const SYSTEM_TAB = '__system__';
9
+
10
+ export const THEME_STORE = 'mdcc-theme';
11
+
12
+ export const SHOW_HIDDEN_STORE = 'mdcc-show-hidden';
13
+
14
+ // DDR-171 — CSS panel vocabulary mode ('advanced' | 'designer'), read inside
15
+ // CssKnobs.
16
+ export const CP_MODE_STORE = 'maude-cp-mode';
17
+
18
+ export const SIDEBAR_STORE = 'mdcc-sidebar-open';
19
+
20
+ export const MINIMAP_STORE = 'mdcc-minimap-visible';
21
+
22
+ export const ZOOMCTL_STORE = 'mdcc-zoomctl-visible';
23
+
24
+ export const ANNOT_STORE = 'mdcc-annotations-visible';
25
+
26
+ export const AUTOOPEN_STORE = 'maude-auto-open-inspector';
27
+
28
+ // DDR-185 security addendum — floor between OS notifications for a NEW
29
+ // permission/elicitation request, so a burst of distinct pending approvals
30
+ // (capped at 15 total server-side, DDR-179/180) reads as one attention-
31
+ // getting ping instead of a rapid-fire flood. The in-app badge is unaffected.
32
+ export const ATTENTION_NOTIFY_COOLDOWN_MS = 30_000;
33
+
34
+ export const PANEL_SIDES_STORE = 'mdcc-panel-sides';
35
+
36
+ export const LAYERS_MODE_STORE = 'mdcc-layers-mode';
37
+
38
+ export const CANVAS_EXT_RE = /\.(tsx|html?)$/i;
39
+
40
+ // A canvas the shell builds as a module and that reports `canvas-rendered`
41
+ // itself, as opposed to a legacy .html canvas that is drawn on `load`.
42
+ export const isModuleCanvasPath = (p) => /\.(tsx|jsx)$/i.test(String(p || ''));
43
+
44
+ // Bun's `define` substitutes this at build time (see build.ts); falls back when
45
+ // the bundle is consumed in a context that hasn't run the build.
46
+ export const MDCC_VERSION = typeof __MDCC_VERSION__ !== 'undefined' ? __MDCC_VERSION__ : 'dev';
47
+
48
+ // Stable empty list for the Sidebar while the tree state hydrates.
49
+ export const EMPTY_GROUPS = [];
50
+
51
+ // DDR-223 (issue #93, supersedes DDR-187's boot half) — one-time first-run
52
+ // teaching hint. Authoring canvases now boot into EDIT (`move`/V armed): click
53
+ // selects like Figma, and the mock is inert until the Preview toggle flips the
54
+ // alive posture back on. Teach exactly that ONCE, gated by a NEW localStorage
55
+ // marker (`maude-mode-hint-seen` — deliberately not the old
56
+ // `maude-browse-hint-seen`, which taught the opposite posture; every existing
57
+ // user should see the new hint once). Read-only viewers still boot preview
58
+ // (alive) and keep the DDR-187 wording. Auto-dismisses; the taught gesture
59
+ // (V in read-only) clears it early.
60
+ export const MODE_HINT_SEEN = 'maude-mode-hint-seen';