@marver-design/marver 0.23.0 → 0.24.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.
- package/CHANGELOG.md +56 -0
- package/README.md +3 -1
- package/dist/{bake-l6N12qgx.mjs → bake-ZhXq-X9f.mjs} +1 -1
- package/dist/{board-status-D_lHZZ09.mjs → board-status-BZSzc9Hp.mjs} +1 -1
- package/dist/{boards-DbVJlbd5.mjs → boards-BRLnoTC3.mjs} +14 -6
- package/dist/{boards-CahYhF5B.mjs → boards-Dv-Ipd8G.mjs} +13 -6
- package/dist/{build-CuRhHXcY.mjs → build-ckcinlWH.mjs} +15 -11
- package/dist/cli.mjs +10 -10
- package/dist/{comments-0d3e274b.mjs → comments-Dx1hCVOT.mjs} +1 -1
- package/dist/{config-g-J8NrPn.mjs → config-BUKprFAp.mjs} +1 -1
- package/dist/{context-fAtQLHt2.mjs → context-BncTXjLB.mjs} +3 -3
- package/dist/{daemon-DZ367fiM.mjs → daemon-CQv73-jM.mjs} +5 -4
- package/dist/{dev-R6zvwbqX.mjs → dev-gv4NS6Fk.mjs} +7 -7
- package/dist/{init-DAnBlt-V.mjs → init--3Moc4J7.mjs} +9 -4
- package/dist/{link-CcfAfKY-.mjs → link-vXjxMHTG.mjs} +3 -3
- package/dist/{manifest-BkjJ5OQk.mjs → manifest-cyG3kbhk.mjs} +9 -4
- package/dist/{plugin-C1avHL7g.mjs → plugin-Sa08E7wO.mjs} +232 -36
- package/dist/{poster-Bc4-3DlQ.mjs → poster-B2QPvKOq.mjs} +1 -1
- package/dist/{publish-bakes-DQWn14IY.mjs → publish-bakes-BJR3huhu.mjs} +2 -2
- package/dist/{shot-CVOlQHUr.mjs → shot-Cw96h5Kk.mjs} +2 -2
- package/dist/{shot-C1YR_Sqx.mjs → shot-Dh6fV1Lm.mjs} +1 -1
- package/dist/{work-CJ8OIpBD.mjs → work-CBUfsOOT.mjs} +2 -2
- package/dist/{work-CiUvBVa6.mjs → work-ayuL_9Kk.mjs} +1 -1
- package/docs/boards-and-folders.md +31 -1
- package/docs/live-jam.md +4 -1
- package/docs/sticky-notes.md +1 -1
- package/package.json +1 -1
- package/src/client/content/index.tsx +4 -0
- package/src/client/content/md.ts +3 -2
- package/src/client/shell/App.tsx +37 -12
- package/src/client/shell/BoardList.tsx +27 -7
- package/src/client/shell/Play.tsx +2 -0
- package/src/client/shell/canvas/Canvas.tsx +2 -0
- package/src/client/shell/canvas/FrameNode.tsx +6 -1
- package/src/client/shell/comments-store.ts +2 -0
- package/src/client/shell/marks-ui.tsx +119 -0
- package/src/client/shell/store.ts +110 -9
- package/src/client/shell/styles.css +23 -0
- package/src/client/shell/tidy.ts +34 -3
- package/src/shared/frames.ts +3 -0
- package/src/shared/marks.ts +65 -0
|
@@ -1,15 +1,141 @@
|
|
|
1
1
|
import { t as __exportAll } from "./rolldown-runtime-D7D4PA-g.mjs";
|
|
2
2
|
import { a as ROUTE, i as PKG, r as NAME } from "./cli.mjs";
|
|
3
|
-
import {
|
|
4
|
-
import { i as readContextFacts, n as planNames, r as planWithStage, t as annotateBoards } from "./board-status-
|
|
3
|
+
import { C as wireKids, D as HAS_STATUS, F as resolveType, I as settableStatuses, L as hash, M as readReason, N as readStatusWord, P as readType, S as validateWire, _ as folderMap, a as checkRealDirs, b as readDescription, c as nodeExists, d as withRegistryLock, f as BOARD_NAME, i as checkBoardsDir, j as readCapability, l as parseBoard, m as buildTree, o as isRegularFile, p as FOLDERS_FILE, r as boardFields, s as listBoardFiles, t as AUTHOR_FIELDS, u as readRegistry, x as readTitle } from "./boards-BRLnoTC3.mjs";
|
|
4
|
+
import { i as readContextFacts, n as planNames, r as planWithStage, t as annotateBoards } from "./board-status-BZSzc9Hp.mjs";
|
|
5
5
|
import { n as localProfile, t as isConnected } from "./profile-CrZohD6g.mjs";
|
|
6
|
-
import { a as
|
|
7
|
-
import { n as loadConfig } from "./config-
|
|
8
|
-
import { r as boardsChanged } from "./work-
|
|
9
|
-
import { closeSync, copyFileSync, existsSync, linkSync, mkdirSync, openSync, readFileSync, readdirSync, realpathSync, renameSync, rmSync, watch, writeFileSync } from "node:fs";
|
|
6
|
+
import { a as noteFileFor, c as setSceneTitle, n as isNoteFile, o as rendersDoc, r as layoutDocSource, s as scanFrames, t as affectedFrameIds, u as writeManifest } from "./manifest-cyG3kbhk.mjs";
|
|
7
|
+
import { n as loadConfig } from "./config-BUKprFAp.mjs";
|
|
8
|
+
import { r as boardsChanged } from "./work-ayuL_9Kk.mjs";
|
|
9
|
+
import { closeSync, copyFileSync, existsSync, linkSync, mkdirSync, openSync, readFileSync, readdirSync, realpathSync, renameSync, rmSync, statSync, watch, writeFileSync } from "node:fs";
|
|
10
10
|
import { basename, dirname, join, resolve, sep } from "node:path";
|
|
11
11
|
import { fileURLToPath } from "node:url";
|
|
12
12
|
import { randomBytes } from "node:crypto";
|
|
13
|
+
//#region src/shared/frames.ts
|
|
14
|
+
/** A canvas made of content frames alone (Doc, Md, Diagram ship their own styling) needs no theme -
|
|
15
|
+
* only an app frame does (#4). Empty counts as not content-only: the warning still helps there. */
|
|
16
|
+
const contentOnly = (frames) => frames.length > 0 && frames.every((f) => !!f.intent);
|
|
17
|
+
//#endregion
|
|
18
|
+
//#region src/server/marks.ts
|
|
19
|
+
/**
|
|
20
|
+
* Sidebar marks, the dev server's half (spec 25): when each frame last changed, and which change
|
|
21
|
+
* you have seen. Local only - `design/.local/` is never committed and never published.
|
|
22
|
+
*
|
|
23
|
+
* Changed = the latest of the frame file's mtime, its sticky note's, and `changes.json` - an agent
|
|
24
|
+
* naming the frame in `work done` (an edit to a shared kit it imports), or the frame first appearing
|
|
25
|
+
* under a new id (a rename keeps the file's old mtime). A git pull moves mtimes too.
|
|
26
|
+
* Seen = `seen.json`: { version, baseline, ids, frames: { id: the change stamp you saw } }. Its first
|
|
27
|
+
* read sets the baseline to now, so everything already on the canvas that day counts as seen.
|
|
28
|
+
* A "seen" is the stamp the page displayed, never a clock: an edit landing after you looked is new.
|
|
29
|
+
*/
|
|
30
|
+
var marks_exports = /* @__PURE__ */ __exportAll({
|
|
31
|
+
markSeen: () => markSeen,
|
|
32
|
+
readMarks: () => readMarks,
|
|
33
|
+
readSeen: () => readSeen,
|
|
34
|
+
recordChanged: () => recordChanged
|
|
35
|
+
});
|
|
36
|
+
const dir = (root) => join(root, "design", ".local");
|
|
37
|
+
const read = (file) => {
|
|
38
|
+
try {
|
|
39
|
+
return JSON.parse(readFileSync(file, "utf8"));
|
|
40
|
+
} catch {
|
|
41
|
+
return null;
|
|
42
|
+
}
|
|
43
|
+
};
|
|
44
|
+
/** Writes stay inside the project: a symlinked design/ or .local is refused (as boards.ts refuses). */
|
|
45
|
+
const write = (root, name, data) => {
|
|
46
|
+
if (checkRealDirs(root, [[join(root, "design"), "design"], [dir(root), "design/.local"]])) return;
|
|
47
|
+
mkdirSync(dir(root), { recursive: true });
|
|
48
|
+
const file = join(dir(root), name), tmp = `${file}.${randomBytes(6).toString("hex")}.tmp`;
|
|
49
|
+
writeFileSync(tmp, JSON.stringify(data) + "\n");
|
|
50
|
+
renameSync(tmp, file);
|
|
51
|
+
};
|
|
52
|
+
const stamps = (o) => o && typeof o === "object" ? Object.fromEntries(Object.entries(o).filter(([, v]) => typeof v === "number" && Number.isFinite(v))) : {};
|
|
53
|
+
function readSeen(root) {
|
|
54
|
+
const f = read(join(dir(root), "seen.json"));
|
|
55
|
+
const strs = (v) => Array.isArray(v) ? v.filter((i) => typeof i === "string") : null;
|
|
56
|
+
if (f && typeof f.baseline === "number") return {
|
|
57
|
+
version: 1,
|
|
58
|
+
baseline: f.baseline,
|
|
59
|
+
ids: strs(f.ids),
|
|
60
|
+
notes: strs(f.notes) ?? [],
|
|
61
|
+
frames: stamps(f.frames)
|
|
62
|
+
};
|
|
63
|
+
const fresh = {
|
|
64
|
+
version: 1,
|
|
65
|
+
baseline: Date.now(),
|
|
66
|
+
ids: null,
|
|
67
|
+
frames: {}
|
|
68
|
+
};
|
|
69
|
+
write(root, "seen.json", fresh);
|
|
70
|
+
return fresh;
|
|
71
|
+
}
|
|
72
|
+
/** You saw these frames at these change stamps. Never lowers a stamp; drops ids the canvas no longer has. */
|
|
73
|
+
function markSeen(root, seen, known) {
|
|
74
|
+
const s = readSeen(root);
|
|
75
|
+
for (const [id, at] of Object.entries(stamps(seen))) if (known.has(id)) s.frames[id] = Math.max(s.frames[id] ?? 0, at);
|
|
76
|
+
for (const id of Object.keys(s.frames)) if (!known.has(id)) delete s.frames[id];
|
|
77
|
+
write(root, "seen.json", s);
|
|
78
|
+
}
|
|
79
|
+
const readChanges = (root) => stamps(read(join(dir(root), "changes.json"))?.frames);
|
|
80
|
+
/** These frames changed now, whatever their files say (`work done`, or a frame new under its id). */
|
|
81
|
+
function recordChanged(root, ids, known) {
|
|
82
|
+
const c = readChanges(root), now = Date.now();
|
|
83
|
+
for (const id of ids) c[id] = now;
|
|
84
|
+
if (known) {
|
|
85
|
+
for (const id of Object.keys(c)) if (!known.has(id)) delete c[id];
|
|
86
|
+
}
|
|
87
|
+
write(root, "changes.json", {
|
|
88
|
+
version: 1,
|
|
89
|
+
frames: c
|
|
90
|
+
});
|
|
91
|
+
}
|
|
92
|
+
const mtime = (abs) => {
|
|
93
|
+
try {
|
|
94
|
+
return statSync(abs).mtimeMs;
|
|
95
|
+
} catch {
|
|
96
|
+
return 0;
|
|
97
|
+
}
|
|
98
|
+
};
|
|
99
|
+
function readMarks(root, manifest) {
|
|
100
|
+
const all = manifest.frames.map((f) => f.id);
|
|
101
|
+
const known = new Set(all);
|
|
102
|
+
const seen = readSeen(root);
|
|
103
|
+
const noteAt = {};
|
|
104
|
+
for (const f of manifest.frames) noteAt[f.id] = mtime(noteFileFor(join(root, f.file)));
|
|
105
|
+
const notes = all.filter((id) => noteAt[id] > 0);
|
|
106
|
+
const had = seen.ids ? new Set(seen.ids) : null;
|
|
107
|
+
const added = had ? all.filter((id) => !had.has(id)) : [];
|
|
108
|
+
const noteGone = had ? (seen.notes ?? []).filter((id) => known.has(id) && !noteAt[id]) : [];
|
|
109
|
+
const removed = had ? [...had].some((id) => !known.has(id)) : false;
|
|
110
|
+
if (added.length || noteGone.length || removed) recordChanged(root, [...added, ...noteGone], known);
|
|
111
|
+
if (!had || had.size !== all.length || added.length || noteGone.length || notes.length !== (seen.notes ?? []).length) {
|
|
112
|
+
const frames = Object.fromEntries(Object.entries(seen.frames).filter(([id]) => known.has(id)));
|
|
113
|
+
write(root, "seen.json", {
|
|
114
|
+
...seen,
|
|
115
|
+
ids: all,
|
|
116
|
+
notes,
|
|
117
|
+
frames
|
|
118
|
+
});
|
|
119
|
+
seen.frames = frames;
|
|
120
|
+
}
|
|
121
|
+
const done = readChanges(root);
|
|
122
|
+
const changed = {};
|
|
123
|
+
for (const f of manifest.frames) changed[f.id] = Math.max(mtime(join(root, f.file)), noteAt[f.id], done[f.id] ?? 0);
|
|
124
|
+
const boards = { "all-scenes": all };
|
|
125
|
+
const boardsDir = join(root, "design", "boards");
|
|
126
|
+
if (existsSync(boardsDir) && !checkBoardsDir(root, boardsDir)) for (const b of listBoardFiles(boardsDir).boards) {
|
|
127
|
+
const j = b.json;
|
|
128
|
+
if (!j || b.name === "all-scenes") continue;
|
|
129
|
+
boards[b.name] = j.auto === true ? all : Array.isArray(j.nodes) ? j.nodes.map((n) => n?.frame).filter((f) => typeof f === "string" && known.has(f)) : [];
|
|
130
|
+
}
|
|
131
|
+
return {
|
|
132
|
+
changed,
|
|
133
|
+
seen: seen.frames,
|
|
134
|
+
baseline: seen.baseline,
|
|
135
|
+
boards
|
|
136
|
+
};
|
|
137
|
+
}
|
|
138
|
+
//#endregion
|
|
13
139
|
//#region src/server/sizes.ts
|
|
14
140
|
/**
|
|
15
141
|
* Content-frame heights - `design/boards/_sizes.json`, committed.
|
|
@@ -280,7 +406,8 @@ function apiMiddleware(root, opts = {}) {
|
|
|
280
406
|
const files = listBoardFiles(boardsDir).boards;
|
|
281
407
|
const rows = files.map((b) => ({
|
|
282
408
|
name: b.name,
|
|
283
|
-
...boardFields(b.json, validName)
|
|
409
|
+
...boardFields(b.json, validName),
|
|
410
|
+
...b.error ? { error: b.error } : {}
|
|
284
411
|
}));
|
|
285
412
|
const reg = readRegistry(boardsDir);
|
|
286
413
|
const regFolders = reg.state === "ok" ? reg.folders : [];
|
|
@@ -774,14 +901,12 @@ function apiMiddleware(root, opts = {}) {
|
|
|
774
901
|
if (req.method === "GET") {
|
|
775
902
|
if (!existsSync(p)) return json(res, 200, { board: null });
|
|
776
903
|
const content = readFileSync(p, "utf8");
|
|
777
|
-
|
|
778
|
-
|
|
779
|
-
|
|
780
|
-
|
|
781
|
-
|
|
782
|
-
}
|
|
783
|
-
return json(res, 422, { error: `board "${boardMatch[1]}" is not valid JSON - fix the file` });
|
|
784
|
-
}
|
|
904
|
+
const parsed = parseBoard(content);
|
|
905
|
+
if (parsed.error) return json(res, 422, { error: `design/boards/${boardMatch[1]}.json is not valid JSON - ${parsed.error}` });
|
|
906
|
+
return json(res, 200, {
|
|
907
|
+
board: parsed.json,
|
|
908
|
+
sha256: hash(content)
|
|
909
|
+
});
|
|
785
910
|
}
|
|
786
911
|
if (req.method === "PUT") {
|
|
787
912
|
const raw = await readBody(req);
|
|
@@ -821,7 +946,7 @@ function apiMiddleware(root, opts = {}) {
|
|
|
821
946
|
}
|
|
822
947
|
}
|
|
823
948
|
if (path === "shot" && req.method === "GET") {
|
|
824
|
-
const { readDevInfo } = await import("./work-
|
|
949
|
+
const { readDevInfo } = await import("./work-ayuL_9Kk.mjs").then((n) => n.o);
|
|
825
950
|
const token = readDevInfo(root)?.token;
|
|
826
951
|
if (!ownerGated(req) && !(token && req.headers["x-mv-work"] === token)) return json(res, 403, { error: "forbidden" });
|
|
827
952
|
const frameId = url.searchParams.get("frame") ?? "";
|
|
@@ -837,7 +962,7 @@ function apiMiddleware(root, opts = {}) {
|
|
|
837
962
|
};
|
|
838
963
|
const asPng = url.searchParams.get("format") === "png";
|
|
839
964
|
const origin = opts.origin?.() ?? `http://${req.headers.host ?? "localhost"}`;
|
|
840
|
-
const { shootFrame } = await import("./shot-
|
|
965
|
+
const { shootFrame } = await import("./shot-Cw96h5Kk.mjs");
|
|
841
966
|
const r = await shootFrame({
|
|
842
967
|
root,
|
|
843
968
|
viewports: opts.viewports ?? {},
|
|
@@ -870,7 +995,7 @@ function apiMiddleware(root, opts = {}) {
|
|
|
870
995
|
return res.end(png);
|
|
871
996
|
}
|
|
872
997
|
if (path === "shots" && req.method === "POST") {
|
|
873
|
-
const { readDevInfo } = await import("./work-
|
|
998
|
+
const { readDevInfo } = await import("./work-ayuL_9Kk.mjs").then((n) => n.o);
|
|
874
999
|
const token = readDevInfo(root)?.token;
|
|
875
1000
|
if (!ownerGated(req) && !(token && req.headers["x-mv-work"] === token)) return json(res, 403, { error: "forbidden" });
|
|
876
1001
|
const raw = await readBody(req);
|
|
@@ -887,7 +1012,7 @@ function apiMiddleware(root, opts = {}) {
|
|
|
887
1012
|
if (typeof theme !== "string" || !/^[a-z0-9-]+$/i.test(theme)) return json(res, 400, { error: "invalid theme" });
|
|
888
1013
|
const scale = body.scale === void 0 ? void 0 : body.scale;
|
|
889
1014
|
if (scale !== void 0 && !(Number.isInteger(scale) && scale >= 1 && scale <= 4)) return json(res, 400, { error: "invalid scale" });
|
|
890
|
-
const { resolveFrames, shootBatch } = await import("./shot-
|
|
1015
|
+
const { resolveFrames, shootBatch } = await import("./shot-Cw96h5Kk.mjs");
|
|
891
1016
|
const sel = resolveFrames(root, body);
|
|
892
1017
|
if (!sel.ok) return json(res, sel.status, { error: sel.error });
|
|
893
1018
|
const origin = opts.origin?.() ?? `http://${req.headers.host ?? "localhost"}`;
|
|
@@ -915,7 +1040,7 @@ function apiMiddleware(root, opts = {}) {
|
|
|
915
1040
|
return json(res, 400, { error: "malformed JSON" });
|
|
916
1041
|
}
|
|
917
1042
|
if (!body || typeof body !== "object" || !Array.isArray(body.asks) || !body.asks.length || body.asks.length > 200) return json(res, 400, { error: "asks must list 1-200 frames" });
|
|
918
|
-
const { bakeBatch, ASK_MAX } = await import("./bake-
|
|
1043
|
+
const { bakeBatch, ASK_MAX } = await import("./bake-ZhXq-X9f.mjs");
|
|
919
1044
|
let manifest = {};
|
|
920
1045
|
try {
|
|
921
1046
|
manifest = JSON.parse(readFileSync(join(root, "design", "manifest.json"), "utf8"));
|
|
@@ -959,8 +1084,8 @@ function apiMiddleware(root, opts = {}) {
|
|
|
959
1084
|
if (path === "poster" && req.method === "GET") {
|
|
960
1085
|
if (!ownerGated(req)) return json(res, 403, { error: "forbidden" });
|
|
961
1086
|
const src = url.searchParams.get("src") ?? "";
|
|
962
|
-
const { ensurePoster, isLocalClip } = await import("./poster-
|
|
963
|
-
const { isLocalAssetRef } = await import("./build-
|
|
1087
|
+
const { ensurePoster, isLocalClip } = await import("./poster-B2QPvKOq.mjs");
|
|
1088
|
+
const { isLocalAssetRef } = await import("./build-ckcinlWH.mjs");
|
|
964
1089
|
if (!isLocalAssetRef(src) || !isLocalClip(src)) return json(res, 400, { error: "src must be a clip under design/assets/" });
|
|
965
1090
|
const r = await ensurePoster(join(root, "design", "assets"), src);
|
|
966
1091
|
if (!r.ok) return json(res, r.error.includes("does not exist") ? 404 : 503, { error: r.error });
|
|
@@ -1001,15 +1126,41 @@ function apiMiddleware(root, opts = {}) {
|
|
|
1001
1126
|
atomicWrite(join(dir, "profile.json"), JSON.stringify(prof, null, 2) + "\n");
|
|
1002
1127
|
return json(res, 200, { user: localProfile(root) });
|
|
1003
1128
|
}
|
|
1129
|
+
if (path === "marks" || path === "marks/seen") {
|
|
1130
|
+
if (!ownerGated(req)) return json(res, 403, { error: "forbidden" });
|
|
1131
|
+
const { readMarks, markSeen } = await Promise.resolve().then(() => marks_exports);
|
|
1132
|
+
let manifest;
|
|
1133
|
+
try {
|
|
1134
|
+
manifest = JSON.parse(readFileSync(join(root, "design", "manifest.json"), "utf8"));
|
|
1135
|
+
} catch {
|
|
1136
|
+
manifest = scanFrames(root);
|
|
1137
|
+
}
|
|
1138
|
+
if (path === "marks" && req.method === "GET") return json(res, 200, readMarks(root, manifest));
|
|
1139
|
+
if (path === "marks/seen" && req.method === "POST") {
|
|
1140
|
+
const raw = await readBody(req);
|
|
1141
|
+
if (raw == null) return json(res, 400, { error: "body too large" });
|
|
1142
|
+
let b;
|
|
1143
|
+
try {
|
|
1144
|
+
b = JSON.parse(raw);
|
|
1145
|
+
} catch {
|
|
1146
|
+
return json(res, 400, { error: "malformed JSON" });
|
|
1147
|
+
}
|
|
1148
|
+
if (!b?.frames || typeof b.frames !== "object" || Array.isArray(b.frames)) return json(res, 400, { error: "frames: { id: stamp } required" });
|
|
1149
|
+
markSeen(root, b.frames, new Set(manifest.frames.map((f) => f.id)));
|
|
1150
|
+
opts.notify?.("sh:marks");
|
|
1151
|
+
return json(res, 200, { ok: true });
|
|
1152
|
+
}
|
|
1153
|
+
return json(res, 405, { error: "method not allowed" });
|
|
1154
|
+
}
|
|
1004
1155
|
if (path === "work") {
|
|
1005
|
-
const { workActivity, readDevInfo, WORK_TTL_DEFAULT, WORK_TTL_MAX } = await import("./work-
|
|
1156
|
+
const { workActivity, readDevInfo, WORK_TTL_DEFAULT, WORK_TTL_MAX } = await import("./work-ayuL_9Kk.mjs").then((n) => n.o);
|
|
1006
1157
|
const tokenOk = () => {
|
|
1007
1158
|
const t = readDevInfo(root)?.token;
|
|
1008
1159
|
return !!t && req.headers["x-mv-work"] === t;
|
|
1009
1160
|
};
|
|
1010
1161
|
if (req.method === "GET") {
|
|
1011
1162
|
if (!ownerGated(req) && !tokenOk()) return json(res, 403, { error: "forbidden" });
|
|
1012
|
-
const { boardsShowing, activityClock } = await import("./work-
|
|
1163
|
+
const { boardsShowing, activityClock } = await import("./work-ayuL_9Kk.mjs").then((n) => n.o);
|
|
1013
1164
|
const frames = workActivity.active();
|
|
1014
1165
|
return json(res, 200, {
|
|
1015
1166
|
frames,
|
|
@@ -1030,13 +1181,22 @@ function apiMiddleware(root, opts = {}) {
|
|
|
1030
1181
|
const frames = Array.isArray(b.frames) ? b.frames.filter((f) => typeof f === "string" && f) : [];
|
|
1031
1182
|
const on = b.on !== false;
|
|
1032
1183
|
if (!on && b.all === true) {
|
|
1184
|
+
const done = workActivity.active().filter((f) => workActivity.has(f, "cli"));
|
|
1185
|
+
if (done.length) {
|
|
1186
|
+
(await Promise.resolve().then(() => marks_exports)).recordChanged(root, done);
|
|
1187
|
+
opts.notify?.("sh:marks");
|
|
1188
|
+
}
|
|
1033
1189
|
workActivity.clearAll("cli");
|
|
1034
1190
|
return json(res, 200, { frames: workActivity.active() });
|
|
1035
1191
|
}
|
|
1036
1192
|
if (!frames.length) return json(res, 400, { error: "frames required" });
|
|
1037
1193
|
const ttl = Math.min(Math.max(Number(b.ttlMs) || WORK_TTL_DEFAULT, 1e4), WORK_TTL_MAX);
|
|
1038
1194
|
for (const f of frames) on ? workActivity.mark(f, ttl, "cli") : workActivity.clear(f, "cli");
|
|
1039
|
-
if (!on)
|
|
1195
|
+
if (!on) {
|
|
1196
|
+
(await Promise.resolve().then(() => marks_exports)).recordChanged(root, frames);
|
|
1197
|
+
opts.notify?.("sh:marks");
|
|
1198
|
+
return json(res, 200, { frames: workActivity.active() });
|
|
1199
|
+
}
|
|
1040
1200
|
let behind = [];
|
|
1041
1201
|
let contextPresent = false;
|
|
1042
1202
|
try {
|
|
@@ -1313,6 +1473,10 @@ function marverPlugin(ctx) {
|
|
|
1313
1473
|
revision: `${bootId}:${++invRev}`
|
|
1314
1474
|
});
|
|
1315
1475
|
}, 120);
|
|
1476
|
+
/** No theme is only a problem for app frames: a canvas made of content frames alone (Doc, Md,
|
|
1477
|
+
* Diagram ship their own styling) needs none (#4). The shell decides its banner from the live
|
|
1478
|
+
* manifest; the config carries only whether a theme exists. */
|
|
1479
|
+
const themeMissing = () => themeFile() == null && !contentOnly(manifest.frames);
|
|
1316
1480
|
/** Theme resolution: design/theme.css wrapper > configured > detected > empty (spec §5.4). */
|
|
1317
1481
|
const themeFile = () => {
|
|
1318
1482
|
const wrapper = join(root, "design", "theme.css");
|
|
@@ -1331,7 +1495,7 @@ function marverPlugin(ctx) {
|
|
|
1331
1495
|
},
|
|
1332
1496
|
load(id) {
|
|
1333
1497
|
if (id === "\0virtual:sh-theme.css") {
|
|
1334
|
-
console.warn("[marver] no theme detected - frames render unstyled. Create design/theme.css importing your app's stylesheet (or set `theme` in design/config.ts).");
|
|
1498
|
+
if (themeMissing()) console.warn("[marver] no theme detected - frames render unstyled. Create design/theme.css importing your app's stylesheet (or set `theme` in design/config.ts).");
|
|
1335
1499
|
return "/* marver: no theme configured */";
|
|
1336
1500
|
}
|
|
1337
1501
|
if (id === "\0virtual:sh-config") {
|
|
@@ -1430,7 +1594,8 @@ function marverPlugin(ctx) {
|
|
|
1430
1594
|
server.middlewares.use(apiMiddleware(root, {
|
|
1431
1595
|
viewports: config.viewports,
|
|
1432
1596
|
origin: listeningOrigin,
|
|
1433
|
-
bakeGen: () => bakeGen
|
|
1597
|
+
bakeGen: () => bakeGen,
|
|
1598
|
+
notify: (event) => server.ws.send(event, {})
|
|
1434
1599
|
}));
|
|
1435
1600
|
server.middlewares.use(routesMiddleware(server, clientDir));
|
|
1436
1601
|
devServer = server;
|
|
@@ -1476,7 +1641,7 @@ function marverPlugin(ctx) {
|
|
|
1476
1641
|
};
|
|
1477
1642
|
const prune = () => setTimeout(async () => {
|
|
1478
1643
|
try {
|
|
1479
|
-
(await import("./bake-
|
|
1644
|
+
(await import("./bake-ZhXq-X9f.mjs")).pruneBakes(root, bakeGen);
|
|
1480
1645
|
} catch {}
|
|
1481
1646
|
}, 500);
|
|
1482
1647
|
prune();
|
|
@@ -1509,6 +1674,19 @@ function marverPlugin(ctx) {
|
|
|
1509
1674
|
server.watcher.on("unlink", restatus);
|
|
1510
1675
|
server.watcher.on("change", restatus);
|
|
1511
1676
|
server.watcher.on("change", (f) => inScope(f) && (/\.(tsx|jsx)$/.test(f) || f.endsWith("_brief.md") || isNoteFile(f)) && regen());
|
|
1677
|
+
const marksChanged = debounce(() => server.ws.send("sh:marks", {}), 300);
|
|
1678
|
+
for (const ev of [
|
|
1679
|
+
"add",
|
|
1680
|
+
"change",
|
|
1681
|
+
"unlink"
|
|
1682
|
+
]) server.watcher.on(ev, (f) => {
|
|
1683
|
+
if (inScope(f) && (/\.(tsx|jsx|html)$/.test(f) || isNoteFile(f))) marksChanged();
|
|
1684
|
+
});
|
|
1685
|
+
server.watcher.on("unlink", (f) => {
|
|
1686
|
+
if (!inScope(f) || !isNoteFile(f)) return;
|
|
1687
|
+
const fr = manifest.frames.find((x) => noteFileFor(join(root, x.file)) === f);
|
|
1688
|
+
if (fr) recordChanged(root, [fr.id]);
|
|
1689
|
+
});
|
|
1512
1690
|
const configFile = join(root, "design", "config.ts");
|
|
1513
1691
|
server.watcher.on("change", (f) => {
|
|
1514
1692
|
if (f !== configFile) return;
|
|
@@ -1525,6 +1703,15 @@ function marverPlugin(ctx) {
|
|
|
1525
1703
|
try {
|
|
1526
1704
|
mkdirSync(boardsDir, { recursive: true });
|
|
1527
1705
|
const timers = /* @__PURE__ */ new Map();
|
|
1706
|
+
const badBoards = /* @__PURE__ */ new Map();
|
|
1707
|
+
const reportBad = (file, content, error) => {
|
|
1708
|
+
if (badBoards.get(file) === hash(content)) return;
|
|
1709
|
+
badBoards.set(file, hash(content));
|
|
1710
|
+
console.warn(`[marver] design/boards/${file} is not valid JSON - ${error}`);
|
|
1711
|
+
};
|
|
1712
|
+
if (!checkBoardsDir(root, boardsDir)) {
|
|
1713
|
+
for (const b of listBoardFiles(boardsDir).boards) if (b.error) reportBad(`${b.name}.json`, b.content, b.error);
|
|
1714
|
+
}
|
|
1528
1715
|
let listTimer;
|
|
1529
1716
|
const watcher = watch(boardsDir, (_event, file) => {
|
|
1530
1717
|
if (!file || !file.endsWith(".json") || file === "_sizes.json") return;
|
|
@@ -1537,14 +1724,23 @@ function marverPlugin(ctx) {
|
|
|
1537
1724
|
clearTimeout(timers.get(file));
|
|
1538
1725
|
timers.set(file, setTimeout(() => {
|
|
1539
1726
|
timers.delete(file);
|
|
1727
|
+
let content;
|
|
1728
|
+
if (!isRegularFile(join(boardsDir, file))) return;
|
|
1540
1729
|
try {
|
|
1541
|
-
|
|
1542
|
-
|
|
1543
|
-
|
|
1544
|
-
|
|
1545
|
-
|
|
1546
|
-
|
|
1547
|
-
|
|
1730
|
+
content = readFileSync(join(boardsDir, file), "utf8");
|
|
1731
|
+
} catch {
|
|
1732
|
+
return;
|
|
1733
|
+
}
|
|
1734
|
+
const { error } = parseBoard(content);
|
|
1735
|
+
if (error) {
|
|
1736
|
+
if (!checkBoardsDir(root, boardsDir)) reportBad(file, content, error);
|
|
1737
|
+
return;
|
|
1738
|
+
}
|
|
1739
|
+
badBoards.delete(file);
|
|
1740
|
+
server.ws.send("sh:board", {
|
|
1741
|
+
name: file.replace(/\.json$/, ""),
|
|
1742
|
+
sha256: hash(content)
|
|
1743
|
+
});
|
|
1548
1744
|
}, 120));
|
|
1549
1745
|
});
|
|
1550
1746
|
server.httpServer?.once("close", () => watcher.close());
|
|
@@ -1629,7 +1825,7 @@ function marverPlugin(ctx) {
|
|
|
1629
1825
|
});
|
|
1630
1826
|
return;
|
|
1631
1827
|
}
|
|
1632
|
-
const { shootFrame, shootBatch, resolveFrames } = await import("./shot-
|
|
1828
|
+
const { shootFrame, shootBatch, resolveFrames } = await import("./shot-Cw96h5Kk.mjs");
|
|
1633
1829
|
if (ways[0] === "frame") {
|
|
1634
1830
|
if (typeof spec.frame !== "string") {
|
|
1635
1831
|
write({
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { capture, t as findChrome } from "./shot-
|
|
1
|
+
import { capture, t as findChrome } from "./shot-Cw96h5Kk.mjs";
|
|
2
2
|
import { constants, copyFileSync, existsSync, mkdtempSync, realpathSync, rmSync, writeFileSync } from "node:fs";
|
|
3
3
|
import { basename, dirname, join, sep } from "node:path";
|
|
4
4
|
import { pathToFileURL } from "node:url";
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { o as slideSize } from "./cli.mjs";
|
|
2
|
-
import { planShot, t as findChrome } from "./shot-
|
|
3
|
-
import { ASK_MAX, bakeBatch } from "./bake-
|
|
2
|
+
import { planShot, t as findChrome } from "./shot-Cw96h5Kk.mjs";
|
|
3
|
+
import { ASK_MAX, bakeBatch } from "./bake-ZhXq-X9f.mjs";
|
|
4
4
|
import { MIME } from "./serve-z5qtj_wJ.mjs";
|
|
5
5
|
import { copyFileSync, lstatSync, mkdirSync, readFileSync, realpathSync, rmSync, statSync, writeFileSync } from "node:fs";
|
|
6
6
|
import { extname, isAbsolute, join, relative, resolve } from "node:path";
|
|
@@ -337,8 +337,8 @@ async function shootFrame(opts) {
|
|
|
337
337
|
};
|
|
338
338
|
const plan = planShot(frame, viewports, size);
|
|
339
339
|
if (frame.kind !== "html") try {
|
|
340
|
-
const { scanAssetRefs } = await import("./build-
|
|
341
|
-
const { ensurePoster } = await import("./poster-
|
|
340
|
+
const { scanAssetRefs } = await import("./build-ckcinlWH.mjs");
|
|
341
|
+
const { ensurePoster } = await import("./poster-B2QPvKOq.mjs");
|
|
342
342
|
const refs = scanAssetRefs(readFileSync(join(root, frame.file), "utf8"), frame.file);
|
|
343
343
|
for (const r of refs) if (r.endsWith(".poster.png")) await ensurePoster(join(root, "design", "assets"), r.slice(0, -11));
|
|
344
344
|
} catch {}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { r as NAME } from "./cli.mjs";
|
|
2
|
-
import { i as readDevInfo } from "./work-
|
|
2
|
+
import { i as readDevInfo } from "./work-ayuL_9Kk.mjs";
|
|
3
3
|
//#region src/cli/shot.ts
|
|
4
4
|
/**
|
|
5
5
|
* `marver shot <scene/frame> [...]`, `--scene <name>`, `--all` - render frames headless and
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { r as NAME } from "./cli.mjs";
|
|
2
|
-
import { i as readDevInfo, n as WORK_TTL_MAX, t as WORK_TTL_DEFAULT } from "./work-
|
|
2
|
+
import { i as readDevInfo, n as WORK_TTL_MAX, t as WORK_TTL_DEFAULT } from "./work-ayuL_9Kk.mjs";
|
|
3
3
|
//#region src/cli/work.ts
|
|
4
4
|
/**
|
|
5
5
|
* `marver work` - the coding agent's hand on the canvas working state.
|
|
@@ -66,7 +66,7 @@ async function workCommand(root, action, frames, opts) {
|
|
|
66
66
|
});
|
|
67
67
|
console.log(active.length ? `still working: ${active.join(", ")}` : "nothing working - all clear");
|
|
68
68
|
const done = before.filter((f) => !active.includes(f));
|
|
69
|
-
const link = done.length ? await (await import("./link-
|
|
69
|
+
const link = done.length ? await (await import("./link-vXjxMHTG.mjs")).linkLine(root, done) : null;
|
|
70
70
|
if (link) console.log(`on the canvas: ${link}`);
|
|
71
71
|
return;
|
|
72
72
|
}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { t as __exportAll } from "./rolldown-runtime-D7D4PA-g.mjs";
|
|
2
|
-
import { s as listBoardFiles } from "./boards-
|
|
2
|
+
import { s as listBoardFiles } from "./boards-BRLnoTC3.mjs";
|
|
3
3
|
import { mkdirSync, readFileSync, rmSync, writeFileSync } from "node:fs";
|
|
4
4
|
import { join } from "node:path";
|
|
5
5
|
import { randomBytes } from "node:crypto";
|
|
@@ -43,6 +43,31 @@ you can drop into the sub-folder, after it in its folder, or after the folder at
|
|
|
43
43
|
hold the pointer decides - over the row above, its indent picks the level; over the row below, the
|
|
44
44
|
seam takes that row's level.
|
|
45
45
|
|
|
46
|
+
## What is new, what needs you
|
|
47
|
+
|
|
48
|
+
The sidebar shows where to look.
|
|
49
|
+
|
|
50
|
+
- **New** - a frame that changed since you looked: its icon and title turn blue, with a dot at the
|
|
51
|
+
right of its row. On the canvas, its title above the card does the same.
|
|
52
|
+
- **Needs you** - Marver asked you something on a frame (a note from your agent, or a jam reply that
|
|
53
|
+
asks): its icon turns orange, and an orange bubble at the right holds how many questions are open -
|
|
54
|
+
`1`, `2`. Answer in the thread and the bubble goes hollow while the agent works; it is gone once
|
|
55
|
+
the thread is resolved, and the frame turns blue if the agent changed it.
|
|
56
|
+
- **One slot per row.** Every row keeps the one item at its right edge it has today, and what matters
|
|
57
|
+
most takes it: a question's bubble first, then the row's own count or status, then a frame's dot. A
|
|
58
|
+
board you are not on turns blue when its frames hold something new, and a question there takes its
|
|
59
|
+
status glyph's place until answered. A closed folder or a folded scene changes only its count: blue
|
|
60
|
+
when something inside is new, the bubble when something inside needs you.
|
|
61
|
+
- **`U`** goes to the next frame that needs you, then the next new one.
|
|
62
|
+
|
|
63
|
+
"Changed" means the frame's file or its sticky note changed - an edit, your agent, a `git pull` - or
|
|
64
|
+
an agent named the frame in `npx marver work done`. "Looked at" means you selected it, opened it from
|
|
65
|
+
the sidebar or a link, opened it in focus or play, kept it on screen at a readable zoom (50 % or more)
|
|
66
|
+
for two seconds, or chose **Mark all as seen** on a scene, board or folder. An edit still waiting to
|
|
67
|
+
load (behind **Update** in focus or play) counts as seen only once it is on screen. Your marks live in `design/.local/seen.json`, on
|
|
68
|
+
this machine only; the day you upgrade, everything already on the canvas counts as seen. A published
|
|
69
|
+
canvas shows no marks.
|
|
70
|
+
|
|
46
71
|
## In the files
|
|
47
72
|
|
|
48
73
|
Two files carry it, and they are the truth.
|
|
@@ -78,6 +103,10 @@ nests a sub-folder with `parent`:
|
|
|
78
103
|
with its rank, the landing board - and `--json` gives the same tree. The landing board is the first
|
|
79
104
|
board in that reading order, down through folders.
|
|
80
105
|
|
|
106
|
+
A board file that is not valid JSON says why, with the line and column: a red mark on its row in the
|
|
107
|
+
sidebar (hover it), the toast when you open it, the dev server's log, and an `(invalid JSON: …)` note
|
|
108
|
+
on its line in `npx marver boards` (`invalid` in `--json`).
|
|
109
|
+
|
|
81
110
|
### Sizes
|
|
82
111
|
|
|
83
112
|
A content frame - a `Doc` of markdown, diagrams and images - is as tall as its content, which only a
|
|
@@ -171,7 +200,8 @@ long as the work, so nobody sets it.
|
|
|
171
200
|
- `npx marver boards new <name> --folder features` - a board in its type's starting layout: a
|
|
172
201
|
feature's three phase scenes as three bands (spec, lo-fi, hi-fi), a start board rendering
|
|
173
202
|
`context/INDEX.md` and `context/shipped.md`, a deck on its title slide. `--type` overrides the
|
|
174
|
-
folder's; `--title`, `--description`, `--capability` fill the rest.
|
|
203
|
+
folder's; `--title`, `--description`, `--capability` fill the rest. A phase scene with its brief
|
|
204
|
+
and no frame yet waits quietly: its band takes no room until its first frame lands.
|
|
175
205
|
|
|
176
206
|
## Agents
|
|
177
207
|
|
package/docs/live-jam.md
CHANGED
|
@@ -158,7 +158,10 @@ Live Jam answers comments; the same voice works the other way. An agent you are
|
|
|
158
158
|
a note where it needs you - `npx marver comments new <scene/frame> --body "..." [--on "<words on
|
|
159
159
|
screen>"]` pins it on the frame, or on the element showing those words - and answers your threads
|
|
160
160
|
with `npx marver comments reply`. Both post as Marver, with the same provenance, land on your canvas
|
|
161
|
-
at once, and raise the bottom-right pill with a ping
|
|
161
|
+
at once, and raise the bottom-right pill with a ping - Marver's replies on one board fold into a
|
|
162
|
+
single notice ("2 replies", View walks through them), a new note or a reply that asks stands on its
|
|
163
|
+
own, and the frame wears the orange question
|
|
164
|
+
bubble in the sidebar until the thread is resolved. Reply in a note and it is a jam job like any
|
|
162
165
|
reply to Marver - no tag needed; while the chat agent still has that frame lit (`marver work
|
|
163
166
|
start`), the job waits for it. Notes stay on your machine for now, like jam replies; a reply to a
|
|
164
167
|
collaborator's thread keeps your voice, the one that reaches them on the published canvas.
|
package/docs/sticky-notes.md
CHANGED
|
@@ -17,7 +17,7 @@ One markdown file, nothing to declare:
|
|
|
17
17
|
|
|
18
18
|
Markdown with the Md block's rules: headings, lists, tables, emphasis, code; `[text](goto:scene/frame)`
|
|
19
19
|
links jump to a frame; `http(s)` links open a new tab; images come from `design/assets/`; raw HTML is
|
|
20
|
-
inert. A scene note is 380 wide, a frame note 260; when a frame has both, they stack in one column,
|
|
20
|
+
inert, shown as plain text, and HTML comments (`<!-- ... -->`) are not shown at all. A scene note is 380 wide, a frame note 260; when a frame has both, they stack in one column,
|
|
21
21
|
scene first. An edit lands on the canvas as you save, without reloading the frame.
|
|
22
22
|
|
|
23
23
|
The room is the layout's job. Every layout the shell composes (a board's `layout` recipe, the auto
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@marver-design/marver",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.24.0",
|
|
4
4
|
"description": "The agent-native design canvas. A design/ folder, one command, a canvas of live frames built from your repo's real components - comment @marver and your own coding agent does the work. The tool ships no AI.",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"private": false,
|
|
@@ -272,6 +272,10 @@ body { margin: 0; }
|
|
|
272
272
|
breathe ABOVE far more than below, so structure reads at a glance. Every
|
|
273
273
|
list-style is re-asserted: host Tailwind preflight strips markers. */
|
|
274
274
|
.mv-md { max-width: 72ch; min-width: 0; font-size: 16px; line-height: 1.65; }
|
|
275
|
+
/* #12: prose keeps its measure, but a table straight in a wide Doc grows past it as far as its
|
|
276
|
+
cells need, up to the Doc's own width (cqi) - never into a Row's neighbour */
|
|
277
|
+
.mv-doc-wide { container-type: inline-size; }
|
|
278
|
+
.mv-doc-wide > .mv-md table { width: max-content; min-width: 100%; max-width: 100cqi; }
|
|
275
279
|
.mv-md > :first-child { margin-top: 0; }
|
|
276
280
|
.mv-md > :last-child { margin-bottom: 0; }
|
|
277
281
|
.mv-md h1 { font-size: 30px; line-height: 1.16; letter-spacing: -0.021em; font-weight: 700; margin: 44px 0 14px; }
|
package/src/client/content/md.ts
CHANGED
|
@@ -39,8 +39,9 @@ export function assetUrl(src: string): string | null {
|
|
|
39
39
|
const marked = new Marked({
|
|
40
40
|
gfm: true,
|
|
41
41
|
renderer: {
|
|
42
|
-
// raw HTML (block or inline) renders as its literal text - inert by construction
|
|
43
|
-
|
|
42
|
+
// raw HTML (block or inline) renders as its literal text - inert by construction. Comments
|
|
43
|
+
// are the exception: markdown readers never show them, an unclosed one runs to the end (#15)
|
|
44
|
+
html(token: any) { return escapeHtml(String(token.text ?? '').replace(/<!--(?:-?>|[\s\S]*?(?:-->|$))/g, '')) },
|
|
44
45
|
// marked leaves the text INSIDE a raw block (<script>, <style>, <pre>, <textarea>) unescaped
|
|
45
46
|
// (`token.escaped`); here every text token is escaped - there is no raw block to serve
|
|
46
47
|
text(token: any) {
|