@marver-design/marver 0.26.1 → 0.27.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.
Files changed (82) hide show
  1. package/CHANGELOG.md +104 -0
  2. package/README.md +8 -3
  3. package/dist/{anchor-check-l-ny3UzH.mjs → anchor-check-ChdDqL5z.mjs} +1 -1
  4. package/dist/{bake-C-awKgLA.mjs → bake-DM_uWgAA.mjs} +1 -1
  5. package/dist/{boards-DYG22tOe.mjs → boards-DlTcpF47.mjs} +1 -1
  6. package/dist/{build-BDRiO_mP.mjs → build-DZnFysGU.mjs} +4 -4
  7. package/dist/cli.mjs +28 -16
  8. package/dist/{comments-BqXua-XL.mjs → comments-DxOkCSNE.mjs} +4 -4
  9. package/dist/{daemon-DL6Fwq6D.mjs → daemon-BSA0lV8d.mjs} +8 -6
  10. package/dist/detect-C0wpaePX.mjs +125 -0
  11. package/dist/dev-eQJhWsqg.mjs +1273 -0
  12. package/dist/dev-lock-C_FC70Mu.mjs +65 -0
  13. package/dist/exclusive-B1RtpeeP.mjs +150 -0
  14. package/dist/{init-D8DtrK_F.mjs → init-COD0x48i.mjs} +5 -3
  15. package/dist/{link-BNzLvdhI.mjs → link-DDXZVGtv.mjs} +20 -8
  16. package/dist/ls-D7O1G505.mjs +38 -0
  17. package/dist/{marks-DyWMv_Z1.mjs → marks-CWM3WJjc.mjs} +1 -1
  18. package/dist/perf-BWzQwZqj.mjs +369 -0
  19. package/dist/perf-BoDSkbEb.mjs +429 -0
  20. package/dist/{perf-jam-BU3TVrZu.mjs → perf-jam-D55U3FZK.mjs} +5 -2
  21. package/dist/{plugin-DkGmZs_r.mjs → plugin-C-E7omsh.mjs} +394 -55
  22. package/dist/{poster-BdtSKMDm.mjs → poster-Bx83ZYVK.mjs} +1 -1
  23. package/dist/{profile-WU9qcbIo.mjs → profile-Bh5Y5zpW.mjs} +1 -1
  24. package/dist/{publish-bakes-9RzRToXV.mjs → publish-bakes-aljgm45S.mjs} +2 -2
  25. package/dist/{queue-29ok5_eZ.mjs → queue-CAM_vNmX.mjs} +1 -1
  26. package/dist/recover-t9Pno3u9.mjs +66 -0
  27. package/dist/{share--oFJ1bCI.mjs → share-W5H3BNvP.mjs} +1 -1
  28. package/dist/{shot-XQV7HC9A.mjs → shot-DoHLl6ig.mjs} +1 -1
  29. package/dist/{shot-DQeR_Pfn.mjs → shot-LFhC-WYD.mjs} +9 -3
  30. package/dist/slots-DCDo3N0x.mjs +471 -0
  31. package/dist/{sync-DKk-yT1V.mjs → sync-BQVlHZpx.mjs} +4 -3
  32. package/dist/{work-F5u-twpJ.mjs → work-Bp1p39kq.mjs} +4 -2
  33. package/dist/{work-VvX_JIgl.mjs → work-BroFwnup.mjs} +4 -2
  34. package/docs/boards-and-folders.md +3 -1
  35. package/docs/jam-session.md +55 -1
  36. package/docs/performance.md +262 -0
  37. package/package.json +2 -2
  38. package/src/client/content/index.tsx +3 -0
  39. package/src/client/content/video.tsx +6 -2
  40. package/src/client/frame-host/bridge.js +22 -6
  41. package/src/client/frame-host/main.tsx +17 -5
  42. package/src/client/shell/App.tsx +180 -25
  43. package/src/client/shell/BoardList.tsx +5 -5
  44. package/src/client/shell/Comments.tsx +3 -2
  45. package/src/client/shell/JamSurface.tsx +4 -2
  46. package/src/client/shell/LockedApp.tsx +5 -5
  47. package/src/client/shell/Play.tsx +16 -8
  48. package/src/client/shell/Toolbar.tsx +12 -1
  49. package/src/client/shell/api.ts +206 -0
  50. package/src/client/shell/canvas/Canvas.tsx +30 -3
  51. package/src/client/shell/canvas/FrameNode.tsx +12 -3
  52. package/src/client/shell/canvas/admission.ts +8 -1
  53. package/src/client/shell/canvas/camera-broadcast.ts +15 -5
  54. package/src/client/shell/canvas/ctl.ts +2 -0
  55. package/src/client/shell/canvas/frame-registry.ts +28 -2
  56. package/src/client/shell/canvas/sleep.ts +4 -1
  57. package/src/client/shell/comments-store.ts +12 -4
  58. package/src/client/shell/goto.ts +22 -10
  59. package/src/client/shell/jam-capture.ts +22 -8
  60. package/src/client/shell/jam-keys.ts +4 -0
  61. package/src/client/shell/jam-panel.tsx +3 -0
  62. package/src/client/shell/jam-queue.ts +3 -3
  63. package/src/client/shell/jam-session.tsx +14 -8
  64. package/src/client/shell/jam-voice.ts +7 -5
  65. package/src/client/shell/legacy-links.ts +2 -2
  66. package/src/client/shell/main.tsx +4 -0
  67. package/src/client/shell/notes.ts +8 -1
  68. package/src/client/shell/perf.ts +69 -58
  69. package/src/client/shell/recorder-core.ts +183 -0
  70. package/src/client/shell/recorder.ts +565 -0
  71. package/src/client/shell/store.ts +254 -98
  72. package/src/client/shell/styles.css +26 -1
  73. package/templates/AGENTS-embedded.md +22 -4
  74. package/templates/AGENTS-studio.md +22 -4
  75. package/templates/demo/dark.tsx +1 -1
  76. package/templates/demo/welcome.tsx +1 -1
  77. package/templates/instructions/welcome.md +6 -3
  78. package/dist/config-Cf7EjAMf.mjs +0 -292
  79. package/dist/dev-Bw_qYWWq.mjs +0 -755
  80. package/dist/dev-lock-DWSpa6nj.mjs +0 -179
  81. package/dist/perf-C75MZ73h.mjs +0 -167
  82. package/dist/perf-DPbLGhhO.mjs +0 -49
