@marver-design/marver 0.30.0 → 0.31.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (109) hide show
  1. package/CHANGELOG.md +74 -0
  2. package/README.md +11 -7
  3. package/dist/{anchor-check-c52IDkiQ.mjs → anchor-check-B92s9tVv.mjs} +1 -1
  4. package/dist/{board-tree-BXR8dw4b.mjs → board-tree-DGj0HhEE.mjs} +6 -2
  5. package/dist/{boards-EH2onUXM.mjs → boards-Cim1GTKc.mjs} +32 -2
  6. package/dist/{boards-BeWtjGUM.mjs → boards-OlAhZ87x.mjs} +7 -7
  7. package/dist/{build-C3mUtjEn.mjs → build-BNssmbqd.mjs} +14 -17
  8. package/dist/{capture-DEtM4qm5.mjs → capture-HaS-1or8.mjs} +1 -1
  9. package/dist/cli.mjs +38 -20
  10. package/dist/{collab-BEAcXrBb.mjs → collab-D2NcrOB8.mjs} +53 -14
  11. package/dist/comment-actions-Bxf9Ld4g.mjs +351 -0
  12. package/dist/{comments-XNhMmSSu.mjs → comments-BakJQwaf.mjs} +85 -10
  13. package/dist/config-B0YcFtqS.mjs +510 -0
  14. package/dist/{context-BUnFiyA3.mjs → context-Cj2TcC0H.mjs} +3 -3
  15. package/dist/{daemon-B0Wi1OQ3.mjs → daemon-MxoEQajX.mjs} +223 -26
  16. package/dist/deep-link-DYtuT740.mjs +163 -0
  17. package/dist/{dev-5dlxoW28.mjs → dev-BBZe_brH.mjs} +23 -16
  18. package/dist/devices-uJZ2inMq.mjs +155 -0
  19. package/dist/{events-CLH4ijKP.mjs → events-Dieo1482.mjs} +49 -4
  20. package/dist/{init-CYlFaRzG.mjs → init-BgusplYn.mjs} +40 -10
  21. package/dist/{jam-Cj5gBvwD.mjs → jam-CkuLL8A8.mjs} +1 -1
  22. package/dist/{link-BFFRgrMt.mjs → link-Cmt9Xy4X.mjs} +54 -7
  23. package/dist/{logo-CXY-1yrn.mjs → logo-C9s7-Cy9.mjs} +89 -66
  24. package/dist/{ls-NqmePKOf.mjs → ls-DGVIW-Io.mjs} +1 -1
  25. package/dist/{manifest-DPZ3WNg_.mjs → manifest-CK8Qh4Nq.mjs} +255 -13
  26. package/dist/{marks-BnNANic9.mjs → marks-C8oX8kbE.mjs} +3 -3
  27. package/dist/{marks-DBp3h1Mc.mjs → marks-Dt-5JXCp.mjs} +18 -5
  28. package/dist/{marver-id-gate-vBLb_Icb.mjs → marver-id-gate-BAeuMeaU.mjs} +11 -7
  29. package/dist/md-B9_13Q0R.mjs +105 -0
  30. package/dist/notes-CRAX4wgk.mjs +148 -0
  31. package/dist/own-C8Mq0Hnf.mjs +128 -0
  32. package/dist/pdf-0m721FFn.mjs +117 -0
  33. package/dist/pdf-CZENT6t3.mjs +2299 -0
  34. package/dist/{perf-BCxAo0IS.mjs → perf-BB0XNt1M.mjs} +1 -1
  35. package/dist/{perf-6MOTHxay.mjs → perf-CIMijND6.mjs} +5 -5
  36. package/dist/{plugin-CXRoMA8g.mjs → plugin-CL8_wL7a.mjs} +519 -112
  37. package/dist/{poster-CYmCa00B.mjs → poster-B7uSjlEP.mjs} +1 -1
  38. package/dist/{profile-B1FKOM1e.mjs → profile-cdmSer1k.mjs} +1 -1
  39. package/dist/{publish-bakes-C_2ZtHou.mjs → publish-bakes-BjgDNeyS.mjs} +3 -3
  40. package/dist/{queue-DeSQm24g.mjs → queue-BLLfdlDw.mjs} +156 -11
  41. package/dist/{recover-XD8iXJOj.mjs → recover-ByuFQOF9.mjs} +2 -2
  42. package/dist/{serve-DQv3Ti6X.mjs → serve-kcF6-H8V.mjs} +4 -4
  43. package/dist/{session-VDJfXEEm.mjs → session-DBF-nQvq.mjs} +29 -3
  44. package/dist/{share-Bu_kuOKL.mjs → share-CS2mg27O.mjs} +1 -1
  45. package/dist/{shot-CRRGgxru.mjs → shot-BqwkdtKn.mjs} +4 -4
  46. package/dist/{shot-DBWN8hPP.mjs → shot-D2TQGo2V.mjs} +1 -1
  47. package/dist/show-B1u3DiJw.mjs +101 -0
  48. package/dist/{sizes-wjXDev3b.mjs → sizes-BckcL4Zz.mjs} +1 -1
  49. package/dist/{slots-Dn4Onb0V.mjs → slots-BOcfIqxy.mjs} +15 -3
  50. package/dist/{summary-Y8MY1Wuc.mjs → summary-cPmRDGpX.mjs} +1 -1
  51. package/dist/{sync-CMozOwZ0.mjs → sync-BNWwh8OF.mjs} +205 -7
  52. package/dist/{work-BYWD_1Zf.mjs → work-DRdzXPvg.mjs} +3 -3
  53. package/dist/{work-DJxH7cCX.mjs → work-Nv-n2_Un.mjs} +1 -1
  54. package/docs/app.md +49 -0
  55. package/docs/boards-and-folders.md +37 -6
  56. package/docs/jam-session.md +5 -0
  57. package/docs/live-jam.md +9 -0
  58. package/docs/pdf.md +108 -0
  59. package/docs/performance.md +2 -1
  60. package/docs/publish.md +9 -9
  61. package/docs/sharing.md +11 -0
  62. package/docs/slides.md +9 -0
  63. package/package.json +3 -1
  64. package/src/client/content/index.tsx +4 -2
  65. package/src/client/frame-host/main.tsx +3 -0
  66. package/src/client/shell/App.tsx +71 -24
  67. package/src/client/shell/BoardList.tsx +16 -7
  68. package/src/client/shell/Comments.tsx +77 -16
  69. package/src/client/shell/Play.tsx +24 -22
  70. package/src/client/shell/Toolbar.tsx +4 -3
  71. package/src/client/shell/app-bridge.ts +32 -5
  72. package/src/client/shell/canvas/Canvas.tsx +30 -8
  73. package/src/client/shell/canvas/FrameNode.tsx +3 -1
  74. package/src/client/shell/canvas/ctl.ts +16 -0
  75. package/src/client/shell/commands.ts +20 -0
  76. package/src/client/shell/comments-store.ts +81 -2
  77. package/src/client/shell/devices.tsx +42 -0
  78. package/src/client/shell/goto.ts +56 -9
  79. package/src/client/shell/icons.tsx +11 -4
  80. package/src/client/shell/jam-lines.ts +5 -3
  81. package/src/client/shell/jam-panel.tsx +17 -5
  82. package/src/client/shell/marks-ui.tsx +54 -0
  83. package/src/client/shell/notes.ts +21 -0
  84. package/src/client/shell/pdf-export.tsx +154 -0
  85. package/src/client/shell/pdf-notes.ts +20 -0
  86. package/src/client/shell/recorder.ts +3 -2
  87. package/src/client/shell/show.ts +250 -0
  88. package/src/client/shell/store.ts +79 -48
  89. package/src/client/shell/styles.css +43 -0
  90. package/src/shared/app-api.ts +49 -4
  91. package/src/shared/auto-place.ts +32 -0
  92. package/src/shared/board-tree.ts +3 -0
  93. package/src/shared/board-types.ts +6 -2
  94. package/src/shared/deep-link.ts +212 -0
  95. package/src/shared/devices.ts +89 -0
  96. package/src/shared/events.ts +48 -5
  97. package/src/shared/export-plan.ts +98 -0
  98. package/templates/AGENTS-embedded.md +76 -12
  99. package/templates/AGENTS-studio.md +76 -12
  100. package/templates/instructions/boards.md +6 -5
  101. package/templates/instructions/configure.md +32 -2
  102. package/templates/instructions/iterate.md +8 -0
  103. package/templates/instructions/jam.md +9 -0
  104. package/templates/instructions/publish.md +14 -4
  105. package/templates/instructions/review.md +4 -0
  106. package/templates/instructions/slides.md +67 -1
  107. package/templates/instructions/welcome.md +9 -5
  108. package/templates/playbooks/publish-canvas/PLAYBOOK.md +1 -1
  109. package/dist/config-BezZTiov.mjs +0 -182
@@ -1,19 +1,20 @@
1
1
  import { t as __exportAll } from "./rolldown-runtime-8H4AJuhK.mjs";
2
2
  import { a as ROUTE, i as PKG, r as NAME } from "./cli.mjs";
