@marver-design/marver 0.23.1 → 0.24.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 +23 -0
- package/README.md +2 -0
- package/dist/{bake-DQtnDB8-.mjs → bake-ZhXq-X9f.mjs} +1 -1
- package/dist/{build-_ndp_dXn.mjs → build-ckcinlWH.mjs} +4 -4
- package/dist/cli.mjs +7 -7
- package/dist/{comments-BlqyZh3D.mjs → comments-Dx1hCVOT.mjs} +1 -1
- package/dist/{context-CdkNiKdJ.mjs → context-BncTXjLB.mjs} +1 -1
- package/dist/{daemon-BvMPdQ3k.mjs → daemon-CQv73-jM.mjs} +1 -1
- package/dist/{dev-Cf-4eqaC.mjs → dev-gv4NS6Fk.mjs} +5 -5
- package/dist/{init-hfZV7TwY.mjs → init--3Moc4J7.mjs} +1 -1
- package/dist/{link-BodAbIQz.mjs → link-vXjxMHTG.mjs} +1 -1
- package/dist/{manifest-TpfDWldB.mjs → manifest-cyG3kbhk.mjs} +1 -1
- package/dist/{plugin-DoXql0ZZ.mjs → plugin-Sa08E7wO.mjs} +182 -12
- package/dist/{poster-XBmUvQiL.mjs → poster-B2QPvKOq.mjs} +1 -1
- package/dist/{publish-bakes-KKTHWqq3.mjs → publish-bakes-BJR3huhu.mjs} +2 -2
- package/dist/{shot-DOD8v6fJ.mjs → shot-Cw96h5Kk.mjs} +2 -2
- package/dist/{work-ClFFq0Qh.mjs → work-CBUfsOOT.mjs} +1 -1
- package/docs/boards-and-folders.md +25 -0
- package/docs/live-jam.md +4 -1
- package/package.json +1 -1
- package/src/client/shell/App.tsx +35 -11
- package/src/client/shell/BoardList.tsx +22 -7
- package/src/client/shell/Play.tsx +2 -0
- package/src/client/shell/canvas/Canvas.tsx +2 -0
- package/src/client/shell/canvas/FrameNode.tsx +6 -1
- package/src/client/shell/comments-store.ts +2 -0
- package/src/client/shell/marks-ui.tsx +119 -0
- package/src/client/shell/store.ts +91 -1
- package/src/client/shell/styles.css +22 -0
- package/src/shared/marks.ts +65 -0
package/src/client/shell/App.tsx
CHANGED
|
@@ -16,6 +16,8 @@ import { avatarFallback, useComments } from './comments-store.ts'
|
|
|
16
16
|
import { goTo, navigated, revealFrame } from './goto.ts'
|
|
17
17
|
import { useNotes } from './notes.ts'
|
|
18
18
|
import { contentOnly } from '../../shared/frames.ts'
|
|
19
|
+
import { nextToLook } from '../../shared/marks.ts'
|
|
20
|
+
import { asksNow, Bubble, MarkedRow, useRollup, useSeenOnScreen } from './marks-ui.tsx'
|
|
19
21
|
import { CommentButton, DevicePicker, HideUIButton, LaserButton, Popover, ThemePicker, toggleHideUI, usePopover } from './Toolbar.tsx'
|
|
20
22
|
|
|
21
23
|
const commentsStore = () => useComments.getState()
|
|
@@ -26,8 +28,9 @@ let booted = false // survives Fast Refresh; see the
|
|
|
26
28
|
* selected frame - a quiet secondary wash so ancestry survives collapsing the group.
|
|
27
29
|
* `renaming` swaps the label for an input: the scene's TITLE (its brief's front matter) -
|
|
28
30
|
* the directory never moves from here. */
|
|
29
|
-
function SceneGroup({ name, label, count, held, renaming, onRename, onPick, onContextMenu, children }: { name: string; label: string; count: number; held: boolean; renaming?: boolean; onRename?: (title: string | null) => void; onPick?: () => void; onContextMenu?: (e: ReactMouseEvent) => void; children: ReactNode }) {
|
|
31
|
+
function SceneGroup({ name, label, count, held, renaming, onRename, onPick, onContextMenu, ids, children }: { name: string; label: string; count: number; held: boolean; renaming?: boolean; onRename?: (title: string | null) => void; onPick?: () => void; onContextMenu?: (e: ReactMouseEvent) => void; ids: string[]; children: ReactNode }) {
|
|
30
32
|
const [open, setOpen] = useState(true)
|
|
33
|
+
const fold = useRollup(open ? [] : ids) // only a folded scene rolls up (spec 25)
|
|
31
34
|
const done = useRef(false) // Enter then blur: one commit
|
|
32
35
|
if (renaming) { done.current = false }
|
|
33
36
|
const finish = (v: string | null) => { if (done.current) return; done.current = true; onRename?.(v) }
|
|
@@ -45,7 +48,8 @@ function SceneGroup({ name, label, count, held, renaming, onRename, onPick, onCo
|
|
|
45
48
|
<CaretIcon size={11} className="tw" style={{ transform: open ? undefined : 'rotate(-90deg)' }} />
|
|
46
49
|
{/* the NAME selects every frame in the scene; the caret/row still collapses */}
|
|
47
50
|
<span onClick={(e) => { if (!onPick) return; e.stopPropagation(); onPick() }}>{label || '(root)'}</span>
|
|
48
|
-
|
|
51
|
+
{/* folded, its one slot rolls the frames up (spec 25): a question first, else a blue count */}
|
|
52
|
+
{fold.asks ? <Bubble n={fold.asks} /> : <small className={fold.fresh ? 'mk-fresh' : undefined}>{count}</small>}
|
|
49
53
|
</button>
|
|
50
54
|
)}
|
|
51
55
|
{open && children}
|
|
@@ -329,6 +333,7 @@ function ThemeMenu() {
|
|
|
329
333
|
export function App() {
|
|
330
334
|
// B0.1: per-field selectors, NOT `useStore()` (which subscribes to the whole store and
|
|
331
335
|
// re-rendered the entire shell on every setScale tick during a pan/zoom).
|
|
336
|
+
useSeenOnScreen()
|
|
332
337
|
const manifest = useStore((s) => s.manifest)
|
|
333
338
|
const nodes = useStore((s) => s.nodes)
|
|
334
339
|
const panelOpen = useStore((s) => s.panelOpen)
|
|
@@ -442,6 +447,7 @@ export function App() {
|
|
|
442
447
|
if (s.play) s.setPlay(null)
|
|
443
448
|
const keys = linkTargets(h, s.nodes)
|
|
444
449
|
useStore.setState({ selection: keys })
|
|
450
|
+
s.markSeen(keys.map((k) => s.nodes.find((n) => n.key === k)?.frame).filter((f): f is string => !!f)) // a link opened is a look
|
|
445
451
|
if (!keys.length && h.f?.length) void revealFrame(h.f[0]) // not on this board - where it lives
|
|
446
452
|
else setTimeout(() => (keys.length ? canvasCtl.fitNodes(keys) : canvasCtl.fitAll()), 60)
|
|
447
453
|
}
|
|
@@ -513,11 +519,16 @@ export function App() {
|
|
|
513
519
|
import.meta.hot.on('sh:scenes', (m: any) => useStore.getState().setScenes(m?.scenes))
|
|
514
520
|
// Live Jam presence: the daemon broadcasts the set of frames Marver is editing.
|
|
515
521
|
// Camera-safe by construction - this only toggles a glow class, never moves the view.
|
|
516
|
-
import.meta.hot.on('sh:jam-activity', (m: any) => useStore.getState().setWorkingFrom(m))
|
|
522
|
+
import.meta.hot.on('sh:jam-activity', (m: any) => { useStore.getState().setWorkingFrom(m); void useStore.getState().syncMarks() })
|
|
517
523
|
// then ask for what is lit now - a broadcast sent before this listener existed is gone - and again
|
|
518
524
|
// after the dev server reconnects
|
|
519
525
|
void useStore.getState().syncWorking()
|
|
520
526
|
import.meta.hot.on('vite:ws:connect', () => void useStore.getState().syncWorking())
|
|
527
|
+
// sidebar marks (spec 25): a frame changed on disk, or an agent's work started or ended
|
|
528
|
+
void useStore.getState().syncMarks()
|
|
529
|
+
import.meta.hot.on('vite:ws:connect', () => void useStore.getState().syncMarks())
|
|
530
|
+
import.meta.hot.on('sh:marks', () => void useStore.getState().syncMarks())
|
|
531
|
+
import.meta.hot.on('sh:boards', () => void useStore.getState().syncMarks()) // a board's frames changed: its roll-up too
|
|
521
532
|
// Live Jam reply delivery: the daemon just wrote to a board's log - fetch it NOW instead of
|
|
522
533
|
// waiting out the 30s comment poll, so the reply + notification land within a second.
|
|
523
534
|
import.meta.hot.on('sh:jam-comment', (m: any) => { if (typeof m?.board === 'string') useComments.getState().poke(m.board) })
|
|
@@ -687,6 +698,15 @@ export function App() {
|
|
|
687
698
|
}
|
|
688
699
|
if (e.key === 'C' && e.shiftKey) { const c = commentsStore(); c.setShow(!c.show) }
|
|
689
700
|
// sticky notes (spec 18): any note visible -> hide all; none -> show all
|
|
701
|
+
// U: the next frame that needs you, else the next new one (spec 25)
|
|
702
|
+
if (e.key === 'u' && !e.shiftKey && !PUBLISHED) {
|
|
703
|
+
const live = s.nodes.filter((n) => !n.missing).sort((a, b) => a.y - b.y || a.x - b.x)
|
|
704
|
+
const from = s.selection.length ? s.nodes.find((n) => n.key === s.selection[s.selection.length - 1])?.frame ?? null : null
|
|
705
|
+
const id = nextToLook(s.marks, asksNow(), [...new Set(live.map((n) => n.frame))], from)
|
|
706
|
+
const n = id ? live.find((x) => x.frame === id) : null
|
|
707
|
+
if (n) { s.select(n.key); canvasCtl.fitNode(n.key) } else toast('nothing new on this board')
|
|
708
|
+
return
|
|
709
|
+
}
|
|
690
710
|
if (e.key === 'n' && !e.shiftKey) { const visible = document.querySelectorAll('.sh-notes:not(.off)').length > 0; useNotes.getState().toggleAll(visible); toast(visible ? 'notes hidden' : 'notes shown'); return }
|
|
691
711
|
// Shift+L = laser comment: the laser-sharp lighting on the element a comment tags
|
|
692
712
|
// (pick hover, compose lock, open-thread highlight). Pins and cards stay - this
|
|
@@ -813,6 +833,7 @@ export function App() {
|
|
|
813
833
|
<div className="hd" style={{ marginTop: 10 }}>Scenes</div>
|
|
814
834
|
{scenes.map((sc) => (
|
|
815
835
|
<SceneGroup key={sc.name} name={sc.name} label={sceneLabel(sc.name)} count={sc.frames}
|
|
836
|
+
ids={frames.filter((f) => f.scene === sc.name).map((f) => f.id)}
|
|
816
837
|
held={frames.some((f) => f.scene === sc.name && selFrames.has(f.id))}
|
|
817
838
|
renaming={sceneNaming === sc.name}
|
|
818
839
|
onRename={(raw) => {
|
|
@@ -829,7 +850,8 @@ export function App() {
|
|
|
829
850
|
onClick: () => copyToClipboard(sc.name
|
|
830
851
|
? `board: ${useStore.getState().board} · scene: ${sc.name} (design/scenes/${sc.name}/)`
|
|
831
852
|
: `board: ${useStore.getState().board} · scene: (root)`, 'path copied'),
|
|
832
|
-
}, ...(!PUBLISHED && sc.name ? [{ label: 'Rename', icon: <PencilSimpleIcon size={15} />, onClick: () => setSceneNaming(sc.name) }] : [])
|
|
853
|
+
}, ...(!PUBLISHED && sc.name ? [{ label: 'Rename', icon: <PencilSimpleIcon size={15} />, onClick: () => setSceneNaming(sc.name) }] : []),
|
|
854
|
+
...(!PUBLISHED ? [{ label: 'Mark all as seen', icon: <CheckIcon size={15} />, onClick: () => useStore.getState().markSeen(frames.filter((f) => f.scene === sc.name).map((f) => f.id), true) }] : [])])}
|
|
833
855
|
onPick={() => {
|
|
834
856
|
const keys = nodes.filter((n) => frames.some((f) => f.scene === sc.name && f.id === n.frame) && !n.missing).map((n) => n.key)
|
|
835
857
|
if (!keys.length) return
|
|
@@ -897,10 +919,10 @@ export function App() {
|
|
|
897
919
|
const on = !!n && selection.includes(n.key)
|
|
898
920
|
const nm = m.title ?? cap((m.id.split('/').pop() ?? '').replace(/^[a-z]-/, '').replace(/-/g, ' '))
|
|
899
921
|
rows.push(
|
|
900
|
-
<
|
|
922
|
+
<MarkedRow key={m.id} frame={m.id} className={`sub vrow${on ? ' on' : ''}`} onClick={(e) => go(m.id, e.shiftKey)}
|
|
901
923
|
onContextMenu={(e) => cm.open(e, frameMenu(m))}>
|
|
902
924
|
<span className={`chip${on ? ' on' : ''}`}>{(m.variant ?? '?').toUpperCase()}</span><span className="nm">{nm}</span>
|
|
903
|
-
</
|
|
925
|
+
</MarkedRow>,
|
|
904
926
|
)
|
|
905
927
|
}
|
|
906
928
|
continue
|
|
@@ -909,7 +931,7 @@ export function App() {
|
|
|
909
931
|
const n = nodeFor(f.id)
|
|
910
932
|
const on = !!n && selection.includes(n.key)
|
|
911
933
|
rows.push(
|
|
912
|
-
<
|
|
934
|
+
<MarkedRow key={f.id} frame={f.id} className={`sub${on ? ' on' : ''}`} onClick={(e) => go(f.id, e.shiftKey)} onContextMenu={(e) => cm.open(e, frameMenu(f))} title={f.intent}>
|
|
913
935
|
{/* every frame leads with an icon: the slide badge first (a deck
|
|
914
936
|
frame is a deck frame whatever it imports), intent glyph for
|
|
915
937
|
content frames, the plain rectangle for UI frames */}
|
|
@@ -918,8 +940,8 @@ export function App() {
|
|
|
918
940
|
: f.intent
|
|
919
941
|
? <IntentGlyph intent={f.intent} size={13} className="iicon" aria-label={f.intent} />
|
|
920
942
|
: <FrameRectIcon size={13} className="iicon" />}
|
|
921
|
-
{cap(f.id.split('/').slice(1).join('/') || f.id)}
|
|
922
|
-
</
|
|
943
|
+
<span className="nm">{cap(f.id.split('/').slice(1).join('/') || f.id)}</span>
|
|
944
|
+
</MarkedRow>,
|
|
923
945
|
)
|
|
924
946
|
}
|
|
925
947
|
return rows
|
|
@@ -1053,13 +1075,15 @@ function JamToast({ id, note, badge, inert }: { id: number; note: import('./stor
|
|
|
1053
1075
|
<div className="sh-jam-txt">
|
|
1054
1076
|
{human
|
|
1055
1077
|
? <b className="sh-jam-frame"><span className="t">{note.author!.name ?? 'Someone'}</span> <span className="v">{note.kind === 'mention' ? 'mentioned you' : 'replied'}</span></b>
|
|
1056
|
-
:
|
|
1078
|
+
: note.stack?.length
|
|
1079
|
+
? <b className="sh-jam-frame"><span className="t">{boardLabel(note.board)}</span> <span className="v">· {note.stack.length + 1} replies</span></b>
|
|
1080
|
+
: <b className="sh-jam-frame"><span className="t">{note.frameTitle ?? note.board}</span></b>}
|
|
1057
1081
|
<span className="sh-jam-prev">{note.preview}</span>
|
|
1058
1082
|
</div>
|
|
1059
1083
|
{badge != null
|
|
1060
1084
|
? <span className="sh-jam-badge">+{badge}</span>
|
|
1061
1085
|
: !inert && <>
|
|
1062
|
-
<button className="sh-jam-view" onClick={() => void viewNote(note,
|
|
1086
|
+
<button className="sh-jam-view" onClick={() => void viewNote(note, () => useStore.getState().advanceToast(id))}>View</button>
|
|
1063
1087
|
<button className="sh-jam-x" aria-label="Dismiss" onClick={dismiss}><XIcon size={13} /></button>
|
|
1064
1088
|
</>}
|
|
1065
1089
|
</div>
|
|
@@ -5,9 +5,11 @@ import { StatusPicker } from './StatusPicker.tsx'
|
|
|
5
5
|
import type { StatusWord } from '../../shared/board-types.ts'
|
|
6
6
|
import { PHASE_LABEL, STATUS_LABEL } from '../../shared/status.ts'
|
|
7
7
|
import { canvasCtl } from './canvas/Canvas.tsx'
|
|
8
|
+
import { rollup } from '../../shared/marks.ts'
|
|
9
|
+
import { Bubble, useAsks } from './marks-ui.tsx'
|
|
8
10
|
import { Tip } from './Tip.tsx'
|
|
9
11
|
import { copyToClipboard, type MenuItem, type MenuOpener } from './ContextMenu.tsx'
|
|
10
|
-
import { ArrowLineUpIcon, CardsIcon, CardsThreeIcon, FolderIcon, FolderMinusIcon, FolderOpenIcon, FolderPlusIcon, PencilSimpleIcon, SignpostIcon } from './icons.tsx'
|
|
12
|
+
import { ArrowLineUpIcon, CardsIcon, CheckIcon, CardsThreeIcon, FolderIcon, FolderMinusIcon, FolderOpenIcon, FolderPlusIcon, PencilSimpleIcon, SignpostIcon } from './icons.tsx'
|
|
11
13
|
import {
|
|
12
14
|
applyDrop, boardsIn, createFolder, deleteFolder, depthOf, folderEntries, folderIn, folderOf, foldersIn, holdsFolders, humanize, INDENT, isOwnSlot, labelOf, listIn, moveBoard, moveFolderToRoot, newFolderSlot, parentOf, readTitle,
|
|
13
15
|
resolveDrop, retitleFolder, rootIndex, slugFor,
|
|
@@ -53,7 +55,12 @@ export function BoardList({ onMenu }: { onMenu: MenuOpener }) {
|
|
|
53
55
|
const board = useStore((s) => s.board)
|
|
54
56
|
const working = useStore((s) => s.workingBoards) // boards an agent is working on right now
|
|
55
57
|
const titles = useStore((s) => s.boardTitles) // board slug → title, off the last tree read
|
|
56
|
-
const meta = useStore((s) => s.boardMeta)
|
|
58
|
+
const meta = useStore((s) => s.boardMeta)
|
|
59
|
+
// sidebar marks (spec 25): a board you are not on, or a closed folder, rolls up its frames
|
|
60
|
+
const marks = useStore((s) => s.marks)
|
|
61
|
+
const asks = useAsks()
|
|
62
|
+
const framesOf = (boards: string[]) => boards.flatMap((b) => marks?.boards[b] ?? [])
|
|
63
|
+
const seeAll = (boards: string[]): MenuItem[] => (!PUBLISHED ? [{ label: 'Mark all as seen', icon: <CheckIcon size={15} />, onClick: () => useStore.getState().markSeen(framesOf(boards), true) }] : []) // board slug → type and status (spec 20)
|
|
57
64
|
const label = (n: string) => labelOf(n, titles[n]) // a board's label; a folder's is labelOf(name, item.title)
|
|
58
65
|
const [tree, setTree] = useState<TreeItem[]>([])
|
|
59
66
|
const [naming, setNaming] = useState<Naming | null>(null)
|
|
@@ -329,7 +336,7 @@ export function BoardList({ onMenu }: { onMenu: MenuOpener }) {
|
|
|
329
336
|
refresh() // a clear: what the evidence says now
|
|
330
337
|
}
|
|
331
338
|
const boardMenu = (n: string, parent: string | null): MenuItem[] => {
|
|
332
|
-
const items: MenuItem[] = [{ label: 'Copy path', icon: <SignpostIcon size={15} />, onClick: () => copyToClipboard(`board: ${n}`, 'path copied') }]
|
|
339
|
+
const items: MenuItem[] = [{ label: 'Copy path', icon: <SignpostIcon size={15} />, onClick: () => copyToClipboard(`board: ${n}`, 'path copied') }, ...seeAll([n])]
|
|
333
340
|
if (PUBLISHED || n === 'all-scenes') return items
|
|
334
341
|
// a feature or project board: its status first, as Linear puts it - the picker opens in place
|
|
335
342
|
const m = useStore.getState().boardMeta[n]
|
|
@@ -352,7 +359,7 @@ export function BoardList({ onMenu }: { onMenu: MenuOpener }) {
|
|
|
352
359
|
const folderMenu = (f: string, boards: string[], parent: string | null): MenuItem[] => {
|
|
353
360
|
const items: MenuItem[] = [{ label: 'Copy path', icon: <SignpostIcon size={15} />, onClick: () => copyToClipboard(`folder: ${f}${parent ? ` (in ${parent})` : ''} (boards: ${boards.join(', ') || 'none'})`, 'path copied') }]
|
|
354
361
|
if (PUBLISHED) return items
|
|
355
|
-
items.push({ label: 'Rename', icon: <PencilSimpleIcon size={15} />, onClick: () => setNaming({ kind: 'folder', name: f }) })
|
|
362
|
+
items.push({ label: 'Rename', icon: <PencilSimpleIcon size={15} />, onClick: () => setNaming({ kind: 'folder', name: f }) }, ...seeAll(boards))
|
|
356
363
|
// two levels: a top-level folder can hold folders; a sub-folder can leave its parent
|
|
357
364
|
if (!parent) items.push({ label: 'New folder inside', icon: <FolderPlusIcon size={15} />, onClick: () => newFolderAt(listIn(treeRef.current, f)?.length ?? 0, undefined, f) })
|
|
358
365
|
else items.push({ label: 'Move to top level', icon: <ArrowLineUpIcon size={15} />, onClick: () => mutate((t) => {
|
|
@@ -444,9 +451,11 @@ export function BoardList({ onMenu }: { onMenu: MenuOpener }) {
|
|
|
444
451
|
)
|
|
445
452
|
const canDrag = !PUBLISHED && n !== 'all-scenes'
|
|
446
453
|
const item: Drag = { kind: 'board', name: n }
|
|
454
|
+
// the board you are on shows nothing: its rows below speak for themselves
|
|
455
|
+
const r = n === board ? { asks: 0, fresh: 0 } : rollup(marks, asks, framesOf([n]))
|
|
447
456
|
return (
|
|
448
457
|
<button key={`b:${n}`} data-board-row data-board={n} data-folder={parent ?? undefined} data-depth={depth} data-reorderable={canDrag || undefined}
|
|
449
|
-
className={`it board${indent(depth)}${n === board ? ' cur' : ''}${dragging ? ' dragging' : ''}${s.cls}`} style={s.style}
|
|
458
|
+
className={`it board${indent(depth)}${n === board ? ' cur' : ''}${r.asks ? ' mk-ask' : r.fresh ? ' mk-new' : ''}${dragging ? ' dragging' : ''}${s.cls}`} style={s.style}
|
|
450
459
|
// draggable rows switch on the pointer tap (onPointerUp), so their trailing mouse
|
|
451
460
|
// click (detail >= 1) must be ignored to avoid a double switch; keyboard clicks
|
|
452
461
|
// (detail === 0) and non-draggable rows (all-scenes, published) switch here as normal
|
|
@@ -466,7 +475,9 @@ export function BoardList({ onMenu }: { onMenu: MenuOpener }) {
|
|
|
466
475
|
<i className="st st-error" data-board-error aria-label={`not valid JSON: ${meta[n].error}`}>!</i>
|
|
467
476
|
</Tip>
|
|
468
477
|
)}
|
|
469
|
-
{
|
|
478
|
+
{/* one slot: a question for you takes it until answered, then the status comes back */}
|
|
479
|
+
{r.asks > 0 && <i className="st"><Bubble n={r.asks} /></i>}
|
|
480
|
+
{meta[n]?.status && !r.asks && (
|
|
470
481
|
<Tip side="right" label={<StatusTipLabel m={meta[n]} />}>
|
|
471
482
|
<i className="st" data-status={meta[n].status!.status} aria-hidden="true"><StatusIcon status={meta[n].status!.status} fill={meta[n].status!.fill} /></i>
|
|
472
483
|
</Tip>
|
|
@@ -518,7 +529,11 @@ export function BoardList({ onMenu }: { onMenu: MenuOpener }) {
|
|
|
518
529
|
{/* a closed folder carries the live signal of the boards it hides */}
|
|
519
530
|
<LiveIcon live={!open && boards.some((b) => working.includes(b))}>{open ? <FolderOpenIcon size={14} /> : <FolderIcon size={14} />}</LiveIcon>
|
|
520
531
|
<span>{labelOf(f, it.title)}</span>
|
|
521
|
-
|
|
532
|
+
{(() => {
|
|
533
|
+
// a closed folder's one slot rolls up what it hides: a question first, else a blue count
|
|
534
|
+
const r = open ? { asks: 0, fresh: 0 } : rollup(marks, asks, framesOf(boards))
|
|
535
|
+
return r.asks ? <Bubble n={r.asks} /> : <small className={r.fresh ? 'mk-fresh' : undefined}>{boards.length}</small>
|
|
536
|
+
})()}
|
|
522
537
|
</button>,
|
|
523
538
|
)
|
|
524
539
|
}
|
|
@@ -15,6 +15,7 @@ import { useStore, BOARD_POLICY, BRANDING, CONFIG, PUBLISHED, SOURCE_REVEALED, b
|
|
|
15
15
|
import { deckOrder } from './play-order.ts'
|
|
16
16
|
import { useComments } from './comments-store.ts'
|
|
17
17
|
import { isNoteAnchor } from './notes.ts'
|
|
18
|
+
import { stageShown } from './marks-ui.tsx'
|
|
18
19
|
import { ROUTE, slideSize } from '../const.ts'
|
|
19
20
|
import { poweredByUrl } from '../../shared/utm.ts'
|
|
20
21
|
import { canvasCtl } from './canvas/ctl.ts'
|
|
@@ -464,6 +465,7 @@ function PlayInner() {
|
|
|
464
465
|
postStage({ type: 'sh:laser', on: s.laser })
|
|
465
466
|
postStage({ type: 'sh:pick', on: commentsStore().commentMode, quiet: !commentsStore().showAnchor })
|
|
466
467
|
setStageReady((n) => n + 1) // a reload wiped the frame's lock; let PlayComments re-drive it
|
|
468
|
+
stageShown() // spec 25: what the stage shows now counts toward seen
|
|
467
469
|
} else if (data.type === 'sh:stage-at') {
|
|
468
470
|
const p = s.play
|
|
469
471
|
if (p && typeof data.at === 'string') s.setPlay({ ...p, at: data.at })
|
|
@@ -231,6 +231,8 @@ export function Canvas() {
|
|
|
231
231
|
const keys = linkTargets(bootHash, useStore.getState().nodes)
|
|
232
232
|
if (keys.length) {
|
|
233
233
|
useStore.setState({ selection: keys })
|
|
234
|
+
const st = useStore.getState() // a link opened is a look (marks not in yet: their first load acknowledges it)
|
|
235
|
+
st.markSeen(keys.map((k) => st.nodes.find((n) => n.key === k)?.frame).filter((f): f is string => !!f))
|
|
234
236
|
canvasCtl.fitNodes(keys)
|
|
235
237
|
} else {
|
|
236
238
|
canvasCtl.fitAll()
|
|
@@ -12,6 +12,7 @@ import { canAutoReload, shouldArmReadyWatch } from './ready-watch.ts'
|
|
|
12
12
|
import { Stickies, type NoteSpec } from './Sticky.tsx'
|
|
13
13
|
import { noteId, sceneNoteHost } from '../notes.ts'
|
|
14
14
|
import { slideSize, stageFit } from '../../const.ts'
|
|
15
|
+
import { FrameSlot, toneOf, useFrameMark } from '../marks-ui.tsx'
|
|
15
16
|
|
|
16
17
|
export const HEADER = 28
|
|
17
18
|
const SNAP = 12
|
|
@@ -64,6 +65,7 @@ export const FrameNode = memo(function FrameNode({ node }: { node: Node }) {
|
|
|
64
65
|
const selected = useStore((s) => s.selection.includes(node.key))
|
|
65
66
|
const interact = useStore((s) => s.interact === node.key)
|
|
66
67
|
const working = useStore((s) => s.working.includes(node.frame)) // Live Jam: Marver is editing this frame
|
|
68
|
+
const mark = useFrameMark(node.frame) // spec 25: new, or a question for you
|
|
67
69
|
// sticky notes (spec 18): the scene's note when this node is the scene's first on the board
|
|
68
70
|
// (reading order), then the frame's own. Text is compared by value - a note edit re-renders
|
|
69
71
|
// only its column; a pan never re-renders any node (no position subscription here).
|
|
@@ -272,6 +274,7 @@ export const FrameNode = memo(function FrameNode({ node }: { node: Node }) {
|
|
|
272
274
|
// shift-click toggles multi-selection instead of dragging (Figma convention)
|
|
273
275
|
if (e.shiftKey && mode === 'move') { select(node.key, true); return }
|
|
274
276
|
if (!(selected && useStore.getState().selection.length > 1)) select(node.key)
|
|
277
|
+
else useStore.getState().markSeen([node.frame]) // a click inside a group selection still looks at this one
|
|
275
278
|
const el = e.currentTarget as HTMLElement
|
|
276
279
|
const world = document.getElementById('sh-world')!
|
|
277
280
|
// Law G-5: measured scale, never stored zoom state. #sh-world is 1px wide by design,
|
|
@@ -391,13 +394,15 @@ export const FrameNode = memo(function FrameNode({ node }: { node: Node }) {
|
|
|
391
394
|
<span>{variantName}</span>
|
|
392
395
|
</div>
|
|
393
396
|
)}
|
|
394
|
-
<div className=
|
|
397
|
+
<div className={`sh-node-head sh-no-pan${toneOf(mark)}`} onPointerDown={(e) => drag(e, 'move')} title={frame.file}>
|
|
395
398
|
{/* the chrome badge: slide first, else the content intent glyph */}
|
|
396
399
|
{frame.slide
|
|
397
400
|
? <SlideFrameIcon size={12} className="iicon sh-no-pan" role="img" aria-hidden={false} aria-label="slide" />
|
|
398
401
|
: frame.intent && <IntentGlyph intent={frame.intent} size={12} className="iicon sh-no-pan" aria-label={frame.intent} />}
|
|
399
402
|
<span className="id sh-no-pan">{frame.title ?? frame.id}</span>
|
|
400
403
|
<span className="dim sh-no-pan">{Math.round(node.w)} · {node.theme}</span>
|
|
404
|
+
{/* the sidebar's marks on the frame itself (spec 25): no outline, no glow - the glow is an agent working */}
|
|
405
|
+
<FrameSlot m={mark} />
|
|
401
406
|
</div>
|
|
402
407
|
|
|
403
408
|
<div className="sh-node-body" style={{ height: node.h }}>
|
|
@@ -125,6 +125,8 @@ export const useComments = create<CommentsState>((set, get) => {
|
|
|
125
125
|
threadId, board: t?.board ?? e.board ?? get().board ?? '', ts: e.ts,
|
|
126
126
|
preview: (e.body ?? '').replace(/\s+/g, ' ').slice(0, 90),
|
|
127
127
|
frame: t?.frame, frameTitle: entry?.title ?? t?.frame, intent: entry?.intent,
|
|
128
|
+
// a reply folds into the board's round; a new note, or a reply that asks (ends in "?"), stands alone
|
|
129
|
+
round: e.type === 'reply' && !/\?\s*$/.test(e.body ?? ''),
|
|
128
130
|
})
|
|
129
131
|
}
|
|
130
132
|
})
|
|
@@ -0,0 +1,119 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Sidebar marks in the shell (spec 25, variant B - one slot). Colour on a row's icon and title
|
|
3
|
+
* carries the state (blue new, orange needs you); the row's one right-hand slot holds what matters
|
|
4
|
+
* most: a question's numbered bubble, then the row's own count or status, then a frame's dot.
|
|
5
|
+
*/
|
|
6
|
+
import { useEffect, type HTMLAttributes, type ReactNode } from 'react'
|
|
7
|
+
import { create } from 'zustand'
|
|
8
|
+
import { useStore, PUBLISHED } from './store.ts'
|
|
9
|
+
import { useComments } from './comments-store.ts'
|
|
10
|
+
import { frameMark, isNew, questions, type Ask, type FrameMark } from '../../shared/marks.ts'
|
|
11
|
+
|
|
12
|
+
/** Every frame's mark, derived ONCE per change of marks, threads or manifest. Rows and headers read
|
|
13
|
+
* one string each, so a change re-renders only what it changes - never the whole shell. */
|
|
14
|
+
interface View { q: Map<string, Ask>; frame: Record<string, string>; fresh: Record<string, true> }
|
|
15
|
+
const useMarkView = create<View>(() => ({ q: new Map(), frame: {}, fresh: {} }))
|
|
16
|
+
const derive = () => {
|
|
17
|
+
const { marks, manifest } = useStore.getState()
|
|
18
|
+
// a published canvas shows no marks at all: no seen state there, and its threads are not yours
|
|
19
|
+
const q = PUBLISHED ? new Map<string, Ask>() : questions(useComments.getState().threads)
|
|
20
|
+
const frame: Record<string, string> = {}, fresh: Record<string, true> = {}
|
|
21
|
+
for (const f of manifest?.frames ?? []) {
|
|
22
|
+
const m = frameMark(marks, q, f.id)
|
|
23
|
+
if (m) frame[f.id] = m.kind === 'new' ? 'new' : `${m.kind}:${m.n}`
|
|
24
|
+
if (isNew(marks, f.id)) fresh[f.id] = true
|
|
25
|
+
}
|
|
26
|
+
useMarkView.setState({ q, frame, fresh })
|
|
27
|
+
}
|
|
28
|
+
useStore.subscribe((s, p) => { if (s.marks !== p.marks || s.manifest !== p.manifest) derive() })
|
|
29
|
+
useComments.subscribe((s, p) => { if (s.threads !== p.threads) derive() })
|
|
30
|
+
|
|
31
|
+
/** The playNav at which the focus/play stage last finished loading (Play reports it); -1 while none
|
|
32
|
+
* has. An applied Update reloads the stage: the change is on screen once that reload lands. */
|
|
33
|
+
let stageNav = -1
|
|
34
|
+
export const stageShown = () => { stageNav = useStore.getState().playNav }
|
|
35
|
+
useStore.subscribe((s, p) => { if (!s.play && p.play) stageNav = -1 })
|
|
36
|
+
|
|
37
|
+
export const asksNow = (): Map<string, Ask> => useMarkView.getState().q
|
|
38
|
+
/** Open Marver questions per frame - for the board list, a light component that rolls up per board. */
|
|
39
|
+
export const useAsks = (): Map<string, Ask> => useMarkView((s) => s.q)
|
|
40
|
+
|
|
41
|
+
const parse = (k: string): FrameMark => {
|
|
42
|
+
if (!k) return null
|
|
43
|
+
if (k === 'new') return { kind: 'new' }
|
|
44
|
+
const [kind, n] = k.split(':')
|
|
45
|
+
return { kind: kind as 'ask' | 'answered', n: Number(n) }
|
|
46
|
+
}
|
|
47
|
+
export const useFrameMark = (id: string): FrameMark => parse(useMarkView((s) => s.frame[id] ?? ''))
|
|
48
|
+
|
|
49
|
+
/** A row standing for many frames: open questions and new frames among `ids`, as one primitive -
|
|
50
|
+
* the row re-renders only when the pair changes. */
|
|
51
|
+
export function useRollup(ids: readonly string[]): { asks: number; fresh: number } {
|
|
52
|
+
const k = useMarkView((s) => {
|
|
53
|
+
let asks = 0, fresh = 0
|
|
54
|
+
for (const id of new Set(ids)) { const f = s.frame[id]; if (f?.startsWith('ask:')) asks += Number(f.slice(4)); if (s.fresh[id]) fresh++ }
|
|
55
|
+
return `${asks}:${fresh}`
|
|
56
|
+
})
|
|
57
|
+
const [asks, fresh] = k.split(':').map(Number)
|
|
58
|
+
return { asks, fresh }
|
|
59
|
+
}
|
|
60
|
+
|
|
61
|
+
/** The row's tone class: blue for new, orange for a question (answered or not). */
|
|
62
|
+
export const toneOf = (m: FrameMark): string => (!m ? '' : m.kind === 'new' ? ' mk-new' : ' mk-ask')
|
|
63
|
+
|
|
64
|
+
export const Bubble = ({ n, hollow }: { n: number; hollow?: boolean }) => (
|
|
65
|
+
<i className={`mk-bubble${hollow ? ' hollow' : ''}`} data-mark={hollow ? 'answered' : 'ask'}
|
|
66
|
+
aria-label={hollow ? `${n} answered, waiting on the agent` : `${n} question${n > 1 ? 's' : ''} for you`}>{n}</i>
|
|
67
|
+
)
|
|
68
|
+
|
|
69
|
+
/** A frame row's slot: the bubble, or the blue dot. */
|
|
70
|
+
export function FrameSlot({ m }: { m: FrameMark }) {
|
|
71
|
+
if (!m) return null
|
|
72
|
+
if (m.kind === 'new') return <i className="mk-slot"><i className="mk-dot" data-mark="new" aria-label="new" /></i>
|
|
73
|
+
return <i className="mk-slot"><Bubble n={m.n} hollow={m.kind === 'answered'} /></i>
|
|
74
|
+
}
|
|
75
|
+
|
|
76
|
+
/** A sidebar frame row that wears its frame's mark: the tone on the row, the slot at its end. */
|
|
77
|
+
export function MarkedRow({ frame, className, children, ...rest }: { frame: string; className: string; children: ReactNode } & HTMLAttributes<HTMLDivElement>) {
|
|
78
|
+
const m = useFrameMark(frame)
|
|
79
|
+
return <div className={className + toneOf(m)} {...rest}>{children}<FrameSlot m={m} /></div>
|
|
80
|
+
}
|
|
81
|
+
|
|
82
|
+
/** Looking at a frame counts as seeing it (spec 25): any part of it in the window for two seconds,
|
|
83
|
+
* at a readable zoom (scale 0.5 or more), showing the change - a frame still loading, or holding a
|
|
84
|
+
* deferred update, is not showing it yet. In focus or play the frame on stage fills the window, once
|
|
85
|
+
* an update it holds is applied and the stage has reloaded with it. Polls once a second, and only frames that are new. */
|
|
86
|
+
export function useSeenOnScreen() {
|
|
87
|
+
useEffect(() => {
|
|
88
|
+
if (PUBLISHED) return
|
|
89
|
+
const since = new Map<string, number>() // "key@changed" -> when it came into view
|
|
90
|
+
const tick = () => {
|
|
91
|
+
const s = useStore.getState(), m = s.marks
|
|
92
|
+
const now = Date.now()
|
|
93
|
+
const shown = new Map<string, string>() // clock key -> frame; a newer change restarts the clock
|
|
94
|
+
if (m && !document.hidden && s.play) {
|
|
95
|
+
const f = s.nodes.find((n) => n.key === s.play!.at)?.frame ?? s.play.at
|
|
96
|
+
if (!s.playUpdateRevision && stageNav === s.playNav && isNew(m, f)) shown.set(`play:${f}@${m.changed[f] ?? 0}`, f)
|
|
97
|
+
} else if (m && !document.hidden && s.scale >= 0.5) {
|
|
98
|
+
// in view: some of it inside the window and not all of that under the open sidebar
|
|
99
|
+
const P = document.querySelector('.sh-panel:not(.closed)')?.getBoundingClientRect()
|
|
100
|
+
const W = window.innerWidth, H = window.innerHeight
|
|
101
|
+
for (const n of s.nodes) {
|
|
102
|
+
if (n.status !== 'ready' || s.pendingFrameRevisions[n.frame] || !isNew(m, n.frame)) continue
|
|
103
|
+
const r = document.querySelector<HTMLElement>(`.sh-node[data-node="${CSS.escape(n.key)}"]`)?.getBoundingClientRect()
|
|
104
|
+
if (!r) continue
|
|
105
|
+
const x0 = Math.max(r.left, 0), x1 = Math.min(r.right, W), y0 = Math.max(r.top, 0), y1 = Math.min(r.bottom, H)
|
|
106
|
+
if (x0 >= x1 || y0 >= y1) continue
|
|
107
|
+
if (P && x0 >= P.left && x1 <= P.right && y0 >= P.top && y1 <= P.bottom) continue
|
|
108
|
+
shown.set(`${n.key}@${m.changed[n.frame] ?? 0}`, n.frame)
|
|
109
|
+
}
|
|
110
|
+
}
|
|
111
|
+
for (const k of [...since.keys()]) if (!shown.has(k)) since.delete(k)
|
|
112
|
+
const due: string[] = []
|
|
113
|
+
for (const [k, f] of shown) { const t = since.get(k) ?? now; since.set(k, t); if (now - t >= 2000) due.push(f) }
|
|
114
|
+
if (due.length) s.markSeen(due, true)
|
|
115
|
+
}
|
|
116
|
+
const id = setInterval(tick, 1000)
|
|
117
|
+
return () => clearInterval(id)
|
|
118
|
+
}, [])
|
|
119
|
+
}
|
|
@@ -102,6 +102,10 @@ export interface JamNote {
|
|
|
102
102
|
frame?: string; frameTitle?: string; intent?: string
|
|
103
103
|
kind?: 'mention' | 'reply' // absent = the agent pill
|
|
104
104
|
author?: { name?: string; avatar?: string; id?: string; email?: string }
|
|
105
|
+
/** an agent REPLY (not a new question): a board's replies fold into one notice per round (spec 25) */
|
|
106
|
+
round?: boolean
|
|
107
|
+
/** the earlier replies of the round, under this one - View walks through them */
|
|
108
|
+
stack?: JamNote[]
|
|
105
109
|
}
|
|
106
110
|
export interface Toast { id: number; text: string; jam?: JamNote }
|
|
107
111
|
|
|
@@ -150,6 +154,7 @@ import { canAutoReload } from './canvas/ready-watch.ts'
|
|
|
150
154
|
import { buildTree, flatten, labelOf, toWire, TREE_PROTOCOL, type TreeItem } from '../../shared/board-tree.ts'
|
|
151
155
|
import type { BoardType, StatusWord } from '../../shared/board-types.ts'
|
|
152
156
|
import type { Phase, Status } from '../../shared/status.ts'
|
|
157
|
+
import { isNew, type Marks } from '../../shared/marks.ts'
|
|
153
158
|
|
|
154
159
|
/** The CAS tokens a tree write echoes: the sha256 of every board file as last seen, and of
|
|
155
160
|
* the folder registry (null = there was no file). */
|
|
@@ -401,6 +406,12 @@ function defaultSize(frame: FrameEntry) {
|
|
|
401
406
|
}
|
|
402
407
|
|
|
403
408
|
let resizedInGesture = false
|
|
409
|
+
// sidebar marks: the fetch in flight, and acknowledgements the server has not confirmed yet
|
|
410
|
+
let marksSeq = 0
|
|
411
|
+
let marksTimer: ReturnType<typeof setTimeout> | undefined
|
|
412
|
+
const pendingSeen: Record<string, number> = {}
|
|
413
|
+
/** frames looked at before the first marks arrived (a link, a click, focus) - acknowledged when they land */
|
|
414
|
+
const lookedEarly = new Set<string>()
|
|
404
415
|
/** Why a board's last load failed, from the server (a parse error names its line) - for its toast. */
|
|
405
416
|
const loadErrors = new Map<string, string>()
|
|
406
417
|
const whyNot = (name: string) => { const e = loadErrors.get(name); return e ? ` - ${e}` : '' }
|
|
@@ -518,6 +529,8 @@ interface State {
|
|
|
518
529
|
toast(text: string): void
|
|
519
530
|
jamToast(note: JamNote): void
|
|
520
531
|
dismissToast(id: number): void
|
|
532
|
+
/** View on a notice: a round's notice moves to its next reply, any other one goes. */
|
|
533
|
+
advanceToast(id: number): void
|
|
521
534
|
clearJamToasts(): void
|
|
522
535
|
/** Frames Marver is editing right now (Live Jam presence) - drives the working glow. */
|
|
523
536
|
working: string[]
|
|
@@ -529,6 +542,12 @@ interface State {
|
|
|
529
542
|
setWorkingFrom(m: unknown): void
|
|
530
543
|
/** Fetch what is lit now (dev only) - the snapshot behind the broadcasts. */
|
|
531
544
|
syncWorking(): Promise<void>
|
|
545
|
+
/** Sidebar marks (spec 25): what changed since you looked - null on a published canvas. */
|
|
546
|
+
marks: Marks | null
|
|
547
|
+
syncMarks(): Promise<void>
|
|
548
|
+
/** You looked at these frames: clear their "new", here and on disk - skipping one still holding a
|
|
549
|
+
* deferred update, unless `shown` (the dwell and the play stage know what is on screen; Mark all as seen) */
|
|
550
|
+
markSeen(frameIds: readonly string[], shown?: boolean): void
|
|
532
551
|
/** Boards showing a working frame - their sidebar icon shimmers while an agent works. */
|
|
533
552
|
workingBoards: string[]
|
|
534
553
|
/** The place in the server's order of the activity last applied - an older answer is dropped. */
|
|
@@ -1348,6 +1367,8 @@ export const useStore = create<State>((set, get) => {
|
|
|
1348
1367
|
: [key]
|
|
1349
1368
|
return { selection, interact: s.interact && selection.includes(s.interact) ? s.interact : null }
|
|
1350
1369
|
})
|
|
1370
|
+
// selecting a frame is looking at it, every time - even one already selected (spec 25)
|
|
1371
|
+
if (key != null) { const f = get().nodes.find((n) => n.key === key)?.frame; if (f) get().markSeen([f]) }
|
|
1351
1372
|
},
|
|
1352
1373
|
// scoped device sizing: only the selected frames change; null restores their defaults.
|
|
1353
1374
|
// Always followed by a tidy - a preset change must never scramble the layout.
|
|
@@ -1384,6 +1405,8 @@ export const useStore = create<State>((set, get) => {
|
|
|
1384
1405
|
const valid = keys.filter((k) => s.nodes.some((n) => n.key === k))
|
|
1385
1406
|
return { selection: valid, interact: s.interact && valid.includes(s.interact) ? s.interact : null }
|
|
1386
1407
|
})
|
|
1408
|
+
// a frame link, a scene's name: the frames brought in front of you are looked at (⌘A is selectAll - not a look)
|
|
1409
|
+
const st = get(); st.markSeen(st.selection.map((k) => st.nodes.find((n) => n.key === k)?.frame).filter((f): f is string => !!f))
|
|
1387
1410
|
},
|
|
1388
1411
|
// interact is a ONE-frame mode: entering it collapses any multi-selection to the
|
|
1389
1412
|
// interacted frame (a 4-frame selection double-clicked otherwise leaves all four
|
|
@@ -1544,9 +1567,30 @@ export const useStore = create<State>((set, get) => {
|
|
|
1544
1567
|
jamToast(note) {
|
|
1545
1568
|
const id = ++toastSeq
|
|
1546
1569
|
const text = note.kind === 'mention' ? 'You were mentioned' : note.kind === 'reply' ? 'New reply' : 'Marver replied'
|
|
1547
|
-
set((s) =>
|
|
1570
|
+
set((s) => {
|
|
1571
|
+
// one notice per board per round: an agent reply folds into that board's open notice (spec 25)
|
|
1572
|
+
// a round ends after ten quiet minutes: a later reply opens a fresh notice
|
|
1573
|
+
const prev = note.round ? s.toasts.find((t) => t.jam?.round && t.jam.board === note.board && note.ts - t.jam.ts < 600_000) : undefined
|
|
1574
|
+
const jam = prev ? { ...note, stack: [...(prev.jam!.stack ?? []), { ...prev.jam!, stack: undefined }].filter((n) => n.threadId !== note.threadId) } : note
|
|
1575
|
+
// a notice whose top reply is this thread steps down to the replies under it, never loses them
|
|
1576
|
+
const others = s.toasts.flatMap((t) => {
|
|
1577
|
+
if (t === prev) return []
|
|
1578
|
+
const rest = (t.jam?.stack ?? []).filter((n) => n.threadId !== note.threadId)
|
|
1579
|
+
if (t.jam?.threadId !== note.threadId) return [t.jam?.stack ? { ...t, jam: { ...t.jam, stack: rest } } : t]
|
|
1580
|
+
return rest.length ? [{ ...t, jam: { ...rest[rest.length - 1], stack: rest.slice(0, -1) } }] : []
|
|
1581
|
+
})
|
|
1582
|
+
return { toasts: [...others, { id, text, jam }].slice(-8) }
|
|
1583
|
+
})
|
|
1548
1584
|
},
|
|
1549
1585
|
dismissToast(id) { set((s) => ({ toasts: s.toasts.filter((t) => t.id !== id) })) },
|
|
1586
|
+
advanceToast(id) {
|
|
1587
|
+
// a merged round notice steps to its next reply; any other notice goes
|
|
1588
|
+
set((s) => ({ toasts: s.toasts.flatMap((t) => {
|
|
1589
|
+
if (t.id !== id) return [t]
|
|
1590
|
+
const rest = t.jam?.stack ?? []
|
|
1591
|
+
return rest.length ? [{ ...t, jam: { ...rest[rest.length - 1], stack: rest.slice(0, -1) } }] : []
|
|
1592
|
+
}) }))
|
|
1593
|
+
},
|
|
1550
1594
|
clearJamToasts() { set((s) => ({ toasts: s.toasts.filter((t) => !t.jam) })) },
|
|
1551
1595
|
setWorkingFrom(m) {
|
|
1552
1596
|
const strings = (v: unknown) => (Array.isArray(v) ? v.filter((x: unknown): x is string => typeof x === 'string') : [])
|
|
@@ -1557,6 +1601,45 @@ export const useStore = create<State>((set, get) => {
|
|
|
1557
1601
|
if (seq !== undefined) set({ workingSeq: seq })
|
|
1558
1602
|
get().setWorking(strings(o.frames), strings(o.boards))
|
|
1559
1603
|
},
|
|
1604
|
+
marks: null,
|
|
1605
|
+
// one fetch per burst (activity, board edits, file changes), and only the newest answer lands;
|
|
1606
|
+
// acknowledgements still in flight are kept over any answer that predates them
|
|
1607
|
+
async syncMarks() {
|
|
1608
|
+
if (PUBLISHED) return
|
|
1609
|
+
clearTimeout(marksTimer)
|
|
1610
|
+
await new Promise<void>((done) => { marksTimer = setTimeout(done, 200) })
|
|
1611
|
+
const seq = ++marksSeq
|
|
1612
|
+
try {
|
|
1613
|
+
for (let i = 0; i < 2; i++) { // the first ask may prime the CSRF cookie (as syncWorking)
|
|
1614
|
+
const r = await fetch(`${ROUTE}/api/marks`, { headers: { 'x-mv-c': csrf() } })
|
|
1615
|
+
if (seq !== marksSeq) return
|
|
1616
|
+
if (r.ok) {
|
|
1617
|
+
const m = await r.json() as Marks
|
|
1618
|
+
if (seq !== marksSeq) return
|
|
1619
|
+
const seen = { ...m.seen }
|
|
1620
|
+
for (const [id, at] of Object.entries(pendingSeen)) seen[id] = Math.max(seen[id] ?? 0, at)
|
|
1621
|
+
set({ marks: { ...m, seen } })
|
|
1622
|
+
if (lookedEarly.size) { const early = [...lookedEarly]; lookedEarly.clear(); get().markSeen(early) }
|
|
1623
|
+
return
|
|
1624
|
+
}
|
|
1625
|
+
if (r.status !== 403) return
|
|
1626
|
+
}
|
|
1627
|
+
} catch { /* the next broadcast heals it */ }
|
|
1628
|
+
},
|
|
1629
|
+
markSeen(frameIds, shown) {
|
|
1630
|
+
const m = get().marks, held = get().pendingFrameRevisions
|
|
1631
|
+
if (!m) { if (!PUBLISHED) for (const id of frameIds) lookedEarly.add(id); return }
|
|
1632
|
+
const fresh = frameIds.filter((id) => isNew(m, id) && (shown || !held[id]))
|
|
1633
|
+
if (!m || !fresh.length) return
|
|
1634
|
+
// you saw the change the page shows - its stamp, never a clock: an edit landing after this is new
|
|
1635
|
+
const seen = Object.fromEntries(fresh.map((id) => [id, m.changed[id] ?? 0]))
|
|
1636
|
+
Object.assign(pendingSeen, seen)
|
|
1637
|
+
set({ marks: { ...m, seen: { ...m.seen, ...seen } } })
|
|
1638
|
+
void postOwner('marks/seen', { frames: seen })
|
|
1639
|
+
// kept once confirmed too (stamps only ever rise): an answer that left before this one cannot undo it
|
|
1640
|
+
.then((r) => { if (!r.ok) throw new Error(String(r.status)) })
|
|
1641
|
+
.catch(() => { for (const [id, at] of Object.entries(seen)) if (pendingSeen[id] === at) delete pendingSeen[id]; void get().syncMarks() })
|
|
1642
|
+
},
|
|
1560
1643
|
async syncWorking() {
|
|
1561
1644
|
if (PUBLISHED) return
|
|
1562
1645
|
try {
|
|
@@ -1683,5 +1766,12 @@ export const useStore = create<State>((set, get) => {
|
|
|
1683
1766
|
}
|
|
1684
1767
|
})
|
|
1685
1768
|
|
|
1769
|
+
// a frame opened in focus or play is looked at (spec 25); selecting one is handled in select()
|
|
1770
|
+
useStore.subscribe((s, prev) => {
|
|
1771
|
+
// a frame opened in focus or play is in front of you too - stepping within play while an edit is
|
|
1772
|
+
// held behind Update shows the old version, so that waits for the dwell after Update
|
|
1773
|
+
if (s.play?.at && s.play.at !== prev.play?.at && (!prev.play || !s.playUpdateRevision)) { const f = s.nodes.find((n) => n.key === s.play!.at)?.frame ?? s.play.at; s.markSeen([f], true) }
|
|
1774
|
+
})
|
|
1775
|
+
|
|
1686
1776
|
// dev-only inspection hook for tests/debugging (never installed in published builds)
|
|
1687
1777
|
if (import.meta.env.DEV) (window as unknown as { __mvStore: unknown }).__mvStore = useStore
|
|
@@ -12,6 +12,7 @@
|
|
|
12
12
|
--glass-ink: #18181b;
|
|
13
13
|
--glass-ink-2: rgba(24, 24, 27, .66);
|
|
14
14
|
--glass-ink-3: rgba(24, 24, 27, .4);
|
|
15
|
+
--mk-ask: #f08a00; --mk-new: #0077e6;
|
|
15
16
|
--glass-hover: rgba(24, 24, 27, .06);
|
|
16
17
|
--glass-accent: #0077e6;
|
|
17
18
|
--glass-accent-bg: rgba(0, 136, 255, .13);
|
|
@@ -52,6 +53,7 @@
|
|
|
52
53
|
--glass-ink: #f5f5f7;
|
|
53
54
|
--glass-ink-2: rgba(245, 245, 247, .64);
|
|
54
55
|
--glass-ink-3: rgba(245, 245, 247, .4);
|
|
56
|
+
--mk-ask: #ff9f0a; --mk-new: #5cb3ff;
|
|
55
57
|
--glass-hover: rgba(255, 255, 255, .1);
|
|
56
58
|
--glass-accent: #5cb3ff;
|
|
57
59
|
--glass-accent-bg: rgba(0, 136, 255, .28);
|
|
@@ -1398,3 +1400,23 @@ body.sh-commenting .sh-sticky-body { cursor: crosshair }
|
|
|
1398
1400
|
research/notes/diagprobe5.ts */
|
|
1399
1401
|
text-rendering: geometricPrecision }
|
|
1400
1402
|
.sh-sticky-diagram svg text, .sh-sticky-diagram svg tspan { text-rendering: geometricPrecision }
|
|
1403
|
+
|
|
1404
|
+
/* sidebar marks (spec 25, variant B - one slot): colour on the icon and title carries the state,
|
|
1405
|
+
blue new, orange needs you; the row's one right-hand slot holds the bubble or the dot. Their own
|
|
1406
|
+
tokens: the accent turns purple in interact mode, a mark never does */
|
|
1407
|
+
.sh-panel .sub .nm { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap }
|
|
1408
|
+
.mk-slot { flex: none; display: inline-flex; align-items: center; justify-content: center; min-width: 16px; margin-left: 6px; font-style: normal }
|
|
1409
|
+
.sh-node-head .mk-slot { margin-left: 0 }
|
|
1410
|
+
.mk-dot { width: 7px; height: 7px; border-radius: 50%; background: var(--mk-new); flex: none }
|
|
1411
|
+
.mk-bubble { flex: none; min-width: 16px; height: 15px; padding: 0 4px; border-radius: 8px 8px 8px 2px;
|
|
1412
|
+
background: var(--mk-ask); color: #fff; font: 700 10px/15px -apple-system, system-ui, sans-serif; font-style: normal;
|
|
1413
|
+
text-align: center; font-variant-numeric: tabular-nums }
|
|
1414
|
+
.mk-bubble.hollow { background: transparent; color: var(--mk-ask); box-shadow: inset 0 0 0 1.5px var(--mk-ask) }
|
|
1415
|
+
.sh-panel .sub.mk-new, .sh-panel .sub.mk-new .nm { color: var(--mk-new); font-weight: 600 }
|
|
1416
|
+
.sh-panel .sub.mk-new .iicon, .sh-panel .sub.mk-new .chip { color: var(--mk-new); opacity: 1 }
|
|
1417
|
+
.sh-panel .sub.mk-ask .iicon, .sh-panel .sub.mk-ask .chip { color: var(--mk-ask); opacity: 1 }
|
|
1418
|
+
.sh-panel .it.board.mk-new { color: var(--mk-new) }
|
|
1419
|
+
.sh-panel .it.board.mk-new > .sh-live-ic svg, .sh-panel .it.board.mk-new > svg { color: var(--mk-new) }
|
|
1420
|
+
.sh-panel .it.board.mk-ask > .sh-live-ic svg, .sh-panel .it.board.mk-ask > svg { color: var(--mk-ask) }
|
|
1421
|
+
.sh-panel .it small.mk-fresh { color: var(--mk-new); font-weight: 700 }
|
|
1422
|
+
.sh-node-head.mk-new .id { color: var(--mk-new) }
|