@@ -5,14 +5,16 @@ import { JamSurface, useLaneLift } from './JamSurface.tsx'
5
5
  import { JamButton } from './jam-session.tsx'
6
6
  import { useJamCapture } from './jam-capture.ts'
7
7
  import { useJamQueue } from './jam-queue.ts'
8
- import { Component, useEffect, useRef, useState, type MouseEvent as ReactMouseEvent, type ReactNode } from 'react'
9
- import { useStore, CONFIG, CANVAS_NAME, LOCKED_SHELL, PUBLISHED, SOURCE_REVEALED, logReload, takeReloadCause, addToBoard, boardLabel, cap, humanize, fetchBoardNames, landingBoard, tabTitle, hydrateBoardPolicy, landingMode, playsAsSlides, sceneLabel, type FrameEntry } from './store.ts'
8
+ import { Component, useEffect, useLayoutEffect, useRef, useState, type MouseEvent as ReactMouseEvent, type ReactNode } from 'react'
9
+ import { useStore, BOARD_GONE, CONFIG, CANVAS_NAME, DISK_WON, LOCKED_SHELL, PUBLISHED, SOURCE_REVEALED, stoppedFor, logReload, takeReloadCause, addToBoard, boardLabel, cap, humanize, fetchBoardNames, landingBoard, tabTitle, hydrateBoardPolicy, landingMode, playsAsSlides, sceneLabel, switchCount, type FrameEntry } from './store.ts'
10
10
  import { AddToBoard, BoardList } from './BoardList.tsx'
11
11
  import { ContextMenu, copyToClipboard, framePath, useContextMenu, type MenuItem } from './ContextMenu.tsx'
12
12
  import { Tip } from './Tip.tsx'
13
13
  import { PKG, ROUTE } from '../const.ts'
14
+ import { api, resumed, scoped, useLink } from './api.ts'
14
15
  import { animateLayout, Canvas, canvasCtl } from './canvas/Canvas.tsx'
15
- import { frameByWindow } from './canvas/frame-registry.ts'
16
+ import { frameByWindow, fromLiveDocument } from './canvas/frame-registry.ts'
17
+ import { recorder } from './recorder.ts'
16
18
  import { enterFocus, enterPlay, enterSlides, playCtl, PlayOverlay } from './Play.tsx'
17
19
  import { bootHash, linkTargets, parseHash, retargetBoot, UNPLACED, writeHash } from './hash.ts'
18
20
  import { isLegacyLink, landLegacy } from './legacy-links.ts'
@@ -21,7 +23,7 @@ import { ALL_SCENES, humanize as slugLabel, readTitle } from '../../shared/board
21
23
  import { CommentsController, parkThread, revealThread } from './Comments.tsx'
22
24
  import { poweredByUrl } from '../../shared/utm.ts'
23
25
  import { avatarFallback, NO_COMMENTS_HERE, useComments } from './comments-store.ts'
24
- import { goTo, isLatest, navigated, revealFrame } from './goto.ts'
26
+ import { goTo, isLatest, navigated, revealFrame, switchFor } from './goto.ts'
25
27
  import { useNotes } from './notes.ts'
26
28
  import { contentOnly } from '../../shared/frames.ts'
27
29
  import { nextToLook } from '../../shared/marks.ts'
