easel-canvas 0.3.0 → 0.4.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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "easel-canvas",
3
- "version": "0.3.0",
3
+ "version": "0.4.0",
4
4
  "description": "Easel: an HTML design canvas for AI agents. Shows screens/*.html as boards and edits the source directly, with Claude Code / Codex via MCP",
5
5
  "license": "MIT",
6
6
  "author": "Hyun Park",
@@ -30,7 +30,9 @@
30
30
  "design:css": "node tools/mkcss.mjs",
31
31
  "verify:agents": "node tools/verify-agents.mjs",
32
32
  "perf": "node tools/perf/measure.mjs",
33
- "perf:phases": "node tools/perf/phases.mjs"
33
+ "perf:phases": "node tools/perf/phases.mjs",
34
+ "site": "node site/build.mjs",
35
+ "icons": "node tools/icons/build.mjs"
34
36
  },
35
37
  "engines": {
36
38
  "node": ">=20"
@@ -128,7 +128,9 @@ export function boardEntries(beforeText, afterText) {
128
128
  }
129
129
 
130
130
  /* ---------- Step names ---------- */
131
- const EDIT_OPS = { setText: "Change text on", setStyle: "Change style on", setAttr: "Change attribute on", delete: "Delete element on", duplicate: "Duplicate element on", move: "Move element on", insert: "Add element on", setTweaks: "Change tweaks on", batch: "Edit", wrap: "Group elements on" };
131
+ const EDIT_OPS = { setText: "Change text on", setStyle: "Change style on", setStyleText: "Change style on", setAttr: "Change attribute on", delete: "Delete element on", duplicate: "Duplicate element on", move: "Move element on", insert: "Add element on", setTweaks: "Change tweaks on", batch: "Edit", wrap: "Group elements on" };
132
+ /** What a style property is called in a step name (the app's own words; the client says them in the person's language) */
133
+ const STYLE_NOUNS = { color: "colour", "background-color": "fill", background: "fill", "font-size": "text size", "font-weight": "weight", "font-style": "italic", "text-decoration-line": "underline", "text-align": "alignment", "border-radius": "radius", padding: "padding", gap: "gap", opacity: "opacity", "letter-spacing": "letter spacing", width: "size", height: "size", left: "position", top: "position", "box-shadow": "shadow", border: "border" };
132
134
  /** App labels for board.json steps that are about some boards: named after them */
133
135
  const BOARD_LABELS = new Set(["Move board", "Resize board", "Board options", "Bring to front", "Send to back", "Move to page", "Set launch screen"]);
134
136
  /** What the text of an element is called in a step name */
@@ -159,7 +161,10 @@ export function stepName(step, env, describe = describeChange) {
159
161
  let m = /^(.+\.html) (\w+)$/.exec(label);
160
162
  if (m && EDIT_OPS[m[2]]) {
161
163
  const t = html.length === 1 ? textOf1(html[0]) : null;
162
- return t ? `Change ${copyNoun(t.tag)} on ${title(m[1])}` : `${EDIT_OPS[m[2]]} ${title(m[1])}`;
164
+ if (t) return `Change ${copyNoun(t.tag)} on ${title(m[1])}`;
165
+ // A style step that changed one known property is named after it ("Change colour on Ticket")
166
+ if (/^(setStyle|batch)$/.test(m[2]) && step.prop && STYLE_NOUNS[step.prop]) return `Change ${STYLE_NOUNS[step.prop]} on ${title(m[1])}`;
167
+ return `${EDIT_OPS[m[2]]} ${title(m[1])}`;
163
168
  }
164
169
  if ((m = /^Create board (.+)$/.exec(label))) return `Add board ${title(m[1])}`;
165
170
  // One writer per board, and picking a version (server/forks.mjs)
@@ -285,6 +290,16 @@ function stepInfo(ctx, step, env) {
285
290
  };
286
291
  }
287
292
 
293
+ /** The history's state with each step's human name in place of its internal label (undo / redo tooltips, the toast after ⌘Z) */
294
+ export async function namedState(ctx) {
295
+ const env = await envOf(ctx);
296
+ const { undo, redo } = ctx.history.entries();
297
+ return { ...ctx.history.state(), undo: undo.slice(-20).map((s) => stepName(s, env)), redo: redo.slice(-20).map((s) => stepName(s, env)) };
298
+ }
299
+ export async function stepNameOf(ctx, step) {
300
+ return step ? stepName(step, await envOf(ctx)) : null;
301
+ }
302
+
288
303
  /** What step names need: where the screens and board.json are, and the board titles now */
289
304
  async function envOf(ctx) {
290
305
  const board = await ctx.store.readBoard();
package/server/boards.mjs CHANGED
@@ -3,10 +3,11 @@
3
3
  import fs from "node:fs/promises";
4
4
  import path from "node:path";
5
5
 
6
+ import { namedState, stepNameOf } from "./activity.mjs";
6
7
  import { formatBoard } from "./boardFormat.mjs";
7
8
  import { writeAtomic } from "./fsutil.mjs";
8
9
  import { readBody, safeJoin, sendJson } from "./index.mjs";
9
- import { freeSpot, GAP_X, placeNew } from "./place.mjs";
10
+ import { besideOf, besideSpot, nearSpot, placeNew } from "./place.mjs";
10
11
  import { SYSTEM_FONT } from "./tokens.mjs";
11
12
 
12
13
  const read = (p) => fs.readFile(p, "utf8").catch(() => null);
@@ -276,10 +277,14 @@ export function boardRoutes() {
276
277
  const title = b.title || (tpl === "blank" ? wanted.replace(/\.html$/, "") : TEMPLATES[tpl].label);
277
278
  const board0 = await ctx.store.readBoard();
278
279
  const html = b.html ?? newBoardHtml({ title, w, h, template: tpl, brand: board0.title });
279
- // No position given (an agent's create_board): the first free spot, never on top of a board or a note
280
- const at = Number.isFinite(b.x) && Number.isFinite(b.y) ? { x: b.x, y: b.y } : placeNew(board0, { w, h }, b.page);
280
+ // Where it goes, never on top of a board or a note unless it was drawn there: beside a board (New board with one picked), near
281
+ // a point (New board: the view's centre), exactly where drawn (the board tool), or, with no position (an agent's create_board),
282
+ // the first free spot after the last auto-placed screen
283
+ const xy = Number.isFinite(b.x) && Number.isFinite(b.y);
284
+ const src = b.beside ? board0.boards[b.beside] : null;
285
+ const at = src ? besideOf(board0, src, { w, h }) : xy && b.near ? nearSpot(board0, { x: Math.round(b.x), y: Math.round(b.y), w, h }, b.page) : xy ? { x: b.x, y: b.y } : placeNew(board0, { w, h }, b.page);
281
286
  const [file] = await createBoards(ctx, [{ file: wanted, html, x: at.x, y: at.y, w, h, title, page: b.page }], `Create board ${wanted}`);
282
- sendJson(res, 200, { file });
287
+ sendJson(res, 200, { file, x: at.x, y: at.y, w, h });
283
288
  },
284
289
  ],
285
290
  ["GET", "/api/boards/templates", async (req, res) => sendJson(res, 200, { templates: Object.entries(TEMPLATES).map(([id, t]) => ({ id, ...t })) })],
@@ -320,7 +325,8 @@ export function boardRoutes() {
320
325
  const board0 = await ctx.store.readBoard();
321
326
  // The copy is an ordinary board: it is not a variant or fork of anything
322
327
  const { origin, autoPlaced, ...it } = board0.boards[b.file] ?? { x: 0, y: 0, w: 390, h: 844 };
323
- const at = freeSpot(board0, { x: it.x + it.w + GAP_X, y: it.y, w: it.w, h: it.h }, { page: it.page });
328
+ // Beside its original: right of it when that is free, else the nearer of further right and below
329
+ const at = besideSpot(board0, it);
324
330
  await commitBoard(
325
331
  ctx,
326
332
  `Duplicate board ${b.file}`,
@@ -399,7 +405,8 @@ export function boardRoutes() {
399
405
  async (req, res, url, ctx) => {
400
406
  const step = await ctx.history.undo();
401
407
  ctx.broadcast({ type: "history-changed" });
402
- sendJson(res, 200, { ok: true, label: step?.label ?? null, ...ctx.history.state() });
408
+ // label: the step's human name ("Change colour on Ticket"), never its file and internal operation
409
+ sendJson(res, 200, { ok: true, label: await stepNameOf(ctx, step), ...(await namedState(ctx)) });
403
410
  },
404
411
  ],
405
412
  [
@@ -408,10 +415,10 @@ export function boardRoutes() {
408
415
  async (req, res, url, ctx) => {
409
416
  const step = await ctx.history.redo();
410
417
  ctx.broadcast({ type: "history-changed" });
411
- sendJson(res, 200, { ok: true, label: step?.label ?? null, ...ctx.history.state() });
418
+ sendJson(res, 200, { ok: true, label: await stepNameOf(ctx, step), ...(await namedState(ctx)) });
412
419
  },
413
420
  ],
414
- ["GET", "/api/history", async (req, res, url, ctx) => sendJson(res, 200, ctx.history.state())],
421
+ ["GET", "/api/history", async (req, res, url, ctx) => sendJson(res, 200, await namedState(ctx))],
415
422
  // Notes (titles, sticky notes): shared by MCP and the app. All recorded in the undo history
416
423
  [
417
424
  "POST",
package/server/edit.mjs CHANGED
@@ -160,6 +160,33 @@ export function applyEdit(html, req) {
160
160
  }
161
161
  return setAttrRaw(html, node, "style", next);
162
162
  }
163
+ if (op === "setStyleText") {
164
+ // The Code tab (2026-12-01): the element's whole inline style, as typed. Only the style attribute's range changes, its quotes kept;
165
+ // an empty text removes the attribute
166
+ const { node } = target(html, path, hash);
167
+ const next = String(req.text ?? "")
168
+ .split(/;|\n/)
169
+ .map((d) => d.trim())
170
+ .filter(Boolean)
171
+ .join(";");
172
+ const cur = node.attrs?.find((a) => a.name === "style")?.value ?? "";
173
+ if (next === cur.trim().replace(/;$/, "")) return html;
174
+ const loc = node.sourceCodeLocation?.attrs?.style;
175
+ if (loc) {
176
+ const raw = html.slice(loc.startOffset, loc.endOffset);
177
+ const m = raw.match(/^(style\s*=\s*)(["']?)([\s\S]*?)\2$/i);
178
+ if (!m) throw new EditError(422, "Could not read the style attribute");
179
+ const q = m[2] || '"';
180
+ if (!next) {
181
+ let s = loc.startOffset;
182
+ while (s > 0 && /\s/.test(html[s - 1])) s--;
183
+ return splice(html, s, loc.endOffset, "");
184
+ }
185
+ const val = q === '"' ? next.replace(/"/g, """) : next.replace(/'/g, "'");
186
+ return splice(html, loc.startOffset, loc.endOffset, `${m[1]}${q}${val}${q}`);
187
+ }
188
+ return next ? setAttrRaw(html, node, "style", next) : html;
189
+ }
163
190
  if (op === "setAttr") {
164
191
  const { node } = target(html, path, hash);
165
192
  if (!/^[a-zA-Z_:][-a-zA-Z0-9_:.]*$/.test(String(req.name ?? ""))) throw new EditError(400, "Invalid attribute name");
package/server/export.mjs CHANGED
@@ -12,6 +12,7 @@ import { createBoardStore } from "./board.mjs";
12
12
  import { browserStatus, withPage as sharedWithPage } from "./browser.mjs";
13
13
  import { projectName, rootOf, toPosix } from "./fsutil.mjs";
14
14
  import { MIME, readBody, safeJoin, sendJson } from "./index.mjs";
15
+ import { plainComment } from "./requests.mjs";
15
16
  import { git } from "./snapshot.mjs";
16
17
 
17
18
  export const MANIFEST = ".easel-export.json";
@@ -412,6 +413,8 @@ async function renderBoards(dir, boards, withPage) {
412
413
  try {
413
414
  const png = await withPage({ viewport: { width: b.w, height: b.h }, deviceScaleFactor: 2 }, async (pg) => {
414
415
  await pg.goto(`${srv.url}/screens/${encodePath(b.file)}`, { waitUntil: "load", timeout: 20000 });
416
+ // The board's background (board.json bg) behind its page; only a plain colour is taken
417
+ if (b.bg && /^(#[0-9a-f]{3,8}|[a-z]+|rgba?\([\d\s.,%]+\))$/i.test(b.bg)) await pg.addStyleTag({ content: `html{background:${b.bg}}` });
415
418
  await pg.waitForTimeout(150);
416
419
  return pg.screenshot({ type: "png" });
417
420
  });
@@ -427,12 +430,26 @@ async function renderBoards(dir, boards, withPage) {
427
430
  return shots;
428
431
  }
429
432
 
430
- /** One page per board, each page the board's own size (CSS named pages) */
433
+ /** Paper sizes in CSS px (96 per inch): Letter 8.5 × 11 in, A4 210 × 297 mm */
434
+ export const PAPER = { letter: { w: 816, h: 1056 }, a4: { w: 794, h: 1123 } };
435
+
436
+ /** The pages of one board: continuous (the default) is one page the board's own size; fixed is paper-size pages, the board scaled to
437
+ * the paper's width and carried over as many pages as it needs */
438
+ export function pagesOf(s) {
439
+ if (s.print !== "fixed") return [{ w: s.w, h: s.h, scale: 1, top: 0 }];
440
+ const paper = PAPER[s.paper] ?? PAPER.letter;
441
+ const scale = paper.w / s.w;
442
+ const n = Math.max(1, Math.ceil((s.h * scale) / paper.h - 0.001));
443
+ return Array.from({ length: n }, (_, k) => ({ w: paper.w, h: paper.h, scale, top: -k * paper.h }));
444
+ }
445
+
446
+ /** One page per board (or per paper sheet of a fixed board), each its own size (CSS named pages) */
431
447
  async function pdfOf(shots, withPage) {
432
- const css = shots.map((s, i) => `@page b${i}{size:${s.w}px ${s.h}px;margin:0}.b${i}{page:b${i};width:${s.w}px;height:${s.h}px}`).join("");
433
- const body = shots.map((s, i) => `<div class="b${i}"><img src="data:image/png;base64,${s.png.toString("base64")}" alt=""></div>`).join("");
448
+ const pages = shots.flatMap((s) => pagesOf(s).map((pg) => ({ ...pg, s })));
449
+ const css = pages.map((p, i) => `@page b${i}{size:${p.w}px ${p.h}px;margin:0}.b${i}{page:b${i};width:${p.w}px;height:${p.h}px;position:relative}.b${i} img{position:absolute;left:0;top:${p.top}px;width:${Math.round(p.s.w * p.scale)}px;height:${Math.round(p.s.h * p.scale)}px}`).join("");
450
+ const body = pages.map((p, i) => `<div class="b${i}"><img src="data:image/png;base64,${p.s.png.toString("base64")}" alt=""></div>`).join("");
434
451
  return withPage(undefined, async (pg) => {
435
- await pg.setContent(`<!doctype html><html><head><style>html,body{margin:0}div{break-after:page;overflow:hidden}div:last-child{break-after:auto}img{display:block;width:100%;height:100%}${css}</style></head><body>${body}</body></html>`, { waitUntil: "load" });
452
+ await pg.setContent(`<!doctype html><html><head><style>html,body{margin:0}div{break-after:page;overflow:hidden}div:last-child{break-after:auto}img{display:block}${css}</style></head><body>${body}</body></html>`, { waitUntil: "load" });
436
453
  return pg.pdf({ preferCSSPageSize: true, printBackground: true });
437
454
  });
438
455
  }
@@ -463,7 +480,7 @@ export async function exportDesign({ dir, out, store, format = "web", singleFile
463
480
  if (kind === "pdf" || kind === "png") {
464
481
  const status = withPage === sharedWithPage ? await browserStatus() : { ok: true };
465
482
  if (!status.ok) throw fail(501, `PDF and PNG are unavailable here. ${status.reason}`);
466
- const shots = await renderBoards(dir, scope.boards.map((f) => ({ file: f, w: board.boards[f].w, h: board.boards[f].h })), withPage);
483
+ const shots = await renderBoards(dir, scope.boards.map((f) => ({ file: f, w: board.boards[f].w, h: board.boards[f].h, print: board.boards[f].print, paper: board.boards[f].paper, bg: board.boards[f].bg })), withPage);
467
484
  if (kind === "png") for (const s of shots) entries.push({ rel: `png/${s.file.replace(/\.html$/, "").replace(/\//g, "-")}@2x.png`, data: s.png });
468
485
  else entries.push({ rel: `${slug(dir)}-canvas.pdf`, data: await pdfOf(shots, withPage) });
469
486
  main = kind === "pdf" ? entries[0].rel : "png/";
@@ -473,7 +490,8 @@ export async function exportDesign({ dir, out, store, format = "web", singleFile
473
490
  const col = await collect(dir, scope.boards, exclude);
474
491
  skipped = col.skipped;
475
492
  const viewer = await viewerBuild();
476
- const comments = (await readComments(dir)).filter((c) => scope.boards.includes(c.file));
493
+ // For AI requests travel as ordinary comments: a view-only copy has no request status or controls
494
+ const comments = (await readComments(dir)).filter((c) => scope.boards.includes(c.file)).map(plainComment);
477
495
  const pick = (obj, ids) => Object.fromEntries(ids.map((id) => [id, obj[id]]));
478
496
  const shapes = pick(board.shapes ?? {}, scope.shapes);
479
497
  const data = {
package/server/index.mjs CHANGED
@@ -15,7 +15,8 @@ import { rootOf, toPosix } from "./fsutil.mjs";
15
15
  import { createHistory, requestScope } from "./history.mjs";
16
16
  import { contentHash } from "./livePatch.mjs";
17
17
  import { createOccupancy } from "./occupancy.mjs";
18
- import { writeEntry } from "./registry.mjs";
18
+ import { createStamps } from "./stamps.mjs";
19
+ import { isAlive, readEntries, real, writeEntry } from "./registry.mjs";
19
20
  import { checkUpdate } from "./update.mjs";
20
21
 
21
22
  export const MIME = {
@@ -208,7 +209,8 @@ export async function createServer({ dir, port, dev = true, extraRoutes = [], au
208
209
  const occupancy = createOccupancy({ onChange: (boards) => ctx.broadcast({ type: "occupancy", boards }) });
209
210
  history = createHistory({ ...trackedFiles(store), onStep: (step, changes) => noteWriters(occupancy, store.screensDir, step, changes) });
210
211
  // boot: when this server started; the chat shows "Easel restarted" when it changes (the undo history did not survive)
211
- const ctx = { dir, store, history, occupancy, broadcast: () => {}, boot: new Date().toISOString() };
212
+ // stamps: each board's render stamp (server/stamps.mjs), the version of its zoomed-out thumbnail
213
+ const ctx = { dir, store, history, occupancy, stamps: createStamps(dir), broadcast: () => {}, boot: new Date().toISOString() };
212
214
  await history.seed();
213
215
 
214
216
  // App UI: on startup, build once if the app source is newer than dist, then serve dist statically.
@@ -230,12 +232,35 @@ export async function createServer({ dir, port, dev = true, extraRoutes = [], au
230
232
  const routes = [
231
233
  ["GET", "/api/update", async (req, res) => sendJson(res, 200, { update: await update })],
232
234
  ["GET", "/api/health", async (req, res) => sendJson(res, 200, { ok: true, dir, root: rootOf(dir), screens: screensRel, pid: process.pid })],
235
+ // Other Easel canvases running on this machine (the registry easel-canvas status reads), for the project menu: only those that
236
+ // answer for their own folder, never this one. Title from each one's board.json; nothing else of theirs is read
237
+ [
238
+ "GET",
239
+ "/api/projects",
240
+ async (req, res) => {
241
+ const me = real(dir);
242
+ const entries = readEntries().filter((e) => real(e.dir) !== me);
243
+ const live = (await Promise.all(entries.map(async (e) => ((await isAlive(e, 600)) ? e : null)))).filter(Boolean);
244
+ const projects = await Promise.all(
245
+ live.map(async (e) => {
246
+ let title = null;
247
+ try {
248
+ title = JSON.parse(await fs.readFile(path.join(e.dir, "board.json"), "utf8")).title ?? null;
249
+ } catch {
250
+ /* no title: the folder's name */
251
+ }
252
+ return { port: e.port, title: title || path.basename(e.root), root: e.root };
253
+ }),
254
+ );
255
+ sendJson(res, 200, { projects });
256
+ },
257
+ ],
233
258
  [
234
259
  "GET",
235
260
  "/api/board",
236
261
  async (req, res) => {
237
262
  const { board, files, missing } = await store.syncBoard();
238
- sendJson(res, 200, { board, files, missing, dir, screens: screensRel });
263
+ sendJson(res, 200, { board, files, missing, dir, screens: screensRel, stamps: await ctx.stamps.stampAll(files) });
239
264
  },
240
265
  ],
241
266
  [
@@ -16,6 +16,8 @@ export function createOccupancy({ quietMs = QUIET_MS, doneMs = DONE_MS, onChange
16
16
  /** file → { base, holders: Map<key, holder> } — holder: { key, kind, by | person, client, runs, clients, conns, since, quietUntil, doneAt, timer } */
17
17
  const files = new Map();
18
18
  const conns = new Map(); // WebSocket id → { file, key }
19
+ /** In-app runs that have ended: a write of theirs noticed after the end (the watcher can be late) must not hold a board again */
20
+ const ended = new Set();
19
21
  const changed = () => onChange(snapshot());
20
22
  const timer = (fn, ms) => {
21
23
  const t = setTimeout(fn, ms);
@@ -70,7 +72,13 @@ export function createOccupancy({ quietMs = QUIET_MS, doneMs = DONE_MS, onChange
70
72
  h.since = Date.now();
71
73
  h.doneAt = null;
72
74
  }
73
- if (run) h.runs.add(run);
75
+ if (run && ended.has(run)) {
76
+ // A late write of a run that is over: the board shows the agent as done, not editing forever
77
+ if (!h.runs.size && !h.clients.size) {
78
+ h.quietUntil = 0;
79
+ settle(file, h);
80
+ }
81
+ } else if (run) h.runs.add(run);
74
82
  else {
75
83
  if (client) h.clients.add(client);
76
84
  h.quietUntil = Date.now() + quietMs;
@@ -92,16 +100,19 @@ export function createOccupancy({ quietMs = QUIET_MS, doneMs = DONE_MS, onChange
92
100
  }
93
101
 
94
102
  function runEnded(run) {
103
+ ended.add(run);
104
+ if (ended.size > 500) ended.delete(ended.values().next().value);
95
105
  for (const [file, r] of [...files])
96
106
  for (const h of [...r.holders.values()])
97
- if (h.runs.delete(run) && !h.runs.size) settle(file, h); // done now, unless the same agent also wrote over MCP within its quiet time
107
+ // People on the board have no runs (an element picked there: the usual case for AI asked at the element); only agents end
108
+ if (h.kind === "agent" && h.runs.delete(run) && !h.runs.size) settle(file, h); // done now, unless the same agent also wrote over MCP within its quiet time
98
109
  }
99
110
 
100
111
  /** An MCP client disconnected: boards it alone kept busy are done now */
101
112
  function clientGone(client) {
102
113
  for (const [file, r] of [...files])
103
114
  for (const h of [...r.holders.values()])
104
- if (h.clients.delete(client) && !h.clients.size && !h.runs.size && !h.doneAt) {
115
+ if (h.kind === "agent" && h.clients.delete(client) && !h.clients.size && !h.runs.size && !h.doneAt) {
105
116
  h.quietUntil = 0;
106
117
  settle(file, h);
107
118
  }
package/server/place.mjs CHANGED
@@ -108,6 +108,17 @@ export function placeNew(board, size, page) {
108
108
  return freeSpot(board, { x: left, y: bottom + GAP_Y, ...size }, { dir: "down", page });
109
109
  }
110
110
 
111
+ /** A new board of size near a point (the view's centre) or beside board o: the nearer of the first free spot going right and the first
112
+ * going down, so it lands in free space close by and never on top of a board or a note */
113
+ export function nearSpot(board, rect, page) {
114
+ const right = freeSpot(board, rect, { dir: "right", page });
115
+ const down = freeSpot(board, rect, { dir: "down", page });
116
+ return Math.hypot(down.x - rect.x, down.y - rect.y) < Math.hypot(right.x - rect.x, right.y - rect.y) ? down : right;
117
+ }
118
+ export function besideOf(board, o, size) {
119
+ return nearSpot(board, { x: o.x + o.w + GAP_X, y: o.y, w: size.w, h: size.h }, o.page);
120
+ }
121
+
111
122
  /** A row of n copies of board b (variants): the first free row below it */
112
123
  export function freeRow(board, b, n) {
113
124
  const r = freeSpot(board, { x: b.x, y: b.y + b.h + GAP_Y, w: n * b.w + (n - 1) * GAP_X, h: b.h }, { dir: "down", page: b.page });