@1agh/maude 2.0.6 → 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 (177) hide show
  1. package/apps/studio/access/closure.ts +156 -16
  2. package/apps/studio/access/filters.ts +27 -0
  3. package/apps/studio/actions/agents.ts +54 -0
  4. package/apps/studio/actions/ctx.ts +3 -0
  5. package/apps/studio/actions/defs/sync.ts +13 -0
  6. package/apps/studio/actions/defs/view.ts +59 -3
  7. package/apps/studio/actions/keymap.gen.ts +35 -0
  8. package/apps/studio/actions/menu.ts +2 -0
  9. package/apps/studio/actions/types.ts +3 -1
  10. package/apps/studio/actions.manifest.json +136 -1
  11. package/apps/studio/actions.parity.json +25 -1
  12. package/apps/studio/annotations/ui/ai-seen.tsx +4 -3
  13. package/apps/studio/annotations/ui/ride.ts +2 -1
  14. package/apps/studio/annotations-context-toolbar.tsx +5 -4
  15. package/apps/studio/annotations-layer.tsx +4 -3
  16. package/apps/studio/api.ts +383 -128
  17. package/apps/studio/artboard-activity-overlay.tsx +4 -4
  18. package/apps/studio/artboard-ai-copies.tsx +4 -4
  19. package/apps/studio/artboard-freeze.ts +108 -0
  20. package/apps/studio/artboard-live-gate.tsx +414 -45
  21. package/apps/studio/artboard-live.ts +526 -31
  22. package/apps/studio/artboard-placeholder.ts +197 -0
  23. package/apps/studio/artboard-still-raster.ts +485 -0
  24. package/apps/studio/artboard-still-warmup.ts +221 -0
  25. package/apps/studio/artboard-still.ts +1188 -0
  26. package/apps/studio/artboard-webgl.ts +2 -1
  27. package/apps/studio/asset-placeholder.tsx +237 -132
  28. package/apps/studio/asset-upload-bars.tsx +4 -4
  29. package/apps/studio/bin/_perf-probe-open.mjs +364 -0
  30. package/apps/studio/bin/_perf-shared.mjs +12 -7
  31. package/apps/studio/bin/_pw-launch.mjs +26 -1
  32. package/apps/studio/bin/perf.sh +19 -0
  33. package/apps/studio/bridge/dgn-protocol.ts +35 -0
  34. package/apps/studio/canvas-build-sandbox.ts +69 -13
  35. package/apps/studio/canvas-camera.ts +90 -0
  36. package/apps/studio/canvas-comment-mount.tsx +9 -9
  37. package/apps/studio/canvas-lib.tsx +160 -34
  38. package/apps/studio/canvas-pages-view.tsx +465 -0
  39. package/apps/studio/canvas-pages.ts +305 -0
  40. package/apps/studio/canvas-rows.ts +62 -0
  41. package/apps/studio/canvas-shell.tsx +62 -16
  42. package/apps/studio/canvas-theme-icons.tsx +41 -0
  43. package/apps/studio/canvas-theme-pill.tsx +15 -6
  44. package/apps/studio/canvas-theme.ts +12 -11
  45. package/apps/studio/client/app.jsx +7 -0
  46. package/apps/studio/client/canvas-url.js +23 -1
  47. package/apps/studio/client/hooks/canvas-origin-probe.js +34 -0
  48. package/apps/studio/client/hooks/use-action-keys.jsx +3 -1
  49. package/apps/studio/client/hooks/use-canvas-bridge.jsx +1 -1
  50. package/apps/studio/client/hooks/use-palette-and-panels.jsx +23 -6
  51. package/apps/studio/client/hooks/use-photo-and-timeline.jsx +16 -8
  52. package/apps/studio/client/hooks/use-project-data.jsx +11 -2
  53. package/apps/studio/client/hooks/use-shell-core.jsx +19 -9
  54. package/apps/studio/client/index-loader.ts +41 -21
  55. package/apps/studio/client/inspector/inspector-panel.jsx +35 -14
  56. package/apps/studio/client/shell/viewport.jsx +32 -16
  57. package/apps/studio/client/tree/tree.jsx +17 -0
  58. package/apps/studio/client/v2/canvases/canvases-panel.jsx +24 -0
  59. package/apps/studio/client/v2/canvases/use-canvas-index.js +24 -1
  60. package/apps/studio/client/v2/code/canvas-error-card.jsx +14 -2
  61. package/apps/studio/client/v2/code/canvas-imports-card.jsx +7 -3
  62. package/apps/studio/client/v2/code/canvas-imports-words.js +16 -0
  63. package/apps/studio/client/v2/code/canvas-waiting-card.jsx +59 -5
  64. package/apps/studio/client/v2/code/canvas-waiting.js +18 -1
  65. package/apps/studio/client/v2/code/code-consent-sheet.jsx +87 -0
  66. package/apps/studio/client/v2/code/code-consent.js +67 -0
  67. package/apps/studio/client/v2/diagnostics/sync-details/sync-details-model.js +62 -10
  68. package/apps/studio/client/v2/diagnostics/sync-details/sync-details.jsx +314 -5
  69. package/apps/studio/client/v2/layers/artboard-layers.jsx +24 -5
  70. package/apps/studio/client/v2/layers/layers-request.js +49 -0
  71. package/apps/studio/client/v2/left-panel/canvases-pinned.jsx +93 -3
  72. package/apps/studio/client/v2/left-panel/ds-boards.js +39 -0
  73. package/apps/studio/client/v2/left-panel/left-panel-model.js +13 -0
  74. package/apps/studio/client/v2/left-panel/left-panel.css +24 -0
  75. package/apps/studio/client/v2/shell/canvas-crash-guard.js +40 -5
  76. package/apps/studio/client/v2/shell/canvas-mode.js +17 -1
  77. package/apps/studio/client/v2/shell/floating-panels.css +37 -1
  78. package/apps/studio/client/v2/shell/mode-switch.jsx +14 -3
  79. package/apps/studio/client/v2/shell/opening-skeleton.js +118 -0
  80. package/apps/studio/client/v2/shell/opening-skeleton.jsx +103 -0
  81. package/apps/studio/client/v2/shell/pages-pick.js +49 -0
  82. package/apps/studio/client/v2/shell/project-menu-model.js +3 -0
  83. package/apps/studio/client/v2/shell/share-cluster-host.jsx +3 -1
  84. package/apps/studio/client/v2/shell/shell-parity.json +8 -0
  85. package/apps/studio/client/v2/shell/use-canvas-mode-lane.js +30 -0
  86. package/apps/studio/comments-overlay.tsx +12 -11
  87. package/apps/studio/config-reload-wire.ts +4 -1
  88. package/apps/studio/config.schema.json +6 -0
  89. package/apps/studio/context.ts +37 -1
  90. package/apps/studio/dist/client.bundle.js +720 -720
  91. package/apps/studio/dist/comment-mount.js +2 -2
  92. package/apps/studio/dist/styles.css +1 -1
  93. package/apps/studio/ds/board/board.css +6 -0
  94. package/apps/studio/ds/board/ds-bar.tsx +21 -3
  95. package/apps/studio/ds/board/specimen.tsx +6 -3
  96. package/apps/studio/ds/board/template.ts +39 -19
  97. package/apps/studio/ds/cli.ts +7 -1
  98. package/apps/studio/ds/component-list.ts +2 -1
  99. package/apps/studio/ds/default.ts +6 -1
  100. package/apps/studio/ds/ds-resolver.ts +58 -8
  101. package/apps/studio/ds/engine.ts +3 -1
  102. package/apps/studio/ds/folder-systems.ts +199 -0
  103. package/apps/studio/ds/pairing-css.ts +2 -1
  104. package/apps/studio/ds/rename.ts +10 -3
  105. package/apps/studio/ds/shell-fallbacks.ts +2 -1
  106. package/apps/studio/ds/upgrade-stage.ts +6 -2
  107. package/apps/studio/editing/ai-point-ring.tsx +4 -4
  108. package/apps/studio/editing/ai-scope-outline.tsx +4 -4
  109. package/apps/studio/editing/align-bar.tsx +4 -4
  110. package/apps/studio/editing/anchor-report.ts +3 -2
  111. package/apps/studio/editing/artboard-handles.tsx +4 -4
  112. package/apps/studio/editing/corner-dots.tsx +4 -4
  113. package/apps/studio/editing/crop-mode.tsx +4 -4
  114. package/apps/studio/editing/drop-chip.tsx +4 -4
  115. package/apps/studio/editing/empty-report.ts +3 -2
  116. package/apps/studio/editing/focus-model.tsx +4 -4
  117. package/apps/studio/editing/gap-bands.tsx +3 -3
  118. package/apps/studio/editing/hold-rings.tsx +4 -4
  119. package/apps/studio/editing/lock-badge.tsx +3 -3
  120. package/apps/studio/editing/long-page.ts +23 -1
  121. package/apps/studio/editing/nudge.tsx +2 -2
  122. package/apps/studio/editing/page-activity.ts +4 -3
  123. package/apps/studio/editing/paste-bar.tsx +4 -4
  124. package/apps/studio/editing/pen/overlay.tsx +4 -3
  125. package/apps/studio/editing/place-freely.tsx +3 -3
  126. package/apps/studio/editing/reorder-slot.tsx +3 -3
  127. package/apps/studio/editing/selection.tsx +4 -4
  128. package/apps/studio/editing/size-ghost.tsx +4 -4
  129. package/apps/studio/editing/tab-order.tsx +4 -4
  130. package/apps/studio/editing/text-in-place.tsx +4 -4
  131. package/apps/studio/editing/undo-preview.tsx +3 -3
  132. package/apps/studio/equal-spacing-handles.tsx +3 -3
  133. package/apps/studio/frame-clock.ts +89 -0
  134. package/apps/studio/http.ts +66 -32
  135. package/apps/studio/index/ds-usage.ts +4 -1
  136. package/apps/studio/index-cache.ts +272 -0
  137. package/apps/studio/inspect-overlay.tsx +4 -3
  138. package/apps/studio/inspect.ts +7 -2
  139. package/apps/studio/link-chip-overlay.tsx +4 -3
  140. package/apps/studio/measure-overlay.tsx +4 -3
  141. package/apps/studio/present/pointer-dot.tsx +3 -2
  142. package/apps/studio/present/present-media.ts +6 -2
  143. package/apps/studio/present/present-stage.tsx +3 -2
  144. package/apps/studio/preview/preview-camera.tsx +3 -2
  145. package/apps/studio/routes/sync.ts +176 -0
  146. package/apps/studio/safe-zones-overlay.tsx +3 -2
  147. package/apps/studio/skip-dirs.ts +103 -47
  148. package/apps/studio/studio-page-host.ts +70 -0
  149. package/apps/studio/sync/code-module-consent.ts +86 -0
  150. package/apps/studio/sync/file-ledger.ts +24 -0
  151. package/apps/studio/sync/file-plane.ts +458 -53
  152. package/apps/studio/sync/held-deletes.ts +230 -0
  153. package/apps/studio/sync/hubs-config.ts +59 -2
  154. package/apps/studio/sync/index.ts +99 -15
  155. package/apps/studio/sync/seed-progress.ts +92 -2
  156. package/apps/studio/sync/settings.ts +36 -1
  157. package/apps/studio/sync/status.ts +15 -1
  158. package/apps/studio/sync/writer-registry.ts +5 -0
  159. package/apps/studio/text-caret.ts +5 -3
  160. package/apps/studio/toolbars/toolbar-rect.ts +3 -2
  161. package/apps/studio/use-annotation-resize.tsx +4 -3
  162. package/apps/studio/use-artboard-drag.tsx +3 -2
  163. package/apps/studio/use-element-resize.tsx +7 -6
  164. package/apps/studio/use-grid-track-handles.tsx +5 -4
  165. package/apps/studio/use-selection-set.tsx +64 -4
  166. package/apps/studio/use-spacing-handles.tsx +7 -6
  167. package/apps/studio/video-comp.tsx +55 -42
  168. package/apps/studio/video-play-overlay.tsx +4 -3
  169. package/apps/studio/whats-new.json +27 -0
  170. package/cli/commands/design.mjs +5 -2
  171. package/cli/commands/hub.mjs +10 -1
  172. package/cli/lib/bash-guard.mjs +14 -0
  173. package/cli/lib/design-help.gen.mjs +1 -1
  174. package/cli/lib/design-link.mjs +42 -17
  175. package/cli/lib/hub-purge.mjs +183 -0
  176. package/package.json +8 -8
  177. package/plugins/design/templates/_shell.html +164 -1
