frameboard 0.14.0 → 0.15.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 +32 -100
- package/dist/cli.js +204 -19
- package/dist/client/assets/index-Dw9kkXht.css +2 -0
- package/dist/client/assets/index-l0GcY95w.js +110 -0
- package/dist/client/index.html +2 -2
- package/package.json +3 -3
- package/dist/client/assets/index-D6XyJYZH.css +0 -2
- package/dist/client/assets/index-RAnQsb-L.js +0 -110
package/README.md
CHANGED
|
@@ -1,12 +1,25 @@
|
|
|
1
|
-
<
|
|
2
|
-
|
|
3
|
-
|
|
1
|
+
<div align="center">
|
|
2
|
+
|
|
3
|
+
<img src="src/client/public/icon.svg" alt="Frameboard logo" width="64" height="64">
|
|
4
4
|
|
|
5
5
|
# Frameboard
|
|
6
6
|
|
|
7
7
|
A local design board that coding agents draw on as plain HTML files, and you review and tweak.
|
|
8
8
|
|
|
9
|
-
](https://www.npmjs.com/package/frameboard)
|
|
10
|
+
[](https://github.com/erclx/frameboard/actions/workflows/verify.yml)
|
|
11
|
+
[](package.json)
|
|
12
|
+
[](LICENSE)
|
|
13
|
+
|
|
14
|
+
</div>
|
|
15
|
+
|
|
16
|
+
<p align="center">
|
|
17
|
+
<picture>
|
|
18
|
+
<source media="(prefers-color-scheme: dark)" srcset=".github/readme-hero-dark.png">
|
|
19
|
+
<source media="(prefers-reduced-motion: reduce)" srcset=".github/readme-hero-light.png">
|
|
20
|
+
<img src=".github/readme-hero-loop-light.webp" alt="The Frameboard canvas showing a plant care app's landing page and two phone screens" width="880">
|
|
21
|
+
</picture>
|
|
22
|
+
</p>
|
|
10
23
|
|
|
11
24
|
## Quick start
|
|
12
25
|
|
|
@@ -14,113 +27,31 @@ A local design board that coding agents draw on as plain HTML files, and you rev
|
|
|
14
27
|
npx frameboard serve
|
|
15
28
|
```
|
|
16
29
|
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
Install it with `npm install -g frameboard` or `bun add -g frameboard`.
|
|
20
|
-
|
|
21
|
-
## What you get
|
|
30
|
+
`serve` opens a board in your browser, in a tab that can edit. Point your coding agent at the same folder, and each frame it writes shows up as soon as the file lands.
|
|
22
31
|
|
|
23
|
-
|
|
24
|
-
- Frames render as real web pages, so animation, video, and interaction work
|
|
25
|
-
- Every frame reloads the moment its file changes, in light and dark
|
|
26
|
-
- The files are the design, so Frameboard keeps no private copy and a hand edit touches only what changed
|
|
27
|
-
- The server binds to `127.0.0.1`, with no hosted service and no MCP server
|
|
32
|
+
To keep it around, install it with `npm install -g frameboard` or `bun add -g frameboard`.
|
|
28
33
|
|
|
29
34
|
## How it works
|
|
30
35
|
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
- Each frame is one `.html` file beside a `layout.json` that records where it sits
|
|
36
|
-
|
|
37
|
-
### Tokens and themes
|
|
38
|
-
|
|
39
|
-
Frames share one look through a `tokens.css` in the board folder, which a project's own `tokens.css` overrides.
|
|
40
|
-
|
|
41
|
-
- `serve --tokens <path>` takes a sheet another tool manages instead
|
|
42
|
-
- `project tokens <project> --accent <preset> --font <face>` writes a starter sheet where no sheet reaches the project, and refuses where one does
|
|
43
|
-
- 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
|
|
44
|
-
- The file on disk stays as written
|
|
45
|
-
- One toggle switches the board and every frame between light and dark
|
|
46
|
-
|
|
47
|
-
## For agents
|
|
48
|
-
|
|
49
|
-
### Commands
|
|
50
|
-
|
|
51
|
-
The `project`, `page`, and `frame` commands manage the board on disk, and `list` shows it.
|
|
52
|
-
|
|
53
|
-
- `edit` changes one style, attribute, or text on one element without touching another byte
|
|
54
|
-
- `show` points the open board at a frame, or offers Go while you are mid-action or it sits in another project, and `capture` writes PNGs of a frame or page in either theme
|
|
55
|
-
- `frame add` with no size makes a frame that hugs its content, which a running server measures after each write, and `frame fit` sets a height to its content and keeps it hugging
|
|
56
|
-
- `inspect` lists each rendered element with the index `edit` takes, its box, and its computed color and type
|
|
57
|
-
- `frameboard docs` prints every command, flag, record shape, and exit code
|
|
58
|
-
|
|
59
|
-
### Content checks
|
|
60
|
-
|
|
61
|
-
`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.
|
|
62
|
-
|
|
63
|
-
- The board runs the same rules on each change, and a frame's findings badge opens the list, which the inspector shows too
|
|
64
|
-
- A running server adds the rules only a browser can see, being clipped content, an inner scrollbar, content sized off the viewport, text under a project's minimum size, and dropped CSS
|
|
65
|
-
|
|
66
|
-
### Claims
|
|
67
|
-
|
|
68
|
-
An agent runs `editing` on a frame before rewriting it.
|
|
69
|
-
|
|
70
|
-
- 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
|
|
71
|
-
- 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
|
|
72
|
-
- When you move, resize, edit, rename, or delete a claimed frame, your edit waits until the claim ends, under a card naming the agent
|
|
73
|
-
- A move or resize then goes only if the agent left the frame as you saw it, and a rename or delete goes once the claim ends
|
|
74
|
-
- An element edit goes if the agent left that element alone, and otherwise comes back, with typed text kept in the Text field to apply again
|
|
75
|
-
|
|
76
|
-
### Change marks and following
|
|
77
|
-
|
|
78
|
-
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.
|
|
79
|
-
|
|
80
|
-
- 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
|
|
81
|
-
- The compare button on a changed frame's label flips it to the version before the agent's run, or splits it at a divider you drag
|
|
82
|
-
- The server keeps that version until it restarts or 200 later changes land
|
|
83
|
-
- Click a listening agent's initial in the inspector header to follow it
|
|
84
|
-
- The board then pans to each frame it claims or writes, across pages, until you pan, zoom, or click the canvas yourself
|
|
85
|
-
|
|
86
|
-
### Plugin
|
|
87
|
-
|
|
88
|
-
The Claude Code plugin in `plugins/frameboard/` runs the static checks after each agent write and hands the findings back in the same turn.
|
|
89
|
-
|
|
90
|
-
- Its monitor runs `inbox --follow` for the session, so a sent note reaches the agent at once
|
|
36
|
+
| 1. Your agent writes | 2. The board shows it | 3. You steer |
|
|
37
|
+
| ------------------------------------------------------------------------------------------------ | ---------------------------------------------------------------------------------------------------------- | ---------------------------------------------------------------------------------- |
|
|
38
|
+
| Each frame is one HTML file in a page folder, so your agent draws with the tools it already has. | A frame reloads the moment its file changes, in light and dark, and a broken rule is flagged on the frame. | Move, restyle, and retype by hand, or pin a note your agent answers in its thread. |
|
|
91
39
|
|
|
92
40
|
## For you
|
|
93
41
|
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
- Enter, Esc, and Tab walk the tree, and the layers panel lists each frame's elements
|
|
99
|
-
- `selection` prints what you picked, with the element's index and hash ready for `edit`
|
|
100
|
-
|
|
101
|
-
### Notes
|
|
102
|
-
|
|
103
|
-
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.
|
|
104
|
-
|
|
105
|
-
- The agent answers in the note's thread through `notes reply` and closes it with `notes done`
|
|
106
|
-
- Paste or drop a PNG, JPEG, GIF, or WebP image into a note or a reply, and the agent gets its path to open
|
|
107
|
-
- The notes stay in each page's `notes.json`, and their images in its `.notes/` folder
|
|
108
|
-
- With nobody listening, Send can start a session through a command you export before `serve`, such as `FRAMEBOARD_DISPATCH='claude --bg "$FRAMEBOARD_NOTE"'`, which gets the note in its environment
|
|
109
|
-
- The command runs in the folder `serve` started in, and `claude --bg` starts only once Claude Code trusts that folder
|
|
110
|
-
|
|
111
|
-
### Hand edits
|
|
42
|
+
- You arrange pages, frames, and layers, and copy, paste, or undo across all of them
|
|
43
|
+
- You change text, shapes, color, and type by hand, picking colors from your project's tokens
|
|
44
|
+
- A note you pin on a frame or an element reaches your agent straight away
|
|
112
45
|
|
|
113
|
-
|
|
46
|
+
[Everything you can do on the board](docs/board.md)
|
|
114
47
|
|
|
115
|
-
|
|
116
|
-
- The inspector edits a frame's fill and an element's opacity, radius, type, line height, letter spacing, fill, stroke, shadow, and text, its numbers stepping on arrows and scrubbing from a label
|
|
117
|
-
- The layers panel selects, renames, restacks, hides, and locks frames, renames elements, and Cmd+D, Cmd+C, Cmd+X, and Cmd+V duplicate, copy, cut, and paste them across pages and projects
|
|
118
|
-
- Cmd+F finds a frame, an element, or a line of copy on any page of the project and jumps to it
|
|
119
|
-
- Right-click a frame, element, empty canvas, page, or layers row for its actions, such as Copy as PNG, Fit height, or Flip to light, which shows that frame alone in the other theme until reload
|
|
48
|
+
## For your agent
|
|
120
49
|
|
|
121
|
-
|
|
50
|
+
- Commands print JSON and never prompt, so an agent can run them unattended
|
|
51
|
+
- `frameboard check` flags what breaks a frame, such as clipped text or a color set for one theme only
|
|
52
|
+
- The Claude Code plugin checks each frame the agent writes and hands it your notes as they arrive
|
|
122
53
|
|
|
123
|
-
|
|
54
|
+
[The command and check reference](docs/agents.md)
|
|
124
55
|
|
|
125
56
|
## Requirements
|
|
126
57
|
|
|
@@ -130,6 +61,7 @@ Frameboard runs on macOS and Linux, with Node 22 or later or with Bun. Windows s
|
|
|
130
61
|
|
|
131
62
|
## Links
|
|
132
63
|
|
|
64
|
+
- [How it works](docs/how-it-works.md) for the board folder, tokens, and themes
|
|
133
65
|
- [Contributing guide](CONTRIBUTING.md) for setup, tests, and the commit rules
|
|
134
66
|
- [Security policy](SECURITY.md) for reporting a vulnerability privately
|
|
135
67
|
- [Issue tracker](https://github.com/erclx/frameboard/issues)
|
package/dist/cli.js
CHANGED
|
@@ -9031,7 +9031,88 @@ const FRAME_SIZES = {
|
|
|
9031
9031
|
height: 900
|
|
9032
9032
|
}
|
|
9033
9033
|
};
|
|
9034
|
+
/**
|
|
9035
|
+
* The devices the Frame tool and `--size` offer beside the three presets.
|
|
9036
|
+
* The iPad Pro 11 and a 1440 desktop are the tablet and desktop presets, so
|
|
9037
|
+
* neither repeats here.
|
|
9038
|
+
*/
|
|
9039
|
+
const DEVICE_SIZES = [
|
|
9040
|
+
{
|
|
9041
|
+
name: "small-phone",
|
|
9042
|
+
label: "Small phone",
|
|
9043
|
+
group: "phone",
|
|
9044
|
+
width: 375,
|
|
9045
|
+
height: 667
|
|
9046
|
+
},
|
|
9047
|
+
{
|
|
9048
|
+
name: "iphone-16",
|
|
9049
|
+
label: "iPhone 16",
|
|
9050
|
+
group: "phone",
|
|
9051
|
+
width: 393,
|
|
9052
|
+
height: 852
|
|
9053
|
+
},
|
|
9054
|
+
{
|
|
9055
|
+
name: "android",
|
|
9056
|
+
label: "Android",
|
|
9057
|
+
group: "phone",
|
|
9058
|
+
width: 412,
|
|
9059
|
+
height: 917
|
|
9060
|
+
},
|
|
9061
|
+
{
|
|
9062
|
+
name: "iphone-16-pro-max",
|
|
9063
|
+
label: "iPhone 16 Pro Max",
|
|
9064
|
+
group: "phone",
|
|
9065
|
+
width: 440,
|
|
9066
|
+
height: 956
|
|
9067
|
+
},
|
|
9068
|
+
{
|
|
9069
|
+
name: "ipad-mini",
|
|
9070
|
+
label: "iPad mini",
|
|
9071
|
+
group: "tablet",
|
|
9072
|
+
width: 744,
|
|
9073
|
+
height: 1133
|
|
9074
|
+
},
|
|
9075
|
+
{
|
|
9076
|
+
name: "ipad-pro-12-9",
|
|
9077
|
+
label: "iPad Pro 12.9",
|
|
9078
|
+
group: "tablet",
|
|
9079
|
+
width: 1024,
|
|
9080
|
+
height: 1366
|
|
9081
|
+
},
|
|
9082
|
+
{
|
|
9083
|
+
name: "macbook-air",
|
|
9084
|
+
label: "MacBook Air",
|
|
9085
|
+
group: "desktop",
|
|
9086
|
+
width: 1280,
|
|
9087
|
+
height: 832
|
|
9088
|
+
},
|
|
9089
|
+
{
|
|
9090
|
+
name: "full-hd",
|
|
9091
|
+
label: "Full HD",
|
|
9092
|
+
group: "desktop",
|
|
9093
|
+
width: 1920,
|
|
9094
|
+
height: 1080
|
|
9095
|
+
}
|
|
9096
|
+
];
|
|
9097
|
+
/** Every size name, the three presets first, then the devices. */
|
|
9098
|
+
const FRAME_SIZE_NAMES = [
|
|
9099
|
+
"phone",
|
|
9100
|
+
"tablet",
|
|
9101
|
+
"desktop",
|
|
9102
|
+
...DEVICE_SIZES.map((device) => device.name)
|
|
9103
|
+
];
|
|
9034
9104
|
const DEFAULT_FRAME_SIZE = "desktop";
|
|
9105
|
+
function isFrameSizePreset(value) {
|
|
9106
|
+
return Object.hasOwn(FRAME_SIZES, value);
|
|
9107
|
+
}
|
|
9108
|
+
/** The width and height a size name stands for. */
|
|
9109
|
+
function frameSizeOf(name) {
|
|
9110
|
+
const { width, height } = isFrameSizePreset(name) ? FRAME_SIZES[name] : DEVICE_SIZES.find((device) => device.name === name) ?? FRAME_SIZES["desktop"];
|
|
9111
|
+
return {
|
|
9112
|
+
width,
|
|
9113
|
+
height
|
|
9114
|
+
};
|
|
9115
|
+
}
|
|
9035
9116
|
// src/shared/records/board.ts
|
|
9036
9117
|
const boardFileSchema = looseObject({ version: literal(1) });
|
|
9037
9118
|
/** A project's own check rules, absent meaning the built-in rules alone. */
|
|
@@ -9173,7 +9254,8 @@ function placeFrames(frames, names) {
|
|
|
9173
9254
|
/**
|
|
9174
9255
|
* Where a frame with no layout entry sits: desktop size at `y` 0, 80 past the
|
|
9175
9256
|
* right edge of every frame already placed, on top of all of them. The board
|
|
9176
|
-
* draws what the scanner returns, and `frame add` persists the same box
|
|
9257
|
+
* draws what the scanner returns, and `frame add` persists the same box for
|
|
9258
|
+
* the first unplaced file, placing any other past the placed frames alone.
|
|
9177
9259
|
*/
|
|
9178
9260
|
function placeNext(placed) {
|
|
9179
9261
|
const right = Math.max(...placed.map(({ box }) => box.x + box.width + 80), 0);
|
|
@@ -9333,7 +9415,7 @@ async function isDirectory(path) {
|
|
|
9333
9415
|
}
|
|
9334
9416
|
}
|
|
9335
9417
|
// package.json
|
|
9336
|
-
var version$1 = "0.
|
|
9418
|
+
var version$1 = "0.15.0";
|
|
9337
9419
|
var dependencies = { "playwright-core": "1.64.1" };
|
|
9338
9420
|
// src/shared/version.ts
|
|
9339
9421
|
const version = version$1;
|
|
@@ -9589,8 +9671,9 @@ async function framePathParts(root, ref, cwd) {
|
|
|
9589
9671
|
// src/server/board/frames.ts
|
|
9590
9672
|
/**
|
|
9591
9673
|
* Places a frame on its page, writing a skeleton file only when none exists.
|
|
9592
|
-
* A file with no entry keeps its bytes and
|
|
9593
|
-
*
|
|
9674
|
+
* A file with no entry keeps its bytes and lands 80 past the placed frames,
|
|
9675
|
+
* as `placeNext` puts it, ignoring the page's other unplaced files, unless a
|
|
9676
|
+
* size or position is given. Every axis no size names hugs its
|
|
9594
9677
|
* content, a preset fixing the width alone, and the box stands in until the
|
|
9595
9678
|
* server measures.
|
|
9596
9679
|
*/
|
|
@@ -9607,7 +9690,8 @@ async function addFrame(root, ref, options) {
|
|
|
9607
9690
|
const exists = existsSync(frame.path);
|
|
9608
9691
|
if (exists && layout.hasEntry(frame.name)) throw new FrameboardError("name-taken", `${frame.project}/${frame.page}/${frame.name} is already a placed frame.`, { ref: refOf(frame) });
|
|
9609
9692
|
const names = exists ? layout.names : [...layout.names, frame.name].sort();
|
|
9610
|
-
const
|
|
9693
|
+
const slot = names.filter((name) => name === frame.name || layout.hasEntry(name));
|
|
9694
|
+
const computed = placeFrames(layout.file.frames, slot).get(frame.name);
|
|
9611
9695
|
if (!computed) throw new Error(`No placement computed for ${frame.name}.`);
|
|
9612
9696
|
if (!exists) {
|
|
9613
9697
|
await writeFile(frame.path, skeleton(frame.name), { flag: "wx" });
|
|
@@ -9900,7 +9984,7 @@ function sizeOf({ size, width, height }) {
|
|
|
9900
9984
|
width,
|
|
9901
9985
|
height
|
|
9902
9986
|
});
|
|
9903
|
-
if (size !== void 0) return
|
|
9987
|
+
if (size !== void 0) return frameSizeOf(size);
|
|
9904
9988
|
return {
|
|
9905
9989
|
...width === void 0 ? {} : { width },
|
|
9906
9990
|
...height === void 0 ? {} : { height }
|
|
@@ -36853,7 +36937,7 @@ const refs = array$1(ref).min(1).max(1e3);
|
|
|
36853
36937
|
const coordinate = int$1();
|
|
36854
36938
|
const frameAddSchema = object$1({
|
|
36855
36939
|
ref,
|
|
36856
|
-
size: _enum$1(
|
|
36940
|
+
size: _enum$1(FRAME_SIZE_NAMES).optional(),
|
|
36857
36941
|
width: int$1().min(1).optional(),
|
|
36858
36942
|
height: int$1().min(1).optional(),
|
|
36859
36943
|
x: coordinate.optional(),
|
|
@@ -38753,10 +38837,45 @@ function readContentSize() {
|
|
|
38753
38837
|
for (let parent = element.parentElement; parent && parent !== document.body; parent = parent.parentElement) if (crops(parent)) return true;
|
|
38754
38838
|
return false;
|
|
38755
38839
|
};
|
|
38840
|
+
const hangOf = (lineHeight, height) => lineHeight < height ? (height - lineHeight) / 2 : 0;
|
|
38841
|
+
const textBottom = (element) => {
|
|
38842
|
+
let bottom = -Infinity;
|
|
38843
|
+
if (crops(element)) return bottom;
|
|
38844
|
+
const lineHeight = parseFloat(getComputedStyle(element).lineHeight);
|
|
38845
|
+
for (const child of element.childNodes) {
|
|
38846
|
+
if (child.nodeType !== Node.TEXT_NODE) continue;
|
|
38847
|
+
const range = document.createRange();
|
|
38848
|
+
range.selectNodeContents(child);
|
|
38849
|
+
for (const rect of range.getClientRects()) {
|
|
38850
|
+
if (rect.width === 0 && rect.height === 0) continue;
|
|
38851
|
+
bottom = Math.max(bottom, rect.bottom - hangOf(lineHeight, rect.height));
|
|
38852
|
+
}
|
|
38853
|
+
}
|
|
38854
|
+
return bottom;
|
|
38855
|
+
};
|
|
38856
|
+
const replaced = [
|
|
38857
|
+
"img",
|
|
38858
|
+
"video",
|
|
38859
|
+
"canvas",
|
|
38860
|
+
"iframe",
|
|
38861
|
+
"object",
|
|
38862
|
+
"embed",
|
|
38863
|
+
"audio"
|
|
38864
|
+
];
|
|
38865
|
+
const ownBottom = (element) => {
|
|
38866
|
+
const rect = element.getBoundingClientRect();
|
|
38867
|
+
if (element.namespaceURI !== "http://www.w3.org/1999/xhtml") return rect.bottom;
|
|
38868
|
+
if (replaced.includes(element.localName)) return rect.bottom;
|
|
38869
|
+
const style = getComputedStyle(element);
|
|
38870
|
+
if (style.display !== "inline") return rect.bottom;
|
|
38871
|
+
if (parseFloat(style.paddingBottom) + parseFloat(style.borderBottomWidth) > 0) return rect.bottom;
|
|
38872
|
+
const above = parseFloat(style.paddingTop) + parseFloat(style.borderTopWidth);
|
|
38873
|
+
return rect.bottom - hangOf(parseFloat(style.lineHeight), rect.height - above);
|
|
38874
|
+
};
|
|
38756
38875
|
let bottom = root.getBoundingClientRect().bottom;
|
|
38757
38876
|
for (const element of document.querySelectorAll("body *")) {
|
|
38758
38877
|
if (isCropped(element)) continue;
|
|
38759
|
-
bottom = Math.max(bottom, element
|
|
38878
|
+
bottom = Math.max(bottom, ownBottom(element), textBottom(element));
|
|
38760
38879
|
}
|
|
38761
38880
|
return {
|
|
38762
38881
|
height: Math.max(1, Math.ceil(bottom + window.scrollY)),
|
|
@@ -38881,6 +39000,48 @@ function readLayout() {
|
|
|
38881
39000
|
for (let parent = element.parentElement; parent && parent !== document.body; parent = parent.parentElement) if (crops(parent)) return true;
|
|
38882
39001
|
return false;
|
|
38883
39002
|
};
|
|
39003
|
+
const hangOf = (lineHeight, height) => lineHeight < height ? (height - lineHeight) / 2 : 0;
|
|
39004
|
+
const textReach = (element) => {
|
|
39005
|
+
let bottom = -Infinity;
|
|
39006
|
+
let right = -Infinity;
|
|
39007
|
+
if (crops(element)) return {
|
|
39008
|
+
bottom,
|
|
39009
|
+
right
|
|
39010
|
+
};
|
|
39011
|
+
const lineHeight = parseFloat(getComputedStyle(element).lineHeight);
|
|
39012
|
+
for (const child of element.childNodes) {
|
|
39013
|
+
if (child.nodeType !== Node.TEXT_NODE) continue;
|
|
39014
|
+
const range = document.createRange();
|
|
39015
|
+
range.selectNodeContents(child);
|
|
39016
|
+
for (const rect of range.getClientRects()) {
|
|
39017
|
+
if (rect.width === 0 && rect.height === 0) continue;
|
|
39018
|
+
bottom = Math.max(bottom, rect.bottom - hangOf(lineHeight, rect.height));
|
|
39019
|
+
right = Math.max(right, rect.right);
|
|
39020
|
+
}
|
|
39021
|
+
}
|
|
39022
|
+
return {
|
|
39023
|
+
bottom,
|
|
39024
|
+
right
|
|
39025
|
+
};
|
|
39026
|
+
};
|
|
39027
|
+
const replaced = [
|
|
39028
|
+
"img",
|
|
39029
|
+
"video",
|
|
39030
|
+
"canvas",
|
|
39031
|
+
"iframe",
|
|
39032
|
+
"object",
|
|
39033
|
+
"embed",
|
|
39034
|
+
"audio"
|
|
39035
|
+
];
|
|
39036
|
+
const ownBottom = (element, rect) => {
|
|
39037
|
+
if (element.namespaceURI !== "http://www.w3.org/1999/xhtml") return rect.bottom;
|
|
39038
|
+
if (replaced.includes(element.localName)) return rect.bottom;
|
|
39039
|
+
const style = getComputedStyle(element);
|
|
39040
|
+
if (style.display !== "inline") return rect.bottom;
|
|
39041
|
+
if (parseFloat(style.paddingBottom) + parseFloat(style.borderBottomWidth) > 0) return rect.bottom;
|
|
39042
|
+
const above = parseFloat(style.paddingTop) + parseFloat(style.borderTopWidth);
|
|
39043
|
+
return rect.bottom - hangOf(parseFloat(style.lineHeight), rect.height - above);
|
|
39044
|
+
};
|
|
38884
39045
|
const rootRect = root.getBoundingClientRect();
|
|
38885
39046
|
let index = 0;
|
|
38886
39047
|
for (const node of document.querySelectorAll("*")) {
|
|
@@ -38890,13 +39051,14 @@ function readLayout() {
|
|
|
38890
39051
|
if (!(node instanceof HTMLElement || node instanceof SVGElement)) continue;
|
|
38891
39052
|
if (node === root || node === document.body || !document.body.contains(node)) continue;
|
|
38892
39053
|
const rect = node.getBoundingClientRect();
|
|
38893
|
-
|
|
39054
|
+
const text = textReach(node);
|
|
39055
|
+
if (rect.width === 0 && rect.height === 0 && text.right === -Infinity) continue;
|
|
38894
39056
|
const tag = node.tagName.toLowerCase();
|
|
38895
39057
|
boxes.push({
|
|
38896
39058
|
index: own,
|
|
38897
39059
|
tag,
|
|
38898
|
-
bottom: Math.ceil(rect.bottom + window.scrollY),
|
|
38899
|
-
right: Math.ceil(rect.right + window.scrollX),
|
|
39060
|
+
bottom: Math.ceil(Math.max(ownBottom(node, rect), text.bottom) + window.scrollY),
|
|
39061
|
+
right: Math.ceil(Math.max(rect.right, text.right) + window.scrollX),
|
|
38900
39062
|
height: Math.round(rect.height),
|
|
38901
39063
|
cropped: isCropped(node)
|
|
38902
39064
|
});
|
|
@@ -39604,15 +39766,15 @@ function contentFormat() {
|
|
|
39604
39766
|
reservedPageNames: [...RESERVED_PAGE_NAMES],
|
|
39605
39767
|
collision: "Two names collide when they match case-insensitively. A verb choosing a name itself takes the first free -2, -3, and onward."
|
|
39606
39768
|
},
|
|
39607
|
-
frameSizes:
|
|
39769
|
+
frameSizes: Object.fromEntries(FRAME_SIZE_NAMES.map((name) => [name, frameSizeOf(name)])),
|
|
39608
39770
|
defaultFrameSize: DEFAULT_FRAME_SIZE,
|
|
39609
39771
|
layout: [
|
|
39610
39772
|
"x and y are integers, width and height integers of at least 1, and order an integer of at least 0, where a higher order draws on top.",
|
|
39611
39773
|
"hidden, locked, hugWidth, and hugHeight read as false when absent, and an axis whose hug flag is false holds the size its entry states.",
|
|
39612
|
-
`An axis that hugs takes its size from the frame's content: a running serve measures it after each write to the frame file, its width at most ${FRAME_SIZES.desktop.width} px, and writes width and height alone, never a flag. Content sized off the viewport keeps the box it has.`,
|
|
39774
|
+
`An axis that hugs takes its size from the frame's content: a running serve measures it after each write to the frame file and when frame add places a file already written, its width at most ${FRAME_SIZES.desktop.width} px, and writes width and height alone, never a flag. Content sized off the viewport keeps the box it has.`,
|
|
39613
39775
|
"frame add with no size hugs both axes, --size or --width fixes the width and hugs the height, and --height fixes the height alone, its box standing in until serve measures. frame resize and a hand resize fix each axis they set, and frame fit sets the height and turns hugHeight on.",
|
|
39614
39776
|
"Frames sort by order, then name, and a write that changes order renumbers the page from 0.",
|
|
39615
|
-
`A frame file with no entry is unplaced: it reads at desktop size, y 0, 80 px past the right edge of every frame placed before it in name order
|
|
39777
|
+
`A frame file with no entry is unplaced: it reads at desktop size, y 0, 80 px past the right edge of every frame placed before it in name order. frame add places it 80 px past the placed frames alone, so the first unplaced file keeps that box and any later one moves left.`,
|
|
39616
39778
|
"An entry with no frame file beside it is ignored on read and kept on write.",
|
|
39617
39779
|
`A ${LAYOUT_FILE} that does not parse is reported by list and refused by every verb writing that page, never overwritten.`,
|
|
39618
39780
|
`Moving or resizing a frame writes ${LAYOUT_FILE} alone and never the frame file.`
|
|
@@ -39860,7 +40022,7 @@ function registerFrame(program, context) {
|
|
|
39860
40022
|
const { io } = context;
|
|
39861
40023
|
const frame = program.command("frame").description("Manage frames");
|
|
39862
40024
|
const verb = (name, description) => addVerb(frame, name, description, { project: true }).argument("<frame-ref>", FRAME_REF);
|
|
39863
|
-
const withSize = (command) => command.addOption(new Option("--size <preset>", "a size preset").choices(
|
|
40025
|
+
const withSize = (command) => command.addOption(new Option("--size <preset>", "a size preset or device").choices(FRAME_SIZE_NAMES)).option("--width <n>", "width in px", parseInteger(1)).option("--height <n>", "height in px", parseInteger(1));
|
|
39864
40026
|
const withPosition = (command) => command.option("--x <n>", "board x in px", ANY_INTEGER).option("--y <n>", "board y in px", ANY_INTEGER);
|
|
39865
40027
|
const done = (record, what) => ({
|
|
39866
40028
|
data: record,
|
|
@@ -48243,6 +48405,19 @@ function frameNameOf(name) {
|
|
|
48243
48405
|
const temp = name.lastIndexOf(`${FRAME_EXTENSION}.`);
|
|
48244
48406
|
return temp > 0 ? name.slice(0, temp) : null;
|
|
48245
48407
|
}
|
|
48408
|
+
/**
|
|
48409
|
+
* The hugging frames `next` holds placed that `previous` held unplaced or
|
|
48410
|
+
* not at all, on a page whose `layout.json` is among `paths`, as one an
|
|
48411
|
+
* agent wrote and then placed. Placing writes `layout.json` alone, which
|
|
48412
|
+
* reloads nothing, so these are measured without a reload. A frame that only
|
|
48413
|
+
* moved was placed in both, and one a folder rename carried has a new ref
|
|
48414
|
+
* but a batch naming the folder alone, so both are left out.
|
|
48415
|
+
*/
|
|
48416
|
+
function placedRefs(previous, next, paths) {
|
|
48417
|
+
const written = new Set(paths);
|
|
48418
|
+
const before = new Set(previous.projects.flatMap((project) => project.pages.flatMap((page) => page.frames.filter((frame) => frame.placed).map((frame) => frame.ref))));
|
|
48419
|
+
return next.projects.flatMap((project) => project.pages.filter((page) => written.has(join(page.path, LAYOUT_FILE))).flatMap((page) => page.frames.filter((frame) => frame.placed && (frame.hugWidth || frame.hugHeight) && !before.has(frame.ref)).map((frame) => frame.ref)));
|
|
48420
|
+
}
|
|
48246
48421
|
// src/server/live/findings.ts
|
|
48247
48422
|
/**
|
|
48248
48423
|
* The board's check findings, held between batches so a hello needs no
|
|
@@ -48871,6 +49046,7 @@ async function listen({ clientDir, facesDir, root, tokens, port, openUrl, launch
|
|
|
48871
49046
|
settling.add(timer);
|
|
48872
49047
|
};
|
|
48873
49048
|
const shown = { board: null };
|
|
49049
|
+
const scanned = { board: null };
|
|
48874
49050
|
let moved = [];
|
|
48875
49051
|
const recentlyMoved = () => {
|
|
48876
49052
|
moved = moved.filter(({ at }) => Date.now() - at < MOVED_MS);
|
|
@@ -49045,6 +49221,7 @@ async function listen({ clientDir, facesDir, root, tokens, port, openUrl, launch
|
|
|
49045
49221
|
let board = await scanBoard(root);
|
|
49046
49222
|
const stale = await writtenSinceLayout(board).catch(() => []);
|
|
49047
49223
|
if (await hug.now(board, stale).catch(() => false)) board = await scanBoard(root);
|
|
49224
|
+
scanned.board = board;
|
|
49048
49225
|
await tracker.prime(board);
|
|
49049
49226
|
findings.update(board, "all");
|
|
49050
49227
|
rendered.queue(board, []);
|
|
@@ -49067,7 +49244,8 @@ async function listen({ clientDir, facesDir, root, tokens, port, openUrl, launch
|
|
|
49067
49244
|
hug,
|
|
49068
49245
|
settleLater,
|
|
49069
49246
|
moved: recentlyMoved,
|
|
49070
|
-
shown
|
|
49247
|
+
shown,
|
|
49248
|
+
scanned
|
|
49071
49249
|
}));
|
|
49072
49250
|
});
|
|
49073
49251
|
return {
|
|
@@ -49105,13 +49283,20 @@ async function listen({ clientDir, facesDir, root, tokens, port, openUrl, launch
|
|
|
49105
49283
|
* notes or frames it touched, whose queue it offers to delivery. The frames
|
|
49106
49284
|
* an agent changed wait out the grace before the board hears of them.
|
|
49107
49285
|
*/
|
|
49108
|
-
async function pushBatch(root, tokens, paths, { hub, findings, rendered, delivery, tracker, claims, thumbnails, hug, settleLater, moved, shown }) {
|
|
49286
|
+
async function pushBatch(root, tokens, paths, { hub, findings, rendered, delivery, tracker, claims, thumbnails, hug, settleLater, moved, shown, scanned }) {
|
|
49109
49287
|
let board;
|
|
49110
49288
|
let own;
|
|
49289
|
+
let placed;
|
|
49111
49290
|
try {
|
|
49112
49291
|
board = await scanBoard(root);
|
|
49292
|
+
const previous = scanned.board;
|
|
49293
|
+
scanned.board = board;
|
|
49113
49294
|
own = ownFileRefs(board, paths);
|
|
49114
|
-
|
|
49295
|
+
placed = previous ? placedRefs(previous, board, paths).filter((ref) => !own.includes(ref)) : [];
|
|
49296
|
+
if (await hug.now(board, [...own, ...placed]).catch(() => false)) {
|
|
49297
|
+
board = await scanBoard(root);
|
|
49298
|
+
scanned.board = board;
|
|
49299
|
+
}
|
|
49115
49300
|
} catch {
|
|
49116
49301
|
return;
|
|
49117
49302
|
}
|
|
@@ -49122,7 +49307,7 @@ async function pushBatch(root, tokens, paths, { hub, findings, rendered, deliver
|
|
|
49122
49307
|
const last = shown.board;
|
|
49123
49308
|
shown.board = board;
|
|
49124
49309
|
const refs = reloadRefs(root, paths, board, tokens);
|
|
49125
|
-
hug.later(board, refs.filter((ref) => !own.includes(ref)));
|
|
49310
|
+
hug.later(board, refs.filter((ref) => !own.includes(ref) && !placed.includes(ref)));
|
|
49126
49311
|
if (refs.length > 0) {
|
|
49127
49312
|
const reloads = unmovedRefs(refs, board, moved(), last);
|
|
49128
49313
|
if (reloads.length > 0) hub.broadcast({
|