@1agh/maude 2.0.4 → 2.0.8

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 (272) hide show
  1. package/apps/hub/src/project-transactions/kernel.mjs +10 -1
  2. package/apps/studio/access/closure.ts +156 -16
  3. package/apps/studio/access/filters.ts +39 -5
  4. package/apps/studio/access/known-canvases.ts +24 -1
  5. package/apps/studio/access/refused-inputs.ts +89 -0
  6. package/apps/studio/actions/agents.ts +59 -0
  7. package/apps/studio/actions/ctx.ts +3 -0
  8. package/apps/studio/actions/defs/app.ts +12 -0
  9. package/apps/studio/actions/defs/sync.ts +13 -0
  10. package/apps/studio/actions/defs/view.ts +59 -3
  11. package/apps/studio/actions/keymap.gen.ts +35 -0
  12. package/apps/studio/actions/menu.ts +2 -0
  13. package/apps/studio/actions/types.ts +3 -1
  14. package/apps/studio/actions.manifest.json +148 -1
  15. package/apps/studio/actions.parity.json +31 -1
  16. package/apps/studio/annotations/ui/ai-seen.tsx +4 -3
  17. package/apps/studio/annotations/ui/element-node.tsx +139 -54
  18. package/apps/studio/annotations/ui/lod.tsx +1 -1
  19. package/apps/studio/annotations/ui/ride.ts +2 -1
  20. package/apps/studio/annotations/ui/text-style.ts +1 -1
  21. package/apps/studio/annotations-context-toolbar.tsx +5 -4
  22. package/apps/studio/annotations-layer.tsx +4 -15
  23. package/apps/studio/api.ts +425 -128
  24. package/apps/studio/artboard-activity-overlay.tsx +4 -4
  25. package/apps/studio/artboard-ai-copies.tsx +4 -4
  26. package/apps/studio/artboard-freeze.ts +108 -0
  27. package/apps/studio/artboard-live-gate.tsx +636 -0
  28. package/apps/studio/artboard-live.ts +831 -0
  29. package/apps/studio/artboard-placeholder.ts +197 -0
  30. package/apps/studio/artboard-still-raster.ts +485 -0
  31. package/apps/studio/artboard-still-warmup.ts +221 -0
  32. package/apps/studio/artboard-still.ts +1188 -0
  33. package/apps/studio/artboard-webgl.ts +669 -0
  34. package/apps/studio/asset-placeholder.tsx +237 -132
  35. package/apps/studio/asset-upload-bars.tsx +4 -4
  36. package/apps/studio/bin/_agent-browser-bin.mjs +8 -0
  37. package/apps/studio/bin/_agent-browser-safe.mjs +2 -1
  38. package/apps/studio/bin/_canvas-reasons.mjs +34 -0
  39. package/apps/studio/bin/_ds-check-live.mjs +37 -0
  40. package/apps/studio/bin/_ds-check.mjs +4 -1
  41. package/apps/studio/bin/_ds-prove-judge.mjs +167 -0
  42. package/apps/studio/bin/_ds-prove-playwright.mjs +183 -105
  43. package/apps/studio/bin/_import-asset.mjs +2 -1
  44. package/apps/studio/bin/_perf-probe-open.mjs +364 -0
  45. package/apps/studio/bin/_perf-probe.mjs +2 -1
  46. package/apps/studio/bin/_perf-shared.mjs +12 -7
  47. package/apps/studio/bin/_pw-launch.mjs +26 -1
  48. package/apps/studio/bin/_studio-verb.mjs +24 -3
  49. package/apps/studio/bin/_thumb-blank.mjs +70 -0
  50. package/apps/studio/bin/_thumb-cover.mjs +35 -0
  51. package/apps/studio/bin/_thumbs-playwright.mjs +89 -12
  52. package/apps/studio/bin/ds-check.sh +5 -1
  53. package/apps/studio/bin/perf.sh +30 -1
  54. package/apps/studio/bin/server-up.sh +7 -2
  55. package/apps/studio/bin/smoke.sh +19 -0
  56. package/apps/studio/bridge/dgn-protocol.ts +35 -0
  57. package/apps/studio/canvas-build-sandbox.ts +69 -13
  58. package/apps/studio/canvas-camera.ts +90 -0
  59. package/apps/studio/canvas-comment-mount.tsx +9 -9
  60. package/apps/studio/canvas-lib.tsx +289 -44
  61. package/apps/studio/canvas-pages-view.tsx +465 -0
  62. package/apps/studio/canvas-pages.ts +305 -0
  63. package/apps/studio/canvas-rows.ts +62 -0
  64. package/apps/studio/canvas-shell.tsx +62 -16
  65. package/apps/studio/canvas-theme-icons.tsx +41 -0
  66. package/apps/studio/canvas-theme-pill.tsx +15 -6
  67. package/apps/studio/canvas-theme.ts +12 -11
  68. package/apps/studio/client/app.jsx +7 -0
  69. package/apps/studio/client/canvas-url.js +36 -1
  70. package/apps/studio/client/home/HomeAccounts.jsx +262 -0
  71. package/apps/studio/client/home/Shelves.jsx +4 -3
  72. package/apps/studio/client/home/home-accounts-model.js +121 -0
  73. package/apps/studio/client/home/home-api.js +6 -0
  74. package/apps/studio/client/home/home-app.jsx +141 -40
  75. package/apps/studio/client/home/home-model.js +172 -6
  76. package/apps/studio/client/home/home.css +169 -5
  77. package/apps/studio/client/home/shell-mode.js +8 -1
  78. package/apps/studio/client/hooks/canvas-origin-probe.js +34 -0
  79. package/apps/studio/client/hooks/use-action-keys.jsx +3 -1
  80. package/apps/studio/client/hooks/use-canvas-bridge.jsx +1 -1
  81. package/apps/studio/client/hooks/use-palette-and-panels.jsx +23 -6
  82. package/apps/studio/client/hooks/use-photo-and-timeline.jsx +16 -8
  83. package/apps/studio/client/hooks/use-project-data.jsx +13 -2
  84. package/apps/studio/client/hooks/use-shell-core.jsx +19 -9
  85. package/apps/studio/client/index-loader.ts +41 -21
  86. package/apps/studio/client/inspector/inspector-panel.jsx +35 -14
  87. package/apps/studio/client/panels/ChatPanel.jsx +27 -20
  88. package/apps/studio/client/panels/CreateProject.jsx +19 -5
  89. package/apps/studio/client/panels/caps-cache.js +46 -0
  90. package/apps/studio/client/shell/viewport.jsx +66 -22
  91. package/apps/studio/client/tree/tree.jsx +17 -0
  92. package/apps/studio/client/v2/access/access-client.js +2 -0
  93. package/apps/studio/client/v2/access/access-host.jsx +12 -1
  94. package/apps/studio/client/v2/access/trashed-banner.jsx +6 -3
  95. package/apps/studio/client/v2/ai/Advanced.jsx +12 -0
  96. package/apps/studio/client/v2/ai/Composer.jsx +27 -10
  97. package/apps/studio/client/v2/canvases/canvases-panel.jsx +24 -0
  98. package/apps/studio/client/v2/canvases/use-canvas-index.js +24 -1
  99. package/apps/studio/client/v2/code/canvas-error-card.jsx +14 -2
  100. package/apps/studio/client/v2/code/canvas-imports-card.jsx +19 -14
  101. package/apps/studio/client/v2/code/canvas-imports-words.js +60 -0
  102. package/apps/studio/client/v2/code/canvas-waiting-card.jsx +59 -5
  103. package/apps/studio/client/v2/code/canvas-waiting.js +18 -1
  104. package/apps/studio/client/v2/code/code-bus.js +5 -0
  105. package/apps/studio/client/v2/code/code-consent-sheet.jsx +87 -0
  106. package/apps/studio/client/v2/code/code-consent.js +67 -0
  107. package/apps/studio/client/v2/diagnostics/sync-details/sync-details-model.js +62 -10
  108. package/apps/studio/client/v2/diagnostics/sync-details/sync-details.jsx +314 -5
  109. package/apps/studio/client/v2/ds/advanced-host.jsx +11 -26
  110. package/apps/studio/client/v2/ds/ds-refresh.js +161 -0
  111. package/apps/studio/client/v2/ds/library-host.jsx +45 -45
  112. package/apps/studio/client/v2/ds/make-host.jsx +13 -15
  113. package/apps/studio/client/v2/ds/off-system-host.jsx +18 -19
  114. package/apps/studio/client/v2/ds/review-host.jsx +7 -1
  115. package/apps/studio/client/v2/ds/truth-host.jsx +15 -17
  116. package/apps/studio/client/v2/ds/upgrade-host.jsx +26 -10
  117. package/apps/studio/client/v2/history/branch-actions.js +13 -9
  118. package/apps/studio/client/v2/history/git-advanced.jsx +8 -1
  119. package/apps/studio/client/v2/history/git-model.js +3 -1
  120. package/apps/studio/client/v2/history/git-parts.jsx +16 -1
  121. package/apps/studio/client/v2/layers/artboard-layers.jsx +24 -5
  122. package/apps/studio/client/v2/layers/layers-request.js +49 -0
  123. package/apps/studio/client/v2/left-panel/canvases-pinned.jsx +93 -3
  124. package/apps/studio/client/v2/left-panel/ds-boards.js +39 -0
  125. package/apps/studio/client/v2/left-panel/left-panel-model.js +13 -0
  126. package/apps/studio/client/v2/left-panel/left-panel.css +24 -0
  127. package/apps/studio/client/v2/presence/faces.jsx +42 -14
  128. package/apps/studio/client/v2/shell/account-card.jsx +10 -4
  129. package/apps/studio/client/v2/shell/canvas-crash-guard.js +172 -0
  130. package/apps/studio/client/v2/shell/canvas-mode.js +17 -1
  131. package/apps/studio/client/v2/shell/floating-panels.css +37 -1
  132. package/apps/studio/client/v2/shell/github-signin-host.jsx +42 -0
  133. package/apps/studio/client/v2/shell/menu-runner.js +11 -0
  134. package/apps/studio/client/v2/shell/mode-switch.jsx +14 -3
  135. package/apps/studio/client/v2/shell/opening-skeleton.js +118 -0
  136. package/apps/studio/client/v2/shell/opening-skeleton.jsx +103 -0
  137. package/apps/studio/client/v2/shell/pages-pick.js +49 -0
  138. package/apps/studio/client/v2/shell/project-account-card.jsx +203 -0
  139. package/apps/studio/client/v2/shell/project-account-model.js +182 -0
  140. package/apps/studio/client/v2/shell/project-menu-model.js +3 -0
  141. package/apps/studio/client/v2/shell/share-cluster-host.jsx +140 -11
  142. package/apps/studio/client/v2/shell/share-cluster.css +58 -0
  143. package/apps/studio/client/v2/shell/share-cluster.jsx +26 -7
  144. package/apps/studio/client/v2/shell/shell-parity.json +8 -0
  145. package/apps/studio/client/v2/shell/team-switch.js +94 -0
  146. package/apps/studio/client/v2/shell/too-heavy-card.jsx +38 -0
  147. package/apps/studio/client/v2/shell/use-account.js +8 -1
  148. package/apps/studio/client/v2/shell/use-canvas-mode-lane.js +30 -0
  149. package/apps/studio/collab/persistence.ts +9 -1
  150. package/apps/studio/collab/registry.ts +32 -0
  151. package/apps/studio/collab/room.ts +8 -0
  152. package/apps/studio/comments-overlay.tsx +12 -11
  153. package/apps/studio/config-reload-wire.ts +56 -0
  154. package/apps/studio/config.schema.json +6 -0
  155. package/apps/studio/context.ts +37 -1
  156. package/apps/studio/dist/client.bundle.js +1198 -1198
  157. package/apps/studio/dist/comment-mount.js +2 -2
  158. package/apps/studio/dist/styles.css +1 -1
  159. package/apps/studio/ds/board/board.css +6 -0
  160. package/apps/studio/ds/board/ds-bar.tsx +21 -3
  161. package/apps/studio/ds/board/specimen.tsx +16 -2
  162. package/apps/studio/ds/board/template.ts +39 -19
  163. package/apps/studio/ds/canvas-cli.ts +58 -2
  164. package/apps/studio/ds/check.ts +26 -1
  165. package/apps/studio/ds/cli.ts +14 -4
  166. package/apps/studio/ds/component-list.ts +2 -1
  167. package/apps/studio/ds/convert.ts +34 -6
  168. package/apps/studio/ds/default.ts +6 -1
  169. package/apps/studio/ds/ds-resolver.ts +58 -8
  170. package/apps/studio/ds/ds-verb.ts +13 -0
  171. package/apps/studio/ds/engine.ts +3 -1
  172. package/apps/studio/ds/folder-systems.ts +199 -0
  173. package/apps/studio/ds/pairing-css.ts +2 -1
  174. package/apps/studio/ds/post-build.ts +38 -0
  175. package/apps/studio/ds/rename.ts +10 -3
  176. package/apps/studio/ds/shell-fallbacks.ts +2 -1
  177. package/apps/studio/ds/upgrade-apply.ts +27 -5
  178. package/apps/studio/ds/upgrade-cli.ts +22 -2
  179. package/apps/studio/ds/upgrade-prove.ts +198 -15
  180. package/apps/studio/ds/upgrade-stage.ts +10 -3
  181. package/apps/studio/editing/ai-point-ring.tsx +4 -4
  182. package/apps/studio/editing/ai-scope-outline.tsx +4 -4
  183. package/apps/studio/editing/align-bar.tsx +4 -4
  184. package/apps/studio/editing/anchor-report.ts +3 -2
  185. package/apps/studio/editing/artboard-handles.tsx +4 -4
  186. package/apps/studio/editing/corner-dots.tsx +4 -4
  187. package/apps/studio/editing/crop-mode.tsx +4 -4
  188. package/apps/studio/editing/drop-chip.tsx +4 -4
  189. package/apps/studio/editing/empty-report.ts +3 -2
  190. package/apps/studio/editing/focus-model.tsx +4 -4
  191. package/apps/studio/editing/gap-bands.tsx +3 -3
  192. package/apps/studio/editing/hold-rings.tsx +4 -4
  193. package/apps/studio/editing/lock-badge.tsx +3 -3
  194. package/apps/studio/editing/long-page.ts +23 -1
  195. package/apps/studio/editing/nudge.tsx +2 -2
  196. package/apps/studio/editing/page-activity.ts +4 -3
  197. package/apps/studio/editing/paste-bar.tsx +4 -4
  198. package/apps/studio/editing/pen/overlay.tsx +4 -3
  199. package/apps/studio/editing/place-freely.tsx +3 -3
  200. package/apps/studio/editing/reorder-slot.tsx +3 -3
  201. package/apps/studio/editing/selection.tsx +4 -4
  202. package/apps/studio/editing/size-ghost.tsx +4 -4
  203. package/apps/studio/editing/tab-order.tsx +4 -4
  204. package/apps/studio/editing/text-in-place.tsx +4 -4
  205. package/apps/studio/editing/undo-preview.tsx +3 -3
  206. package/apps/studio/equal-spacing-handles.tsx +3 -3
  207. package/apps/studio/frame-clock.ts +89 -0
  208. package/apps/studio/history/trash.ts +6 -0
  209. package/apps/studio/home/accounts.ts +87 -0
  210. package/apps/studio/home/index-reader.ts +24 -2
  211. package/apps/studio/home/routes.ts +19 -0
  212. package/apps/studio/http.ts +80 -34
  213. package/apps/studio/index/ds-usage.ts +4 -1
  214. package/apps/studio/index-cache.ts +272 -0
  215. package/apps/studio/inspect-overlay.tsx +4 -3
  216. package/apps/studio/inspect.ts +7 -2
  217. package/apps/studio/link-chip-overlay.tsx +4 -3
  218. package/apps/studio/measure-overlay.tsx +4 -3
  219. package/apps/studio/present/pointer-dot.tsx +3 -2
  220. package/apps/studio/present/present-media.ts +6 -2
  221. package/apps/studio/present/present-stage.tsx +3 -2
  222. package/apps/studio/preview/preview-camera.tsx +3 -2
  223. package/apps/studio/routes/ds-convert.ts +18 -0
  224. package/apps/studio/routes/sync.ts +176 -0
  225. package/apps/studio/routes/trash.ts +16 -1
  226. package/apps/studio/safe-zones-overlay.tsx +3 -2
  227. package/apps/studio/server.ts +8 -10
  228. package/apps/studio/skip-dirs.ts +103 -47
  229. package/apps/studio/studio-page-host.ts +70 -0
  230. package/apps/studio/sync/accepted-cold-start.ts +28 -13
  231. package/apps/studio/sync/asset-push.ts +146 -23
  232. package/apps/studio/sync/asset-state.ts +3 -2
  233. package/apps/studio/sync/code-module-consent.ts +86 -0
  234. package/apps/studio/sync/file-ledger.ts +24 -0
  235. package/apps/studio/sync/file-membership.ts +28 -3
  236. package/apps/studio/sync/file-plane.ts +497 -61
  237. package/apps/studio/sync/file-pull.ts +304 -33
  238. package/apps/studio/sync/held-deletes.ts +230 -0
  239. package/apps/studio/sync/hub-link.ts +1 -2
  240. package/apps/studio/sync/hubs-config.ts +59 -2
  241. package/apps/studio/sync/index.ts +405 -163
  242. package/apps/studio/sync/journal-client.ts +94 -5
  243. package/apps/studio/sync/pending-deletes.ts +100 -0
  244. package/apps/studio/sync/projection.ts +77 -12
  245. package/apps/studio/sync/seed-progress.ts +104 -3
  246. package/apps/studio/sync/settings.ts +36 -1
  247. package/apps/studio/sync/status.ts +17 -1
  248. package/apps/studio/sync/writer-registry.ts +5 -0
  249. package/apps/studio/text-caret.ts +5 -3
  250. package/apps/studio/thumbs/service.ts +12 -2
  251. package/apps/studio/thumbs/validate.ts +7 -0
  252. package/apps/studio/toolbars/toolbar-rect.ts +3 -2
  253. package/apps/studio/ui-prefs-migrate.ts +4 -0
  254. package/apps/studio/use-annotation-resize.tsx +4 -3
  255. package/apps/studio/use-artboard-drag.tsx +3 -2
  256. package/apps/studio/use-element-resize.tsx +7 -6
  257. package/apps/studio/use-grid-track-handles.tsx +5 -4
  258. package/apps/studio/use-selection-set.tsx +64 -4
  259. package/apps/studio/use-spacing-handles.tsx +7 -6
  260. package/apps/studio/video-comp.tsx +75 -39
  261. package/apps/studio/video-play-overlay.tsx +4 -3
  262. package/apps/studio/whats-new.json +99 -0
  263. package/cli/commands/design.mjs +5 -2
  264. package/cli/commands/hub.mjs +10 -1
  265. package/cli/lib/bash-guard.mjs +27 -1
  266. package/cli/lib/design-help.gen.mjs +1 -1
  267. package/cli/lib/design-hook.mjs +20 -0
  268. package/cli/lib/design-link.mjs +42 -17
  269. package/cli/lib/hub-purge.mjs +183 -0
  270. package/cli/lib/studio-locate.mjs +35 -10
  271. package/package.json +8 -8
  272. package/plugins/design/templates/_shell.html +164 -1
