@1agh/maude 1.8.1 → 1.9.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/acp/bridge.ts +14 -2
- package/apps/studio/acp/probe.ts +51 -1
- package/apps/studio/api.ts +19 -4
- package/apps/studio/bin/_curl-local.mjs +7 -0
- package/apps/studio/bin/annotate.mjs +16 -7
- package/apps/studio/bin/read-annotations.mjs +62 -4
- package/apps/studio/client/app.jsx +428 -15977
- package/apps/studio/client/dialogs/asset-picker.jsx +331 -0
- package/apps/studio/client/dialogs/command-palette.jsx +112 -0
- package/apps/studio/client/dialogs/export-dialog.jsx +782 -0
- package/apps/studio/client/dialogs/help-modal.jsx +324 -0
- package/apps/studio/client/dialogs/shortcuts-overlay.jsx +144 -0
- package/apps/studio/client/hooks/use-canvas-bridge.jsx +2150 -0
- package/apps/studio/client/hooks/use-git-actions.jsx +236 -0
- package/apps/studio/client/hooks/use-keyboard-shortcuts.jsx +297 -0
- package/apps/studio/client/hooks/use-palette-and-panels.jsx +474 -0
- package/apps/studio/client/hooks/use-photo-and-timeline.jsx +901 -0
- package/apps/studio/client/hooks/use-project-data.jsx +90 -0
- package/apps/studio/client/hooks/use-shell-core.jsx +1212 -0
- package/apps/studio/client/hooks/use-tabs.jsx +723 -0
- package/apps/studio/client/hooks/use-web-socket.jsx +13 -0
- package/apps/studio/client/inspector/artboard-knobs.jsx +456 -0
- package/apps/studio/client/inspector/color-picker.jsx +196 -0
- package/apps/studio/client/inspector/color.js +92 -0
- package/apps/studio/client/inspector/css-knobs.jsx +1720 -0
- package/apps/studio/client/inspector/css-vocab.jsx +131 -0
- package/apps/studio/client/inspector/ds-tokens.js +90 -0
- package/apps/studio/client/inspector/grid-tracks-editor.jsx +97 -0
- package/apps/studio/client/inspector/inspect-computed.jsx +68 -0
- package/apps/studio/client/inspector/inspector-panel.jsx +769 -0
- package/apps/studio/client/inspector/layers.jsx +322 -0
- package/apps/studio/client/inspector/selection.js +65 -0
- package/apps/studio/client/inspector/token-popover.jsx +301 -0
- package/apps/studio/client/menus/menubar.jsx +856 -0
- package/apps/studio/client/selection-scope.js +40 -0
- package/apps/studio/client/shell/banners.jsx +272 -0
- package/apps/studio/client/shell/collapsed-rail.jsx +23 -0
- package/apps/studio/client/shell/comments-panel.jsx +177 -0
- package/apps/studio/client/shell/constants.js +60 -0
- package/apps/studio/client/shell/dock.jsx +131 -0
- package/apps/studio/client/shell/icons.jsx +370 -0
- package/apps/studio/client/shell/status-bar.jsx +215 -0
- package/apps/studio/client/shell/util.js +332 -0
- package/apps/studio/client/shell/viewport.jsx +254 -0
- package/apps/studio/client/system/system-view.jsx +255 -0
- package/apps/studio/client/tree/tree.jsx +1243 -0
- package/apps/studio/comments-overlay.tsx +6 -4
- package/apps/studio/config.schema.json +5 -0
- package/apps/studio/context.ts +13 -0
- package/apps/studio/dist/client.bundle.js +1337 -1337
- package/apps/studio/dist/comment-mount.js +2 -2
- package/apps/studio/exporters/_browser-bundles.ts +21 -2
- package/apps/studio/exporters/jobs.ts +75 -15
- package/apps/studio/exporters/scope.ts +15 -12
- package/apps/studio/format.ts +296 -0
- package/apps/studio/http.ts +213 -23
- package/apps/studio/server.ts +118 -29
- package/apps/studio/sync/accepted-link.ts +6 -0
- package/apps/studio/sync/agent.ts +9 -1
- package/apps/studio/sync/cold-start-apply.ts +29 -4
- package/apps/studio/sync/cold-start.ts +78 -0
- package/apps/studio/sync/file-plane.ts +61 -1
- package/apps/studio/sync/format-sync.ts +160 -0
- package/apps/studio/sync/index.ts +134 -10
- package/apps/studio/sync/journal-client.ts +25 -5
- package/apps/studio/sync/migrate-seed.ts +8 -1
- package/apps/studio/sync/status.ts +2 -0
- package/apps/studio/sync/transaction-client.ts +130 -13
- package/apps/studio/ui-prefs.ts +95 -10
- package/apps/studio/whats-new.json +9 -0
- package/apps/studio/ws.ts +19 -4
- package/cli/bin/claude-design-server.mjs +0 -0
- package/package.json +10 -8
|
@@ -0,0 +1,324 @@
|
|
|
1
|
+
// dialogs/help-modal.jsx — moved verbatim out of client/app.jsx (Maude v2 plan V2-0.2, move-only split).
|
|
2
|
+
|
|
3
|
+
import { useEffect } from 'react';
|
|
4
|
+
import { MDCC_VERSION } from '../shell/constants.js';
|
|
5
|
+
|
|
6
|
+
// Help modal — hosts the cheatsheet that used to live in the left sidebar.
|
|
7
|
+
// Triggered from the menubar's Help item. Esc + backdrop click close it.
|
|
8
|
+
export function HelpModal({ open, onClose, onStartTour }) {
|
|
9
|
+
useEffect(() => {
|
|
10
|
+
if (!open) return;
|
|
11
|
+
function onKey(e) {
|
|
12
|
+
if (e.key === 'Escape') onClose();
|
|
13
|
+
}
|
|
14
|
+
window.addEventListener('keydown', onKey);
|
|
15
|
+
return () => window.removeEventListener('keydown', onKey);
|
|
16
|
+
}, [open, onClose]);
|
|
17
|
+
if (!open) return null;
|
|
18
|
+
return (
|
|
19
|
+
<div
|
|
20
|
+
className="help-modal-backdrop"
|
|
21
|
+
role="presentation"
|
|
22
|
+
onMouseDown={(e) => {
|
|
23
|
+
if (e.target === e.currentTarget) onClose();
|
|
24
|
+
}}
|
|
25
|
+
>
|
|
26
|
+
<div
|
|
27
|
+
className="help-modal"
|
|
28
|
+
role="dialog"
|
|
29
|
+
aria-modal="true"
|
|
30
|
+
aria-labelledby="help-modal-title"
|
|
31
|
+
>
|
|
32
|
+
<header className="help-modal-hd">
|
|
33
|
+
<span className="title" id="help-modal-title">
|
|
34
|
+
Help · shortcuts & commands
|
|
35
|
+
</span>
|
|
36
|
+
<span className="sku">MAUDE-DEV-SRV / v{MDCC_VERSION}</span>
|
|
37
|
+
{onStartTour && (
|
|
38
|
+
<button
|
|
39
|
+
type="button"
|
|
40
|
+
className="mdcc-tour__back"
|
|
41
|
+
style={{ marginLeft: 'auto' }}
|
|
42
|
+
onClick={onStartTour}
|
|
43
|
+
>
|
|
44
|
+
▶ Take the tour
|
|
45
|
+
</button>
|
|
46
|
+
)}
|
|
47
|
+
<button
|
|
48
|
+
type="button"
|
|
49
|
+
className="help-modal-close"
|
|
50
|
+
aria-label="Close (Esc)"
|
|
51
|
+
onClick={onClose}
|
|
52
|
+
>
|
|
53
|
+
×
|
|
54
|
+
</button>
|
|
55
|
+
</header>
|
|
56
|
+
<div className="help-modal-body">
|
|
57
|
+
<details open>
|
|
58
|
+
<summary>Canvas selection & tools</summary>
|
|
59
|
+
<ul>
|
|
60
|
+
<li>
|
|
61
|
+
<kbd>V</kbd> <span>move tool — Cmd+click to select, Cmd+Shift to multi</span>
|
|
62
|
+
</li>
|
|
63
|
+
<li>
|
|
64
|
+
<kbd>H</kbd> <span>hand tool — bare drag pans (no Space needed)</span>
|
|
65
|
+
</li>
|
|
66
|
+
<li>
|
|
67
|
+
<kbd>C</kbd> <span>comment tool — hover paints, click drops a pin</span>
|
|
68
|
+
</li>
|
|
69
|
+
<li>
|
|
70
|
+
<kbd>⌘</kbd> + hover <span>preview deepest element under cursor</span>
|
|
71
|
+
</li>
|
|
72
|
+
<li>
|
|
73
|
+
<kbd>⌘</kbd> + click <span>select that element (replace)</span>
|
|
74
|
+
</li>
|
|
75
|
+
<li>
|
|
76
|
+
<kbd>⌘⇧</kbd> + click <span>add deepest to selection (multi)</span>
|
|
77
|
+
</li>
|
|
78
|
+
<li>
|
|
79
|
+
right-click <span>context menu (Copy CSS / Fit / Reset...)</span>
|
|
80
|
+
</li>
|
|
81
|
+
<li>
|
|
82
|
+
<kbd>Esc</kbd> in canvas <span>clear selection + close menu</span>
|
|
83
|
+
</li>
|
|
84
|
+
</ul>
|
|
85
|
+
</details>
|
|
86
|
+
<details>
|
|
87
|
+
<summary>Annotation tools</summary>
|
|
88
|
+
<ul>
|
|
89
|
+
<li>
|
|
90
|
+
<kbd>B</kbd> <span>pen — freehand stroke</span>
|
|
91
|
+
</li>
|
|
92
|
+
<li>
|
|
93
|
+
<kbd>R</kbd> <span>rectangle — drag to define corners</span>
|
|
94
|
+
</li>
|
|
95
|
+
<li>
|
|
96
|
+
<kbd>O</kbd> <span>ellipse — drag from center outward</span>
|
|
97
|
+
</li>
|
|
98
|
+
<li>
|
|
99
|
+
<kbd>A</kbd> <span>arrow — drag tail → tip</span>
|
|
100
|
+
</li>
|
|
101
|
+
<li>
|
|
102
|
+
<kbd>E</kbd> <span>eraser — click or drag over strokes to remove</span>
|
|
103
|
+
</li>
|
|
104
|
+
<li>
|
|
105
|
+
<kbd>V</kbd> + click stroke <span>select annotation (Shift+click to multi)</span>
|
|
106
|
+
</li>
|
|
107
|
+
<li>
|
|
108
|
+
<kbd>V</kbd> + drag empty <span>marquee-select strokes that overlap</span>
|
|
109
|
+
</li>
|
|
110
|
+
<li>
|
|
111
|
+
double-click rect/ellipse <span>add text inside the shape</span>
|
|
112
|
+
</li>
|
|
113
|
+
<li>
|
|
114
|
+
arrow keys <span>nudge selected annotation 1 unit (Shift = 10)</span>
|
|
115
|
+
</li>
|
|
116
|
+
<li>
|
|
117
|
+
<kbd>Backspace</kbd> <span>delete selected annotations</span>
|
|
118
|
+
</li>
|
|
119
|
+
<li>
|
|
120
|
+
<kbd>⇧P</kbd> <span>presentation — hide annotations for clean screenshot</span>
|
|
121
|
+
</li>
|
|
122
|
+
</ul>
|
|
123
|
+
</details>
|
|
124
|
+
<details>
|
|
125
|
+
<summary>Canvas & panels</summary>
|
|
126
|
+
<ul>
|
|
127
|
+
<li>
|
|
128
|
+
click in tree <span>open canvas (replaces the active one)</span>
|
|
129
|
+
</li>
|
|
130
|
+
<li>
|
|
131
|
+
File ▸ Close canvas <span>clear the stage</span>
|
|
132
|
+
</li>
|
|
133
|
+
<li>
|
|
134
|
+
<kbd>⌘R</kbd> <span>reload canvas</span>
|
|
135
|
+
</li>
|
|
136
|
+
<li>
|
|
137
|
+
<kbd>/</kbd> <span>focus search</span>
|
|
138
|
+
</li>
|
|
139
|
+
<li>
|
|
140
|
+
<kbd>⌘⇧M</kbd> <span>comments panel</span>
|
|
141
|
+
</li>
|
|
142
|
+
<li>
|
|
143
|
+
<kbd>⌘⇧I</kbd> <span>inspector</span>
|
|
144
|
+
</li>
|
|
145
|
+
<li>
|
|
146
|
+
<kbd>?</kbd> <span>keyboard-shortcuts cheat sheet</span>
|
|
147
|
+
</li>
|
|
148
|
+
</ul>
|
|
149
|
+
</details>
|
|
150
|
+
<details>
|
|
151
|
+
<summary>Slash commands</summary>
|
|
152
|
+
<ul className="cmds">
|
|
153
|
+
<li>
|
|
154
|
+
<code>
|
|
155
|
+
/design:edit "<i>feedback</i>"
|
|
156
|
+
</code>
|
|
157
|
+
<span>edit + 4-iter multi-axis loop</span>
|
|
158
|
+
</li>
|
|
159
|
+
<li>
|
|
160
|
+
<code>
|
|
161
|
+
/design:edit "<i>…</i>" --perfect
|
|
162
|
+
</code>
|
|
163
|
+
<span>8-iter polish (4.5/5 aspiration)</span>
|
|
164
|
+
</li>
|
|
165
|
+
<li>
|
|
166
|
+
<code>
|
|
167
|
+
/design:edit "<i>…</i>" --no-critic
|
|
168
|
+
</code>
|
|
169
|
+
<span>raw edit, skip loop</span>
|
|
170
|
+
</li>
|
|
171
|
+
<li>
|
|
172
|
+
<code>
|
|
173
|
+
/design:edit "<i>…</i>" --opt-out=<i>scope</i>
|
|
174
|
+
</code>
|
|
175
|
+
<span>override DS scope (palette/aesthetic/full)</span>
|
|
176
|
+
</li>
|
|
177
|
+
<li>
|
|
178
|
+
<code>
|
|
179
|
+
/design:new "<i>Name</i>" "<i>brief</i>"
|
|
180
|
+
</code>
|
|
181
|
+
<span>scaffold canvas</span>
|
|
182
|
+
</li>
|
|
183
|
+
<li>
|
|
184
|
+
<code>
|
|
185
|
+
/design:new "<i>…</i>" --opt-out=aesthetic
|
|
186
|
+
</code>
|
|
187
|
+
<span>scaffold off-system canvas (gradients/radii/type free)</span>
|
|
188
|
+
</li>
|
|
189
|
+
<li>
|
|
190
|
+
<code>/design:critic</code>
|
|
191
|
+
<span>review panel (routed)</span>
|
|
192
|
+
</li>
|
|
193
|
+
<li>
|
|
194
|
+
<code>/design:critic --all</code>
|
|
195
|
+
<span>10-critic sweep</span>
|
|
196
|
+
</li>
|
|
197
|
+
<li>
|
|
198
|
+
<code>/design:critic --agent signature-moment-critic</code>
|
|
199
|
+
<span>aspiration axis only</span>
|
|
200
|
+
</li>
|
|
201
|
+
<li>
|
|
202
|
+
<code>/design:rollback</code>
|
|
203
|
+
<span>undo last edit</span>
|
|
204
|
+
</li>
|
|
205
|
+
<li>
|
|
206
|
+
<code>/design:screenshot</code>
|
|
207
|
+
<span>capture canvas</span>
|
|
208
|
+
</li>
|
|
209
|
+
<li>
|
|
210
|
+
<code>/design:setup-docs</code>
|
|
211
|
+
<span>refresh README + INDEX</span>
|
|
212
|
+
</li>
|
|
213
|
+
<li>
|
|
214
|
+
<code>/design:handoff</code>
|
|
215
|
+
<span>migrate to apps/</span>
|
|
216
|
+
</li>
|
|
217
|
+
</ul>
|
|
218
|
+
</details>
|
|
219
|
+
<details>
|
|
220
|
+
<summary>Opt-out scope</summary>
|
|
221
|
+
<ul>
|
|
222
|
+
<li>
|
|
223
|
+
<strong>palette</strong>{' '}
|
|
224
|
+
<span>
|
|
225
|
+
default — tokens + rootClass kept; local namespace overrides colors only. DS
|
|
226
|
+
aesthetic still enforced.
|
|
227
|
+
</span>
|
|
228
|
+
</li>
|
|
229
|
+
<li>
|
|
230
|
+
<strong>aesthetic</strong>{' '}
|
|
231
|
+
<span>
|
|
232
|
+
palette + gradients/off-ladder radii/alt type/decorative SVG flags allowed.
|
|
233
|
+
</span>
|
|
234
|
+
</li>
|
|
235
|
+
<li>
|
|
236
|
+
<strong>full</strong>{' '}
|
|
237
|
+
<span>DS treated as advisory. Type/radii/aesthetic up to canvas.</span>
|
|
238
|
+
</li>
|
|
239
|
+
<li>
|
|
240
|
+
<em>A11y enforced at every scope</em>{' '}
|
|
241
|
+
<span>contrast, focus, semantics, motion, touch targets — never relaxed.</span>
|
|
242
|
+
</li>
|
|
243
|
+
<li>
|
|
244
|
+
Persisted on canvas's <code>.meta.json</code> <code>opt_out_scope</code> field —
|
|
245
|
+
subsequent <code>/design:edit</code> iterations inherit.
|
|
246
|
+
</li>
|
|
247
|
+
<li>
|
|
248
|
+
Inferred from brief ("modern", "vibrant", "off-system") with one-shot
|
|
249
|
+
AskUserQuestion before iter-1 critics fire.
|
|
250
|
+
</li>
|
|
251
|
+
</ul>
|
|
252
|
+
</details>
|
|
253
|
+
<details>
|
|
254
|
+
<summary>Auto-critic loop</summary>
|
|
255
|
+
<ul>
|
|
256
|
+
<li>
|
|
257
|
+
<strong>Default</strong>{' '}
|
|
258
|
+
<span>4 iter · aspiration ≥ 4.0 · stable-but-bland exit</span>
|
|
259
|
+
</li>
|
|
260
|
+
<li>
|
|
261
|
+
<strong>--perfect</strong>{' '}
|
|
262
|
+
<span>8 iter · aspiration ≥ 4.5 · broader divergence tolerance</span>
|
|
263
|
+
</li>
|
|
264
|
+
<li>
|
|
265
|
+
<strong>--perfect --all</strong>{' '}
|
|
266
|
+
<span>every critic incl. aspiration · portfolio-grade</span>
|
|
267
|
+
</li>
|
|
268
|
+
<li>
|
|
269
|
+
Exit: <code>solid</code> · <code>stable-but-bland</code> · <code>max-reached</code>{' '}
|
|
270
|
+
· <code>divergent</code>
|
|
271
|
+
</li>
|
|
272
|
+
<li>
|
|
273
|
+
<em>stable-but-bland</em> = correctness clean, aspiration plateau — surface for
|
|
274
|
+
review with lowest 2 axes named
|
|
275
|
+
</li>
|
|
276
|
+
<li>
|
|
277
|
+
When <code>opt_out_scope ∈ {aesthetic, full}</code>: iter-1 checkpoint
|
|
278
|
+
fires — pick (a) run loop, (b) skip auto-loop and review iter 1, (c) a11y-only
|
|
279
|
+
check.
|
|
280
|
+
</li>
|
|
281
|
+
</ul>
|
|
282
|
+
</details>
|
|
283
|
+
<details>
|
|
284
|
+
<summary>Pin-to-element flow</summary>
|
|
285
|
+
<ol>
|
|
286
|
+
<li>Open a canvas</li>
|
|
287
|
+
<li>
|
|
288
|
+
<kbd>⌘</kbd>+click element
|
|
289
|
+
</li>
|
|
290
|
+
<li>Status bar shows ● selector</li>
|
|
291
|
+
<li>
|
|
292
|
+
Run{' '}
|
|
293
|
+
<code>
|
|
294
|
+
/design:edit "<i>change just this</i>"
|
|
295
|
+
</code>
|
|
296
|
+
</li>
|
|
297
|
+
<li>
|
|
298
|
+
Reload iframe (<kbd>⌘R</kbd>)
|
|
299
|
+
</li>
|
|
300
|
+
</ol>
|
|
301
|
+
</details>
|
|
302
|
+
<details>
|
|
303
|
+
<summary>Comments</summary>
|
|
304
|
+
<ol>
|
|
305
|
+
<li>
|
|
306
|
+
<kbd>⌘</kbd>+click element, then <kbd>⌘C</kbd> <span>or ⌘⇧+click</span>
|
|
307
|
+
</li>
|
|
308
|
+
<li>Numbered pin appears on canvas</li>
|
|
309
|
+
<li>
|
|
310
|
+
<kbd>⌘⇧M</kbd> <span>opens panel — All / Open / Resolved</span>
|
|
311
|
+
</li>
|
|
312
|
+
<li>
|
|
313
|
+
Click row in panel <span>jumps to that file + pin</span>
|
|
314
|
+
</li>
|
|
315
|
+
<li>
|
|
316
|
+
Claude reads <code>_comments/<slug>.json</code> on next <code>/design</code>
|
|
317
|
+
</li>
|
|
318
|
+
</ol>
|
|
319
|
+
</details>
|
|
320
|
+
</div>
|
|
321
|
+
</div>
|
|
322
|
+
</div>
|
|
323
|
+
);
|
|
324
|
+
}
|
|
@@ -0,0 +1,144 @@
|
|
|
1
|
+
// dialogs/shortcuts-overlay.jsx — moved verbatim out of client/app.jsx (Maude v2 plan V2-0.2, move-only split).
|
|
2
|
+
|
|
3
|
+
import { Kbd } from '../shell/icons.jsx';
|
|
4
|
+
import { Fragment, useEffect } from 'react';
|
|
5
|
+
|
|
6
|
+
// ───────── Keyboard-shortcuts overlay (DS components-shortcuts-overlay) ─────
|
|
7
|
+
//
|
|
8
|
+
// The ? cheat-sheet: dim scrim, shared panel material, four dense mono-headed
|
|
9
|
+
// columns, Esc chip in the footer. REAL bindings only — every row here is
|
|
10
|
+
// wired in the shell handler, the canvas input-router, or canvas-lib's
|
|
11
|
+
// viewport controller. Scope chips mark the rows that need canvas focus.
|
|
12
|
+
|
|
13
|
+
export const SHORTCUT_GROUPS = [
|
|
14
|
+
{
|
|
15
|
+
id: 'canvas',
|
|
16
|
+
label: 'Canvas',
|
|
17
|
+
items: [
|
|
18
|
+
{ label: 'Command palette', kbd: '⌘ K' },
|
|
19
|
+
{ label: 'New brief board', kbd: 'N' },
|
|
20
|
+
{ label: 'Export…', kbd: '⇧ ⌘ E' },
|
|
21
|
+
{ label: 'Handoff to production', kbd: '⇧ ⌘ H' },
|
|
22
|
+
{ label: 'Reload canvas', kbd: '⌘ R' },
|
|
23
|
+
{ label: 'Search files', kbd: '/', alt: '⌘ F' },
|
|
24
|
+
],
|
|
25
|
+
},
|
|
26
|
+
{
|
|
27
|
+
id: 'tools',
|
|
28
|
+
label: 'Tools · canvas focus',
|
|
29
|
+
items: [
|
|
30
|
+
{ label: 'Move · Hand · Comment', kbd: 'V', alt: 'H / C' },
|
|
31
|
+
{ label: 'Pen · Highlighter · Eraser', kbd: 'B', alt: 'I / E' },
|
|
32
|
+
{ label: 'Shape · Arrow', kbd: 'R', alt: 'A' },
|
|
33
|
+
{ label: 'Sticky · Text · Section', kbd: 'N', alt: 'T / ⇧S' },
|
|
34
|
+
{ label: 'Undo / redo', kbd: '⌘ Z', alt: '⇧ ⌘ Z' },
|
|
35
|
+
],
|
|
36
|
+
},
|
|
37
|
+
{
|
|
38
|
+
id: 'selection',
|
|
39
|
+
label: 'Selection & zoom',
|
|
40
|
+
items: [
|
|
41
|
+
{ label: 'Select element', kbd: '⌘ click' },
|
|
42
|
+
{ label: 'Add to selection', kbd: '⌘ ⇧ click' },
|
|
43
|
+
{ label: 'Preview deepest', kbd: '⌘ hover' },
|
|
44
|
+
{ label: 'Deselect · close menu', kbd: 'Esc' },
|
|
45
|
+
{ label: 'Zoom in / out', kbd: '⌘ +', alt: '⌘ −' },
|
|
46
|
+
{ label: 'Fit · actual size', kbd: '⌘ 0', alt: '⌘ 1' },
|
|
47
|
+
],
|
|
48
|
+
},
|
|
49
|
+
{
|
|
50
|
+
id: 'view',
|
|
51
|
+
label: 'View',
|
|
52
|
+
items: [
|
|
53
|
+
{ label: 'Project tree', kbd: 'T' },
|
|
54
|
+
{ label: 'Design system view', kbd: 'S' },
|
|
55
|
+
{ label: 'Inspector', kbd: '⌘ ⇧ I' },
|
|
56
|
+
{ label: 'Comments sidebar', kbd: '⌘ ⇧ M' },
|
|
57
|
+
{ label: 'Annotations', kbd: '⇧ P' },
|
|
58
|
+
{ label: 'Hidden files', kbd: 'H' },
|
|
59
|
+
{ label: 'This cheat sheet · help', kbd: '?', alt: 'F1' },
|
|
60
|
+
],
|
|
61
|
+
},
|
|
62
|
+
];
|
|
63
|
+
|
|
64
|
+
export function ShortcutCombo({ kbd, alt }) {
|
|
65
|
+
const combo = (s, key) => (
|
|
66
|
+
<span className="so-combo" key={key}>
|
|
67
|
+
{s.split(' ').map((k, i) => (
|
|
68
|
+
<Kbd key={`${k}-${i}`}>{k}</Kbd>
|
|
69
|
+
))}
|
|
70
|
+
</span>
|
|
71
|
+
);
|
|
72
|
+
return (
|
|
73
|
+
<span className="so-combos">
|
|
74
|
+
{combo(kbd, 'main')}
|
|
75
|
+
{alt
|
|
76
|
+
? alt.split(' / ').map((a) => (
|
|
77
|
+
<Fragment key={a}>
|
|
78
|
+
<span className="so-or">/</span>
|
|
79
|
+
{combo(a, a)}
|
|
80
|
+
</Fragment>
|
|
81
|
+
))
|
|
82
|
+
: null}
|
|
83
|
+
</span>
|
|
84
|
+
);
|
|
85
|
+
}
|
|
86
|
+
|
|
87
|
+
export function ShortcutsOverlay({ open, onClose }) {
|
|
88
|
+
useEffect(() => {
|
|
89
|
+
if (!open) return;
|
|
90
|
+
function onKey(e) {
|
|
91
|
+
if (e.key === 'Escape') {
|
|
92
|
+
e.preventDefault();
|
|
93
|
+
onClose();
|
|
94
|
+
}
|
|
95
|
+
}
|
|
96
|
+
window.addEventListener('keydown', onKey);
|
|
97
|
+
return () => window.removeEventListener('keydown', onKey);
|
|
98
|
+
}, [open, onClose]);
|
|
99
|
+
if (!open) return null;
|
|
100
|
+
const bindings = SHORTCUT_GROUPS.reduce((n, g) => n + g.items.length, 0);
|
|
101
|
+
return (
|
|
102
|
+
<div
|
|
103
|
+
className="st-scrim"
|
|
104
|
+
role="presentation"
|
|
105
|
+
onMouseDown={(e) => {
|
|
106
|
+
if (e.target === e.currentTarget) onClose();
|
|
107
|
+
}}
|
|
108
|
+
>
|
|
109
|
+
<div className="so-overlay" role="dialog" aria-modal="true" aria-label="Keyboard shortcuts">
|
|
110
|
+
<div className="so-overlay-hd">
|
|
111
|
+
<span className="so-title">Keyboard shortcuts</span>
|
|
112
|
+
<span className="so-trigger">
|
|
113
|
+
press <Kbd>?</Kbd> to open
|
|
114
|
+
</span>
|
|
115
|
+
</div>
|
|
116
|
+
<div className="so-columns">
|
|
117
|
+
{SHORTCUT_GROUPS.map((g) => (
|
|
118
|
+
<section key={g.id} className={'so-section so-section--' + g.id}>
|
|
119
|
+
<h3 className="so-section-hd">{g.label}</h3>
|
|
120
|
+
<dl className="so-list">
|
|
121
|
+
{g.items.map((it) => (
|
|
122
|
+
<div key={it.label} className="so-pair">
|
|
123
|
+
<dt>{it.label}</dt>
|
|
124
|
+
<dd>
|
|
125
|
+
<ShortcutCombo kbd={it.kbd} alt={it.alt} />
|
|
126
|
+
</dd>
|
|
127
|
+
</div>
|
|
128
|
+
))}
|
|
129
|
+
</dl>
|
|
130
|
+
</section>
|
|
131
|
+
))}
|
|
132
|
+
</div>
|
|
133
|
+
<div className="so-overlay-ft">
|
|
134
|
+
<span>
|
|
135
|
+
close with <Kbd>Esc</Kbd>
|
|
136
|
+
</span>
|
|
137
|
+
<span className="so-count">
|
|
138
|
+
{bindings} bindings · {SHORTCUT_GROUPS.length} groups
|
|
139
|
+
</span>
|
|
140
|
+
</div>
|
|
141
|
+
</div>
|
|
142
|
+
</div>
|
|
143
|
+
);
|
|
144
|
+
}
|