@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.
- package/CHANGELOG.md +70 -0
- package/README.md +12 -8
- package/dist/{anchor-check-Bv4o-R2T.mjs → anchor-check-DZtX13ly.mjs} +1 -1
- package/dist/{board-tree-BXR8dw4b.mjs → board-tree-DGj0HhEE.mjs} +6 -2
- package/dist/{boards-EH2onUXM.mjs → boards-Cim1GTKc.mjs} +32 -2
- package/dist/{boards-BeWtjGUM.mjs → boards-jHmEPLV7.mjs} +7 -7
- package/dist/{build-zWGXSzly.mjs → build-D2dHEWX-.mjs} +14 -17
- package/dist/{capture-DEtM4qm5.mjs → capture-HaS-1or8.mjs} +1 -1
- package/dist/cli.mjs +38 -20
- package/dist/{collab-BEAcXrBb.mjs → collab-D2NcrOB8.mjs} +53 -14
- package/dist/comment-actions-Bxf9Ld4g.mjs +351 -0
- package/dist/{comments-XNhMmSSu.mjs → comments-ocvsnt2j.mjs} +85 -10
- package/dist/config-B0YcFtqS.mjs +510 -0
- package/dist/{context-BUnFiyA3.mjs → context-Cj2TcC0H.mjs} +3 -3
- package/dist/{daemon-CChgWJNq.mjs → daemon-D6TrdgMi.mjs} +268 -28
- package/dist/deep-link-DYtuT740.mjs +163 -0
- package/dist/{dev-DOgIITpT.mjs → dev-DMQYbw-2.mjs} +23 -16
- package/dist/devices-uJZ2inMq.mjs +155 -0
- package/dist/{events-CLH4ijKP.mjs → events-Dieo1482.mjs} +49 -4
- package/dist/{init-CYlFaRzG.mjs → init-BgusplYn.mjs} +40 -10
- package/dist/{jam-Cj5gBvwD.mjs → jam-CkuLL8A8.mjs} +1 -1
- package/dist/{link-BFFRgrMt.mjs → link-aZq5cExV.mjs} +54 -7
- package/dist/{logo-CXY-1yrn.mjs → logo-C9s7-Cy9.mjs} +89 -66
- package/dist/{ls-NqmePKOf.mjs → ls-DGVIW-Io.mjs} +1 -1
- package/dist/{manifest-DPZ3WNg_.mjs → manifest-CK8Qh4Nq.mjs} +255 -13
- package/dist/{marks-BnNANic9.mjs → marks-C8oX8kbE.mjs} +3 -3
- package/dist/{marks-DBp3h1Mc.mjs → marks-Dt-5JXCp.mjs} +18 -5
- package/dist/{marver-id-gate-vBLb_Icb.mjs → marver-id-gate-BAeuMeaU.mjs} +11 -7
- package/dist/md-B9_13Q0R.mjs +105 -0
- package/dist/notes-CRAX4wgk.mjs +148 -0
- package/dist/own-C8Mq0Hnf.mjs +128 -0
- package/dist/pdf-Cf9GIoIM.mjs +2299 -0
- package/dist/pdf-HB0prF75.mjs +117 -0
- package/dist/{perf-6MOTHxay.mjs → perf-9ZEF5KLO.mjs} +5 -5
- package/dist/{perf-BCxAo0IS.mjs → perf-BA_NDarr.mjs} +2 -1
- package/dist/{plugin-CFWBcAba.mjs → plugin-DesQP9L5.mjs} +565 -107
- package/dist/{poster-DPPpQiva.mjs → poster-Bb6WraCA.mjs} +1 -1
- package/dist/{profile-B1FKOM1e.mjs → profile-cdmSer1k.mjs} +1 -1
- package/dist/{publish-bakes-_Zx8crP3.mjs → publish-bakes-EjMmukJB.mjs} +3 -3
- package/dist/{queue-DeSQm24g.mjs → queue-BLLfdlDw.mjs} +156 -11
- package/dist/{recover-mDUVsnPd.mjs → recover-B3dmatx4.mjs} +2 -2
- package/dist/{serve-DQv3Ti6X.mjs → serve-kcF6-H8V.mjs} +4 -4
- package/dist/{session-VDJfXEEm.mjs → session-DBF-nQvq.mjs} +29 -3
- package/dist/{share-Bu_kuOKL.mjs → share-CS2mg27O.mjs} +1 -1
- package/dist/{shot-d4h_hJi9.mjs → shot-Bjt2MQe3.mjs} +4 -4
- package/dist/{shot-DBWN8hPP.mjs → shot-BuUCG46-.mjs} +1 -1
- package/dist/show-DhmiUu01.mjs +101 -0
- package/dist/{sizes-wjXDev3b.mjs → sizes-BckcL4Zz.mjs} +1 -1
- package/dist/{slots-Dn4Onb0V.mjs → slots-BOcfIqxy.mjs} +15 -3
- package/dist/{summary-Y8MY1Wuc.mjs → summary-cPmRDGpX.mjs} +1 -1
- package/dist/{sync-CMozOwZ0.mjs → sync-BNWwh8OF.mjs} +205 -7
- package/dist/{work-DJxH7cCX.mjs → work-B4tydWnf.mjs} +38 -2
- package/dist/{work-BYWD_1Zf.mjs → work-CzIXp7n1.mjs} +3 -3
- package/docs/app.md +143 -6
- package/docs/boards-and-folders.md +41 -7
- package/docs/jam-session.md +5 -0
- package/docs/live-jam.md +9 -0
- package/docs/pdf.md +108 -0
- package/docs/publish.md +9 -9
- package/docs/sharing.md +11 -0
- package/docs/slides.md +11 -1
- package/package.json +3 -1
- package/src/client/content/index.tsx +4 -2
- package/src/client/frame-host/main.tsx +3 -0
- package/src/client/shell/App.tsx +71 -24
- package/src/client/shell/BoardList.tsx +16 -7
- package/src/client/shell/Comments.tsx +77 -16
- package/src/client/shell/Play.tsx +104 -27
- package/src/client/shell/Toolbar.tsx +4 -3
- package/src/client/shell/app-bridge.ts +40 -5
- package/src/client/shell/canvas/Canvas.tsx +30 -8
- package/src/client/shell/canvas/FrameNode.tsx +3 -1
- package/src/client/shell/canvas/ctl.ts +16 -0
- package/src/client/shell/commands.ts +20 -0
- package/src/client/shell/comments-store.ts +81 -2
- package/src/client/shell/devices.tsx +42 -0
- package/src/client/shell/goto.ts +56 -9
- package/src/client/shell/icons.tsx +11 -4
- package/src/client/shell/immersive.ts +123 -0
- package/src/client/shell/inset.ts +29 -3
- package/src/client/shell/jam-lines.ts +5 -3
- package/src/client/shell/jam-panel.tsx +17 -5
- package/src/client/shell/marks-ui.tsx +54 -0
- package/src/client/shell/notes.ts +21 -0
- package/src/client/shell/pdf-export.tsx +154 -0
- package/src/client/shell/pdf-notes.ts +20 -0
- package/src/client/shell/recorder-signals.ts +5 -2
- package/src/client/shell/show.ts +250 -0
- package/src/client/shell/store.ts +23 -38
- package/src/client/shell/styles.css +68 -6
- package/src/shared/app-api.ts +90 -4
- package/src/shared/auto-place.ts +32 -0
- package/src/shared/board-tree.ts +3 -0
- package/src/shared/board-types.ts +6 -2
- package/src/shared/deep-link.ts +212 -0
- package/src/shared/devices.ts +89 -0
- package/src/shared/events.ts +48 -5
- package/src/shared/export-plan.ts +98 -0
- package/src/shared/immersive.ts +13 -0
- package/src/shared/perf-records.ts +1 -1
- package/templates/AGENTS-embedded.md +76 -12
- package/templates/AGENTS-studio.md +76 -12
- package/templates/instructions/boards.md +6 -5
- package/templates/instructions/configure.md +32 -2
- package/templates/instructions/iterate.md +8 -0
- package/templates/instructions/jam.md +9 -0
- package/templates/instructions/publish.md +14 -4
- package/templates/instructions/review.md +4 -0
- package/templates/instructions/slides.md +67 -1
- package/templates/instructions/welcome.md +9 -5
- package/templates/playbooks/publish-canvas/PLAYBOOK.md +1 -1
- package/dist/config-BezZTiov.mjs +0 -182
|
@@ -0,0 +1,510 @@
|
|
|
1
|
+
import { t as __exportAll } from "./rolldown-runtime-8H4AJuhK.mjs";
|
|
2
|
+
import { h as readDescription } from "./board-tree-DGj0HhEE.mjs";
|
|
3
|
+
import { i as onPath, n as AGENT_NAMES, r as detectAgent, t as AGENT_BIN } from "./agent-BsieQGTD.mjs";
|
|
4
|
+
import { n as lookFromName, r as parseGlyph } from "./devices-uJZ2inMq.mjs";
|
|
5
|
+
import { o as readInside } from "./logo-C9s7-Cy9.mjs";
|
|
6
|
+
import { existsSync, realpathSync } from "node:fs";
|
|
7
|
+
import { isAbsolute, join, resolve } from "node:path";
|
|
8
|
+
import { pathToFileURL } from "node:url";
|
|
9
|
+
//#region src/server/device-icons.ts
|
|
10
|
+
/**
|
|
11
|
+
* Your own breakpoints' icons and labels (spec 31 F.1, F.2): `viewports.<name>.icon` and `.label` in design/config.ts,
|
|
12
|
+
* resolved once when the config loads into the look the shell draws (`DeviceLook`, src/shared/devices.ts).
|
|
13
|
+
*
|
|
14
|
+
* An `icon` is a built-in glyph (`tablet`, `tablet-landscape`, ...) or a repo-relative `.svg` path. The SVG is read
|
|
15
|
+
* inside the repo only - the logo's file checks (logo.ts `readInside`: a regular file, never a symlink, its real path
|
|
16
|
+
* inside the repo's, read as checked) at 32 KB at most - then REBUILT from a strict allowlist: the elements svg, g,
|
|
17
|
+
* path, circle, ellipse, rect, line, polyline, polygon; geometry and paint attributes only, each value in a plain
|
|
18
|
+
* charset (no `url(`, no `;`, no `:`, no quotes) - so no `style`, `class`, `id`, `href`, event handler, `foreignObject`,
|
|
19
|
+
* `<script>`, `<use>`, `<image>`, entity or external URL survives. Anything else is dropped with its subtree; a DOCTYPE,
|
|
20
|
+
* a malformed document or one that draws nothing is refused. What is left ships as a base64 `data:` URI the shell
|
|
21
|
+
* draws as a CSS `mask-image` in the toolbar's ink: an image, never DOM - nothing in it can run or restyle the page.
|
|
22
|
+
* A bad icon falls back to the name's glyph with one warning saying why.
|
|
23
|
+
*/
|
|
24
|
+
/** The largest icon file read. */
|
|
25
|
+
const DEVICE_ICON_MAX = 32768;
|
|
26
|
+
const ELEMENTS = /* @__PURE__ */ new Set([
|
|
27
|
+
"svg",
|
|
28
|
+
"g",
|
|
29
|
+
"path",
|
|
30
|
+
"circle",
|
|
31
|
+
"ellipse",
|
|
32
|
+
"rect",
|
|
33
|
+
"line",
|
|
34
|
+
"polyline",
|
|
35
|
+
"polygon"
|
|
36
|
+
]);
|
|
37
|
+
const DRAWN = /* @__PURE__ */ new Set([
|
|
38
|
+
"path",
|
|
39
|
+
"circle",
|
|
40
|
+
"ellipse",
|
|
41
|
+
"rect",
|
|
42
|
+
"line",
|
|
43
|
+
"polyline",
|
|
44
|
+
"polygon"
|
|
45
|
+
]);
|
|
46
|
+
/** paint and presentation, on any element */
|
|
47
|
+
const PAINT = [
|
|
48
|
+
"fill",
|
|
49
|
+
"fill-opacity",
|
|
50
|
+
"fill-rule",
|
|
51
|
+
"clip-rule",
|
|
52
|
+
"stroke",
|
|
53
|
+
"stroke-width",
|
|
54
|
+
"stroke-opacity",
|
|
55
|
+
"stroke-linecap",
|
|
56
|
+
"stroke-linejoin",
|
|
57
|
+
"stroke-miterlimit",
|
|
58
|
+
"stroke-dasharray",
|
|
59
|
+
"stroke-dashoffset",
|
|
60
|
+
"opacity",
|
|
61
|
+
"transform",
|
|
62
|
+
"vector-effect",
|
|
63
|
+
"paint-order",
|
|
64
|
+
"shape-rendering"
|
|
65
|
+
];
|
|
66
|
+
const ALLOWED = Object.fromEntries(Object.entries({
|
|
67
|
+
svg: [
|
|
68
|
+
"viewBox",
|
|
69
|
+
"width",
|
|
70
|
+
"height",
|
|
71
|
+
"preserveAspectRatio"
|
|
72
|
+
],
|
|
73
|
+
g: [],
|
|
74
|
+
path: ["d", "pathLength"],
|
|
75
|
+
circle: [
|
|
76
|
+
"cx",
|
|
77
|
+
"cy",
|
|
78
|
+
"r",
|
|
79
|
+
"pathLength"
|
|
80
|
+
],
|
|
81
|
+
ellipse: [
|
|
82
|
+
"cx",
|
|
83
|
+
"cy",
|
|
84
|
+
"rx",
|
|
85
|
+
"ry",
|
|
86
|
+
"pathLength"
|
|
87
|
+
],
|
|
88
|
+
rect: [
|
|
89
|
+
"x",
|
|
90
|
+
"y",
|
|
91
|
+
"width",
|
|
92
|
+
"height",
|
|
93
|
+
"rx",
|
|
94
|
+
"ry",
|
|
95
|
+
"pathLength"
|
|
96
|
+
],
|
|
97
|
+
line: [
|
|
98
|
+
"x1",
|
|
99
|
+
"y1",
|
|
100
|
+
"x2",
|
|
101
|
+
"y2",
|
|
102
|
+
"pathLength"
|
|
103
|
+
],
|
|
104
|
+
polyline: ["points", "pathLength"],
|
|
105
|
+
polygon: ["points", "pathLength"]
|
|
106
|
+
}).map(([el, a]) => [el, /* @__PURE__ */ new Set([...a, ...PAINT])]));
|
|
107
|
+
/** A value's charset: numbers, words, separators, `#` colours, `%` - no `:` (schemes), `;`, quotes, `<`, `&`, `/`,
|
|
108
|
+
* backslashes. Parentheses only for the functions a transform or a colour is written with. */
|
|
109
|
+
const PLAIN = /^[-+.,%#\s0-9A-Za-z()]*$/;
|
|
110
|
+
const FUNCS = {
|
|
111
|
+
transform: /^(matrix|translate|scale|rotate|skewx|skewy)$/i,
|
|
112
|
+
fill: /^(rgb|rgba|hsl|hsla)$/i,
|
|
113
|
+
stroke: /^(rgb|rgba|hsl|hsla)$/i
|
|
114
|
+
};
|
|
115
|
+
const VALUE_MAX = 24e3;
|
|
116
|
+
function valueOk(attr, v) {
|
|
117
|
+
if (v.length > VALUE_MAX || !PLAIN.test(v)) return false;
|
|
118
|
+
if (!v.includes("(") && !v.includes(")")) return true;
|
|
119
|
+
const ok = FUNCS[attr];
|
|
120
|
+
if (!ok) return false;
|
|
121
|
+
for (const m of v.matchAll(/([A-Za-z]*)\s*\(/g)) if (!ok.test(m[1])) return false;
|
|
122
|
+
return !/\([^)]*\(/.test(v);
|
|
123
|
+
}
|
|
124
|
+
const ENTITY = {
|
|
125
|
+
amp: "&",
|
|
126
|
+
lt: "<",
|
|
127
|
+
gt: ">",
|
|
128
|
+
quot: "\"",
|
|
129
|
+
apos: "'"
|
|
130
|
+
};
|
|
131
|
+
/** XML's five entities and character references; null for anything else (a DTD's entity, which is refused). */
|
|
132
|
+
function unescapeXml(s) {
|
|
133
|
+
let bad = false;
|
|
134
|
+
const out = s.replace(/&(#x[0-9a-fA-F]+|#[0-9]+|[A-Za-z]+);?/g, (_m, e) => {
|
|
135
|
+
if (e[0] === "#") {
|
|
136
|
+
const n = e[1] === "x" ? parseInt(e.slice(2), 16) : parseInt(e.slice(1), 10);
|
|
137
|
+
if (!Number.isFinite(n) || n > 1114111) {
|
|
138
|
+
bad = true;
|
|
139
|
+
return "";
|
|
140
|
+
}
|
|
141
|
+
return String.fromCodePoint(n);
|
|
142
|
+
}
|
|
143
|
+
if (e in ENTITY) return ENTITY[e];
|
|
144
|
+
bad = true;
|
|
145
|
+
return "";
|
|
146
|
+
});
|
|
147
|
+
return bad ? null : out;
|
|
148
|
+
}
|
|
149
|
+
const NAME = /^[A-Za-z_][-A-Za-z0-9_.:]*/;
|
|
150
|
+
/** A sanitized SVG's text, or why it is refused. Pure: no file, no DOM. */
|
|
151
|
+
function sanitizeSvg(src) {
|
|
152
|
+
const text = src.replace(/^/, "");
|
|
153
|
+
if (/<!DOCTYPE|<!ENTITY/i.test(text)) return { error: "it declares a DOCTYPE or entities" };
|
|
154
|
+
let i = 0;
|
|
155
|
+
const out = [];
|
|
156
|
+
/** open elements: their name and whether they are kept (a dropped one drops its whole subtree) */
|
|
157
|
+
const stack = [];
|
|
158
|
+
let rootSeen = false, rootClosed = false, drawn = 0;
|
|
159
|
+
while (i < text.length) {
|
|
160
|
+
const lt = text.indexOf("<", i);
|
|
161
|
+
if (lt < 0) break;
|
|
162
|
+
i = lt;
|
|
163
|
+
if (text.startsWith("<?", i)) {
|
|
164
|
+
const e = text.indexOf("?>", i + 2);
|
|
165
|
+
if (e < 0) return { error: "it is not well-formed" };
|
|
166
|
+
i = e + 2;
|
|
167
|
+
continue;
|
|
168
|
+
}
|
|
169
|
+
if (text.startsWith("<!--", i)) {
|
|
170
|
+
const e = text.indexOf("-->", i + 4);
|
|
171
|
+
if (e < 0) return { error: "it is not well-formed" };
|
|
172
|
+
i = e + 3;
|
|
173
|
+
continue;
|
|
174
|
+
}
|
|
175
|
+
if (text.startsWith("<![CDATA[", i)) {
|
|
176
|
+
const e = text.indexOf("]]>", i + 9);
|
|
177
|
+
if (e < 0) return { error: "it is not well-formed" };
|
|
178
|
+
i = e + 3;
|
|
179
|
+
continue;
|
|
180
|
+
}
|
|
181
|
+
if (text.startsWith("<!", i)) return { error: "it declares a DOCTYPE or entities" };
|
|
182
|
+
if (text.startsWith("</", i)) {
|
|
183
|
+
const m = NAME.exec(text.slice(i + 2));
|
|
184
|
+
const e = text.indexOf(">", i + 2);
|
|
185
|
+
if (!m || e < 0) return { error: "it is not well-formed" };
|
|
186
|
+
const top = stack.pop();
|
|
187
|
+
if (!top || top.name !== m[0] || text.slice(i + 2 + m[0].length, e).trim()) return { error: "it is not well-formed" };
|
|
188
|
+
if (top.kept) out.push(`</${top.name}>`);
|
|
189
|
+
if (!stack.length) rootClosed = true;
|
|
190
|
+
i = e + 1;
|
|
191
|
+
continue;
|
|
192
|
+
}
|
|
193
|
+
const m = NAME.exec(text.slice(i + 1));
|
|
194
|
+
if (!m) return { error: "it is not well-formed" };
|
|
195
|
+
if (rootClosed) return { error: "it has more than one root" };
|
|
196
|
+
const name = m[0];
|
|
197
|
+
let k = i + 1 + name.length;
|
|
198
|
+
const attrs = [];
|
|
199
|
+
let selfClose = false;
|
|
200
|
+
for (;;) {
|
|
201
|
+
const ws = /^\s*/.exec(text.slice(k))[0].length;
|
|
202
|
+
k += ws;
|
|
203
|
+
if (text.startsWith("/>", k)) {
|
|
204
|
+
selfClose = true;
|
|
205
|
+
k += 2;
|
|
206
|
+
break;
|
|
207
|
+
}
|
|
208
|
+
if (text[k] === ">") {
|
|
209
|
+
k += 1;
|
|
210
|
+
break;
|
|
211
|
+
}
|
|
212
|
+
if (!ws) return { error: "it is not well-formed" };
|
|
213
|
+
const an = NAME.exec(text.slice(k));
|
|
214
|
+
if (!an) return { error: "it is not well-formed" };
|
|
215
|
+
k += an[0].length;
|
|
216
|
+
const eq = /^\s*=\s*/.exec(text.slice(k));
|
|
217
|
+
if (!eq) return { error: "it is not well-formed" };
|
|
218
|
+
k += eq[0].length;
|
|
219
|
+
const q = text[k];
|
|
220
|
+
if (q !== "\"" && q !== "'") return { error: "it is not well-formed" };
|
|
221
|
+
const end = text.indexOf(q, k + 1);
|
|
222
|
+
if (end < 0) return { error: "it is not well-formed" };
|
|
223
|
+
const raw = text.slice(k + 1, end);
|
|
224
|
+
if (raw.includes("<")) return { error: "it is not well-formed" };
|
|
225
|
+
attrs.push([an[0], raw]);
|
|
226
|
+
k = end + 1;
|
|
227
|
+
}
|
|
228
|
+
if (!stack.length && rootSeen) return { error: "it has more than one root" };
|
|
229
|
+
if (!stack.length) {
|
|
230
|
+
if (name !== "svg") return { error: "its root is not <svg>" };
|
|
231
|
+
rootSeen = true;
|
|
232
|
+
}
|
|
233
|
+
const kept = (stack.length ? stack[stack.length - 1].kept : true) && ELEMENTS.has(name) && (name !== "svg" || !stack.length);
|
|
234
|
+
if (kept) {
|
|
235
|
+
const allowed = ALLOWED[name];
|
|
236
|
+
const keep = [];
|
|
237
|
+
const seen = /* @__PURE__ */ new Set();
|
|
238
|
+
for (const [an, raw] of attrs) {
|
|
239
|
+
if (!allowed.has(an) || seen.has(an)) continue;
|
|
240
|
+
seen.add(an);
|
|
241
|
+
const v = unescapeXml(raw);
|
|
242
|
+
if (v === null || !valueOk(an, v.trim())) continue;
|
|
243
|
+
keep.push(` ${an}="${v.trim()}"`);
|
|
244
|
+
}
|
|
245
|
+
if (name === "svg") {
|
|
246
|
+
const vb = attrs.find(([a]) => a === "viewBox");
|
|
247
|
+
const w = Number(attrs.find(([a]) => a === "width")?.[1]), h = Number(attrs.find(([a]) => a === "height")?.[1]);
|
|
248
|
+
out.push(`<svg xmlns="http://www.w3.org/2000/svg"${!vb && w > 0 && h > 0 ? ` viewBox="0 0 ${w} ${h}"` : ""}${keep.join("")}${selfClose ? "/>" : ">"}`);
|
|
249
|
+
} else out.push(`<${name}${keep.join("")}${selfClose ? "/>" : ">"}`);
|
|
250
|
+
if (DRAWN.has(name)) drawn++;
|
|
251
|
+
}
|
|
252
|
+
if (selfClose) {
|
|
253
|
+
if (!stack.length) rootClosed = true;
|
|
254
|
+
} else stack.push({
|
|
255
|
+
name,
|
|
256
|
+
kept
|
|
257
|
+
});
|
|
258
|
+
i = k;
|
|
259
|
+
}
|
|
260
|
+
if (!rootSeen) return { error: "it has no <svg>" };
|
|
261
|
+
if (stack.length || !rootClosed) return { error: "it is not well-formed" };
|
|
262
|
+
if (!drawn) return { error: "it draws nothing (paths and shapes only)" };
|
|
263
|
+
return { svg: out.join("") };
|
|
264
|
+
}
|
|
265
|
+
/** The sanitized SVG as the data URI the shell masks with - base64, so nothing in it can close a CSS `url()`. */
|
|
266
|
+
const svgDataUri = (svg) => `data:image/svg+xml;base64,${Buffer.from(svg, "utf8").toString("base64")}`;
|
|
267
|
+
/** A repo-relative `.svg` icon, read and sanitized: its data URI, or why not. */
|
|
268
|
+
function readDeviceIcon(root, rel) {
|
|
269
|
+
if (isAbsolute(rel)) return { error: "it is not a repo-relative path" };
|
|
270
|
+
let realRoot;
|
|
271
|
+
try {
|
|
272
|
+
realRoot = realpathSync(root);
|
|
273
|
+
} catch {
|
|
274
|
+
return { error: "the repo is unreadable" };
|
|
275
|
+
}
|
|
276
|
+
const r = readInside(realRoot, resolve(realRoot, rel), DEVICE_ICON_MAX, /\.svg$/i, "not an .svg", "over 32 KB");
|
|
277
|
+
if (typeof r === "string") return { error: r };
|
|
278
|
+
let text;
|
|
279
|
+
try {
|
|
280
|
+
text = new TextDecoder("utf-8", { fatal: true }).decode(r);
|
|
281
|
+
} catch {
|
|
282
|
+
return { error: "not UTF-8 text" };
|
|
283
|
+
}
|
|
284
|
+
const s = sanitizeSvg(text);
|
|
285
|
+
return "error" in s ? s : { mask: svgDataUri(s.svg) };
|
|
286
|
+
}
|
|
287
|
+
/** Each device's look: its `label` (40 characters at most) and `icon`, else what its name suggests. `warn` hears
|
|
288
|
+
* each value that could not be used - the device then wears its name's glyph or label. */
|
|
289
|
+
function resolveDevices(root, raw, names, warn = () => {}) {
|
|
290
|
+
const out = {};
|
|
291
|
+
const src = raw && typeof raw === "object" ? raw : {};
|
|
292
|
+
for (const name of names) {
|
|
293
|
+
const look = lookFromName(name);
|
|
294
|
+
const vp = src[name] && typeof src[name] === "object" ? src[name] : {};
|
|
295
|
+
if (vp.label !== void 0) {
|
|
296
|
+
const l = typeof vp.label === "string" ? vp.label.trim() : "";
|
|
297
|
+
if (l && l.length <= 40) look.label = l;
|
|
298
|
+
else warn(`design/config.ts: viewports.${name}.label must be text of 1 to 40 characters - showing "${look.label}"`);
|
|
299
|
+
}
|
|
300
|
+
if (vp.icon !== void 0) {
|
|
301
|
+
const g = typeof vp.icon === "string" ? parseGlyph(vp.icon) : null;
|
|
302
|
+
if (g) {
|
|
303
|
+
look.glyph = g.glyph;
|
|
304
|
+
look.rotate = g.rotate;
|
|
305
|
+
} else if (typeof vp.icon === "string" && /\.svg$/i.test(vp.icon)) {
|
|
306
|
+
const r = readDeviceIcon(root, vp.icon);
|
|
307
|
+
if ("mask" in r) {
|
|
308
|
+
look.mask = r.mask;
|
|
309
|
+
look.rotate = false;
|
|
310
|
+
} else warn(`design/config.ts: viewports.${name}.icon ${vp.icon} is ignored: ${r.error} - showing the ${look.glyph ?? "devices"} glyph`);
|
|
311
|
+
} else warn(`design/config.ts: viewports.${name}.icon must be a built-in glyph (mobile, tablet, laptop, monitor, tv, watch, desktop, ereader; -landscape turns it) or a repo-relative .svg - showing the ${look.glyph ?? "devices"} glyph`);
|
|
312
|
+
}
|
|
313
|
+
out[name] = look;
|
|
314
|
+
}
|
|
315
|
+
return out;
|
|
316
|
+
}
|
|
317
|
+
//#endregion
|
|
318
|
+
//#region src/server/config.ts
|
|
319
|
+
var config_exports = /* @__PURE__ */ __exportAll({
|
|
320
|
+
DEFAULTS: () => DEFAULTS,
|
|
321
|
+
loadConfig: () => loadConfig
|
|
322
|
+
});
|
|
323
|
+
const DEFAULTS = {
|
|
324
|
+
mode: "studio",
|
|
325
|
+
theme: null,
|
|
326
|
+
viewports: {
|
|
327
|
+
mobile: {
|
|
328
|
+
width: 390,
|
|
329
|
+
height: 844
|
|
330
|
+
},
|
|
331
|
+
tablet: {
|
|
332
|
+
width: 768,
|
|
333
|
+
height: 1024
|
|
334
|
+
},
|
|
335
|
+
laptop: {
|
|
336
|
+
width: 1280,
|
|
337
|
+
height: 800
|
|
338
|
+
},
|
|
339
|
+
monitor: {
|
|
340
|
+
width: 1920,
|
|
341
|
+
height: 1080
|
|
342
|
+
}
|
|
343
|
+
},
|
|
344
|
+
devices: Object.fromEntries([
|
|
345
|
+
"mobile",
|
|
346
|
+
"tablet",
|
|
347
|
+
"laptop",
|
|
348
|
+
"monitor"
|
|
349
|
+
].map((n) => [n, lookFromName(n)])),
|
|
350
|
+
themes: ["light", "dark"],
|
|
351
|
+
port: 5199,
|
|
352
|
+
zoomSpeed: 1,
|
|
353
|
+
share: { branding: true }
|
|
354
|
+
};
|
|
355
|
+
/** Load design/config.ts via native TS import (Node >= 22.18). Missing or broken fields fall back to defaults. */
|
|
356
|
+
async function loadConfig(root) {
|
|
357
|
+
const file = join(root, "design", "config.ts");
|
|
358
|
+
if (!existsSync(file)) return {
|
|
359
|
+
...DEFAULTS,
|
|
360
|
+
...jamFields(void 0)
|
|
361
|
+
};
|
|
362
|
+
try {
|
|
363
|
+
const user = (await import(`${pathToFileURL(file).href}?t=${Date.now()}`)).default ?? {};
|
|
364
|
+
const viewports = validViewports(user.viewports) ?? DEFAULTS.viewports;
|
|
365
|
+
return {
|
|
366
|
+
...DEFAULTS,
|
|
367
|
+
...user,
|
|
368
|
+
name: text(user.name, "name", 80),
|
|
369
|
+
logo: text(user.logo, "logo", 1024),
|
|
370
|
+
viewports,
|
|
371
|
+
devices: viewports === DEFAULTS.viewports ? DEFAULTS.devices : resolveDevices(root, user.viewports, Object.keys(viewports), (m) => console.warn(`[marver] ${m}`)),
|
|
372
|
+
themes: Array.isArray(user.themes) && user.themes.length ? user.themes.map(String) : DEFAULTS.themes,
|
|
373
|
+
port: validPort(user.port) ?? DEFAULTS.port,
|
|
374
|
+
zoomSpeed: validZoom(user.zoomSpeed) ?? DEFAULTS.zoomSpeed,
|
|
375
|
+
description: readDescription(user.description),
|
|
376
|
+
share: {
|
|
377
|
+
branding: user.share?.branding !== false,
|
|
378
|
+
name: typeof user.share?.name === "string" ? user.share.name : void 0,
|
|
379
|
+
logo: typeof user.share?.logo === "string" ? user.share.logo : void 0,
|
|
380
|
+
frontDoor: user.share?.frontDoor !== false && user.share?.front_door !== false,
|
|
381
|
+
notify: user.share?.notify !== false
|
|
382
|
+
},
|
|
383
|
+
...jamFields(user.jam)
|
|
384
|
+
};
|
|
385
|
+
} catch (err) {
|
|
386
|
+
console.error(`[marver] design/config.ts failed to load, using defaults and leaving Live Jam OFF:\n ${err.message}`);
|
|
387
|
+
return {
|
|
388
|
+
...DEFAULTS,
|
|
389
|
+
jamOff: "unreadable"
|
|
390
|
+
};
|
|
391
|
+
}
|
|
392
|
+
}
|
|
393
|
+
/** A config string: trimmed, present only when it says something; a non-string or an overlong one says so once. */
|
|
394
|
+
function text(v, key, max) {
|
|
395
|
+
if (v === void 0) return void 0;
|
|
396
|
+
const t = typeof v === "string" ? v.trim() : "";
|
|
397
|
+
if (t && t.length <= max) return t;
|
|
398
|
+
if (typeof v !== "string" || t) console.warn(`[marver] design/config.ts: ${key} must be text of at most ${max} characters - got ${show(v)}. Ignored.`);
|
|
399
|
+
}
|
|
400
|
+
const validDim = (n) => typeof n === "number" && Number.isFinite(n) && n >= 1 && n <= 2e4;
|
|
401
|
+
function validPort(n) {
|
|
402
|
+
return typeof n === "number" && Number.isInteger(n) && n > 0 && n < 65536 ? n : null;
|
|
403
|
+
}
|
|
404
|
+
function validZoom(n) {
|
|
405
|
+
return typeof n === "number" && Number.isFinite(n) && n >= .1 && n <= 10 ? n : null;
|
|
406
|
+
}
|
|
407
|
+
/** Six frames at once is what a jam actually feels like - at 3, half of a multi-frame
|
|
408
|
+
* ask sat waiting on the other half while the human watched. */
|
|
409
|
+
const DEFAULT_CONCURRENCY = 6;
|
|
410
|
+
/** A config value, printable in a warning. Never throws - a formatter that can crash inside an
|
|
411
|
+
* error path (JSON.stringify does, on a BigInt) turns a clear message into a mystery. */
|
|
412
|
+
const show = (v) => {
|
|
413
|
+
try {
|
|
414
|
+
return JSON.stringify(v) ?? String(v);
|
|
415
|
+
} catch {
|
|
416
|
+
return String(v);
|
|
417
|
+
}
|
|
418
|
+
};
|
|
419
|
+
/** A `{...}` written by hand, not a Date/Map/class instance that merely types as "object". */
|
|
420
|
+
const plainObject = (v) => {
|
|
421
|
+
if (!v || typeof v !== "object") return false;
|
|
422
|
+
const proto = Object.getPrototypeOf(v);
|
|
423
|
+
return proto === Object.prototype || proto === null;
|
|
424
|
+
};
|
|
425
|
+
/** The agent to arm with - or, when the human NAMED one we cannot use, why not (said once,
|
|
426
|
+
* here, because a bad `jam.agent` is a config-file error like any other).
|
|
427
|
+
*
|
|
428
|
+
* A named agent is never quietly swapped for another: running a different tool than the one
|
|
429
|
+
* asked for is worse than not running. Nor is one armed that cannot be spawned - that would
|
|
430
|
+
* claim every @marver mention, fail it, and never retry. */
|
|
431
|
+
function resolveAgent(named) {
|
|
432
|
+
if (named === void 0) return detectAgent() ?? "no-agent";
|
|
433
|
+
if (typeof named !== "string" || !Object.hasOwn(AGENT_BIN, named)) {
|
|
434
|
+
console.warn(`[marver] design/config.ts: jam.agent ${show(named)} is not an agent marver can spawn - Live Jam is off. Use ${AGENT_NAMES}.`);
|
|
435
|
+
return "bad-agent";
|
|
436
|
+
}
|
|
437
|
+
const agent = named;
|
|
438
|
+
if (!onPath(AGENT_BIN[agent])) {
|
|
439
|
+
console.warn(`[marver] design/config.ts names jam.agent "${agent}", but \`${AGENT_BIN[agent]}\` is not on PATH - Live Jam is off until it is installed.`);
|
|
440
|
+
return "bad-agent";
|
|
441
|
+
}
|
|
442
|
+
return agent;
|
|
443
|
+
}
|
|
444
|
+
/** Resolve the jam block. Live Jam is ON by default: an absent or partial `jam` resolves
|
|
445
|
+
* to whatever agent CLI this machine has, so a fresh workspace jams with nothing
|
|
446
|
+
* configured and an old one needs no re-init. `jam: false` is the off switch. */
|
|
447
|
+
function resolveJam(v) {
|
|
448
|
+
if (v === false) return "opted-out";
|
|
449
|
+
const shape = v === void 0 || v === true ? {} : typeof v === "string" ? { agent: v } : plainObject(v) ? v : null;
|
|
450
|
+
if (!shape) {
|
|
451
|
+
console.warn(`[marver] design/config.ts: jam must be false, an agent name, or an options object - got ${show(v)}. Live Jam is off.`);
|
|
452
|
+
return "bad-agent";
|
|
453
|
+
}
|
|
454
|
+
const j = shape;
|
|
455
|
+
const agent = resolveAgent(j.agent);
|
|
456
|
+
if (agent === "no-agent" || agent === "bad-agent") return agent;
|
|
457
|
+
const c = j.concurrency;
|
|
458
|
+
const pick = (key, v, ok, fallback, want) => {
|
|
459
|
+
if (v === void 0) return fallback;
|
|
460
|
+
if (ok(v)) return v;
|
|
461
|
+
console.warn(`[marver] design/config.ts: jam.${key} must be ${want} - got ${show(v)}. Using ${JSON.stringify(fallback)}.`);
|
|
462
|
+
return fallback;
|
|
463
|
+
};
|
|
464
|
+
const bool = (v) => typeof v === "boolean";
|
|
465
|
+
return {
|
|
466
|
+
agent,
|
|
467
|
+
concurrency: typeof c === "number" && Number.isInteger(c) && c >= 1 && c <= 16 ? c : DEFAULT_CONCURRENCY,
|
|
468
|
+
subagents: j.subagents !== false,
|
|
469
|
+
proactive: j.proactive === true,
|
|
470
|
+
chime: pick("chime", j.chime, bool, true, "true or false"),
|
|
471
|
+
capture: pick("capture", j.capture, (v) => v === "confirm" || v === "at-once", "confirm", `'confirm' or 'at-once'`),
|
|
472
|
+
loc: pick("loc", j.loc, bool, true, "true or false"),
|
|
473
|
+
names: pick("names", j.names, bool, true, "true or false"),
|
|
474
|
+
runner: pick("runner", j.runner, (v) => v === "auto" || v === "session" || v === "background", "auto", `'auto', 'session' or 'background'`),
|
|
475
|
+
session: pick("session", j.session, bool, true, "true or false"),
|
|
476
|
+
context: pick("context", j.context, (v) => v === "fork" || v === "fresh", "fork", `'fork' or 'fresh'`),
|
|
477
|
+
mcp: pick("mcp", j.mcp, bool, true, "true or false"),
|
|
478
|
+
skills: pick("skills", j.skills, bool, true, "true or false"),
|
|
479
|
+
others: pick("others", j.others, bool, false, "true or false"),
|
|
480
|
+
...((sm) => sm === void 0 ? {} : { sessionMax: sm })(pick("sessionMax", j.sessionMax, (v) => typeof v === "number" && Number.isInteger(v) && v >= 1 && v <= 8, void 0, "a whole number from 1 to 8"))
|
|
481
|
+
};
|
|
482
|
+
}
|
|
483
|
+
/** Exactly one of `jam` (armed) or `jamOff` (why not) - so the dev server can speak up about
|
|
484
|
+
* the one off-state nothing has reported yet, and stay quiet about the rest. BOTH keys are
|
|
485
|
+
* always written: these spread over the user's own `jam`, and a raw `jam: false` reaching the
|
|
486
|
+
* server as config would arm the daemon against a truthy object check. */
|
|
487
|
+
function jamFields(v) {
|
|
488
|
+
const r = resolveJam(v);
|
|
489
|
+
return typeof r === "string" ? {
|
|
490
|
+
jam: void 0,
|
|
491
|
+
jamOff: r
|
|
492
|
+
} : {
|
|
493
|
+
jam: r,
|
|
494
|
+
jamOff: void 0
|
|
495
|
+
};
|
|
496
|
+
}
|
|
497
|
+
function validViewports(v) {
|
|
498
|
+
if (!v || typeof v !== "object") return null;
|
|
499
|
+
const out = {};
|
|
500
|
+
for (const [k, val] of Object.entries(v)) {
|
|
501
|
+
const vp = val;
|
|
502
|
+
if (validDim(vp?.width) && validDim(vp?.height)) out[k] = {
|
|
503
|
+
width: Math.round(vp.width),
|
|
504
|
+
height: Math.round(vp.height)
|
|
505
|
+
};
|
|
506
|
+
}
|
|
507
|
+
return Object.keys(out).length ? out : null;
|
|
508
|
+
}
|
|
509
|
+
//#endregion
|
|
510
|
+
export { loadConfig as n, config_exports as t };
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { r as NAME } from "./cli.mjs";
|
|
2
|
-
import {
|
|
3
|
-
import { O as readStatusWord, f as isBoardName, l as framesOn } from "./board-tree-
|
|
4
|
-
import { A as levelsIn, C as LEVEL, D as globRe, E as frontMatter, F as tables, I as wordCount, M as looseTables, N as parseMap, O as hasGlob, P as proseLines, S as GENERATED, T as capabilityTable, b as CITED_FILE, j as lf, k as isRecordTable, s as scanFrames, w as availableLevels, x as EVIDENCE_COLUMN, y as CITATION } from "./manifest-
|
|
2
|
+
import { s as checkRealDirs } from "./boards-Cim1GTKc.mjs";
|
|
3
|
+
import { O as readStatusWord, f as isBoardName, l as framesOn } from "./board-tree-DGj0HhEE.mjs";
|
|
4
|
+
import { A as levelsIn, C as LEVEL, D as globRe, E as frontMatter, F as tables, I as wordCount, M as looseTables, N as parseMap, O as hasGlob, P as proseLines, S as GENERATED, T as capabilityTable, b as CITED_FILE, j as lf, k as isRecordTable, s as scanFrames, w as availableLevels, x as EVIDENCE_COLUMN, y as CITATION } from "./manifest-CK8Qh4Nq.mjs";
|
|
5
5
|
import { pkgDir } from "./managed-HwHVNI3h.mjs";
|
|
6
6
|
import { t as writeManaged } from "./managed-write-Bo-oPc-i.mjs";
|
|
7
7
|
import { t as imports } from "./imports-WBSnnHLb.mjs";
|