@@ -26,24 +26,42 @@ const ICON = { digital: DigitalIcon, web: WebIcon, print: PrintIcon, video: Vide
26
26
  export const artboardCountWords = (n) => (n === 1 ? '1 artboard' : `${n} artboards`);
27
27
 
28
28
  /**
29
- * Which row the tree goes under: the artboard the tree is of, else the selection's, else none.
30
- * @param {{ boards?: Array<{ id: string }>, treeArtboard?: string|null, selectedArtboard?: string|null }} p
29
+ * Which row is marked (aria-current) and holds the tree: the artboard the person is on (`onBoard` — the page in
30
+ * Pages, else the selection's artboard on this canvas: `artboardInView`), else the selection's, else the artboard the
31
+ * tree is of (browse mode: the tree follows the artboard in view), else none. 2.0.7 fix (decision
32
+ * `v2-207-layers-current`): the tree's artboard used to come FIRST, so a tree that was late or for another artboard
33
+ * marked the wrong row about half the time.
34
+ * @param {{ boards?: Array<{ id: string }>, onBoard?: string|null, treeArtboard?: string|null,
35
+ * selectedArtboard?: string|null }} p
31
36
  */
32
- export function currentBoard({ boards = [], treeArtboard = null, selectedArtboard = null }) {
33
- for (const id of [treeArtboard, selectedArtboard])
37
+ export function currentBoard({
38
+ boards = [],
39
+ onBoard = null,
40
+ treeArtboard = null,
41
+ selectedArtboard = null,
42
+ }) {
43
+ for (const id of [onBoard, selectedArtboard, treeArtboard])
34
44
  if (id && boards.some((b) => b.id === id)) return id;
35
45
  return null;
36
46
  }
37
47
 
48
+ /** The tree to draw under row `current`: only its own artboard's (no row marked: the tree as it is). */
49
+ export function treeOfBoard(tree, current) {
50
+ if (!current) return tree ?? null;
51
+ return tree && tree.artboardId === current ? tree : null;
52
+ }
53
+
38
54
  /**
39
55
  * @param {{ boards?: Array<{ id: string, label?: string, kind?: string }>, canvasName?: string,
40
- * count?: number, current?: string|null, onPick?: (artboardId: string) => void, children?: any }} props
56
+ * count?: number, current?: string|null, pending?: boolean, onPick?: (artboardId: string) => void,
57
+ * children?: any }} props — `pending`: the current row's own tree has not landed yet (the row says it is busy)
41
58
  */
42
59
  export function ArtboardLayers({
43
60
  boards,
44
61
  canvasName = '',
45
62
  count,
46
63
  current = null,
64
+ pending = false,
47
65
  onPick,
48
66
  children,
49
67
  }) {
@@ -80,6 +98,7 @@ export function ArtboardLayers({
80
98
  data-testid={`layers-artboard-${b.id}`}
81
99
  data-kind={b.kind || 'digital'}
82
100
  aria-current={on ? 'true' : undefined}
101
+ aria-busy={on && pending ? 'true' : undefined}
83
102
  title={b.label || b.id}
84
103
  onClick={() => onPick?.(b.id)}
85
104
  >
@@ -0,0 +1,49 @@
1
+ // client/v2/layers/layers-request.js — 2.0.7 fix (decision `v2-207-layers-current`): which artboard's Layers tree
2
+ // the shell asks the open canvas for, and the asking.
3
+ //
4
+ // The tree used to be asked for only for the artboard nearest the viewport centre (`canvasActiveArtboard`), and the
5
+ // canvas posts one on a click inside it. A pick in Layers (`select-by-id`) asked for nothing, and in Pages the
6
+ // nearest-centre guess counts the artboards Pages hides — so the tree, and with it the marked row, stayed on (or
7
+ // moved to) another artboard. The tree is now asked for the artboard the person is on, the same one Layers marks.
8
+
9
+ import { useEffect, useRef } from 'react';
10
+ import { artboardInView } from '../left-panel/left-panel-model.js';
11
+
12
+ /**
13
+ * The artboard whose tree Layers needs: the page in Pages, else the selection's artboard on this canvas
14
+ * (`artboardInView`, what the Canvases panel marks), else the artboard nearest the viewport centre (`inView`) — so
15
+ * Layers still shows a tree with nothing selected.
16
+ * @param {{ selected?: any, activePath?: string|null, pagesAt?: string|null, inView?: string|null }} p
17
+ * @returns {string|null}
18
+ */
19
+ export function layersArtboardOf({ selected, activePath, pagesAt = null, inView = null }) {
20
+ return artboardInView({ selected, activePath, pagesAt }) ?? (inView || null);
21
+ }
22
+
23
+ /**
24
+ * Ask the open canvas for artboard `want`'s tree, `delay` ms after it settles (the in-view signal flickers in a
25
+ * fast pan). With `have` — the artboard of the tree in hand — it asks only while that is another artboard's, so a
26
+ * late tree for the previous artboard is answered by asking again instead of staying. `skip` turns it off.
27
+ * @param {{ activePath?: string|null, want?: string|null, have?: string|null, post: (m: object) => void,
28
+ * delay?: number, skip?: boolean }} p
29
+ */
30
+ export function useLayersTreeRequest({
31
+ activePath,
32
+ want,
33
+ have = undefined,
34
+ post,
35
+ delay = 250,
36
+ skip = false,
37
+ }) {
38
+ const mismatch = have === undefined ? null : have !== want;
39
+ const postRef = useRef(post);
40
+ postRef.current = post;
41
+ useEffect(() => {
42
+ if (skip || !activePath || !want || mismatch === false) return undefined;
43
+ const t = setTimeout(
44
+ () => postRef.current?.({ dgn: 'request-layers', artboardId: want }),
45
+ delay
46
+ );
47
+ return () => clearTimeout(t);
48
+ }, [skip, activePath, want, mismatch, delay]);
49
+ }
@@ -4,10 +4,59 @@
4
4
  // Both are plain buttons that call what the tree already had: the design-system view (`onOpenSystem`)
5
5
  // and the Trash list (TrashView below the list's owner).
6
6
 
7
+ import { Fragment, useEffect, useRef, useState } from 'react';
7
8
  import { StIcon } from '../../shell/icons.jsx';
9
+ import { pathTestIdSlug } from '../../shell/util.js';
10
+ import { DigitalIcon, PrintIcon, VideoIcon, WebIcon } from '../canvases/canvas-icons.jsx';
11
+ import { JumpToggle } from '../canvases/jump-list.jsx';
12
+ import { KIND_LABEL } from '../canvases/jump-model.js';
13
+ import { dispatchArtboardJump } from './left-panel-bus.js';
8
14
  import { trashRowCount } from './left-panel-model.js';
9
15
  import { SystemRenameField } from '../ds/system-rename.jsx';
10
16
 
17
+ const KIND_GLYPH = { web: WebIcon, digital: DigitalIcon, print: PrintIcon, video: VideoIcon };
18
+
19
+ /** 2.0.7 (B3) — the artboards of a system's Design system canvas, under its row (the canvas row's 11 · pn-jump
20
+ * list). A click takes the camera there: the canvas opens if it is not the one on screen. */
21
+ function DsBoardList({ dsName, list, activePath, activeArtboard, onJump }) {
22
+ const slug = pathTestIdSlug(list.path);
23
+ const onCanvas = activePath === list.path;
24
+ // 2.0.7 polish — the artboard in view moved (Pages' ‹ › turn it): its row scrolls into view, once per artboard
25
+ const curRef = useRef(null);
26
+ const inView = onCanvas ? activeArtboard : null;
27
+ useEffect(() => {
28
+ if (inView) curRef.current?.scrollIntoView?.({ block: 'nearest' });
29
+ }, [inView]);
30
+ return (
31
+ <div className="lp-ds-boards" data-testid="canvases-ds-boards" data-ds={dsName}>
32
+ {list.boards.map((b) => {
33
+ const Glyph = KIND_GLYPH[b.kind] || WebIcon;
34
+ const word = KIND_LABEL[b.kind] || b.kind;
35
+ const current = onCanvas && activeArtboard === b.id;
36
+ return (
37
+ <div key={b.id} className={`cv-row cv-row--board lp-ds-board${current ? ' is-sel' : ''}`}>
38
+ <button
39
+ type="button"
40
+ className="cv-main"
41
+ ref={current ? curRef : undefined}
42
+ data-testid={`jump-artboard-${slug}-${b.id}`}
43
+ data-kind={b.kind}
44
+ aria-current={current ? 'true' : undefined}
45
+ title={`${b.label} — ${word}`}
46
+ onClick={() => (onJump || dispatchArtboardJump)(list.path, b.id)}
47
+ >
48
+ <span className="cv-bk" role="img" aria-label={word}>
49
+ <Glyph size={12} />
50
+ </span>
51
+ <span className="cv-name">{b.label}</span>
52
+ </button>
53
+ </div>
54
+ );
55
+ })}
56
+ </div>
57
+ );
58
+ }
59
+
11
60
  /** A trash can on the shell's 16-box icon grid (the icon set has none). */
12
61
  export function TrashIcon({ size = 14 }) {
13
62
  return (
@@ -40,7 +89,10 @@ export function TrashIcon({ size = 14 }) {
40
89
  * empty { label } | null onMake() the empty row's door
41
90
  * onBringUp(ds) S10.15b: a click on the amber dot (omit = the dot is only a mark)
42
91
  * renaming dsName | null onRename(row, name) P8 round 7: that row's name is a field (Rename…, 13 · ds-multi-menu)
43
- * onRenameDone() the field closed (↵ or esc) */
92
+ * onRenameDone() the field closed (↵ or esc)
93
+ * boards Map dsName → { path, boards } (ds-boards.js) 2.0.7 (B3): a row with artboards opens into them
94
+ * activePath, activeArtboard the canvas on screen and the artboard in view (the list marks it)
95
+ * onJump(path, id) a click on an artboard (omit = the left-panel bus) */
44
96
  export function DsPinnedRows({
45
97
  rows,
46
98
  activeDsName,
@@ -53,7 +105,13 @@ export function DsPinnedRows({
53
105
  renaming = null,
54
106
  onRename,
55
107
  onRenameDone,
108
+ boards = null,
109
+ activePath = null,
110
+ activeArtboard = null,
111
+ onJump,
56
112
  }) {
113
+ // which rows show their artboards: the person's own choice, this session (a canvas row's list is the same)
114
+ const [openLists, setOpenLists] = useState(() => new Set());
57
115
  if (!rows?.length && !empty) return null;
58
116
  return (
59
117
  <div className="lp-pinned" data-testid="canvases-pinned">
@@ -89,8 +147,26 @@ export function DsPinnedRows({
89
147
  </div>
90
148
  </div>
91
149
  );
92
- return (
93
- <div key={r.dsName} className="lp-ds-wrap">
150
+ const list = boards?.get?.(r.dsName) ?? null;
151
+ const listOpen = !!list && openLists.has(r.dsName);
152
+ const row = (
153
+ <div className={`lp-ds-wrap${list ? ' lp-ds-wrap--jump' : ''}`}>
154
+ {list ? (
155
+ <JumpToggle
156
+ open={listOpen}
157
+ slug={pathTestIdSlug(list.path)}
158
+ name={r.label}
159
+ left={0}
160
+ onToggle={() =>
161
+ setOpenLists((s) => {
162
+ const n = new Set(s);
163
+ if (n.has(r.dsName)) n.delete(r.dsName);
164
+ else n.add(r.dsName);
165
+ return n;
166
+ })
167
+ }
168
+ />
169
+ ) : null}
94
170
  <button
95
171
  type="button"
96
172
  className={`lp-row lp-ds${on ? ' is-sel' : ''}${r.sub ? ' lp-ds--two' : ''}`}
@@ -151,6 +227,20 @@ export function DsPinnedRows({
151
227
  ) : null}
152
228
  </div>
153
229
  );
230
+ return (
231
+ <Fragment key={r.dsName}>
232
+ {row}
233
+ {listOpen ? (
234
+ <DsBoardList
235
+ dsName={r.dsName}
236
+ list={list}
237
+ activePath={activePath}
238
+ activeArtboard={activeArtboard}
239
+ onJump={onJump}
240
+ />
241
+ ) : null}
242
+ </Fragment>
243
+ );
154
244
  })}
155
245
  {empty ? (
156
246
  <button
@@ -0,0 +1,39 @@
1
+ // client/v2/left-panel/ds-boards.js — 2.0.7 (B3): a pinned Design system row opens into the artboards of its
2
+ // Design system canvas, the way a canvas row opens into its own (11 · pn-jump). PURE: which canvas a system's
3
+ // row lists, and its artboards in the canvas's own order, read from the index snapshot the Canvases panel
4
+ // already holds (no second read of the index).
5
+
6
+ import { indexMeta } from '../canvases/tree-model.js';
7
+
8
+ /** The repo path of a system's Design system canvas: `<designRel>/<system path>/design-system.tsx`. */
9
+ export function dsCanvasPath(systemPath, designRel) {
10
+ if (typeof systemPath !== 'string' || !systemPath.trim()) return null;
11
+ const rel = `${systemPath.replace(/^\/+|\/+$/g, '')}/design-system.tsx`;
12
+ return designRel ? `${designRel}/${rel}` : rel;
13
+ }
14
+
15
+ /**
16
+ * Each pinned row's Design system canvas and its artboards: Map dsName → { path, boards: [{ id, label, kind }] }.
17
+ * A system that has no Design system canvas yet (not converted), or whose canvas lists no artboards, is left
18
+ * out — its row has nothing to open.
19
+ * systems [{ name, path }] — the shell config's designSystems; a row the config does not list falls back
20
+ * to the group's `dsFolders` (a folder that brings its own design-system.tsx, 2.0.7 #1)
21
+ */
22
+ export function dsBoardLists(rows, { snapshot, designRel = '', systems = [], groups = [] } = {}) {
23
+ const out = new Map();
24
+ if (!snapshot || !Array.isArray(rows) || !rows.length) return out;
25
+ const root = (snapshot?.project?.designRel || designRel || '').replace(/^\/+|\/+$/g, '');
26
+ const meta = indexMeta(snapshot, root);
27
+ const folders = (groups || []).flatMap((g) => g?.dsFolders || []);
28
+ for (const r of rows) {
29
+ const name = r?.dsName;
30
+ if (!name) continue;
31
+ const sys =
32
+ (systems || []).find((d) => d?.name === name) || folders.find((f) => f?.name === name);
33
+ const path = dsCanvasPath(sys?.path, root);
34
+ const m = path ? meta.get(path) : null;
35
+ if (!m || !m.boards?.length) continue;
36
+ out.set(name, { path, boards: m.boards });
37
+ }
38
+ return out;
39
+ }
@@ -182,3 +182,16 @@ export const CAPABILITY_HOMES = [
182
182
  actionId: 'view.trash',
183
183
  },
184
184
  ];
185
+
186
+ /**
187
+ * 2.0.7 polish (decision `v2-207-pages-left-panel-follows`) — the artboard in view on the open canvas, which the
188
+ * artboard lists under a canvas row and a Design system row mark: in Pages the artboard on the page (it turns with
189
+ * ‹ › and the keys, which never touch the selection), else the selected artboard of the open canvas.
190
+ * selected the shell's selection (one object or a list; its first counts)
191
+ * pagesAt the active canvas's page while it shows Pages (use-canvas-mode-lane `usePagesArtboard`), else null
192
+ */
193
+ export function artboardInView({ selected, activePath, pagesAt = null }) {
194
+ if (typeof pagesAt === 'string' && pagesAt) return pagesAt;
195
+ const sel = Array.isArray(selected) ? selected[0] : selected;
196
+ return sel && activePath && sel.file === activePath ? (sel.artboardId ?? null) : null;
197
+ }
@@ -352,6 +352,30 @@
352
352
  display: flex;
353
353
  align-items: center;
354
354
  }
355
+ /* 2.0.7 (B3) — a system row with a Design system canvas opens into its artboards (the canvas row's 11 · pn-jump
356
+ twisty in the row's left gutter, and its 22 px artboard rows underneath) */
357
+ .lp-ds-wrap--jump > .lp-ds {
358
+ padding-left: calc(var(--space-3) + 6px);
359
+ }
360
+ .lp-ds-wrap--jump > .cv-jt[aria-expanded="false"] {
361
+ opacity: 0;
362
+ }
363
+ .lp-ds-wrap--jump:hover > .cv-jt,
364
+ .lp-ds-wrap--jump:focus-within > .cv-jt,
365
+ .lp-ds-wrap--jump > .cv-jt:focus-visible {
366
+ opacity: 1;
367
+ }
368
+ .lp-ds-boards {
369
+ display: flex;
370
+ flex-direction: column;
371
+ padding-bottom: var(--space-1);
372
+ }
373
+ .lp-ds-board {
374
+ height: 22px;
375
+ }
376
+ .lp-ds-board > .cv-main {
377
+ padding-left: calc(var(--space-3) + 18px);
378
+ }
355
379
  .lp-ds--two {
356
380
  align-items: center;
357
381
  padding-block: var(--space-1);
@@ -79,12 +79,35 @@ function toneStyle(name, you = false) {
79
79
  return { '--face-tone': toneVar(you ? YOU_TONE : toneFor(name)) };
80
80
  }
81
81
 
82
+ /** 2.0.5 W4 — your own face is the avatar: a button that opens THIS project's account (the host's card). */
83
+ function YouFace({ face, onYou, youOpen }) {
84
+ return (
85
+ <li className="sh-face-li">
86
+ <button
87
+ type="button"
88
+ className="sh-face is-you"
89
+ style={toneStyle(face.name, true)}
90
+ title={`${face.name} · Account`}
91
+ aria-label={`${face.name} — this project's account`}
92
+ aria-haspopup="dialog"
93
+ aria-expanded={youOpen ? 'true' : 'false'}
94
+ data-testid="share-cluster-face-you"
95
+ data-account-opener="true"
96
+ onClick={() => onYou()}
97
+ >
98
+ {face.initials}
99
+ </button>
100
+ </li>
101
+ );
102
+ }
103
+
82
104
  /** The pre-S9.23 strip: a peer's face IS the Follow control. */
83
- function LegacyFaces({ faces, onFollow }) {
105
+ function LegacyFaces({ faces, onFollow, onYou, youOpen }) {
84
106
  return (
85
107
  <ul className="sh-faces" aria-label="People here" data-testid="share-cluster-faces">
86
108
  {faces.map((f) => {
87
109
  const key = `${f.you ? 'you' : f.agent ? 'agent' : `peer-${f.clientID}`}:${f.name}`;
110
+ if (f.you && onYou) return <YouFace key={key} face={f} onYou={onYou} youOpen={youOpen} />;
88
111
  if (isPeer(f) && onFollow) {
89
112
  const label = f.following
90
113
  ? `Stop following ${firstName(f.name)}`
@@ -261,7 +284,7 @@ function PeopleList({ peers, presence, close, now, onPick }) {
261
284
  );
262
285
  }
263
286
 
264
- export function PresenceFaces({ faces, onFollow, presence = null }) {
287
+ export function PresenceFaces({ faces, onFollow, presence = null, onYou = null, youOpen = false }) {
265
288
  const [open, setOpen] = useState(null); // { kind: 'face', clientID } | { kind: 'list' } | null
266
289
  const hostRef = useRef(null);
267
290
  const openerRef = useRef(null);
@@ -273,7 +296,8 @@ export function PresenceFaces({ faces, onFollow, presence = null }) {
273
296
  () => openerRef.current?.focus()
274
297
  );
275
298
  if (!faces?.length) return null;
276
- if (!presence) return <LegacyFaces faces={faces} onFollow={onFollow} />;
299
+ if (!presence)
300
+ return <LegacyFaces faces={faces} onFollow={onFollow} onYou={onYou} youOpen={youOpen} />;
277
301
 
278
302
  const lead = faces.filter((f) => !isPeer(f));
279
303
  const peers = faces.filter(isPeer);
@@ -284,17 +308,21 @@ export function PresenceFaces({ faces, onFollow, presence = null }) {
284
308
  return (
285
309
  <span className="sh-faces-host" ref={hostRef}>
286
310
  <ul className="sh-faces" aria-label="People here" data-testid="share-cluster-faces">
287
- {lead.map((f) => (
288
- <li
289
- key={f.you ? `you:${f.name}` : `agent:${f.name}`}
290
- className={`sh-face${f.agent ? ' is-agent' : ''}${f.you ? ' is-you' : ''}`}
291
- style={f.you ? toneStyle(f.name, true) : undefined}
292
- title={f.name}
293
- aria-label={f.name}
294
- >
295
- {f.agent ? <SparkGlyph size={12} /> : f.initials}
296
- </li>
297
- ))}
311
+ {lead.map((f) =>
312
+ f.you && onYou ? (
313
+ <YouFace key={`you:${f.name}`} face={f} onYou={onYou} youOpen={youOpen} />
314
+ ) : (
315
+ <li
316
+ key={f.you ? `you:${f.name}` : `agent:${f.name}`}
317
+ className={`sh-face${f.agent ? ' is-agent' : ''}${f.you ? ' is-you' : ''}`}
318
+ style={f.you ? toneStyle(f.name, true) : undefined}
319
+ title={f.name}
320
+ aria-label={f.name}
321
+ >
322
+ {f.agent ? <SparkGlyph size={12} /> : f.initials}
323
+ </li>
324
+ )
325
+ )}
298
326
  {shown.map((f) => {
299
327
  const idle = typeof f.idleSince === 'number' && f.idleSince > 0;
300
328
  const label = `${f.name} — ${whereOf(f, { labelOf: presence.labelOf, roleOf: presence.roleOf, now })}`;
@@ -29,7 +29,7 @@ function Face({ initial, tone, size = 'md' }) {
29
29
  * @param onSwitch () => void — the shell's `account.switch`
30
30
  * @param onSignOut () => Promise — the existing sign-out path
31
31
  */
32
- export function AccountChip({ chip, card, onSwitch, onSignOut }) {
32
+ export function AccountChip({ chip, card, onSwitch, onSignOut, onOpen = null, opened = false }) {
33
33
  const [open, setOpen] = useState(false);
34
34
  const [asking, setAsking] = useState(false);
35
35
  const [busy, setBusy] = useState(false);
@@ -74,14 +74,20 @@ export function AccountChip({ chip, card, onSwitch, onSignOut }) {
74
74
  <button
75
75
  ref={btn}
76
76
  type="button"
77
- className={`sh-acct-chip${open ? ' is-on' : ''}`}
77
+ className={`sh-acct-chip${open || opened ? ' is-on' : ''}`}
78
78
  data-testid="share-cluster-account"
79
79
  data-account={chip.id}
80
+ // 2.0.5 W4 — with `onOpen` the chip opens the project's account card (project-account-card.jsx)
81
+ data-account-opener={onOpen ? 'true' : undefined}
80
82
  aria-haspopup="dialog"
81
- aria-expanded={open ? 'true' : 'false'}
83
+ aria-expanded={open || opened ? 'true' : 'false'}
82
84
  aria-label={`Account: ${chip.title}`}
83
85
  title={chip.title}
84
- onClick={() => (open ? close(false) : setOpen(true))}
86
+ onClick={() => {
87
+ if (onOpen) onOpen();
88
+ else if (open) close(false);
89
+ else setOpen(true);
90
+ }}
85
91
  >
86
92
  <Face initial={chip.initial} tone={chip.tone} />
87
93
  <span className="sh-acct-name">{chip.label}</span>
@@ -0,0 +1,172 @@
1
+ // client/v2/shell/canvas-crash-guard.js — 2.0.5: a canvas that crashes the page is not reopened in a loop.
2
+ //
3
+ // When a heavy canvas makes WebKit kill the page's WebContent process, the desktop shell reloads the tab
4
+ // (apps/desktop/src-tauri/src/web_process.rs) and the shell reopened the same canvas — which crashed it
5
+ // again, over and over. No JavaScript runs at the crash, so the guard works backwards: while a canvas is
6
+ // open the shell keeps a "live" mark in localStorage and clears it on a clean `pagehide`. A page that boots
7
+ // and finds the mark still there died with that canvas open. `CRASH_LIMIT` such deaths of the same canvas
8
+ // within `CRASH_WINDOW_MS` and the viewport stops opening it: the tab shows "This canvas is too heavy to
9
+ // show all at once" with the lighter way in (only the artboards near the viewport mounted,
10
+ // `?artboard-live=light`). Pure over a Storage-like object so it is testable without a browser.
11
+ //
12
+ // 2.0.7: a leftover mark alone is not a crash. WKWebView fires no `pagehide` when the app quits, so every
13
+ // normal quit left the mark behind and two quits with a canvas open made it "too heavy". The shell's crash
14
+ // recovery (`web_process.rs` `recovery_target`) now navigates with `?maude-recovered=1`; only a boot that
15
+ // carries it counts the mark. Any other boot (launch, relaunch, manual reload, after a quit) drops the mark.
16
+ // The marker is read once, as the bundle loads, and stripped from the address so it is never copied,
17
+ // shared or counted twice.
18
+
19
+ export const CRASH_LIMIT = 2;
20
+ export const CRASH_WINDOW_MS = 10 * 60 * 1000;
21
+ /** A chosen lighter mode is kept this long for that canvas (it survives the next crash reload). */
22
+ export const LIGHT_KEEP_MS = 24 * 60 * 60 * 1000;
23
+ export const CRASH_KEY = 'maude.canvas-crash.v1';
24
+ /** Query param the desktop shell adds when it re-navigates after a WebContent crash (web_process.rs). */
25
+ export const RECOVERED_PARAM = 'maude-recovered';
26
+
27
+ /**
28
+ * Was this page brought back by the shell's crash recovery? Strips the marker from the address.
29
+ * @param {{ location: { href: string }, history: { state: unknown, replaceState(s: unknown, t: string, u: string): void } } | null} win
30
+ */
31
+ export function takeRecoveredMarker(win) {
32
+ try {
33
+ if (!win?.location) return false;
34
+ const url = new URL(win.location.href);
35
+ if (!url.searchParams.has(RECOVERED_PARAM)) return false;
36
+ url.searchParams.delete(RECOVERED_PARAM);
37
+ try {
38
+ win.history?.replaceState(win.history.state, '', `${url.pathname}${url.search}${url.hash}`);
39
+ } catch {
40
+ /* the guard still knows; the address just keeps the marker */
41
+ }
42
+ return true;
43
+ } catch {
44
+ return false;
45
+ }
46
+ }
47
+
48
+ // Read as the bundle loads, before the address hook rewrites the URL (`withOpenParam` keeps only `open`).
49
+ const RECOVERED_AT_BOOT = typeof window === 'undefined' ? false : takeRecoveredMarker(window);
50
+
51
+ function empty() {
52
+ return { live: null, crashes: {}, light: {} };
53
+ }
54
+
55
+ function read(storage) {
56
+ try {
57
+ const raw = storage?.getItem(CRASH_KEY);
58
+ if (!raw) return empty();
59
+ const s = JSON.parse(raw);
60
+ if (!s || typeof s !== 'object') return empty();
61
+ return {
62
+ live: typeof s.live === 'string' ? s.live : null,
63
+ crashes: s.crashes && typeof s.crashes === 'object' ? s.crashes : {},
64
+ light: s.light && typeof s.light === 'object' ? s.light : {},
65
+ };
66
+ } catch {
67
+ return empty();
68
+ }
69
+ }
70
+
71
+ /**
72
+ * @param {{ getItem(k: string): string | null, setItem(k: string, v: string): void } | null} storage
73
+ * @param {() => number} [now]
74
+ * @param {{ recovered?: boolean }} [boot] `recovered`: the shell's crash recovery brought this page back.
75
+ */
76
+ export function createCrashGuard(storage, now = Date.now, { recovered = false } = {}) {
77
+ const s = read(storage);
78
+ const save = () => {
79
+ try {
80
+ storage?.setItem(CRASH_KEY, JSON.stringify(s));
81
+ } catch {
82
+ /* private mode / quota — the guard just forgets */
83
+ }
84
+ };
85
+ const prune = () => {
86
+ const t = now();
87
+ for (const [p, list] of Object.entries(s.crashes)) {
88
+ const kept = Array.isArray(list)
89
+ ? list.filter((x) => typeof x === 'number' && t - x < CRASH_WINDOW_MS)
90
+ : [];
91
+ if (kept.length) s.crashes[p] = kept;
92
+ else delete s.crashes[p];
93
+ }
94
+ for (const [p, at] of Object.entries(s.light)) {
95
+ if (typeof at !== 'number' || t - at >= LIGHT_KEEP_MS) delete s.light[p];
96
+ }
97
+ };
98
+ // Boot: a mark left behind is a page that died with that canvas open — a crash only when the shell's
99
+ // crash recovery brought the page back; otherwise (a quit, a relaunch, a reload) it is just dropped.
100
+ if (s.live && recovered) {
101
+ const list = s.crashes[s.live] || [];
102
+ list.push(now());
103
+ s.crashes[s.live] = list;
104
+ }
105
+ s.live = null;
106
+ prune();
107
+ save();
108
+
109
+ return {
110
+ /** The open canvas (null when none is framed). Called whenever the active frame changes. */
111
+ noteOpen(path) {
112
+ const next = typeof path === 'string' && path ? path : null;
113
+ if (s.live === next) return;
114
+ s.live = next;
115
+ save();
116
+ },
117
+ /** A clean unload (`pagehide`): whatever was open did not crash the page. */
118
+ noteClean() {
119
+ if (s.live === null) return;
120
+ s.live = null;
121
+ save();
122
+ },
123
+ crashCount(path) {
124
+ prune();
125
+ return (s.crashes[path] || []).length;
126
+ },
127
+ /** Too heavy: it crashed the page `CRASH_LIMIT` times recently and no lighter mode was chosen. */
128
+ tooHeavy(path) {
129
+ if (!path) return false;
130
+ prune();
131
+ return (s.crashes[path] || []).length >= CRASH_LIMIT && !(path in s.light);
132
+ },
133
+ isLight(path) {
134
+ prune();
135
+ return !!path && path in s.light;
136
+ },
137
+ /** "Show visible artboards only". */
138
+ chooseLight(path) {
139
+ s.light[path] = now();
140
+ save();
141
+ },
142
+ /** "Show everything": forget the crashes and the lighter mode for this canvas. */
143
+ forgive(path) {
144
+ delete s.crashes[path];
145
+ delete s.light[path];
146
+ save();
147
+ },
148
+ };
149
+ }
150
+
151
+ let shared = null;
152
+ const subs = new Set();
153
+
154
+ /** The page's one guard, on localStorage, cleared on a clean pagehide. */
155
+ export function crashGuard() {
156
+ if (shared) return shared;
157
+ const storage = typeof localStorage === 'undefined' ? null : localStorage;
158
+ const g = createCrashGuard(storage, Date.now, { recovered: RECOVERED_AT_BOOT });
159
+ const wrap = (fn) => (path) => {
160
+ fn(path);
161
+ for (const cb of subs) cb();
162
+ };
163
+ shared = { ...g, chooseLight: wrap(g.chooseLight), forgive: wrap(g.forgive) };
164
+ if (typeof window !== 'undefined') window.addEventListener('pagehide', () => g.noteClean());
165
+ return shared;
166
+ }
167
+
168
+ /** Re-render on a choice made on the card. */
169
+ export function subscribeCrashGuard(cb) {
170
+ subs.add(cb);
171
+ return () => subs.delete(cb);
172
+ }
@@ -61,6 +61,10 @@ export function createShellMode(caps = ALL_CAPS) {
61
61
  position: null,
62
62
  media: null,
63
63
  viewing: null,
64
+ // 2.0.7 B2 — the active canvas shows Pages (canvas-pages.ts, told over `pages-view`): Preview and Present are
65
+ // off meanwhile, like the Viewing hold refuses them. The canvas owns the view; this is only its echo.
66
+ pages: false,
67
+ pagesAt: null,
64
68
  });
65
69
  const subs = new Set();
66
70
  const emit = (next) => {
@@ -78,6 +82,7 @@ export function createShellMode(caps = ALL_CAPS) {
78
82
  * presenting leaves Present for it. Present itself goes through `present(spec)`. */
79
83
  select(mode, { tool = null } = {}) {
80
84
  if (mode === 'present' || snap.viewing) return; // S1.14: a past version holds the mode
85
+ if (mode === 'preview' && snap.pages) return; // 2.0.7 B2: Pages holds Preview off
81
86
  emit({ mode, tool, nonce: snap.nonce + 1, ...notPresenting });
82
87
  },
83
88
  /**
@@ -102,6 +107,17 @@ export function createShellMode(caps = ALL_CAPS) {
102
107
  });
103
108
  return true;
104
109
  },
110
+ /**
111
+ * 2.0.7 B2 — the active canvas says whether it shows Pages (a new active canvas starts at false); 2.0.7 polish —
112
+ * and which artboard is on the page (`at`, the left panel marks it; null when off or not said).
113
+ */
114
+ pages(on, at = null) {
115
+ const next = on === true;
116
+ const nextAt = next && typeof at === 'string' && at ? at : null;
117
+ if (snap.pages === next && (snap.pagesAt ?? null) === nextAt) return false;
118
+ emit({ pages: next, pagesAt: nextAt });
119
+ return true;
120
+ },
105
121
  /** esc / "back to now" / a restore: leave the hold. */
106
122
  leaveViewing() {
107
123
  if (!snap.viewing) return false;
@@ -110,7 +126,7 @@ export function createShellMode(caps = ALL_CAPS) {
110
126
  },
111
127
  /** Enter Present (Artboards or the Canvas). Already presenting: nothing (esc leaves first). */
112
128
  present(spec) {
113
- if (snap.mode === 'present' || snap.viewing) return false;
129
+ if (snap.mode === 'present' || snap.viewing || snap.pages) return false;
114
130
  emit({
115
131
  mode: 'present',
116
132
  tool: null,