@present-day/device 0.1.0 → 0.2.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/README.md CHANGED
@@ -2,7 +2,7 @@
2
2
 
3
3
  Phone and tablet frames for screenshots, embedded pages and live content. Every frame is drawn in CSS from one set of proportions in [`src/core/devices.ts`](src/core/devices.ts), so a change there reaches every site that uses the package.
4
4
 
5
- The frame takes its shape from the content: the phone screen is 390 × 844 CSS pixels (an iPhone 12 to 14), so a screenshot or a page laid out at that size fills it exactly.
5
+ The frame takes its shape from the content: the phone screen is 390 × 844 CSS pixels (an iPhone 12 to 14), so a screenshot or a page laid out at that size fills it exactly. The real-phone presets also draw the status bar and tell the content where the cutout is, the way a phone's safe area does.
6
6
 
7
7
  ```sh
8
8
  npm i @present-day/device
@@ -27,20 +27,59 @@ import { Device } from '@present-day/device'
27
27
 
28
28
  The stylesheet is imported for you. Give the device a width, or a `maxHeight` (any CSS length); its height follows from the shape.
29
29
 
30
- | Prop | Default | |
31
- | -------------------------------- | --------------- | ---------------------------------------------------------------------------------------------------------- |
32
- | `device` | `'phone'` | `'phone'`, `'tablet'` (1180 × 820), or your own `DeviceSpec` |
33
- | `cutout` | the device's | `'island'` or `'none'`. Over an iframe it defaults to `'none'`, since the embedded page has no safe area |
34
- | `maxHeight` | | Any CSS length; the width shrinks to keep the whole device in it |
35
- | `src`, `alt`, `imgProps` | | A screenshot, drawn at the screen's size |
36
- | `iframe`, `title`, `iframeProps` | | A page laid out at the viewport and scaled to the screen. Wins over `src` and `children` |
37
- | `children`, `fit` | `fit: 'screen'` | Any content. `fit: 'viewport'` lays it out at the viewport and scales it like an iframe |
38
- | `interactive` | `false` | Lets pointer events reach the screen. Off, an iframe also leaves the tab order, so it never traps a scroll |
39
- | `overlay` | | Drawn over the screen and stays interactive, e.g. a poster until the page has drawn |
40
- | `fallback` | | Replaces the iframe, laid out at the viewport, once it has failed |
41
- | `loadTimeout` | | Milliseconds the iframe gets after it first scrolls into view before it counts as failed |
42
- | `ready`, `failed` | | Outside signals, e.g. from `postMessage`, since `load` can fire before hydration |
43
- | `onStatusChange` | | `'loading'`, `'ready'` or `'failed'` |
30
+ | Prop | Default | |
31
+ | -------------------------------- | --------------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
32
+ | `device` | `'phone'` | A preset (below) or your own `DeviceSpec` |
33
+ | `cutout` | the device's | `'island'`, `'none'`, or a shape: `{ type: 'island', width, height, top }` or `{ type: 'hole', diameter, top, x }`. Lengths are viewport px; a hole's `x` is its center as a fraction of the screen width (default `0.5`). On `phone` it defaults to `'none'` over an iframe. `'none'` hides the drawing; the insets still come from the device |
34
+ | `safeArea` | see below | `'expose'`, `'reserve'` or `'none'`, on presets with a safe area |
35
+ | `statusBarStyle` | `'dark'` | `'dark'` text for light content, `'light'` for dark |
36
+ | `maxHeight` | | Any CSS length; the width shrinks to keep the whole device in it |
37
+ | `src`, `alt`, `imgProps` | | A screenshot, drawn at the screen's size |
38
+ | `iframe`, `title`, `iframeProps` | | A page laid out at the viewport and scaled to the screen. Wins over `src` and `children` |
39
+ | `children`, `fit` | `fit: 'screen'` | Any content. `fit: 'viewport'` lays it out at the viewport and scales it like an iframe |
40
+ | `interactive` | `false` | Lets pointer events reach the screen. Off, an iframe also leaves the tab order, so it never traps a scroll |
41
+ | `overlay` | | Drawn over the screen and stays interactive, e.g. a poster until the page has drawn |
42
+ | `fallback` | | Replaces the iframe, laid out at the viewport, once it has failed |
43
+ | `loadTimeout` | | Milliseconds the iframe gets after it first scrolls into view before it counts as failed |
44
+ | `ready`, `failed` | | Outside signals, e.g. from `postMessage`, since `load` can fire before hydration |
45
+ | `onStatusChange` | | `'loading'`, `'ready'` or `'failed'` |
46
+
47
+ ## Presets
48
+
49
+ | `device` | Viewport | Cutout | Safe area (top, bottom) |
50
+ | --------------- | ---------- | --------------------------------- | ----------------------- |
51
+ | `phone` | 390 × 844 | Dynamic Island | none |
52
+ | `tablet` | 1180 × 820 | none | none |
53
+ | `iphone-16-pro` | 402 × 874 | Dynamic Island, 125 × 36.67 | 62, 34 |
54
+ | `pixel-9` | 412 × 923 | Punch hole, 30.5 across, centered | 50, 24 |
55
+
56
+ The iPhone 16 Pro numbers come from the iOS Simulator; the Pixel 9's from the Android emulator's device definition and skin. The Pixel's insets are approximate, since its status bar height isn't published.
57
+
58
+ ## The safe area
59
+
60
+ On a preset with a safe area, `safeArea` decides how the content meets the cutout:
61
+
62
+ | Mode | Default for | What happens |
63
+ | --------- | ----------------------- | --------------------------------------------------------------------------------------------------------------- |
64
+ | `reserve` | `iframe` and `children` | Solid status bar and home bands; the content gets the screen between them. Works with any content |
65
+ | `expose` | | Content runs edge to edge under a transparent status bar and gets the insets, so it can clear the cutout itself |
66
+ | `none` | `src` | No status bar or insets; a screenshot carries its own |
67
+
68
+ In `expose`, content reads four CSS variables, `--pd-safe-top`, `--pd-safe-right`, `--pd-safe-bottom` and `--pd-safe-left`. Fall back to `env()` and the same CSS works on a real phone:
69
+
70
+ ```css
71
+ padding-top: var(--pd-safe-top, env(safe-area-inset-top, 0px));
72
+ ```
73
+
74
+ React children get the variables on their wrapper. An iframe gets them through its URL: the frame adds `pd-safe-area=top,right,bottom,left` (CSS px), and the page applies it once at startup:
75
+
76
+ ```ts
77
+ import { applySafeArea } from '@present-day/device/core'
78
+
79
+ applySafeArea() // sets --pd-safe-* on <html>; does nothing without the parameter
80
+ ```
81
+
82
+ `withSafeArea(url, insets)` builds the same URL yourself. Changing the device or mode changes the URL, which reloads the iframe.
44
83
 
45
84
  ## Without React
46
85
 
@@ -62,6 +101,7 @@ deviceHTML({ src: '/shots/map.webp', alt: 'The map', width: 390, height: 844 })
62
101
  | `--pd-device-screen-color` | `#000` (behind content while it loads) |
