@marver-design/marver 0.26.0 → 0.26.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.
- package/CHANGELOG.md +54 -0
- package/README.md +2 -2
- package/dist/{anchor-check-Dg5xpNnU.mjs → anchor-check-l-ny3UzH.mjs} +1 -1
- package/dist/{audio-CmSRYFEs.mjs → audio-Dw1lfMdb.mjs} +14 -0
- package/dist/{bake-DtVlm0_F.mjs → bake-C-awKgLA.mjs} +1 -1
- package/dist/{build-C_gUgcdC.mjs → build-BDRiO_mP.mjs} +3 -3
- package/dist/{capture-CrqvU_jh.mjs → capture-vadKjuCo.mjs} +2 -1
- package/dist/cli.mjs +6 -6
- package/dist/{daemon-DZo6o3rU.mjs → daemon-DL6Fwq6D.mjs} +394 -270
- package/dist/{dev-_Nlsc6v9.mjs → dev-Bw_qYWWq.mjs} +24 -11
- package/dist/{marks-NQi0wZJ4.mjs → marks-DyWMv_Z1.mjs} +1 -1
- package/dist/perf-C75MZ73h.mjs +167 -0
- package/dist/perf-jam-BU3TVrZu.mjs +239 -0
- package/dist/{plugin-CTD0rydA.mjs → plugin-DkGmZs_r.mjs} +42 -22
- package/dist/{poster-ChjXGTS5.mjs → poster-BdtSKMDm.mjs} +2 -1
- package/dist/{publish-bakes-CEP_2NRc.mjs → publish-bakes-9RzRToXV.mjs} +2 -2
- package/dist/{queue-BuiCKSX1.mjs → queue-29ok5_eZ.mjs} +2 -2
- package/dist/{session-qZWKt_VA.mjs → session-BAaJsK5c.mjs} +1 -1
- package/dist/{shot-DqcxJibP.mjs → shot-DQeR_Pfn.mjs} +337 -19
- package/dist/shot-XQV7HC9A.mjs +139 -0
- package/dist/speech-worker.mjs +40 -5
- package/docs/jam-session.md +24 -7
- package/docs/live-jam.md +8 -0
- package/package.json +1 -1
- package/src/client/frame-host/inspect.js +8 -3
- package/src/client/frame-host/keys.js +6 -2
- package/src/client/shell/App.tsx +8 -4
- package/src/client/shell/JamSurface.tsx +9 -3
- package/src/client/shell/Play.tsx +11 -7
- package/src/client/shell/Toolbar.tsx +5 -4
- package/src/client/shell/canvas/FrameNode.tsx +3 -2
- package/src/client/shell/icons.tsx +2 -0
- package/src/client/shell/jam-capture.ts +77 -11
- package/src/client/shell/jam-keys.ts +47 -18
- package/src/client/shell/jam-lane.tsx +46 -5
- package/src/client/shell/jam-panel.tsx +63 -13
- package/src/client/shell/jam-state.ts +48 -6
- package/src/client/shell/jam-surface-parts.tsx +10 -6
- package/src/client/shell/store.ts +14 -5
- package/src/client/shell/styles.css +28 -8
- package/src/client/stage/main.tsx +2 -0
- package/templates/instructions/jam.md +5 -3
- package/dist/perf-D6VmmJ2q.mjs +0 -68
- package/dist/shot-CNbHoZ6H.mjs +0 -86
package/dist/speech-worker.mjs
CHANGED
|
@@ -54,10 +54,16 @@ var Segmenter = class {
|
|
|
54
54
|
vad;
|
|
55
55
|
recognize;
|
|
56
56
|
onWords;
|
|
57
|
-
|
|
57
|
+
onTiming;
|
|
58
|
+
decoding = 0;
|
|
59
|
+
/** the audio waiting for the recognizer, in samples - this capture's alone, or (the worker's) every capture sharing it */
|
|
60
|
+
backlog;
|
|
61
|
+
constructor(vad, recognize, onWords, onTiming, backlog) {
|
|
58
62
|
this.vad = vad;
|
|
59
63
|
this.recognize = recognize;
|
|
60
64
|
this.onWords = onWords;
|
|
65
|
+
this.onTiming = onTiming;
|
|
66
|
+
this.backlog = backlog ?? (() => this.waitingSamples + this.decoding);
|
|
61
67
|
}
|
|
62
68
|
/** The samples from `offset` on (the page numbers them; an overlap is skipped). A short gap is silence
|
|
63
69
|
* given to the VAD; a long one (over a second - a microphone that opened late, a resumed capture) ends
|
|
@@ -130,6 +136,8 @@ var Segmenter = class {
|
|
|
130
136
|
}
|
|
131
137
|
}
|
|
132
138
|
enqueue(p) {
|
|
139
|
+
p.queuedAt = performance.now();
|
|
140
|
+
p.backlog = this.backlog();
|
|
133
141
|
this.waiting.push(p);
|
|
134
142
|
while (this.waiting.length > 1 && this.waiting.reduce((n, x) => n + x.samples.length, 0) > 48e4) {
|
|
135
143
|
const gone = this.waiting.shift();
|
|
@@ -148,8 +156,13 @@ var Segmenter = class {
|
|
|
148
156
|
while (this.waiting.length) {
|
|
149
157
|
const p = this.waiting.shift();
|
|
150
158
|
let words = [];
|
|
159
|
+
const t0 = performance.now();
|
|
160
|
+
this.decoding = p.samples.length;
|
|
161
|
+
let decodeMs;
|
|
151
162
|
try {
|
|
152
|
-
|
|
163
|
+
const r = await this.recognize(p.samples);
|
|
164
|
+
decodeMs = r.ms;
|
|
165
|
+
words = tokensToWords(r, p.start);
|
|
153
166
|
} catch {
|
|
154
167
|
words = [{
|
|
155
168
|
w: "[words lost]",
|
|
@@ -157,6 +170,15 @@ var Segmenter = class {
|
|
|
157
170
|
lost: true
|
|
158
171
|
}];
|
|
159
172
|
}
|
|
173
|
+
this.decoding = 0;
|
|
174
|
+
const end = performance.now();
|
|
175
|
+
const dec = decodeMs ?? end - t0;
|
|
176
|
+
if (!this.cancelled) this.onTiming?.({
|
|
177
|
+
audioMs: p.samples.length / RATE * 1e3,
|
|
178
|
+
waitMs: Math.max(0, end - dec - (p.queuedAt ?? t0)),
|
|
179
|
+
decodeMs: dec,
|
|
180
|
+
backlogMs: (p.backlog ?? 0) / RATE * 1e3
|
|
181
|
+
});
|
|
160
182
|
const kept = words.filter((x) => x.at <= this.last);
|
|
161
183
|
if (kept.length && !this.cancelled) this.onWords(kept);
|
|
162
184
|
}
|
|
@@ -175,6 +197,10 @@ var Segmenter = class {
|
|
|
175
197
|
this.pending = /* @__PURE__ */ new Float32Array(0);
|
|
176
198
|
if (!this.busy) for (const f of this.idle.splice(0)) f();
|
|
177
199
|
}
|
|
200
|
+
/** The phrase being transcribed now, in samples. */
|
|
201
|
+
get decodingSamples() {
|
|
202
|
+
return this.decoding;
|
|
203
|
+
}
|
|
178
204
|
/** Audio given and not yet turned into words: phrases waiting, in samples (the worker's backlog). */
|
|
179
205
|
get waitingSamples() {
|
|
180
206
|
return this.waiting.reduce((n, x) => n + x.samples.length, 0);
|
|
@@ -224,6 +250,7 @@ const port = parentPort;
|
|
|
224
250
|
const paths = workerData.paths;
|
|
225
251
|
let sherpa;
|
|
226
252
|
let recognizer;
|
|
253
|
+
const loadStart = performance.now();
|
|
227
254
|
try {
|
|
228
255
|
sherpa = createRequire(import.meta.url)("sherpa-onnx-node");
|
|
229
256
|
recognizer = new sherpa.OfflineRecognizer({
|
|
@@ -243,7 +270,10 @@ try {
|
|
|
243
270
|
modelType: "nemo_transducer"
|
|
244
271
|
}
|
|
245
272
|
});
|
|
246
|
-
port.postMessage({
|
|
273
|
+
port.postMessage({
|
|
274
|
+
type: "ready",
|
|
275
|
+
modelLoadMs: performance.now() - loadStart
|
|
276
|
+
});
|
|
247
277
|
} catch (err) {
|
|
248
278
|
port.postMessage({
|
|
249
279
|
type: "unavailable",
|
|
@@ -265,6 +295,7 @@ const vadFor = () => new sherpa.Vad({
|
|
|
265
295
|
const turn = () => new Promise((r) => setImmediate(r));
|
|
266
296
|
const recognize = async (samples) => {
|
|
267
297
|
await turn();
|
|
298
|
+
const t0 = performance.now();
|
|
268
299
|
const s = recognizer.createStream();
|
|
269
300
|
s.acceptWaveform({
|
|
270
301
|
sampleRate: RATE,
|
|
@@ -274,7 +305,8 @@ const recognize = async (samples) => {
|
|
|
274
305
|
const r = recognizer.getResult(s);
|
|
275
306
|
return {
|
|
276
307
|
tokens: r.tokens ?? [],
|
|
277
|
-
timestamps: r.timestamps ?? []
|
|
308
|
+
timestamps: r.timestamps ?? [],
|
|
309
|
+
ms: performance.now() - t0
|
|
278
310
|
};
|
|
279
311
|
};
|
|
280
312
|
const captures = /* @__PURE__ */ new Map();
|
|
@@ -286,7 +318,10 @@ port.on("message", (m) => {
|
|
|
286
318
|
type: "words",
|
|
287
319
|
capture: id,
|
|
288
320
|
words
|
|
289
|
-
}))
|
|
321
|
+
}), (t) => port.postMessage({
|
|
322
|
+
type: "timing",
|
|
323
|
+
...t
|
|
324
|
+
}), () => [...captures.values()].reduce((n, x) => n + x.waitingSamples + x.decodingSamples, 0)));
|
|
290
325
|
} else if (m.type === "audio") {
|
|
291
326
|
const seg = captures.get(id);
|
|
292
327
|
if (!seg || !(m.pcm instanceof Int16Array)) return;
|
package/docs/jam-session.md
CHANGED
|
@@ -16,7 +16,8 @@ dot. While it records, everything you do is part of it:
|
|
|
16
16
|
|
|
17
17
|
- **what you say**, transcribed on this Mac (see [Words](#words-on-this-mac));
|
|
18
18
|
- **what you point at**: a click on an element numbers it on the frame, and holding the
|
|
19
|
-
pointer still over one notes it too. `L` picks with the laser
|
|
19
|
+
pointer still over one notes it too. `L` picks with the laser (`⌥L` for the inspect laser,
|
|
20
|
+
every element outlined);
|
|
20
21
|
- **what you do in the prototype**: interactive mode on and off, every click and field, the
|
|
21
22
|
screens you went to in play, the device and theme you switched to, what you copied;
|
|
22
23
|
- **notes** you type (`N` opens the notes card) - a note often names what your words point at;
|
|
@@ -26,6 +27,11 @@ dot. While it records, everything you do is part of it:
|
|
|
26
27
|
|
|
27
28
|
`E` ends it. `Esc` throws it away. One capture records at a time.
|
|
28
29
|
|
|
30
|
+
Closing or reloading the tab asks first while a capture is recording or finishing. If you leave anyway, the capture
|
|
31
|
+
is kept as it stood - its words and notes so far, and a line saying the page closed before it finished - and comes
|
|
32
|
+
back as a draft to read, resume or drop; it never goes to your agent on its own. (Best effort: a crash gives the page
|
|
33
|
+
no chance to keep it.)
|
|
34
|
+
|
|
29
35
|
A capture is about the frames you **touched** - selected, clicked, typed in, scrolled,
|
|
30
36
|
resized, pictured, or zoomed to alone - not every frame that happened to be on screen. Those
|
|
31
37
|
are the frames its run may edit, and the frames pictured before and after it.
|
|
@@ -55,6 +61,10 @@ right - drafts, queued, working, ready to review, done. Each tile says where it
|
|
|
55
61
|
the lane the keyboard: `←` `→` move, `⏎` opens, `⌘⏎` runs a queued one next, `K` keeps,
|
|
56
62
|
`⌫` drops, `Esc` hands the keys back. Right-click a tile to rename it.
|
|
57
63
|
|
|
64
|
+
Once two or more captures are done, they fold into one **Done** tile at the left end - "4
|
|
65
|
+
captures · 6 frames changed" - so the lane keeps its room for what still needs you. Click it
|
|
66
|
+
(or `⏎` on it) to open them in place, behind a narrow collapse tile that folds them back.
|
|
67
|
+
|
|
58
68
|
Your agent works on up to `jam.concurrency` captures at once (6 by default), each in its own
|
|
59
69
|
run, but never two on the same frame: a capture about a frame another run holds waits for it
|
|
60
70
|
("Queued · next").
|
|
@@ -64,9 +74,11 @@ run, but never two on the same frame: a capture about a frame another run holds
|
|
|
64
74
|
When a run finishes, its tile turns to **Ready to review**, with a soft chime (`jam: { chime:
|
|
65
75
|
false }` silences it). `V` opens the next one to review:
|
|
66
76
|
|
|
67
|
-
- **Review** shows the agent's reply beside
|
|
68
|
-
|
|
69
|
-
**
|
|
77
|
+
- **Review** shows the agent's reply beside each frame it changed, **before and after at
|
|
78
|
+
once**: side by side for a tall frame (a phone), one above the other for a wide one (a
|
|
79
|
+
laptop), the panel as wide as that takes. **Both · Before · After** shows one alone; `B`
|
|
80
|
+
steps through them. `⌥←` `⌥→` move between frames. A frame the run made is marked **New**,
|
|
81
|
+
with no before.
|
|
70
82
|
- **Capture** (the tab at the top) shows the capture as you made it: its pictures and timeline.
|
|
71
83
|
|
|
72
84
|
`⏎` **Looks good** closes it; `⇧⏎` **More work** sends it back with what is still wrong;
|
|
@@ -154,15 +166,20 @@ A bad value says so at boot and takes the default; nothing here turns Jam off.
|
|
|
154
166
|
| Where | Keys |
|
|
155
167
|
|---|---|
|
|
156
168
|
| Anywhere on the canvas | `S` capture · `J` session · `Q` the lane · `V` next to review |
|
|
157
|
-
| A capture recording | `E` end · `N` note · `I` picture · `L` laser · `Esc` drop |
|
|
169
|
+
| A capture recording | `E` end · `N` note · `I` picture · `L` laser · `⌥L` inspect · `Esc` drop |
|
|
158
170
|
| A read-back | `⏎` add to queue · `K` keep · `R` resume · `Esc` drop |
|
|
159
|
-
| A review | `⏎` looks good · `⇧⏎` more work · `→` later · `←` back · `B` before/after · `⌥←` `⌥→` frames · `Esc` leave |
|
|
160
|
-
| The lane (`Q`) | `←` `→` move · `⏎` open · `⌘⏎` do next · `K` keep · `⌫` drop · `Esc` leave |
|
|
171
|
+
| A review | `⏎` looks good · `⇧⏎` more work · `→` later · `←` back · `B` both/before/after · `⌥←` `⌥→` frames · `Esc` leave |
|
|
172
|
+
| The lane (`Q`) | `←` `→` move · `⏎` open (or open/fold the Done tile) · `⌘⏎` do next · `K` keep · `⌫` drop · `Esc` leave |
|
|
173
|
+
| A laser on | `L` pointer · `⌥L` inspect · `Esc` off (before it closes or drops anything) |
|
|
161
174
|
|
|
162
175
|
The keys work inside frames too, in interactive mode and in play.
|
|
163
176
|
|
|
164
177
|
## Where things are kept
|
|
165
178
|
|
|
179
|
+
How long each step takes on your machine - a capture sealing, its pictures, your words, naming, the queue, your agent,
|
|
180
|
+
the pictures before and after - is in `npx marver perf --jam` (median, slowest, and what went wrong lately), read from
|
|
181
|
+
`design/.local/perf/jam.jsonl`: numbers and fixed codes only, never your words.
|
|
182
|
+
|
|
166
183
|
The capture itself sits in `design/.local/` (gitignored, never published): its full record
|
|
167
184
|
and pictures under `design/.local/jam/`, the session transcript under
|
|
168
185
|
`design/.local/jam/sessions/`, the queue in `design/.local/jam-jobs.json`.
|
package/docs/live-jam.md
CHANGED
|
@@ -130,6 +130,14 @@ obvious one:
|
|
|
130
130
|
The canvas's **copy as image** (`i` / `⇧i`, the images-square toolbar button) is this same
|
|
131
131
|
renderer with `format=png`, so what a designer pastes and what an agent shoots is one picture.
|
|
132
132
|
|
|
133
|
+
- **Pictures that are what the frame shows** (0.26.1). Headless Chrome could copy its view before resizing it for the
|
|
134
|
+
picture and tile the old copy across the image. Each picture now has a window of its own (a fixed frame's or a
|
|
135
|
+
slide's sized to the picture first), and every picture is checked for that tiling: one that shows it is taken again
|
|
136
|
+
(`recaptures` in `--json` says how many times), and one that never comes out right fails with "stale surface"
|
|
137
|
+
rather than shipping.
|
|
138
|
+
- **Inside a sandbox** (Codex blocks the network, localhost included), `marver shot` cannot reach the dev server: it
|
|
139
|
+
then drops the same request in the file inbox itself and waits for its answer - the same output, the same exit code.
|
|
140
|
+
|
|
133
141
|
The generated jam instructions tell every agent to shoot and LOOK before replying "done".
|
|
134
142
|
A frame that never mounts, or a dev server that isn't reachable, comes back as an honest
|
|
135
143
|
`{"ok":false,"error":...}` carrying the real cause - never a blank that reads as success.
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@marver-design/marver",
|
|
3
|
-
"version": "0.26.
|
|
3
|
+
"version": "0.26.1",
|
|
4
4
|
"description": "The agent-native design canvas. A design/ folder, one command, a canvas of live frames built from your repo's real components - comment @marver and your own coding agent does the work. The tool ships no AI.",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"private": false,
|
|
@@ -325,6 +325,9 @@ if (typeof window !== 'undefined') window.__mvAnchorCheck = checkTarget
|
|
|
325
325
|
|
|
326
326
|
export function createInspect({ post, getId, onModeChange, onLaserPick }) {
|
|
327
327
|
let laserOn = false, pickOn = false
|
|
328
|
+
// the laser as inspect (⌥L): every element outlined. Off, the laser is a pointer - the element under the cursor lit,
|
|
329
|
+
// as comment mode lights it
|
|
330
|
+
let inspectOn = false
|
|
328
331
|
// quiet pick (⇧L laser comment off): clicks still anchor comments, but NO hover outline,
|
|
329
332
|
// label, or lock lighting inside the artwork - the shell decides, the frame obeys
|
|
330
333
|
let pickQuiet = false
|
|
@@ -343,14 +346,15 @@ export function createInspect({ post, getId, onModeChange, onLaserPick }) {
|
|
|
343
346
|
// Both colour by the element's depth hue (--mv-hue lives in the always-on base sheet).
|
|
344
347
|
const laserCss = () => {
|
|
345
348
|
let rules = DEPTH_HUE // depth hues live only while a mode is active
|
|
346
|
-
if (laserOn)
|
|
349
|
+
if (laserOn && inspectOn)
|
|
347
350
|
rules += 'body *:not(script):not(style):not(#mv-laser-label):not(#mv-laser-label *) { outline: 1px solid hsl(var(--mv-hue) 85% 55% / .75); outline-offset: -1px }\n'
|
|
348
351
|
if (pickOn || laserOn)
|
|
349
352
|
rules += `body, body * { cursor: ${pickOn ? PICK_CURSOR : LASER_CURSOR} !important }\n`
|
|
350
353
|
// comment mode: the hovered element pops in its OWN hue (outline + fill + ring), so it
|
|
351
354
|
// reads as "the thing you'll comment on" in the same colour it wears in laser. Laser
|
|
352
355
|
// keeps its lighter single outline so the whole board stays legible.
|
|
353
|
-
|
|
356
|
+
// the pointer laser lights the hovered element exactly as comment mode does; inspect keeps its lighter outline
|
|
357
|
+
const hover = pickOn || !inspectOn ? HUE_HL('[data-mv-hover]', '--mv-hue') : `
|
|
354
358
|
body [data-mv-hover] { outline: 2px solid hsl(var(--mv-hue) 95% 45%); outline-offset: -2px;
|
|
355
359
|
background-image: linear-gradient(hsl(var(--mv-hue) 95% 50% / .08), hsl(var(--mv-hue) 95% 50% / .08)) }`
|
|
356
360
|
return rules + hover + `
|
|
@@ -527,7 +531,8 @@ body [data-mv-hover] { outline: 2px solid hsl(var(--mv-hue) 95% 45%); outline-of
|
|
|
527
531
|
if (e.origin && e.origin !== location.origin) return // a navigated frame must not spoof shell commands
|
|
528
532
|
const m = e?.data
|
|
529
533
|
if (!m || typeof m !== 'object') return
|
|
530
|
-
|
|
534
|
+
// (a shell from before 0.26.1 sends no `inspect`: its laser is the outlined one)
|
|
535
|
+
if (m.type === 'sh:laser') { laserOn = !!m.on; inspectOn = laserOn && (m.inspect === undefined ? true : !!m.inspect); applyModes(); onModeChange?.(laserOn, pickOn) }
|
|
531
536
|
else if (m.type === 'sh:pick') {
|
|
532
537
|
pickOn = !!m.on; pickQuiet = !!m.quiet; applyModes()
|
|
533
538
|
if (pickQuiet) clearHover() // a hover lit before the toggle landed must not linger
|
|
@@ -22,9 +22,13 @@ export const composing = (e) => !!e.isComposing || e.keyCode === 229
|
|
|
22
22
|
/** May a shortcut take this key at all? Not from a field, not mid-composition. */
|
|
23
23
|
export const keyAllowed = (e) => !composing(e) && !inField(e.target)
|
|
24
24
|
|
|
25
|
+
/** A key's name: a single character lowercased, else its name - and with Alt, a letter named by the key pressed
|
|
26
|
+
* (Option on a Mac types a symbol: ⌥L is "¬"). */
|
|
27
|
+
export const keyName = (e) => (e.altKey && /^Key[A-Z]$/.test(e.code ?? '') ? e.code.slice(3).toLowerCase() : e.key && e.key.length === 1 ? e.key.toLowerCase() : e.key)
|
|
28
|
+
|
|
25
29
|
/** The descriptor `sh:keys` speaks. */
|
|
26
30
|
export function keyDescriptor(e) {
|
|
27
|
-
const k = e
|
|
31
|
+
const k = keyName(e)
|
|
28
32
|
return [e.ctrlKey && 'Ctrl', e.metaKey && 'Meta', e.altKey && 'Alt', e.shiftKey && 'Shift', k].filter(Boolean).join('+')
|
|
29
33
|
}
|
|
30
34
|
|
|
@@ -43,7 +47,7 @@ export function createKeys({ post, trusted }) {
|
|
|
43
47
|
if (!owns(e)) return
|
|
44
48
|
e.preventDefault()
|
|
45
49
|
e.stopImmediatePropagation()
|
|
46
|
-
const key = e
|
|
50
|
+
const key = keyName(e)
|
|
47
51
|
post({ type: 'sh:key', key, code: e.code, shift: e.shiftKey, alt: e.altKey, meta: e.metaKey, ctrl: e.ctrlKey })
|
|
48
52
|
}
|
|
49
53
|
window.addEventListener('message', onMessage)
|
package/src/client/shell/App.tsx
CHANGED
|
@@ -728,7 +728,9 @@ export function App() {
|
|
|
728
728
|
const s = useStore.getState()
|
|
729
729
|
if (s.play) return // play mode owns the keyboard (Play.tsx)
|
|
730
730
|
// Jam's keys first (spec 27): the first state that takes the key; the rest falls through
|
|
731
|
-
|
|
731
|
+
// with Option a Mac types a symbol (⌥L is "¬"): an Alt shortcut is named by the key pressed
|
|
732
|
+
const key = e.altKey && /^Key[A-Z]$/.test(e.code) ? e.code.slice(3).toLowerCase() : e.key
|
|
733
|
+
if (!e.repeat && jamKey({ key, shift: e.shiftKey, alt: e.altKey, meta: e.metaKey, ctrl: e.ctrlKey })) { e.preventDefault(); return }
|
|
732
734
|
if ((e.metaKey || e.ctrlKey) && e.key === '\\') { e.preventDefault(); togglePanel(); return }
|
|
733
735
|
if ((e.metaKey || e.ctrlKey) && e.key === '/') { e.preventDefault(); setPillOpen((o) => !o); return }
|
|
734
736
|
if ((e.metaKey || e.ctrlKey) && e.key === 'a') { e.preventDefault(); s.selectAll(); return }
|
|
@@ -748,9 +750,11 @@ export function App() {
|
|
|
748
750
|
if (e.key === 't') { animateLayout(); runTidy() }
|
|
749
751
|
// laser and comment mode are one-at-a-time: comment mode already highlights
|
|
750
752
|
// what you'd click, so stacking the full rainbow on top only adds noise
|
|
751
|
-
|
|
752
|
-
|
|
753
|
-
|
|
753
|
+
// L: the pointer laser (the element under the cursor); ⌥L: inspect (every element outlined)
|
|
754
|
+
if (key === 'l' && !e.shiftKey && SOURCE_REVEALED) {
|
|
755
|
+
e.preventDefault()
|
|
756
|
+
commentsStore().setMode(false)
|
|
757
|
+
s.toggleLaser(e.altKey)
|
|
754
758
|
}
|
|
755
759
|
// C = comment mode (the Figma/Miro convention) · Shift+C = hide/show
|
|
756
760
|
// pins · Shift+P = copy file path(s) (P alone is play; D6, changelog 0.4.0)
|
|
@@ -16,7 +16,7 @@ import { ContextMenu, useContextMenu, type MenuItem } from './ContextMenu.tsx'
|
|
|
16
16
|
import { ArrowBendUpLeftIcon, ArrowLineUpIcon, ArrowUpIcon, CheckSquareOffsetIcon, CommentIcon, EyeIcon, NotebookIcon, PencilSimpleIcon, PlayIcon, ReloadIcon, XIcon } from './icons.tsx'
|
|
17
17
|
import { laneLine, timelineLines } from './jam-lines.ts'
|
|
18
18
|
import { changedShots, useJamQueue, type JamCard } from './jam-queue.ts'
|
|
19
|
-
import { letGoOfTile, useJamUi } from './jam-state.ts'
|
|
19
|
+
import { DONE_GROUP, doneFold, letGoOfTile, useJamUi } from './jam-state.ts'
|
|
20
20
|
import { CaptureLaneRow, FocusPanelView } from './jam-surface-parts.tsx'
|
|
21
21
|
import { clearMoreDraft, EdgeRing } from './jam-panel.tsx'
|
|
22
22
|
import { useComments } from './comments-store.ts'
|
|
@@ -118,13 +118,18 @@ export function JamSurface({ sidebarRight }: { sidebarRight: number }) {
|
|
|
118
118
|
if (sel?.thread === s.active) { if (st.panel) st.close() } else letGoOfTile()
|
|
119
119
|
}), [])
|
|
120
120
|
const made = (id: string) => Number(/^cap-(\d+)-/.exec(id)?.[1] ?? 0)
|
|
121
|
-
const withMade = list.map((c) => ({ made: c.made, tile: { id: c.id, state: c.state, title: c.title ?? 'Capture', line: laneLine(c), ...(c.exclusive ? { exclusive: true } : {}) } as { id: string; state: JamCard['state']; title: string; line: string; exclusive?: boolean } }))
|
|
121
|
+
const withMade = list.map((c) => ({ made: c.made, tile: { id: c.id, state: c.state, title: c.title ?? 'Capture', line: laneLine(c), ...(c.exclusive ? { exclusive: true } : {}), ...(c.state === 'done' && c.shots?.some((x) => !x.same) ? { frames: c.shots.filter((x) => !x.same).map((x) => x.frame) } : {}), ...(c.kind === 'wrapup' ? { record: true } : {}) } as { id: string; state: JamCard['state']; title: string; line: string; exclusive?: boolean; frames?: string[]; record?: boolean } }))
|
|
122
122
|
// captures the server does not hold yet: sealing (pictures and flushes still out) or waiting to send -
|
|
123
123
|
// each in its place by when it started, so one sealing late never swaps with a newer one
|
|
124
124
|
const known = new Set(list.map((c) => c.id))
|
|
125
125
|
for (const c of Object.values(cap.caps)) if (c.state === 'draining' && !known.has(c.id)) withMade.push({ made: made(c.id), tile: { id: c.id, state: 'confirming', title: 'Capture', line: 'Finishing' } })
|
|
126
126
|
for (const id of cap.unsent) if (!known.has(id) && !cap.caps[id]) withMade.push({ made: made(id), tile: { id, state: 'confirming', title: 'Capture', line: 'Waiting to send' } })
|
|
127
127
|
const tiles = withMade.sort((a, b) => a.made - b.made).map((x) => x.tile)
|
|
128
|
+
// a selected tile that became done while the Done group is folded: the group holds the selection now
|
|
129
|
+
const doneNow = doneFold(tiles, ui.doneOpen)
|
|
130
|
+
useEffect(() => {
|
|
131
|
+
if (doneNow.fold && !ui.doneOpen && ui.selected && doneNow.done.some((t) => t.id === ui.selected)) ui.select(DONE_GROUP)
|
|
132
|
+
}, [doneNow.fold, ui.doneOpen, ui.selected, doneNow.done.length])
|
|
128
133
|
const recording = cap.current ? (() => {
|
|
129
134
|
const c = cap.caps[cap.current!]
|
|
130
135
|
const counts = captureCounts(c)
|
|
@@ -177,6 +182,7 @@ export function JamSurface({ sidebarRight }: { sidebarRight: number }) {
|
|
|
177
182
|
{shown && (
|
|
178
183
|
<CaptureLaneRow
|
|
179
184
|
tiles={folded ? [] : tiles} recording={recording} between={between} selected={ui.selected ?? undefined} keyboard={ui.laneKeys} followEnd={ui.followEnd}
|
|
185
|
+
doneOpen={ui.doneOpen} onDoneOpen={(open, ids) => ui.setDoneOpen(open, ids)}
|
|
180
186
|
onOpen={(id) => openTile(id)}
|
|
181
187
|
onMenu={(e, id) => { const c = cards?.find((x) => x.id === id); if (c) { ui.select(id); cm.open(e, tileMenu(c)) } else e.preventDefault() }}
|
|
182
188
|
ask={voice.asking && cap.current ? voiceAsk(voice) : undefined}
|
|
@@ -214,7 +220,7 @@ export function JamSurface({ sidebarRight }: { sidebarRight: number }) {
|
|
|
214
220
|
shots={changedShots(panelCard.shots).map((x) => ({ frame: x.frame, before: picture(x.before), after: picture(x.after), ...(x.new ? { new: true } : {}) }))}
|
|
215
221
|
reply={panelCard.reply ? replyText(panelCard) : ''}
|
|
216
222
|
view={ui.view} tab={ui.tab} moreOpen={ui.moreOpen}
|
|
217
|
-
onTab={(i) => ui.setTab(i)} onFlip={() => ui.
|
|
223
|
+
onTab={(i) => ui.setTab(i)} onFlip={(v) => ui.setView(v)} onMoreOpen={(on) => ui.setMoreOpen(on)}
|
|
218
224
|
onClose={() => ui.close()}
|
|
219
225
|
onEdit={(text) => saveEdit(panelCard, text)}
|
|
220
226
|
onConfirm={() => void decideDraft(panelCard.id, 'confirm')}
|
|
@@ -340,7 +340,8 @@ function PlayInner() {
|
|
|
340
340
|
|
|
341
341
|
// laser / comment ride the same rail as canvas frames, broadcast to the stage iframe.
|
|
342
342
|
// Re-sent on stage-ready (below) so a stage reload restores the mode.
|
|
343
|
-
|
|
343
|
+
const laserInspect = useStore((s) => s.laserInspect)
|
|
344
|
+
useEffect(() => { postStage({ type: 'sh:laser', on: laser, inspect: laserInspect }) }, [laser, laserInspect])
|
|
344
345
|
useEffect(() => { postStage({ type: 'sh:pick', on: commentMode, quiet: !useComments.getState().showAnchor }) }, [commentMode, playShowAnchor])
|
|
345
346
|
|
|
346
347
|
const exit = () => {
|
|
@@ -462,7 +463,7 @@ function PlayInner() {
|
|
|
462
463
|
if (typeof data.at === 'string' && data.at !== p.at) postStage({ type: 'sh:stage-set', at: p.at })
|
|
463
464
|
postStage({ type: 'sh:set-theme', theme: p.theme })
|
|
464
465
|
}
|
|
465
|
-
postStage({ type: 'sh:laser', on: s.laser })
|
|
466
|
+
postStage({ type: 'sh:laser', on: s.laser, inspect: s.laserInspect })
|
|
466
467
|
postStage({ type: 'sh:pick', on: commentsStore().commentMode, quiet: !commentsStore().showAnchor })
|
|
467
468
|
setStageReady((n) => n + 1) // a reload wiped the frame's lock; let PlayComments re-drive it
|
|
468
469
|
} else if (data.type === 'sh:stage-shown') {
|
|
@@ -486,7 +487,7 @@ function PlayInner() {
|
|
|
486
487
|
}
|
|
487
488
|
} else if (data.type === 'sh:stage-key') {
|
|
488
489
|
if (data.meta && data.key === '/') toggleCollapse()
|
|
489
|
-
else handleKey(String(data.key), String(data.code))
|
|
490
|
+
else handleKey(String(data.key), String(data.code), !!data.alt)
|
|
490
491
|
} else if (data.type === 'sh:picked') {
|
|
491
492
|
// comment pick from the stage: stage the draft on the walked frame (its canvas
|
|
492
493
|
// node when one is on this board, so the thread also lands on the canvas). Stamp
|
|
@@ -522,7 +523,7 @@ function PlayInner() {
|
|
|
522
523
|
}, [])
|
|
523
524
|
|
|
524
525
|
// shared handler: keys arrive directly (focus in shell) or forwarded by the stage
|
|
525
|
-
const handleKey = (key: string, code: string) => {
|
|
526
|
+
const handleKey = (key: string, code: string, alt = false) => {
|
|
526
527
|
if (key === 'Escape') {
|
|
527
528
|
// a live review mode swallows Escape first (cancel), so it never ejects you from
|
|
528
529
|
// the prototype mid-comment; a second Escape (nothing live) exits
|
|
@@ -539,7 +540,8 @@ function PlayInner() {
|
|
|
539
540
|
if (key === ']') { switchVariant(1); return }
|
|
540
541
|
if (key === 'r') { restart(); return }
|
|
541
542
|
if (key === 'h') { toggleHideUI(); return }
|
|
542
|
-
|
|
543
|
+
// L: the pointer laser; ⌥L: inspect
|
|
544
|
+
if (key === 'l' && SOURCE_REVEALED) { commentsStore().setMode(false); useStore.getState().toggleLaser(alt); return }
|
|
543
545
|
if (key === 'c') { const c = commentsStore(); if (!c.commentMode && useStore.getState().board === UNPLACED) return useStore.getState().toast(NO_COMMENTS_HERE); if (!c.commentMode) useStore.getState().setLaser(false); c.setMode(!c.commentMode); return }
|
|
544
546
|
if (key === 'C') { const c = commentsStore(); c.setShow(!c.show); return } // ⇧C hides/shows pins
|
|
545
547
|
if (key === 'L') { const c = commentsStore(); c.setShowAnchor(!c.showAnchor); return } // ⇧L element focus
|
|
@@ -561,10 +563,12 @@ function PlayInner() {
|
|
|
561
563
|
const onKey = (e: KeyboardEvent) => {
|
|
562
564
|
if (!keyAllowed(e)) return // the one key guard (frame-host/keys.js): never from a field, an editable, an IME composition
|
|
563
565
|
// Jam's keys first - a review open takes the arrows before they step screens
|
|
564
|
-
|
|
566
|
+
// with Option a Mac types a symbol (⌥L is "¬"): an Alt shortcut is named by the key pressed
|
|
567
|
+
const key = e.altKey && /^Key[A-Z]$/.test(e.code) ? e.code.slice(3).toLowerCase() : e.key
|
|
568
|
+
if (!e.repeat && jamKey({ key, shift: e.shiftKey, alt: e.altKey, meta: e.metaKey, ctrl: e.ctrlKey })) { e.preventDefault(); return }
|
|
565
569
|
if ((e.metaKey || e.ctrlKey) && e.key === '/') { e.preventDefault(); toggleCollapse(); return }
|
|
566
570
|
if (e.metaKey || e.ctrlKey) return
|
|
567
|
-
handleKey(e.
|
|
571
|
+
handleKey(key, e.code, e.altKey)
|
|
568
572
|
}
|
|
569
573
|
window.addEventListener('keydown', onKey)
|
|
570
574
|
return () => window.removeEventListener('keydown', onKey)
|
|
@@ -89,15 +89,16 @@ function TipRows({ rows }: { rows: [string, string][] }) {
|
|
|
89
89
|
* since the two are one-at-a-time). */
|
|
90
90
|
export function LaserButton() {
|
|
91
91
|
const laser = useStore((s) => s.laser)
|
|
92
|
+
const laserInspect = useStore((s) => s.laserInspect)
|
|
92
93
|
const showAnchor = useComments((s) => s.showAnchor)
|
|
93
94
|
// stripped build: the paths are not in the bundle, so the button that would
|
|
94
95
|
// copy them has nothing honest to offer
|
|
95
96
|
if (!SOURCE_REVEALED) return null
|
|
96
97
|
return (
|
|
97
|
-
<Tip side="bottom" label={<TipRows rows={[['Laser
|
|
98
|
-
<button className={`sh-pill-btn${laser ? ' on' : ''}`} onClick={() => {
|
|
99
|
-
|
|
100
|
-
useStore.getState().
|
|
98
|
+
<Tip side="bottom" label={<TipRows rows={[['Laser', 'L'], ['Inspect', '⌥L'], [showAnchor ? 'Hide laser comment' : 'Show laser comment', '⇧L']]} />}>
|
|
99
|
+
<button className={`sh-pill-btn${laser ? ' on' : ''}`} data-laser={laser ? (laserInspect ? 'inspect' : 'pointer') : 'off'} onClick={(e) => {
|
|
100
|
+
commentsStore().setMode(false)
|
|
101
|
+
useStore.getState().toggleLaser(e.altKey)
|
|
101
102
|
}}><LaserIcon size={16} /></button>
|
|
102
103
|
</Tip>
|
|
103
104
|
)
|
|
@@ -158,6 +158,7 @@ export const FrameNode = memo(function FrameNode({ node }: { node: Node }) {
|
|
|
158
158
|
// laser mode rides the same rail; re-sent when a frame becomes ready
|
|
159
159
|
// so late loaders join an already-lasered board
|
|
160
160
|
const laser = useStore((s) => s.laser)
|
|
161
|
+
const laserInspect = useStore((s) => s.laserInspect)
|
|
161
162
|
const commentMode = useComments((s) => s.commentMode)
|
|
162
163
|
// a node hosting the OPEN thread card (or a draft composer) rises above its
|
|
163
164
|
// neighbors - each node is a stacking context, so an overflowing card would
|
|
@@ -167,8 +168,8 @@ export const FrameNode = memo(function FrameNode({ node }: { node: Node }) {
|
|
|
167
168
|
t.id === s.active && !t.resolved && threadHostKey(t, useStore.getState().nodes) === node.key)) || s.draft?.nodeKey === node.key)
|
|
168
169
|
useEffect(() => {
|
|
169
170
|
if (node.status === 'ready' || !laser)
|
|
170
|
-
iframeRef.current?.contentWindow?.postMessage({ type: 'sh:laser', on: laser }, location.origin)
|
|
171
|
-
}, [laser, node.status])
|
|
171
|
+
iframeRef.current?.contentWindow?.postMessage({ type: 'sh:laser', on: laser, inspect: laserInspect }, location.origin)
|
|
172
|
+
}, [laser, laserInspect, node.status])
|
|
172
173
|
// comment mode = pick mode in the frame (late loaders join like laser does); quiet when
|
|
173
174
|
// laser comment (⇧L) is off - clicks still anchor, no lighting in the artwork
|
|
174
175
|
const showAnchor = useComments((s) => s.showAnchor)
|
|
@@ -20,6 +20,8 @@ const icon = (children: ReactNode) =>
|
|
|
20
20
|
export const SunIcon = icon(<path d="M120,40V16a8,8,0,0,1,16,0V40a8,8,0,0,1-16,0Zm72,88a64,64,0,1,1-64-64A64.07,64.07,0,0,1,192,128Zm-16,0a48,48,0,1,0-48,48A48.05,48.05,0,0,0,176,128ZM58.34,69.66A8,8,0,0,0,69.66,58.34l-16-16A8,8,0,0,0,42.34,53.66Zm0,116.68-16,16a8,8,0,0,0,11.32,11.32l16-16a8,8,0,0,0-11.32-11.32ZM192,72a8,8,0,0,0,5.66-2.34l16-16a8,8,0,0,0-11.32-11.32l-16,16A8,8,0,0,0,192,72Zm5.66,114.34a8,8,0,0,0-11.32,11.32l16,16a8,8,0,0,0,11.32-11.32ZM48,128a8,8,0,0,0-8-8H16a8,8,0,0,0,0,16H40A8,8,0,0,0,48,128Zm80,80a8,8,0,0,0-8,8v24a8,8,0,0,0,16,0V216A8,8,0,0,0,128,208Zm112-88H216a8,8,0,0,0,0,16h24a8,8,0,0,0,0-16Z" />)
|
|
21
21
|
export const MoonIcon = icon(<path d="M233.54,142.23a8,8,0,0,0-8-2,88.08,88.08,0,0,1-109.8-109.8,8,8,0,0,0-10-10,104.84,104.84,0,0,0-52.91,37A104,104,0,0,0,136,224a103.09,103.09,0,0,0,62.52-20.88,104.84,104.84,0,0,0,37-52.91A8,8,0,0,0,233.54,142.23ZM188.9,190.34A88,88,0,0,1,65.66,67.11a89,89,0,0,1,31.4-26A106,106,0,0,0,96,56,104.11,104.11,0,0,0,200,160a106,106,0,0,0,14.92-1.06A89,89,0,0,1,188.9,190.34Z" />)
|
|
22
22
|
export const CaretIcon = icon(<path d="M213.66,101.66l-80,80a8,8,0,0,1-11.32,0l-80-80A8,8,0,0,1,53.66,90.34L128,164.69l74.34-74.35a8,8,0,0,1,11.32,11.32Z" />)
|
|
23
|
+
/** arrows-in-line-horizontal: fold a row in on itself (the lane's Done tiles) */
|
|
24
|
+
export const ArrowsInLineHorizontalIcon = icon(<path d="M136,40V216a8,8,0,0,1-16,0V40a8,8,0,0,1,16,0ZM69.66,90.34a8,8,0,0,0-11.32,11.32L76.69,120H16a8,8,0,0,0,0,16H76.69L58.34,154.34a8,8,0,0,0,11.32,11.32l32-32a8,8,0,0,0,0-11.32ZM240,120H179.31l18.35-18.34a8,8,0,0,0-11.32-11.32l-32,32a8,8,0,0,0,0,11.32l32,32a8,8,0,0,0,11.32-11.32L179.31,136H240a8,8,0,0,0,0-16Z" />)
|
|
23
25
|
export const PlayIcon = icon(<path d="M232.4,114.49,88.32,26.35a16,16,0,0,0-16.2-.3A15.86,15.86,0,0,0,64,39.87V216.13A15.94,15.94,0,0,0,80,232a16.07,16.07,0,0,0,8.36-2.35L232.4,141.51a15.81,15.81,0,0,0,0-27ZM80,215.94V40l143.83,88Z" />)
|
|
24
26
|
export const GridIcon = icon(<path d="M104,40H56A16,16,0,0,0,40,56v48a16,16,0,0,0,16,16h48a16,16,0,0,0,16-16V56A16,16,0,0,0,104,40Zm0,64H56V56h48v48Zm96-64H152a16,16,0,0,0-16,16v48a16,16,0,0,0,16,16h48a16,16,0,0,0,16-16V56A16,16,0,0,0,200,40Zm0,64H152V56h48v48Zm-96,32H56a16,16,0,0,0-16,16v48a16,16,0,0,0,16,16h48a16,16,0,0,0,16-16V152A16,16,0,0,0,104,136Zm0,64H56V152h48v48Zm96-64H152a16,16,0,0,0-16,16v48a16,16,0,0,0,16,16h48a16,16,0,0,0,16-16V152A16,16,0,0,0,200,136Zm0,64H152V152h48v48Z" />)
|
|
25
27
|
export const CopyIcon = icon(<path d="M216,32H88a8,8,0,0,0-8,8V80H40a8,8,0,0,0-8,8V216a8,8,0,0,0,8,8H168a8,8,0,0,0,8-8V176h40a8,8,0,0,0,8-8V40A8,8,0,0,0,216,32ZM160,208H48V96H160Zm48-48H176V88a8,8,0,0,0-8-8H96V48H208Z" />)
|