@@ -103,6 +103,9 @@ export const DELIVERY_WORD = Object.freeze({
103
103
  stuck: 'stuck',
104
104
  'referenced-but-unoffered': 'used, never received',
105
105
  'local-only': 'only on this Mac',
106
+ // Issue #207 (7b) — a delete waiting for the person's answer, and a file they kept on the hub.
107
+ 'delete-held': 'deleted on this Mac — waiting for your answer',
108
+ 'hub-only': 'on the hub only',
106
109
  });
107
110
 
108
111
  const thousands = (n) => String(n).replace(/\B(?=(\d{3})+(?!\d))/g, ' ');
@@ -153,6 +156,31 @@ export function syncDetailsModel(
153
156
  const held = Array.isArray(files?.held)
154
157
  ? files.held.filter((h) => h && typeof h.kind === 'string')
155
158
  : [];
159
+ // Issue #207 (7b) — Deleted on this Mac, held: a card with its own answer (Delete on the hub too ·
160
+ // Keep on the hub), naming the folders and the count. While the owner's purge of them runs, the
161
+ // card says how far it is (or why it stopped).
162
+ const deletesOut = held.find((h) => h.kind === 'delete-out' && isCount(h.count) && h.count > 0);
163
+ if (deletesOut) {
164
+ needs.push({
165
+ kind: 'deletes-held',
166
+ count: deletesOut.count,
167
+ detail: cleanName(deletesOut.detail, 'Files deleted on this Mac are held.', HELD_DETAIL_MAX),
168
+ folders: (Array.isArray(deletesOut.folders) ? deletesOut.folders : [])
169
+ .filter((f) => f && typeof f.folder === 'string' && isCount(f.count))
170
+ .slice(0, 10)
171
+ .map((f) => ({ folder: f.folder, count: f.count })),
172
+ });
173
+ }
174
+ const purge = files?.deletePurge;
175
+ if (purge && isCount(purge.total) && isCount(purge.done)) {
176
+ needs.push({
177
+ kind: 'deletes-purging',
178
+ total: purge.total,
179
+ done: Math.min(purge.done, purge.total),
180
+ running: purge.running === true,
181
+ error: typeof purge.error === 'string' ? cleanName(purge.error, '', HELD_DETAIL_MAX) : '',
182
+ });
183
+ }
156
184
  const rateLimited = files?.rateLimited
157
185
  ? isCount(files.rateLimited.waiting)
158
186
  ? files.rateLimited.waiting
@@ -160,11 +188,15 @@ export function syncDetailsModel(
160
188
  : 0;
161
189
  const failed = files && isCount(files.failed) ? files.failed : 0;
162
190
  const attention = [];
191
+ const hubOnly = [];
163
192
  const delivery = status?.files?.delivery;
164
193
  if (delivery && typeof delivery === 'object' && !Array.isArray(delivery)) {
165
- for (const [rel, state] of Object.entries(delivery))
194
+ for (const [rel, state] of Object.entries(delivery)) {
166
195
  if (typeof state === 'string' && ATTENTION.has(state)) attention.push([rel, state]);
196
+ if (state === 'hub-only') hubOnly.push(rel);
197
+ }
167
198
  attention.sort((a, b) => a[0].localeCompare(b[0]));
199
+ hubOnly.sort((a, b) => a.localeCompare(b));
168
200
  }
169
201
 
170
202
  const counts = [];
@@ -174,7 +206,10 @@ export function syncDetailsModel(
174
206
  'Project files',
175
207
  progress.remaining > 0
176
208
  ? `${thousands(progress.delivered)} of ${thousands(progress.tracked)}`
177
- : `${thousands(progress.tracked)} · all here`,
209
+ : hubOnly.length > 0
210
+ ? // 2.0.7 — files kept on the hub (Keep on the hub) are not here: say both numbers
211
+ `${thousands(Math.max(0, progress.tracked - hubOnly.length))} here · ${thousands(hubOnly.length)} on the hub only`
212
+ : `${thousands(progress.tracked)} · all here`,
178
213
  ]);
179
214
  } else if (files) {
180
215
  counts.push(['files', 'Project files', `${thousands(files.synced)} · all here`]);
@@ -196,23 +231,40 @@ export function syncDetailsModel(
196
231
  ]);
