@marver-design/marver 0.30.1 → 0.32.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 (112) hide show
  1. package/CHANGELOG.md +70 -0
  2. package/README.md +12 -8
  3. package/dist/{anchor-check-Bv4o-R2T.mjs → anchor-check-DZtX13ly.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-jHmEPLV7.mjs} +7 -7
  7. package/dist/{build-zWGXSzly.mjs → build-D2dHEWX-.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-ocvsnt2j.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-CChgWJNq.mjs → daemon-D6TrdgMi.mjs} +268 -28
  16. package/dist/deep-link-DYtuT740.mjs +163 -0
  17. package/dist/{dev-DOgIITpT.mjs → dev-DMQYbw-2.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-aZq5cExV.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-Cf9GIoIM.mjs +2299 -0
  33. package/dist/pdf-HB0prF75.mjs +117 -0
  34. package/dist/{perf-6MOTHxay.mjs → perf-9ZEF5KLO.mjs} +5 -5
  35. package/dist/{perf-BCxAo0IS.mjs → perf-BA_NDarr.mjs} +2 -1
  36. package/dist/{plugin-CFWBcAba.mjs → plugin-DesQP9L5.mjs} +565 -107
  37. package/dist/{poster-DPPpQiva.mjs → poster-Bb6WraCA.mjs} +1 -1
  38. package/dist/{profile-B1FKOM1e.mjs → profile-cdmSer1k.mjs} +1 -1
  39. package/dist/{publish-bakes-_Zx8crP3.mjs → publish-bakes-EjMmukJB.mjs} +3 -3
  40. package/dist/{queue-DeSQm24g.mjs → queue-BLLfdlDw.mjs} +156 -11
  41. package/dist/{recover-mDUVsnPd.mjs → recover-B3dmatx4.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-d4h_hJi9.mjs → shot-Bjt2MQe3.mjs} +4 -4
  46. package/dist/{shot-DBWN8hPP.mjs → shot-BuUCG46-.mjs} +1 -1
  47. package/dist/show-DhmiUu01.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-DJxH7cCX.mjs → work-B4tydWnf.mjs} +38 -2
  53. package/dist/{work-BYWD_1Zf.mjs → work-CzIXp7n1.mjs} +3 -3
  54. package/docs/app.md +143 -6
  55. package/docs/boards-and-folders.md +41 -7
  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/publish.md +9 -9
  60. package/docs/sharing.md +11 -0
  61. package/docs/slides.md +11 -1
  62. package/package.json +3 -1
  63. package/src/client/content/index.tsx +4 -2
  64. package/src/client/frame-host/main.tsx +3 -0
  65. package/src/client/shell/App.tsx +71 -24
  66. package/src/client/shell/BoardList.tsx +16 -7
  67. package/src/client/shell/Comments.tsx +77 -16
  68. package/src/client/shell/Play.tsx +104 -27
  69. package/src/client/shell/Toolbar.tsx +4 -3
  70. package/src/client/shell/app-bridge.ts +40 -5
  71. package/src/client/shell/canvas/Canvas.tsx +30 -8
  72. package/src/client/shell/canvas/FrameNode.tsx +3 -1
  73. package/src/client/shell/canvas/ctl.ts +16 -0
  74. package/src/client/shell/commands.ts +20 -0
  75. package/src/client/shell/comments-store.ts +81 -2
  76. package/src/client/shell/devices.tsx +42 -0
  77. package/src/client/shell/goto.ts +56 -9
  78. package/src/client/shell/icons.tsx +11 -4
  79. package/src/client/shell/immersive.ts +123 -0
  80. package/src/client/shell/inset.ts +29 -3
  81. package/src/client/shell/jam-lines.ts +5 -3
  82. package/src/client/shell/jam-panel.tsx +17 -5
  83. package/src/client/shell/marks-ui.tsx +54 -0
  84. package/src/client/shell/notes.ts +21 -0
  85. package/src/client/shell/pdf-export.tsx +154 -0
  86. package/src/client/shell/pdf-notes.ts +20 -0
  87. package/src/client/shell/recorder-signals.ts +5 -2
  88. package/src/client/shell/show.ts +250 -0
  89. package/src/client/shell/store.ts +23 -38
  90. package/src/client/shell/styles.css +68 -6
  91. package/src/shared/app-api.ts +90 -4
  92. package/src/shared/auto-place.ts +32 -0
  93. package/src/shared/board-tree.ts +3 -0
  94. package/src/shared/board-types.ts +6 -2
  95. package/src/shared/deep-link.ts +212 -0
  96. package/src/shared/devices.ts +89 -0
  97. package/src/shared/events.ts +48 -5
  98. package/src/shared/export-plan.ts +98 -0
  99. package/src/shared/immersive.ts +13 -0
  100. package/src/shared/perf-records.ts +1 -1
  101. package/templates/AGENTS-embedded.md +76 -12
  102. package/templates/AGENTS-studio.md +76 -12
  103. package/templates/instructions/boards.md +6 -5
  104. package/templates/instructions/configure.md +32 -2
  105. package/templates/instructions/iterate.md +8 -0
  106. package/templates/instructions/jam.md +9 -0
  107. package/templates/instructions/publish.md +14 -4
  108. package/templates/instructions/review.md +4 -0
  109. package/templates/instructions/slides.md +67 -1
  110. package/templates/instructions/welcome.md +9 -5
  111. package/templates/playbooks/publish-canvas/PLAYBOOK.md +1 -1
  112. package/dist/config-BezZTiov.mjs +0 -182
