@marver-design/marver 0.30.1 → 0.31.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/CHANGELOG.md +58 -0
- package/README.md +11 -7
- package/dist/{anchor-check-Bv4o-R2T.mjs → anchor-check-B92s9tVv.mjs} +1 -1
- package/dist/{board-tree-BXR8dw4b.mjs → board-tree-DGj0HhEE.mjs} +6 -2
- package/dist/{boards-EH2onUXM.mjs → boards-Cim1GTKc.mjs} +32 -2
- package/dist/{boards-BeWtjGUM.mjs → boards-OlAhZ87x.mjs} +7 -7
- package/dist/{build-zWGXSzly.mjs → build-BNssmbqd.mjs} +14 -17
- package/dist/{capture-DEtM4qm5.mjs → capture-HaS-1or8.mjs} +1 -1
- package/dist/cli.mjs +38 -20
- package/dist/{collab-BEAcXrBb.mjs → collab-D2NcrOB8.mjs} +53 -14
- package/dist/comment-actions-Bxf9Ld4g.mjs +351 -0
- package/dist/{comments-XNhMmSSu.mjs → comments-BakJQwaf.mjs} +85 -10
- package/dist/config-B0YcFtqS.mjs +510 -0
- package/dist/{context-BUnFiyA3.mjs → context-Cj2TcC0H.mjs} +3 -3
- package/dist/{daemon-CChgWJNq.mjs → daemon-MxoEQajX.mjs} +222 -23
- package/dist/deep-link-DYtuT740.mjs +163 -0
- package/dist/{dev-DOgIITpT.mjs → dev-BBZe_brH.mjs} +23 -16
- package/dist/devices-uJZ2inMq.mjs +155 -0
- package/dist/{events-CLH4ijKP.mjs → events-Dieo1482.mjs} +49 -4
- package/dist/{init-CYlFaRzG.mjs → init-BgusplYn.mjs} +40 -10
- package/dist/{jam-Cj5gBvwD.mjs → jam-CkuLL8A8.mjs} +1 -1
- package/dist/{link-BFFRgrMt.mjs → link-Cmt9Xy4X.mjs} +54 -7
- package/dist/{logo-CXY-1yrn.mjs → logo-C9s7-Cy9.mjs} +89 -66
- package/dist/{ls-NqmePKOf.mjs → ls-DGVIW-Io.mjs} +1 -1
- package/dist/{manifest-DPZ3WNg_.mjs → manifest-CK8Qh4Nq.mjs} +255 -13
- package/dist/{marks-BnNANic9.mjs → marks-C8oX8kbE.mjs} +3 -3
- package/dist/{marks-DBp3h1Mc.mjs → marks-Dt-5JXCp.mjs} +18 -5
- package/dist/{marver-id-gate-vBLb_Icb.mjs → marver-id-gate-BAeuMeaU.mjs} +11 -7
- package/dist/md-B9_13Q0R.mjs +105 -0
- package/dist/notes-CRAX4wgk.mjs +148 -0
- package/dist/own-C8Mq0Hnf.mjs +128 -0
- package/dist/pdf-0m721FFn.mjs +117 -0
- package/dist/pdf-CZENT6t3.mjs +2299 -0
- package/dist/{perf-BCxAo0IS.mjs → perf-BB0XNt1M.mjs} +1 -1
- package/dist/{perf-6MOTHxay.mjs → perf-CIMijND6.mjs} +5 -5
- package/dist/{plugin-CFWBcAba.mjs → plugin-CL8_wL7a.mjs} +460 -83
- package/dist/{poster-DPPpQiva.mjs → poster-B7uSjlEP.mjs} +1 -1
- package/dist/{profile-B1FKOM1e.mjs → profile-cdmSer1k.mjs} +1 -1
- package/dist/{publish-bakes-_Zx8crP3.mjs → publish-bakes-BjgDNeyS.mjs} +3 -3
- package/dist/{queue-DeSQm24g.mjs → queue-BLLfdlDw.mjs} +156 -11
- package/dist/{recover-mDUVsnPd.mjs → recover-ByuFQOF9.mjs} +2 -2
- package/dist/{serve-DQv3Ti6X.mjs → serve-kcF6-H8V.mjs} +4 -4
- package/dist/{session-VDJfXEEm.mjs → session-DBF-nQvq.mjs} +29 -3
- package/dist/{share-Bu_kuOKL.mjs → share-CS2mg27O.mjs} +1 -1
- package/dist/{shot-d4h_hJi9.mjs → shot-BqwkdtKn.mjs} +4 -4
- package/dist/{shot-DBWN8hPP.mjs → shot-D2TQGo2V.mjs} +1 -1
- package/dist/show-B1u3DiJw.mjs +101 -0
- package/dist/{sizes-wjXDev3b.mjs → sizes-BckcL4Zz.mjs} +1 -1
- package/dist/{slots-Dn4Onb0V.mjs → slots-BOcfIqxy.mjs} +15 -3
- package/dist/{summary-Y8MY1Wuc.mjs → summary-cPmRDGpX.mjs} +1 -1
- package/dist/{sync-CMozOwZ0.mjs → sync-BNWwh8OF.mjs} +205 -7
- package/dist/{work-BYWD_1Zf.mjs → work-DRdzXPvg.mjs} +3 -3
- package/dist/{work-DJxH7cCX.mjs → work-Nv-n2_Un.mjs} +1 -1
- package/docs/app.md +49 -0
- package/docs/boards-and-folders.md +37 -6
- package/docs/jam-session.md +5 -0
- package/docs/live-jam.md +9 -0
- package/docs/pdf.md +108 -0
- package/docs/publish.md +9 -9
- package/docs/sharing.md +11 -0
- package/docs/slides.md +9 -0
- package/package.json +3 -1
- package/src/client/content/index.tsx +4 -2
- package/src/client/frame-host/main.tsx +3 -0
- package/src/client/shell/App.tsx +71 -24
- package/src/client/shell/BoardList.tsx +16 -7
- package/src/client/shell/Comments.tsx +77 -16
- package/src/client/shell/Play.tsx +24 -22
- package/src/client/shell/Toolbar.tsx +4 -3
- package/src/client/shell/app-bridge.ts +32 -5
- package/src/client/shell/canvas/Canvas.tsx +30 -8
- package/src/client/shell/canvas/FrameNode.tsx +3 -1
- package/src/client/shell/canvas/ctl.ts +16 -0
- package/src/client/shell/commands.ts +20 -0
- package/src/client/shell/comments-store.ts +81 -2
- package/src/client/shell/devices.tsx +42 -0
- package/src/client/shell/goto.ts +56 -9
- package/src/client/shell/icons.tsx +11 -4
- package/src/client/shell/jam-lines.ts +5 -3
- package/src/client/shell/jam-panel.tsx +17 -5
- package/src/client/shell/marks-ui.tsx +54 -0
- package/src/client/shell/notes.ts +21 -0
- package/src/client/shell/pdf-export.tsx +154 -0
- package/src/client/shell/pdf-notes.ts +20 -0
- package/src/client/shell/show.ts +250 -0
- package/src/client/shell/store.ts +23 -38
- package/src/client/shell/styles.css +43 -0
- package/src/shared/app-api.ts +49 -4
- package/src/shared/auto-place.ts +32 -0
- package/src/shared/board-tree.ts +3 -0
- package/src/shared/board-types.ts +6 -2
- package/src/shared/deep-link.ts +212 -0
- package/src/shared/devices.ts +89 -0
- package/src/shared/events.ts +48 -5
- package/src/shared/export-plan.ts +98 -0
- package/templates/AGENTS-embedded.md +76 -12
- package/templates/AGENTS-studio.md +76 -12
- package/templates/instructions/boards.md +6 -5
- package/templates/instructions/configure.md +32 -2
- package/templates/instructions/iterate.md +8 -0
- package/templates/instructions/jam.md +9 -0
- package/templates/instructions/publish.md +14 -4
- package/templates/instructions/review.md +4 -0
- package/templates/instructions/slides.md +67 -1
- package/templates/instructions/welcome.md +9 -5
- package/templates/playbooks/publish-canvas/PLAYBOOK.md +1 -1
- package/dist/config-BezZTiov.mjs +0 -182
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@marver-design/marver",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.31.0",
|
|
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,
|
|
@@ -53,6 +53,7 @@
|
|
|
53
53
|
"magic-string": "^0.30.21",
|
|
54
54
|
"marked": "^16.0.0",
|
|
55
55
|
"mermaid": "^11.6.0",
|
|
56
|
+
"pdf-lib": "1.17.1",
|
|
56
57
|
"react-zoom-pan-pinch": "^3.6.1",
|
|
57
58
|
"roughjs": "^4.6.6",
|
|
58
59
|
"vite": "~8.2.1",
|
|
@@ -68,6 +69,7 @@
|
|
|
68
69
|
"@types/react": "^19.0.0",
|
|
69
70
|
"@types/react-dom": "^19.0.0",
|
|
70
71
|
"@types/ws": "^8.18.2",
|
|
72
|
+
"pdfjs-dist": "4.10.38",
|
|
71
73
|
"tsdown": "^0.22.0",
|
|
72
74
|
"typescript": "^5.7.0",
|
|
73
75
|
"vitest": "^3.0.0"
|
|
@@ -168,10 +168,12 @@ export function Img({ src, caption, alt, h }: { src: string; caption?: string; a
|
|
|
168
168
|
// and a bitmap decoded for the frame's own box would blur there - the plain <img> keeps
|
|
169
169
|
// its full resolution. A slide frame is marked on <html> (data-mv-slide) before it renders.
|
|
170
170
|
const inSlide = useInSlide() || (typeof document !== 'undefined' && document.documentElement.hasAttribute('data-mv-slide'))
|
|
171
|
+
// a deck PDF's render (frame host `export=1`, spec 31 #5): the original image, loaded now - never an LOD bucket
|
|
172
|
+
const exporting = typeof document !== 'undefined' && document.documentElement.hasAttribute('data-mv-export')
|
|
171
173
|
// LOD: paint the image on a <canvas> decoded to its on-screen size (never the full 17MB bitmap), and
|
|
172
174
|
// re-pick resolution only when the canvas settles after a zoom. See img-lod.ts. Falls back to a plain
|
|
173
175
|
// <img> where createImageBitmap/bitmaprenderer isn't available (correctness over the optimization).
|
|
174
|
-
const lodOn = lodSupported && !inSlide
|
|
176
|
+
const lodOn = lodSupported && !inSlide && !exporting
|
|
175
177
|
useEffect(() => {
|
|
176
178
|
if (!url || err || !lodOn || !canvasRef.current) return
|
|
177
179
|
return registerLodImage(canvasRef.current, url)
|
|
@@ -196,7 +198,7 @@ export function Img({ src, caption, alt, h }: { src: string; caption?: string; a
|
|
|
196
198
|
<figure className="mv-block mv-img">
|
|
197
199
|
{lodOn
|
|
198
200
|
? <canvas ref={canvasRef} className="mv-img-el" role="img" aria-label={alt ?? caption ?? ''} style={style} />
|
|
199
|
-
: <img className="mv-img-el" src={url} alt={alt ?? caption ?? ''} loading=
|
|
201
|
+
: <img className="mv-img-el" src={url} alt={alt ?? caption ?? ''} loading={exporting ? 'eager' : 'lazy'} style={style} onError={() => setErr(true)} />}
|
|
200
202
|
{caption && <figcaption>{caption}</figcaption>}
|
|
201
203
|
</figure>
|
|
202
204
|
)
|
|
@@ -21,6 +21,9 @@ const theme = params.get('theme') ?? 'light'
|
|
|
21
21
|
// data attribute). The bridge applies the same pair on sh:set-theme.
|
|
22
22
|
document.documentElement.dataset.theme = theme
|
|
23
23
|
document.documentElement.classList.toggle('dark', theme === 'dark')
|
|
24
|
+
// a deck PDF's render (spec 31 #5): `export=1` says so on the document - Img decodes every image from its original
|
|
25
|
+
// (no LOD canvas, nothing bucketed or capped at dpr 2), on any board, slide or not
|
|
26
|
+
if (params.get('export') === '1') document.documentElement.setAttribute('data-mv-export', '')
|
|
24
27
|
|
|
25
28
|
const post = (msg: Record<string, unknown>) => { if (window.parent !== window) window.parent.postMessage(msg, '*') }
|
|
26
29
|
// this document's id, set by the bridge (imported first, above) before anything is posted - and the URL revision the
|
package/src/client/shell/App.tsx
CHANGED
|
@@ -16,24 +16,29 @@ import { Tip } from './Tip.tsx'
|
|
|
16
16
|
import { PKG, ROUTE } from '../const.ts'
|
|
17
17
|
import { api, resumed, scoped, useLink } from './api.ts'
|
|
18
18
|
import { animateLayout, Canvas, canvasCtl } from './canvas/Canvas.tsx'
|
|
19
|
+
import { bootCancelled } from './canvas/ctl.ts'
|
|
19
20
|
import { frameByWindow, fromLiveDocument } from './canvas/frame-registry.ts'
|
|
20
21
|
import { recorder } from './recorder.ts'
|
|
21
22
|
import { perfSeams } from './recorder-seams.ts'
|
|
22
23
|
import { takeNavToken } from './recorder-reloads.ts'
|
|
23
24
|
import { cmd, endAfterFrames, endOnCamera, endOnLoad, endOnStage, foldsIntoSave, keysOf, shellReload, type CmdHandle, type CmdOpts } from './commands.ts'
|
|
24
25
|
import { enterFocus, enterPlay, enterSlides, playCtl, PlayOverlay } from './Play.tsx'
|
|
26
|
+
import { PdfNotice } from './pdf-export.tsx'
|
|
25
27
|
import { bootHash, linkTargets, parseHash, retargetBoot, UNPLACED, writeHash } from './hash.ts'
|
|
26
28
|
import { isLegacyLink, landLegacy } from './legacy-links.ts'
|
|
27
|
-
import { CaretIcon, CheckIcon, ColumnsIcon, FrameRectIcon, ImagesSquareIcon, IntentGlyph, MoonIcon, PanelFilledIcon, PanelHollowIcon, ParallelogramDuoIcon, ParallelogramFillIcon, PencilSimpleIcon, PlayIcon, PlusIcon, SignpostIcon, SlideFrameIcon, SunIcon, VariantsIcon, XIcon
|
|
29
|
+
import { CaretIcon, CheckIcon, CheckSquareOffsetIcon, ColumnsIcon, FrameRectIcon, ImagesSquareIcon, IntentGlyph, MoonIcon, PanelFilledIcon, PanelHollowIcon, ParallelogramDuoIcon, ParallelogramFillIcon, PencilSimpleIcon, PlayIcon, PlusIcon, SignpostIcon, SlideFrameIcon, SunIcon, VariantsIcon, XIcon } from './icons.tsx'
|
|
30
|
+
import { deviceIcon, deviceLabel } from './devices.tsx'
|
|
28
31
|
import { ALL_SCENES, humanize as slugLabel, readTitle } from '../../shared/board-tree.ts'
|
|
29
|
-
import { CommentsController, parkThread, revealThread } from './Comments.tsx'
|
|
32
|
+
import { cardSelectAll, CommentsController, parkThread, revealThread } from './Comments.tsx'
|
|
30
33
|
import { poweredByUrl } from '../../shared/utm.ts'
|
|
31
34
|
import { avatarFallback, NO_COMMENTS_HERE, useComments } from './comments-store.ts'
|
|
32
|
-
import { goTo, isLatest, navigated, revealFrame, switchFor } from './goto.ts'
|
|
35
|
+
import { goTo, isLatest, navigated, navigatedByHand, navNow, revealFrame, switchFor, watchHands } from './goto.ts'
|
|
36
|
+
import { bootSettled, dismissShow, goNow, showTarget, useShowNotice } from './show.ts'
|
|
37
|
+
import { newerVersion } from '../../shared/deep-link.ts'
|
|
33
38
|
import { useNotes } from './notes.ts'
|
|
34
39
|
import { contentOnly } from '../../shared/frames.ts'
|
|
35
40
|
import { nextToLook } from '../../shared/marks.ts'
|
|
36
|
-
import { asksNow, Bubble, MarkedRow, markSeenFrom, useRollup, useSeenOnScreen } from './marks-ui.tsx'
|
|
41
|
+
import { asksNow, Bubble, MarkedRow, markSeenFrom, resolveAllFrom, useRollup, useSeenOnScreen } from './marks-ui.tsx'
|
|
37
42
|
import { CommentButton, DevicePicker, HideUIButton, LaserButton, Popover, ThemePicker, toggleHideUI, usePopover } from './Toolbar.tsx'
|
|
38
43
|
|
|
39
44
|
const commentsStore = () => useComments.getState()
|
|
@@ -190,9 +195,9 @@ function SelectionBar() {
|
|
|
190
195
|
{Object.entries(CONFIG.viewports).map(([name, vp], vi) => {
|
|
191
196
|
const active = node.w === vp.width
|
|
192
197
|
return (
|
|
193
|
-
<Tip key={name} label={<><b>{
|
|
194
|
-
<button className={active ? 'on' : 'icon'} onClick={() => applyDevice(name)}>
|
|
195
|
-
{deviceIcon(name, 15)}{active && <span>{
|
|
198
|
+
<Tip key={name} label={<><b>{deviceLabel(name)}</b><span>{vp.width} × {vp.height}</span><span className="k">{vi + 1}</span></>}>
|
|
199
|
+
<button className={active ? 'on' : 'icon'} onClick={() => applyDevice(name)} aria-label={deviceLabel(name)}>
|
|
200
|
+
{deviceIcon(name, 15)}{active && <span>{deviceLabel(name)}</span>}
|
|
196
201
|
</button>
|
|
197
202
|
</Tip>
|
|
198
203
|
)
|
|
@@ -259,7 +264,7 @@ function DeviceMenu() {
|
|
|
259
264
|
const active = scoped
|
|
260
265
|
? entries.find(([, vp]) => selNodes.length > 0 && selNodes.every((n) => n.w === vp.width))?.[0] ?? null
|
|
261
266
|
: deviceView
|
|
262
|
-
const hint = scoped ? `${selection.length} selected` : deviceView ?
|
|
267
|
+
const hint = scoped ? `${selection.length} selected` : deviceView ? deviceLabel(deviceView) : `keys 1-${entries.length}`
|
|
263
268
|
return <DevicePicker value={active} onSelect={pick} includeDefault hint={hint} />
|
|
264
269
|
}
|
|
265
270
|
|
|
@@ -274,7 +279,8 @@ function UpdatePill() {
|
|
|
274
279
|
api('update')
|
|
275
280
|
.then((r) => (r.ok ? r.json() : null))
|
|
276
281
|
.then((u) => {
|
|
277
|
-
|
|
282
|
+
// spec 31 E4: the endpoint answers whatever the registry said - the pill only for a strictly newer release
|
|
283
|
+
if (u?.latest && newerVersion(u.latest, u.current) && localStorage.getItem(scoped('mv-update-seen')) !== u.latest) setLatest(u.latest)
|
|
278
284
|
})
|
|
279
285
|
.catch(() => { /* dev server gone or endpoint absent - stay quiet */ })
|
|
280
286
|
}, [])
|
|
@@ -304,6 +310,22 @@ function UpdatePill() {
|
|
|
304
310
|
)
|
|
305
311
|
}
|
|
306
312
|
|
|
313
|
+
/** `marver show` over unsent words (spec 31 D3): the tab did not move - Go moves it, × leaves it be. */
|
|
314
|
+
function ShowNotice() {
|
|
315
|
+
const notice = useShowNotice((s) => s.notice)
|
|
316
|
+
// in Play too: a draft typed there keeps the canvas where it is, and the notice says why (it sits over Play)
|
|
317
|
+
if (!notice) return null
|
|
318
|
+
return (
|
|
319
|
+
<div className="sh-update sh-show-notice" role="status">
|
|
320
|
+
<span>Your agent wants to show you <b>{notice.title}</b></span>
|
|
321
|
+
<button className="cmd" onClick={() => { const h = cmd('show-go', { via: 'click', in: 'shell' }); void goNow().then((r) => { if (r !== 'shown') h.cancel() }) }}><code>Go</code></button>
|
|
322
|
+
<Tip side="top" label="Stay here">
|
|
323
|
+
<button className="x" onClick={() => { cmd('show-dismiss', { via: 'click', in: 'shell' }); dismissShow() }}><XIcon size={13} /></button>
|
|
324
|
+
</Tip>
|
|
325
|
+
</div>
|
|
326
|
+
)
|
|
327
|
+
}
|
|
328
|
+
|
|
307
329
|
const ZOOMS = [2, 1.5, 1, 0.5, 0.25, 0.1]
|
|
308
330
|
|
|
309
331
|
/** Zoom preset dropdown on the percentage readout. */
|
|
@@ -318,15 +340,15 @@ function ZoomMenu() {
|
|
|
318
340
|
</Tip>
|
|
319
341
|
<Popover pop={pop}>
|
|
320
342
|
{ZOOMS.map((z) => (
|
|
321
|
-
<button key={z} onClick={() => go(() => { cmd('zoom-to', { via: 'click', in: 'pill' }); canvasCtl.zoomTo(z) })}>
|
|
343
|
+
<button key={z} onClick={() => go(() => { cmd('zoom-to', { via: 'click', in: 'pill' }); navigatedByHand(); canvasCtl.zoomTo(z) })}>
|
|
322
344
|
<span>{z * 100}%</span>
|
|
323
345
|
{z === 1 && <kbd>⇧0</kbd>}
|
|
324
346
|
{Math.abs(scale - z) < 0.03 && <CheckIcon size={13} className="chk" />}
|
|
325
347
|
</button>
|
|
326
348
|
))}
|
|
327
349
|
<i className="div" />
|
|
328
|
-
<button onClick={() => go(() => { cmd('fit-all', { via: 'click', in: 'pill' }); canvasCtl.fitAll() })}><span>Fit all</span><kbd>⇧1</kbd></button>
|
|
329
|
-
<button onClick={() => go(() => { const h = cmd('fit-selection', { via: 'click', in: 'pill' }); const k = useStore.getState().selection; if (k.length) canvasCtl.fitNodes(k); else h.noop('no-selection') })}>
|
|
350
|
+
<button onClick={() => go(() => { cmd('fit-all', { via: 'click', in: 'pill' }); navigatedByHand(); canvasCtl.fitAll() })}><span>Fit all</span><kbd>⇧1</kbd></button>
|
|
351
|
+
<button onClick={() => go(() => { const h = cmd('fit-selection', { via: 'click', in: 'pill' }); const k = useStore.getState().selection; navigatedByHand(); if (k.length) canvasCtl.fitNodes(k); else h.noop('no-selection') })}>
|
|
330
352
|
<span>Fit selection</span><kbd>⇧2</kbd>
|
|
331
353
|
</button>
|
|
332
354
|
</Popover>
|
|
@@ -445,8 +467,8 @@ export function App() {
|
|
|
445
467
|
else if (resumed?.outcome === 'gone') toast(BOARD_GONE)
|
|
446
468
|
urlReady.current = true
|
|
447
469
|
// a link naming frames on a board with NO nodes: the canvas's boot fit never runs (it waits
|
|
448
|
-
// for the first frame) - follow the frame to where it lives from here
|
|
449
|
-
if (ok && bootHash.f?.length && !bootHash.focus && !useStore.getState().nodes.length) void revealFrame(bootHash.f[0])
|
|
470
|
+
// for the first frame) - follow the frame to where it lives from here, under the boot's own navigation
|
|
471
|
+
if (ok && bootHash.f?.length && !bootHash.focus && !useStore.getState().nodes.length) void revealFrame(bootHash.f[0], navNow(), () => !bootCancelled())
|
|
450
472
|
if (ok && bootHash.focus) {
|
|
451
473
|
// a frame deep link forces focus for that visit, over every other rule
|
|
452
474
|
// (01-sharing §6.1 step 3) - the stage mounts any manifest frame, so no
|
|
@@ -463,6 +485,9 @@ export function App() {
|
|
|
463
485
|
else if (mode === 'focus') enterFocus()
|
|
464
486
|
else if (mode === 'slides') enterSlides()
|
|
465
487
|
}
|
|
488
|
+
// a show that came during the boot applies once it settled - loaded or failed, its mode (focus, play, slides)
|
|
489
|
+
// entered first, so nothing of the boot lands after it (spec 31 D3)
|
|
490
|
+
bootSettled(ok)
|
|
466
491
|
}
|
|
467
492
|
void start()
|
|
468
493
|
}, [])
|
|
@@ -629,10 +654,15 @@ export function App() {
|
|
|
629
654
|
}
|
|
630
655
|
}, [])
|
|
631
656
|
|
|
657
|
+
// every input of the person's: a show or app link still loading gives way to it (spec 31 D3, goto.ts watchHands)
|
|
658
|
+
useEffect(() => watchHands(), [])
|
|
659
|
+
|
|
632
660
|
// live updates from the dev server (source-served shell has import.meta.hot)
|
|
633
661
|
useEffect(() => {
|
|
634
662
|
if (!import.meta.hot) return
|
|
635
663
|
import.meta.hot.on('sh:manifest', (m: any) => applyManifest(m))
|
|
664
|
+
// `marver show` (spec 31 D3): the place an agent shows the human - moved to, or a notice over unsent words
|
|
665
|
+
import.meta.hot.on('sh:show', (m: any) => { void showTarget(m, 'server') })
|
|
636
666
|
// a brief's title or description changed with the frames intact: relabel, never re-key
|
|
637
667
|
import.meta.hot.on('sh:scenes', (m: any) => useStore.getState().setScenes(m?.scenes))
|
|
638
668
|
// Live Jam presence: the daemon broadcasts the set of frames Marver is editing.
|
|
@@ -695,7 +725,8 @@ export function App() {
|
|
|
695
725
|
perfSeams.frameMessage.emit(nodeKey, data)
|
|
696
726
|
// Jam (spec 27): a capture's trail, handshake, probes and flushes; a key the shell owns
|
|
697
727
|
if (onFrameMessage(nodeKey, data)) return
|
|
698
|
-
|
|
728
|
+
// a key the frame forwards: the person's, so a show or link still loading gives way (spec 31 D3)
|
|
729
|
+
if (data.type === 'sh:key') { if (typeof data.key === 'string') { navigatedByHand(); jamKey({ key: data.key, shift: !!data.shift, alt: !!data.alt, meta: !!data.meta, ctrl: !!data.ctrl }, 'frame') } return }
|
|
699
730
|
|
|
700
731
|
if (data.type === 'sh:ready') {
|
|
701
732
|
// a WindowProxy survives navigation, so a ready queued by a SUPERSEDED document (one the
|
|
@@ -819,7 +850,9 @@ export function App() {
|
|
|
819
850
|
const how = (k = e.key): CmdOpts => ({ via: 'key', in: 'shell', keys: keysOf(e, k) })
|
|
820
851
|
if ((e.metaKey || e.ctrlKey) && e.key === '\\') { e.preventDefault(); cmd('panel', how()); togglePanel(); return }
|
|
821
852
|
if ((e.metaKey || e.ctrlKey) && e.key === '/') { e.preventDefault(); cmd('toolbar', how()); setPillOpen((o) => !o); return }
|
|
822
|
-
|
|
853
|
+
// ⌘A in a comment card selects its words, not every frame (spec 31 C.1)
|
|
854
|
+
if ((e.metaKey || e.ctrlKey) && e.key === 'a' && cardSelectAll()) { e.preventDefault(); cmd('thread-select-all', how()); return }
|
|
855
|
+
if ((e.metaKey || e.ctrlKey) && e.key === 'a') { e.preventDefault(); cmd('select-all', how()); navigatedByHand(); s.selectAll(); return }
|
|
823
856
|
if (e.metaKey || e.ctrlKey) return
|
|
824
857
|
if (e.key === 'Escape') {
|
|
825
858
|
const c = commentsStore()
|
|
@@ -827,7 +860,7 @@ export function App() {
|
|
|
827
860
|
if (c.commentMode || c.active || c.draft) { h.step('comments-off'); c.setMode(false); c.setActive(null); c.setDraft(null) }
|
|
828
861
|
else if (s.laser) { h.step('laser-off'); s.setLaser(false) } // Escape also exits laser mode (parity with comment)
|
|
829
862
|
else if (s.interact) { h.step('interact-off'); setInteract(null) }
|
|
830
|
-
else { h.step('deselect'); select(null) }
|
|
863
|
+
else { h.step('deselect'); navigatedByHand(); select(null) }
|
|
831
864
|
endAfterFrames(h)
|
|
832
865
|
}
|
|
833
866
|
// a slides board PLAYS as slides even when its landing is the canvas -
|
|
@@ -869,7 +902,8 @@ export function App() {
|
|
|
869
902
|
const from = s.selection.length ? s.nodes.find((n) => n.key === s.selection[s.selection.length - 1])?.frame ?? null : null
|
|
870
903
|
const id = nextToLook(s.marks, asksNow(), [...new Set(live.map((n) => n.frame))], from)
|
|
871
904
|
const n = id ? live.find((x) => x.frame === id) : null
|
|
872
|
-
|
|
905
|
+
// a person's navigation: a show still waiting or loading gives way (spec 31 D3)
|
|
906
|
+
if (n) { navigated(); s.select(n.key); canvasCtl.fitNode(n.key) } else { h.noop('nothing-new'); toast('nothing new on this board') }
|
|
873
907
|
return
|
|
874
908
|
}
|
|
875
909
|
if (e.key === 'n' && !e.shiftKey) { cmd('notes', how()); const visible = document.querySelectorAll('.sh-notes:not(.off)').length > 0; useNotes.getState().toggleAll(visible); toast(visible ? 'notes hidden' : 'notes shown'); return }
|
|
@@ -911,9 +945,10 @@ export function App() {
|
|
|
911
945
|
s.setTheme(CONFIG.themes[(CONFIG.themes.indexOf(s.viewTheme) + 1) % CONFIG.themes.length])
|
|
912
946
|
}
|
|
913
947
|
}
|
|
914
|
-
|
|
915
|
-
if (e.shiftKey && e.code === '
|
|
916
|
-
if (e.shiftKey && e.code === '
|
|
948
|
+
// a person's camera (spec 31 D3): a show or link still loading gives way
|
|
949
|
+
if (e.shiftKey && e.code === 'Digit0') { cmd('zoom-100', how('0')); navigatedByHand(); canvasCtl.zoom100() }
|
|
950
|
+
if (e.shiftKey && e.code === 'Digit1') { cmd('fit-all', how('1')); navigatedByHand(); canvasCtl.fitAll() }
|
|
951
|
+
if (e.shiftKey && e.code === 'Digit2') { const h = cmd('fit-selection', how('2')); navigatedByHand(); if (s.selection.length) canvasCtl.fitNodes(s.selection); else h.noop('no-selection') }
|
|
917
952
|
// plain digits: 0 = default, 1..n = devices. Scoped to the selection when one
|
|
918
953
|
// exists, board-wide otherwise. Every path tidies - presets never scramble layout.
|
|
919
954
|
if (!e.shiftKey && /^Digit[0-9]$/.test(e.code)) {
|
|
@@ -1026,11 +1061,14 @@ export function App() {
|
|
|
1026
1061
|
? `board: ${useStore.getState().board} · scene: ${sc.name} (design/scenes/${sc.name}/)`
|
|
1027
1062
|
: `board: ${useStore.getState().board} · scene: (root)`, 'path copied', cmd('copy-path', { via: 'context', in: 'shell' })),
|
|
1028
1063
|
}, ...(!PUBLISHED && sc.name ? [{ label: 'Rename', icon: <PencilSimpleIcon size={15} />, onClick: () => setSceneNaming(sc.name) }] : []),
|
|
1029
|
-
...(!PUBLISHED ? [{ label: 'Mark all as seen', icon: <CheckIcon size={15} />, onClick: () => markSeenFrom({ via: 'context', in: 'shell' }, frames.filter((f) => f.scene === sc.name).map((f) => f.id)) }] : [])
|
|
1064
|
+
...(!PUBLISHED ? [{ label: 'Mark all as seen', icon: <CheckIcon size={15} />, onClick: () => markSeenFrom({ via: 'context', in: 'shell' }, frames.filter((f) => f.scene === sc.name).map((f) => f.id)) }] : []),
|
|
1065
|
+
// ...and Resolve all comments on that scene's frames (spec 31 B.1) - the root scene's ('') too
|
|
1066
|
+
...(!PUBLISHED ? [{ label: 'Resolve all comments', icon: <CheckSquareOffsetIcon size={15} />, onClick: () => void resolveAllFrom({ via: 'context', in: 'shell' }, { scene: sc.name }) }] : [])])}
|
|
1030
1067
|
onPick={() => {
|
|
1031
1068
|
const keys = nodes.filter((n) => frames.some((f) => f.scene === sc.name && f.id === n.frame) && !n.missing).map((n) => n.key)
|
|
1032
1069
|
cmd('scene-pick', { via: 'click', in: 'shell', frames: keys.length })
|
|
1033
1070
|
if (!keys.length) return
|
|
1071
|
+
navigated() // a person's navigation: a show still waiting or loading gives way (spec 31 D3)
|
|
1034
1072
|
useStore.getState().selectMany(keys)
|
|
1035
1073
|
canvasCtl.fitNodes(keys)
|
|
1036
1074
|
}}>
|
|
@@ -1058,6 +1096,7 @@ export function App() {
|
|
|
1058
1096
|
const n = nodeFor(id)
|
|
1059
1097
|
if (!n) return
|
|
1060
1098
|
cmd('frame-pick', { via: 'click', in: 'shell', frame: id })
|
|
1099
|
+
navigated() // a person's navigation: a show still waiting or loading gives way (spec 31 D3)
|
|
1061
1100
|
select(n.key, shift)
|
|
1062
1101
|
if (!shift) canvasCtl.fitNode(n.key)
|
|
1063
1102
|
}
|
|
@@ -1087,7 +1126,7 @@ export function App() {
|
|
|
1087
1126
|
rows.push(
|
|
1088
1127
|
<div key={`g:${f.variantGroup}`} className={`sub vgroup${allOn ? ' on' : ''}${held ? ' held' : ''}`}
|
|
1089
1128
|
title="Select all variants"
|
|
1090
|
-
onClick={() => { cmd('group-fit', { via: 'click', in: 'shell', frames: memberKeys.length }); useStore.getState().selectMany(memberKeys); canvasCtl.fitNodes(memberKeys) }}>
|
|
1129
|
+
onClick={() => { cmd('group-fit', { via: 'click', in: 'shell', frames: memberKeys.length }); navigated(); useStore.getState().selectMany(memberKeys); canvasCtl.fitNodes(memberKeys) }}>
|
|
1091
1130
|
<VariantsIcon size={13} className="iicon" />
|
|
1092
1131
|
<span className="glabel">{rel}</span>
|
|
1093
1132
|
</div>,
|
|
@@ -1176,6 +1215,7 @@ export function App() {
|
|
|
1176
1215
|
: CONFIG.noTheme && !contentOnly(manifest?.frames ?? []) && <div className="sh-banner">no theme configured - frames render unstyled. Create design/theme.css importing your app's stylesheet (or set theme in design/config.ts)</div>}
|
|
1177
1216
|
{stopped && <StoppedBanner />}
|
|
1178
1217
|
<UpdatePill />
|
|
1218
|
+
<ShowNotice />
|
|
1179
1219
|
|
|
1180
1220
|
{/* Jam V2 (spec 27): the lane, the focus panel, the notes card, the recording ring */}
|
|
1181
1221
|
{!PUBLISHED && <JamSurface sidebarRight={panelOpen ? 236 + 2 * 10 : 10} />}
|
|
@@ -1316,7 +1356,13 @@ function JamToasts({ toasts }: { toasts: import('./store.ts').Toast[] }) {
|
|
|
1316
1356
|
const newest = jams[jams.length - 1]
|
|
1317
1357
|
return (
|
|
1318
1358
|
<div className="sh-toasts">
|
|
1319
|
-
|
|
1359
|
+
<PdfNotice />
|
|
1360
|
+
{/* the last two - and a notice with an action (Undo) stays among them while it lasts */}
|
|
1361
|
+
{(() => { const act = plain.filter((t) => t.action).slice(-1); return [...plain.filter((t) => !t.action).slice(act.length ? -1 : -2), ...act].sort((a, b) => a.id - b.id) })().map((t) => (
|
|
1362
|
+
<div key={t.id} className="sh-toast" data-toast={t.action?.id}><CheckIcon size={12} /> {t.text}
|
|
1363
|
+
{t.action && <button className="sh-toast-act" onClick={() => { const a = t.action!; useStore.getState().dropToast(t.id); a.run() }}>{t.action.label}</button>}
|
|
1364
|
+
</div>
|
|
1365
|
+
))}
|
|
1320
1366
|
{expanded && jams.length > 2 && (
|
|
1321
1367
|
<div className="sh-jam-list">
|
|
1322
1368
|
<div className="sh-jam-listhead">
|
|
@@ -1354,6 +1400,7 @@ function JamAvatar({ author }: { author: { name?: string; avatar?: string; id?:
|
|
|
1354
1400
|
* note's origin board and retry while its comments load. Dismiss only on success: a
|
|
1355
1401
|
* cross-board note must never be a destructive no-op. */
|
|
1356
1402
|
async function viewNote(note: import('./store.ts').JamNote, dismiss: () => void, h: CmdHandle) {
|
|
1403
|
+
navigatedByHand() // the person chose View (spec 31 D3): a show or link still loading gives way
|
|
1357
1404
|
if (revealThread(note.threadId)) { h.done(); dismiss(); return }
|
|
1358
1405
|
const s = useStore.getState()
|
|
1359
1406
|
// a navigation: a link still finding its board gives way to it - and it to a newer one, wherever this one has got to
|
|
@@ -9,11 +9,12 @@ import { PHASE_LABEL, STATUS_LABEL } from '../../shared/status.ts'
|
|
|
9
9
|
import { canvasCtl } from './canvas/Canvas.tsx'
|
|
10
10
|
import { isLatest, navigated, switchFor } from './goto.ts'
|
|
11
11
|
import { rollup } from '../../shared/marks.ts'
|
|
12
|
-
import { Bubble, markSeenFrom, useAsks } from './marks-ui.tsx'
|
|
12
|
+
import { Bubble, markSeenFrom, resolveAllFrom, useAsks, type ResolveScope } from './marks-ui.tsx'
|
|
13
|
+
import { exportPdf } from './pdf-export.tsx'
|
|
13
14
|
import { Tip } from './Tip.tsx'
|
|
14
15
|
import { copyToClipboard, type MenuItem, type MenuOpener } from './ContextMenu.tsx'
|
|
15
16
|
import { cmd, keysOf, withCmd, withCmds, type CmdHandle, type CmdOpts } from './commands.ts'
|
|
16
|
-
import { ArrowLineUpIcon, CardsIcon, CheckIcon, FolderIcon, FrameCornersIcon, FolderMinusIcon, FolderOpenIcon, FolderPlusIcon, PencilSimpleIcon, SignpostIcon } from './icons.tsx'
|
|
17
|
+
import { ArrowLineUpIcon, CardsIcon, CheckIcon, CheckSquareOffsetIcon, FolderIcon, FrameCornersIcon, FolderMinusIcon, FolderOpenIcon, FolderPlusIcon, PencilSimpleIcon, SignpostIcon, ExportIcon } from './icons.tsx'
|
|
17
18
|
import {
|
|
18
19
|
applyDrop, boardsIn, createFolder, deleteFolder, depthOf, folderEntries, folderIn, folderOf, foldersIn, holdsFolders, humanize, INDENT, isOwnSlot, labelOf, listIn, moveBoard, moveFolderToRoot, newFolderSlot, parentOf, readTitle,
|
|
19
20
|
resolveDrop, retitleFolder, rootIndex, slugFor,
|
|
@@ -80,7 +81,11 @@ export function BoardList({ onMenu }: { onMenu: MenuOpener }) {
|
|
|
80
81
|
const marks = useStore((s) => s.marks)
|
|
81
82
|
const asks = useAsks()
|
|
82
83
|
const framesOf = (boards: string[]) => boards.flatMap((b) => marks?.boards[b] ?? [])
|
|
83
|
-
|
|
84
|
+
// Mark all as seen, and beside it Resolve all comments (spec 31 B.1) - for what the row stands for: a board, a folder
|
|
85
|
+
const seeAll = (boards: string[], scope: ResolveScope): MenuItem[] => (!PUBLISHED ? [
|
|
86
|
+
{ label: 'Mark all as seen', icon: <CheckIcon size={15} />, onClick: () => markSeenFrom({ via: 'context', in: 'shell' }, framesOf(boards)) },
|
|
87
|
+
{ label: 'Resolve all comments', icon: <CheckSquareOffsetIcon size={15} />, onClick: () => void resolveAllFrom({ via: 'context', in: 'shell', ...('board' in scope ? { board: scope.board } : {}) }, scope) },
|
|
88
|
+
] : []) // board slug → type and status (spec 20)
|
|
84
89
|
const label = (n: string) => labelOf(n, titles[n]) // a board's label; a folder's is labelOf(name, item.title)
|
|
85
90
|
const [tree, setTree] = useState<TreeItem[]>([])
|
|
86
91
|
const [read, setRead] = useState(false) // the first tree read has answered
|
|
@@ -420,7 +425,7 @@ export function BoardList({ onMenu }: { onMenu: MenuOpener }) {
|
|
|
420
425
|
} catch (e) { h.fail('api'); throw e }
|
|
421
426
|
}
|
|
422
427
|
const boardMenu = (n: string, parent: string | null): MenuItem[] => {
|
|
423
|
-
const items: MenuItem[] = [{ label: 'Copy path', icon: <SignpostIcon size={15} />, onClick: () => copyToClipboard(`board: ${n}`, 'path copied', cmd('copy-path', { via: 'context', in: 'shell', board: n })) }, ...seeAll([n])]
|
|
428
|
+
const items: MenuItem[] = [{ label: 'Copy path', icon: <SignpostIcon size={15} />, onClick: () => copyToClipboard(`board: ${n}`, 'path copied', cmd('copy-path', { via: 'context', in: 'shell', board: n })) }, ...seeAll([n], { board: n })]
|
|
424
429
|
if (PUBLISHED) return items
|
|
425
430
|
// a feature or project board: its status first, as Linear puts it - the picker opens in place
|
|
426
431
|
const m = useStore.getState().boardMeta[n]
|
|
@@ -429,6 +434,8 @@ export function BoardList({ onMenu }: { onMenu: MenuOpener }) {
|
|
|
429
434
|
panel: (close) => <StatusPicker board={n} meta={m} close={close} onPick={setStatus} />,
|
|
430
435
|
})
|
|
431
436
|
items.push({ label: 'Rename', icon: <PencilSimpleIcon size={15} />, onClick: () => setNaming({ kind: 'board', name: n }) })
|
|
437
|
+
// spec 31: the board printed, one page per slide (a present board's frames at the size Play shows them)
|
|
438
|
+
items.push({ label: 'Export PDF', icon: <ExportIcon size={15} />, onClick: () => void exportPdf(n, {}, { via: 'context', in: 'shell' }) })
|
|
432
439
|
// the new folder takes the board's own slot at its own level (a sub-folder inside a top-level
|
|
433
440
|
// folder; right after its sub-folder when it sits in one - that level holds no folders)
|
|
434
441
|
items.push({ label: 'Move to new folder', icon: <FolderPlusIcon size={15} />, onClick: () => { const at = newFolderSlot(treeRef.current, n); newFolderAt(at.index, n, at.parent) } })
|
|
@@ -443,7 +450,7 @@ export function BoardList({ onMenu }: { onMenu: MenuOpener }) {
|
|
|
443
450
|
const folderMenu = (f: string, boards: string[], parent: string | null): MenuItem[] => {
|
|
444
451
|
const items: MenuItem[] = [{ label: 'Copy path', icon: <SignpostIcon size={15} />, onClick: () => copyToClipboard(`folder: ${f}${parent ? ` (in ${parent})` : ''} (boards: ${boards.join(', ') || 'none'})`, 'path copied', cmd('copy-path', { via: 'context', in: 'shell' })) }]
|
|
445
452
|
if (PUBLISHED) return items
|
|
446
|
-
items.push({ label: 'Rename', icon: <PencilSimpleIcon size={15} />, onClick: () => setNaming({ kind: 'folder', name: f }) }, ...seeAll(boards))
|
|
453
|
+
items.push({ label: 'Rename', icon: <PencilSimpleIcon size={15} />, onClick: () => setNaming({ kind: 'folder', name: f }) }, ...seeAll(boards, { folder: f }))
|
|
447
454
|
// two levels: a top-level folder can hold folders; a sub-folder can leave its parent
|
|
448
455
|
if (!parent) items.push({ label: 'New folder inside', icon: <FolderPlusIcon size={15} />, onClick: () => newFolderAt(listIn(treeRef.current, f)?.length ?? 0, undefined, f) })
|
|
449
456
|
else items.push({ label: 'Move to top level', icon: <ArrowLineUpIcon size={15} />, onClick: () => mutate((t) => {
|
|
@@ -618,8 +625,10 @@ export function BoardList({ onMenu }: { onMenu: MenuOpener }) {
|
|
|
618
625
|
<span>{labelOf(f, it.title)}</span>
|
|
619
626
|
{(() => {
|
|
620
627
|
// a closed folder's one slot rolls up what it hides: a question first, else a blue count
|
|
621
|
-
|
|
622
|
-
|
|
628
|
+
// spec 31 B.7: closed, its number is its asks only - new is a blue dot, never a count; open, its board count
|
|
629
|
+
if (open) return <small>{boards.length}</small>
|
|
630
|
+
const r = rollup(marks, asks, framesOf(boards))
|
|
631
|
+
return r.asks ? <Bubble n={r.asks} /> : r.fresh ? <i className="mk-slot"><i className="mk-dot" data-mark="new" aria-label="new inside" /></i> : null
|
|
623
632
|
})()}
|
|
624
633
|
</button>,
|
|
625
634
|
)
|
|
@@ -6,14 +6,15 @@
|
|
|
6
6
|
* overlap (pin-layout.ts places them).
|
|
7
7
|
*/
|
|
8
8
|
import { TOP } from './inset.ts'
|
|
9
|
-
import { useEffect, useMemo, useRef, useState } from 'react'
|
|
9
|
+
import { useEffect, useMemo, useRef, useState, type ReactNode } from 'react'
|
|
10
10
|
import { createPortal } from 'react-dom'
|
|
11
11
|
import { avatarFallback, useComments } from './comments-store.ts'
|
|
12
12
|
import { api } from './api.ts'
|
|
13
13
|
import { CONFIG, useStore, type Node } from './store.ts'
|
|
14
14
|
import { threadHostKey } from './keys.ts'
|
|
15
15
|
import { isNoteAnchor, resolveNoteAnchor, useNotes } from './notes.ts'
|
|
16
|
-
import { canvasCtl } from './canvas/ctl.ts'
|
|
16
|
+
import { bootCancelled, canvasCtl } from './canvas/ctl.ts'
|
|
17
|
+
import { navigatedByHand } from './goto.ts'
|
|
17
18
|
import { MARKER, placeMarkers, type Placed } from './pin-layout.ts'
|
|
18
19
|
import { bootHash, buildHash, parseHash, writeHash } from './hash.ts'
|
|
19
20
|
import { isLegacyLink } from './legacy-links.ts'
|
|
@@ -304,7 +305,7 @@ export function CommentLayer({ node, frameId, iframe }: { node: Node; frameId: s
|
|
|
304
305
|
if (!engaged && open.length) {
|
|
305
306
|
return (
|
|
306
307
|
<button className={`cm-stack sh-no-pan${open.some((t) => alertIds.has(t.id)) ? ' mention' : ''}`}
|
|
307
|
-
onClick={(e) => { e.stopPropagation(); cmd('thread-open', { via: 'click', in: 'shell', frame: frameId }); useStore.getState().select(node.key); const hit = open.find((t) => alertIds.has(t.id)) ?? open[0]; if (hit) setActive(hit.id) }}>
|
|
308
|
+
onClick={(e) => { e.stopPropagation(); cmd('thread-open', { via: 'click', in: 'shell', frame: frameId }); navigatedByHand(); useStore.getState().select(node.key); const hit = open.find((t) => alertIds.has(t.id)) ?? open[0]; if (hit) setActive(hit.id) }}>
|
|
308
309
|
<MarkerFace threads={open} />
|
|
309
310
|
</button>
|
|
310
311
|
)
|
|
@@ -461,7 +462,7 @@ function AgentMetaTip({ meta }: { meta?: AgentMeta }) {
|
|
|
461
462
|
* human messages keep their avatar + name. While the dev profile is still UNSET, every own
|
|
462
463
|
* message avatar invites editing on hover (discoverability); once set, only the composer's
|
|
463
464
|
* avatar is the door. */
|
|
464
|
-
function MessageHead({ author, agent, agentMeta, ts, board, eventId }: { author?: Thread['author']; agent?: boolean; agentMeta?: AgentMeta; ts: number; board?: string; eventId?: string }) {
|
|
465
|
+
function MessageHead({ author, agent, agentMeta, ts, board, eventId, edited, tools }: { author?: Thread['author']; agent?: boolean; agentMeta?: AgentMeta; ts: number; board?: string; eventId?: string; edited?: number; tools?: ReactNode }) {
|
|
465
466
|
const me = useComments((s) => s.me)
|
|
466
467
|
const local = useComments((s) => s.local)
|
|
467
468
|
const connected = useComments((s) => s.connected)
|
|
@@ -484,7 +485,9 @@ function MessageHead({ author, agent, agentMeta, ts, board, eventId }: { author?
|
|
|
484
485
|
{unset && own ? <EditableAvatar author={author} size={24} /> : <Avatar author={author} size={24} />}
|
|
485
486
|
<b>{shown?.name ?? 'Someone'}</b>
|
|
486
487
|
<span className="dim">{rel(ts)}</span>
|
|
488
|
+
{edited ? <span className="dim cm-edited" title={new Date(edited).toLocaleString()}>edited</span> : null}
|
|
487
489
|
<TagStatus board={board} eventId={eventId} harness={HARNESS} />
|
|
490
|
+
{tools}
|
|
488
491
|
</header>
|
|
489
492
|
)
|
|
490
493
|
}
|
|
@@ -496,7 +499,7 @@ function CommentInput({ value, onChange, onSubmit, onCancel, placeholder, autoFo
|
|
|
496
499
|
/** ends `h` (spec 30): a person typing has got a draft, so the command starts here, at ⏎ or send */
|
|
497
500
|
onSubmit: (h: CmdHandle) => void | Promise<unknown>
|
|
498
501
|
onCancel: () => void; placeholder: string; autoFocus?: boolean; sendLabel: string; owner: boolean
|
|
499
|
-
sendCmd: 'comment-send' | 'comment-reply'; frame?: string
|
|
502
|
+
sendCmd: 'comment-send' | 'comment-reply' | 'comment-edit-save'; frame?: string
|
|
500
503
|
}) {
|
|
501
504
|
const ref = useRef<HTMLTextAreaElement>(null)
|
|
502
505
|
const hlRef = useRef<HTMLDivElement>(null)
|
|
@@ -685,6 +688,40 @@ export function ThreadCard({ thread, at, bounds, nodeKey, side = 'r', flank, sta
|
|
|
685
688
|
const [text, setText] = useState('')
|
|
686
689
|
const [copied, setCopied] = useState(false)
|
|
687
690
|
const copyTimer = useRef<ReturnType<typeof setTimeout>>(undefined)
|
|
691
|
+
// your own messages (spec 31 C.3-C.4): the one being edited, with its words; the one asking "delete?"
|
|
692
|
+
const [editing, setEditing] = useState<{ id: string; text: string } | null>(null)
|
|
693
|
+
const [asking, setAsking] = useState<string | null>(null)
|
|
694
|
+
useComments((s) => s.ownership) // a read of who owns what redraws the tools
|
|
695
|
+
const canDelete = useComments((s) => s.local || s.caps.delete) // an older published server takes no delete
|
|
696
|
+
const mine = (m: { id: string; author?: { id?: string }; agent?: boolean }) => canComment && useComments.getState().isMine(thread.board, m)
|
|
697
|
+
const how = (): CmdOpts => ({ via: 'click', in: 'shell', frame: thread.frame })
|
|
698
|
+
const tools = (m: { id: string; author?: { id?: string }; agent?: boolean; body?: string }) => !mine(m) || editing?.id === m.id ? null : (
|
|
699
|
+
<span className="cm-tools">
|
|
700
|
+
{!(m.id === thread.id && thread.capture) && <button className="cm-tool" data-edit={m.id} onClick={() => { cmd('comment-edit', how()); setAsking(null); setEditing({ id: m.id, text: m.body ?? '' }) }}>Edit</button>}
|
|
701
|
+
{canDelete && <button className="cm-tool" data-delete={m.id} onClick={() => { cmd('comment-delete-ask', how()); setEditing(null); setAsking(m.id) }}>Delete</button>}
|
|
702
|
+
</span>
|
|
703
|
+
)
|
|
704
|
+
/** A message's words: as they are, in their editor, or under the "delete?" question. */
|
|
705
|
+
const words = (m: { id: string; body?: string; author?: Thread['author'] }, root: boolean, shown: ReactNode) => {
|
|
706
|
+
if (editing?.id === m.id) return (
|
|
707
|
+
<div className="cm-editing">
|
|
708
|
+
<CommentInput value={editing.text} onChange={(v) => setEditing({ id: m.id, text: v })} placeholder="Edit your comment…" autoFocus sendLabel="Save" owner={local} sendCmd="comment-edit-save" frame={thread.frame}
|
|
709
|
+
onSubmit={async (h) => { const sent = editing.text; if (sent.trim() === (m.body ?? '').trim()) { h.done(); setEditing(null); return } if (await useComments.getState().edit(thread.id, m.id, sent, h)) setEditing((cur) => (cur?.id === m.id ? null : cur)) }}
|
|
710
|
+
onCancel={() => setEditing(null)} />
|
|
711
|
+
</div>
|
|
712
|
+
)
|
|
713
|
+
if (asking !== m.id) return shown
|
|
714
|
+
return (
|
|
715
|
+
<>
|
|
716
|
+
{shown}
|
|
717
|
+
<div className="cm-confirm" data-confirm-delete={m.id}>
|
|
718
|
+
<span>Delete this {root ? 'comment' : 'reply'}?{root && thread.replies.length ? ' Its replies stay.' : ''}</span>
|
|
719
|
+
<button className="cm-tool danger" onClick={() => { const h = cmd('comment-delete', how()); setAsking(null); void useComments.getState().remove(thread.id, m.id, h) }}>Delete</button>
|
|
720
|
+
<button className="cm-tool" onClick={() => { cmd('comment-delete-cancel', how()); setAsking(null) }}>Cancel</button>
|
|
721
|
+
</div>
|
|
722
|
+
</>
|
|
723
|
+
)
|
|
724
|
+
}
|
|
688
725
|
useEffect(() => () => clearTimeout(copyTimer.current), [])
|
|
689
726
|
// Canvas: the card is a WORLD OBJECT parked beside its frame - it stays put (panning moves
|
|
690
727
|
// frame + card together, never following the viewport). Zoom scales it with a CLAMP
|
|
@@ -820,16 +857,23 @@ export function ThreadCard({ thread, at, bounds, nodeKey, side = 'r', flank, sta
|
|
|
820
857
|
{/* "there is more": the scroller MASKS its own content at the overflowing edge - a soft fade
|
|
821
858
|
of the text itself, not a paint layer over the glass */}
|
|
822
859
|
<div className={`cm-scroll${shadows.top ? ' fade-top' : ''}${shadows.bot ? ' fade-bot' : ''}`} ref={scrollRef} onScroll={syncShadows}>
|
|
823
|
-
|
|
824
|
-
{
|
|
825
|
-
|
|
826
|
-
|
|
827
|
-
|
|
860
|
+
{/* a deleted first comment keeps its replies under a placeholder: nothing of what was said, nor who said it */}
|
|
861
|
+
{thread.deleted
|
|
862
|
+
? <p className="cm-body cm-deleted" data-deleted>Comment deleted</p>
|
|
863
|
+
: <>
|
|
864
|
+
<MessageHead author={thread.author} agent={thread.agent} agentMeta={thread.agentMeta} ts={thread.ts} board={thread.board} eventId={eventOf(thread.id)}
|
|
865
|
+
edited={thread.edited} tools={tools(thread)} />
|
|
866
|
+
{/* a capture's comment reads as a capture: a labelled block, never a typed comment (spec 27) - yours to edit or
|
|
867
|
+
delete like any message (deleting it withdraws a capture not sent yet) */}
|
|
868
|
+
{words(thread, true, thread.capture
|
|
869
|
+
? <CaptureBlock id={thread.capture} facts={thread.facts} words={thread.body ?? ''} />
|
|
870
|
+
: <CommentBody body={thread.body} owner={isOwner(thread.author)} />)}
|
|
871
|
+
</>}
|
|
828
872
|
{/* replies repeat the root's exact message shape (Figma's pattern) - only the icons differ */}
|
|
829
873
|
{thread.replies.map((r) => (
|
|
830
|
-
<div key={r.id} className="cm-msg">
|
|
831
|
-
<MessageHead author={r.author} agent={r.agent} agentMeta={r.agentMeta} ts={r.ts} board={thread.board} eventId={eventOf(r.id)} />
|
|
832
|
-
<CommentBody body={r.body} owner={isOwner(r.author)} />
|
|
874
|
+
<div key={r.id} className="cm-msg" data-msg={r.id}>
|
|
875
|
+
<MessageHead author={r.author} agent={r.agent} agentMeta={r.agentMeta} ts={r.ts} board={thread.board} eventId={eventOf(r.id)} edited={r.edited} tools={tools(r)} />
|
|
876
|
+
{words(r, false, <CommentBody body={r.body} owner={isOwner(r.author)} />)}
|
|
833
877
|
{/* a jam job changed a shared file it was not given: one line, so the reply says it (spec 27) */}
|
|
834
878
|
{r.agent && r.alsoChanged?.length ? <div className="cm-also">Also changed {r.alsoChanged.map((f) => f.split('/').pop()).join(', ')}</div> : null}
|
|
835
879
|
</div>
|
|
@@ -1041,7 +1085,8 @@ export function CommentsController() {
|
|
|
1041
1085
|
if (!active) return
|
|
1042
1086
|
const onDown = (e: PointerEvent) => {
|
|
1043
1087
|
const t = e.target instanceof Element ? e.target : null
|
|
1044
|
-
|
|
1088
|
+
// the show notice (spec 31 D3) too: it is up because words wait unsent here - its Go and × never close them
|
|
1089
|
+
if (t?.closest('.cm-card, .cm-pin, .cm-stack, .cm-modal, .sh-show-notice')) return
|
|
1045
1090
|
if (useComments.getState().active) cmd('thread-close', { via: 'click', in: 'shell' }) // silent when none is open
|
|
1046
1091
|
useComments.getState().setActive(null)
|
|
1047
1092
|
}
|
|
@@ -1064,8 +1109,9 @@ export function CommentsController() {
|
|
|
1064
1109
|
// Consumed only on a successful find: the controller's first effect fires with
|
|
1065
1110
|
// the pre-boot board (child effects run before the parent's boot effect), and
|
|
1066
1111
|
// burning the flag on that empty pass would eat the link.
|
|
1067
|
-
|
|
1068
|
-
if (
|
|
1112
|
+
// ...unless a show applied meanwhile (spec 31 D3): the camera is the show's, the boot link's thread gives way
|
|
1113
|
+
if (bootThreadConsumed || !bootHash.c || bootCancelled()) return
|
|
1114
|
+
if (revealThread(bootHash.c, () => !bootCancelled())) bootThreadConsumed = true
|
|
1069
1115
|
})
|
|
1070
1116
|
return live(board)
|
|
1071
1117
|
}, [board])
|
|
@@ -1102,3 +1148,18 @@ export function CommentsController() {
|
|
|
1102
1148
|
|
|
1103
1149
|
return <IdentityDialog />
|
|
1104
1150
|
}
|
|
1151
|
+
|
|
1152
|
+
/** ⌘A inside a comment card (spec 31 C.1): its messages' text, never every frame - when the selection or the focus is
|
|
1153
|
+
* in a card (not in its composer, which keeps the field's own ⌘A). True when it took the key. */
|
|
1154
|
+
export function cardSelectAll(): boolean {
|
|
1155
|
+
const sel = window.getSelection()
|
|
1156
|
+
const at = (n: globalThis.Node | null | undefined) => (n instanceof Element ? n : n?.parentElement)?.closest('.cm-card') ?? null
|
|
1157
|
+
const card = at(document.activeElement !== document.body ? document.activeElement : null) ?? at(sel?.anchorNode)
|
|
1158
|
+
const text = card?.querySelector('.cm-scroll')
|
|
1159
|
+
if (!card || !text || !sel) return false
|
|
1160
|
+
const range = document.createRange()
|
|
1161
|
+
range.selectNodeContents(text)
|
|
1162
|
+
sel.removeAllRanges()
|
|
1163
|
+
sel.addRange(range)
|
|
1164
|
+
return true
|
|
1165
|
+
}
|