197
232
  }
198
233
 
234
+ // A purge still running is news, not a question: it needs the person only once it stopped short.
235
+ const asking = needs.filter((n) => !(n.kind === 'deletes-purging' && !n.error)).length;
199
236
  return {
200
237
  title: `Sync · ${cleanName(project, 'this project')}`,
201
- needWord: needs.length ? `${needs.length} need you` : null,
238
+ needWord: asking ? `${asking} need you` : null,
202
239
  needs,
203
240
  moving,
204
241
  counts,
205
242
  lists: {
206
- held: held.map((h) => ({
207
- kind: h.kind,
208
- detail: cleanName(h.detail, 'Sync paused — nothing was removed.', HELD_DETAIL_MAX),
209
- paths: Array.isArray(h.paths)
210
- ? h.paths.filter((p) => typeof p === 'string').slice(0, 50)
211
- : [],
212
- })),
243
+ // `delete-out` is the Needs you card above (its own answer), not a second row here.
244
+ held: held
245
+ .filter((h) => !(deletesOut && h === deletesOut))
246
+ .map((h) => ({
247
+ kind: h.kind,
248
+ detail: cleanName(h.detail, 'Sync paused — nothing was removed.', HELD_DETAIL_MAX),
249
+ paths: Array.isArray(h.paths)
250
+ ? h.paths.filter((p) => typeof p === 'string').slice(0, 50)
251
+ : [],
252
+ })),
213
253
  rateLimited: files?.rateLimited ? { waiting: rateLimited } : null,
214
254
  failed,
215
255
  attention: attention.slice(0, 50),
256
+ // Issue #207 (7b) — deleted on this Mac and kept on the hub: listed, never "waiting".
257
+ hubOnly: { count: hubOnly.length, paths: hubOnly.slice(0, 50) },
258
+ // Issue #207 — a long run of pictures going up (a render sequence), and the folders this
259
+ // project leaves out. Both from the server's status; cleaned here like every other list.
260
+ sequences: (Array.isArray(files?.largeSequences) ? files.largeSequences : [])
261
+ .filter((s) => s && typeof s.folder === 'string' && isCount(s.files) && isCount(s.bytes))
262
+ .slice(0, 5)
263
+ .map((s) => ({ folder: s.folder, files: s.files, bytes: s.bytes })),
264
+ ignoredFolders: (Array.isArray(files?.ignoreFolders) ? files.ignoreFolders : [])
265
+ .filter((f) => typeof f === 'string' && f.length > 0)
266
+ .slice(0, 50),
267
+ ignoredFiles: isCount(progress?.ignored) ? progress.ignored : 0,
216
268
  },
217
269
  signIn: refused && !cloud && native,
218
270
  };