@@ -69,6 +71,10 @@ function SceneGroup({ name, label, count, held, renaming, onRename, onPick, onCo
69
71
  export class ShellBoundary extends Component<{ children: ReactNode }, { err: Error | null }> {
70
72
  state = { err: null as Error | null }
71
73
  static getDerivedStateFromError(err: Error) { return { err } }
74
+ // the recorder's (spec 28 A1.7): the error, and the component it came from
75
+ componentDidCatch(err: Error, info: { componentStack?: string | null }) {
76
+ recorder.error({ source: 'shell', message: err.message, stack: err.stack, component: /\bat (\w+)/.exec(info.componentStack ?? '')?.[1] })
77
+ }
72
78
  render() {
73
79
  if (!this.state.err) return this.props.children
74
80
  return (
@@ -254,10 +260,10 @@ function UpdatePill() {
254
260
  const play = useStore((s) => s.play)
255
261
  useEffect(() => {
256
262
  if (PUBLISHED) return // a shared canvas never nags its viewers
257
- fetch(`${ROUTE}/api/update`)
263
+ api('update')
258
264
  .then((r) => (r.ok ? r.json() : null))
259
265
  .then((u) => {
260
- if (u?.latest && localStorage.getItem('mv-update-seen') !== u.latest) setLatest(u.latest)
266
+ if (u?.latest && localStorage.getItem(scoped('mv-update-seen')) !== u.latest) setLatest(u.latest)
261
267
  })
262
268
  .catch(() => { /* dev server gone or endpoint absent - stay quiet */ })
263
269
  }, [])
@@ -265,7 +271,7 @@ function UpdatePill() {
265
271
  // init rides along so managed files (AGENTS.md, instructions/) refresh with the code
266
272
  const cmd = `npm i -D ${PKG}@latest && npx marver init`
267
273
  const dismiss = () => {
268
- try { localStorage.setItem('mv-update-seen', latest) } catch { /* storage unavailable */ }
274
+ try { localStorage.setItem(scoped('mv-update-seen'), latest) } catch { /* storage unavailable */ }
269
275
  setLatest(null)
270
276
  }
271
277
  return (
@@ -344,6 +350,7 @@ export function App() {
344
350
  // re-rendered the entire shell on every setScale tick during a pan/zoom).
345
351
  useSeenOnScreen()
346
352
  const manifest = useStore((s) => s.manifest)
353
+ const stopped = useLink((s) => s.shown) // the canvas stopped (spec 28 A1.11): nothing leaves this page
347
354
  const nodes = useStore((s) => s.nodes)
348
355
  const panelOpen = useStore((s) => s.panelOpen)
349
356
  const laneLift = useLaneLift()
@@ -376,7 +383,7 @@ export function App() {
376
383
  // dev: hydrate board policy (slides/type/open) from the repo so P and
377
384
  // deep links preview exactly what viewers get
378
385
  try {
379
- const r = await fetch(`${ROUTE}/api/policy`)
386
+ const r = await api('policy')
380
387
  if (r.ok) hydrateBoardPolicy(((await r.json()) as { boards?: Record<string, never> }).boards ?? {})
381
388
  } catch { /* dev server without the route - fine */ }
382
389
  }
@@ -398,6 +405,11 @@ export function App() {
398
405
  }
399
406
  const ok = await boot()
400
407
  if (notice) toast(notice)
408
+ // the page before this one reloaded itself when its canvas came back (A1.11): what its save came to - saved, or
409
+ // the board's file won on disk, or the board was gone
410
+ if (ok && resumed?.outcome === 'saved') toast('Back - your edits were saved')
411
+ else if (resumed?.outcome === 'disk') toast(DISK_WON)
412
+ else if (resumed?.outcome === 'gone') toast(BOARD_GONE)
401
413
  urlReady.current = true
402
414
  // a link naming frames on a board with NO nodes: the canvas's boot fit never runs (it waits
403
415
  // for the first frame) - follow the frame to where it lives from here
@@ -447,7 +459,15 @@ export function App() {
447
459
  // selection against the newly loaded state. writeHash skips identical hashes, so
448
460
  // restores never echo back into history.
449
461
  useEffect(() => {
462
+ // the switch a navigation started, while it may still run: back/forward, a pasted link and `location.hash =` each
463
+ // fire popstate AND hashchange, and a second switch to the same board would supersede the first - a second board
464
+ // fetch, and a load that never committed in perf --loads
465
+ let routing: { hash: string; switches: number } | null = null
450
466
  const onPop = async () => {
467
+ // the same hash, and no switch or cancel since this router started its own (a board picked, a goto, a newer
468
+ // navigation): the second event of the navigation the first is carrying through - board, frame and view
469
+ if (routing && routing.hash === location.hash && routing.switches === switchCount()) return
470
+ const raw = location.hash
451
471
  const nav = navigated() // a reveal still looking up its board must not land after this
452
472
  // a lookup below still running when newer navigation lands - a link, a board picked, a step in play - is dropped
453
473
  const at = useStore.getState().board, step = useStore.getState().play?.at
@@ -473,9 +493,15 @@ export function App() {
473
493
  let s = useStore.getState()
474
494
  if (h.board && h.board !== s.board) {
475
495
  if (s.play) s.setPlay(null) // a stale overlay must never survive into another board
476
- await s.switchBoard(h.board)
496
+ const switched = switchFor(h.board, nav)
497
+ const mine = routing = { hash: raw, switches: switchCount() }
498
+ const landed = await switched
499
+ if (routing === mine) routing = null
500
+ // the switch failed (the projection effect re-syncs the URL), or a newer navigation came while this one's board
501
+ // was read - a link, a goto, a board picked - and may have landed on this same board first: the board is the
502
+ // newer one's then, and so are the selection, the mode and the camera
503
+ if (!landed) return
477
504
  s = useStore.getState()
478
- if (s.board !== h.board) return // switch failed; the projection effect will re-sync the URL
479
505
  }
480
506
  // the thread an old link names (Comments.tsx opens every other link's): now, or once the new board's comments load
481
507
  if (legacy && h.c) { if (s.board !== at) parkThread(h.c); else revealThread(h.c) }
@@ -493,13 +519,14 @@ export function App() {
493
519
  useStore.setState({ selection: keys })
494
520
  s.look(keys) // a link opened is a look
495
521
  if (!keys.length && h.f?.length) void revealFrame(h.f[0]) // not on this board - where it lives
496
- else setTimeout(() => (keys.length ? canvasCtl.fitNodes(keys) : canvasCtl.fitAll()), 60)
522
+ else setTimeout(() => { if (isLatest(nav)) (keys.length ? canvasCtl.fitNodes(keys) : canvasCtl.fitAll()) }, 60) // unless a newer navigation has the camera
497
523
  }
498
524
  }
499
525
  // hashchange too: pasting a link into the same tab or editing the URL bar changes
500
526
  // the hash WITHOUT a popstate - ignoring it let the projection rewrite the URL back.
501
527
  // Our own writeHash never fires either event (history API), so there is no echo;
502
- // back/forward fires both, and the handler is idempotent under the double call.
528
+ // back/forward fires both: the second finds the first's switch on its way and leaves it
529
+ // be (above) - without a switch, the handler is idempotent under the double call.
503
530
  window.addEventListener('popstate', onPop)
504
531
  window.addEventListener('hashchange', onPop)
505
532
  return () => { window.removeEventListener('popstate', onPop); window.removeEventListener('hashchange', onPop) }
@@ -624,14 +651,15 @@ export function App() {
624
651
 
625
652
  if (data.type === 'sh:ready') {
626
653
  // a WindowProxy survives navigation, so a ready queued by a SUPERSEDED document (one the
627
- // ready-watchdog auto-renavigated past) can arrive here; drop it by generation like
628
- // sh:measure does, so a stale ready never marks a reloading frame ready.
629
- const gen = el.src.match(/[?&]r=(\d+)/)?.[1] ?? ''
630
- if (String(data.gen ?? '') !== gen) return
654
+ // ready-watchdog auto-renavigated past, or a same-URL reload's predecessor) can arrive here;
655
+ // dropped by generation and document before it touches anything, so a stale ready never marks
656
+ // a reloading frame ready, frees its admission slot or counts as seen
657
+ if (!fromLiveDocument(el, data)) return
631
658
  // a document that loaded again on its own (a full reload) is a new source revision: the
632
659
  // sleeping override of the previous document must not be trusted for this one
633
660
  if (s.nodes.find((n) => n.key === nodeKey)?.status === 'ready') s.bumpRev(nodeKey)
634
661
  s.setStatus(nodeKey, 'ready')
662
+ recorder.ready(nodeKey, data)
635
663
  frameReady(nodeKey)
636
664
  // the revision this document was served with (spec 26): a look counts up to it, and one older
637
665
  // than the frame's last edit reloads
@@ -639,7 +667,12 @@ export function App() {
639
667
  if (typeof data.doc === 'string') s.setShown(nodeKey, data.doc)
640
668
  logReload({ kind: 'ready', cause: takeReloadCause(nodeKey) ?? (before === undefined ? 'first' : 'self'), node: nodeKey, frame: String(data.id ?? ''), shown: typeof data.doc === 'string' ? data.doc : undefined, ms: Number(data.phases?.commit) })
641
669
  } else if (data.type === 'sh:error') {
670
+ // the same guard as sh:ready: an error from a document since replaced fails nothing and is not recorded
671
+ if (!fromLiveDocument(el, data)) return
642
672
  s.setStatus(nodeKey, 'error', String(data.message ?? 'unknown error'))
673
+ recorder.frameError(nodeKey, data)
674
+ } else if (data.type === 'sh:boot') {
675
+ recorder.booted(nodeKey, data) // a new document: its node's outcome starts over (spec 28 A1.7)
643
676
  } else if (data.type === 'sh:exit-interact') {
644
677
  if (s.interact === nodeKey) setInteract(null)
645
678
  } else if (data.type === 'sh:theme-applied') {
@@ -647,16 +680,16 @@ export function App() {
647
680
  } else if (data.type === 'sh:hmr') {
648
681
  s.bumpRev(nodeKey)
649
682
  } else if (data.type === 'sh:measure') {
650
- // Generation guard: the sender echoes ITS document's URL rev; a
683
+ // Generation and document guard: the sender echoes ITS document's URL rev and id; a
651
684
  // WindowProxy survives navigation, so a stale pre-navigation message would
652
- // otherwise route as if it came from the current document. Compare against
653
- // the iframe's CURRENT src - mismatched generations are dropped.
654
- const gen = el.src.match(/[?&]r=(\d+)/)?.[1] ?? ''
655
- if (String(data.gen ?? '') !== gen) return
685
+ // otherwise route as if it came from the current document. Compared against
686
+ // the iframe's CURRENT src and document - a stale one moves and keeps nothing.
687
+ if (!fromLiveDocument(el, data)) return
656
688
  // measureNode does the rest of the admission (content frames only,
657
689
  // frame-id match, finite positive, clamped)
658
- s.measureNode(nodeKey, String(data.frame ?? ''), Number(data.ownWidth), Number(data.measuredWidth), Number(data.height),
690
+ const took = s.measureNode(nodeKey, String(data.frame ?? ''), Number(data.ownWidth), Number(data.measuredWidth), Number(data.height),
659
691
  typeof data.settled === 'boolean' ? data.settled : undefined)
692
+ recorder.measured(nodeKey, data, took)
660
693
  } else if (data.type === 'sh:laser-copy') {
661
694
  // laser click = copy the element's full address for the agent: WHERE it lives on
662
695
  // the canvas ([board ▸ scene]) + frame source file + css path (+ jsx source loc)
@@ -761,6 +794,7 @@ export function App() {
761
794
  if (e.key === 'c' && !e.shiftKey) {
762
795
  const c = commentsStore()
763
796
  if (!c.commentMode && s.board === UNPLACED) return void toast(NO_COMMENTS_HERE)
797
+ if (!c.commentMode && stoppedFor('Comments need the canvas running')) return
764
798
  if (!c.commentMode) s.setLaser(false)
765
799
  c.setMode(!c.commentMode)
766
800
  toast(c.commentMode ? 'comment mode off' : 'comment mode - click an element in a frame')
@@ -1067,6 +1101,7 @@ export function App() {
1067
1101
  {CONFIG.setup
1068
1102
  ? <div className="sh-banner">no app detected - designs would be built from nothing. See design/instructions/setup.md, then restart</div>
1069
1103
  : 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>}
1104
+ {stopped && <StoppedBanner />}
1070
1105
  <UpdatePill />
1071
1106
 
1072
1107
  {/* Jam V2 (spec 27): the lane, the focus panel, the notes card, the recording ring */}
@@ -1076,6 +1111,124 @@ export function App() {
1076
1111
  )
1077
1112
  }
1078
1113
 
1114
+ /** The canvas stopped (spec 28 A1.11): what happened and the way back - and, only when this tab holds some, that
1115
+ * its unsaved edits are kept. It sits on the toolbar's centre line in the free gap between the sidebar and the
1116
+ * toolbar, or just below the toolbar row when that gap is too narrow; it never covers either, and Hide UI (H)
1117
+ * leaves it up. In play it wears the play chrome's dark skin. */
1118
+ function StoppedBanner() {
1119
+ const link = useLink((s) => s.link)
1120
+ const unsaved = useLink((s) => s.unsaved)
1121
+ const play = useStore((s) => !!s.play)
1122
+ const ref = useRef<HTMLDivElement>(null)
1123
+ const cmd = <code>npx marver dev</code>
1124
+ const what = link === 'resuming' ? <>This canvas is back{unsaved ? ' - saving your edits' : ''}</>
1125
+ : link === 'elsewhere' ? <>Another canvas is running on this address - stop it and run {cmd} to bring this one back</>
1126
+ : <>This canvas stopped - run {cmd} to bring it back</>
1127
+ const kept = unsaved && link !== 'resuming'
1128
+ useLayoutEffect(() => {
1129
+ const el = ref.current
1130
+ if (!el) return
1131
+ let raf = 0
1132
+ const place = () => { cancelAnimationFrame(raf); raf = 0; placeBanner(el) }
1133
+ const soon = () => { raf ||= requestAnimationFrame(place) }
1134
+ place()
1135
+ // what moves the gap: the window, the chrome around it opening, closing or changing size, play, Hide UI
1136
+ const seen = new Set<Element>()
1137
+ const ro = new ResizeObserver(soon)
1138
+ const watch = () => { for (const n of el.parentElement?.querySelectorAll(OBSTACLES) ?? []) if (!seen.has(n)) { seen.add(n); ro.observe(n) } }
1139
+ watch()
1140
+ const mo = new MutationObserver(() => { watch(); soon() })
1141
+ if (el.parentElement) mo.observe(el.parentElement, { childList: true, subtree: true, attributes: true, attributeFilter: ['class'] })
1142
+ mo.observe(document.body, { attributes: true, attributeFilter: ['class'] })
1143
+ window.addEventListener('resize', soon)
1144
+ return () => { cancelAnimationFrame(raf); ro.disconnect(); mo.disconnect(); window.removeEventListener('resize', soon) }
1145
+ }, [link, unsaved, play])
1146
+ return (
1147
+ <div ref={ref} className={`sh-banner sh-stopped${play ? ' dark' : ''}`} role="status" data-link={link}>
1148
+ {what}{kept && <><span className="dot"> · </span><span className="kept">your unsaved edits are kept in this tab</span></>}
1149
+ </div>
1150
+ )
1151
+ }
1152
+
1153
+ /** The chrome the stopped banner keeps clear of: the sidebar (or its button) on the left, the toolbar (or its
1154
+ * button) on the right - the canvas's own, or play's brand and toolbar pills over it. */
1155
+ const OBSTACLES = ':scope > .sh-panel, :scope > .sh-fab, :scope > nav.sh-pill, :scope > .sh-pill-fab, :scope > .sh-play > .sh-pill, :scope > .sh-play > .sh-pill-fab'
1156
+ const BANNER_GAP = 12
1157
+ function placeBanner(el: HTMLElement) {
1158
+ const app = el.parentElement
1159
+ if (!app) return
1160
+ const edge = parseFloat(getComputedStyle(app).getPropertyValue('--edge')) || 10
1161
+ // a box in the app's own coordinates, from layout - never the rect mid-morph (a closing panel scales down)
1162
+ const box = (n: HTMLElement) => {
1163
+ let x = 0, y = 0
1164
+ for (let e: HTMLElement | null = n; e && e !== app; e = e.offsetParent as HTMLElement | null) { x += e.offsetLeft; y += e.offsetTop }
1165
+ return { left: x, top: y, right: x + n.offsetWidth, bottom: y + n.offsetHeight }
1166
+ }
1167
+ const pick = (root: Element, sel: string) => {
1168
+ const n = root.querySelector<HTMLElement>(sel)
1169
+ return n && !n.matches('.closed, .hidden') && n.offsetWidth ? box(n) : null
1170
+ }
1171
+ let left: ReturnType<typeof box> | null = null, right: ReturnType<typeof box> | null = null
1172
+ if (!document.body.classList.contains('sh-hide-ui')) {
1173
+ const stage = app.querySelector(':scope > .sh-play')
1174
+ if (stage) {
1175
+ left = pick(stage, ':scope > .sh-play-brand')
1176
+ right = pick(stage, ':scope > .sh-play-pill:not(.sh-play-brand)') ?? pick(stage, ':scope > .sh-pill-fab')
1177
+ } else {
1178
+ left = pick(app, ':scope > .sh-panel') ?? pick(app, ':scope > .sh-fab')
1179
+ right = pick(app, ':scope > nav.sh-pill') ?? pick(app, ':scope > .sh-pill-fab')
1180
+ }
1181
+ }
1182
+ // the toolbar row: its centre line, and its foot - the sidebar runs down the page, so it is no part of the row
1183
+ const tall = !!left && left.bottom - left.top > 64
1184
+ const row = [right, tall ? null : left].filter((b): b is NonNullable<typeof b> => !!b)
1185
+ const mid = row.length ? Math.max(...row.map((b) => (b.top + b.bottom) / 2)) : edge + 23
1186
+ const foot = Math.max(edge + 46, ...row.map((b) => b.bottom))
1187
+ const W = app.clientWidth
1188
+ const from = left ? left.right + BANNER_GAP : edge, to = right ? right.left - BANNER_GAP : W - edge
1189
+ const at = (where: 'row' | 'stack' | 'below', x0: number, x1: number, top?: number) => {
1190
+ el.dataset.at = where
1191
+ el.style.left = `${Math.round(x0 + Math.max(0, (x1 - x0 - el.offsetWidth) / 2))}px`
1192
+ el.style.top = `${Math.round(top ?? mid - el.offsetHeight / 2)}px`
1193
+ }
1194
+ el.style.transform = 'none'
1195
+ el.dataset.at = 'row'
1196
+ // one line in the gap
1197
+ el.style.whiteSpace = 'nowrap'
1198
+ el.style.maxWidth = 'none'
1199
+ const line = el.offsetHeight
1200
+ if (el.offsetWidth <= to - from) return at('row', from, to)
1201
+ // two lines in the gap: what happened, then the kept edits under it
1202
+ if (el.querySelector('.kept')) {
1203
+ el.dataset.at = 'stack'
1204
+ if (el.offsetWidth <= to - from) return at('stack', from, to)
1205
+ el.dataset.at = 'row'
1206
+ }
1207
+ // or wrapped in two, the box no wider than its longest line
1208
+ el.style.whiteSpace = 'normal'
1209
+ el.style.maxWidth = `${to - from}px`
1210
+ if (to - from >= 220 && el.offsetHeight <= line + 18) { hug(el); return at('row', from, to) }
1211
+ // too narrow: under the toolbar row, centred in what the sidebar leaves, the kept edits on a line of their own
1212
+ el.dataset.at = 'below'
1213
+ const lo = tall && left ? left.right + BANNER_GAP : edge, hi = W - edge
1214
+ el.style.maxWidth = `${Math.max(160, Math.min(680, hi - lo))}px`
1215
+ hug(el)
1216
+ at('below', lo, hi, row.length ? foot + 8 : edge) // no row with the chrome hidden: the top edge
1217
+ }
1218
+ /** A wrapped banner's box shrinks to its longest line (a max-width box stays as wide as it may be). */
1219
+ function hug(el: HTMLElement) {
1220
+ const r = document.createRange()
1221
+ r.selectNodeContents(el)
1222
+ const lines = [...r.getClientRects()]
1223
+ if (!lines.length) return
1224
+ const cs = getComputedStyle(el)
1225
+ const chrome = el.offsetWidth - el.clientWidth + parseFloat(cs.paddingLeft) + parseFloat(cs.paddingRight)
1226
+ const need = Math.ceil(Math.max(...lines.map((l) => l.right)) - Math.min(...lines.map((l) => l.left)) + chrome) + 1
1227
+ const was = el.style.maxWidth, h = el.offsetHeight
1228
+ el.style.maxWidth = `${Math.min(need, el.offsetWidth)}px`
1229
+ if (el.offsetHeight > h) el.style.maxWidth = was // never a line more than it had (a balanced wrap re-flows)
1230
+ }
1231
+
1079
1232
  /** The bottom-right notification corner. Plain toasts render as before.
1080
1233
  * Jam pills are FRAME-FIRST (icon + frame title, then Marver · preview) and stack as a DECK:
1081
1234
  * 1-2 show in full; 3+ collapse to the newest pill with two card edges peeking beneath and a
@@ -1129,10 +1282,12 @@ function JamAvatar({ author }: { author: { name?: string; avatar?: string; id?:
1129
1282
  async function viewNote(note: import('./store.ts').JamNote, dismiss: () => void) {
1130
1283
  if (revealThread(note.threadId)) { dismiss(); return }
1131
1284
  const s = useStore.getState()
1285
+ // a navigation: a link still finding its board gives way to it - and it to a newer one, wherever this one has got to
1286
+ const nav = navigated()
1132
1287
  // a thread in the old all-scenes log has no board of its own: its frame's board shows it (spec 26)
1133
- if (note.board === ALL_SCENES) { if (note.frame) await revealFrame(note.frame) }
1134
- else if (note.board && s.board !== note.board) await s.switchBoard(note.board)
1135
- for (let i = 0; i < 12; i++) {
1288
+ if (note.board === ALL_SCENES) { if (note.frame) await revealFrame(note.frame, nav) }
1289
+ else if (note.board && s.board !== note.board && !await switchFor(note.board, nav)) return
1290
+ for (let i = 0; i < 12 && isLatest(nav); i++) {
1136
1291
  if (revealThread(note.threadId)) { dismiss(); return }
1137
1292
  await new Promise((r) => setTimeout(r, 250))
1138
1293
  }
@@ -1,12 +1,13 @@
1
1
  import { useEffect, useRef, useState, type CSSProperties, type MouseEvent as ReactMouseEvent, type PointerEvent as ReactPointerEvent, type ReactNode } from 'react'
2
2
  import { useStore, PUBLISHED, STATUS_AS_OF, addToBoard, boardLabel, fetchBoardNames, fetchBoardTree, fetchMembership, rememberMeta, rememberTitles, type BoardMeta, type TreeBase } from './store.ts'
3
3
  import { UNPLACED } from './hash.ts'
4
+ import { scoped } from './api.ts'
4
5
  import { LiveIcon, StatusIcon, TypeIcon } from './board-icons.tsx'
5
6
  import { StatusPicker } from './StatusPicker.tsx'
6
7
  import type { StatusWord } from '../../shared/board-types.ts'
7
8
  import { PHASE_LABEL, STATUS_LABEL } from '../../shared/status.ts'
8
9
  import { canvasCtl } from './canvas/Canvas.tsx'
9
- import { navigated } from './goto.ts'
10
+ import { isLatest, navigated, switchFor } from './goto.ts'
10
11
  import { rollup } from '../../shared/marks.ts'
11
12
  import { Bubble, useAsks } from './marks-ui.tsx'
12
13
  import { Tip } from './Tip.tsx'
@@ -28,7 +29,7 @@ import {
28
29
  * Active board = accent icon + wash, same language as scenes.
29
30
  */
30
31
 
31
- const CLOSED_KEY = 'mv-folders-closed' // collapsed folders are a viewer preference, never data
32
+ const CLOSED_KEY = scoped('mv-folders-closed') // collapsed folders are a viewer preference, per canvas, never data
32
33
  const readClosed = (): Record<string, true> => { try { return JSON.parse(localStorage.getItem(CLOSED_KEY) ?? '{}') } catch { return {} } }
33
34
 
34
35
  /** The inline input: renaming a board or a folder, or naming a NEW folder that does not exist
@@ -171,9 +172,8 @@ export function BoardList({ onMenu }: { onMenu: MenuOpener }) {
171
172
  }
172
173
  const pick = async (name: string) => {
173
174
  if (name === useStore.getState().board) return
174
- navigated() // a link still finding its board gives way
175
- await useStore.getState().switchBoard(name)
176
- setTimeout(() => canvasCtl.fitAll(), 60)
175
+ const nav = navigated() // a link still finding its board gives way
176
+ if (await switchFor(name, nav)) setTimeout(() => { if (isLatest(nav)) canvasCtl.fitAll() }, 60) // unless a newer one has the camera
177
177
  }
178
178
 
179
179
  /** The one write path: queue the intent, show it at once, persist. The flush takes EVERY
@@ -8,6 +8,7 @@
8
8
  import { useEffect, useMemo, useRef, useState } from 'react'
9
9
  import { createPortal } from 'react-dom'
10
10
  import { avatarFallback, useComments } from './comments-store.ts'
11
+ import { api } from './api.ts'
11
12
  import { CONFIG, useStore, type Node } from './store.ts'
12
13
  import { threadHostKey } from './keys.ts'
13
14
  import { isNoteAnchor, resolveNoteAnchor, useNotes } from './notes.ts'
@@ -21,7 +22,7 @@ import { TagStatus } from './jam-ui.tsx'
21
22
  import { CaptureBlock } from './jam-panel.tsx'
22
23
  import { useJamQueue } from './jam-queue.ts'
23
24
  import { mentionAlerts, mentionPeople, mentionQueryAt, parseBody, type MentionPerson } from './mentions.ts'
24
- import { ROUTE, slideSize, stageFit } from '../const.ts'
25
+ import { slideSize, stageFit } from '../const.ts'
25
26
  import type { AgentMeta, Thread } from '../../shared/events.ts'
26
27
 
27
28
  /** Tint the pin / composer / thread card EDGES (border, outline, focus ring) in the anchored
@@ -901,7 +902,7 @@ export function IdentityDialog() {
901
902
  // an invite link knows WHO it's for - show it (the token is the proof of holding)
902
903
  useEffect(() => {
903
904
  if (!needs || !invite) return setInvitedAs('')
904
- fetch(`${ROUTE}/api/invite-info?token=${encodeURIComponent(invite)}`)
905
+ api(`invite-info?token=${encodeURIComponent(invite)}`)
905
906
  .then((r) => (r.ok ? r.json() : null))
906
907
  .then((d) => d?.email && setInvitedAs(d.email))
907
908
  .catch(() => { /* chip just stays hidden */ })
@@ -22,10 +22,12 @@ import { clearMoreDraft, EdgeRing } from './jam-panel.tsx'
22
22
  import { useComments } from './comments-store.ts'
23
23
  import { HARNESS } from './Comments.tsx'
24
24
  import { PUBLISHED, useStore } from './store.ts'
25
+ import { api, withWs } from './api.ts'
25
26
  import type { CaptureRecord } from '../../server/jam/types.ts'
26
27
 
27
28
  const csrf = () => /(?:^|;\s*)mv_c=([\w-]+)/.exec(document.cookie)?.[1] ?? ''
28
- const picture = (id?: string) => (id ? `${ROUTE}/api/jam/picture?id=${encodeURIComponent(id)}` : undefined)
29
+ /** An <img> cannot send a header: its URL names the workspace, which the server's guard reads (A1.11). */
30
+ const picture = (id?: string) => (id ? withWs(`${ROUTE}/api/jam/picture?id=${encodeURIComponent(id)}`) : undefined)
29
31
 
30
32
  /** Is the lane showing? While a run lasts with a capture in it, or a capture records. */
31
33
  export function useLaneShown(): boolean {
@@ -44,7 +46,7 @@ function useRecord(id: string | undefined) {
44
46
  useEffect(() => {
45
47
  if (!id || rec?.id === id) return
46
48
  let live = true
47
- fetch(`${ROUTE}/api/jam/capture?id=${encodeURIComponent(id)}`, { headers: { 'x-mv-c': csrf() } })
49
+ api(`jam/capture?id=${encodeURIComponent(id)}`, { headers: { 'x-mv-c': csrf() } })
48
50
  .then((r) => (r.ok ? r.json() : null)).then((r) => { if (live && r?.record) setRec({ id, record: r.record, edited: r.edited }) }, () => {})
49
51
  return () => { live = false }
50
52
  }, [id])
@@ -15,6 +15,7 @@ import { enterFocus, enterPlay, enterSlides, PlayOverlay, playCtl } from './Play
15
15
  import { UNPLACED, bootHash, parseHash, retargetBoot, writeHash } from './hash.ts'
16
16
  import { isLegacyLink, landLegacy } from './legacy-links.ts'
17
17
  import { useComments } from './comments-store.ts'
18
+ import { isLatest, navigated, switchFor } from './goto.ts'
18
19
 
19
20
  export class ShellBoundary extends Component<{ children: ReactNode }, { err: Error | null }> {
20
21
  state = { err: null as Error | null }
@@ -96,10 +97,9 @@ export function App() {
96
97
 
97
98
  // back/forward + pasted links, within what the lock allows
98
99
  useEffect(() => {
99
- let popSeq = 0
100
100
  const onPop = async () => {
101
- // a lookup newer navigation overtook - a link, a step on the stage - is dropped
102
- const mine = ++popSeq, was = useStore.getState()
101
+ // a lookup newer navigation overtook - a link, a goto, a step on the stage - is dropped
102
+ const nav = navigated(), was = useStore.getState()
103
103
  const parsed = parseHash()
104
104
  const raw = parsed.board === UNPLACED ? {} : parsed // dev's view, and what it names: not here
105
105
  // an old All Scenes link lands on a real board; it, and the bare #/, with no board: the landing one
@@ -107,11 +107,11 @@ export function App() {
107
107
  const h = r.hash
108
108
  const board = h.board ?? (h.focus ? undefined : await landingBoard())
109
109
  const s = useStore.getState()
110
- if (mine !== popSeq || s.board !== was.board || s.play?.at !== was.play?.at) return
110
+ if (!isLatest(nav) || s.board !== was.board || s.play?.at !== was.play?.at) return
111
111
  if (r.notice) s.toast(r.notice)
112
112
  if (h.c) pendingThread = h.c
113
113
  if (board && board !== s.board) {
114
- await s.switchBoard(board)
114
+ if (!await switchFor(board, nav)) return // failed, or a newer navigation's board and stage by now
115
115
  useStore.getState().setPlay(null) // the stage restarts on the board the link names, at its frame
116
116
  if (h.play?.slides) enterSlides(h.play)
117
117
  else if (h.play) enterPlay(h.play)
@@ -16,15 +16,17 @@ import { jamKey } from './jam-keys.ts'
16
16
  import { letGoOfTile } from './jam-state.ts'
17
17
  import { JamButton } from './jam-session.tsx'
18
18
  import { useEffect, useRef, useState } from 'react'
19
- import { useStore, BOARD_POLICY, BRANDING, CONFIG, PUBLISHED, SOURCE_REVEALED, boardLabel, boardLocked, cap, fetchBoardNames, modeAllowed, playsAsSlides, SLIDE_INTRINSIC, type Node } from './store.ts'
19
+ import { useStore, BOARD_POLICY, BRANDING, CONFIG, PUBLISHED, SOURCE_REVEALED, boardLabel, boardLocked, cap, fetchBoardNames, modeAllowed, playsAsSlides, SLIDE_INTRINSIC, stoppedFor, type Node } from './store.ts'
20
20
  import { deckOrder } from './play-order.ts'
21
21
  import { NO_COMMENTS_HERE, useComments } from './comments-store.ts'
22
22
  import { UNPLACED } from './hash.ts'
23
23
  import { isNoteAnchor } from './notes.ts'
24
24
  import { ROUTE, slideSize } from '../const.ts'
25
+ import { stranded, withWs } from './api.ts'
25
26
  import { poweredByUrl } from '../../shared/utm.ts'
26
27
  import { canvasCtl } from './canvas/ctl.ts'
27
- import { revealFrame } from './goto.ts'
28
+ import { recorder } from './recorder.ts'
29
+ import { revealFrame, switchFor } from './goto.ts'
28
30
  import { Tip } from './Tip.tsx'
29
31
  import { keyAllowed } from '../frame-host/keys.js'
30
32
  import { CommentButton, DevicePicker, HideUIButton, isHideUI, LaserButton, Popover, ThemePicker, toggleHideUI, usePopover } from './Toolbar.tsx'
@@ -147,8 +149,9 @@ async function switchPlayBoard(name: string) {
147
149
  const s = useStore.getState()
148
150
  if (name === s.board) return
149
151
  const device = s.play?.device // the device is the viewer's choice - it survives the switch
150
- await s.switchBoard(name)
151
- if (useStore.getState().board !== name) return
152
+ // a navigation like any other: a link still reading its board gives way to it, and it to a newer one - which then
153
+ // has the board, the stage and the camera
154
+ if (!await switchFor(name)) return
152
155
  const dev = device && device !== 'slide' ? { device } : undefined // the deck's own size does not follow to a prototype
153
156
  if (playsAsSlides(name)) enterSlides(device ? { device } : undefined)
154
157
  else enterPlay(dev)
@@ -305,10 +308,12 @@ function PlayInner() {
305
308
  const slParams = (p: { slides?: boolean }) => p.slides
306
309
  ? `&slides=1${BOARD_POLICY[useStore.getState().board]?.transition === 'none' ? '&tr=none' : ''}`
307
310
  : ''
308
- const src = useRef(play ? `${ROUTE}/stage/?at=${encodeURIComponent(play.at)}&theme=${encodeURIComponent(play.theme)}${slParams(play)}` : '')
311
+ // the stage runs the project's frames: its URL names the workspace like a frame's (A1.11)
312
+ const src = useRef(play ? withWs(`${ROUTE}/stage/?at=${encodeURIComponent(play.at)}&theme=${encodeURIComponent(play.theme)}${slParams(play)}`) : '')
309
313
  const [win, setWin] = useState({ w: window.innerWidth, h: window.innerHeight })
310
314
  const [pillOpen, setPillOpen] = useState(true) // collapse (pill -> re-open fab), like the canvas
311
315
  const [stageReady, setStageReady] = useState(0) // bumps on each sh:stage-ready (reload) - re-drives the highlight
316
+ const [away, setAway] = useState(false) // the stage shows another project's "another canvas" page (A1.11)
312
317
  const fill = play?.device === 'fill'
313
318
  // the mode's shape: focus is single-frame; the doc preset (reading width,
314
319
  // page ground) applies when the board's declared type is doc; lock and deep
@@ -334,7 +339,7 @@ function PlayInner() {
334
339
  if (!playNav || !iframeRef.current) return
335
340
  const p = useStore.getState().play
336
341
  if (!p) return
337
- iframeRef.current.src = `${ROUTE}/stage/?at=${encodeURIComponent(p.at)}&theme=${encodeURIComponent(p.theme)}${slParams(p)}&r=${playNav}`
342
+ iframeRef.current.src = withWs(`${ROUTE}/stage/?at=${encodeURIComponent(p.at)}&theme=${encodeURIComponent(p.theme)}${slParams(p)}&r=${playNav}`)
338
343
  }, [playNav])
339
344
  const applyUpdate = () => useStore.getState().applyPlayUpdate()
340
345
 
@@ -483,6 +488,7 @@ function PlayInner() {
483
488
  else {
484
489
  useStore.setState({ stageShown: null }) // an error card holds the stage now: nothing on it counts as seen
485
490
  s.toast(`play: ${String(data.message ?? 'frame error')}`)
491
+ recorder.error({ source: 'stage', message: data.message })
486
492
  if (s.playNav && !s.stageShown) useStore.setState({ playUpdateRevision: 'retry' }) // an Update that failed: offer it again
487
493
  }
488
494
  } else if (data.type === 'sh:stage-key') {
@@ -542,7 +548,7 @@ function PlayInner() {
542
548
  if (key === 'h') { toggleHideUI(); return }
543
549
  // L: the pointer laser; ⌥L: inspect
544
550
  if (key === 'l' && SOURCE_REVEALED) { commentsStore().setMode(false); useStore.getState().toggleLaser(alt); return }
545
- if (key === 'c') { const c = commentsStore(); if (!c.commentMode && useStore.getState().board === UNPLACED) return useStore.getState().toast(NO_COMMENTS_HERE); if (!c.commentMode) useStore.getState().setLaser(false); c.setMode(!c.commentMode); return }
551
+ if (key === 'c') { const c = commentsStore(); if (!c.commentMode && useStore.getState().board === UNPLACED) return useStore.getState().toast(NO_COMMENTS_HERE); if (!c.commentMode && stoppedFor('Comments need the canvas running')) return; if (!c.commentMode) useStore.getState().setLaser(false); c.setMode(!c.commentMode); return }
546
552
  if (key === 'C') { const c = commentsStore(); c.setShow(!c.show); return } // ⇧C hides/shows pins
547
553
  if (key === 'L') { const c = commentsStore(); c.setShowAnchor(!c.showAnchor); return } // ⇧L element focus
548
554
 
@@ -632,10 +638,12 @@ function PlayInner() {
632
638
  <iframe
633
639
  ref={iframeRef}
634
640
  src={src.current}
635
- onLoad={() => frameLoaded('stage', iframeRef.current)}
641
+ onLoad={() => { setAway(stranded(iframeRef.current)); frameLoaded('stage', iframeRef.current) }}
636
642
  title="play"
637
643
  style={{ width: vp.width, height: vp.height, transform: `scale(${dw / vp.width}, ${dh / vp.height})` }}
638
644
  />
645
+ {/* its canvas is away from this address: one calm line, the banner says the rest */}
646
+ {away && <div className="sh-stranded"><span>Waiting for this canvas</span></div>}
639
647
  </div>
640
648
  <PlayComments iframe={iframeRef} frameId={play.at} vp={vp} dw={dw} dh={dh} ready={stageReady} />
641
649
  </div>
@@ -8,7 +8,8 @@
8
8
  */
9
9
  import { createPortal } from 'react-dom'
10
10
  import { useEffect, useRef, useState, type ReactNode } from 'react'
11
- import { useStore, CONFIG, SOURCE_REVEALED, cap } from './store.ts'
11
+ import { useStore, CONFIG, SOURCE_REVEALED, cap, stoppedFor } from './store.ts'
12
+ import { STOPPED_TIP, useStopped } from './api.ts'
12
13
  import { NO_COMMENTS_HERE, useComments } from './comments-store.ts'
13
14
  import { UNPLACED } from './hash.ts'
14
15
  import { Tip } from './Tip.tsx'
@@ -115,7 +116,16 @@ export function CommentButton() {
115
116
  const myBoards = useComments((s) => s.myBoards)
116
117
  const board = useStore((s) => s.board)
117
118
  const asked = useRef(0)
119
+ const stopped = useStopped()
118
120
  const lockedOut = !!me && !!myBoards && myBoards[board] === 'view'
121
+ // the canvas stopped (spec 28 A1.11): off, saying why - a comment could not be sent
122
+ if (stopped && !commentMode) {
123
+ return (
124
+ <Tip side="bottom" label={<div className="sh-tip-lines"><b>Comments need the canvas running</b><small>{STOPPED_TIP}</small></div>}>
125
+ <button className="sh-pill-btn off" aria-disabled="true" data-stopped="" onClick={() => stoppedFor('Comments need the canvas running')}><CommentIcon size={16} /></button>
126
+ </Tip>
127
+ )
128
+ }
119
129
  if (lockedOut) {
120
130
  return (
121
131
  <Tip side="bottom" label={<><b>Commenting is not available for you yet</b><span>click to ask the owner</span></>}>
@@ -134,6 +144,7 @@ export function CommentButton() {
134
144
  <button className={`sh-pill-btn${commentMode ? ' on' : ''}`} onClick={() => {
135
145
  const c = commentsStore()
136
146
  if (!c.commentMode && useStore.getState().board === UNPLACED) return useStore.getState().toast(NO_COMMENTS_HERE)
147
+ if (!c.commentMode && stoppedFor('Comments need the canvas running')) return
137
148
  if (!c.commentMode) useStore.getState().setLaser(false)
138
149
  c.setMode(!c.commentMode)
139
150
  useStore.getState().toast(c.commentMode ? 'comment mode off' : 'comment mode - click an element in a frame')