frameboard 0.5.0 → 0.6.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/README.md +77 -11
- package/dist/cli.js +196 -27
- package/dist/client/assets/index-Bu_iEvp_.js +111 -0
- package/dist/client/assets/index-C2o-JeD6.css +2 -0
- package/dist/client/index.html +2 -2
- package/package.json +1 -1
- package/dist/client/assets/index-D-VR2nQK.css +0 -2
- package/dist/client/assets/index-rlhpPZLV.js +0 -111
package/README.md
CHANGED
|
@@ -26,31 +26,97 @@ In a folder with no board, `serve` creates `.frameboard/` with one empty project
|
|
|
26
26
|
|
|
27
27
|
## How it works
|
|
28
28
|
|
|
29
|
-
|
|
29
|
+
### Board folder
|
|
30
30
|
|
|
31
|
-
|
|
31
|
+
A board folder holds projects, a project holds pages, and a page holds frames.
|
|
32
32
|
|
|
33
|
-
|
|
33
|
+
- Each frame is one `.html` file beside a `layout.json` that records where it sits
|
|
34
34
|
|
|
35
|
-
|
|
35
|
+
### Tokens and themes
|
|
36
36
|
|
|
37
|
-
|
|
37
|
+
Frames share one look through a `tokens.css` in the board folder, which a project's own `tokens.css` overrides.
|
|
38
38
|
|
|
39
|
-
|
|
39
|
+
- `serve --tokens <path>` takes a sheet another tool manages instead
|
|
40
|
+
- The server puts the sheets and three faces, Geist, Geist Mono, and Caveat, ahead of each frame's own styles as it serves the frame
|
|
41
|
+
- The file on disk stays as written
|
|
42
|
+
- One toggle switches the board and every frame between light and dark
|
|
40
43
|
|
|
41
|
-
|
|
44
|
+
## For agents
|
|
42
45
|
|
|
43
|
-
|
|
46
|
+
### Commands
|
|
44
47
|
|
|
45
|
-
The
|
|
48
|
+
The `project`, `page`, and `frame` commands manage the board on disk, and `list` shows it.
|
|
46
49
|
|
|
47
|
-
|
|
50
|
+
- `edit` changes one style, attribute, or text on one element without touching another byte
|
|
51
|
+
- `show` points the open board at a frame, and `capture` writes PNGs of a frame or page in either theme
|
|
52
|
+
- `frame fit` sets a frame's height to its content
|
|
53
|
+
- `inspect` lists each rendered element with the index `edit` takes, its box, and its computed color and type
|
|
54
|
+
- `frameboard docs` prints every command, flag, record shape, and exit code
|
|
55
|
+
|
|
56
|
+
### Content checks
|
|
57
|
+
|
|
58
|
+
`frameboard check` reports every content rule a frame breaks, such as a link outside its page folder or colors set for one theme alone, and exits 8 on any error.
|
|
59
|
+
|
|
60
|
+
- The board runs the same rules on each change
|
|
61
|
+
- A running server adds the rules only a browser can see, being clipped content, a scrollbar inside the frame, content sized off the viewport, and text under a project's minimum size
|
|
62
|
+
|
|
63
|
+
### Claims
|
|
64
|
+
|
|
65
|
+
An agent runs `editing` on a frame before rewriting it.
|
|
66
|
+
|
|
67
|
+
- The board then outlines the frame and tags it with the agent and how long it has held it, and a second session that tries to claim it is told it is taken
|
|
68
|
+
- A claim lapses five minutes after the agent last ran `editing`, and a note sent from a claimed frame goes to the session holding it
|
|
69
|
+
- When you move, resize, edit, rename, or delete a claimed frame, your edit waits until the claim ends, under a card naming the agent
|
|
70
|
+
- A move, resize, or element edit then goes only if the agent left the frame as you saw it, and a rename or delete goes once the claim ends
|
|
71
|
+
|
|
72
|
+
### Change marks and following
|
|
73
|
+
|
|
74
|
+
When an agent writes a frame, the board marks it with a dot and counts it on its page and project until you look at it.
|
|
75
|
+
|
|
76
|
+
- A toast names the agent and offers Show, which takes you to the change and makes the edited elements glow, and Next, or `]`, steps to the next one
|
|
77
|
+
- Click a listening agent's initial in the inspector header to follow it
|
|
78
|
+
- The board then pans to each frame it claims or writes, across pages, until you pan, zoom, or click the canvas yourself
|
|
79
|
+
|
|
80
|
+
### Plugin
|
|
81
|
+
|
|
82
|
+
The Claude Code plugin in `plugins/frameboard/` runs the static checks after each agent write and hands the findings back in the same turn.
|
|
83
|
+
|
|
84
|
+
- Its monitor runs `inbox --follow` for the session, so a sent note reaches the agent at once
|
|
85
|
+
|
|
86
|
+
## For you
|
|
87
|
+
|
|
88
|
+
### Selecting
|
|
89
|
+
|
|
90
|
+
On the board, Cmd-click or double-click selects an element inside a frame.
|
|
91
|
+
|
|
92
|
+
- Enter, Esc, and Tab walk the tree, and the layers panel lists each frame's elements
|
|
93
|
+
- `selection` prints what you picked, with the element's index and hash ready for `edit`
|
|
94
|
+
|
|
95
|
+
### Notes
|
|
96
|
+
|
|
97
|
+
Pin a note on a frame or one element with the Note tool, and Send hands it to a Claude Code session listening on the board.
|
|
98
|
+
|
|
99
|
+
- The agent answers in the note's thread through `notes reply` and closes it with `notes done`
|
|
100
|
+
- The notes stay in each page's `notes.json`
|
|
101
|
+
|
|
102
|
+
### Hand edits
|
|
103
|
+
|
|
104
|
+
In the board you move and resize frames, add, rename, reorder, delete, and search pages, and add a frame at a phone, tablet, or desktop size with the Frame tool.
|
|
105
|
+
|
|
106
|
+
- On the home view, New project adds a project, and a card's right-click menu opens, renames, duplicates, or deletes one
|
|
107
|
+
- The inspector edits a selected element's name, opacity, radius, type size, weight, alignment, fill, stroke color, shadow, and text
|
|
108
|
+
- It offers the project's tokens first and flags a color no token names
|
|
109
|
+
- The layers panel selects, renames, restacks, hides, and locks frames, and Cmd+D, Cmd+C, Cmd+X, and Cmd+V duplicate, copy, cut, and paste them across pages and projects
|
|
110
|
+
- Cmd+F finds a frame, an element, or a line of copy on any page of the project and jumps to it
|
|
111
|
+
- Right-click a frame, an element, empty canvas, a page, or a layers row for the actions that apply there, such as Copy as PNG, Paste here, or Flip to light, which shows that frame alone in the other theme until you reload
|
|
112
|
+
|
|
113
|
+
Undo any of it with Cmd+Z. An undo of something an agent has changed since is refused and named on the board, so it never reverts the agent's work. Releases before 1.0 ship the board in stages, and the rest of editing by hand arrives in later 0.x releases.
|
|
48
114
|
|
|
49
115
|
## Requirements
|
|
50
116
|
|
|
51
117
|
Frameboard runs on macOS and Linux, with Node 22 or later or with Bun. Windows support is planned.
|
|
52
118
|
|
|
53
|
-
`capture`, `frame fit`,
|
|
119
|
+
`capture`, `frame fit`, `inspect`, and the home view's project thumbnails render in Playwright's headless shell. Without it, the commands print the command that installs it and download nothing, and each home card shows its frames as plain boxes.
|
|
54
120
|
|
|
55
121
|
## Links
|
|
56
122
|
|
package/dist/cli.js
CHANGED
|
@@ -9,7 +9,7 @@ import process$1, { versions } from "node:process";
|
|
|
9
9
|
import { isDeepStrictEqual, promisify, stripVTControlCharacters } from "node:util";
|
|
10
10
|
import { fileURLToPath } from "node:url";
|
|
11
11
|
import { constants, copyFile, cp, link, lstat, mkdir, open, readFile, readdir, realpath, rename, rm, stat as stat$1, writeFile } from "node:fs/promises";
|
|
12
|
-
import { createHash, randomBytes, timingSafeEqual } from "node:crypto";
|
|
12
|
+
import { createHash, randomBytes, randomUUID, timingSafeEqual } from "node:crypto";
|
|
13
13
|
import { setTimeout as setTimeout$1 } from "node:timers/promises";
|
|
14
14
|
import { STATUS_CODES, ServerResponse, createServer } from "node:http";
|
|
15
15
|
import { Http2ServerRequest, constants as constants$1 } from "node:http2";
|
|
@@ -9360,7 +9360,7 @@ async function isDirectory(path) {
|
|
|
9360
9360
|
}
|
|
9361
9361
|
//#endregion
|
|
9362
9362
|
//#region package.json
|
|
9363
|
-
var version$1 = "0.
|
|
9363
|
+
var version$1 = "0.6.0";
|
|
9364
9364
|
var dependencies = { "playwright-core": "1.64.1" };
|
|
9365
9365
|
//#endregion
|
|
9366
9366
|
//#region src/shared/version.ts
|
|
@@ -34567,6 +34567,9 @@ const LOOK_MARKER = "data-frameboard";
|
|
|
34567
34567
|
* the route served, so a live frame names the exact file an edit addresses.
|
|
34568
34568
|
*/
|
|
34569
34569
|
const RENDERED_HASH = "data-hash";
|
|
34570
|
+
function isTheme$1(value) {
|
|
34571
|
+
return value === "light" || value === "dark";
|
|
34572
|
+
}
|
|
34570
34573
|
/**
|
|
34571
34574
|
* Shows a frame's root in `theme`: `data-theme`, `color-scheme`, and the
|
|
34572
34575
|
* `.dark` or `.light` class, the selectors a token sheet reads. The frame
|
|
@@ -35437,20 +35440,33 @@ async function holdFrames(root, refs, options) {
|
|
|
35437
35440
|
}
|
|
35438
35441
|
/**
|
|
35439
35442
|
* Writes held frames onto a page as new files on top of its stack, each
|
|
35440
|
-
* taking the next free name so nothing on the page is overwritten.
|
|
35441
|
-
* keeps its box on another page and lands beside its source
|
|
35442
|
-
* the way `duplicateFrame` places a copy.
|
|
35443
|
+
* taking the next free name so nothing on the page is overwritten. Without
|
|
35444
|
+
* `at`, a frame keeps its box on another page and lands beside its source
|
|
35445
|
+
* on its own, the way `duplicateFrame` places a copy.
|
|
35443
35446
|
*/
|
|
35444
35447
|
async function pasteFrames(root, pageRef, held, options) {
|
|
35445
|
-
const { journal } = options;
|
|
35448
|
+
const { journal, at } = options;
|
|
35446
35449
|
const target = await resolvePageRef(root, pageRef, options);
|
|
35450
|
+
const left = Math.min(...held.map((frame) => frame.placement.box.x));
|
|
35451
|
+
const top = Math.min(...held.map((frame) => frame.placement.box.y));
|
|
35452
|
+
const place = (frame) => {
|
|
35453
|
+
const { box } = frame.placement;
|
|
35454
|
+
if (at) return {
|
|
35455
|
+
...box,
|
|
35456
|
+
x: at.x + box.x - left,
|
|
35457
|
+
y: at.y + box.y - top
|
|
35458
|
+
};
|
|
35459
|
+
return frame.page === target.path ? {
|
|
35460
|
+
...box,
|
|
35461
|
+
x: box.x + box.width + 80
|
|
35462
|
+
} : box;
|
|
35463
|
+
};
|
|
35447
35464
|
const names = await withLayouts([target.path], async (layouts) => {
|
|
35448
35465
|
const layout = layouts.get(target.path);
|
|
35449
35466
|
if (!layout) throw new Error(`No layout read for ${target.path}.`);
|
|
35450
35467
|
const pasted = [];
|
|
35451
35468
|
for (const frame of held) {
|
|
35452
35469
|
const name = freeFrameName(layout.names, frame.name, void 0);
|
|
35453
|
-
const { box } = frame.placement;
|
|
35454
35470
|
const path = join(target.path, `${name}${FRAME_EXTENSION}`);
|
|
35455
35471
|
await writeFile(path, frame.bytes, { flag: "wx" });
|
|
35456
35472
|
await journal?.created(path);
|
|
@@ -35458,10 +35474,7 @@ async function pasteFrames(root, pageRef, held, options) {
|
|
|
35458
35474
|
if (frame.entry) layout.file.frames[name] = { ...frame.entry };
|
|
35459
35475
|
layout.set(name, {
|
|
35460
35476
|
...frame.placement,
|
|
35461
|
-
box: frame
|
|
35462
|
-
...box,
|
|
35463
|
-
x: box.x + box.width + 80
|
|
35464
|
-
} : box,
|
|
35477
|
+
box: place(frame),
|
|
35465
35478
|
order: layout.topOrder()
|
|
35466
35479
|
});
|
|
35467
35480
|
pasted.push(name);
|
|
@@ -35569,7 +35582,13 @@ const frameAddSchema = object$1({
|
|
|
35569
35582
|
y: coordinate.optional()
|
|
35570
35583
|
});
|
|
35571
35584
|
const framesSchema = object$1({ refs });
|
|
35572
|
-
const pasteSchema = object$1({
|
|
35585
|
+
const pasteSchema = object$1({
|
|
35586
|
+
ref,
|
|
35587
|
+
at: object$1({
|
|
35588
|
+
x: coordinate,
|
|
35589
|
+
y: coordinate
|
|
35590
|
+
}).optional()
|
|
35591
|
+
});
|
|
35573
35592
|
const frameFlagSchema = object$1({
|
|
35574
35593
|
refs,
|
|
35575
35594
|
flag: _enum$1(["hidden", "locked"]),
|
|
@@ -35837,7 +35856,8 @@ function structureRoutes(root, access, history) {
|
|
|
35837
35856
|
const held = clipboard;
|
|
35838
35857
|
const frames = await recorded((journal) => pasteFrames(root, body.ref, held, {
|
|
35839
35858
|
cwd,
|
|
35840
|
-
journal
|
|
35859
|
+
journal,
|
|
35860
|
+
at: body.at
|
|
35841
35861
|
}), (pasted) => onFrames(pasted.map((frame) => frame.ref)));
|
|
35842
35862
|
return c.json({
|
|
35843
35863
|
ok: true,
|
|
@@ -35887,6 +35907,55 @@ function structureRoutes(root, access, history) {
|
|
|
35887
35907
|
return app;
|
|
35888
35908
|
}
|
|
35889
35909
|
//#endregion
|
|
35910
|
+
//#region src/server/routes/thumbnails.ts
|
|
35911
|
+
/**
|
|
35912
|
+
* `GET /api/thumbnails?theme=` answers `{ stamps }`, the stamp of each
|
|
35913
|
+
* visible frame on every project's first page whose capture in that theme is
|
|
35914
|
+
* current, and queues a render of the rest, so the home view asks once and
|
|
35915
|
+
* hears each landing over the live socket. `GET /api/thumbnails/png` serves
|
|
35916
|
+
* one capture at `?ref=&theme=&v=<stamp>`, cached for good since a changed
|
|
35917
|
+
* frame takes a new stamp. Both only read, so they take no writer guard.
|
|
35918
|
+
*/
|
|
35919
|
+
function thumbnailRoutes(root, store) {
|
|
35920
|
+
const app = new Hono();
|
|
35921
|
+
app.get("/api/thumbnails", async (c) => {
|
|
35922
|
+
const theme = themeOf(c.req.query("theme"), "Ask for /api/thumbnails?theme=<light|dark>.");
|
|
35923
|
+
const frames = (await scanBoard(root)).projects.flatMap((project) => (project.pages[0]?.frames ?? []).filter((frame) => !frame.hidden).map(({ ref, box }) => ({
|
|
35924
|
+
ref,
|
|
35925
|
+
box: {
|
|
35926
|
+
width: box.width,
|
|
35927
|
+
height: box.height
|
|
35928
|
+
}
|
|
35929
|
+
})));
|
|
35930
|
+
return c.json({
|
|
35931
|
+
ok: true,
|
|
35932
|
+
data: { stamps: store.ask(theme, frames) }
|
|
35933
|
+
});
|
|
35934
|
+
});
|
|
35935
|
+
app.get("/api/thumbnails/png", async (c) => {
|
|
35936
|
+
const theme = themeOf(c.req.query("theme"), "Ask for /api/thumbnails/png?ref=<frame-ref>&theme=<light|dark>&v=<stamp>.");
|
|
35937
|
+
const ref = c.req.query("ref") ?? "";
|
|
35938
|
+
const stamp = c.req.query("v") ?? "";
|
|
35939
|
+
const path = store.file(ref, theme, stamp);
|
|
35940
|
+
const bytes = path ? await readFile(path).catch(() => null) : null;
|
|
35941
|
+
if (!bytes) throw new FrameboardError("frame-not-found", `No current thumbnail of ${ref} in ${theme} at v=${stamp}.`, {
|
|
35942
|
+
ref,
|
|
35943
|
+
theme,
|
|
35944
|
+
v: stamp
|
|
35945
|
+
});
|
|
35946
|
+
return c.body(new Uint8Array(bytes), 200, {
|
|
35947
|
+
"Content-Type": "image/png",
|
|
35948
|
+
"Cache-Control": "public, max-age=31536000, immutable"
|
|
35949
|
+
});
|
|
35950
|
+
});
|
|
35951
|
+
app.onError(answerRefusal);
|
|
35952
|
+
return app;
|
|
35953
|
+
}
|
|
35954
|
+
function themeOf(value, usage) {
|
|
35955
|
+
if (!isTheme$1(value)) throw new FrameboardError("usage", usage, { theme: value ?? "" });
|
|
35956
|
+
return value;
|
|
35957
|
+
}
|
|
35958
|
+
//#endregion
|
|
35890
35959
|
//#region src/server/app.ts
|
|
35891
35960
|
const LOOPBACK_NAMES = /* @__PURE__ */ new Set(["127.0.0.1", "localhost"]);
|
|
35892
35961
|
/**
|
|
@@ -35910,7 +35979,7 @@ function boardHostGuard(port) {
|
|
|
35910
35979
|
await next();
|
|
35911
35980
|
};
|
|
35912
35981
|
}
|
|
35913
|
-
function createApp({ clientDir, root, port, actions, tickets, renderFrame, facesDir, tokens, delivery, history, selection, checks }) {
|
|
35982
|
+
function createApp({ clientDir, root, port, actions, tickets, renderFrame, facesDir, tokens, delivery, history, selection, checks, thumbnails }) {
|
|
35914
35983
|
const app = new Hono();
|
|
35915
35984
|
const given = tokens ?? null;
|
|
35916
35985
|
app.use("*", async (c, next) => {
|
|
@@ -35938,6 +36007,7 @@ function createApp({ clientDir, root, port, actions, tickets, renderFrame, faces
|
|
|
35938
36007
|
app.route("/", editRoutes(root, actions.access, history));
|
|
35939
36008
|
app.route("/", pngRoutes(root, renderFrame));
|
|
35940
36009
|
if (checks) app.route("/", checkRoutes(actions.access, checks));
|
|
36010
|
+
if (thumbnails) app.route("/", thumbnailRoutes(root, thumbnails));
|
|
35941
36011
|
app.route("/", frames.routes);
|
|
35942
36012
|
app.use("*", serveStatic({ root: clientDir }));
|
|
35943
36013
|
app.get("/p/*", serveStatic({
|
|
@@ -36250,11 +36320,11 @@ function createWarmBrowser(launch) {
|
|
|
36250
36320
|
};
|
|
36251
36321
|
}
|
|
36252
36322
|
/**
|
|
36253
|
-
* Renders on a server's warm browser one frame at a time at
|
|
36254
|
-
*
|
|
36255
|
-
*
|
|
36323
|
+
* Renders on a server's warm browser one frame at a time at `scale`. The
|
|
36324
|
+
* queue is the renderer's own, so a PNG never waits behind another consumer
|
|
36325
|
+
* of the browser, such as a thumbnail.
|
|
36256
36326
|
*/
|
|
36257
|
-
function createWarmRenderer({ baseUrl, browser }) {
|
|
36327
|
+
function createWarmRenderer({ baseUrl, browser, scale }) {
|
|
36258
36328
|
let queue = Promise.resolve();
|
|
36259
36329
|
return (frame, theme) => {
|
|
36260
36330
|
const run = queue.then(async () => {
|
|
@@ -36263,7 +36333,7 @@ function createWarmRenderer({ baseUrl, browser }) {
|
|
|
36263
36333
|
ref: frame.ref,
|
|
36264
36334
|
box: frame.box,
|
|
36265
36335
|
theme,
|
|
36266
|
-
scale
|
|
36336
|
+
scale
|
|
36267
36337
|
});
|
|
36268
36338
|
try {
|
|
36269
36339
|
return await opened.page.screenshot({
|
|
@@ -42172,6 +42242,77 @@ function createTickets(now = Date.now) {
|
|
|
42172
42242
|
};
|
|
42173
42243
|
}
|
|
42174
42244
|
//#endregion
|
|
42245
|
+
//#region src/server/capture/thumbnails.ts
|
|
42246
|
+
const THUMBNAILS_FOLDER = "thumbnails";
|
|
42247
|
+
/**
|
|
42248
|
+
* The home view's frame captures, one per frame and theme under
|
|
42249
|
+
* `.run/thumbnails/<project>/<page>/<frame>.<theme>.png`. A stamp names the
|
|
42250
|
+
* server run, how often the frame changed, and its size, so a capture of a
|
|
42251
|
+
* changed or resized frame, or one a previous server served, is never
|
|
42252
|
+
* answered as current. A failed render is remembered against its stamp, so a
|
|
42253
|
+
* frame refusing `font-missing`, or a board with no headless shell, costs one
|
|
42254
|
+
* render until the frame changes.
|
|
42255
|
+
*/
|
|
42256
|
+
function createThumbnailStore({ root, run, render, onRendered }) {
|
|
42257
|
+
const folder = join(root, RUN_FOLDER, THUMBNAILS_FOLDER);
|
|
42258
|
+
const generations = /* @__PURE__ */ new Map();
|
|
42259
|
+
const entries = /* @__PURE__ */ new Map();
|
|
42260
|
+
const inFlight = /* @__PURE__ */ new Set();
|
|
42261
|
+
const pathOf = (ref, theme) => join(folder, `${ref}.${theme}.png`);
|
|
42262
|
+
const keyOf = (ref, theme) => `${theme}:${ref}`;
|
|
42263
|
+
const stampOf = ({ ref, box }) => `${run}-${generations.get(ref) ?? 0}-${box.width}x${box.height}`;
|
|
42264
|
+
const start = (frame, theme, stamp) => {
|
|
42265
|
+
const key = keyOf(frame.ref, theme);
|
|
42266
|
+
const entry = {
|
|
42267
|
+
stamp,
|
|
42268
|
+
state: "rendering"
|
|
42269
|
+
};
|
|
42270
|
+
entries.set(key, entry);
|
|
42271
|
+
const landing = render(frame, theme).then(async (bytes) => {
|
|
42272
|
+
if (entries.get(key) !== entry) return;
|
|
42273
|
+
const path = pathOf(frame.ref, theme);
|
|
42274
|
+
await mkdir(dirname(path), { recursive: true });
|
|
42275
|
+
await writeFile(path, bytes);
|
|
42276
|
+
if (entries.get(key) !== entry) return;
|
|
42277
|
+
entry.state = "done";
|
|
42278
|
+
onRendered(theme, { [frame.ref]: stamp });
|
|
42279
|
+
}).catch(() => {
|
|
42280
|
+
entry.state = "failed";
|
|
42281
|
+
}).finally(() => inFlight.delete(landing));
|
|
42282
|
+
inFlight.add(landing);
|
|
42283
|
+
};
|
|
42284
|
+
return {
|
|
42285
|
+
ask: (theme, frames) => {
|
|
42286
|
+
const stamps = {};
|
|
42287
|
+
for (const frame of frames) {
|
|
42288
|
+
const stamp = stampOf(frame);
|
|
42289
|
+
const entry = entries.get(keyOf(frame.ref, theme));
|
|
42290
|
+
if (entry?.stamp !== stamp) start(frame, theme, stamp);
|
|
42291
|
+
else if (entry.state === "done") stamps[frame.ref] = stamp;
|
|
42292
|
+
}
|
|
42293
|
+
return stamps;
|
|
42294
|
+
},
|
|
42295
|
+
invalidate: (refs) => {
|
|
42296
|
+
for (const ref of refs) {
|
|
42297
|
+
generations.set(ref, (generations.get(ref) ?? 0) + 1);
|
|
42298
|
+
entries.delete(keyOf(ref, "light"));
|
|
42299
|
+
entries.delete(keyOf(ref, "dark"));
|
|
42300
|
+
}
|
|
42301
|
+
},
|
|
42302
|
+
file: (ref, theme, stamp) => {
|
|
42303
|
+
const entry = entries.get(keyOf(ref, theme));
|
|
42304
|
+
return entry?.stamp === stamp && entry.state === "done" ? pathOf(ref, theme) : null;
|
|
42305
|
+
},
|
|
42306
|
+
settled: async () => {
|
|
42307
|
+
while (inFlight.size > 0) await Promise.all(inFlight);
|
|
42308
|
+
},
|
|
42309
|
+
empty: () => rm(folder, {
|
|
42310
|
+
recursive: true,
|
|
42311
|
+
force: true
|
|
42312
|
+
})
|
|
42313
|
+
};
|
|
42314
|
+
}
|
|
42315
|
+
//#endregion
|
|
42175
42316
|
//#region src/server/changes/diff.ts
|
|
42176
42317
|
/** Past this many changed elements, one glow over the frame reads better than many. */
|
|
42177
42318
|
const MOST_ELEMENTS = 8;
|
|
@@ -45171,14 +45312,30 @@ async function listen({ clientDir, facesDir, root, tokens, port, openUrl, launch
|
|
|
45171
45312
|
inTurn
|
|
45172
45313
|
});
|
|
45173
45314
|
const browser = createWarmBrowser(() => launchCaptureBrowser({
|
|
45174
|
-
purpose: "Board PNGs and browser checks",
|
|
45315
|
+
purpose: "Board PNGs, thumbnails, and browser checks",
|
|
45175
45316
|
launch
|
|
45176
45317
|
}));
|
|
45177
45318
|
const baseUrl = () => `http://${HOSTNAME}:${bound}`;
|
|
45178
45319
|
const renderFrame = createWarmRenderer({
|
|
45179
45320
|
baseUrl,
|
|
45180
|
-
browser
|
|
45321
|
+
browser,
|
|
45322
|
+
scale: 2
|
|
45323
|
+
});
|
|
45324
|
+
const thumbnails = createThumbnailStore({
|
|
45325
|
+
root,
|
|
45326
|
+
run: randomUUID().slice(0, 8),
|
|
45327
|
+
render: createWarmRenderer({
|
|
45328
|
+
baseUrl,
|
|
45329
|
+
browser,
|
|
45330
|
+
scale: .5
|
|
45331
|
+
}),
|
|
45332
|
+
onRendered: (theme, stamps) => hub.broadcast({
|
|
45333
|
+
type: "thumbnails",
|
|
45334
|
+
theme,
|
|
45335
|
+
stamps
|
|
45336
|
+
})
|
|
45181
45337
|
});
|
|
45338
|
+
await thumbnails.empty();
|
|
45182
45339
|
const rendered = createRenderedFindings({
|
|
45183
45340
|
check: async (frame) => checkRendered(await browser.get(), {
|
|
45184
45341
|
baseUrl: baseUrl(),
|
|
@@ -45213,6 +45370,7 @@ async function listen({ clientDir, facesDir, root, tokens, port, openUrl, launch
|
|
|
45213
45370
|
history,
|
|
45214
45371
|
selection,
|
|
45215
45372
|
renderFrame,
|
|
45373
|
+
thumbnails,
|
|
45216
45374
|
checks: {
|
|
45217
45375
|
refresh: () => inTurn(async () => {
|
|
45218
45376
|
try {
|
|
@@ -45271,6 +45429,7 @@ async function listen({ clientDir, facesDir, root, tokens, port, openUrl, launch
|
|
|
45271
45429
|
delivery,
|
|
45272
45430
|
tracker,
|
|
45273
45431
|
claims,
|
|
45432
|
+
thumbnails,
|
|
45274
45433
|
settleLater
|
|
45275
45434
|
}));
|
|
45276
45435
|
});
|
|
@@ -45302,12 +45461,13 @@ async function listen({ clientDir, facesDir, root, tokens, port, openUrl, launch
|
|
|
45302
45461
|
}
|
|
45303
45462
|
/**
|
|
45304
45463
|
* One rescan per batch: the whole board to every tab, then the frames to
|
|
45305
|
-
* reload,
|
|
45464
|
+
* reload, marking their thumbnails stale in both themes without rendering
|
|
45465
|
+
* any, then the findings of every frame the batch rechecked, queueing the
|
|
45306
45466
|
* same frames for the browser checker, then the notes of every page whose
|
|
45307
45467
|
* notes or frames it touched, whose queue it offers to delivery. The frames
|
|
45308
45468
|
* an agent changed wait out the grace before the board hears of them.
|
|
45309
45469
|
*/
|
|
45310
|
-
async function pushBatch(root, tokens, paths, { hub, findings, rendered, delivery, tracker, claims, settleLater }) {
|
|
45470
|
+
async function pushBatch(root, tokens, paths, { hub, findings, rendered, delivery, tracker, claims, thumbnails, settleLater }) {
|
|
45311
45471
|
let board;
|
|
45312
45472
|
try {
|
|
45313
45473
|
board = await scanBoard(root);
|
|
@@ -45319,10 +45479,19 @@ async function pushBatch(root, tokens, paths, { hub, findings, rendered, deliver
|
|
|
45319
45479
|
data: board
|
|
45320
45480
|
});
|
|
45321
45481
|
const refs = reloadRefs(root, paths, board, tokens);
|
|
45322
|
-
if (refs.length > 0)
|
|
45323
|
-
|
|
45324
|
-
|
|
45325
|
-
|
|
45482
|
+
if (refs.length > 0) {
|
|
45483
|
+
hub.broadcast({
|
|
45484
|
+
type: "reload",
|
|
45485
|
+
refs
|
|
45486
|
+
});
|
|
45487
|
+
thumbnails.invalidate(refs);
|
|
45488
|
+
const stale = Object.fromEntries(refs.map((ref) => [ref, null]));
|
|
45489
|
+
for (const theme of THEMES) hub.broadcast({
|
|
45490
|
+
type: "thumbnails",
|
|
45491
|
+
theme,
|
|
45492
|
+
stamps: stale
|
|
45493
|
+
});
|
|
45494
|
+
}
|
|
45326
45495
|
const held = await tracker.update(board, paths, await claims.read());
|
|
45327
45496
|
if (held.length > 0) settleLater(held);
|
|
45328
45497
|
const changed = findings.update(board, paths);
|