@@ -1,7 +1,8 @@
1
1
  // client/v2/diagnostics/sync-details/sync-details.jsx — S11.12 (06 ad-syncd): Menu › Diagnostics ›
2
2
  // Sync, rebuilt. The controls carry the v1 hooks the e2e scenarios drive (S11.12b): sync-panel (root) ·
3
3
  // sync-ai-held · sync-ai-publish · sync-ai-discard · sync-assets-cancel · sync-signin-again ·
4
- // sync-delivery-attention. Replaces the v1 Sync panel's mount in the sheet (its routes stay; SyncPanel.jsx and
4
+ // sync-delivery-attention · sync-deletes-held (+ -delete / -keep / -confirm / -cancel / -said /
5
+ // -folders / -confirming) · sync-deletes-purging · sync-hub-only. Replaces the v1 Sync panel's mount in the sheet (its routes stay; SyncPanel.jsx and
5
6
  // SourceConflictPanel.jsx keep their files). What needs the person comes first, each with its own
6
7
  // choice; the transfer, the counts and the lists follow.
7
8
  //
@@ -14,6 +15,8 @@ import { useEffect, useRef, useState } from 'react';
14
15
  import { MEDIA_STAYS_LINE, MEDIA_STAYS_NEXT } from '../../../../sync/media-gate.ts';
