frameboard 0.40.0 → 0.41.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 +201 -37
- package/dist/client/assets/index-D-jPOVe6.css +2 -0
- package/dist/client/assets/index-D_JiNG33.js +180 -0
- package/dist/client/index.html +2 -2
- package/dist/frame-bridge.js +69 -69
- package/package.json +1 -1
- package/dist/client/assets/index-Bc2kMch6.js +0 -174
- package/dist/client/assets/index-DTVg3VZz.css +0 -2
package/dist/cli.js
CHANGED
|
@@ -9084,11 +9084,15 @@ function datetime(params) {
|
|
|
9084
9084
|
return /* @__PURE__ */ _isoDateTime(ZodISODateTime, params);
|
|
9085
9085
|
}
|
|
9086
9086
|
// src/shared/frame-device.ts
|
|
9087
|
-
/**
|
|
9087
|
+
/**
|
|
9088
|
+
* The devices the board can draw around a frame. A frame's width picks the
|
|
9089
|
+
* first three, and a frame names a foldable.
|
|
9090
|
+
*/
|
|
9088
9091
|
const DEVICES = [
|
|
9089
9092
|
"phone",
|
|
9090
9093
|
"tablet",
|
|
9091
|
-
"laptop"
|
|
9094
|
+
"laptop",
|
|
9095
|
+
"foldable"
|
|
9092
9096
|
];
|
|
9093
9097
|
/** The laptop lid's chin below the screen, past the border its sides hold. */
|
|
9094
9098
|
const LAPTOP_CHIN = 28;
|
|
@@ -9099,8 +9103,9 @@ const LAPTOP_BASE = {
|
|
|
9099
9103
|
radius: 10
|
|
9100
9104
|
};
|
|
9101
9105
|
/**
|
|
9102
|
-
* Bezels measured off a current Pro phone and 13-inch tablet, the
|
|
9103
|
-
*
|
|
9106
|
+
* Bezels measured off a current Pro phone and 13-inch tablet, the laptop
|
|
9107
|
+
* scaled off the picked mock, and the foldable's body less its glass. The
|
|
9108
|
+
* tablet's and the foldable's screen radii are guesses no source gives.
|
|
9104
9109
|
*/
|
|
9105
9110
|
const BEZELS = {
|
|
9106
9111
|
phone: {
|
|
@@ -9120,6 +9125,12 @@ const BEZELS = {
|
|
|
9120
9125
|
bottom: LAPTOP_CHIN + LAPTOP_BASE.height,
|
|
9121
9126
|
screenRadius: 10,
|
|
9122
9127
|
bodyRadius: 30
|
|
9128
|
+
},
|
|
9129
|
+
foldable: {
|
|
9130
|
+
border: 20,
|
|
9131
|
+
bottom: 20,
|
|
9132
|
+
screenRadius: 48,
|
|
9133
|
+
bodyRadius: 68
|
|
9123
9134
|
}
|
|
9124
9135
|
};
|
|
9125
9136
|
/**
|
|
@@ -9169,6 +9180,67 @@ const HOME_BAR = {
|
|
|
9169
9180
|
height: 5,
|
|
9170
9181
|
bottom: 8
|
|
9171
9182
|
};
|
|
9183
|
+
/** The ways a foldable is held, each a screen the frame's box takes the size of. */
|
|
9184
|
+
const POSES = [
|
|
9185
|
+
"closed",
|
|
9186
|
+
"half",
|
|
9187
|
+
"open"
|
|
9188
|
+
];
|
|
9189
|
+
/**
|
|
9190
|
+
* Each pose's screen in points, the cover display closed and the inner one
|
|
9191
|
+
* half open and open. The published pixel counts at three pixels to a point,
|
|
9192
|
+
* a scale no source states for this device.
|
|
9193
|
+
*/
|
|
9194
|
+
const POSE_SIZES = {
|
|
9195
|
+
closed: {
|
|
9196
|
+
width: 466,
|
|
9197
|
+
height: 678
|
|
9198
|
+
},
|
|
9199
|
+
half: {
|
|
9200
|
+
width: 890,
|
|
9201
|
+
height: 626
|
|
9202
|
+
},
|
|
9203
|
+
open: {
|
|
9204
|
+
width: 890,
|
|
9205
|
+
height: 626
|
|
9206
|
+
}
|
|
9207
|
+
};
|
|
9208
|
+
/** A layout entry's `pose` as a pose, closed for none or a value no reader knows. */
|
|
9209
|
+
function poseOf(value) {
|
|
9210
|
+
return POSES.find((pose) => pose === value) ?? "closed";
|
|
9211
|
+
}
|
|
9212
|
+
/** The pose a frame this wide starts in, closed or open, whichever moves its box least. */
|
|
9213
|
+
function nearestPose(width) {
|
|
9214
|
+
return Math.abs(width - POSE_SIZES.closed.width) <= Math.abs(width - POSE_SIZES.open.width) ? "closed" : "open";
|
|
9215
|
+
}
|
|
9216
|
+
/**
|
|
9217
|
+
* The foldable's island, a generic pill, centered on the cover screen and on
|
|
9218
|
+
* the right half of the inner one, a place no source gives.
|
|
9219
|
+
*/
|
|
9220
|
+
const FOLDABLE_ISLAND = {
|
|
9221
|
+
width: 100,
|
|
9222
|
+
height: 30,
|
|
9223
|
+
top: 14
|
|
9224
|
+
};
|
|
9225
|
+
/** Where the island's center sits across a pose's screen, as a share of its width. */
|
|
9226
|
+
function islandCenter(pose) {
|
|
9227
|
+
return pose === "closed" ? .5 : .75;
|
|
9228
|
+
}
|
|
9229
|
+
/**
|
|
9230
|
+
* The band drawn down the middle of the inner screen, a faint crease open
|
|
9231
|
+
* and a shaded fold half open, null on the cover screen, which has no fold.
|
|
9232
|
+
*/
|
|
9233
|
+
function foldBand(pose) {
|
|
9234
|
+
if (pose === "closed") return null;
|
|
9235
|
+
if (pose === "open") return {
|
|
9236
|
+
width: 26,
|
|
9237
|
+
background: "linear-gradient(90deg, transparent, rgba(0,0,0,.05) 35%, rgba(0,0,0,.11) 50%, rgba(255,255,255,.5) 56%, transparent)"
|
|
9238
|
+
};
|
|
9239
|
+
return {
|
|
9240
|
+
width: 150,
|
|
9241
|
+
background: "linear-gradient(90deg, transparent, rgba(0,0,0,.10) 30%, rgba(0,0,0,.34) 49%, rgba(0,0,0,.34) 51%, rgba(0,0,0,.08) 70%, transparent)"
|
|
9242
|
+
};
|
|
9243
|
+
}
|
|
9172
9244
|
/**
|
|
9173
9245
|
* The laptop's chin and base, each a box from the frame's top left, which
|
|
9174
9246
|
* the board and the PNG draw as positioned boxes, since one spread around
|
|
@@ -9425,6 +9497,13 @@ function widthsOf(value) {
|
|
|
9425
9497
|
}
|
|
9426
9498
|
return widths;
|
|
9427
9499
|
}
|
|
9500
|
+
/**
|
|
9501
|
+
* The widths a layout entry draws: none for a frame naming the foldable,
|
|
9502
|
+
* whose poses are its sizes, whatever its `widths` lists.
|
|
9503
|
+
*/
|
|
9504
|
+
function drawnWidths(entry) {
|
|
9505
|
+
return entry.foldable === true ? [] : widthsOf(entry.widths);
|
|
9506
|
+
}
|
|
9428
9507
|
function isSize(value) {
|
|
9429
9508
|
return typeof value === "number" && Number.isInteger(value) && value >= 1;
|
|
9430
9509
|
}
|
|
@@ -9648,6 +9727,8 @@ const layoutEntrySchema = looseObject({
|
|
|
9648
9727
|
})), unknown()]).optional(),
|
|
9649
9728
|
showDevice: unknown().optional(),
|
|
9650
9729
|
device: unknown().optional(),
|
|
9730
|
+
foldable: unknown().optional(),
|
|
9731
|
+
pose: unknown().optional(),
|
|
9651
9732
|
transition: unknown().optional(),
|
|
9652
9733
|
speakerNotes: unknown().optional()
|
|
9653
9734
|
});
|
|
@@ -24449,7 +24530,10 @@ function placeFrames(frames, names, readTransition = storedTransitionOf) {
|
|
|
24449
24530
|
height: entry.height
|
|
24450
24531
|
};
|
|
24451
24532
|
const shown = showsDevice(entry);
|
|
24452
|
-
const
|
|
24533
|
+
const foldable = entry.foldable === true;
|
|
24534
|
+
const kept = widthsOf(entry.widths);
|
|
24535
|
+
const named = foldable ? "foldable" : deviceForWidth(box.width);
|
|
24536
|
+
const device = shown ? named : null;
|
|
24453
24537
|
const transition = readTransition(entry.transition);
|
|
24454
24538
|
const speakerNotes = speakerNotesOf(entry.speakerNotes);
|
|
24455
24539
|
placements.set(name, {
|
|
@@ -24460,9 +24544,14 @@ function placeFrames(frames, names, readTransition = storedTransitionOf) {
|
|
|
24460
24544
|
hugWidth: !scroll && (entry.hugWidth ?? false),
|
|
24461
24545
|
hugHeight: !scroll && (entry.hugHeight ?? false),
|
|
24462
24546
|
scroll,
|
|
24463
|
-
widths:
|
|
24547
|
+
widths: drawnWidths(entry),
|
|
24464
24548
|
...shown ? { showDevice: true } : {},
|
|
24465
24549
|
...device ? { device } : {},
|
|
24550
|
+
...foldable ? {
|
|
24551
|
+
foldable,
|
|
24552
|
+
pose: poseOf(entry.pose)
|
|
24553
|
+
} : {},
|
|
24554
|
+
...foldable && kept.length > 0 ? { keptWidths: kept } : {},
|
|
24466
24555
|
...transition ? { transition } : {},
|
|
24467
24556
|
...speakerNotes ? { speakerNotes } : {},
|
|
24468
24557
|
placed: true
|
|
@@ -24573,7 +24662,7 @@ async function scanPage(root, project, name, index, transitions) {
|
|
|
24573
24662
|
const placements = placeFrames(frames, names, (value) => transitionOf(value, own));
|
|
24574
24663
|
const stacked = (await Promise.all(names.map(async (frame) => {
|
|
24575
24664
|
const framePath = join(path, `${frame}${FRAME_EXTENSION}`);
|
|
24576
|
-
const placement = placements.get(frame) ?? placeNext([]);
|
|
24665
|
+
const { foldable: _named, keptWidths: _kept, ...placement } = placements.get(frame) ?? placeNext([]);
|
|
24577
24666
|
return {
|
|
24578
24667
|
ref: `${project}/${name}/${frame}`,
|
|
24579
24668
|
project,
|
|
@@ -24692,7 +24781,7 @@ async function isDirectory(path) {
|
|
|
24692
24781
|
}
|
|
24693
24782
|
}
|
|
24694
24783
|
// package.json
|
|
24695
|
-
var version$1 = "0.
|
|
24784
|
+
var version$1 = "0.41.0";
|
|
24696
24785
|
var dependencies = { "playwright-core": "1.65.0" };
|
|
24697
24786
|
var peerDependencies = { "oxfmt": "0.78.0" };
|
|
24698
24787
|
// src/shared/version.ts
|
|
@@ -25364,6 +25453,10 @@ async function setLinkedWidths(root, targets, widths, options) {
|
|
|
25364
25453
|
}
|
|
25365
25454
|
/** The placement `resizeFrame` writes, for the size it read off its options. */
|
|
25366
25455
|
function resizedPlacement(placement, frameRef, size, options) {
|
|
25456
|
+
if (placement.foldable && options.widths && options.widths.length > 0) throw new FrameboardError("usage", `${frameRef} is a foldable, whose poses are its sizes, so it shows at no other width.`, {
|
|
25457
|
+
ref: frameRef,
|
|
25458
|
+
widths: options.widths
|
|
25459
|
+
});
|
|
25367
25460
|
const scroll = options.scroll ?? placement.scroll;
|
|
25368
25461
|
const width = size.width ?? placement.box.width;
|
|
25369
25462
|
const drops = scroll && placement.hugHeight && size.height === void 0;
|
|
@@ -25373,8 +25466,10 @@ function resizedPlacement(placement, frameRef, size, options) {
|
|
|
25373
25466
|
hugWidth,
|
|
25374
25467
|
held: placement.widths
|
|
25375
25468
|
});
|
|
25469
|
+
const { keptWidths, ...kept } = placement;
|
|
25376
25470
|
return {
|
|
25377
|
-
...
|
|
25471
|
+
...kept,
|
|
25472
|
+
...keptWidths && options.widths !== false ? { keptWidths } : {},
|
|
25378
25473
|
box: {
|
|
25379
25474
|
...placement.box,
|
|
25380
25475
|
...size,
|
|
@@ -25645,17 +25740,54 @@ async function setFrameFlag(root, ref, flag, { on, ...options }) {
|
|
|
25645
25740
|
}));
|
|
25646
25741
|
}
|
|
25647
25742
|
/**
|
|
25648
|
-
* Shows or hides
|
|
25649
|
-
*
|
|
25650
|
-
*
|
|
25743
|
+
* Shows or hides a frame's device, names or un-names the foldable, and folds
|
|
25744
|
+
* it, never writing the frame's file. Naming a foldable shows it and, as a
|
|
25745
|
+
* pose does, sets the box to that pose's screen, fixed on both axes.
|
|
25651
25746
|
*/
|
|
25652
|
-
async function setFrameDevice(root, ref, show, options) {
|
|
25653
|
-
return updatePlacement(root, ref, options, (placement) => {
|
|
25654
|
-
const { showDevice:
|
|
25655
|
-
|
|
25747
|
+
async function setFrameDevice(root, ref, show, { foldable: name, pose: fold, ...options }) {
|
|
25748
|
+
return updatePlacement(root, ref, options, (placement, frameRef) => {
|
|
25749
|
+
const { showDevice: held, device: _device, foldable: named, pose: stored, keptWidths, ...rest } = placement;
|
|
25750
|
+
const foldable = name ?? named === true;
|
|
25751
|
+
if (fold && !foldable) throw new FrameboardError("usage", `${frameRef} is not a foldable, so it has no pose. Name it with --foldable first.`, {
|
|
25752
|
+
ref: frameRef,
|
|
25753
|
+
pose: fold
|
|
25754
|
+
});
|
|
25755
|
+
const shown = show ?? (name === true || held === true);
|
|
25756
|
+
const base = {
|
|
25656
25757
|
...rest,
|
|
25657
|
-
showDevice: true
|
|
25658
|
-
}
|
|
25758
|
+
...shown ? { showDevice: true } : {}
|
|
25759
|
+
};
|
|
25760
|
+
if (!foldable) {
|
|
25761
|
+
const widths = (keptWidths ?? rest.widths).filter((linked) => linked.width !== placement.box.width);
|
|
25762
|
+
return {
|
|
25763
|
+
...base,
|
|
25764
|
+
widths
|
|
25765
|
+
};
|
|
25766
|
+
}
|
|
25767
|
+
const undrawn = keptWidths ?? rest.widths;
|
|
25768
|
+
const kept = {
|
|
25769
|
+
widths: [],
|
|
25770
|
+
...undrawn.length > 0 ? { keptWidths: undrawn } : {}
|
|
25771
|
+
};
|
|
25772
|
+
const pose = fold ?? stored ?? nearestPose(placement.box.width);
|
|
25773
|
+
if (!fold && named) return {
|
|
25774
|
+
...base,
|
|
25775
|
+
...kept,
|
|
25776
|
+
foldable,
|
|
25777
|
+
pose
|
|
25778
|
+
};
|
|
25779
|
+
return {
|
|
25780
|
+
...base,
|
|
25781
|
+
...kept,
|
|
25782
|
+
foldable,
|
|
25783
|
+
pose,
|
|
25784
|
+
box: {
|
|
25785
|
+
...placement.box,
|
|
25786
|
+
...POSE_SIZES[pose]
|
|
25787
|
+
},
|
|
25788
|
+
hugWidth: false,
|
|
25789
|
+
hugHeight: false
|
|
25790
|
+
};
|
|
25659
25791
|
});
|
|
25660
25792
|
}
|
|
25661
25793
|
/**
|
|
@@ -25786,10 +25918,11 @@ var PageLayout = class {
|
|
|
25786
25918
|
* Writes the fixed keys after the entry's own, so unknown keys survive, and a
|
|
25787
25919
|
* flag only once on or already held, so an older entry gains no key.
|
|
25788
25920
|
*/
|
|
25789
|
-
set(name, { box, order, hidden, locked, scroll, widths, showDevice, transition, speakerNotes, hugWidth: hugsWidth, hugHeight: hugsHeight }) {
|
|
25921
|
+
set(name, { box, order, hidden, locked, scroll, widths, showDevice, foldable, pose, keptWidths, transition, speakerNotes, hugWidth: hugsWidth, hugHeight: hugsHeight }) {
|
|
25790
25922
|
const hugWidth = hugsWidth && !scroll;
|
|
25791
25923
|
const hugHeight = hugsHeight && !scroll;
|
|
25792
25924
|
const held = this.file.frames[name];
|
|
25925
|
+
const listed = foldable ? keptWidths ?? [] : widths;
|
|
25793
25926
|
const entry = {
|
|
25794
25927
|
...held,
|
|
25795
25928
|
x: box.x,
|
|
@@ -25802,15 +25935,21 @@ var PageLayout = class {
|
|
|
25802
25935
|
...!held || hugWidth || held.hugWidth !== void 0 ? { hugWidth } : {},
|
|
25803
25936
|
...!held || hugHeight || held.hugHeight !== void 0 ? { hugHeight } : {},
|
|
25804
25937
|
...scroll || held?.scroll !== void 0 ? { scroll } : {},
|
|
25805
|
-
...
|
|
25938
|
+
...listed.length > 0 ? { widths: listed.map(({ width, height }) => ({
|
|
25806
25939
|
width,
|
|
25807
25940
|
height
|
|
25808
25941
|
})) } : {},
|
|
25809
25942
|
...showDevice ? { showDevice } : {},
|
|
25943
|
+
...foldable ? { foldable } : {},
|
|
25944
|
+
...foldable && pose && (held?.foldable !== true || poseOf(held.pose) !== pose) ? { pose } : {},
|
|
25810
25945
|
...transition ? { transition: { ...transition } } : {},
|
|
25811
25946
|
...speakerNotes ? { speakerNotes } : {}
|
|
25812
25947
|
};
|
|
25813
|
-
if (
|
|
25948
|
+
if (listed.length === 0 && widthsOf(held?.widths).length > 0) delete entry.widths;
|
|
25949
|
+
if (!foldable && held?.foldable === true) {
|
|
25950
|
+
delete entry.foldable;
|
|
25951
|
+
delete entry.pose;
|
|
25952
|
+
}
|
|
25814
25953
|
if (!showDevice && held?.showDevice === true) delete entry.showDevice;
|
|
25815
25954
|
if (typeof held?.device === "string") delete entry.device;
|
|
25816
25955
|
if (!transition && storedTransitionOf(held?.transition)) delete entry.transition;
|
|
@@ -44805,7 +44944,10 @@ function createWarmRenderer({ baseUrl, browser, scale: defaultScale }) {
|
|
|
44805
44944
|
} finally {
|
|
44806
44945
|
await opened.close();
|
|
44807
44946
|
}
|
|
44808
|
-
return device ? drawBezel(open, shot, frame.box,
|
|
44947
|
+
return device ? drawBezel(open, shot, frame.box, {
|
|
44948
|
+
device,
|
|
44949
|
+
pose: frame.pose
|
|
44950
|
+
}, scale) : shot;
|
|
44809
44951
|
});
|
|
44810
44952
|
queue = run.catch(() => {});
|
|
44811
44953
|
return run;
|
|
@@ -44843,7 +44985,7 @@ async function shootElement(page, ref, index, scale) {
|
|
|
44843
44985
|
* A frame's shot drawn inside a device's body, as the board draws it, on a
|
|
44844
44986
|
* page the size of the body, so the PNG holds the body and nothing past it.
|
|
44845
44987
|
*/
|
|
44846
|
-
async function drawBezel(browser, shot, box, device, scale) {
|
|
44988
|
+
async function drawBezel(browser, shot, box, { device, pose = "closed" }, scale) {
|
|
44847
44989
|
const outer = bezelBox({
|
|
44848
44990
|
x: 0,
|
|
44849
44991
|
y: 0,
|
|
@@ -44859,7 +45001,7 @@ async function drawBezel(browser, shot, box, device, scale) {
|
|
|
44859
45001
|
});
|
|
44860
45002
|
try {
|
|
44861
45003
|
const page = await context.newPage();
|
|
44862
|
-
const marks = device === "phone" ? `<span style="${pill(PHONE_ISLAND.width, PHONE_ISLAND.height, BEZEL_COLORS.island)}top:${PHONE_ISLAND.top}px"></span><span style="${pill(HOME_BAR.width, HOME_BAR.height, BEZEL_COLORS.homeBar)}bottom:${HOME_BAR.bottom}px"></span>` : laptop ? laptopMarks(box) : "";
|
|
45004
|
+
const marks = device === "phone" ? `<span style="${pill(PHONE_ISLAND.width, PHONE_ISLAND.height, BEZEL_COLORS.island)}top:${PHONE_ISLAND.top}px"></span><span style="${pill(HOME_BAR.width, HOME_BAR.height, BEZEL_COLORS.homeBar)}bottom:${HOME_BAR.bottom}px"></span>` : laptop ? laptopMarks(box) : device === "foldable" ? foldableMarks(pose) : "";
|
|
44863
45005
|
const radius = screenCorners(device);
|
|
44864
45006
|
await page.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="display:block;width:100%;height:100%;border-radius:${radius}"><div style="position:absolute;inset:0;border-radius:${radius};box-shadow:${bezelShadow(device, { board: false })}">${marks}</div></div></body></html>`, { waitUntil: "load" });
|
|
44865
45007
|
return await page.screenshot({
|
|
@@ -44879,8 +45021,15 @@ function laptopMarks(box) {
|
|
|
44879
45021
|
const edge = `1px solid ${BEZEL_COLORS.edge}`;
|
|
44880
45022
|
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>`;
|
|
44881
45023
|
}
|
|
44882
|
-
|
|
44883
|
-
|
|
45024
|
+
/** The foldable's fold band, island, and home bar as the board draws them for a pose. */
|
|
45025
|
+
function foldableMarks(pose) {
|
|
45026
|
+
const band = foldBand(pose);
|
|
45027
|
+
const reach = pose === "half" ? -BEZELS.foldable.border : 0;
|
|
45028
|
+
const island = pill(FOLDABLE_ISLAND.width, FOLDABLE_ISLAND.height, BEZEL_COLORS.island, islandCenter(pose));
|
|
45029
|
+
return (band ? `<span style="position:absolute;left:50%;transform:translateX(-50%);top:${reach}px;bottom:${reach}px;width:${band.width}px;background:${band.background}"></span>` : "") + `<span style="${island}top:${FOLDABLE_ISLAND.top}px"></span><span style="${pill(HOME_BAR.width, HOME_BAR.height, BEZEL_COLORS.homeBar)}bottom:${HOME_BAR.bottom}px"></span>`;
|
|
45030
|
+
}
|
|
45031
|
+
function pill(width, height, color, center = .5) {
|
|
45032
|
+
return `position:absolute;left:${center * 100}%;transform:translateX(-50%);width:${width}px;height:${height}px;border-radius:${height / 2}px;background:${color};`;
|
|
44884
45033
|
}
|
|
44885
45034
|
// src/server/capture/fit.ts
|
|
44886
45035
|
/** The widest a hugging width grows, past which the layout check reports the content clipped. */
|
|
@@ -46446,7 +46595,10 @@ const pasteSchema = object$1({
|
|
|
46446
46595
|
});
|
|
46447
46596
|
const frameDeviceSchema = object$1({
|
|
46448
46597
|
refs,
|
|
46449
|
-
|
|
46598
|
+
/** Absent leaves the device as it stands, but for naming a foldable, which shows it. */
|
|
46599
|
+
show: boolean$1().optional(),
|
|
46600
|
+
foldable: boolean$1().optional(),
|
|
46601
|
+
pose: _enum$1(POSES).optional()
|
|
46450
46602
|
});
|
|
46451
46603
|
/** More widths than any device list offers, so a body cannot grow without bound. */
|
|
46452
46604
|
const widthList = array$1(int$1().min(1)).max(64);
|
|
@@ -46812,12 +46964,14 @@ function structureRoutes(root, access, history, measure, tokens = null) {
|
|
|
46812
46964
|
data: frames
|
|
46813
46965
|
});
|
|
46814
46966
|
});
|
|
46815
|
-
/** Shows or hides
|
|
46967
|
+
/** Shows or hides each frame's device, names the foldable, or folds it, in one step, leaving every frame file alone. */
|
|
46816
46968
|
app.post("/api/frame/device", async (c) => {
|
|
46817
46969
|
const body = await parseBody$1(c.req.raw, frameDeviceSchema);
|
|
46818
46970
|
const frames = await eachFrame(body.refs, (frame, journal) => setFrameDevice(root, frame, body.show, {
|
|
46819
46971
|
cwd,
|
|
46820
|
-
journal
|
|
46972
|
+
journal,
|
|
46973
|
+
foldable: body.foldable,
|
|
46974
|
+
pose: body.pose
|
|
46821
46975
|
}), (records) => records.map((record) => record.ref));
|
|
46822
46976
|
return c.json({
|
|
46823
46977
|
ok: true,
|
|
@@ -48166,8 +48320,13 @@ const frameRecordSchema = object$1({
|
|
|
48166
48320
|
})),
|
|
48167
48321
|
/** Whether the board draws the frame inside a device, absent when it does not. */
|
|
48168
48322
|
showDevice: boolean$1().optional(),
|
|
48169
|
-
/**
|
|
48323
|
+
/**
|
|
48324
|
+
* The device the frame draws inside while it shows one: `foldable` when the
|
|
48325
|
+
* frame names it, else the one its width picks, absent when off or under 320 wide.
|
|
48326
|
+
*/
|
|
48170
48327
|
device: _enum$1(DEVICES).optional(),
|
|
48328
|
+
/** The pose a frame naming the foldable is folded to, shown or not, absent on every other frame. */
|
|
48329
|
+
pose: _enum$1(POSES).optional(),
|
|
48171
48330
|
/** The transition the frame arrives with in present mode, over its page's, absent when it holds none. */
|
|
48172
48331
|
transition: transitionRecordSchema.optional(),
|
|
48173
48332
|
/** What the presenter means to say over the slide, plain text with its line breaks, absent when it holds none. */
|
|
@@ -48731,6 +48890,7 @@ function contentFormat() {
|
|
|
48731
48890
|
`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.`,
|
|
48732
48891
|
`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.`,
|
|
48733
48892
|
`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.`,
|
|
48893
|
+
`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.`,
|
|
48734
48894
|
`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.`,
|
|
48735
48895
|
"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.",
|
|
48736
48896
|
"Frames sort by order, then name, and a write that changes order renumbers the page from 0.",
|
|
@@ -49147,11 +49307,12 @@ const DEVICE_ON = [
|
|
|
49147
49307
|
"phone",
|
|
49148
49308
|
"tablet"
|
|
49149
49309
|
];
|
|
49150
|
-
/** What `frame device` did, naming the device the frame's
|
|
49151
|
-
function deviceHeadline({ ref, box, showDevice, device }) {
|
|
49152
|
-
|
|
49310
|
+
/** What `frame device` did, naming the device the frame draws inside and a foldable's pose. */
|
|
49311
|
+
function deviceHeadline({ ref, box, showDevice, device, pose }) {
|
|
49312
|
+
const folded = pose ? `, folded ${pose} at ${box.width} by ${box.height}` : "";
|
|
49313
|
+
if (!showDevice) return `Hid the device on ${ref}${folded}`;
|
|
49153
49314
|
if (!device) return `Showed the device on ${ref}, though no device fits its ${box.width} px width`;
|
|
49154
|
-
return `Showed the ${device} on ${ref}`;
|
|
49315
|
+
return `Showed the ${device} on ${ref}${folded}`;
|
|
49155
49316
|
}
|
|
49156
49317
|
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";
|
|
49157
49318
|
const POSITIVE = parseInteger(1);
|
|
@@ -49233,11 +49394,14 @@ function registerFrame(program, context) {
|
|
|
49233
49394
|
human: `Deleted frame ${result.deleted}`
|
|
49234
49395
|
};
|
|
49235
49396
|
});
|
|
49236
|
-
act(verb("device", "Show or hide the device the board draws around a frame, the phone, tablet, or laptop its width names
|
|
49237
|
-
|
|
49397
|
+
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, and fold a foldable, 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)), context, async ([ref = "", value], { foldable, pose, ...options }) => {
|
|
49398
|
+
if (value === void 0 && foldable === void 0 && pose === void 0) throw new FrameboardError("usage", "frame device takes on or off, --foldable, --no-foldable, or --pose.");
|
|
49399
|
+
const show = value !== void 0 && Object.hasOwn(DEVICE_SWITCH, value) ? DEVICE_SWITCH[value] : void 0;
|
|
49238
49400
|
const record = await setFrameDevice(await boardOf(options, io), ref, show, {
|
|
49239
49401
|
...options,
|
|
49240
|
-
cwd: io.cwd
|
|
49402
|
+
cwd: io.cwd,
|
|
49403
|
+
foldable,
|
|
49404
|
+
pose
|
|
49241
49405
|
});
|
|
49242
49406
|
return {
|
|
49243
49407
|
data: record,
|