63
102
  | `--pd-device-edge` | `hsl(0 0% 50% / 0.25)` (hairline that keeps the body visible on dark pages) |
64
103
  | `--pd-device-shadow` | `0 24px 48px -24px rgb(0 0 0 / 0.45)` |
104
+ | `--pd-device-status-color` | `#fff`, or `#000` with `statusBarStyle="light"` (the bands in `reserve`) |
65
105
 
66
106
  ## Development
67
107
 
package/dist/core.d.mts CHANGED
@@ -1,4 +1,26 @@
1
- type Cutout = 'island' | 'none';
1
+ /** A cutout's shape and place, in viewport CSS px. */
2
+ type CutoutSpec = {
3
+ type: 'island';
4
+ width: number;
5
+ height: number;
6
+ top: number;
7
+ } | {
8
+ type: 'hole';
9
+ diameter: number;
10
+ /** Distance from the screen's top edge to the hole's top. */
11
+ top: number;
12
+ /** The hole's center as a fraction of the screen width. Defaults to 0.5. */
13
+ x?: number;
14
+ };
15
+ /** `'island'` is the Dynamic Island in proportion to the screen width. */
16
+ type Cutout = 'island' | 'none' | CutoutSpec;
17
+ /** Insets from each screen edge that content should clear, in viewport CSS px, portrait. */
18
+ interface SafeArea {
19
+ top: number;
20
+ right: number;
21
+ bottom: number;
22
+ left: number;
23
+ }
2
24
  interface DeviceButton {
3
25
  side: 'left' | 'right' | 'top';
4
26
  /** Where the button starts, as a fraction of that side's length. */
@@ -21,6 +43,27 @@ interface DeviceSpec {
21
43
  screenRadius: number;
22
44
  cutout: Cutout;
23
45
  buttons: readonly DeviceButton[];
46
+ /** Hardware insets content should clear. Without it the device draws no status bar. */
47
+ safeArea?: SafeArea;
48
+ statusBar?: StatusBarSpec;
49
+ homeIndicator?: HomeIndicatorSpec;
50
+ }
51
+ /** Where the status bar sits, in viewport CSS px. */
52
+ interface StatusBarSpec {
53
+ /** The time's center, from the screen's left edge. */
54
+ time: number;
55
+ /** The icons' center, from the screen's right edge. */
56
+ icons: number;
57
+ /** The text's vertical center, from the screen's top edge. */
58
+ center: number;
59
+ fontSize: number;
60
+ }
61
+ /** The home indicator or gesture bar, in viewport CSS px. */
62
+ interface HomeIndicatorSpec {
63
+ width: number;
64
+ height: number;
65
+ /** Gap between the bar and the screen's bottom edge. */
66
+ bottom: number;
24
67
  }
25
68
  /**
26
69
  * Proportions follow the screen, not a particular model: the phone is a
@@ -69,47 +112,101 @@ declare const DEVICES: {
69
112
  readonly length: 0.06;
70
113
  }];
71
114
  };
72
- };
73
- type DeviceName = keyof typeof DEVICES;
74
- declare function resolveDevice(device?: DeviceName | DeviceSpec): DeviceSpec | {
75
- readonly viewport: {
76
- readonly width: 390;
77
- readonly height: 844;
115
+ readonly 'iphone-16-pro': {
116
+ readonly viewport: {
117
+ readonly width: 402;
118
+ readonly height: 874;
119
+ };
120
+ readonly bezel: 0.034;
121
+ readonly screenRadius: number;
122
+ readonly cutout: {
123
+ readonly type: "island";
124
+ readonly width: 125;
125
+ readonly height: 36.67;
126
+ readonly top: 14;
127
+ };
128
+ readonly safeArea: {
129
+ readonly top: 62;
130
+ readonly right: 0;
131
+ readonly bottom: 34;
132
+ readonly left: 0;
133
+ };
134
+ readonly statusBar: {
135
+ readonly time: 74;
136
+ readonly icons: 73;
137
+ readonly center: 33;
138
+ readonly fontSize: 17;
139
+ };
140
+ readonly homeIndicator: {
141
+ readonly width: 134;
142
+ readonly height: 5;
143
+ readonly bottom: 8;
144
+ };
145
+ readonly buttons: readonly [{
146
+ readonly side: "left";
147
+ readonly start: 0.175;
148
+ readonly length: 0.045;
149
+ }, {
150
+ readonly side: "left";
151
+ readonly start: 0.255;
152
+ readonly length: 0.085;
153
+ }, {
154
+ readonly side: "left";
155
+ readonly start: 0.36;
156
+ readonly length: 0.085;
157
+ }, {
158
+ readonly side: "right";
159
+ readonly start: 0.29;
160
+ readonly length: 0.14;
161
+ }, {
162
+ readonly side: "right";
163
+ readonly start: 0.6;
164
+ readonly length: 0.07;
165
+ }];
78
166
  };
79
- readonly bezel: 0.036;
80
- readonly screenRadius: number;
81
- readonly cutout: "island";
82
- readonly buttons: readonly [{
83
- readonly side: "left";
84
- readonly start: 0.175;
85
- readonly length: 0.045;
86
- }, {
87
- readonly side: "left";
88
- readonly start: 0.255;
89
- readonly length: 0.085;
90
- }, {
91
- readonly side: "left";
92
- readonly start: 0.36;
93
- readonly length: 0.085;
94
- }, {
95
- readonly side: "right";
96
- readonly start: 0.29;
97
- readonly length: 0.14;
98
- }];
99
- } | {
100
- readonly viewport: {
101
- readonly width: 1180;
102
- readonly height: 820;
167
+ readonly 'pixel-9': {
168
+ readonly viewport: {
169
+ readonly width: 412;
170
+ readonly height: 923;
171
+ };
172
+ readonly bezel: 0.034;
173
+ readonly screenRadius: number;
174
+ readonly cutout: {
175
+ readonly type: "hole";
176
+ readonly diameter: 30.5;
177
+ readonly top: 17.5;
178
+ readonly x: 0.5;
179
+ };
180
+ readonly safeArea: {
181
+ readonly top: 50;
182
+ readonly right: 0;
183
+ readonly bottom: 24;
184
+ readonly left: 0;
185
+ };
186
+ readonly statusBar: {
187
+ readonly time: 42;
188
+ readonly icons: 50;
189
+ readonly center: 26;
190
+ readonly fontSize: 14;
191
+ };
192
+ readonly homeIndicator: {
193
+ readonly width: 108;
194
+ readonly height: 4;
195
+ readonly bottom: 10;
196
+ };
197
+ readonly buttons: readonly [{
198
+ readonly side: "right";
199
+ readonly start: 0.22;
200
+ readonly length: 0.07;
201
+ }, {
202
+ readonly side: "right";
203
+ readonly start: 0.33;
204
+ readonly length: 0.14;
205
+ }];
103
206
  };
104
- readonly bezel: 0.032;
105
- readonly screenRadius: number;
106
- readonly cutout: "none";
107
- readonly buttons: readonly [{
108
- readonly side: "top";
109
- readonly start: 0.84;
110
- readonly length: 0.06;
111
- }];
112
207
  };
208
+ type DeviceName = keyof typeof DEVICES;
209
+ declare function resolveDevice(device?: DeviceName | DeviceSpec): DeviceSpec;
113
210
  interface DeviceGeometry {
114
211
  width: number;
115
212
  height: number;
@@ -120,12 +217,19 @@ interface DeviceGeometry {
120
217
  height: number;
121
218
  radius: number;
122
219
  };
123
- /** Absent when the cutout is `none`. */
124
220
  island?: {
125
221
  width: number;
126
222
  height: number;
127
223
  top: number;
128
224
  };
225
+ /** `x` is the hole's center as a fraction of the screen width. */
226
+ hole?: {
227
+ diameter: number;
228
+ top: number;
229
+ x: number;
230
+ };
231
+ /** Present when the spec has one, whatever the cutout. */
232
+ safeArea?: SafeArea;
129
233
  buttonDepth: number;
130
234
  /** Multiply the viewport by this to fit it to the screen. */
131
235
  scale: number;
@@ -166,4 +270,21 @@ interface DeviceHTMLOptions {
166
270
  */
167
271
  declare function deviceHTML(options: DeviceHTMLOptions): string;
168
272
 
169
- export { type Cutout, DEVICES, type DeviceButton, type DeviceGeometry, type DeviceHTMLOptions, type DeviceName, type DeviceSpec, deviceGeometry, deviceHTML, deviceVars, resolveDevice };
273
+ /** The query parameter a framed page reads its insets from: `top,right,bottom,left` in CSS px. */
274
+ declare const SAFE_AREA_PARAM = "pd-safe-area";
275
+ /**
276
+ * `url` with `pd-safe-area` set to the insets, rounded to whole pixels. The
277
+ * rest of the URL is kept exactly as given, relative or not. URLs that aren't
278
+ * http(s) or relative, such as `data:` and `about:blank`, come back unchanged.
279
+ */
280
+ declare function withSafeArea(url: string, insets: SafeArea): string;
281
+ /** The insets in a query string, or null when the parameter is absent or malformed. */
282
+ declare function readSafeArea(search: string): SafeArea | null;
283
+ /**
284
+ * Sets `--pd-safe-top`, `--pd-safe-right`, `--pd-safe-bottom` and
285
+ * `--pd-safe-left` on `target` from the page URL's `pd-safe-area`. Does
286
+ * nothing when it's absent, so CSS falls back to `env(safe-area-inset-*)`.
287
+ */
288
+ declare function applySafeArea(target?: HTMLElement, search?: string): SafeArea | null;
289
+
290
+ export { type Cutout, type CutoutSpec, DEVICES, type DeviceButton, type DeviceGeometry, type DeviceHTMLOptions, type DeviceName, type DeviceSpec, type HomeIndicatorSpec, SAFE_AREA_PARAM, type SafeArea, type StatusBarSpec, applySafeArea, deviceGeometry, deviceHTML, deviceVars, readSafeArea, resolveDevice, withSafeArea };
package/dist/core.d.ts CHANGED
@@ -1,4 +1,26 @@
1
- type Cutout = 'island' | 'none';
1
+ /** A cutout's shape and place, in viewport CSS px. */
2
+ type CutoutSpec = {
3
+ type: 'island';
4
+ width: number;
5
+ height: number;
6
+ top: number;
7
+ } | {
8
+ type: 'hole';
9
+ diameter: number;
10
+ /** Distance from the screen's top edge to the hole's top. */
11
+ top: number;
12
+ /** The hole's center as a fraction of the screen width. Defaults to 0.5. */
13
+ x?: number;
14
+ };
15
+ /** `'island'` is the Dynamic Island in proportion to the screen width. */
16
+ type Cutout = 'island' | 'none' | CutoutSpec;
17
+ /** Insets from each screen edge that content should clear, in viewport CSS px, portrait. */
18
+ interface SafeArea {
19
+ top: number;
20
+ right: number;
21
+ bottom: number;
22
+ left: number;
23
+ }
2
24
  interface DeviceButton {
3
25
  side: 'left' | 'right' | 'top';
4
26
  /** Where the button starts, as a fraction of that side's length. */
@@ -21,6 +43,27 @@ interface DeviceSpec {
21
43
  screenRadius: number;
22
44
  cutout: Cutout;
23
45
  buttons: readonly DeviceButton[];
46
+ /** Hardware insets content should clear. Without it the device draws no status bar. */
47
+ safeArea?: SafeArea;
48
+ statusBar?: StatusBarSpec;
49
+ homeIndicator?: HomeIndicatorSpec;
50
+ }
51
+ /** Where the status bar sits, in viewport CSS px. */
52
+ interface StatusBarSpec {
53
+ /** The time's center, from the screen's left edge. */
54
+ time: number;
55
+ /** The icons' center, from the screen's right edge. */
56
+ icons: number;
57
+ /** The text's vertical center, from the screen's top edge. */
58
+ center: number;
59
+ fontSize: number;
60
+ }
61
+ /** The home indicator or gesture bar, in viewport CSS px. */
62
+ interface HomeIndicatorSpec {
63
+ width: number;
64
+ height: number;
65
+ /** Gap between the bar and the screen's bottom edge. */
66
+ bottom: number;
24
67
  }
25
68
  /**
26
69
  * Proportions follow the screen, not a particular model: the phone is a
@@ -69,47 +112,101 @@ declare const DEVICES: {
69
112
  readonly length: 0.06;
70
113
  }];
71
114
  };
72
- };
73
- type DeviceName = keyof typeof DEVICES;
74
- declare function resolveDevice(device?: DeviceName | DeviceSpec): DeviceSpec | {
75
- readonly viewport: {
76
- readonly width: 390;
77
- readonly height: 844;
115
+ readonly 'iphone-16-pro': {
116
+ readonly viewport: {
117
+ readonly width: 402;
118
+ readonly height: 874;
119
+ };
120
+ readonly bezel: 0.034;
121
+ readonly screenRadius: number;
122
+ readonly cutout: {
123
+ readonly type: "island";
124
+ readonly width: 125;
125
+ readonly height: 36.67;
126
+ readonly top: 14;
127
+ };
128
+ readonly safeArea: {
129
+ readonly top: 62;
130
+ readonly right: 0;
131
+ readonly bottom: 34;
132
+ readonly left: 0;
133
+ };
134
+ readonly statusBar: {
135
+ readonly time: 74;
136
+ readonly icons: 73;
137
+ readonly center: 33;
138
+ readonly fontSize: 17;
139
+ };
140
+ readonly homeIndicator: {
141
+ readonly width: 134;
142
+ readonly height: 5;
143
+ readonly bottom: 8;
144
+ };
145
+ readonly buttons: readonly [{
146
+ readonly side: "left";
147
+ readonly start: 0.175;
148
+ readonly length: 0.045;
149
+ }, {
150
+ readonly side: "left";
151
+ readonly start: 0.255;
152
+ readonly length: 0.085;
153
+ }, {
154
+ readonly side: "left";
155
+ readonly start: 0.36;
156
+ readonly length: 0.085;
157
+ }, {
158
+ readonly side: "right";
159
+ readonly start: 0.29;
160
+ readonly length: 0.14;
161
+ }, {
162
+ readonly side: "right";
163
+ readonly start: 0.6;
164
+ readonly length: 0.07;
165
+ }];
78
166
  };
79
- readonly bezel: 0.036;
80
- readonly screenRadius: number;
81
- readonly cutout: "island";
82
- readonly buttons: readonly [{
83
- readonly side: "left";
84
- readonly start: 0.175;
85
- readonly length: 0.045;
86
- }, {
87
- readonly side: "left";
88
- readonly start: 0.255;
89
- readonly length: 0.085;
90
- }, {
91
- readonly side: "left";
92
- readonly start: 0.36;
93
- readonly length: 0.085;
94
- }, {
95
- readonly side: "right";
96
- readonly start: 0.29;
97
- readonly length: 0.14;
98
- }];
99
- } | {
100
- readonly viewport: {
101
- readonly width: 1180;
102
- readonly height: 820;
167
+ readonly 'pixel-9': {
168
+ readonly viewport: {
169
+ readonly width: 412;
170
+ readonly height: 923;
171
+ };
172
+ readonly bezel: 0.034;
173
+ readonly screenRadius: number;
174
+ readonly cutout: {
175
+ readonly type: "hole";
176
+ readonly diameter: 30.5;
177
+ readonly top: 17.5;
178
+ readonly x: 0.5;
179
+ };
180
+ readonly safeArea: {
181
+ readonly top: 50;
182
+ readonly right: 0;
183
+ readonly bottom: 24;
184
+ readonly left: 0;
185
+ };
186
+ readonly statusBar: {
187
+ readonly time: 42;
188
+ readonly icons: 50;
189
+ readonly center: 26;
190
+ readonly fontSize: 14;
191
+ };
192
+ readonly homeIndicator: {
193
+ readonly width: 108;
194
+ readonly height: 4;
195
+ readonly bottom: 10;
196
+ };
197
+ readonly buttons: readonly [{
198
+ readonly side: "right";
199
+ readonly start: 0.22;
200
+ readonly length: 0.07;
201
+ }, {
202
+ readonly side: "right";
203
+ readonly start: 0.33;
204
+ readonly length: 0.14;
205
+ }];
103
206
  };
104
- readonly bezel: 0.032;
105
- readonly screenRadius: number;
106
- readonly cutout: "none";
107
- readonly buttons: readonly [{
108
- readonly side: "top";
109
- readonly start: 0.84;
110
- readonly length: 0.06;
111
- }];
112
207
  };
208
+ type DeviceName = keyof typeof DEVICES;
209
+ declare function resolveDevice(device?: DeviceName | DeviceSpec): DeviceSpec;
113
210
  interface DeviceGeometry {
114
211
  width: number;
115
212
  height: number;
@@ -120,12 +217,19 @@ interface DeviceGeometry {
120
217
  height: number;
121
218
  radius: number;
122
219
  };
123
- /** Absent when the cutout is `none`. */
124
220
  island?: {
125
221
  width: number;
126
222
  height: number;
127
223
  top: number;
128
224
  };
225
+ /** `x` is the hole's center as a fraction of the screen width. */
226
+ hole?: {
227
+ diameter: number;
228
+ top: number;
229
+ x: number;
230
+ };
231
+ /** Present when the spec has one, whatever the cutout. */
232
+ safeArea?: SafeArea;
129
233
  buttonDepth: number;
130
234
  /** Multiply the viewport by this to fit it to the screen. */
131
235
  scale: number;
@@ -166,4 +270,21 @@ interface DeviceHTMLOptions {
166
270
  */
167
271
  declare function deviceHTML(options: DeviceHTMLOptions): string;
168
272
 
169
- export { type Cutout, DEVICES, type DeviceButton, type DeviceGeometry, type DeviceHTMLOptions, type DeviceName, type DeviceSpec, deviceGeometry, deviceHTML, deviceVars, resolveDevice };
273
+ /** The query parameter a framed page reads its insets from: `top,right,bottom,left` in CSS px. */
274
+ declare const SAFE_AREA_PARAM = "pd-safe-area";
275
+ /**
276
+ * `url` with `pd-safe-area` set to the insets, rounded to whole pixels. The
277
+ * rest of the URL is kept exactly as given, relative or not. URLs that aren't
278
+ * http(s) or relative, such as `data:` and `about:blank`, come back unchanged.
279
+ */
280
+ declare function withSafeArea(url: string, insets: SafeArea): string;
281
+ /** The insets in a query string, or null when the parameter is absent or malformed. */
282
+ declare function readSafeArea(search: string): SafeArea | null;
283
+ /**
284
+ * Sets `--pd-safe-top`, `--pd-safe-right`, `--pd-safe-bottom` and
285
+ * `--pd-safe-left` on `target` from the page URL's `pd-safe-area`. Does
286
+ * nothing when it's absent, so CSS falls back to `env(safe-area-inset-*)`.
287
+ */
288
+ declare function applySafeArea(target?: HTMLElement, search?: string): SafeArea | null;
289
+
290
+ export { type Cutout, type CutoutSpec, DEVICES, type DeviceButton, type DeviceGeometry, type DeviceHTMLOptions, type DeviceName, type DeviceSpec, type HomeIndicatorSpec, SAFE_AREA_PARAM, type SafeArea, type StatusBarSpec, applySafeArea, deviceGeometry, deviceHTML, deviceVars, readSafeArea, resolveDevice, withSafeArea };