15
16
  import { safeDetail, syncPresentation } from '../../../../sync/presentation.ts';
16
17
  import { lineDiff } from '../../../panels/SourceConflictPanel.jsx';
18
+ import { readCodeConsent } from '../../code/code-consent.js';
19
+ import { CodeConsentSheet } from '../../code/code-consent-sheet.jsx';
17
20
  import { DELIVERY_WORD, cleanName, resolvedWords, syncDetailsModel } from './sync-details-model.js';
18
21
 
19
22
  /** Registry id → the `choice` the conflict route takes. */
@@ -155,6 +158,174 @@ function ConflictCard({ slug, canvasName, fetchImpl, onResolved, focusSeq = 0 })
155
158
  );
156
159
  }
157
160
 
161
+ /**
162
+ * fix/207 — shared code from the project's hub: the held row's "Allow shared code…" and, once it is
163
+ * allowed on this Mac, "Stop allowing shared code…". Both open the confirm sheet; the server writes
164
+ * the answer (POST /_api/sync/code-consent/set) and the next pass brings what was held.
165
+ */
166
+ export function useCodeConsent(fetchImpl, seq = 0) {
167
+ const [consent, setConsent] = useState(null);
168
+ // biome-ignore lint/correctness/useExhaustiveDependencies: re-read when the held rows change
169
+ useEffect(() => {
170
+ let live = true;
171
+ readCodeConsent(fetchImpl).then((c) => {
172
+ if (live) setConsent(c);
173
+ });
174
+ return () => {
175
+ live = false;
176
+ };
177
+ }, [seq]);
178
+ return [consent, setConsent];
179
+ }
180
+
181
+ function CodeConsentButton({ mode, host, fetchImpl, onDone }) {
182
+ const [open, setOpen] = useState(false);
183
+ const stop = mode === 'stop';
184
+ return (
185
+ <>
186
+ <button
187
+ type="button"
188
+ className="sd-link"
189
+ data-action={stop ? 'sync.stop-code' : 'sync.allow-code'}
190
+ data-testid={stop ? 'diag-sync-stop-code' : 'diag-sync-allow-code'}
191
+ onClick={() => setOpen(true)}
192
+ >
193
+ {stop ? 'Stop allowing shared code…' : 'Allow shared code…'}
194
+ </button>
195
+ {open ? (
196
+ <CodeConsentSheet
197
+ mode={mode}
198
+ host={host}
199
+ fetchImpl={fetchImpl}
200
+ onClose={() => setOpen(false)}
201
+ onDone={(c) => {
202
+ setOpen(false);
203
+ onDone?.(c);
204
+ }}
205
+ />
206
+ ) : null}
207
+ </>
208
+ );
209
+ }
210
+
211
+ const filesWord = (n) => `${n.toLocaleString('en-US')} ${n === 1 ? 'file' : 'files'}`;
212
+
213
+ /** Issue #207 (7b) — the words after an answer to held deletes (CONTRACT §3–§4: plain, no "we"). */
214
+ export function heldDeletesWords(answer) {
215
+ if (!answer?.ok) return safeDetail(answer?.detail, 'That didn’t work. Nothing was deleted.');
216
+ if (answer.how === 'keep')
217
+ return `Kept on the hub. ${filesWord(answer.count)} stay there and aren’t downloaded again.`;
218
+ if (answer.how === 'purge')
219
+ return `Deleting ${filesWord(answer.count)} on the hub. A batch this big takes a few minutes.`;
220
+ return `Deleting ${filesWord(answer.count)} on the hub.`;
221
+ }
222
+
223
+ /**
224
+ * Issue #207 (7b) — Deleted on this Mac, held: a batch of local deletes larger than sync sends unasked.
225
+ * Delete on the hub too… asks once more (the batch reaches every teammate), then sends it as one
226
+ * confirmed batch; Keep on the hub leaves the files there and never downloads them again. Both
227
+ * `POST /_api/sync/held-deletes`; the server picks the hub's door or the owner's confirmed purge.
228
+ */
229
+ function HeldDeletesCard({ need, fetchImpl }) {
230
+ const [confirming, setConfirming] = useState(false);
231
+ const [busy, setBusy] = useState(false);
232
+ const [said, setSaid] = useState('');
233
+ const [done, setDone] = useState(false);
234
+ async function answer(kind) {
235
+ setBusy(true);
236
+ setSaid('');
237
+ const r = await postJson(fetchImpl, '/_api/sync/held-deletes', { answer: kind, folder: null });
238
+ setBusy(false);
239
+ setConfirming(false);
240
+ setSaid(heldDeletesWords(r));
241
+ if (r?.ok) setDone(true);
242
+ }
243
+ const n = need.count;
244
+ return (
245
+ <div className="sd-card" data-testid="sync-deletes-held">
246
+ <strong className="sd-ct">Deleted on this Mac · {filesWord(n)}</strong>
247
+ <span className="sd-cd">{need.detail}</span>
248
+ {need.folders.length ? (
249
+ <ul className="sd-failed" data-testid="sync-deletes-held-folders">
250
+ {need.folders.map((f) => (
251
+ <li key={f.folder}>
252
+ <span className="dg-mono">{cleanName(f.folder, 'the project folder')}</span>{' '}
253
+ {filesWord(f.count)}
254
+ </li>
255
+ ))}
256
+ </ul>
257
+ ) : null}
258
+ {done ? null : confirming ? (
259
+ <div className="sd-acts" data-testid="sync-deletes-held-confirming">
260
+ <span className="sd-cd">
261
+ Move {filesWord(n)} to the hub’s trash? Each teammate confirms on their own Mac.
262
+ </span>
263
+ <button
264
+ type="button"
265
+ className="dg-btn dg-btn--primary"
266
+ data-testid="sync-deletes-held-confirm"
267
+ disabled={busy}
268
+ onClick={() => answer('delete')}
269
+ >
270
+ Move to the hub’s trash
271
+ </button>
272
+ <button
273
+ type="button"
274
+ className="dg-btn"
275
+ data-testid="sync-deletes-held-cancel"
276
+ disabled={busy}
277
+ onClick={() => setConfirming(false)}
278
+ >
279
+ Cancel
280
+ </button>
281
+ </div>
282
+ ) : (
283
+ <div className="sd-acts">
284
+ <button
285
+ type="button"
286
+ className="dg-btn"
287
+ data-action="sync.delete-held-on-hub"
288
+ data-testid="sync-deletes-held-delete"
289
+ disabled={busy}
290
+ onClick={() => setConfirming(true)}
291
+ >
292
+ Move to the hub’s trash too…
293
+ </button>
294
+ <button
295
+ type="button"
296
+ className="dg-btn"
297
+ data-action="sync.keep-held-on-hub"
298
+ data-testid="sync-deletes-held-keep"
299
+ disabled={busy}
300
+ onClick={() => answer('keep')}
301
+ >
302
+ Keep on the hub
303
+ </button>
304
+ </div>
305
+ )}
306
+ {said ? (
307
+ <p className="dg-hint" role="status" data-testid="sync-deletes-held-said">
308
+ {said}
309
+ </p>
310
+ ) : null}
311
+ </div>
312
+ );
313
+ }
314
+
315
+ /** Issue #207 (7b) — the owner's purge of held deletes: how far it is, or why it stopped. */
316
+ function DeletesPurgingCard({ need }) {
317
+ return (
318
+ <div className="sd-card" data-testid="sync-deletes-purging">
319
+ <strong className="sd-ct">
320
+ {need.error
321
+ ? 'Deleting on the hub stopped.'
322
+ : `Deleting on the hub · ${need.done.toLocaleString('en-US')} of ${filesWord(need.total)}`}
323
+ </strong>
324
+ {need.error ? <span className="sd-cd">{need.error}</span> : null}
325
+ </div>
326
+ );
327
+ }
328
+
158
329
  // The team server holds no media checkout (sync/media-gate.ts words): said once, with the next step.
