@vinena/knobs 0.5.0 → 0.5.2
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/CHANGELOG.md +21 -0
- package/README.md +7 -0
- package/dist/early.global.js +6 -6
- package/dist/{elementsview-6g274ptr.js → elementsview-2z4pkrdz.js} +4 -4
- package/dist/{elementsview-pkzp9kc6.js → elementsview-qn8qyksa.js} +4 -4
- package/dist/engine/browserdraw.d.ts +24 -2
- package/dist/engine/browserkit.d.ts +18 -1
- package/dist/engine/browserui.d.ts +162 -22
- package/dist/engine/devicon.d.ts +59 -0
- package/dist/engine/fit.d.ts +4 -3
- package/dist/engine/foldflip.d.ts +40 -0
- package/dist/engine/identity.d.ts +7 -4
- package/dist/engine/mock.d.ts +16 -0
- package/dist/engine/mockdata.d.ts +4 -1
- package/dist/engine/mockdraw.d.ts +14 -2
- package/dist/engine/pageshot.d.ts +5 -2
- package/dist/engine/safaridraw.d.ts +162 -10
- package/dist/engine/screen.d.ts +24 -0
- package/dist/engine/store.d.ts +2 -1
- package/dist/engine/tabicon.d.ts +43 -0
- package/dist/engine/toplayer.d.ts +62 -0
- package/dist/engine/touchpointer.d.ts +0 -21
- package/dist/engine/underbar.d.ts +61 -0
- package/dist/{framekit-g96t6nmq.js → framekit-te90cjs0.js} +2325 -1572
- package/dist/{framekit-3n7p79ht.js → framekit-w0v516w5.js} +2325 -1572
- package/dist/host.d.ts +51 -0
- package/dist/{index-64rd634h.js → index-30fc6php.js} +1 -1
- package/dist/{index-dvr4x91q.js → index-9re7sv56.js} +20 -8
- package/dist/{index-0casarhy.js → index-agwr37gw.js} +1 -1
- package/dist/{index-2d6wvs8h.js → index-dan2kpsd.js} +4 -4
- package/dist/{index-kzsb9drs.js → index-hv02xka3.js} +20 -8
- package/dist/{index-peh33xjv.js → index-pewcdh28.js} +1 -1
- package/dist/{index-d0cjxjsm.js → index-r72tz2vn.js} +1 -1
- package/dist/{index-33x9hxe3.js → index-sxe5079a.js} +605 -187
- package/dist/{index-5d6qzte3.js → index-trx7bxdk.js} +4 -4
- package/dist/{index-5baxvd3v.js → index-xjhwp5cj.js} +275 -112
- package/dist/index.d.ts +26 -1
- package/dist/index.global.js +270 -176
- package/dist/index.js +398 -124
- package/dist/instance.d.ts +23 -4
- package/dist/{react-pdvseef0.js → react-05jh9jv5.js} +1 -1
- package/dist/{react-4kbj1t4h.js → react-16spgn0h.js} +1 -1
- package/dist/{react-65tgdbs8.js → react-4pvp6amm.js} +1 -1
- package/dist/{react-qv0nykcv.js → react-ayg1bgw3.js} +602 -184
- package/dist/{react-xxfpfddf.js → react-exjcpxma.js} +1 -1
- package/dist/{react-carf84xv.js → react-fm9y8dbn.js} +275 -112
- package/dist/{react-mv9y20jy.js → react-sw8d8c94.js} +4 -4
- package/dist/{react-71a9ypex.js → react-zy1mmhgz.js} +4 -4
- package/dist/react.js +394 -123
- package/dist/{storageview-vdkbp6rt.js → storageview-r595qpt9.js} +4 -4
- package/dist/{storageview-j9d44f99.js → storageview-s7heg93p.js} +4 -4
- package/dist/types.d.ts +7 -0
- package/dist/ui/footer.d.ts +9 -2
- package/dist/ui/panel.d.ts +16 -2
- package/dist/ui/settings.d.ts +17 -1
- package/dist/version.d.ts +2 -0
- package/package.json +3 -2
- package/skills/devknobs/SKILL.md +1 -1
- package/dist/elementsview-jnkbhzkj.js +0 -2873
- package/dist/elementsview-tf4qzmtw.js +0 -2874
- package/dist/engine/endroom.d.ts +0 -21
- package/dist/framekit-095qevka.js +0 -8838
- package/dist/framekit-q5aad770.js +0 -8839
- package/dist/index-hw56t3zy.js +0 -4800
- package/dist/index-k015tb6c.js +0 -357
- package/dist/index-ke6v7919.js +0 -4801
- package/dist/index-qxye1j73.js +0 -528
- package/dist/index-z5ytnj01.js +0 -4563
- package/dist/index-zvze25nf.js +0 -686
- package/dist/react-eygws6cx.js +0 -358
- package/dist/react-sq9pkw4k.js +0 -687
- package/dist/react-vjm88w4t.js +0 -4564
- package/dist/react-znfrjqk8.js +0 -529
- package/dist/storageview-sb23henh.js +0 -2729
- package/dist/storageview-vf8v8q8j.js +0 -2728
|
@@ -2,13 +2,104 @@ import type { BrowserValue, OrientationValue } from "../types";
|
|
|
2
2
|
import type { Rect } from "./mock";
|
|
3
3
|
/**
|
|
4
4
|
* The browser a phone shows the page in, drawn around it inside the screen:
|
|
5
|
-
* Safari on an iPhone, Chrome on an Android phone. The numbers are iOS
|
|
6
|
-
* Safari measured in the simulator,
|
|
7
|
-
* sources, in css px of the screen.
|
|
5
|
+
* Safari on an iPhone, Chrome on an Android phone. The numbers are iOS 27.0
|
|
6
|
+
* Safari measured in the simulator, where it kept iOS 26.5's geometry, and
|
|
7
|
+
* Chrome's from the Chromium and AOSP sources, in css px of the screen.
|
|
8
8
|
*/
|
|
9
9
|
export type Platform = "safari" | "chrome";
|
|
10
10
|
/** Where the browser keeps its bars, or none at all. */
|
|
11
11
|
export type BrowserLayout = "compact" | "bottom" | "top" | "off";
|
|
12
|
+
/**
|
|
13
|
+
* Safari 27.1 on the iPhone Duo, measured on the iOS 27.1 simulator. Upright
|
|
14
|
+
* on the cover screen the status and Safari's buttons stack down a column on
|
|
15
|
+
* the right, which the page never runs under, and the address floats at the
|
|
16
|
+
* bottom of the page, so the page is the screen less the column, 98 off its
|
|
17
|
+
* height expanded (382 by 580) and 60 minimized, WebKit's 618
|
|
18
|
+
* (webkit.org/blog/18486), as the simulator's cover has no minimized state to
|
|
19
|
+
* measure. In the column: the time, the ring of the battery round wifi with
|
|
20
|
+
* the signal's four dots in its gap, back and reader, and a capsule of new
|
|
21
|
+
* tab and tabs on the address's line. Held across, the cover has no status
|
|
22
|
+
* and no column: one bar 80 tall runs along the top, back and reader, the
|
|
23
|
+
* address in the middle, and share, new tab and tabs (678 by 386). Its
|
|
24
|
+
* minimized bar is the simulator's `lvh`, 440, as the cover takes no swipe.
|
|
25
|
+
*/
|
|
26
|
+
export declare const DUO_COVER: {
|
|
27
|
+
readonly column: 84;
|
|
28
|
+
readonly bottom: 98;
|
|
29
|
+
readonly minimized: 60;
|
|
30
|
+
/** The column's center line, in from the screen's right edge. */
|
|
31
|
+
readonly axis: 48;
|
|
32
|
+
readonly time: {
|
|
33
|
+
readonly y: 91.5;
|
|
34
|
+
readonly size: 15.75;
|
|
35
|
+
};
|
|
36
|
+
/** The ring's center, the radius of its stroke's middle, and the stroke. */
|
|
37
|
+
readonly ring: {
|
|
38
|
+
readonly y: 129.9;
|
|
39
|
+
readonly radius: 18.9;
|
|
40
|
+
readonly stroke: 3.5;
|
|
41
|
+
};
|
|
42
|
+
/** The tops of back and reader, 48 round. */
|
|
43
|
+
readonly buttons: readonly [174.2, 234.2];
|
|
44
|
+
/** New tab and tabs in one capsule 48 wide, and the address 48 high, both 34 off the bottom. */
|
|
45
|
+
readonly capsule: 102;
|
|
46
|
+
readonly gap: 34;
|
|
47
|
+
/** The address's inset from the page's sides. */
|
|
48
|
+
readonly inset: 24;
|
|
49
|
+
/** Held across: the bar's height, expanded and minimized, and its row. */
|
|
50
|
+
readonly across: {
|
|
51
|
+
readonly top: 80;
|
|
52
|
+
readonly minimized: 26;
|
|
53
|
+
readonly side: 7.33;
|
|
54
|
+
readonly address: {
|
|
55
|
+
readonly x: 209;
|
|
56
|
+
readonly width: 260;
|
|
57
|
+
};
|
|
58
|
+
readonly end: 149.33;
|
|
59
|
+
};
|
|
60
|
+
};
|
|
61
|
+
/**
|
|
62
|
+
* The inner screen, measured on the iOS 27.1 simulator: the page runs the
|
|
63
|
+
* whole width under Safari's bar at the top, held either way, 80 of it
|
|
64
|
+
* expanded and 51 minimized (951 by 589 and 618 upright, 669 by 871 and 900
|
|
65
|
+
* across). Its row: back and reader, the address, new tab and tabs in one
|
|
66
|
+
* capsule, then the time and the ring at the right. Minimized, only a small
|
|
67
|
+
* domain pill is left, the status gone.
|
|
68
|
+
*/
|
|
69
|
+
export declare const DUO_INNER: {
|
|
70
|
+
readonly top: 80;
|
|
71
|
+
readonly minimized: 51;
|
|
72
|
+
/** The ring's center line and the time's center, in from the screen's right edge. */
|
|
73
|
+
readonly axis: 47.67;
|
|
74
|
+
readonly time: {
|
|
75
|
+
readonly x: 99.83;
|
|
76
|
+
readonly y: 47.4;
|
|
77
|
+
readonly size: 15.75;
|
|
78
|
+
};
|
|
79
|
+
readonly ring: {
|
|
80
|
+
readonly y: 47.9;
|
|
81
|
+
readonly radius: 18.9;
|
|
82
|
+
readonly stroke: 3.5;
|
|
83
|
+
};
|
|
84
|
+
readonly side: 6;
|
|
85
|
+
/** The address's left end and width, 951 wide and 669 wide. */
|
|
86
|
+
readonly address: {
|
|
87
|
+
readonly landscape: {
|
|
88
|
+
readonly x: 295;
|
|
89
|
+
readonly width: 361;
|
|
90
|
+
};
|
|
91
|
+
readonly portrait: {
|
|
92
|
+
readonly x: 184;
|
|
93
|
+
readonly width: 241.5;
|
|
94
|
+
};
|
|
95
|
+
};
|
|
96
|
+
/** New tab and tabs' capsule, its left end in from the screen's right edge. */
|
|
97
|
+
readonly end: 232;
|
|
98
|
+
/** The minimized domain pill's top. */
|
|
99
|
+
readonly pill: 23.5;
|
|
100
|
+
};
|
|
101
|
+
/** May the page run under Safari's bars held sideways? Not on the Duo, whose page is never under them. */
|
|
102
|
+
export declare function runsUnderBars(id: string): boolean;
|
|
12
103
|
/** Safari's bars, measured from the bottom of the screen or the top inset. */
|
|
13
104
|
export declare const SAFARI_BARS: {
|
|
14
105
|
/** Compact's capsules and the bottom gap under them. */
|
|
@@ -48,18 +139,14 @@ export interface Screen {
|
|
|
48
139
|
/**
|
|
49
140
|
* Where the page's viewport sits in the screen, and its size: what the page
|
|
50
141
|
* reads as `innerWidth` and `innerHeight`. The whole screen without a browser.
|
|
142
|
+
* A frame of this size gives `visualViewport`, `dvh` and a fixed `bottom: 0`
|
|
143
|
+
* as Safari does. Not `svh`, `lvh` and `vh`, which a frame takes from its own
|
|
144
|
+
* height as it goes: Safari keeps `svh` at the expanded height, and `lvh` and
|
|
145
|
+
* `vh` at the minimized one, or the whole screen in Top.
|
|
51
146
|
*/
|
|
52
147
|
export declare function viewportOf(device: Screen, orientation: OrientationValue, layout: BrowserLayout | null, minimized: boolean, edge?: boolean): Rect;
|
|
53
|
-
/**
|
|
54
|
-
* The room the end of a page drawn edge to edge needs so its last content
|
|
55
|
-
* scrolls clear of the bars: how far the frame runs past the bottom of the
|
|
56
|
-
* viewport Safari gives the page, bars as they are. On the phone the page
|
|
57
|
-
* ends there, and under the bars is its plain background. None where the
|
|
58
|
-
* frame is that viewport, and none for the bars at the top.
|
|
59
|
-
*/
|
|
60
|
-
export declare function endRoom(device: Screen, orientation: OrientationValue, layout: BrowserLayout | null, minimized: boolean, edge: boolean): number;
|
|
61
148
|
/** A glyph the bars draw. */
|
|
62
|
-
export type Glyph = "back" | "forward" | "share" | "bookmarks" | "tabs" | "reload" | "page" | "
|
|
149
|
+
export type Glyph = "back" | "forward" | "share" | "bookmarks" | "tabs" | "reload" | "page" | "plus" | "home" | "tune" | "switcher" | "menu";
|
|
63
150
|
/** A glyph centered on `x`, `y`. */
|
|
64
151
|
export interface Mark {
|
|
65
152
|
glyph: Glyph;
|
|
@@ -75,11 +162,38 @@ export interface Shape extends Rect {
|
|
|
75
162
|
kind: "glass" | "card" | "field" | "pill" | "toolbar";
|
|
76
163
|
radius: number;
|
|
77
164
|
marks: Mark[];
|
|
78
|
-
/**
|
|
165
|
+
/**
|
|
166
|
+
* Where the shape shows the domain: its center in Safari, its start in
|
|
167
|
+
* Chrome. A pill's width is the domain's advance and `pad`.
|
|
168
|
+
*/
|
|
79
169
|
text?: {
|
|
80
170
|
x: number;
|
|
81
171
|
y: number;
|
|
82
172
|
size: number;
|
|
173
|
+
pad?: number;
|
|
174
|
+
};
|
|
175
|
+
}
|
|
176
|
+
/**
|
|
177
|
+
* The Duo's status: on the cover screen stacked down its column under the
|
|
178
|
+
* camera hole, the time, then the ring of the battery round wifi, with the
|
|
179
|
+
* signal's dots in its gap; on the inner screen the time left of the ring.
|
|
180
|
+
*/
|
|
181
|
+
export interface StatusColumn {
|
|
182
|
+
/** The ring's center line. */
|
|
183
|
+
x: number;
|
|
184
|
+
/** Over the strip at the top, as on the inner screen, else on the page's own color. */
|
|
185
|
+
strip: boolean;
|
|
186
|
+
/** The time's center and size. */
|
|
187
|
+
time: {
|
|
188
|
+
x: number;
|
|
189
|
+
y: number;
|
|
190
|
+
size: number;
|
|
191
|
+
};
|
|
192
|
+
/** The ring's center, the radius of its stroke's middle, and the stroke's width. */
|
|
193
|
+
ring: {
|
|
194
|
+
y: number;
|
|
195
|
+
radius: number;
|
|
196
|
+
stroke: number;
|
|
83
197
|
};
|
|
84
198
|
}
|
|
85
199
|
/** The status bar and what is in it. */
|
|
@@ -102,6 +216,8 @@ export interface StatusBar {
|
|
|
102
216
|
x: number;
|
|
103
217
|
y: number;
|
|
104
218
|
};
|
|
219
|
+
/** iOS draws the time and the icons a size up on the big screens, 420 and wider. */
|
|
220
|
+
large: boolean;
|
|
105
221
|
}
|
|
106
222
|
export interface Bars {
|
|
107
223
|
platform: Platform;
|
|
@@ -111,20 +227,19 @@ export interface Bars {
|
|
|
111
227
|
orientation: OrientationValue;
|
|
112
228
|
minimized: boolean;
|
|
113
229
|
status: StatusBar | null;
|
|
230
|
+
/** The Duo has its own status instead: in the cover's column, or at the inner screen's top right. */
|
|
231
|
+
column: StatusColumn | null;
|
|
114
232
|
shapes: Shape[];
|
|
115
233
|
/** Chrome's chin under the toolbar, in the toolbar's color. */
|
|
116
234
|
chin: Rect | null;
|
|
117
235
|
/** Chrome's hairline between the toolbar and the page. */
|
|
118
236
|
hairline: Rect | null;
|
|
119
|
-
/** Safari's
|
|
120
|
-
|
|
121
|
-
/** Safari
|
|
237
|
+
/** A minimized Safari's wash over the page under its status bar. */
|
|
238
|
+
scrim: Scrim | null;
|
|
239
|
+
/** Safari's look under its bars: always upright, and turned across with edge to edge on. */
|
|
122
240
|
edge: boolean;
|
|
123
241
|
}
|
|
124
|
-
/**
|
|
125
|
-
* A fade from clear into the page's background, `y` to the screen's bottom,
|
|
126
|
-
* with how opaque it is `at` px down it.
|
|
127
|
-
*/
|
|
242
|
+
/** A fade over the screen from `y` down, `height` tall, with how opaque it is `at` px down it. */
|
|
128
243
|
export interface Fade {
|
|
129
244
|
y: number;
|
|
130
245
|
height: number;
|
|
@@ -133,6 +248,22 @@ export interface Fade {
|
|
|
133
248
|
alpha: number;
|
|
134
249
|
}[];
|
|
135
250
|
}
|
|
251
|
+
/**
|
|
252
|
+
* What a minimized Safari shows under its status bar: the page scrolled up
|
|
253
|
+
* under it, in a wash of the page's own color that fades from 0.81 opaque at
|
|
254
|
+
* the top of the screen to none 100 px down, measured on the iOS 26.5
|
|
255
|
+
* simulator over #111 content on a white body (#d1d1d1 at 0, #727272 at 40,
|
|
256
|
+
* #111111 at 100). The frame cannot show what scrolled past its top, so `at`
|
|
257
|
+
* is where the content it stands for is read: the top of the page.
|
|
258
|
+
*/
|
|
259
|
+
export interface Scrim extends Fade {
|
|
260
|
+
at: {
|
|
261
|
+
x: number;
|
|
262
|
+
y: number;
|
|
263
|
+
};
|
|
264
|
+
}
|
|
265
|
+
/** How opaque a fade is `y` px down the screen, between its stops. */
|
|
266
|
+
export declare function alphaAt(fade: Fade, y: number): number;
|
|
136
267
|
/** The domain's size in Safari's address field and in the minimized pill. */
|
|
137
268
|
export declare const SAFARI_TEXT: {
|
|
138
269
|
readonly field: 17;
|
|
@@ -154,16 +285,25 @@ export interface BarsMotion {
|
|
|
154
285
|
/** Until when scrolls are the page settling into a new viewport, not the user's. */
|
|
155
286
|
lockUntil: number;
|
|
156
287
|
}
|
|
157
|
-
export type BarsEvent =
|
|
288
|
+
export type BarsEvent =
|
|
289
|
+
/**
|
|
290
|
+
* The page scrolled to `y` at `time`. `room` is how far up minimizing
|
|
291
|
+
* moves the page's top, as Safari's top bars do, and how far the page
|
|
292
|
+
* scrolls to keep its content in place. `rest` is how far the page can
|
|
293
|
+
* still scroll once the frame grows for minimized bars.
|
|
294
|
+
*/
|
|
295
|
+
{
|
|
158
296
|
type: "scroll";
|
|
159
297
|
y: number;
|
|
160
298
|
time: number;
|
|
299
|
+
room?: number;
|
|
300
|
+
rest?: number;
|
|
161
301
|
} | {
|
|
162
302
|
type: "tap";
|
|
163
303
|
} | {
|
|
164
304
|
type: "navigate";
|
|
165
305
|
}
|
|
166
|
-
/** The frame was resized for the bars,
|
|
306
|
+
/** The frame was resized for the bars, at `time`. */
|
|
167
307
|
| {
|
|
168
308
|
type: "resize";
|
|
169
309
|
time: number;
|
|
@@ -0,0 +1,59 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* The dev ribbon on the tab's icon: the site's own icon with a yellow band
|
|
3
|
+
* across its top right corner, `DEV` on it where the bitmap is big enough to
|
|
4
|
+
* read. The same rule as the native devicon tool, so the two draw one picture.
|
|
5
|
+
*/
|
|
6
|
+
export declare const RIBBON_YELLOW = "#ffd60a";
|
|
7
|
+
export declare const RIBBON_INK = "#111111";
|
|
8
|
+
/** The bitmap size from which the band says `DEV`, in px. */
|
|
9
|
+
export declare const RIBBON_TEXT_MIN = 32;
|
|
10
|
+
/** The visible tile of an icon, made square: its left, top and side, in px. */
|
|
11
|
+
export interface TileBox {
|
|
12
|
+
x: number;
|
|
13
|
+
y: number;
|
|
14
|
+
s: number;
|
|
15
|
+
}
|
|
16
|
+
/** Where the band goes, in the frame turned 45 degrees at the tile's top right corner. */
|
|
17
|
+
export interface RibbonGeometry {
|
|
18
|
+
box: TileBox;
|
|
19
|
+
/** The corner radius of the tile the band is clipped to. */
|
|
20
|
+
radius: number;
|
|
21
|
+
/** The tile's top right corner, the frame's origin. */
|
|
22
|
+
origin: {
|
|
23
|
+
x: number;
|
|
24
|
+
y: number;
|
|
25
|
+
};
|
|
26
|
+
/** The frame's turn, in radians, clockwise on screen. */
|
|
27
|
+
angle: number;
|
|
28
|
+
/** The band's width across. */
|
|
29
|
+
width: number;
|
|
30
|
+
/** How far the band's inner edge lies from the corner. */
|
|
31
|
+
distance: number;
|
|
32
|
+
/** The black edge on both long sides of the band. */
|
|
33
|
+
edge: number;
|
|
34
|
+
/** How far the band runs either way along the frame's x. */
|
|
35
|
+
reach: number;
|
|
36
|
+
/** `DEV`'s size and the y of its middle, null on a bitmap too small for it. */
|
|
37
|
+
text: {
|
|
38
|
+
size: number;
|
|
39
|
+
y: number;
|
|
40
|
+
} | null;
|
|
41
|
+
}
|
|
42
|
+
/**
|
|
43
|
+
* The tile box of an S by S bitmap's rgba pixels: the box of those with an
|
|
44
|
+
* alpha over 128, made square around its center. The whole bitmap when none is.
|
|
45
|
+
*/
|
|
46
|
+
export declare function tileBox(data: ArrayLike<number>, size: number): TileBox;
|
|
47
|
+
/** The band for a bitmap of `size` px whose tile is `box`. */
|
|
48
|
+
export declare function ribbonGeometry(size: number, box: TileBox): RibbonGeometry;
|
|
49
|
+
/** What the drawing reads an icon from: an image or a canvas, anything `drawImage` takes. */
|
|
50
|
+
export type IconSource = CanvasImageSource & {
|
|
51
|
+
width: number;
|
|
52
|
+
height: number;
|
|
53
|
+
};
|
|
54
|
+
/**
|
|
55
|
+
* Draw `source` into an S by S context with the ribbon over it. The source
|
|
56
|
+
* fits the bitmap, centered, as it is. Throws where the canvas cannot be
|
|
57
|
+
* read back, as with a cross-origin image.
|
|
58
|
+
*/
|
|
59
|
+
export declare function drawDevIcon(context: CanvasRenderingContext2D, size: number, source: IconSource): void;
|
package/dist/engine/fit.d.ts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import type { DevknobsState, PostureValue, SideValue } from "../types";
|
|
2
2
|
import type { Sides } from "./mock";
|
|
3
|
-
import type
|
|
3
|
+
import { type Point } from "./zoom";
|
|
4
4
|
/** The room over the readout's row, so it stands clear of the window's top edge, in px. */
|
|
5
5
|
export declare const STRIP_TOP = 8;
|
|
6
6
|
/** The readout strip over the frame, in px. The frame is fitted to the room under it. */
|
|
@@ -14,7 +14,7 @@ export interface Fit {
|
|
|
14
14
|
zoom: number;
|
|
15
15
|
/** What the frame is drawn at: the zoom picked, or the fit. */
|
|
16
16
|
scale: number;
|
|
17
|
-
/** What the frame is drawn at to fit
|
|
17
|
+
/** What the frame is drawn at to fit. Above 1 only for a frame of a set width and height. */
|
|
18
18
|
fit: number;
|
|
19
19
|
/** `transform: scale()` on the frame's wrapper: the scale, and the zoom undone. */
|
|
20
20
|
transform: number;
|
|
@@ -33,7 +33,8 @@ export declare function hasStrip(knobs: Pick<DevknobsState, "width" | "height" |
|
|
|
33
33
|
* Place a frame in a letterbox of `size`, under its readout strip. A width or
|
|
34
34
|
* height of the frame's own keeps a margin around it, and the window's own
|
|
35
35
|
* size has none, as it is the window. To fit, a frame wider or taller than the
|
|
36
|
-
* room is drawn smaller,
|
|
36
|
+
* room is drawn smaller, one of a set width and height is drawn bigger to
|
|
37
|
+
* fill the room, and one without a height of its own is made taller by
|
|
37
38
|
* as much, so it still fills the height. An open panel covers `aside` px of
|
|
38
39
|
* the window's edge on its `side`, the right by default, and a frame of a set
|
|
39
40
|
* width that would reach under it is fitted to the room beside it, while that
|
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
import type { Point } from "./fold";
|
|
2
|
+
import type { Face, Picture } from "./foldpage";
|
|
3
|
+
import type { Mock, Rect } from "./mock";
|
|
4
|
+
/**
|
|
5
|
+
* The Duo's cover held across turns its top to the right, where the fold's
|
|
6
|
+
* frames have it turned to the left. That fold is the other turned over: the
|
|
7
|
+
* hinge on the cover's top and the camera hole at its bottom right, as the
|
|
8
|
+
* cover lies at rest. So it is laid out and drawn as the other, in a
|
|
9
|
+
* letterbox turned over, its sides, the device and the pictures of the page
|
|
10
|
+
* turned over too, and the whole of it turned back. The frames come out
|
|
11
|
+
* exactly as rendered, half a turn round, and each end lies where the device
|
|
12
|
+
* is drawn.
|
|
13
|
+
*/
|
|
14
|
+
/** The size of the letterbox a fold is turned over in. */
|
|
15
|
+
export interface Room {
|
|
16
|
+
width: number;
|
|
17
|
+
height: number;
|
|
18
|
+
}
|
|
19
|
+
/** A point of a box `room` big, the box turned half round. */
|
|
20
|
+
export declare function flipPoint(point: Point, room: Room): Point;
|
|
21
|
+
/** A rect in a box `room` big, the box turned half round. */
|
|
22
|
+
export declare function flipRect<T extends Rect>(rect: T, room: Room): T;
|
|
23
|
+
/** A mock turned half round, its picture too: one turned with the device turns the other way. */
|
|
24
|
+
export declare function flipMock(mock: Mock): Mock;
|
|
25
|
+
/** Is the shape such a foldable open and held upright? */
|
|
26
|
+
export declare function openUpright(shape: string): boolean;
|
|
27
|
+
/**
|
|
28
|
+
* Is the case held the other way up, going from the shape `from` to `to`, `over`
|
|
29
|
+
* before? Unfolded from the cover held across, the open phone is the same
|
|
30
|
+
* phone, so its case is half round, its screen's page upright as iOS keeps
|
|
31
|
+
* it. Its cover across keeps it so, and it stays so while it stays open
|
|
32
|
+
* upright. Anything else is the case as it is drawn.
|
|
33
|
+
*/
|
|
34
|
+
export declare function caseOver(from: string, to: string, over: boolean): boolean;
|
|
35
|
+
/** A side of a fold in a letterbox `room` big, turned half round. */
|
|
36
|
+
export declare function flipFace(face: Face, room: Room): Face;
|
|
37
|
+
/** A picture turned half round, the same one for the same picture. */
|
|
38
|
+
export declare function flipCanvas(canvas: HTMLCanvasElement): HTMLCanvasElement;
|
|
39
|
+
/** The page on a screen `size` css px, turned half round: its pictures and the bars over them. */
|
|
40
|
+
export declare function flipPicture(picture: Picture, size: Room): Picture;
|
|
@@ -12,6 +12,8 @@ export interface Identity {
|
|
|
12
12
|
dpr: DprValue;
|
|
13
13
|
}
|
|
14
14
|
type IdentityKnobs = Pick<DevknobsState, "ua" | "device" | "dpr">;
|
|
15
|
+
/** What the frame's new window is patched with: its identity, and the screen it reads. */
|
|
16
|
+
type PatchKnobs = IdentityKnobs & Pick<DevknobsState, "posture" | "orientation">;
|
|
15
17
|
export declare function identityOf(state: IdentityKnobs): Identity;
|
|
16
18
|
/** Does a page loaded as `loaded` read wrong under `next`? Not while no page has loaded. */
|
|
17
19
|
export declare function stale(loaded: Identity | null, next: Identity): boolean;
|
|
@@ -19,9 +21,10 @@ export declare function stale(loaded: Identity | null, next: Identity): boolean;
|
|
|
19
21
|
export declare function patchedAs(view: object): Identity | undefined;
|
|
20
22
|
/**
|
|
21
23
|
* Patch the frame's new window from the page above, as the frame's own copy
|
|
22
|
-
* would on mount: the user agent, the touch screen, its pointer queries
|
|
23
|
-
*
|
|
24
|
-
* over. A window patched already keeps what it
|
|
24
|
+
* would on mount: the user agent, the touch screen, its pointer queries, its
|
|
25
|
+
* scrollbars and the device's screen size, before the window's first script.
|
|
26
|
+
* The copy there takes them over. A window patched already keeps what it
|
|
27
|
+
* has, and says what that is.
|
|
25
28
|
*/
|
|
26
|
-
export declare function patchWindow(view: Window, state:
|
|
29
|
+
export declare function patchWindow(view: Window, state: PatchKnobs): Identity;
|
|
27
30
|
export {};
|
package/dist/engine/mock.d.ts
CHANGED
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import type { OrientationValue } from "../types";
|
|
2
|
+
import { type Front } from "./mockdata";
|
|
2
3
|
/** A length on each side of a box, in css px of the screen. */
|
|
3
4
|
export interface Sides {
|
|
4
5
|
top: number;
|
|
@@ -33,6 +34,10 @@ export interface Part extends Rect {
|
|
|
33
34
|
export interface MockImage extends Rect {
|
|
34
35
|
file: string;
|
|
35
36
|
turn: number | null;
|
|
37
|
+
/** Turned the other way, its top to the right, `turn` then the upright mock's height. */
|
|
38
|
+
clockwise?: boolean;
|
|
39
|
+
/** Not turned, but half round in the mock: the case held the other way up, as `flipMock` has it. */
|
|
40
|
+
over?: boolean;
|
|
36
41
|
}
|
|
37
42
|
/** A device's body around its screen, in css px of the screen. */
|
|
38
43
|
export interface Mock {
|
|
@@ -44,11 +49,22 @@ export interface Mock {
|
|
|
44
49
|
/** The body, in the mock. */
|
|
45
50
|
body: Rect;
|
|
46
51
|
screenRadius: Radius;
|
|
52
|
+
/** The screen's corners are continuous, as on the phones with an island, not round. */
|
|
53
|
+
continuous: boolean;
|
|
47
54
|
bodyRadius: Radius;
|
|
48
55
|
parts: Part[];
|
|
49
56
|
/** The body as a picture, which then has every part in it, in place of the drawn one. */
|
|
50
57
|
image?: MockImage;
|
|
51
58
|
}
|
|
59
|
+
/** The island of a phone that has one, a pill over the top of its screen held upright. */
|
|
60
|
+
export declare function islandOf(id: string): Front | null;
|
|
61
|
+
/** A rect with fully round ends. */
|
|
62
|
+
export declare function round(kind: Part["kind"], rect: Rect): Part;
|
|
63
|
+
/**
|
|
64
|
+
* A rect of a portrait mock `width` wide and `height` tall, turned a quarter
|
|
65
|
+
* so its top is on the left, or `clockwise`, on the right.
|
|
66
|
+
*/
|
|
67
|
+
export declare function turnRect<T extends Rect>(rect: T, width: number, height: number, clockwise: boolean): T;
|
|
52
68
|
export declare function turnSides(sides: Sides, clockwise?: boolean): Sides;
|
|
53
69
|
/** The corners after the same turn: the top right one comes to the top left, or the bottom left one, clockwise. */
|
|
54
70
|
export declare function turnRadius(radius: Radius, clockwise?: boolean): Radius;
|
|
@@ -37,6 +37,9 @@ export interface Body {
|
|
|
37
37
|
* the bezel, and Camera Control is left out where it sits flush. The Pixels
|
|
38
38
|
* but the 9 are measured the same way from Google's emulator frames, at their
|
|
39
39
|
* own density: the bezel, the corner, the punch hole and the right side's
|
|
40
|
-
* buttons, with the body radius an estimate as on the iPhones.
|
|
40
|
+
* buttons, with the body radius an estimate as on the iPhones. The islands
|
|
41
|
+
* of the 17 family, the 16 Pro and the Air, and the Air's screen radius, are
|
|
42
|
+
* measured on the iOS 26.5 simulator instead. An island's screen radius is the
|
|
43
|
+
* circle through the 45 degree point of its continuous corner.
|
|
41
44
|
*/
|
|
42
45
|
export declare const BODIES: Record<string, Body>;
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import type { Mock, Radius } from "./mock";
|
|
1
|
+
import type { Mock, Radius, Rect } from "./mock";
|
|
2
2
|
/**
|
|
3
3
|
* How far black runs past the screen's edge under a picture of the body, in
|
|
4
4
|
* css px of the screen. The picture's opening and the screen share an edge,
|
|
@@ -6,10 +6,22 @@ import type { Mock, Radius } from "./mock";
|
|
|
6
6
|
* mat would show through as a light line. The rim of the body there is black.
|
|
7
7
|
*/
|
|
8
8
|
export declare const UNDER = 2;
|
|
9
|
+
/**
|
|
10
|
+
* Apple's continuous screen corner, from the iOS 26.5 simulator's screen
|
|
11
|
+
* masks: the edge starts to curve `extent` times the radius from the corner,
|
|
12
|
+
* 84.66 on the 17 Pro, and passes the 45 degree point a circle of the radius
|
|
13
|
+
* would, 18.19 in. A superellipse of exponent 2 to the `shape` draws it.
|
|
14
|
+
*/
|
|
15
|
+
export declare const CONTINUOUS: {
|
|
16
|
+
readonly extent: 1.363;
|
|
17
|
+
readonly shape: 1.52;
|
|
18
|
+
};
|
|
9
19
|
/** A device's body over the frame, drawn by `drawMock`, in the letterbox's shadow root. */
|
|
10
|
-
export declare const MOCK_CSS
|
|
20
|
+
export declare const MOCK_CSS: string;
|
|
11
21
|
/** The radius of each corner, from the top left round by the right, `by` added to each. */
|
|
12
22
|
export declare function corners(radius: Radius, by?: number): [number, number, number, number];
|
|
23
|
+
/** A rect with continuous corners as path data, each corner a superellipse traced in 16 steps. */
|
|
24
|
+
export declare function continuousRect(rect: Rect, radius: Radius): string;
|
|
13
25
|
/**
|
|
14
26
|
* The device's body, in css px of the frame: the buttons under it, the band,
|
|
15
27
|
* the front glass inside it with the screen cut out, and the island, holes,
|
|
@@ -101,8 +101,11 @@ export declare function marginPlace(shot: number, padded: number): {
|
|
|
101
101
|
};
|
|
102
102
|
/** A picture of nothing, `width` by `height` px as made, as data: it holds a picture's place and draws none. */
|
|
103
103
|
export declare function blankUrl(width: number, height: number): string;
|
|
104
|
-
/**
|
|
105
|
-
|
|
104
|
+
/**
|
|
105
|
+
* The page in `frame`, copied as it is now for `paintPage`, or null where it
|
|
106
|
+
* is out of reach. What `leave` picks of the page is left out of the copy.
|
|
107
|
+
*/
|
|
108
|
+
export declare function copyPage(frame: HTMLIFrameElement, leave?: (node: Element) => boolean): Element | null;
|
|
106
109
|
/** `svg` as a data url, any lone half of a pair made U+FFFD first, as encoding one throws. */
|
|
107
110
|
export declare function svgUrl(svg: string): string;
|
|
108
111
|
/**
|