3
- import { a as checkBoardsDir, c as listBoardFiles, d as pinFrames, g as tryFileLock, h as takeFileLock, i as boardLock, l as nodeExists, m as readRegistry, p as readMembership, r as boardFields, s as isRegularFile, t as AUTHOR_FIELDS, u as parseBoard, v as withRegistryLock, y as hash } from "./boards-EH2onUXM.mjs";
4
- import { A as resolveType, D as readReason, E as readCapability, O as readStatusWord, S as HAS_STATUS, _ as validateWire, a as buildTree, c as folderMap, g as readTitle, h as readDescription, j as settableStatuses, k as readType, n as BOARD_NAME, r as FOLDERS_FILE, t as ALL_SCENES, v as wireKids } from "./board-tree-BXR8dw4b.mjs";
5
- import { c as setSceneTitle, d as annotateBoards, f as planNames, m as readContextFacts, n as isNoteFile, p as planWithStage, s as scanFrames, t as affectedFrameIds, u as writeManifest } from "./manifest-DPZ3WNg_.mjs";
6
- import { a as workActivity, r as boardsChanged } from "./work-DJxH7cCX.mjs";
7
- import { r as replay, t as asks } from "./events-CLH4ijKP.mjs";
3
+ import { _ as tryFileLock, c as isRegularFile, d as parseBoard, f as pinFrames, g as takeFileLock, h as readRegistry, i as boardLock, l as listBoardFiles, m as readMembership, o as checkBoardsDir, r as boardFields, s as checkRealDirs, t as AUTHOR_FIELDS, u as nodeExists, x as hash, y as withRegistryLock } from "./boards-Cim1GTKc.mjs";
4
+ import { A as resolveType, D as readReason, E as readCapability, O as readStatusWord, S as HAS_STATUS, _ as validateWire, a as buildTree, c as folderMap, g as readTitle, h as readDescription, j as settableStatuses, k as readType, n as BOARD_NAME, r as FOLDERS_FILE, t as ALL_SCENES, v as wireKids } from "./board-tree-DGj0HhEE.mjs";
5
+ import { c as setSceneTitle, d as annotateBoards, f as planNames, m as readContextFacts, n as isNoteFile, p as planWithStage, s as scanFrames, t as affectedFrameIds, u as writeManifest } from "./manifest-CK8Qh4Nq.mjs";
6
+ import { c as newerVersion, o as checkShowTarget } from "./deep-link-DYtuT740.mjs";
7
+ import { g as LIVE_WIRE, h as LIVE_BOUNDS, i as marverHome, o as originOf, v as workspaceId } from "./slots-BOcfIqxy.mjs";
8
+ import { a as workActivity, r as boardsChanged } from "./work-Nv-n2_Un.mjs";
9
+ import { a as replay, t as asks } from "./events-Dieo1482.mjs";
8
10
  import { a as readLog, i as listBoards } from "./comments-0BSbb04K.mjs";
9
- import { g as LIVE_WIRE, h as LIVE_BOUNDS, i as marverHome, o as originOf, v as workspaceId } from "./slots-Dn4Onb0V.mjs";
10
- import { n as localProfile, t as isConnected } from "./profile-B1FKOM1e.mjs";
11
- import { c as recordChanged, i as initMarks, n as docRevs, o as observe, r as freshFrames, t as docRev } from "./marks-BnNANic9.mjs";
12
- import { C as WRITE_MATCH_MS, S as WRITER_HEADERS, _ as ID12, b as RELOAD_BOUNDS, c as takePageBatch, l as takeReloadBatch, n as appendRun, r as logReloadLines, t as PAGE_BODY_MAX, u as tidyPerfDir, v as RECORDER_LEVELS, w as decodeCmds, y as RECORDER_PARAM } from "./perf-BCxAo0IS.mjs";
13
- import { n as loadConfig } from "./config-BezZTiov.mjs";
14
- import { a as mergeSizes, c as serializeSizes, i as measuringFrames, l as sizesPath, n as autoWidthOf, o as readSizes, r as keptSizes, s as readSizesFile } from "./sizes-wjXDev3b.mjs";
15
- import { c as pool, d as withBrowser, f as Browser, l as shotConcurrency, m as launchFlags, r as SURFACE, t as AREA } from "./shot-CRRGgxru.mjs";
16
- import { a as appProofOk, o as proofHeaders, r as logoRoute } from "./logo-CXY-1yrn.mjs";
11
+ import { n as localProfile, t as isConnected } from "./profile-cdmSer1k.mjs";
12
+ import { c as recordChanged, i as initMarks, n as docRevs, o as observe, r as freshFrames, t as docRev } from "./marks-C8oX8kbE.mjs";
13
+ import { C as WRITE_MATCH_MS, S as WRITER_HEADERS, _ as ID12, b as RELOAD_BOUNDS, c as takePageBatch, l as takeReloadBatch, n as appendRun, r as logReloadLines, t as PAGE_BODY_MAX, u as tidyPerfDir, v as RECORDER_LEVELS, w as decodeCmds, y as RECORDER_PARAM } from "./perf-BB0XNt1M.mjs";
14
+ import { c as proofHeaders, i as logoRoute, s as appProofOk, t as findLogo } from "./logo-C9s7-Cy9.mjs";
15
+ import { n as loadConfig } from "./config-B0YcFtqS.mjs";
16
+ import { a as mergeSizes, c as serializeSizes, i as measuringFrames, l as sizesPath, n as autoWidthOf, o as readSizes, r as keptSizes, s as readSizesFile } from "./sizes-BckcL4Zz.mjs";
17
+ import { c as pool, d as withBrowser, h as launchFlags, l as shotConcurrency, p as Browser, r as SURFACE, t as AREA } from "./shot-BqwkdtKn.mjs";
17
18
  import { closeSync, copyFileSync, existsSync, linkSync, lstatSync, mkdirSync, openSync, readFileSync, readdirSync, realpathSync, renameSync, rmSync, statSync, utimesSync, watch, writeFileSync } from "node:fs";
18
19
  import { basename, dirname, isAbsolute, join, relative, resolve, sep } from "node:path";
19
20
  import { fileURLToPath } from "node:url";
@@ -21,6 +22,56 @@ import { createHash, randomBytes } from "node:crypto";
21
22
  import { arch, cpus, totalmem } from "node:os";
22
23
  import { execFile } from "node:child_process";
23
24
  import { stat } from "node:fs/promises";
25
+ import { isCSSRequest } from "vite";
26
+ //#region src/server/identity.ts
27
+ /**
28
+ * One identity resolver (spec 31 G.1): what a canvas is called, and which logo it wears - here, and nowhere else.
29
+ *
30
+ * - local name (`marver dev`: the app's tab and Home card through the slot file, the sidebar, the manifest's project):
31
+ * config `name` > `share.name` > the folder's name - today's runtime rule, with `name` on top.
32
+ * - published name (`marver build`'s meta.json: the gate's title, the sign-in screens): config `name` > `share.name` >
33
+ * package.json `name` > the folder's - today's build rule, with `name` on top.
34
+ * - logo: config `logo` > `share.logo` > logo.ts's ladder (`findLogo`).
35
+ *
36
+ * `share.*` keeps working and nothing is rewritten: a canvas that sets neither `name` nor `logo` resolves exactly as it
37
+ * did before.
38
+ */
39
+ /** The host package.json's `name`, when it has one. */
40
+ function packageName(root) {
41
+ try {
42
+ const n = JSON.parse(readFileSync(join(root, "package.json"), "utf8")).name;
43
+ return typeof n === "string" && n ? n : void 0;
44
+ } catch {
45
+ return;
46
+ }
47
+ }
48
+ function canvasIdentity(root, config) {
49
+ const own = config.name || config.share.name;
50
+ const folder = basename(root);
51
+ const pkg = own ? void 0 : packageName(root);
52
+ return {
53
+ local: own || folder,
54
+ published: own || pkg || folder,
55
+ nameFrom: config.name ? "name" : config.share.name ? "share.name" : "folder",
56
+ logos: [{
57
+ key: "logo",
58
+ path: config.logo
59
+ }, {
60
+ key: "share.logo",
61
+ path: config.share.logo
62
+ }]
63
+ };
64
+ }
65
+ /** `marver dev`'s boot-line note (spec 31 G.2): what still makes this canvas look like any other in the app - its
66
+ * folder's name, the Marver mark - and the one place each is set. Null when it has both a name and a logo. */
67
+ function identityNudge(root, config) {
68
+ const id = canvasIdentity(root, config);
69
+ const folder = id.nameFrom === "folder";
70
+ const mark = !findLogo(root, id.logos);
71
+ if (!folder && !mark) return null;
72
+ return `this canvas still shows ${folder && mark ? `its folder's name ("${id.local}") and the Marver mark` : folder ? `its folder's name ("${id.local}")` : "the Marver mark"} - give it ${[folder ? "name: \"Your Product\" in design/config.ts" : "", mark ? "your product's logo at design/logo.svg" : ""].filter(Boolean).join(" and ")}`;
73
+ }
74
+ //#endregion
24
75
  //#region src/shared/frames.ts
25
76
  /** A canvas made of content frames alone (Doc, Md, Diagram ship their own styling) needs no theme -
26
77
  * only an app frame does (#4). Empty counts as not content-only: the warning still helps there. */