159
330
  function AssetsStayCard() {
160
331
  return (
@@ -232,6 +403,97 @@ function AiCard({ need, fetchImpl }) {
232
403
  );
233
404
  }
234
405
 
406
+ /** 1 234 567 890 → "1.1 GB"; below a gigabyte, whole megabytes. */
407
+ function sizeWord(bytes) {
408
+ const mb = bytes / (1024 * 1024);
409
+ return mb >= 1024 ? `${(mb / 1024).toFixed(1)} GB` : `${Math.max(1, Math.round(mb))} MB`;
410
+ }
411
+
412
+ /**
413
+ * Issue #207 — a long run of pictures going up (a render sequence), and the folders this project
414
+ * leaves out. Never a warning: the pictures sync like every other file; leaving the folder out is
415
+ * an option, and "Sync it again" undoes it. Both write `linkedHub.ignoreFolders` through
416
+ * `/_api/sync/settings`; the next pass applies it.
417
+ */
418
+ function FoldersSection({ sequences, ignored, fetchImpl }) {
419
+ const [left, setLeft] = useState(() => new Set());
420
+ const [back, setBack] = useState(() => new Set());
421
+ const [said, setSaid] = useState('');
422
+ const change = async (body, done) => {
423
+ setSaid('');
424
+ const res = await postJson(fetchImpl, '/_api/sync/settings', body);
425
+ if (res?.ok) done();
426
+ else setSaid('That didn’t save. Nothing changed — try again.');
427
+ };
428
+ const shown = sequences.filter((s) => !ignored.includes(s.folder));
429
+ const still = ignored.filter((f) => !back.has(f));
430
+ if (!shown.length && !still.length) return null;
431
+ return (
432
+ <section aria-label="Large folders" data-testid="sync-folders">
433
+ {shown.map((s, i) => (
434
+ <div className="sd-card" key={s.folder} data-testid={`sync-large-seq-${i}`}>
435
+ <strong className="sd-ct">
436
+ {cleanName(s.folder)} · {s.files.toLocaleString()} pictures · {sizeWord(s.bytes)}
437
+ </strong>
438
+ {left.has(s.folder) ? (
439
+ <span className="sd-cd" role="status" data-testid={`sync-large-seq-left-${i}`}>
440
+ Left out from the next sync. What’s already in the project stays there.
441
+ </span>
442
+ ) : (
443
+ <>
444
+ <span className="sd-cd">
445
+ They go up like every other file, and a run this long takes a while. You can keep
446
+ this folder on this Mac only.
447
+ </span>
448
+ <div className="sd-acts">
449
+ <button
450
+ type="button"
451
+ className="dg-btn"
452
+ data-action="sync.ignore-folder"
453
+ data-testid={`sync-large-seq-ignore-${i}`}
454
+ onClick={() =>
455
+ change({ addIgnoreFolder: s.folder }, () =>
456
+ setLeft((prev) => new Set(prev).add(s.folder))
457
+ )
458
+ }
459
+ >
460
+ Don’t sync this folder
461
+ </button>
462
+ </div>
463
+ </>
464
+ )}
465
+ </div>
466
+ ))}
467
+ {still.length ? (
468
+ <div data-testid="sync-ignored-folders">
469
+ <p className="sd-sub">Not synced · {still.length}</p>
470
+ {still.map((f, i) => (
471
+ <div className="dg-row" key={f} data-testid={`sync-ignored-folder-${i}`}>
472
+ <span className="dg-k dg-mono">{cleanName(f)}</span>
473
+ <button
474
+ type="button"
475
+ className="dg-btn"
476
+ data-action="sync.sync-folder-again"
477
+ data-testid={`sync-ignored-folder-resume-${i}`}
478
+ onClick={() =>
479
+ change({ removeIgnoreFolder: f }, () => setBack((prev) => new Set(prev).add(f)))
480
+ }
481
+ >
482
+ Sync it again
483
+ </button>
484
+ </div>
485
+ ))}
486
+ </div>
487
+ ) : null}
488
+ {said ? (
489
+ <p className="dg-hint" role="alert">
490
+ {said}
491
+ </p>
492
+ ) : null}
493
+ </section>
494
+ );
495
+ }
496
+
235
497
  export default function SyncDetails({
236
498
  status,
237
499
  project,
@@ -247,6 +509,9 @@ export default function SyncDetails({
247
509
  const p = syncPresentation(status, { project });
248
510
  const m = syncDetailsModel(status, { project, cloud, native, refused: p?.phase === 'refused' });
249
511
  const [cancelled, setCancelled] = useState(false);
512
+ const codeHeld = m.lists.held.find((h) => h.kind === 'code-consent');
513
+ const [consent, setConsent] = useCodeConsent(fetchImpl, codeHeld ? codeHeld.paths.length + 1 : 0);
514
+ const canChange = consent?.changeable === true;
250
515
  return (
251
516
  <div className="sd" data-testid="sync-panel">
252
517
  <div className="dg-hd">
@@ -274,6 +539,10 @@ export default function SyncDetails({
274
539
  <AssetsFailedCard key="assets-failed" need={need} />
275
540
  ) : need.kind === 'assets-stay' ? (
276
541
  <AssetsStayCard key="assets-stay" />
542
+ ) : need.kind === 'deletes-held' ? (
543
+ <HeldDeletesCard key="deletes-held" need={need} fetchImpl={fetchImpl} />
544
+ ) : need.kind === 'deletes-purging' ? (
545
+ <DeletesPurgingCard key="deletes-purging" need={need} />
277
546
  ) : (
278
547
  <AiCard key="ai" need={need} fetchImpl={fetchImpl} />
279
548
  )
@@ -316,6 +585,12 @@ export default function SyncDetails({
316
585
  </section>
317
586
  ) : null}
318
587
 
588
+ <FoldersSection
589
+ sequences={m.lists.sequences}
590
+ ignored={m.lists.ignoredFolders}
591
+ fetchImpl={fetchImpl}
592
+ />
593
+
319
594
  {m.counts.length ? (
320
595
  <section aria-label="Counts" data-testid="diag-sync-counts">
321
596
  <p className="sd-sub">Counts</p>
@@ -334,15 +609,49 @@ export default function SyncDetails({
334
609
  </p>
335
610
  ) : null}
336
611
  {m.lists.held.map((h) => (
337
- <details className="sd-held" key={h.kind} data-testid={`diag-sync-held-${h.kind}`}>
338
- <summary>{h.detail}</summary>
612
+ <div key={h.kind}>
613
+ <details className="sd-held" data-testid={`diag-sync-held-${h.kind}`}>
614
+ <summary>{h.detail}</summary>
615
+ <ul>
616
+ {h.paths.map((rel) => (
617
+ <li key={rel}>{cleanName(rel)}</li>
618
+ ))}
619
+ </ul>
620
+ </details>
621
+ {h.kind === 'code-consent' && canChange && !consent.allowed ? (
622
+ <CodeConsentButton
623
+ mode="allow"
624
+ host={consent.host}
625
+ fetchImpl={fetchImpl}
626
+ onDone={setConsent}
627
+ />
628
+ ) : null}
629
+ </div>
630
+ ))}
631
+ {canChange && consent.allowed && consent.how !== 'cell' ? (
632
+ <p className="dg-hint" data-testid="diag-sync-code-allowed">
633
+ Shared code from {consent.host} is allowed on this Mac.{' '}
634
+ <CodeConsentButton
635
+ mode="stop"
636
+ host={consent.host}
637
+ fetchImpl={fetchImpl}
638
+ onDone={setConsent}
639
+ />
640
+ </p>
641
+ ) : null}
642
+ {m.lists.hubOnly.count ? (
643
+ <details className="sd-held" data-testid="sync-hub-only">
644
+ <summary>
645
+ On the hub only · {filesWord(m.lists.hubOnly.count)} — deleted on this Mac and kept
646
+ on the hub. They aren’t downloaded again.
647
+ </summary>
339
648
  <ul>
340
- {h.paths.map((rel) => (
649
+ {m.lists.hubOnly.paths.map((rel) => (
341
650
  <li key={rel}>{cleanName(rel)}</li>
342
651
  ))}
343
652
  </ul>
344
653
  </details>
345
- ))}
654
+ ) : null}
346
655
  {m.lists.failed > 0 || m.lists.attention.length ? (
347
656
  <div data-testid="diag-sync-failed">
348
657
  {m.lists.attention.length ? (
@@ -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
+ }