@@ -0,0 +1,117 @@
1
+ import { r as NAME } from "./cli.mjs";
2
+ import { a as readDevInfo } from "./work-B4tydWnf.mjs";
3
+ import { mkdirSync, renameSync, rmSync, writeFileSync } from "node:fs";
4
+ import { dirname, isAbsolute, join, relative, resolve } from "node:path";
5
+ import { randomBytes } from "node:crypto";
6
+ //#region src/cli/pdf.ts
7
+ /**
8
+ * `marver pdf <board>` - a board's deck as a PDF (spec 31 Part A), made by the running `marver dev` (it owns the frames
9
+ * and the browser) and written to `design/exports/<board>.pdf` (`--notes`: `<board>-notes.pdf`, the handout).
10
+ *
11
+ * The job runs in the dev server; this command starts it, shows its progress, cancels it on Ctrl-C, then fetches the
12
+ * finished file and writes it whole. What it prints is the report: pages, size, time, and every slide that was skipped,
13
+ * clipped, unsettled, patched, rasterised, changed while printing or failed.
14
+ */
15
+ const mb = (n) => n >= 1e6 ? `${(n / 2 ** 20).toFixed(1)} MB` : `${Math.max(1, Math.round(n / 1024))} KB`;
16
+ /** The report as lines a person reads: the file, then each kind of slide that needs a look. */
17
+ function reportLines(r, out) {
18
+ const lines = [`${out} - ${r.pages} page${r.pages === 1 ? "" : "s"}, ${mb(r.bytes)}, ${(r.ms / 1e3).toFixed(1)} s`];
19
+ const of = (pred, say) => r.slides.filter(pred).map(say);
20
+ const group = (label, items) => {
21
+ if (items.length) lines.push(` ${label}: ${items.join(", ")}`);
22
+ };
23
+ group("skipped", r.skipped.map((s) => `${s.frame} (${s.why})`));
24
+ group("failed", of((s) => s.status === "failed", (s) => `${s.frame} (${s.error ?? "failed"})`));
25
+ group("patched", of((s) => s.status === "patched", (s) => `${s.frame} (${[...new Set(s.patches ?? [])].join("; ")})`));
26
+ group("raster", of((s) => s.status === "raster", (s) => `${s.frame} (${s.raster ?? "raster"})`));
27
+ group("unsettled", of((s) => !!s.unsettled, (s) => s.frame));
28
+ group("clipped", of((s) => !!s.clipped, (s) => s.frame));
29
+ group("spilled", of((s) => !!s.spilled, (s) => s.frame));
30
+ group("changed while printing", of((s) => !!s.changed, (s) => s.frame));
31
+ const differs = of((s) => !!s.printDiffers, (s) => s.frame);
32
+ group("printed differently from the screen (kept: --vector)", differs);
33
+ if (!r.notes) lines.push(r.certified === "print" ? " every page print-certified (rasterised and compared with the screen)" : differs.length ? " not print-certified: the pages above differ in print" : " screen-certified only (no PDF rasteriser here)");
34
+ return lines;
35
+ }
36
+ async function pdfCommand(root, board, opts) {
37
+ const usage = `${NAME} pdf <board> [--theme <name>] [--notes] [--paper letter|a4] [--out <file>] [--raster|--vector] [--keep-going] [--json]`;
38
+ if (!board) throw new Error(`name the board: ${usage}`);
39
+ if (opts.raster && opts.vector) throw new Error("--raster or --vector, not both");
40
+ if (opts.paper !== void 0 && opts.paper !== "letter" && opts.paper !== "a4") throw new Error("--paper is letter or a4");
41
+ if (opts.paper && !opts.notes) throw new Error("--paper is for the handout (--notes): a deck page is its slide's own size");
42
+ const info = readDevInfo(root);
43
+ if (!info) throw new Error(`\`${NAME} dev\` is not running in this repo (design/.local/dev.json not found) - start it first.`);
44
+ const base = `http://localhost:${info.port}/__mv/api/pdf`;
45
+ const headers = {
46
+ "x-mv-work": info.token,
47
+ "content-type": "application/json"
48
+ };
49
+ const ask = {
50
+ board,
51
+ ...opts.theme ? { theme: opts.theme } : {},
52
+ ...opts.notes ? { notes: true } : {},
53
+ ...opts.paper ? { paper: opts.paper } : {},
54
+ ...opts.raster ? { mode: "raster" } : opts.vector ? { mode: "vector" } : {},
55
+ ...opts.keepGoing ? { keepGoing: true } : {}
56
+ };
57
+ const call = async (url, init) => {
58
+ try {
59
+ return await fetch(url, init);
60
+ } catch {
61
+ throw new Error(`could not reach \`${NAME} dev\` on port ${info.port} - is it still running?`);
62
+ }
63
+ };
64
+ const started = await call(base, {
65
+ method: "POST",
66
+ headers,
67
+ body: JSON.stringify(ask)
68
+ });
69
+ const s0 = await started.json().catch(() => ({}));
70
+ if (!started.ok || !s0.job) throw new Error(s0.error ? `${s0.error}${started.status === 409 && s0.job ? ` (job ${s0.job})` : ""}` : `the PDF could not start (${started.status})`);
71
+ const job = s0.job;
72
+ const onInt = () => {
73
+ fetch(`${base}/${job}`, {
74
+ method: "DELETE",
75
+ headers
76
+ }).finally(() => process.exit(130));
77
+ };
78
+ process.once("SIGINT", onInt);
79
+ const tty = process.stderr.isTTY && !opts.json;
80
+ let status = {};
81
+ try {
82
+ for (;;) {
83
+ const r = await call(`${base}/${job}`, { headers });
84
+ status = await r.json().catch(() => ({}));
85
+ if (!r.ok) throw new Error(status.error ?? `lost the job (${r.status})`);
86
+ if (tty) process.stderr.write(`\r ${status.phase === "merging" ? "merging" : status.phase === "handout" ? "printing the handout" : `page ${status.page ?? 0} of ${status.pages ?? "?"}`} `);
87
+ if (status.state !== "running") break;
88
+ await new Promise((res) => setTimeout(res, 400));
89
+ }
90
+ } finally {
91
+ process.removeListener("SIGINT", onInt);
92
+ if (tty) process.stderr.write("\r\x1B[K");
93
+ }
94
+ if (status.state !== "done" || !status.report) throw new Error(`the PDF ${status.state ?? "failed"}${status.error ? ` - ${status.error}` : ""}`);
95
+ const file = await call(`${base}/${job}/file`, { headers });
96
+ if (!file.ok) throw new Error((await file.json().catch(() => ({}))).error ?? `could not fetch the PDF (${file.status})`);
97
+ const bytes = Buffer.from(await file.arrayBuffer());
98
+ const out = opts.out ? isAbsolute(opts.out) ? opts.out : resolve(process.cwd(), opts.out) : join(root, "design", "exports", status.filename ?? `${board}.pdf`);
99
+ mkdirSync(dirname(out), { recursive: true });
100
+ const tmp = `${out}.${randomBytes(6).toString("hex")}.tmp`;
101
+ writeFileSync(tmp, bytes);
102
+ try {
103
+ renameSync(tmp, out);
104
+ } catch (err) {
105
+ rmSync(tmp, { force: true });
106
+ throw err;
107
+ }
108
+ const shown = relative(process.cwd(), out).startsWith("..") ? out : relative(process.cwd(), out) || out;
109
+ if (opts.json) console.log(JSON.stringify({
110
+ file: out,
111
+ ...status.report
112
+ }, null, 2));
113
+ else for (const l of reportLines(status.report, shown)) console.log(l);
114
+ return status.report.slides.some((s) => s.status === "failed") ? 1 : 0;
115
+ }
116
+ //#endregion
117
+ export { pdfCommand };
@@ -1,8 +1,8 @@
1
- import { a as checkBoardsDir, c as listBoardFiles, r as boardFields } from "./boards-EH2onUXM.mjs";
2
- import { f as isBoardName, p as labelOf } from "./board-tree-BXR8dw4b.mjs";
3
- import { i as readDevInfo } from "./work-DJxH7cCX.mjs";
4
- import { i as marverHome, v as workspaceId } from "./slots-Dn4Onb0V.mjs";
5
- import { a as readPage, g as parseAppLine, h as APP_LOG, i as perfDir, m as appLogFiles, o as readReloads, p as readJam, s as readRuns } from "./perf-BCxAo0IS.mjs";
1
+ import { l as listBoardFiles, o as checkBoardsDir, r as boardFields } from "./boards-Cim1GTKc.mjs";
2
+ import { f as isBoardName, p as labelOf } from "./board-tree-DGj0HhEE.mjs";
3
+ import { i as marverHome, v as workspaceId } from "./slots-BOcfIqxy.mjs";
4
+ import { a as readDevInfo } from "./work-B4tydWnf.mjs";
5
+ import { a as readPage, g as parseAppLine, h as APP_LOG, i as perfDir, m as appLogFiles, o as readReloads, p as readJam, s as readRuns } from "./perf-BA_NDarr.mjs";
6
6
  import { closeSync, existsSync, fstatSync, openSync, readFileSync, readSync, readdirSync, realpathSync, statSync } from "node:fs";
7
7
  import { join } from "node:path";
8
8
  import { homedir } from "node:os";
@@ -1,5 +1,5 @@
1
1
  import { t as __exportAll } from "./rolldown-runtime-8H4AJuhK.mjs";
2
- import { o as checkRealDirs } from "./boards-EH2onUXM.mjs";
2
+ import { s as checkRealDirs } from "./boards-Cim1GTKc.mjs";
3
3
  import { appendFileSync, chmodSync, closeSync, existsSync, fstatSync, lstatSync, mkdirSync, openSync, readFileSync, readSync, readdirSync, renameSync, statSync, unlinkSync } from "node:fs";
4
4
  import { isAbsolute, join, relative } from "node:path";
5
5
  import { appendFile } from "node:fs/promises";
@@ -187,6 +187,7 @@ const MODES = [
187
187
  "play",
188
188
  "slides",
189
189
  "hide-ui",
190
+ "immersive",
190
191
  "jam-session",
191
192
  "jam-capture",
192
193
  "jam-review",