@@ -43,8 +94,12 @@ const contentOnly = (frames) => frames.length > 0 && frames.every((f) => !!f.int
43
94
  * has been applied in place: the frames past it are touched (marked) but not reloaded.
44
95
  *
45
96
  * Every other `full-reload` Vite or Tailwind sends is dropped and becomes reloads of the frames it
46
- * names (or every frame, when it names none) - the shell never reloads for a design edit. The one
47
- * that passes is the dependency optimiser's: module URLs changed, every document must reload.
97
+ * names - the shell never reloads for a design edit. One that names nothing, sent while a file no
98
+ * document imports is being handled, is Tailwind's for a file it only scans (a note, app code): the
99
+ * stylesheet is pushed in place and only the frames the marks find changed reload - with the frames of
100
+ * a stylesheet that cannot take its update in place, and every HTML frame. Named nothing
101
+ * otherwise, every frame reloads: the sender is unknown. The one that passes is the dependency
102
+ * optimiser's: module URLs changed, every document must reload.
48
103
  */
49
104
  const safeReal = (p) => {
50
105
  try {
@@ -127,9 +182,36 @@ function updatesPlugin(root, manifest, hooks, landed, changes) {
127
182
  }
128
183
  };
129
184
  }
130
- /** Wraps the client's hot channel: the reload guard and refused refreshes. */
131
- function guardUpdates(server, root, manifest, hooks, changes) {
185
+ /** Wraps the client's hot channel: the reload guard and refused refreshes. `onStyles`: this server's, for a scanned file no
186
+ * document imports - it names the stylesheets that scan it, any of which may have new classes; no frame needs a reload. */
187
+ function guardUpdates(server, root, manifest, hooks, changes, onStyles) {
132
188
  const env = server.environments.client;
189
+ const notImported = (file) => [...env.moduleGraph.getModulesByFile(file) ?? []].every((m) => m.id == null || m.type === "asset");
190
+ const sheetsOf = (files) => {
191
+ const push = /* @__PURE__ */ new Set(), refused = /* @__PURE__ */ new Set(), seen = /* @__PURE__ */ new Set();
192
+ const up = files.flatMap((f) => [...env.moduleGraph.getModulesByFile(f) ?? []]);
193
+ while (up.length) {
194
+ const m = up.shift();
195
+ if (seen.has(m)) continue;
196
+ seen.add(m);
197
+ for (const by of m.importers) {
198
+ if (!isCSSRequest(by.id ?? by.url)) continue;
199
+ if (by.isSelfAccepting === true && by.file) push.add(by.file);
200
+ else refused.add(by);
201
+ up.push(by);
202
+ }
203
+ }
204
+ const reload = /* @__PURE__ */ new Set();
205
+ for (const m of refused) {
206
+ const t = framesFor(root, manifest(), m.file ?? "", [m]);
207
+ for (const id of [...t.doc, ...t.touched]) reload.add(id);
208
+ }
209
+ return {
210
+ push: [...push],
211
+ reload
212
+ };
213
+ };
214
+ const htmlFrames = () => manifest().frames.filter((f) => f.kind === "html").map((f) => f.id);
133
215
  const wrap = (ch) => {
134
216
  const send = ch.send.bind(ch);
135
217
  ch.send = (...a) => {
@@ -144,14 +226,18 @@ function guardUpdates(server, root, manifest, hooks, changes) {
144
226
  }, passed, at);
145
227
  if (!passed) {
146
228
  const mods = by ? env.moduleGraph.getModulesByFile(by) : void 0;
147
- const all = manifest().frames.map((f) => f.id);
229
+ const scanned = by ? [] : changes.handling().filter(notImported);
230
+ const all = () => manifest().frames.map((f) => f.id);
231
+ const sheets = scanned.length ? sheetsOf(scanned) : null;
232
+ const doc = sheets ? [.../* @__PURE__ */ new Set([...sheets.reload, ...htmlFrames()])] : all();
148
233
  const t = by ? framesFor(root, manifest(), by, mods ?? []) : {
149
234
  file: "",
150
- doc: all,
235
+ doc,
151
236
  touched: [],
152
237
  unattributed: true
153
238
  };
154
- if (t.doc.length || t.touched.length) hooks.onFrames(t, "reload", at);
239
+ if (sheets) onStyles(sheets.push);
240
+ if (t.doc.length || t.touched.length || scanned.length) hooks.onFrames(t, "reload", at);
155
241
  return;
156
242
  }
157
243
  }
@@ -303,6 +389,10 @@ function createChanges(o) {
303
389
  candidates: bounded(ids(flying))
304
390
  };
305
391
  },
392
+ /** The files whose hot update is running right now: a pathless reload was sent for one of these. */
393
+ handling() {
394
+ return [...brackets].map((t) => t.file);
395
+ },
306
396
  /** A page-wide reload that names its file (Vite's dead end, an HTML page), sent after the file's hooks: that file's
307
397
  * token still in flight - no time-window guess. */
308
398
  ofFile(file) {
@@ -766,7 +856,7 @@ async function bakeIn(b, opts) {
766
856
  const deadline = setTimeout(() => {
767
857
  timedOut = true;
768
858
  b.abort(me, TIMED_OUT);
769
- }, bakeSeams.deadlineMs ?? DEADLINE_MS);
859
+ }, DEADLINE_MS);
770
860
  const closeTarget = async (id) => {
771
861
  let t;
772
862
  await Promise.race([b.send("Target.closeTarget", { targetId: id }).catch(() => {}), new Promise((r) => {
@@ -1251,13 +1341,11 @@ function endRunBakes(owner) {
1251
1341
  * looks at a COMPILING outlast any held compile (A3.8 r1 #4's case, added by the review of a3-runs). */
1252
1342
  const bakeSeams = {};
1253
1343
  const holdMs = () => {
1254
- if (bakeSeams.holdMs !== void 0) return bakeSeams.holdMs;
1255
- const v = process.env.MARVER_SLOT_BASE ? Number(process.env.MV_BAKE_HOLD_MS) : NaN;
1256
- return Number.isFinite(v) && v > 0 ? Math.min(v, 6e4) : 0;
1344
+ return 0;
1257
1345
  };
1258
1346
  /** The suite's answer for a compile still running, under MV_BAKE_STOP_ASKING (above). */
1259
1347
  const STOP_ASKING = "still compiling - the suite asks the page to stop asking";
1260
- const stillCompiling = () => bakeSeams.stopAsking ?? (!!process.env.MARVER_SLOT_BASE && process.env.MV_BAKE_STOP_ASKING === "1") ? STOP_ASKING : COMPILING;
1348
+ const stillCompiling = () => COMPILING;
1261
1349
  /** Compiles in flight, by generation and key: identical asks - inside one request or across
1262
1350
  * concurrent ones - share one compile. */
1263
1351
  const inflight = /* @__PURE__ */ new Map();
@@ -1774,6 +1862,11 @@ async function writeHeadlessProfile(home) {
1774
1862
  * firewalled registries degrade to silence. MARVER_NO_UPDATE_CHECK=1 disables it.
1775
1863
  * Published bundles never check anything - viewers are not the owner.
1776
1864
  */
1865
+ var update_exports = /* @__PURE__ */ __exportAll({
1866
+ checkUpdate: () => checkUpdate,
1867
+ installedVersion: () => installedVersion,
1868
+ updateStatus: () => updateStatus
1869
+ });
1777
1870
  const TTL = 864e5;
1778
1871
  /** Installed version: walk up from this module to the package's own package.json
1779
1872
  * (one level from dist/, two from src/server/ - the walk covers both). */
@@ -1789,48 +1882,77 @@ function installedVersion() {
1789
1882
  return null;
1790
1883
  }
1791
1884
  /** Strictly-newer numeric compare; anything non-numeric (prerelease tags) compares false. */
1792
- const newer = (a, b) => {
1793
- const pa = a.split(".").map((n) => parseInt(n, 10));
1794
- const pb = b.split(".").map((n) => parseInt(n, 10));
1795
- for (let i = 0; i < 3; i++) {
1796
- const x = pa[i] ?? 0, y = pb[i] ?? 0;
1797
- if (!Number.isFinite(x) || !Number.isFinite(y)) return false;
1798
- if (x !== y) return x > y;
1799
- }
1800
- return false;
1801
- };
1885
+ const newer = (a, b) => newerVersion(a, b);
1802
1886
  /** The latest published version when strictly newer than installed, else null. Never throws. */
1803
1887
  async function checkUpdate(root) {
1804
1888
  if (process.env.MARVER_NO_UPDATE_CHECK) return null;
1805
1889
  const current = installedVersion();
1806
1890
  if (!current) return null;
1807
- const latest = await latestVersion(root);
1891
+ const { latest } = await latestVersion(root);
1808
1892
  return latest && newer(latest, current) ? latest : null;
1809
1893
  }
1810
- async function latestVersion(root) {
1894
+ async function updateStatus(root) {
1895
+ const current = installedVersion();
1896
+ if (process.env.MARVER_NO_UPDATE_CHECK) return {
1897
+ current,
1898
+ latest: null,
1899
+ checkedAt: null,
1900
+ state: "disabled"
1901
+ };
1902
+ const r = await latestVersion(root);
1903
+ return {
1904
+ current,
1905
+ latest: r.latest,
1906
+ checkedAt: r.checkedAt,
1907
+ state: r.ok ? "ok" : "offline"
1908
+ };
1909
+ }
1910
+ /** One registry read at a time per root: requests that come together share it. */
1911
+ const asking = /* @__PURE__ */ new Map();
1912
+ function latestVersion(root) {
1811
1913
  const cacheFile = join(root, "design", ".local", "update-check.json");
1812
1914
  const wellFormed = (v) => typeof v === "string" && /^\d+\.\d+\.\d+$/.test(v);
1813
1915
  try {
1814
1916
  const c = JSON.parse(readFileSync(cacheFile, "utf8"));
1815
1917
  const age = Date.now() - c.checkedAt;
1816
- if (typeof c.checkedAt === "number" && age >= 0 && age < TTL) return wellFormed(c.latest) ? c.latest : null;
1817
- } catch {}
1818
- let latest = null;
1819
- try {
1820
- const res = await fetch(`https://registry.npmjs.org/${encodeURIComponent(PKG)}/latest`, { signal: AbortSignal.timeout(3e3) });
1821
- if (res.ok) {
1822
- const v = (await res.json())?.version;
1823
- if (wellFormed(v)) latest = v;
1824
- }
1825
- } catch {}
1826
- try {
1827
- mkdirSync(join(root, "design", ".local"), { recursive: true });
1828
- writeFileSync(cacheFile, JSON.stringify({
1829
- checkedAt: Date.now(),
1830
- latest
1831
- }) + "\n");
1918
+ if (typeof c.checkedAt === "number" && age >= 0 && age < TTL) return Promise.resolve({
1919
+ latest: wellFormed(c.latest) ? c.latest : null,
1920
+ checkedAt: c.checkedAt,
1921
+ ok: typeof c.ok === "boolean" ? c.ok : wellFormed(c.latest)
1922
+ });
1832
1923
  } catch {}
1833
- return latest;
1924
+ const had = asking.get(root);
1925
+ if (had) return had;
1926
+ const p = (async () => {
1927
+ let latest = null;
1928
+ let ok = false;
1929
+ try {
1930
+ const res = await fetch(`https://registry.npmjs.org/${encodeURIComponent(PKG)}/latest`, { signal: AbortSignal.timeout(3e3) });
1931
+ if (res.ok) {
1932
+ const v = (await res.json())?.version;
1933
+ if (wellFormed(v)) {
1934
+ latest = v;
1935
+ ok = true;
1936
+ }
1937
+ }
1938
+ } catch {}
1939
+ const checkedAt = Date.now();
1940
+ try {
1941
+ mkdirSync(join(root, "design", ".local"), { recursive: true });
1942
+ writeFileSync(cacheFile, JSON.stringify({
1943
+ checkedAt,
1944
+ latest,
1945
+ ok
1946
+ }) + "\n");
1947
+ } catch {}
1948
+ return {
1949
+ latest,
1950
+ checkedAt,
1951
+ ok
1952
+ };
1953
+ })().finally(() => asking.delete(root));
1954
+ asking.set(root, p);
1955
+ return p;
1834
1956
  }
1835
1957
  //#endregion
1836
1958
  //#region src/server/perf-run.ts
@@ -2033,17 +2155,7 @@ const runSeams = {};
2033
2155
  /** RUN_T, with the suite's overrides: `runSeams.t` in-process, `MV_PERF_RUN_T` (JSON) for a dev server a test starts -
2034
2156
  * both read only with MARVER_SLOT_BASE set (the suite's marker). */
2035
2157
  function runT() {
2036
- const t = { ...RUN_T };
2037
- if (!process.env.MARVER_SLOT_BASE) return t;
2038
- let env = {};
2039
- try {
2040
- env = JSON.parse(process.env.MV_PERF_RUN_T ?? "{}");
2041
- } catch {}
2042
- for (const src of [env, runSeams.t ?? {}]) for (const k of Object.keys(t)) {
2043
- const v = src[k];
2044
- if (typeof v === "number" && v >= 0) t[k] = v;
2045
- }
2046
- return t;
2158
+ return { ...RUN_T };
2047
2159
  }
2048
2160
  /** The shell's address for a run's load: its run id, the warm-up's mark, the recorder's level when not `full` (spec 30
2049
2161
  * #58: the shell reads it, `withWs()` carries it to the frames), the board. */
@@ -2111,7 +2223,6 @@ async function openPage(b, o) {
2111
2223
  }
2112
2224
  };
2113
2225
  function call(m, p = {}, sid, ms = T.callMs) {
2114
- runSeams.cdp?.(m, p);
2115
2226
  const sent = b.send(m, p, sid, own);
2116
2227
  let t;
2117
2228
  const late = new Promise((_, reject) => {
@@ -2175,7 +2286,6 @@ async function openPage(b, o) {
2175
2286
  async function closePage(b, page) {
2176
2287
  page.stop();
2177
2288
  const bounded = async (m, p, sid) => {
2178
- runSeams.cdp?.(m, p);
2179
2289
  let t;
2180
2290
  await Promise.race([b.send(m, p, sid).catch(() => {}), new Promise((r) => {
2181
2291
  t = setTimeout(r, 2e3);
@@ -2700,7 +2810,7 @@ async function serveRun(req, res, o) {
2700
2810
  };
2701
2811
  const beat = setInterval(() => write({ heartbeat: Date.now() }), T.heartbeatMs);
2702
2812
  try {
2703
- const drive = runSeams.driver ?? runOnce;
2813
+ const drive = runOnce;
2704
2814
  for (let i = 0; i < asked.req.repeat && !ac.signal.aborted; i++) write({ line: await drive({
2705
2815
  root: o.root,
2706
2816
  origin: o.origin,
@@ -2720,6 +2830,46 @@ async function serveRun(req, res, o) {
2720
2830
  }
2721
2831
  }
2722
2832
  //#endregion
2833
+ //#region src/server/show.ts
2834
+ const SHOW_OUTCOMES = ["shown", "notice"];
2835
+ const KEEP = 32;
2836
+ const PAGE = /^[A-Za-z0-9_-]{8,64}$/;
2837
+ function createShows() {
2838
+ let seq = 0;
2839
+ const kept = /* @__PURE__ */ new Map();
2840
+ return {
2841
+ start(t) {
2842
+ seq += 1;
2843
+ kept.set(seq, /* @__PURE__ */ new Map());
2844
+ for (const k of kept.keys()) if (k <= seq - KEEP) kept.delete(k);
2845
+ return {
2846
+ seq,
2847
+ cmd: {
2848
+ ...t,
2849
+ seq
2850
+ }
2851
+ };
2852
+ },
2853
+ ack(s, page, outcome) {
2854
+ if (typeof s !== "number" || !kept.has(s) || typeof page !== "string" || !PAGE.test(page)) return false;
2855
+ if (!SHOW_OUTCOMES.includes(outcome)) return false;
2856
+ kept.get(s).set(page, outcome);
2857
+ return true;
2858
+ },
2859
+ acks(s) {
2860
+ const m = kept.get(s);
2861
+ if (!m) return null;
2862
+ let shown = 0, notice = 0;
2863
+ for (const o of m.values()) if (o === "shown") shown++;
2864
+ else notice++;
2865
+ return {
2866
+ shown,
2867
+ notice
2868
+ };
2869
+ }
2870
+ };
2871
+ }
2872
+ //#endregion
2723
2873
  //#region src/server/api.ts
2724
2874
  const BODY_LIMIT = 1e6;
2725
2875
  const CSRF_MAX_AGE = 2592e3;
@@ -2876,6 +3026,7 @@ function apiMiddleware(root, opts = {}) {
2876
3026
  const notSymlink = (p) => !nodeExists(p) || isRegularFile(p);
2877
3027
  const nodeExists$1 = nodeExists;
2878
3028
  let sizesWarned = false;
3029
+ const shows = createShows();
2879
3030
  /** A board file this request wrote (spec 30 #18), with the page and commands it names - the watcher's `sh:board`
2880
3031
  * matches these bytes against it, as a candidate, never as proof. */
2881
3032
  const wroteBoard = (req, board, content) => {
@@ -2889,7 +3040,7 @@ function apiMiddleware(root, opts = {}) {
2889
3040
  * capture not sealed; then the bytes, 8 MB at most as they arrive, their signature and the whole PNG; and the capture
2890
3041
  * still not sealed, just before it is stored. Nothing is stored once `stop` (the deadline) has fired. */
2891
3042
  const livePicture = async (req, url, stop) => {
2892
- const { CAPTURE_ID, addPictureBytes, checkPng, isPng, readCapture, sweepPictures } = await import("./capture-DEtM4qm5.mjs").then((n) => n.i);
3043
+ const { CAPTURE_ID, addPictureBytes, checkPng, isPng, readCapture, sweepPictures } = await import("./capture-HaS-1or8.mjs").then((n) => n.i);
2893
3044
  if (String(req.headers["content-type"] ?? "").split(";")[0].trim().toLowerCase() !== "image/png") return [415, { error: "expected image/png" }];
2894
3045
  const capture = url.searchParams.get("capture") ?? "", frame = url.searchParams.get("frame") ?? "";
2895
3046
  if (!CAPTURE_ID.test(capture)) return [400, { error: "bad capture id" }];
@@ -3151,7 +3302,7 @@ function apiMiddleware(root, opts = {}) {
3151
3302
  return json(res, 400, { error: "malformed JSON" });
3152
3303
  }
3153
3304
  if (!b || b.kind !== "capture" && b.kind !== "upload") return json(res, 400, { error: "kind must be capture or upload" });
3154
- (await import("./perf-BCxAo0IS.mjs").then((n) => n.f)).logJam(root, b);
3305
+ (await import("./perf-BB0XNt1M.mjs").then((n) => n.f)).logJam(root, b);
3155
3306
  return json(res, 200, { ok: true });
3156
3307
  }
3157
3308
  if (path === "perf/page" && req.method === "POST") {
@@ -3174,7 +3325,7 @@ function apiMiddleware(root, opts = {}) {
3174
3325
  return json(res, "error" in answer ? 503 : 200, answer);
3175
3326
  }
3176
3327
  if (path === "perf/run" && req.method === "POST" || path === "perf/inputs" && req.method === "GET") {
3177
- const { readDevInfo } = await import("./work-DJxH7cCX.mjs").then((n) => n.o);
3328
+ const { readDevInfo } = await import("./work-Nv-n2_Un.mjs").then((n) => n.o);
3178
3329
  const token = readDevInfo(root)?.token;
3179
3330
  if (!ownerGated(req) && !(token && req.headers["x-mv-work"] === token)) return json(res, 403, { error: "forbidden" });
3180
3331
  if (path === "perf/inputs") {
@@ -3629,7 +3780,7 @@ function apiMiddleware(root, opts = {}) {
3629
3780
  }
3630
3781
  }
3631
3782
  if (path === "shot" && req.method === "GET") {
3632
- const { readDevInfo } = await import("./work-DJxH7cCX.mjs").then((n) => n.o);
3783
+ const { readDevInfo } = await import("./work-Nv-n2_Un.mjs").then((n) => n.o);
3633
3784
  const token = readDevInfo(root)?.token;
3634
3785
  if (!ownerGated(req) && !(token && req.headers["x-mv-work"] === token)) return json(res, 403, { error: "forbidden" });
3635
3786
  const frameId = url.searchParams.get("frame") ?? "";
@@ -3645,7 +3796,7 @@ function apiMiddleware(root, opts = {}) {
3645
3796
  };
3646
3797
  const asPng = url.searchParams.get("format") === "png";
3647
3798
  const origin = opts.origin?.() ?? `http://${req.headers.host ?? "localhost"}`;
3648
- const { shootFrame } = await import("./shot-CRRGgxru.mjs").then((n) => n.u);
3799
+ const { shootFrame } = await import("./shot-BqwkdtKn.mjs").then((n) => n.u);
3649
3800
  const r = await shootFrame({
3650
3801
  root,
3651
3802
  viewports: opts.viewports ?? {},
@@ -3678,8 +3829,101 @@ function apiMiddleware(root, opts = {}) {
3678
3829
  });
3679
3830
  return res.end(png);
3680
3831
  }
3832
+ const pdfRoute = /^pdf(?:\/([^/]*)(\/file)?)?$/.exec(path);
3833
+ if (pdfRoute) {
3834
+ const { readDevInfo } = await import("./work-Nv-n2_Un.mjs").then((n) => n.o);
3835
+ const token = readDevInfo(root)?.token;
3836
+ if (!ownerGated(req) && !(token && req.headers["x-mv-work"] === token)) return json(res, 403, { error: "forbidden" });
3837
+ const pdf = await import("./pdf-CZENT6t3.mjs");
3838
+ if (pdfRoute[1] === void 0) {
3839
+ if (req.method !== "POST") return json(res, 405, { error: "POST to start a PDF" });
3840
+ const raw = await readBody(req);
3841
+ if (raw == null) return json(res, 400, { error: "body too large or unreadable" });
3842
+ let b;
3843
+ try {
3844
+ b = JSON.parse(raw);
3845
+ } catch {
3846
+ return json(res, 400, { error: "malformed JSON" });
3847
+ }
3848
+ if (!b || typeof b !== "object" || Array.isArray(b)) return json(res, 400, { error: "expected an object" });
3849
+ if (!validName(b.board)) return json(res, 400, { error: "board must be a board name" });
3850
+ const opt = (k, ok) => b[k] === void 0 ? void 0 : ok(b[k]) ? b[k] : null;
3851
+ const theme = opt("theme", (v) => typeof v === "string" && /^[a-z0-9-]{1,32}$/i.test(v));
3852
+ const notes = opt("notes", (v) => typeof v === "boolean");
3853
+ const paper = opt("paper", (v) => v === "letter" || v === "a4");
3854
+ const mode = opt("mode", (v) => v === "auto" || v === "raster" || v === "vector");
3855
+ const keepGoing = opt("keepGoing", (v) => typeof v === "boolean");
3856
+ for (const [k, v] of Object.entries({
3857
+ theme,
3858
+ notes,
3859
+ paper,
3860
+ mode,
3861
+ keepGoing
3862
+ })) if (v === null) return json(res, 400, { error: `invalid ${k}` });
3863
+ const { docRev } = await import("./marks-C8oX8kbE.mjs").then((n) => n.a);
3864
+ const { installedVersion } = await Promise.resolve().then(() => update_exports);
3865
+ const ctx = {
3866
+ root,
3867
+ origin: opts.origin?.() ?? `http://${req.headers.host ?? "localhost"}`,
3868
+ viewports: opts.viewports ?? {},
3869
+ themes: opts.themes ?? ["light", "dark"],
3870
+ canvasName: opts.canvasName?.() ?? root.split(sep).pop() ?? "canvas",
3871
+ version: installedVersion() ?? "0.0.0",
3872
+ frames: () => devManifest().frames,
3873
+ scenes: () => devManifest().scenes,
3874
+ settled: opts.settled ?? (() => true),
3875
+ docRev: (id) => docRev(root, devManifest().frames, id)
3876
+ };
3877
+ const r = await pdf.startPdfJob(ctx, {
3878
+ board: b.board,
3879
+ ...theme ? { theme } : {},
3880
+ ...notes ? { notes } : {},
3881
+ ...paper ? { paper } : {},
3882
+ ...mode ? { mode } : {},
3883
+ ...keepGoing ? { keepGoing } : {}
3884
+ });
3885
+ if (!r.ok) return json(res, r.status, {
3886
+ error: r.error,
3887
+ ...r.job ? { job: r.job } : {}
3888
+ });
3889
+ return json(res, 202, pdf.jobStatus(r.job));
3890
+ }
3891
+ const j = pdf.getJob(pdfRoute[1]);
3892
+ if (!j || j.root !== root) return json(res, 404, { error: "no such PDF job - a finished one is kept for an hour" });
3893
+ if (pdfRoute[2]) {
3894
+ if (req.method !== "GET") return json(res, 405, { error: "GET the file" });
3895
+ if (j.state !== "done" || !j.file) return json(res, 409, { error: j.state === "running" ? "the PDF is not finished yet" : `the export ${j.state}${j.error ? ` - ${j.error}` : ""}` });
3896
+ const { createReadStream, statSync } = await import("node:fs");
3897
+ let size;
3898
+ try {
3899
+ size = statSync(j.file).size;
3900
+ } catch {
3901
+ return json(res, 410, { error: "the PDF is gone - export it again" });
3902
+ }
3903
+ res.writeHead(200, {
3904
+ "content-type": "application/pdf",
3905
+ "content-length": size,
3906
+ "cache-control": "no-store",
3907
+ "x-content-type-options": "nosniff",
3908
+ "content-disposition": `attachment; filename="${j.filename.replace(/[^A-Za-z0-9._-]/g, "_")}"`
3909
+ });
3910
+ const st = createReadStream(j.file);
3911
+ st.on("error", () => res.destroy());
3912
+ res.on("close", () => st.destroy());
3913
+ return st.pipe(res);
3914
+ }
3915
+ if (req.method === "GET") return json(res, 200, pdf.jobStatus(j));
3916
+ if (req.method === "DELETE") {
3917
+ pdf.cancelPdfJob(j.id);
3918
+ return json(res, 200, {
3919
+ job: j.id,
3920
+ cancelled: j.state === "running" || j.state === "cancelled"
3921
+ });
3922
+ }
3923
+ return json(res, 405, { error: "GET or DELETE a job" });
3924
+ }
3681
3925
  if (path === "shots" && req.method === "POST") {
3682
- const { readDevInfo } = await import("./work-DJxH7cCX.mjs").then((n) => n.o);
3926
+ const { readDevInfo } = await import("./work-Nv-n2_Un.mjs").then((n) => n.o);
3683
3927
  const token = readDevInfo(root)?.token;
3684
3928
  if (!ownerGated(req) && !(token && req.headers["x-mv-work"] === token)) return json(res, 403, { error: "forbidden" });
3685
3929
  const raw = await readBody(req);
@@ -3696,7 +3940,7 @@ function apiMiddleware(root, opts = {}) {
3696
3940
  if (typeof theme !== "string" || !/^[a-z0-9-]+$/i.test(theme)) return json(res, 400, { error: "invalid theme" });
3697
3941
  const scale = body.scale === void 0 ? void 0 : body.scale;
3698
3942
  if (scale !== void 0 && !(Number.isInteger(scale) && scale >= 1 && scale <= 4)) return json(res, 400, { error: "invalid scale" });
3699
- const { resolveFrames, shootBatch } = await import("./shot-CRRGgxru.mjs").then((n) => n.u);
3943
+ const { resolveFrames, shootBatch } = await import("./shot-BqwkdtKn.mjs").then((n) => n.u);
3700
3944
  const sel = resolveFrames(root, body);
3701
3945
  if (!sel.ok) return json(res, sel.status, { error: sel.error });
3702
3946
  const origin = opts.origin?.() ?? `http://${req.headers.host ?? "localhost"}`;
@@ -3714,7 +3958,7 @@ function apiMiddleware(root, opts = {}) {
3714
3958
  }
3715
3959
  }
3716
3960
  if (path === "anchor" && req.method === "POST") {
3717
- const { readDevInfo } = await import("./work-DJxH7cCX.mjs").then((n) => n.o);
3961
+ const { readDevInfo } = await import("./work-Nv-n2_Un.mjs").then((n) => n.o);
3718
3962
  const token = readDevInfo(root)?.token;
3719
3963
  if (!ownerGated(req) && !(token && req.headers["x-mv-work"] === token)) return json(res, 403, { error: "forbidden" });
3720
3964
  const raw = await readBody(req);
@@ -3730,7 +3974,7 @@ function apiMiddleware(root, opts = {}) {
3730
3974
  if (typeof target === "string") return json(res, 400, { error: target });
3731
3975
  const others = Array.isArray(b.others) ? b.others.filter((o) => typeof o?.key === "string").slice(0, 200) : [];
3732
3976
  const origin = opts.origin?.() ?? `http://${req.headers.host ?? "localhost"}`;
3733
- const { checkAnchor, CheckInputError } = await import("./anchor-check-c52IDkiQ.mjs");
3977
+ const { checkAnchor, CheckInputError } = await import("./anchor-check-B92s9tVv.mjs");
3734
3978
  try {
3735
3979
  return json(res, 200, await checkAnchor({
3736
3980
  root,
@@ -3780,7 +4024,7 @@ function apiMiddleware(root, opts = {}) {
3780
4024
  });
3781
4025
  docs.push(typeof a?.doc === "string" ? a.doc : void 0);
3782
4026
  }
3783
- const { docRev } = await import("./marks-BnNANic9.mjs").then((n) => n.a);
4027
+ const { docRev } = await import("./marks-C8oX8kbE.mjs").then((n) => n.a);
3784
4028
  const all = devManifest().frames;
3785
4029
  const pending = opts.settled ? !opts.settled() : false;
3786
4030
  const behind = docs.map((d, i) => d !== void 0 && (pending || d !== docRev(root, all, asks[i].frame)));
@@ -3838,8 +4082,8 @@ function apiMiddleware(root, opts = {}) {
3838
4082
  return json(res, 400, { error: "malformed JSON" });
3839
4083
  }
3840
4084
  const src = typeof b?.src === "string" ? b.src : "";
3841
- const { ensurePoster, isLocalClip } = await import("./poster-CYmCa00B.mjs");
3842
- const { isLocalAssetRef } = await import("./build-C3mUtjEn.mjs");
4085
+ const { ensurePoster, isLocalClip } = await import("./poster-B7uSjlEP.mjs");
4086
+ const { isLocalAssetRef } = await import("./build-BNssmbqd.mjs");
3843
4087
  if (!isLocalAssetRef(src) || !isLocalClip(src)) return json(res, 400, { error: "src must be a clip under design/assets/" });
3844
4088
  const r = await ensurePoster(join(root, "design", "assets"), src);
3845
4089
  if (!r.ok) return json(res, r.error.includes("does not exist") ? 404 : 503, { error: r.error });
@@ -3866,7 +4110,7 @@ function apiMiddleware(root, opts = {}) {
3866
4110
  }
3867
4111
  const dir = join(root, "design", ".local");
3868
4112
  mkdirSync(dir, { recursive: true });
3869
- const { validAvatar } = await import("./collab-BEAcXrBb.mjs");
4113
+ const { validAvatar } = await import("./collab-D2NcrOB8.mjs");
3870
4114
  let cur = {};
3871
4115
  try {
3872
4116
  cur = JSON.parse(readFileSync(join(dir, "profile.json"), "utf8"));
@@ -3882,7 +4126,7 @@ function apiMiddleware(root, opts = {}) {
3882
4126
  }
3883
4127
  if (path === "marks" || path === "marks/seen") {
3884
4128
  if (!ownerGated(req)) return json(res, 403, { error: "forbidden" });
3885
- const { readMarks, markSeen } = await import("./marks-BnNANic9.mjs").then((n) => n.a);
4129
+ const { readMarks, markSeen } = await import("./marks-C8oX8kbE.mjs").then((n) => n.a);
3886
4130
  const manifest = devManifest();
3887
4131
  if (path === "marks" && req.method === "GET") return json(res, 200, readMarks(root, manifest));
3888
4132
  if (path === "marks/seen" && req.method === "POST") {
@@ -3901,15 +4145,52 @@ function apiMiddleware(root, opts = {}) {
3901
4145
  }
3902
4146
  return json(res, 405, { error: "method not allowed" });
3903
4147
  }
4148
+ if (path === "show" || path === "show/ack" || path === "show/acks") {
4149
+ const { readDevInfo } = await import("./work-Nv-n2_Un.mjs").then((n) => n.o);
4150
+ const token = readDevInfo(root)?.token;
4151
+ const tokenOk = !!token && req.headers["x-mv-work"] === token;
4152
+ if (path === "show" && req.method === "POST") {
4153
+ if (!ownerGated(req) && !tokenOk) return json(res, 403, { error: "forbidden" });
4154
+ const raw = await readBody(req, 16384);
4155
+ if (raw == null) return json(res, 400, { error: "body too large or unreadable" });
4156
+ let b;
4157
+ try {
4158
+ b = JSON.parse(raw);
4159
+ } catch {
4160
+ return json(res, 400, { error: "malformed JSON" });
4161
+ }
4162
+ const t = checkShowTarget(b);
4163
+ if (!t) return json(res, 400, { error: "not a show target: { board, n?, f?, s?, c? } in the link grammar" });
4164
+ if (t.board !== "~unplaced" && (dirError() || !listBoardFiles(boardsDir).boards.some((x) => x.name === t.board))) return json(res, 404, { error: `no board "${t.board}"` });
4165
+ const { seq, cmd } = shows.start(t);
4166
+ opts.broadcast?.("sh:show", cmd);
4167
+ return json(res, 200, { seq });
4168
+ }
4169
+ if (path === "show/ack" && req.method === "POST") {
4170
+ if (!ownerGated(req)) return json(res, 403, { error: "forbidden" });
4171
+ const raw = await readBody(req, 4096);
4172
+ let b = null;
4173
+ try {
4174
+ b = raw == null ? null : JSON.parse(raw);
4175
+ } catch {}
4176
+ return shows.ack(b?.seq, b?.page, b?.outcome) ? json(res, 200, { ok: true }) : json(res, 400, { error: "not an answer to a show kept here" });
4177
+ }
4178
+ if (path === "show/acks" && req.method === "GET") {
4179
+ if (!ownerGated(req) && !tokenOk) return json(res, 403, { error: "forbidden" });
4180
+ const a = shows.acks(Number(url.searchParams.get("seq")));
4181
+ return a ? json(res, 200, a) : json(res, 404, { error: "no such show" });
4182
+ }
4183
+ return json(res, 405, { error: "method not allowed" });
4184
+ }
3904
4185
  if (path === "work") {
3905
- const { workActivity, readDevInfo, WORK_TTL_DEFAULT, WORK_TTL_MAX } = await import("./work-DJxH7cCX.mjs").then((n) => n.o);
4186
+ const { workActivity, readDevInfo, WORK_TTL_DEFAULT, WORK_TTL_MAX } = await import("./work-Nv-n2_Un.mjs").then((n) => n.o);
3906
4187
  const tokenOk = () => {
3907
4188
  const t = readDevInfo(root)?.token;
3908
4189
  return !!t && req.headers["x-mv-work"] === t;
3909
4190
  };
3910
4191
  if (req.method === "GET") {
3911
4192
  if (!ownerGated(req) && !tokenOk()) return json(res, 403, { error: "forbidden" });
3912
- const { boardsShowing, activityClock } = await import("./work-DJxH7cCX.mjs").then((n) => n.o);
4193
+ const { boardsShowing, activityClock } = await import("./work-Nv-n2_Un.mjs").then((n) => n.o);
3913
4194
  const frames = workActivity.active();
3914
4195
  return json(res, 200, {
3915
4196
  frames,
@@ -3932,7 +4213,7 @@ function apiMiddleware(root, opts = {}) {
3932
4213
  if (!on && b.all === true) {
3933
4214
  const done = workActivity.active().filter((f) => workActivity.has(f, "cli"));
3934
4215
  if (done.length) {
3935
- (await import("./marks-BnNANic9.mjs").then((n) => n.a)).recordChanged(root, devFrames(), done, { doc: false });
4216
+ (await import("./marks-C8oX8kbE.mjs").then((n) => n.a)).recordChanged(root, devFrames(), done, { doc: false });
3936
4217
  opts.notify?.("sh:marks");
3937
4218
  }
3938
4219
  workActivity.clearAll("cli");
@@ -3952,7 +4233,7 @@ function apiMiddleware(root, opts = {}) {
3952
4233
  for (const f of frames) on ? workActivity.mark(f, ttl, "cli") : workActivity.clear(f, "cli");
3953
4234
  saveHolds(root, workActivity);
3954
4235
  if (!on) {
3955
- (await import("./marks-BnNANic9.mjs").then((n) => n.a)).recordChanged(root, devFrames(), frames, { doc: false });
4236
+ (await import("./marks-C8oX8kbE.mjs").then((n) => n.a)).recordChanged(root, devFrames(), frames, { doc: false });
3956
4237
  opts.notify?.("sh:marks");
3957
4238
  return json(res, 200, { frames: workActivity.active() });
3958
4239
  }
@@ -4005,7 +4286,7 @@ function apiMiddleware(root, opts = {}) {
4005
4286
  } catch {
4006
4287
  return json(res, 400, { error: "malformed JSON" });
4007
4288
  }
4008
- const { ACTIONS } = await import("./queue-DeSQm24g.mjs");
4289
+ const { ACTIONS } = await import("./queue-BLLfdlDw.mjs");
4009
4290
  if (!b || typeof b.id !== "string" || !Number.isInteger(b.rev) || !ACTIONS.includes(b.action) || b.body !== void 0 && typeof b.body !== "string") return json(res, 400, { error: "expected { id, rev, action, body? }" });
4010
4291
  if ("kind" in b) return json(res, 400, { error: "a capture has no category" });
4011
4292
  const { jamLive } = await Promise.resolve().then(() => live_exports);
@@ -4050,7 +4331,7 @@ function apiMiddleware(root, opts = {}) {
4050
4331
  if (!jamLive.session || !jamLive.view) return json(res, 409, { error: "jam is not running here" });
4051
4332
  if (req.method === "GET") {
4052
4333
  const ses = jamLive.view().session ?? null;
4053
- const { readTalk, talkMinutes, recordFile } = await import("./session-VDJfXEEm.mjs").then((n) => n.s);
4334
+ const { readTalk, talkMinutes, recordFile } = await import("./session-DBF-nQvq.mjs").then((n) => n.s);
4054
4335
  const folder = ses ? recordFile(root, ses.since, ses.id).replace(/[^/]+$/, "") : null;
4055
4336
  return json(res, 200, {
4056
4337
  session: ses,
@@ -4229,11 +4510,13 @@ function apiMiddleware(root, opts = {}) {
4229
4510
  }
4230
4511
  if (path === "jam/capture" && req.method === "GET") {
4231
4512
  if (!ownerGated(req)) return json(res, 403, { error: "forbidden" });
4232
- const { readCapture } = await import("./capture-DEtM4qm5.mjs").then((n) => n.i);
4513
+ const { readCapture } = await import("./capture-HaS-1or8.mjs").then((n) => n.i);
4233
4514
  const id = url.searchParams.get("id") ?? "";
4234
4515
  const cap = readCapture(root, id);
4235
4516
  if (!cap) return json(res, 404, { error: "no such capture" });
4236
4517
  const { jamLive } = await Promise.resolve().then(() => live_exports);
4518
+ const { captureWithdrawn } = await import("./queue-BLLfdlDw.mjs");
4519
+ if (jamLive.withdrawn?.(id) || captureWithdrawn(root, id, cap.record.context.board)) return json(res, 410, { error: "this capture was withdrawn - its comment was deleted" });
4237
4520
  const card = jamLive.view?.().cards.find((c) => c.id === id);
4238
4521
  return json(res, 200, {
4239
4522
  record: cap.record,
@@ -4252,11 +4535,11 @@ function apiMiddleware(root, opts = {}) {
4252
4535
  } catch {
4253
4536
  return json(res, 400, { error: "malformed JSON" });
4254
4537
  }
4255
- const { CAPTURE_ID, readCapture, addPicture, sweepPictures } = await import("./capture-DEtM4qm5.mjs").then((n) => n.i);
4538
+ const { CAPTURE_ID, readCapture, addPicture, sweepPictures } = await import("./capture-HaS-1or8.mjs").then((n) => n.i);
4256
4539
  if (!b || typeof b.capture !== "string" || !CAPTURE_ID.test(b.capture) || typeof b.frame !== "string") return json(res, 400, { error: "expected { capture, frame, theme?, viewport? }" });
4257
4540
  if (readCapture(root, b.capture)) return json(res, 409, { error: "that capture is sealed" });
4258
4541
  const theme = typeof b.theme === "string" && /^[a-z0-9-]+$/i.test(b.theme) ? b.theme : "light";
4259
- const { shootFrame } = await import("./shot-CRRGgxru.mjs").then((n) => n.u);
4542
+ const { shootFrame } = await import("./shot-BqwkdtKn.mjs").then((n) => n.u);
4260
4543
  const origin = opts.origin?.() ?? `http://${req.headers.host ?? "localhost"}`;
4261
4544
  const vp = typeof b.viewport === "string" ? opts.viewports?.[b.viewport] : void 0;
4262
4545
  const dim = (v) => typeof v === "number" && Number.isFinite(v) ? Math.round(v) : void 0;
@@ -4305,7 +4588,7 @@ function apiMiddleware(root, opts = {}) {
4305
4588
  if (path === "jam/picture" && req.method === "GET") {
4306
4589
  const site = String(req.headers["sec-fetch-site"] ?? "");
4307
4590
  if (!ownerGated(req) && !(cookie(req, "mv_c") && (site === "same-origin" || site === "none"))) return json(res, 403, { error: "forbidden" });
4308
- const { picturePath } = await import("./capture-DEtM4qm5.mjs").then((n) => n.i);
4591
+ const { picturePath } = await import("./capture-HaS-1or8.mjs").then((n) => n.i);
4309
4592
  const p = picturePath(root, url.searchParams.get("id") ?? "");
4310
4593
  if (!p) return json(res, 404, { error: "no such picture" });
4311
4594
  const png = readFileSync(p.path);
@@ -4323,11 +4606,66 @@ function apiMiddleware(root, opts = {}) {
4323
4606
  stored: listBoards(join(root, "design", "comments"))
4324
4607
  });
4325
4608
  }
4609
+ if (path === "capabilities" && req.method === "GET") return json(res, 200, {
4610
+ delete: true,
4611
+ resolveAll: true
4612
+ });
4613
+ if (path === "comment-ownership" && req.method === "GET") {
4614
+ if (!ownerGated(req)) return json(res, 403, { error: "forbidden" });
4615
+ const { ownership } = await import("./own-C8Mq0Hnf.mjs");
4616
+ return json(res, 200, { boards: ownership(root) });
4617
+ }
4618
+ if ((path === "comment-actions/resolve-all" || path === "comment-actions/undo") && req.method === "POST") {
4619
+ const { readDevInfo } = await import("./work-Nv-n2_Un.mjs").then((n) => n.o);
4620
+ const token = readDevInfo(root)?.token;
4621
+ if (!ownerGated(req) && !(token && req.headers["x-mv-work"] === token)) return json(res, 403, { error: "forbidden" });
4622
+ const raw = await readBody(req);
4623
+ if (raw == null) return json(res, 400, { error: "body too large" });
4624
+ let b;
4625
+ try {
4626
+ b = JSON.parse(raw);
4627
+ } catch {
4628
+ return json(res, 400, { error: "malformed JSON" });
4629
+ }
4630
+ const ca = await import("./comment-actions-Bxf9Ld4g.mjs");
4631
+ const { jamLive } = await Promise.resolve().then(() => live_exports);
4632
+ if (typeof b?.op !== "string" || !ca.OP_RE.test(b.op)) return json(res, 400, { error: "expected { op: <8-64 char token>, ... }" });
4633
+ if (path === "comment-actions/undo") {
4634
+ const u = ca.undoResolveAll(root, b.op);
4635
+ if ("error" in u) return json(res, u.status, { error: u.error });
4636
+ jamLive.poke?.();
4637
+ backgroundPush(root);
4638
+ return json(res, u.failed.length ? 207 : 200, {
4639
+ ...u,
4640
+ summary: ca.undoSummary(u)
4641
+ });
4642
+ }
4643
+ const scope = ca.parseScope(b.scope);
4644
+ if (typeof scope === "string") return json(res, 400, { error: scope });
4645
+ const r = ca.resolveAll(root, b.op, scope, {
4646
+ busy: jamLive.busy,
4647
+ dryRun: b.dryRun === true
4648
+ });
4649
+ if ("error" in r) return json(res, r.status, { error: r.error });
4650
+ if (b.dryRun !== true) {
4651
+ jamLive.poke?.();
4652
+ backgroundPush(root);
4653
+ }
4654
+ return json(res, r.failed.length ? 207 : 200, {
4655
+ ...r,
4656
+ summary: ca.resolveSummary(r)
4657
+ });
4658
+ }
4326
4659
  const cm = /^comments\/([a-z0-9][a-z0-9-]*)$/.exec(path);
4327
4660
  if (cm) {
4328
4661
  const { appendEvents, readLog } = await import("./comments-0BSbb04K.mjs").then((n) => n.n);
4329
4662
  const dir = join(root, "design", "comments");
4330
- if (req.method === "GET") return json(res, 200, { events: readLog(dir, cm[1]) });
4663
+ if (req.method === "GET") {
4664
+ const { deletedMessages, withoutDeletedWords } = await import("./events-Dieo1482.mjs").then((n) => n.i);
4665
+ const evs = readLog(dir, cm[1]);
4666
+ const gone = deletedMessages(evs);
4667
+ return json(res, 200, { events: evs.map((e) => withoutDeletedWords(e, gone)) });
4668
+ }
4331
4669
  if (req.method === "POST") {
4332
4670
  if (!ownerGated(req)) return json(res, 403, { error: "forbidden" });
4333
4671
  const raw = await readBody(req);
@@ -4340,6 +4678,31 @@ function apiMiddleware(root, opts = {}) {
4340
4678
  }
4341
4679
  const incoming = Array.isArray(b.events) ? b.events : [];
4342
4680
  const me = localProfile(root);
4681
+ if (incoming.some((ev) => ev?.board !== void 0 && ev.board !== cm[1])) return json(res, 400, { error: "event board does not match the endpoint" });
4682
+ {
4683
+ const have = readLog(dir, cm[1]);
4684
+ const evIds = new Set(have.map((e) => e.id));
4685
+ const msgIds = new Set(have.filter((e) => (e.type === "create" || e.type === "reply") && e.commentId).map((e) => e.commentId));
4686
+ for (const ev of incoming) {
4687
+ if (ev?.type !== "create" && ev?.type !== "reply" || evIds.has(ev.id)) continue;
4688
+ if (typeof ev.commentId !== "string" || msgIds.has(ev.commentId)) return json(res, 409, { error: "a comment with that id already exists" });
4689
+ msgIds.add(ev.commentId);
4690
+ }
4691
+ }
4692
+ if (incoming.some((ev) => ev?.type === "edit" || ev?.type === "delete")) {
4693
+ const { ownsMessage } = await import("./own-C8Mq0Hnf.mjs");
4694
+ const { deletedMessages } = await import("./events-Dieo1482.mjs").then((n) => n.i);
4695
+ const log = readLog(dir, cm[1]);
4696
+ const gone = deletedMessages(log);
4697
+ const captures = new Set(log.filter((e) => e?.type === "create" && e.capture && e.commentId).map((e) => e.commentId));
4698
+ for (const ev of incoming) {
4699
+ if (ev?.type !== "edit" && ev?.type !== "delete") continue;
4700
+ if (typeof ev.commentId !== "string" || !ownsMessage(root, cm[1], ev.commentId)) return json(res, 403, { error: `only its author can ${ev.type} a comment` });
4701
+ if (ev.type === "edit" && gone.has(ev.commentId)) return json(res, 409, { error: "that comment was deleted" });
4702
+ if (ev.type === "edit" && captures.has(ev.commentId)) return json(res, 409, { error: "a capture is edited in Jam - here it can only be deleted" });
4703
+ if (ev.type === "edit" && (typeof ev.body !== "string" || !ev.body.trim())) return json(res, 400, { error: "an edit needs words - delete the comment instead" });
4704
+ }
4705
+ }
4343
4706
  const stamped = incoming.map((ev) => {
4344
4707
  const { agent: _a, agentMeta: _am, origin: _o, ...clean } = ev;
4345
4708
  return {
@@ -4349,20 +4712,24 @@ function apiMiddleware(root, opts = {}) {
4349
4712
  "create",
4350
4713
  "reply",
4351
4714
  "react",
4352
- "edit"
4715
+ "edit",
4716
+ "delete"
4353
4717
  ].includes(clean.type) ? me : void 0)
4354
4718
  };
4355
4719
  });
4356
- const fresh = appendEvents(dir, cm[1], stamped);
4357
4720
  const { record } = await import("./ledger-D54iROST.mjs").then((n) => n.n);
4721
+ const { recordOwn } = await import("./own-C8Mq0Hnf.mjs");
4722
+ const fresh = appendEvents(dir, cm[1], stamped);
4358
4723
  for (const ev of fresh) if (ev.type === "create" || ev.type === "reply" || ev.type === "edit") record(root, cm[1], ev.id);
4724
+ const mine = fresh.filter((ev) => (ev.type === "create" || ev.type === "reply") && typeof ev.commentId === "string").map((ev) => ev.commentId);
4725
+ if (mine.length) recordOwn(root, cm[1], mine);
4359
4726
  (await Promise.resolve().then(() => live_exports)).jamLive.poke?.();
4360
4727
  backgroundPush(root);
4361
4728
  return json(res, 200, { accepted: fresh.length });
4362
4729
  }
4363
4730
  }
4364
4731
  if (path === "sync" && req.method === "POST") {
4365
- const { loadCollab, syncOnce } = await import("./sync-CMozOwZ0.mjs").then((n) => n.o);
4732
+ const { loadCollab, syncOnce } = await import("./sync-BNWwh8OF.mjs").then((n) => n.o);
4366
4733
  const collab = loadCollab(root);
4367
4734
  if (!collab) return json(res, 200, { connected: false });
4368
4735
  try {
@@ -4391,13 +4758,29 @@ function backgroundPush(root) {
4391
4758
  pushTimer = setTimeout(async () => {
4392
4759
  pushTimer = null;
4393
4760
  try {
4394
- const { loadCollab, syncOnce } = await import("./sync-CMozOwZ0.mjs").then((n) => n.o);
4761
+ const { loadCollab, syncOnce } = await import("./sync-BNWwh8OF.mjs").then((n) => n.o);
4395
4762
  const collab = loadCollab(root);
4396
4763
  if (collab) await syncOnce(root, collab);
4397
4764
  } catch {}
4398
4765
  }, 1500);
4399
4766
  }
4400
4767
  //#endregion
4768
+ //#region src/server/pdf-reset.ts
4769
+ /**
4770
+ * The dev server's restart and close reach deck PDF jobs through this hook (spec 31): plugin.ts calls `resetPdf(root)`
4771
+ * without loading pdf.ts (and pdf-lib) on a canvas that never exported; pdf.ts registers itself when it first loads.
4772
+ */
4773
+ let reset = null;
4774
+ function onPdfReset(fn) {
4775
+ reset = fn;
4776
+ }
4777
+ /** Cancel this canvas's running PDF job (its browser closes) and forget its jobs. A no-op until pdf.ts has loaded. */
4778
+ function resetPdf(root) {
4779
+ try {
4780
+ reset?.(root);
4781
+ } catch {}
4782
+ }
4783
+ //#endregion
4401
4784
  //#region src/server/routes.ts
4402
4785
  function routesMiddleware(server, clientDir, stamps, proof) {
4403
4786
  const page = (dir) => {
@@ -4891,7 +5274,7 @@ function marverPlugin(ctx) {
4891
5274
  /** a watcher this plugin makes, handed to the start (its error is said, not Node's crash) - as it is, outside one */
4892
5275
  const guarded = (w) => ctx.startup?.watch?.(w) ?? w;
4893
5276
  let project = {
4894
- name: config.share.name || basename(root),
5277
+ name: canvasIdentity(root, config).local,
4895
5278
  description: config.description
4896
5279
  };
4897
5280
  const projectInfo = () => project;
@@ -5091,7 +5474,8 @@ function marverPlugin(ctx) {
5091
5474
  zoomSpeed: config.zoomSpeed,
5092
5475
  noTheme: themeFile() == null,
5093
5476
  setup: setupPending,
5094
- projectName: config.share.name || basename(root),
5477
+ devices: config.devices,
5478
+ projectName: canvasIdentity(root, config).local,
5095
5479
  branding: config.share.branding,
5096
5480
  jam: config.jam ? {
5097
5481
  chime: config.jam.chime,
@@ -5198,18 +5582,34 @@ function marverPlugin(ctx) {
5198
5582
  });
5199
5583
  server.middlewares.use((req, res, next) => {
5200
5584
  if (new URL(req.url ?? "/", "http://x").pathname !== `/__mv/api/update`) return next();
5201
- update.then((latest) => {
5585
+ update.then(() => updateStatus(root)).then((u) => {
5202
5586
  res.setHeader("content-type", "application/json");
5203
5587
  res.setHeader("cache-control", "no-store");
5204
- res.end(JSON.stringify({
5205
- latest,
5206
- current: installedVersion()
5207
- }));
5588
+ res.end(JSON.stringify(u));
5589
+ }, () => {
5590
+ res.statusCode = 500;
5591
+ res.end("{}");
5208
5592
  });
5209
5593
  });
5210
5594
  const listeningOrigin = () => originOf(server.httpServer?.address());
5211
5595
  initMarks(root, manifest.frames);
5212
5596
  tidyPerfDir(root);
5597
+ resetPdf(root);
5598
+ try {
5599
+ if (!checkRealDirs(root, [
5600
+ [join(root, "design"), "design"],
5601
+ [join(root, "design", ".local"), "design/.local"],
5602
+ [join(root, "design", ".local", "pdf"), "design/.local/pdf"]
5603
+ ])) rmSync(join(root, "design", ".local", "pdf"), {
5604
+ recursive: true,
5605
+ force: true
5606
+ });
5607
+ } catch {}
5608
+ server.httpServer?.once("close", () => resetPdf(root));
5609
+ server.middlewares.use((req, res, next) => {
5610
+ if (!(req.url ?? "").startsWith(`/__mv/handout/`)) return next();
5611
+ import("./pdf-CZENT6t3.mjs").then((m) => m.handoutMiddleware()(req, res, next), next);
5612
+ });
5213
5613
  server.middlewares.use(apiMiddleware(root, {
5214
5614
  viewports: config.viewports,
5215
5615
  origin: listeningOrigin,
@@ -5218,12 +5618,15 @@ function marverPlugin(ctx) {
5218
5618
  server.ws.send(event, {});
5219
5619
  liveChanged();
5220
5620
  },
5621
+ broadcast: (event, payload) => server.ws.send(event, payload),
5221
5622
  manifest: () => manifest,
5222
5623
  settled,
5223
5624
  workspace: ws,
5224
- inputs
5625
+ inputs,
5626
+ themes: config.themes,
5627
+ canvasName: () => canvasIdentity(root, config).local
5225
5628
  }));
5226
- server.middlewares.use(logoRoute(root, () => config.share.logo, ctx.proof));
5629
+ server.middlewares.use(logoRoute(root, () => canvasIdentity(root, config).logos, ctx.proof));
5227
5630
  server.middlewares.use(routesMiddleware(server, clientDir, {
5228
5631
  doc: (id) => docRev(root, manifest.frames, id),
5229
5632
  docs: () => docRevs(root, manifest.frames)
@@ -5233,7 +5636,7 @@ function marverPlugin(ctx) {
5233
5636
  onClose(() => {
5234
5637
  if (devServer === server) devServer = before;
5235
5638
  });
5236
- guardUpdates(server, root, () => manifest, hooks, changes);
5639
+ guardUpdates(server, root, () => manifest, hooks, changes, (sheets) => rescanTheme(sheets));
5237
5640
  let framesKey = JSON.stringify(manifest.frames);
5238
5641
  let scenesKey = JSON.stringify(manifest.scenes);
5239
5642
  let unplacedKey = "";
@@ -5274,12 +5677,16 @@ function marverPlugin(ctx) {
5274
5677
  for (const mod of server.moduleGraph.getModulesByFile(f) ?? []) walk(mod);
5275
5678
  return out;
5276
5679
  };
5680
+ const owed = /* @__PURE__ */ new Set();
5277
5681
  const pushTheme = debounce(() => {
5278
- for (const mod of themeModules()) server.reloadModule(mod).catch(() => {});
5682
+ const sheets = [...owed].flatMap((f) => [...server.moduleGraph.getModulesByFile(f) ?? []]);
5683
+ owed.clear();
5684
+ for (const mod of /* @__PURE__ */ new Set([...themeModules(), ...sheets])) server.reloadModule(mod).catch(() => {});
5279
5685
  }, 150);
5280
5686
  onClose(pushTheme.cancel);
5281
- const rescanTheme = () => {
5687
+ const rescanTheme = (sheets = []) => {
5282
5688
  for (const mod of themeModules()) server.moduleGraph.invalidateModule(mod);
5689
+ for (const f of sheets) owed.add(f);
5283
5690
  pushTheme();
5284
5691
  };
5285
5692
  const localDir = join(root, "design", ".local"), boardsDirGen = join(root, "design", "boards"), manifestPath = join(root, "design", "manifest.json");
@@ -5346,7 +5753,7 @@ function marverPlugin(ctx) {
5346
5753
  if (f !== configFile) return;
5347
5754
  loadConfig(root).then((c) => {
5348
5755
  project = {
5349
- name: c.share.name || basename(root),
5756
+ name: canvasIdentity(root, c).local,
5350
5757
  description: c.description
5351
5758
  };
5352
5759
  regen();
@@ -5487,7 +5894,7 @@ function marverPlugin(ctx) {
5487
5894
  });
5488
5895
  return;
5489
5896
  }
5490
- const { shootFrame, shootBatch, resolveFrames } = await import("./shot-CRRGgxru.mjs").then((n) => n.u);
5897
+ const { shootFrame, shootBatch, resolveFrames } = await import("./shot-BqwkdtKn.mjs").then((n) => n.u);
5491
5898
  if (ways[0] === "frame") {
5492
5899
  if (typeof spec.frame !== "string") {
5493
5900
  write({
@@ -5658,4 +6065,4 @@ async function tailwind3Css(root) {
5658
6065
  return null;
5659
6066
  }
5660
6067
  //#endregion
5661
- export { live_exports as a, ASK_MAX as c, jamLive as i, bakeBatch as l, tailwind3Css as n, liveChanged as o, tailwind4Plugin as r, installedVersion as s, marverPlugin as t };
6068
+ export { live_exports as a, installedVersion as c, canvasIdentity as d, identityNudge as f, jamLive as i, ASK_MAX as l, tailwind3Css as n, liveChanged as o, tailwind4Plugin as r, onPdfReset as s, marverPlugin as t, bakeBatch as u };