frameboard 0.42.0 → 0.43.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/dist/cli.js +319 -47
- package/dist/client/assets/index-CX8erJFM.js +181 -0
- package/dist/client/assets/index-KpPQ0t7L.css +2 -0
- package/dist/client/index.html +2 -2
- package/dist/frame-bridge.js +72 -72
- package/package.json +1 -1
- package/dist/client/assets/index-Broai9D9.js +0 -181
- package/dist/client/assets/index-E0z1fVUW.css +0 -2
package/dist/cli.js
CHANGED
|
@@ -9165,7 +9165,10 @@ const BEZEL_COLORS = {
|
|
|
9165
9165
|
base: "#2c2e33",
|
|
9166
9166
|
edge: "#45484f",
|
|
9167
9167
|
island: "#050506",
|
|
9168
|
-
homeBar: "rgba(128, 128, 128, 0.6)"
|
|
9168
|
+
homeBar: "rgba(128, 128, 128, 0.6)",
|
|
9169
|
+
button: "#2a2c31",
|
|
9170
|
+
islandText: "#ffffff",
|
|
9171
|
+
islandLive: "#34c759"
|
|
9169
9172
|
};
|
|
9170
9173
|
/**
|
|
9171
9174
|
* The phone's island, a generic pill standing in for a size no source gives,
|
|
@@ -9181,6 +9184,125 @@ const HOME_BAR = {
|
|
|
9181
9184
|
height: 5,
|
|
9182
9185
|
bottom: 8
|
|
9183
9186
|
};
|
|
9187
|
+
/** The island's two widths, the compact pill and the wide one a call or a timer shows. */
|
|
9188
|
+
const ISLANDS = ["compact", "wide"];
|
|
9189
|
+
/** A layout entry's `island` as an island, compact for none or a value no reader knows. */
|
|
9190
|
+
function islandOf(value) {
|
|
9191
|
+
return value === "wide" ? "wide" : "compact";
|
|
9192
|
+
}
|
|
9193
|
+
/** The wide island's width, scaled off the picked mock's ratio to the compact one. */
|
|
9194
|
+
const WIDE_ISLAND_WIDTH = 126;
|
|
9195
|
+
/** The phone's island at its picked width, the wide one holding a timer. */
|
|
9196
|
+
function phoneIsland(island) {
|
|
9197
|
+
return island === "wide" ? {
|
|
9198
|
+
...PHONE_ISLAND,
|
|
9199
|
+
width: WIDE_ISLAND_WIDTH
|
|
9200
|
+
} : { ...PHONE_ISLAND };
|
|
9201
|
+
}
|
|
9202
|
+
/** What the wide island shows, a running timer no frame sets, and the heights of the level bars beside it. */
|
|
9203
|
+
const WIDE_ISLAND_TIMER = "0:42";
|
|
9204
|
+
const WIDE_ISLAND_LEVEL = [
|
|
9205
|
+
5,
|
|
9206
|
+
9,
|
|
9207
|
+
7
|
|
9208
|
+
];
|
|
9209
|
+
/**
|
|
9210
|
+
* The phone's side buttons, each from the body's top edge, scaled off the
|
|
9211
|
+
* picked mock: the action button and two volume buttons on the left, and
|
|
9212
|
+
* the side button on the right.
|
|
9213
|
+
*/
|
|
9214
|
+
const PHONE_BUTTONS = [
|
|
9215
|
+
{
|
|
9216
|
+
side: "left",
|
|
9217
|
+
top: 142,
|
|
9218
|
+
height: 33
|
|
9219
|
+
},
|
|
9220
|
+
{
|
|
9221
|
+
side: "left",
|
|
9222
|
+
top: 195,
|
|
9223
|
+
height: 59
|
|
9224
|
+
},
|
|
9225
|
+
{
|
|
9226
|
+
side: "left",
|
|
9227
|
+
top: 266,
|
|
9228
|
+
height: 59
|
|
9229
|
+
},
|
|
9230
|
+
{
|
|
9231
|
+
side: "right",
|
|
9232
|
+
top: 222,
|
|
9233
|
+
height: 95
|
|
9234
|
+
}
|
|
9235
|
+
];
|
|
9236
|
+
/**
|
|
9237
|
+
* The phone's status bar, ending 10 below the island so a page under it
|
|
9238
|
+
* clears the island, its time and marks in the island's band `side` in from
|
|
9239
|
+
* each edge, past the screen's corner arc.
|
|
9240
|
+
*/
|
|
9241
|
+
const STATUS_BAR = {
|
|
9242
|
+
height: PHONE_ISLAND.top + PHONE_ISLAND.height + 10,
|
|
9243
|
+
band: {
|
|
9244
|
+
top: PHONE_ISLAND.top,
|
|
9245
|
+
height: PHONE_ISLAND.height
|
|
9246
|
+
},
|
|
9247
|
+
side: 40,
|
|
9248
|
+
time: "9:41",
|
|
9249
|
+
font: 16
|
|
9250
|
+
};
|
|
9251
|
+
/** The face the status bar and the wide island draw in, a system face every surface holds. */
|
|
9252
|
+
const STATUS_FONT = "system-ui, -apple-system, sans-serif";
|
|
9253
|
+
/** The status bar's signal bars, shortest first, and its battery, each in points. */
|
|
9254
|
+
const SIGNAL_BARS = [
|
|
9255
|
+
4,
|
|
9256
|
+
6.5,
|
|
9257
|
+
9,
|
|
9258
|
+
11.5
|
|
9259
|
+
];
|
|
9260
|
+
const BATTERY = {
|
|
9261
|
+
width: 25,
|
|
9262
|
+
height: 12,
|
|
9263
|
+
radius: 3.5,
|
|
9264
|
+
cap: 2
|
|
9265
|
+
};
|
|
9266
|
+
/** The height the device's status bar takes off the top of a frame's box, 0 for any device but the phone. */
|
|
9267
|
+
function topInset(device) {
|
|
9268
|
+
return device === "phone" ? STATUS_BAR.height : 0;
|
|
9269
|
+
}
|
|
9270
|
+
/**
|
|
9271
|
+
* The page's box inside a frame's box, the box less the status bar while a
|
|
9272
|
+
* phone shows and the box itself on every other device or none. A frame's
|
|
9273
|
+
* box keeps the screen's size, and every surface reads the page through this.
|
|
9274
|
+
*/
|
|
9275
|
+
function pageBox(box, device) {
|
|
9276
|
+
const inset = topInset(device);
|
|
9277
|
+
return {
|
|
9278
|
+
x: box.x,
|
|
9279
|
+
y: box.y + inset,
|
|
9280
|
+
width: box.width,
|
|
9281
|
+
height: Math.max(0, box.height - inset)
|
|
9282
|
+
};
|
|
9283
|
+
}
|
|
9284
|
+
/** The page's corners as a CSS `border-radius`, square on top under a phone's status bar. */
|
|
9285
|
+
function pageCorners(device) {
|
|
9286
|
+
if (device !== "phone") return screenCorners(device);
|
|
9287
|
+
const { screenRadius } = BEZELS.phone;
|
|
9288
|
+
return `0 0 ${screenRadius}px ${screenRadius}px`;
|
|
9289
|
+
}
|
|
9290
|
+
/**
|
|
9291
|
+
* The fill a page shows at its top and its text color, read off its root and
|
|
9292
|
+
* then its body as the browser paints the canvas. Self-contained, so a
|
|
9293
|
+
* browser runs it in the page by its source alone.
|
|
9294
|
+
*/
|
|
9295
|
+
function pageColors(doc = document) {
|
|
9296
|
+
const view = doc.defaultView;
|
|
9297
|
+
const read = (element) => element && view ? view.getComputedStyle(element) : null;
|
|
9298
|
+
const root = read(doc.documentElement);
|
|
9299
|
+
const body = read(doc.body);
|
|
9300
|
+
const painted = (color) => color !== void 0 && color !== "transparent" && !/^rgba\(.*,\s*0\)$/.test(color);
|
|
9301
|
+
return {
|
|
9302
|
+
fill: [root?.backgroundColor, body?.backgroundColor].find(painted) ?? null,
|
|
9303
|
+
ink: body?.color ?? root?.color ?? "CanvasText"
|
|
9304
|
+
};
|
|
9305
|
+
}
|
|
9184
9306
|
/** The ways a foldable is held, each a screen the frame's box takes the size of. */
|
|
9185
9307
|
const POSES = [
|
|
9186
9308
|
"closed",
|
|
@@ -9266,6 +9388,11 @@ function laptopParts({ width, height }) {
|
|
|
9266
9388
|
}
|
|
9267
9389
|
};
|
|
9268
9390
|
}
|
|
9391
|
+
/** How far a device's parts stand past its body's sides, a laptop's base or a phone's buttons. */
|
|
9392
|
+
function sideReach(device, width) {
|
|
9393
|
+
if (device === "laptop") return baseReach(width);
|
|
9394
|
+
return device === "phone" ? 4 : 0;
|
|
9395
|
+
}
|
|
9269
9396
|
function baseReach(width) {
|
|
9270
9397
|
return Math.round((width + 2 * BEZELS.laptop.border) * LAPTOP_BASE.reach);
|
|
9271
9398
|
}
|
|
@@ -9284,13 +9411,13 @@ function bezelShadow(device, { board = true } = {}) {
|
|
|
9284
9411
|
}
|
|
9285
9412
|
/**
|
|
9286
9413
|
* The box a device's body covers around a frame's box, the box itself with
|
|
9287
|
-
* none. A laptop's base reaches past its lid
|
|
9288
|
-
* than
|
|
9414
|
+
* none. A laptop's base reaches past its lid and a phone's buttons past its
|
|
9415
|
+
* sides, so their sides grow by more than their top.
|
|
9289
9416
|
*/
|
|
9290
9417
|
function bezelBox(box, device) {
|
|
9291
9418
|
if (!device) return { ...box };
|
|
9292
9419
|
const { border, bottom } = BEZELS[device];
|
|
9293
|
-
const side =
|
|
9420
|
+
const side = border + sideReach(device, box.width);
|
|
9294
9421
|
return {
|
|
9295
9422
|
x: box.x - side,
|
|
9296
9423
|
y: box.y - border,
|
|
@@ -9809,6 +9936,7 @@ const layoutEntrySchema = looseObject({
|
|
|
9809
9936
|
device: unknown().optional(),
|
|
9810
9937
|
foldable: unknown().optional(),
|
|
9811
9938
|
pose: unknown().optional(),
|
|
9939
|
+
island: unknown().optional(),
|
|
9812
9940
|
transition: unknown().optional(),
|
|
9813
9941
|
speakerNotes: unknown().optional(),
|
|
9814
9942
|
kit: unknown().optional()
|
|
@@ -24812,6 +24940,7 @@ function placeFrames(frames, names, readTransition = storedTransitionOf) {
|
|
|
24812
24940
|
pose: poseOf(entry.pose)
|
|
24813
24941
|
} : {},
|
|
24814
24942
|
...foldable && kept.length > 0 ? { keptWidths: kept } : {},
|
|
24943
|
+
...islandOf(entry.island) === "wide" ? { island: "wide" } : {},
|
|
24815
24944
|
...transition ? { transition } : {},
|
|
24816
24945
|
...speakerNotes ? { speakerNotes } : {},
|
|
24817
24946
|
...kit ? { kit } : {},
|
|
@@ -25043,7 +25172,7 @@ async function isDirectory(path) {
|
|
|
25043
25172
|
}
|
|
25044
25173
|
}
|
|
25045
25174
|
// package.json
|
|
25046
|
-
var version$1 = "0.
|
|
25175
|
+
var version$1 = "0.43.0";
|
|
25047
25176
|
var dependencies = { "playwright-core": "1.65.0" };
|
|
25048
25177
|
var peerDependencies = { "oxfmt": "0.78.0" };
|
|
25049
25178
|
// src/shared/version.ts
|
|
@@ -25834,18 +25963,24 @@ async function setFrameFlag(root, ref, flag, { on, ...options }) {
|
|
|
25834
25963
|
* it, never writing the frame's file. Naming a foldable shows it and, as a
|
|
25835
25964
|
* pose does, sets the box to that pose's screen, fixed on both axes.
|
|
25836
25965
|
*/
|
|
25837
|
-
async function setFrameDevice(root, ref, show, { foldable: name, pose: fold, ...options }) {
|
|
25966
|
+
async function setFrameDevice(root, ref, show, { foldable: name, pose: fold, island: pick, ...options }) {
|
|
25838
25967
|
return updatePlacement(root, ref, options, (placement, frameRef) => {
|
|
25839
|
-
const { showDevice: held, device: _device, foldable: named, pose: stored, keptWidths, ...rest } = placement;
|
|
25968
|
+
const { showDevice: held, device: _device, foldable: named, pose: stored, keptWidths, island: picked, ...rest } = placement;
|
|
25840
25969
|
const foldable = name ?? named === true;
|
|
25841
25970
|
if (fold && !foldable) throw new FrameboardError("usage", `${frameRef} is not a foldable, so it has no pose. Name it with --foldable first.`, {
|
|
25842
25971
|
ref: frameRef,
|
|
25843
25972
|
pose: fold
|
|
25844
25973
|
});
|
|
25974
|
+
if (pick && (foldable || deviceForWidth(placement.box.width) !== "phone")) throw new FrameboardError("usage", `${frameRef} draws no phone, so it has no island. A frame 320 to 479 px wide that names no foldable draws one.`, {
|
|
25975
|
+
ref: frameRef,
|
|
25976
|
+
island: pick
|
|
25977
|
+
});
|
|
25978
|
+
const island = pick ?? islandOf(picked);
|
|
25845
25979
|
const shown = show ?? (name === true || held === true);
|
|
25846
25980
|
const base = {
|
|
25847
25981
|
...rest,
|
|
25848
|
-
...shown ? { showDevice: true } : {}
|
|
25982
|
+
...shown ? { showDevice: true } : {},
|
|
25983
|
+
...island === "wide" ? { island } : {}
|
|
25849
25984
|
};
|
|
25850
25985
|
if (!foldable) {
|
|
25851
25986
|
const widths = (keptWidths ?? rest.widths).filter((linked) => linked.width !== placement.box.width);
|
|
@@ -26028,7 +26163,7 @@ var PageLayout = class {
|
|
|
26028
26163
|
* Writes the fixed keys after the entry's own, so unknown keys survive, and a
|
|
26029
26164
|
* flag only once on or already held, so an older entry gains no key.
|
|
26030
26165
|
*/
|
|
26031
|
-
set(name, { box, order, hidden, locked, scroll, widths, showDevice, foldable, pose, keptWidths, transition, speakerNotes, kit, hugWidth: hugsWidth, hugHeight: hugsHeight }) {
|
|
26166
|
+
set(name, { box, order, hidden, locked, scroll, widths, showDevice, foldable, pose, keptWidths, island, transition, speakerNotes, kit, hugWidth: hugsWidth, hugHeight: hugsHeight }) {
|
|
26032
26167
|
const hugWidth = hugsWidth && !scroll;
|
|
26033
26168
|
const hugHeight = hugsHeight && !scroll;
|
|
26034
26169
|
const held = this.file.frames[name];
|
|
@@ -26052,6 +26187,7 @@ var PageLayout = class {
|
|
|
26052
26187
|
...showDevice ? { showDevice } : {},
|
|
26053
26188
|
...foldable ? { foldable } : {},
|
|
26054
26189
|
...foldable && pose && (held?.foldable !== true || poseOf(held.pose) !== pose) ? { pose } : {},
|
|
26190
|
+
...island ? { island } : {},
|
|
26055
26191
|
...transition ? { transition: { ...transition } } : {},
|
|
26056
26192
|
...speakerNotes ? { speakerNotes } : {},
|
|
26057
26193
|
...kit ? { kit } : {}
|
|
@@ -26062,6 +26198,7 @@ var PageLayout = class {
|
|
|
26062
26198
|
delete entry.pose;
|
|
26063
26199
|
}
|
|
26064
26200
|
if (!showDevice && held?.showDevice === true) delete entry.showDevice;
|
|
26201
|
+
if (!island && islandOf(held?.island) === "wide") delete entry.island;
|
|
26065
26202
|
if (typeof held?.device === "string") delete entry.device;
|
|
26066
26203
|
if (!transition && storedTransitionOf(held?.transition)) delete entry.transition;
|
|
26067
26204
|
if (!speakerNotes && speakerNotesOf(held?.speakerNotes)) delete entry.speakerNotes;
|
|
@@ -45324,13 +45461,15 @@ function createWarmRenderer({ baseUrl, browser, scale: defaultScale }) {
|
|
|
45324
45461
|
const opened = await openFrame(open, {
|
|
45325
45462
|
baseUrl: baseUrl(),
|
|
45326
45463
|
ref: frame.ref,
|
|
45327
|
-
box: frame.box,
|
|
45464
|
+
box: pageSize(frame.box, device),
|
|
45328
45465
|
theme,
|
|
45329
45466
|
scale
|
|
45330
45467
|
});
|
|
45331
45468
|
let shot;
|
|
45469
|
+
let colors = null;
|
|
45332
45470
|
try {
|
|
45333
45471
|
await hideControls(opened.page);
|
|
45472
|
+
if (topInset(device) > 0) colors = await readPageColors(opened.page);
|
|
45334
45473
|
shot = element === void 0 ? await opened.page.screenshot({
|
|
45335
45474
|
animations: "disabled",
|
|
45336
45475
|
caret: "hide"
|
|
@@ -45340,7 +45479,12 @@ function createWarmRenderer({ baseUrl, browser, scale: defaultScale }) {
|
|
|
45340
45479
|
}
|
|
45341
45480
|
return device ? drawBezel(open, shot, frame.box, {
|
|
45342
45481
|
device,
|
|
45343
|
-
pose: frame.pose
|
|
45482
|
+
pose: frame.pose,
|
|
45483
|
+
island: frame.island,
|
|
45484
|
+
bar: {
|
|
45485
|
+
colors,
|
|
45486
|
+
theme
|
|
45487
|
+
}
|
|
45344
45488
|
}, scale) : shot;
|
|
45345
45489
|
});
|
|
45346
45490
|
queue = run.catch(() => {});
|
|
@@ -45379,12 +45523,17 @@ async function shootElement(page, ref, index, scale) {
|
|
|
45379
45523
|
* A frame's shot drawn inside a device's body, as the board draws it, on a
|
|
45380
45524
|
* page the size of the body, so the PNG holds the body and nothing past it.
|
|
45381
45525
|
*/
|
|
45382
|
-
async function drawBezel(browser, shot, box, { device, pose = "closed" }, scale) {
|
|
45526
|
+
async function drawBezel(browser, shot, box, { device, pose = "closed", island = "compact", bar }, scale) {
|
|
45383
45527
|
const outer = bezelBox({
|
|
45384
45528
|
x: 0,
|
|
45385
45529
|
y: 0,
|
|
45386
45530
|
...box
|
|
45387
45531
|
}, device);
|
|
45532
|
+
const page = pageBox({
|
|
45533
|
+
x: 0,
|
|
45534
|
+
y: 0,
|
|
45535
|
+
...box
|
|
45536
|
+
}, device);
|
|
45388
45537
|
const laptop = device === "laptop";
|
|
45389
45538
|
const context = await browser.newContext({
|
|
45390
45539
|
viewport: {
|
|
@@ -45394,11 +45543,11 @@ async function drawBezel(browser, shot, box, { device, pose = "closed" }, scale)
|
|
|
45394
45543
|
deviceScaleFactor: scale
|
|
45395
45544
|
});
|
|
45396
45545
|
try {
|
|
45397
|
-
const
|
|
45398
|
-
const marks = device === "phone" ?
|
|
45546
|
+
const tab = await context.newPage();
|
|
45547
|
+
const marks = device === "phone" ? statusBarHtml(bar.colors, bar.theme) + phoneMarks(island) : laptop ? laptopMarks(box) : device === "foldable" ? foldableMarks(pose) : "";
|
|
45399
45548
|
const radius = screenCorners(device);
|
|
45400
|
-
await
|
|
45401
|
-
return await
|
|
45549
|
+
await tab.setContent(`<!doctype html><html><body style="margin:0;background:transparent"><div style="position:absolute;left:${-outer.x}px;top:${-outer.y}px;width:${box.width}px;height:${box.height}px"><img alt="" src="data:image/png;base64,${shot.toString("base64")}" style="position:absolute;left:0;top:${page.y}px;width:${page.width}px;height:${page.height}px;border-radius:${pageCorners(device)}"><div style="position:absolute;inset:0;border-radius:${radius};box-shadow:${bezelShadow(device, { board: false })}">${marks}</div></div></body></html>`, { waitUntil: "load" });
|
|
45550
|
+
return await tab.screenshot({
|
|
45402
45551
|
omitBackground: true,
|
|
45403
45552
|
caret: "hide"
|
|
45404
45553
|
});
|
|
@@ -45407,6 +45556,56 @@ async function drawBezel(browser, shot, box, { device, pose = "closed" }, scale)
|
|
|
45407
45556
|
}
|
|
45408
45557
|
}
|
|
45409
45558
|
/**
|
|
45559
|
+
* A phone frame's shot of its page set under the status bar, at the frame's
|
|
45560
|
+
* box with no body, so a capture holds the screen the board draws.
|
|
45561
|
+
*/
|
|
45562
|
+
async function underStatusBar(browser, shot, box, { colors, theme }, scale) {
|
|
45563
|
+
const page = pageBox({
|
|
45564
|
+
x: 0,
|
|
45565
|
+
y: 0,
|
|
45566
|
+
...box
|
|
45567
|
+
}, "phone");
|
|
45568
|
+
const context = await browser.newContext({
|
|
45569
|
+
viewport: box,
|
|
45570
|
+
deviceScaleFactor: scale
|
|
45571
|
+
});
|
|
45572
|
+
try {
|
|
45573
|
+
const tab = await context.newPage();
|
|
45574
|
+
await tab.setContent(`<!doctype html><html><body style="margin:0;position:relative;width:${box.width}px;height:${box.height}px"><img alt="" src="data:image/png;base64,${shot.toString("base64")}" style="position:absolute;left:0;top:${page.y}px;width:${page.width}px;height:${page.height}px">` + statusBarHtml(colors, theme, { rounded: false }) + `</body></html>`, { waitUntil: "load" });
|
|
45575
|
+
return await tab.screenshot({ caret: "hide" });
|
|
45576
|
+
} finally {
|
|
45577
|
+
await context.close();
|
|
45578
|
+
}
|
|
45579
|
+
}
|
|
45580
|
+
/** A loaded page's fill and text color, which the browser reads off its own document. */
|
|
45581
|
+
function readPageColors(page) {
|
|
45582
|
+
return page.evaluate(pageColors);
|
|
45583
|
+
}
|
|
45584
|
+
/** The viewport a frame's page opens at, its box less a phone's status bar, at least one pixel tall. */
|
|
45585
|
+
function pageSize(box, device) {
|
|
45586
|
+
const page = pageBox({
|
|
45587
|
+
x: 0,
|
|
45588
|
+
y: 0,
|
|
45589
|
+
...box
|
|
45590
|
+
}, device);
|
|
45591
|
+
return {
|
|
45592
|
+
width: page.width,
|
|
45593
|
+
height: Math.max(1, page.height)
|
|
45594
|
+
};
|
|
45595
|
+
}
|
|
45596
|
+
/**
|
|
45597
|
+
* The phone's status bar as the board draws it, in the page's fill and text
|
|
45598
|
+
* color or its theme's own, its top corners rounded to the screen inside a
|
|
45599
|
+
* body and square on a frame's bare box.
|
|
45600
|
+
*/
|
|
45601
|
+
function statusBarHtml(colors, theme, { rounded = true } = {}) {
|
|
45602
|
+
const { screenRadius } = BEZELS.phone;
|
|
45603
|
+
const corners = rounded ? `${screenRadius}px ${screenRadius}px 0 0` : "0";
|
|
45604
|
+
const signal = SIGNAL_BARS.map((tall) => `<span style="width:3px;height:${tall}px;border-radius:1px;background:currentColor"></span>`).join("");
|
|
45605
|
+
const battery = `<span style="display:flex;align-items:center"><span style="box-sizing:border-box;display:flex;align-items:center;width:${BATTERY.width}px;height:${BATTERY.height}px;border:1px solid currentColor;border-radius:${BATTERY.radius}px;padding:1.5px;opacity:.9"><span style="width:80%;height:100%;border-radius:2px;background:currentColor"></span></span><span style="width:${BATTERY.cap}px;height:4px;margin-left:1px;border-radius:0 1px 1px 0;background:currentColor;opacity:.6"></span></span>`;
|
|
45606
|
+
return `<div style="position:absolute;left:0;right:0;top:0;height:${STATUS_BAR.height}px;border-radius:${corners};color-scheme:${theme};background:${colors?.fill ?? "Canvas"};color:${colors?.ink ?? "CanvasText"}"><div style="position:absolute;left:0;right:0;top:${STATUS_BAR.band.top}px;height:${STATUS_BAR.band.height}px;box-sizing:border-box;display:flex;align-items:center;justify-content:space-between;padding:0 ${STATUS_BAR.side}px;font:600 ${STATUS_BAR.font}px/1 ${STATUS_FONT};font-variant-numeric:tabular-nums"><span>${STATUS_BAR.time}</span><span style="display:flex;align-items:center;gap:6px"><span style="display:flex;align-items:flex-end;gap:2px">${signal}</span>${battery}</span></div></div>`;
|
|
45607
|
+
}
|
|
45608
|
+
/**
|
|
45410
45609
|
* The laptop's chin and base as the board draws them, past the screen's
|
|
45411
45610
|
* bottom, with the body's edge as its last pixel rather than past it.
|
|
45412
45611
|
*/
|
|
@@ -45415,6 +45614,14 @@ function laptopMarks(box) {
|
|
|
45415
45614
|
const edge = `1px solid ${BEZEL_COLORS.edge}`;
|
|
45416
45615
|
return `<span style="position:absolute;box-sizing:border-box;left:${chin.x}px;top:${chin.y}px;width:${chin.width}px;height:${chin.height}px;background:${BEZEL_COLORS.body};border-left:${edge};border-right:${edge}"></span><span style="position:absolute;box-sizing:border-box;left:${base.x}px;top:${base.y}px;width:${base.width}px;height:${base.height}px;background:${BEZEL_COLORS.base};border:${edge};border-radius:0 0 ${LAPTOP_BASE.radius}px ${LAPTOP_BASE.radius}px"></span>`;
|
|
45417
45616
|
}
|
|
45617
|
+
/** The phone's buttons, island, and home bar as the board draws them. */
|
|
45618
|
+
function phoneMarks(island) {
|
|
45619
|
+
const { border } = BEZELS.phone;
|
|
45620
|
+
const buttons = PHONE_BUTTONS.map(({ side, top, height }) => `<span style="position:absolute;${side}:${-border - 4}px;top:${top - border}px;width:4px;height:${height}px;border-radius:2px;background:${BEZEL_COLORS.button}"></span>`).join("");
|
|
45621
|
+
const shape = phoneIsland(island);
|
|
45622
|
+
const timer = island === "wide" ? `<span style="display:flex;align-items:center;gap:5px"><span style="width:6px;height:6px;border-radius:3px;background:${BEZEL_COLORS.islandLive}"></span>${WIDE_ISLAND_TIMER}</span><span style="display:flex;align-items:flex-end;gap:2px">${WIDE_ISLAND_LEVEL.map((tall) => `<span style="width:2px;height:${tall}px;border-radius:1px;background:${BEZEL_COLORS.islandLive}"></span>`).join("")}</span>` : "";
|
|
45623
|
+
return buttons + `<span style="${pill(shape.width, shape.height, BEZEL_COLORS.island)}top:${shape.top}px;box-sizing:border-box;display:flex;align-items:center;justify-content:space-between;padding:0 11px;color:${BEZEL_COLORS.islandText};font:600 11px/1 ${STATUS_FONT};font-variant-numeric:tabular-nums">${timer}</span><span style="${pill(HOME_BAR.width, HOME_BAR.height, BEZEL_COLORS.homeBar)}bottom:${HOME_BAR.bottom}px"></span>`;
|
|
45624
|
+
}
|
|
45418
45625
|
/** The foldable's fold band, island, and home bar as the board draws them for a pose. */
|
|
45419
45626
|
function foldableMarks(pose) {
|
|
45420
45627
|
const band = foldBand(pose);
|
|
@@ -45520,7 +45727,7 @@ async function fitFrame(browser, { baseUrl, frame, ...options }) {
|
|
|
45520
45727
|
const measured = await measureContent(browser, {
|
|
45521
45728
|
baseUrl,
|
|
45522
45729
|
ref: frame.ref,
|
|
45523
|
-
box: frame.box,
|
|
45730
|
+
box: pageBox(frame.box, frame.device),
|
|
45524
45731
|
hugWidth: false
|
|
45525
45732
|
});
|
|
45526
45733
|
const widths = [];
|
|
@@ -45540,7 +45747,7 @@ async function fitFrame(browser, { baseUrl, frame, ...options }) {
|
|
|
45540
45747
|
});
|
|
45541
45748
|
}
|
|
45542
45749
|
return {
|
|
45543
|
-
frame: await fitHeight(options.root, frame.ref, measured.height, {
|
|
45750
|
+
frame: await fitHeight(options.root, frame.ref, measured.height + topInset(frame.device), {
|
|
45544
45751
|
...options,
|
|
45545
45752
|
widths
|
|
45546
45753
|
}),
|
|
@@ -47011,7 +47218,8 @@ const frameDeviceSchema = object$1({
|
|
|
47011
47218
|
/** Absent leaves the device as it stands, but for naming a foldable, which shows it. */
|
|
47012
47219
|
show: boolean$1().optional(),
|
|
47013
47220
|
foldable: boolean$1().optional(),
|
|
47014
|
-
pose: _enum$1(POSES).optional()
|
|
47221
|
+
pose: _enum$1(POSES).optional(),
|
|
47222
|
+
island: _enum$1(ISLANDS).optional()
|
|
47015
47223
|
});
|
|
47016
47224
|
/** More widths than any device list offers, so a body cannot grow without bound. */
|
|
47017
47225
|
const widthList = array$1(int$1().min(1)).max(64);
|
|
@@ -47388,14 +47596,15 @@ function structureRoutes(root, access, history, measure, tokens = null) {
|
|
|
47388
47596
|
data: frames
|
|
47389
47597
|
});
|
|
47390
47598
|
});
|
|
47391
|
-
/** Shows or hides each frame's device, names the foldable,
|
|
47599
|
+
/** Shows or hides each frame's device, names the foldable, folds it, or picks a phone's island, in one step, leaving every frame file alone. */
|
|
47392
47600
|
app.post("/api/frame/device", async (c) => {
|
|
47393
47601
|
const body = await parseBody$1(c.req.raw, frameDeviceSchema);
|
|
47394
47602
|
const frames = await eachFrame(body.refs, (frame, journal) => setFrameDevice(root, frame, body.show, {
|
|
47395
47603
|
cwd,
|
|
47396
47604
|
journal,
|
|
47397
47605
|
foldable: body.foldable,
|
|
47398
|
-
pose: body.pose
|
|
47606
|
+
pose: body.pose,
|
|
47607
|
+
island: body.island
|
|
47399
47608
|
}), (records) => records.map((record) => record.ref));
|
|
47400
47609
|
return c.json({
|
|
47401
47610
|
ok: true,
|
|
@@ -48208,7 +48417,8 @@ async function captureMotionImages(browser, { baseUrl, frame, themes, out, scale
|
|
|
48208
48417
|
baseUrl,
|
|
48209
48418
|
frame: {
|
|
48210
48419
|
ref: frame.ref,
|
|
48211
|
-
box: view
|
|
48420
|
+
box: view,
|
|
48421
|
+
device: viewDevice(frame, view)
|
|
48212
48422
|
},
|
|
48213
48423
|
theme,
|
|
48214
48424
|
scale,
|
|
@@ -48233,6 +48443,7 @@ async function captureMotionImages(browser, { baseUrl, frame, themes, out, scale
|
|
|
48233
48443
|
baseUrl,
|
|
48234
48444
|
ref: frame.ref,
|
|
48235
48445
|
view,
|
|
48446
|
+
device: viewDevice(frame, view),
|
|
48236
48447
|
theme,
|
|
48237
48448
|
scale,
|
|
48238
48449
|
motionTimeoutMs,
|
|
@@ -48273,6 +48484,7 @@ async function renderFilmstrip(browser, { baseUrl, frame, theme, scale = 1, coun
|
|
|
48273
48484
|
baseUrl,
|
|
48274
48485
|
ref: frame.ref,
|
|
48275
48486
|
view,
|
|
48487
|
+
device: frame.device,
|
|
48276
48488
|
theme,
|
|
48277
48489
|
scale,
|
|
48278
48490
|
motionTimeoutMs,
|
|
@@ -48292,24 +48504,29 @@ async function renderFilmstrip(browser, { baseUrl, frame, theme, scale = 1, coun
|
|
|
48292
48504
|
* Opens one frame with its animation clock held, finds its timeline, and
|
|
48293
48505
|
* shoots it at each moment `moments` picks from what it found.
|
|
48294
48506
|
*/
|
|
48295
|
-
async function holdShots(browser, { baseUrl, ref, view, theme, scale, motionTimeoutMs, moments }) {
|
|
48507
|
+
async function holdShots(browser, { baseUrl, ref, view, device, theme, scale, motionTimeoutMs, moments }) {
|
|
48296
48508
|
assertScreenshotFits(ref, view, scale);
|
|
48297
48509
|
const opened = await openFrame(browser, {
|
|
48298
48510
|
baseUrl,
|
|
48299
48511
|
ref,
|
|
48300
|
-
box: view,
|
|
48512
|
+
box: pageSize(view, device),
|
|
48301
48513
|
theme,
|
|
48302
48514
|
scale,
|
|
48303
48515
|
motion: "hold"
|
|
48304
48516
|
});
|
|
48305
48517
|
try {
|
|
48306
48518
|
const motion = await findMotion(opened.page, ref, motionTimeoutMs);
|
|
48519
|
+
const colors = topInset(device) > 0 ? await readPageColors(opened.page) : null;
|
|
48307
48520
|
const held = [];
|
|
48308
48521
|
for (const moment of moments(motion)) {
|
|
48309
48522
|
const at = await seekMotion(opened.page, motion, moment);
|
|
48523
|
+
const shot = await opened.page.screenshot(HELD_SCREENSHOT);
|
|
48310
48524
|
held.push({
|
|
48311
48525
|
held: at,
|
|
48312
|
-
bytes: await
|
|
48526
|
+
bytes: colors ? await underStatusBar(browser, shot, view, {
|
|
48527
|
+
colors,
|
|
48528
|
+
theme
|
|
48529
|
+
}, scale) : shot
|
|
48313
48530
|
});
|
|
48314
48531
|
}
|
|
48315
48532
|
return {
|
|
@@ -48322,23 +48539,35 @@ async function holdShots(browser, { baseUrl, ref, view, theme, scale, motionTime
|
|
|
48322
48539
|
await opened.close();
|
|
48323
48540
|
}
|
|
48324
48541
|
}
|
|
48542
|
+
/**
|
|
48543
|
+
* The device a view draws its page under: the frame's own while the view
|
|
48544
|
+
* is the frame's own box, and none at a linked width, which draws no device.
|
|
48545
|
+
*/
|
|
48546
|
+
function viewDevice(frame, view) {
|
|
48547
|
+
return view.width === frame.box.width ? frame.device : void 0;
|
|
48548
|
+
}
|
|
48325
48549
|
async function renderFrame(browser, baseUrl, frame, view, theme, scale, scroll) {
|
|
48326
48550
|
const box = {
|
|
48327
48551
|
width: view.width,
|
|
48328
48552
|
height: view.height
|
|
48329
48553
|
};
|
|
48330
48554
|
assertScreenshotFits(frame.ref, box, scale);
|
|
48555
|
+
const device = viewDevice(frame, view);
|
|
48331
48556
|
const opened = await openFrame(browser, {
|
|
48332
48557
|
baseUrl,
|
|
48333
48558
|
ref: frame.ref,
|
|
48334
|
-
box,
|
|
48559
|
+
box: pageSize(box, device),
|
|
48335
48560
|
theme,
|
|
48336
48561
|
scale
|
|
48337
48562
|
});
|
|
48338
48563
|
try {
|
|
48339
48564
|
const scrollY = scroll === void 0 ? void 0 : await opened.page.evaluate(scrollAndSettle, scroll);
|
|
48565
|
+
const shot = await opened.page.screenshot(SCREENSHOT);
|
|
48340
48566
|
return {
|
|
48341
|
-
bytes: await
|
|
48567
|
+
bytes: topInset(device) > 0 ? await underStatusBar(browser, shot, box, {
|
|
48568
|
+
colors: await readPageColors(opened.page),
|
|
48569
|
+
theme
|
|
48570
|
+
}, scale) : shot,
|
|
48342
48571
|
scrollY,
|
|
48343
48572
|
videos: opened.videos,
|
|
48344
48573
|
models: opened.models
|
|
@@ -48778,6 +49007,8 @@ const frameRecordSchema = object$1({
|
|
|
48778
49007
|
device: _enum$1(DEVICES).optional(),
|
|
48779
49008
|
/** The pose a frame naming the foldable is folded to, shown or not, absent on every other frame. */
|
|
48780
49009
|
pose: _enum$1(POSES).optional(),
|
|
49010
|
+
/** `wide` while the frame picks the phone's wide island, shown or not, absent for the compact one. */
|
|
49011
|
+
island: literal("wide").optional(),
|
|
48781
49012
|
/** The transition the frame arrives with in present mode, over its page's, absent when it holds none. */
|
|
48782
49013
|
transition: transitionRecordSchema.optional(),
|
|
48783
49014
|
/** What the presenter means to say over the slide, plain text with its line breaks, absent when it holds none. */
|
|
@@ -49364,7 +49595,9 @@ function contentFormat() {
|
|
|
49364
49595
|
"hidden, locked, hugWidth, hugHeight, and scroll read as false when absent, and an axis whose hug flag is false holds the size its entry states.",
|
|
49365
49596
|
`scroll marks a frame that holds a fixed screen height and scrolls past it, such as a page with a sticky section. It fixes both axes, so either hug flag beside it reads as false, frame fit refuses it, and serve never measures it. frame add --scroll sets it, taking the height given or else the preset height of the width (${FRAME_SIZES.desktop.height} px at ${FRAME_SIZES.desktop.width}). frame resize --scroll sets it on a placed frame, dropping a hugging height to that preset height unless a height is given and keeping a fixed height as it stands, so resize a frame fixed past a screen with --height too. frame resize --no-scroll clears it, keeping the box.`,
|
|
49366
49597
|
`widths lists the extra widths one frame file also shows at, as { width, height } objects, each drawn 80 px past the last in a row beside the frame at its y, so a responsive page is one file rather than a copy per width. Each width follows the frame's own height mode: it hugs its content at that width while hugHeight is on, and otherwise holds its height, the preset height of its width when first set and on frame resize --scroll. A value of any other shape reads as none. frame add --widths 834,390 and frame resize --widths set it, refusing a repeated width, the frame's own width, or a frame hugging its width, and frame resize --no-widths clears it. capture writes <frame>@<width>.<theme>.png beside <frame>.<theme>.png, check reports a browser finding at a linked width with that width and prints it as <path>@<width>, and a frames.json value of <project>/<page>/<frame>@<width> syncs that width's images.`,
|
|
49367
|
-
`showDevice true has the board draw the frame inside the device its width names: a phone from 320 to 479 px wide, a tablet from 480 to 1023, and a laptop from 1024 up, with none under 320. The phone's body stands ${BEZELS.phone.border} px past the box on every side and the tablet's ${BEZELS.tablet.border}, and the laptop's lid ${BEZELS.laptop.border} px past its top and sides, with a chin and a wider base below. A resize redraws the body with no write, and list reports the device the width names as device, absent when off or under 320. It never changes the frame file, its size, or its box. frame add, frame duplicate, and a paste place a frame beside another with its own body, a laptop's base included, 80 px past the other's body. A frame given --x keeps that x, a frame landing in a reserved box keeps that box with no room for a device, and a placed frame stays where it stands when its device turns on. Linked widths draw no device. Any other value of showDevice reads as off and is kept on write. A device string from before showDevice reads as on, and the entry's next write replaces it with showDevice. frame add --device on and frame device <frame-ref> <on|off> set it, taking phone and tablet as on and none as off.`,
|
|
49598
|
+
`showDevice true has the board draw the frame inside the device its width names: a phone from 320 to 479 px wide, a tablet from 480 to 1023, and a laptop from 1024 up, with none under 320. The phone's body stands ${BEZELS.phone.border} px past the box on every side, with side buttons 4 px past that, and the tablet's ${BEZELS.tablet.border}, and the laptop's lid ${BEZELS.laptop.border} px past its top and sides, with a chin and a wider base below. A resize redraws the body with no write, and list reports the device the width names as device, absent when off or under 320. It never changes the frame file, its size, or its box. frame add, frame duplicate, and a paste place a frame beside another with its own body, a laptop's base included, 80 px past the other's body. A frame given --x keeps that x, a frame landing in a reserved box keeps that box with no room for a device, and a placed frame stays where it stands when its device turns on. Linked widths draw no device. Any other value of showDevice reads as off and is kept on write. A device string from before showDevice reads as on, and the entry's next write replaces it with showDevice. frame add --device on and frame device <frame-ref> <on|off> set it, taking phone and tablet as on and none as off.`,
|
|
49599
|
+
`While a phone shows, the board draws a status bar over the top ${STATUS_BAR.height} px of the frame's box, in the page's own fill and text color, and the page starts under it: a frame ${FRAME_SIZES.phone.width} by ${FRAME_SIZES.phone.height} shows a page ${FRAME_SIZES.phone.width} by ${FRAME_SIZES.phone.height - STATUS_BAR.height}. The box in layout.json keeps the screen's size, and the frame file gains no padding. A hugging height measures the page and stores it plus the bar, frame fit does the same, and capture, check, inspect, and present each read the page under the bar. An export draws the bar only with its device included, and lays the page out at the whole box without it. A linked width draws no device and no bar. With the device off, or on any other device, the page is the whole box.`,
|
|
49600
|
+
`island wide has a phone draw its wide island, the one a call or a timer shows, and absent draws the compact one. It is kept while the device is off and reads as compact on any other device. Any other value reads as compact and is kept on write. frame device <frame-ref> --island wide sets it, --island compact clears it, and both refuse a frame whose width names no phone or that names the foldable.`,
|
|
49368
49601
|
`foldable true has the frame name the foldable device over the one its width picks, and pose folds it: closed is the cover screen at ${POSE_SIZES.closed.width} by ${POSE_SIZES.closed.height}, and half and open are the inner screen at ${POSE_SIZES.open.width} by ${POSE_SIZES.open.height}, half shading the fold. Naming a foldable or setting a pose sets the box's width and height to that screen and turns both hug flags off, and writes the layout entry alone, never the frame file, so one file shows every pose and its content reflows as on the device. The body stands ${BEZELS.foldable.border} px past the box on every side. A newly named foldable starts in the pose nearest its width, closed up to 678 px wide and open past it. list reports device as foldable while it shows, and pose on every frame naming one, shown or not. With showDevice off the box keeps its pose's size and no body draws. A foldable draws no linked width and refuses a new one, and widths its entry held from before stay in the file undrawn, draw again once --no-foldable un-names it, and clear on frame resize --no-widths. Any other value of foldable reads as width-picked, a pose no reader knows reads as closed, and both are kept on write. An older Frameboard rewriting the entry may drop both keys, leaving a width-picked frame at the pose's size. frame device <frame-ref> --foldable names it and shows it, --pose <closed|half|open> folds it, and --no-foldable hands the pick back to the width at the size it stands.`,
|
|
49369
49602
|
`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.`,
|
|
49370
49603
|
"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.",
|
|
@@ -49793,11 +50026,11 @@ const DEVICE_ON = [
|
|
|
49793
50026
|
"tablet"
|
|
49794
50027
|
];
|
|
49795
50028
|
/** What `frame device` did, naming the device the frame draws inside and a foldable's pose. */
|
|
49796
|
-
function deviceHeadline({ ref, box, showDevice, device, pose }) {
|
|
50029
|
+
function deviceHeadline({ ref, box, showDevice, device, pose, island }) {
|
|
49797
50030
|
const folded = pose ? `, folded ${pose} at ${box.width} by ${box.height}` : "";
|
|
49798
50031
|
if (!showDevice) return `Hid the device on ${ref}${folded}`;
|
|
49799
50032
|
if (!device) return `Showed the device on ${ref}, though no device fits its ${box.width} px width`;
|
|
49800
|
-
return `Showed the ${device} on ${ref}${folded}`;
|
|
50033
|
+
return `Showed the ${device} on ${ref}${folded}${device === "phone" ? ` with the ${islandOf(island)} island` : ""}`;
|
|
49801
50034
|
}
|
|
49802
50035
|
const WIDTHS_HELP = "the extra widths the frame also shows at, a comma list such as 834,390, each drawn beside it and hugging or holding its height as the frame does";
|
|
49803
50036
|
const POSITIVE = parseInteger(1);
|
|
@@ -49879,14 +50112,15 @@ function registerFrame(program, context) {
|
|
|
49879
50112
|
human: `Deleted frame ${result.deleted}`
|
|
49880
50113
|
};
|
|
49881
50114
|
});
|
|
49882
|
-
act(verb("device", "Show or hide the device the board draws around a frame, the phone, tablet, or laptop its width names or the foldable the frame names,
|
|
49883
|
-
if (value === void 0 && foldable === void 0 && pose === void 0) throw new FrameboardError("usage", "frame device takes on or off, --foldable, --no-foldable, or --
|
|
50115
|
+
act(verb("device", "Show or hide the device the board draws around a frame, the phone, tablet, or laptop its width names or the foldable the frame names, fold a foldable, and pick a phone’s island, leaving the frame file as it is").addArgument(new Argument("[on|off]", "on to show the device, off to hide it, with phone and tablet taken as on and none as off, and absent to leave it, which --foldable takes as on").choices(Object.keys(DEVICE_SWITCH))).addOption(new Option("--foldable", "name the foldable over the device the width picks, setting the box to the pose nearest its width")).addOption(new Option("--no-foldable", "hand the pick back to the width, leaving the box at its size")).addOption(new Option("--pose <pose>", "fold a foldable, setting its box to 466 by 678 closed and 890 by 626 half or open").choices(POSES)).addOption(new Option("--island <width>", "pick the phone island drawn over a frame 320 to 479 px wide, compact or the wide one a call or a timer shows").choices(ISLANDS)), context, async ([ref = "", value], { foldable, pose, island, ...options }) => {
|
|
50116
|
+
if (value === void 0 && foldable === void 0 && pose === void 0 && island === void 0) throw new FrameboardError("usage", "frame device takes on or off, --foldable, --no-foldable, --pose, or --island.");
|
|
49884
50117
|
const show = value !== void 0 && Object.hasOwn(DEVICE_SWITCH, value) ? DEVICE_SWITCH[value] : void 0;
|
|
49885
50118
|
const record = await setFrameDevice(await boardOf(options, io), ref, show, {
|
|
49886
50119
|
...options,
|
|
49887
50120
|
cwd: io.cwd,
|
|
49888
50121
|
foldable,
|
|
49889
|
-
pose
|
|
50122
|
+
pose,
|
|
50123
|
+
island
|
|
49890
50124
|
});
|
|
49891
50125
|
return {
|
|
49892
50126
|
data: record,
|
|
@@ -53815,7 +54049,7 @@ async function inspectFrame(browser, { baseUrl, frame, theme, index }) {
|
|
|
53815
54049
|
const opened = await openFrame(browser, {
|
|
53816
54050
|
baseUrl,
|
|
53817
54051
|
ref: frame.ref,
|
|
53818
|
-
box: frame.box,
|
|
54052
|
+
box: pageSize(frame.box, frame.device),
|
|
53819
54053
|
theme
|
|
53820
54054
|
});
|
|
53821
54055
|
let live;
|
|
@@ -55135,7 +55369,11 @@ async function countProject(root, project) {
|
|
|
55135
55369
|
for (const page of await listPageFolders(projectDir)) for (const name of await listFrames(join(projectDir, page))) for (const path of linkedAssets(root, project, page, name)) counts.set(path, (counts.get(path) ?? 0) + 1);
|
|
55136
55370
|
return counts;
|
|
55137
55371
|
}
|
|
55138
|
-
/**
|
|
55372
|
+
/**
|
|
55373
|
+
* The asset paths one frame links, each once, read from its file as it stands
|
|
55374
|
+
* rather than from a cached count. A frame gone between the listing and the
|
|
55375
|
+
* read links none.
|
|
55376
|
+
*/
|
|
55139
55377
|
function linkedAssets(root, project, page, name) {
|
|
55140
55378
|
const linked = /* @__PURE__ */ new Set();
|
|
55141
55379
|
let source;
|
|
@@ -55239,7 +55477,12 @@ const THEMED_RULES = [
|
|
|
55239
55477
|
* Runs every browser rule in both themes and merges them, measuring a missing
|
|
55240
55478
|
* face in the board's fallback rather than refusing, after animations finish.
|
|
55241
55479
|
*/
|
|
55242
|
-
async function checkRendered(browser, { baseUrl, root, frame, config }) {
|
|
55480
|
+
async function checkRendered(browser, { baseUrl, root, frame: shown, config }) {
|
|
55481
|
+
const { device, ...target } = shown;
|
|
55482
|
+
const frame = {
|
|
55483
|
+
...target,
|
|
55484
|
+
box: pageSize(target.box, device)
|
|
55485
|
+
};
|
|
55243
55486
|
const [project = "", page = "", name = ""] = frame.ref.split("/");
|
|
55244
55487
|
const source = readFrame$1({
|
|
55245
55488
|
root,
|
|
@@ -58649,27 +58892,41 @@ function isIgnored(root, path) {
|
|
|
58649
58892
|
* reloading nothing, since moving a frame must not restart it.
|
|
58650
58893
|
*/
|
|
58651
58894
|
function reloadRefs(root, paths, board, tokens = null) {
|
|
58652
|
-
const { refs, everyFrame } = reloadCauses(root, paths, tokens);
|
|
58895
|
+
const { refs, everyFrame, media } = reloadCauses(root, paths, tokens);
|
|
58653
58896
|
const named = [];
|
|
58654
|
-
for (const project of board.projects)
|
|
58897
|
+
for (const project of board.projects) {
|
|
58898
|
+
const changed = media.get(project.name);
|
|
58899
|
+
for (const page of project.pages) for (const frame of page.frames) if (everyFrame || refs.has(frame.ref) || refs.has(`${page.ref}/*`) || refs.has(`${project.name}/*`) || changed !== void 0 && links(root, frame, changed)) named.push(frame.ref);
|
|
58900
|
+
}
|
|
58655
58901
|
return named;
|
|
58656
58902
|
}
|
|
58903
|
+
/** Whether the frame's file, read as it stands, loads any of the changed asset paths. */
|
|
58904
|
+
function links(root, frame, changed) {
|
|
58905
|
+
for (const path of linkedAssets(root, frame.project, frame.page, frame.name)) if (changed.has(path)) return true;
|
|
58906
|
+
return false;
|
|
58907
|
+
}
|
|
58657
58908
|
/**
|
|
58658
58909
|
* The frames `reloadRefs` names through their own file alone, with no token
|
|
58659
58910
|
* sheet, asset, or other page-folder file in the batch reaching them, in
|
|
58660
58911
|
* board order. Only these reload into bytes a hash of that one file names.
|
|
58661
58912
|
*/
|
|
58662
58913
|
function ownReloadRefs(root, paths, board, tokens = null) {
|
|
58663
|
-
const { refs, everyFrame } = reloadCauses(root, paths, tokens);
|
|
58914
|
+
const { refs, everyFrame, media } = reloadCauses(root, paths, tokens);
|
|
58664
58915
|
if (everyFrame) return [];
|
|
58665
|
-
return board.projects.flatMap((project) =>
|
|
58916
|
+
return board.projects.flatMap((project) => {
|
|
58917
|
+
if (refs.has(`${project.name}/*`)) return [];
|
|
58918
|
+
const changed = media.get(project.name);
|
|
58919
|
+
return project.pages.flatMap((page) => refs.has(`${page.ref}/*`) ? [] : page.frames.filter((frame) => refs.has(frame.ref) && (changed === void 0 || !links(root, frame, changed))).map((frame) => frame.ref));
|
|
58920
|
+
});
|
|
58666
58921
|
}
|
|
58667
58922
|
/**
|
|
58668
58923
|
* What a batch's paths reach: frame refs, `<page>/*` and `<project>/*`
|
|
58669
|
-
* wildcards,
|
|
58924
|
+
* wildcards, whether a board-wide sheet reaches every frame, and per project
|
|
58925
|
+
* the placeable media under `assets/` that reach only the frames loading them.
|
|
58670
58926
|
*/
|
|
58671
58927
|
function reloadCauses(root, paths, tokens) {
|
|
58672
58928
|
const refs = /* @__PURE__ */ new Set();
|
|
58929
|
+
const media = /* @__PURE__ */ new Map();
|
|
58673
58930
|
let everyFrame = false;
|
|
58674
58931
|
for (const path of paths) {
|
|
58675
58932
|
const [project, folder, ...rest] = relative(root, path).split(sep);
|
|
@@ -58682,8 +58939,17 @@ function reloadCauses(root, paths, tokens) {
|
|
|
58682
58939
|
continue;
|
|
58683
58940
|
}
|
|
58684
58941
|
if (!project || !folder || rest.length === 0) continue;
|
|
58685
|
-
if (folder === "assets")
|
|
58686
|
-
|
|
58942
|
+
if (folder === "assets") {
|
|
58943
|
+
const name = rest.at(-1) ?? "";
|
|
58944
|
+
if (name.endsWith(".license.json")) continue;
|
|
58945
|
+
if (rest[0] === "kits" || rest[0] === "kit" || !isPlaceableKind(assetKind(name))) {
|
|
58946
|
+
refs.add(`${project}/*`);
|
|
58947
|
+
continue;
|
|
58948
|
+
}
|
|
58949
|
+
const changed = media.get(project) ?? /* @__PURE__ */ new Set();
|
|
58950
|
+
changed.add(rest.join("/"));
|
|
58951
|
+
media.set(project, changed);
|
|
58952
|
+
} else if (rest.length === 1) {
|
|
58687
58953
|
const name = rest[0] ?? "";
|
|
58688
58954
|
if (name === "layout.json" || name === NOTES_FILE) continue;
|
|
58689
58955
|
const frame = frameNameOf(name);
|
|
@@ -58692,7 +58958,8 @@ function reloadCauses(root, paths, tokens) {
|
|
|
58692
58958
|
}
|
|
58693
58959
|
return {
|
|
58694
58960
|
refs,
|
|
58695
|
-
everyFrame
|
|
58961
|
+
everyFrame,
|
|
58962
|
+
media
|
|
58696
58963
|
};
|
|
58697
58964
|
}
|
|
58698
58965
|
/**
|
|
@@ -59062,10 +59329,14 @@ function createHug({ root, measure }) {
|
|
|
59062
59329
|
async function measureParts(measure, frame, parts) {
|
|
59063
59330
|
const size = {};
|
|
59064
59331
|
if (parts !== "linked") {
|
|
59065
|
-
const
|
|
59332
|
+
const page = pageBox(frame.box, frame.device);
|
|
59333
|
+
const own = await measure({
|
|
59334
|
+
...frame,
|
|
59335
|
+
box: page
|
|
59336
|
+
});
|
|
59066
59337
|
if (!own.empty) Object.assign(size, {
|
|
59067
59338
|
width: own.width,
|
|
59068
|
-
height: own.height
|
|
59339
|
+
height: own.height + topInset(frame.device)
|
|
59069
59340
|
});
|
|
59070
59341
|
}
|
|
59071
59342
|
if (parts !== "own" && frame.hugHeight && frame.widths.length > 0) {
|
|
@@ -59730,7 +60001,8 @@ async function listen({ clientDir, facesDir, root, tokens, port, openUrl, launch
|
|
|
59730
60001
|
path: boardPath(root, frame.path),
|
|
59731
60002
|
box,
|
|
59732
60003
|
scroll: frame.scroll,
|
|
59733
|
-
hugHeight: frame.hugHeight
|
|
60004
|
+
hugHeight: frame.hugHeight,
|
|
60005
|
+
device: box.width === frame.box.width ? frame.device : void 0
|
|
59734
60006
|
},
|
|
59735
60007
|
config: readConfig(root, frame.project)
|
|
59736
60008
|
}));
|