@erkamyaman/capacitor-foldable 7.0.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/ErkamyamanCapacitorFoldable.podspec +17 -0
- package/LICENSE +21 -0
- package/Package.swift +28 -0
- package/README.md +457 -0
- package/android/build.gradle +71 -0
- package/android/src/main/AndroidManifest.xml +2 -0
- package/android/src/main/kotlin/io/github/erkamyaman/foldable/DisplayModes.kt +115 -0
- package/android/src/main/kotlin/io/github/erkamyaman/foldable/Foldable.kt +189 -0
- package/android/src/main/kotlin/io/github/erkamyaman/foldable/FoldablePlugin.kt +333 -0
- package/android/src/main/res/.gitkeep +0 -0
- package/dist/docs.json +584 -0
- package/dist/esm/css.d.ts +8 -0
- package/dist/esm/css.js +29 -0
- package/dist/esm/css.js.map +1 -0
- package/dist/esm/definitions.d.ts +267 -0
- package/dist/esm/definitions.js +2 -0
- package/dist/esm/definitions.js.map +1 -0
- package/dist/esm/index.d.ts +5 -0
- package/dist/esm/index.js +9 -0
- package/dist/esm/index.js.map +1 -0
- package/dist/esm/polyfill.d.ts +19 -0
- package/dist/esm/polyfill.js +76 -0
- package/dist/esm/polyfill.js.map +1 -0
- package/dist/esm/segments.d.ts +8 -0
- package/dist/esm/segments.js +26 -0
- package/dist/esm/segments.js.map +1 -0
- package/dist/esm/size-class.d.ts +2 -0
- package/dist/esm/size-class.js +33 -0
- package/dist/esm/size-class.js.map +1 -0
- package/dist/esm/web.d.ts +21 -0
- package/dist/esm/web.js +46 -0
- package/dist/esm/web.js.map +1 -0
- package/dist/plugin.cjs.js +222 -0
- package/dist/plugin.cjs.js.map +1 -0
- package/dist/plugin.js +225 -0
- package/dist/plugin.js.map +1 -0
- package/ios/Sources/FoldablePlugin/Foldable.swift +156 -0
- package/ios/Sources/FoldablePlugin/FoldablePlugin.swift +194 -0
- package/ios/Sources/FoldablePlugin/ReservedRegionFoldProvider.swift +69 -0
- package/ios/Sources/FoldablePlugin/UIKitFoldSource.swift +53 -0
- package/ios/Tests/FoldablePluginTests/FoldableTests.swift +104 -0
- package/ios/Tests/FoldablePluginTests/ReservedRegionFoldProviderTests.swift +143 -0
- package/package.json +96 -0
package/dist/docs.json
ADDED
|
@@ -0,0 +1,584 @@
|
|
|
1
|
+
{
|
|
2
|
+
"api": {
|
|
3
|
+
"name": "FoldablePlugin",
|
|
4
|
+
"slug": "foldableplugin",
|
|
5
|
+
"docs": "",
|
|
6
|
+
"tags": [],
|
|
7
|
+
"methods": [
|
|
8
|
+
{
|
|
9
|
+
"name": "isDeviceFoldable",
|
|
10
|
+
"signature": "() => Promise<{ foldable: boolean; supportsTabletop: boolean; }>",
|
|
11
|
+
"parameters": [],
|
|
12
|
+
"returns": "Promise<{ foldable: boolean; supportsTabletop: boolean; }>",
|
|
13
|
+
"tags": [
|
|
14
|
+
{
|
|
15
|
+
"name": "since",
|
|
16
|
+
"text": "7.0.0"
|
|
17
|
+
}
|
|
18
|
+
],
|
|
19
|
+
"docs": "Whether the device has a fold at all, and whether it can be propped half\nopen like a laptop. Both `false` on web, and on iOS except on iPhone Duo\n(iOS 27.1 or later).",
|
|
20
|
+
"complexTypes": [],
|
|
21
|
+
"slug": "isdevicefoldable"
|
|
22
|
+
},
|
|
23
|
+
{
|
|
24
|
+
"name": "getFoldState",
|
|
25
|
+
"signature": "() => Promise<FoldState>",
|
|
26
|
+
"parameters": [],
|
|
27
|
+
"returns": "Promise<FoldState>",
|
|
28
|
+
"tags": [
|
|
29
|
+
{
|
|
30
|
+
"name": "since",
|
|
31
|
+
"text": "7.0.0"
|
|
32
|
+
}
|
|
33
|
+
],
|
|
34
|
+
"docs": "Read the current fold state. Resolves to\n`{ state: 'flat', isSeparating: false, posture: 'flat' }` when there is no\nfold information.",
|
|
35
|
+
"complexTypes": [
|
|
36
|
+
"FoldState"
|
|
37
|
+
],
|
|
38
|
+
"slug": "getfoldstate"
|
|
39
|
+
},
|
|
40
|
+
{
|
|
41
|
+
"name": "getHingeAngle",
|
|
42
|
+
"signature": "() => Promise<{ angle: number | null; }>",
|
|
43
|
+
"parameters": [],
|
|
44
|
+
"returns": "Promise<{ angle: number | null; }>",
|
|
45
|
+
"tags": [
|
|
46
|
+
{
|
|
47
|
+
"name": "since",
|
|
48
|
+
"text": "7.0.0"
|
|
49
|
+
}
|
|
50
|
+
],
|
|
51
|
+
"docs": "Read the angle between the two halves of the device, in degrees: `0` when\nclosed, `180` when flat. Resolves to `{ angle: null }` on devices without a\nhinge angle sensor, on web, and on iOS before 27.1.",
|
|
52
|
+
"complexTypes": [],
|
|
53
|
+
"slug": "gethingeangle"
|
|
54
|
+
},
|
|
55
|
+
{
|
|
56
|
+
"name": "getSizeClass",
|
|
57
|
+
"signature": "() => Promise<SizeClass>",
|
|
58
|
+
"parameters": [],
|
|
59
|
+
"returns": "Promise<SizeClass>",
|
|
60
|
+
"tags": [
|
|
61
|
+
{
|
|
62
|
+
"name": "since",
|
|
63
|
+
"text": "7.0.0"
|
|
64
|
+
}
|
|
65
|
+
],
|
|
66
|
+
"docs": "Read the window's size classes: Apple's compact and regular, the signal its\niPhone Duo guidelines recommend for telling the outer display from the inner\none, and Material's width and height classes. On iOS `horizontal` and\n`vertical` are UIKit's size classes; everything else comes from the window\nsize.",
|
|
67
|
+
"complexTypes": [
|
|
68
|
+
"SizeClass"
|
|
69
|
+
],
|
|
70
|
+
"slug": "getsizeclass"
|
|
71
|
+
},
|
|
72
|
+
{
|
|
73
|
+
"name": "getDisplayModes",
|
|
74
|
+
"signature": "() => Promise<DisplayModes>",
|
|
75
|
+
"parameters": [],
|
|
76
|
+
"returns": "Promise<DisplayModes>",
|
|
77
|
+
"tags": [
|
|
78
|
+
{
|
|
79
|
+
"name": "since",
|
|
80
|
+
"text": "7.0.0"
|
|
81
|
+
}
|
|
82
|
+
],
|
|
83
|
+
"docs": "Read which of the foldable display modes the device offers right now. Both\nare `'unsupported'` on iOS and web.",
|
|
84
|
+
"complexTypes": [
|
|
85
|
+
"DisplayModes"
|
|
86
|
+
],
|
|
87
|
+
"slug": "getdisplaymodes"
|
|
88
|
+
},
|
|
89
|
+
{
|
|
90
|
+
"name": "getBarPlacement",
|
|
91
|
+
"signature": "() => Promise<BarPlacement>",
|
|
92
|
+
"parameters": [],
|
|
93
|
+
"returns": "Promise<BarPlacement>",
|
|
94
|
+
"tags": [
|
|
95
|
+
{
|
|
96
|
+
"name": "since",
|
|
97
|
+
"text": "7.0.0"
|
|
98
|
+
}
|
|
99
|
+
],
|
|
100
|
+
"docs": "Read where native bars go. Native tab bars and toolbars move to the side of\nthe display on iPhone Duo, but HTML ones stay put, so use this to move your\nown tab bar too.",
|
|
101
|
+
"complexTypes": [
|
|
102
|
+
"BarPlacement"
|
|
103
|
+
],
|
|
104
|
+
"slug": "getbarplacement"
|
|
105
|
+
},
|
|
106
|
+
{
|
|
107
|
+
"name": "startRearDisplay",
|
|
108
|
+
"signature": "() => Promise<void>",
|
|
109
|
+
"parameters": [],
|
|
110
|
+
"returns": "Promise<void>",
|
|
111
|
+
"tags": [
|
|
112
|
+
{
|
|
113
|
+
"name": "since",
|
|
114
|
+
"text": "7.0.0"
|
|
115
|
+
}
|
|
116
|
+
],
|
|
117
|
+
"docs": "Move the app to the outer display. Android asks the user to confirm first,\nand the promise resolves once the app has moved. Rejects when rear display\nmode is not `'available'`. Only on Android.",
|
|
118
|
+
"complexTypes": [],
|
|
119
|
+
"slug": "startreardisplay"
|
|
120
|
+
},
|
|
121
|
+
{
|
|
122
|
+
"name": "stopRearDisplay",
|
|
123
|
+
"signature": "() => Promise<void>",
|
|
124
|
+
"parameters": [],
|
|
125
|
+
"returns": "Promise<void>",
|
|
126
|
+
"tags": [
|
|
127
|
+
{
|
|
128
|
+
"name": "since",
|
|
129
|
+
"text": "7.0.0"
|
|
130
|
+
}
|
|
131
|
+
],
|
|
132
|
+
"docs": "Move the app back to the inner display.",
|
|
133
|
+
"complexTypes": [],
|
|
134
|
+
"slug": "stopreardisplay"
|
|
135
|
+
},
|
|
136
|
+
{
|
|
137
|
+
"name": "startDualScreen",
|
|
138
|
+
"signature": "(options: { url: string; }) => Promise<void>",
|
|
139
|
+
"parameters": [
|
|
140
|
+
{
|
|
141
|
+
"name": "options",
|
|
142
|
+
"docs": "",
|
|
143
|
+
"type": "{ url: string; }"
|
|
144
|
+
}
|
|
145
|
+
],
|
|
146
|
+
"returns": "Promise<void>",
|
|
147
|
+
"tags": [
|
|
148
|
+
{
|
|
149
|
+
"name": "since",
|
|
150
|
+
"text": "7.0.0"
|
|
151
|
+
}
|
|
152
|
+
],
|
|
153
|
+
"docs": "Show a page on the outer display while the app stays on the inner one. A\nrelative `url` resolves against the app's own URL, so `'cover.html'` loads a\npage bundled with the app. The page runs in its own web view without access\nto Capacitor plugins. Calling this again while dual-screen mode is active\nreplaces the page. Only on Android.",
|
|
154
|
+
"complexTypes": [],
|
|
155
|
+
"slug": "startdualscreen"
|
|
156
|
+
},
|
|
157
|
+
{
|
|
158
|
+
"name": "stopDualScreen",
|
|
159
|
+
"signature": "() => Promise<void>",
|
|
160
|
+
"parameters": [],
|
|
161
|
+
"returns": "Promise<void>",
|
|
162
|
+
"tags": [
|
|
163
|
+
{
|
|
164
|
+
"name": "since",
|
|
165
|
+
"text": "7.0.0"
|
|
166
|
+
}
|
|
167
|
+
],
|
|
168
|
+
"docs": "Close the page on the outer display.",
|
|
169
|
+
"complexTypes": [],
|
|
170
|
+
"slug": "stopdualscreen"
|
|
171
|
+
},
|
|
172
|
+
{
|
|
173
|
+
"name": "addListener",
|
|
174
|
+
"signature": "(eventName: 'foldStateChange', listenerFunc: (state: FoldState) => void) => Promise<PluginListenerHandle>",
|
|
175
|
+
"parameters": [
|
|
176
|
+
{
|
|
177
|
+
"name": "eventName",
|
|
178
|
+
"docs": "",
|
|
179
|
+
"type": "'foldStateChange'"
|
|
180
|
+
},
|
|
181
|
+
{
|
|
182
|
+
"name": "listenerFunc",
|
|
183
|
+
"docs": "",
|
|
184
|
+
"type": "(state: FoldState) => void"
|
|
185
|
+
}
|
|
186
|
+
],
|
|
187
|
+
"returns": "Promise<PluginListenerHandle>",
|
|
188
|
+
"tags": [
|
|
189
|
+
{
|
|
190
|
+
"name": "since",
|
|
191
|
+
"text": "7.0.0"
|
|
192
|
+
}
|
|
193
|
+
],
|
|
194
|
+
"docs": "Listen for fold state changes. On a foldable this also fires when the\ndevice rotates, because `hingeOrientation` and `hingeBounds` rotate with\nthe window.",
|
|
195
|
+
"complexTypes": [
|
|
196
|
+
"PluginListenerHandle",
|
|
197
|
+
"FoldState"
|
|
198
|
+
],
|
|
199
|
+
"slug": "addlistenerfoldstatechange-"
|
|
200
|
+
},
|
|
201
|
+
{
|
|
202
|
+
"name": "addListener",
|
|
203
|
+
"signature": "(eventName: 'hingeAngleChange', listenerFunc: (event: { angle: number; }) => void) => Promise<PluginListenerHandle>",
|
|
204
|
+
"parameters": [
|
|
205
|
+
{
|
|
206
|
+
"name": "eventName",
|
|
207
|
+
"docs": "",
|
|
208
|
+
"type": "'hingeAngleChange'"
|
|
209
|
+
},
|
|
210
|
+
{
|
|
211
|
+
"name": "listenerFunc",
|
|
212
|
+
"docs": "",
|
|
213
|
+
"type": "(event: { angle: number; }) => void"
|
|
214
|
+
}
|
|
215
|
+
],
|
|
216
|
+
"returns": "Promise<PluginListenerHandle>",
|
|
217
|
+
"tags": [
|
|
218
|
+
{
|
|
219
|
+
"name": "since",
|
|
220
|
+
"text": "7.0.0"
|
|
221
|
+
}
|
|
222
|
+
],
|
|
223
|
+
"docs": "Listen for hinge angle changes. On Android the hinge sensor only runs while\nat least one of these listeners is registered. On iOS it fires on iPhone\nDuo (iOS 27.1 or later). Never fires on web.",
|
|
224
|
+
"complexTypes": [
|
|
225
|
+
"PluginListenerHandle"
|
|
226
|
+
],
|
|
227
|
+
"slug": "addlistenerhingeanglechange-"
|
|
228
|
+
},
|
|
229
|
+
{
|
|
230
|
+
"name": "addListener",
|
|
231
|
+
"signature": "(eventName: 'sizeClassChange', listenerFunc: (sizeClass: SizeClass) => void) => Promise<PluginListenerHandle>",
|
|
232
|
+
"parameters": [
|
|
233
|
+
{
|
|
234
|
+
"name": "eventName",
|
|
235
|
+
"docs": "",
|
|
236
|
+
"type": "'sizeClassChange'"
|
|
237
|
+
},
|
|
238
|
+
{
|
|
239
|
+
"name": "listenerFunc",
|
|
240
|
+
"docs": "",
|
|
241
|
+
"type": "(sizeClass: SizeClass) => void"
|
|
242
|
+
}
|
|
243
|
+
],
|
|
244
|
+
"returns": "Promise<PluginListenerHandle>",
|
|
245
|
+
"tags": [
|
|
246
|
+
{
|
|
247
|
+
"name": "since",
|
|
248
|
+
"text": "7.0.0"
|
|
249
|
+
}
|
|
250
|
+
],
|
|
251
|
+
"docs": "Listen for size class changes, such as unfolding the device, rotating it or\nresizing the window. On iOS this fires when UIKit's size classes change\n(iOS 17 or later) or the device rotates, so a resize that keeps the same\nsize classes may not update `widthClass` and `heightClass` until then.",
|
|
252
|
+
"complexTypes": [
|
|
253
|
+
"PluginListenerHandle",
|
|
254
|
+
"SizeClass"
|
|
255
|
+
],
|
|
256
|
+
"slug": "addlistenersizeclasschange-"
|
|
257
|
+
},
|
|
258
|
+
{
|
|
259
|
+
"name": "addListener",
|
|
260
|
+
"signature": "(eventName: 'displayModeChange', listenerFunc: (modes: DisplayModes) => void) => Promise<PluginListenerHandle>",
|
|
261
|
+
"parameters": [
|
|
262
|
+
{
|
|
263
|
+
"name": "eventName",
|
|
264
|
+
"docs": "",
|
|
265
|
+
"type": "'displayModeChange'"
|
|
266
|
+
},
|
|
267
|
+
{
|
|
268
|
+
"name": "listenerFunc",
|
|
269
|
+
"docs": "",
|
|
270
|
+
"type": "(modes: DisplayModes) => void"
|
|
271
|
+
}
|
|
272
|
+
],
|
|
273
|
+
"returns": "Promise<PluginListenerHandle>",
|
|
274
|
+
"tags": [
|
|
275
|
+
{
|
|
276
|
+
"name": "since",
|
|
277
|
+
"text": "7.0.0"
|
|
278
|
+
}
|
|
279
|
+
],
|
|
280
|
+
"docs": "Listen for changes to the display modes, including a mode ending because\nthe user folded or unfolded the device. Never fires on iOS and web.",
|
|
281
|
+
"complexTypes": [
|
|
282
|
+
"PluginListenerHandle",
|
|
283
|
+
"DisplayModes"
|
|
284
|
+
],
|
|
285
|
+
"slug": "addlistenerdisplaymodechange-"
|
|
286
|
+
},
|
|
287
|
+
{
|
|
288
|
+
"name": "addListener",
|
|
289
|
+
"signature": "(eventName: 'barPlacementChange', listenerFunc: (placement: BarPlacement) => void) => Promise<PluginListenerHandle>",
|
|
290
|
+
"parameters": [
|
|
291
|
+
{
|
|
292
|
+
"name": "eventName",
|
|
293
|
+
"docs": "",
|
|
294
|
+
"type": "'barPlacementChange'"
|
|
295
|
+
},
|
|
296
|
+
{
|
|
297
|
+
"name": "listenerFunc",
|
|
298
|
+
"docs": "",
|
|
299
|
+
"type": "(placement: BarPlacement) => void"
|
|
300
|
+
}
|
|
301
|
+
],
|
|
302
|
+
"returns": "Promise<PluginListenerHandle>",
|
|
303
|
+
"tags": [
|
|
304
|
+
{
|
|
305
|
+
"name": "since",
|
|
306
|
+
"text": "7.0.0"
|
|
307
|
+
}
|
|
308
|
+
],
|
|
309
|
+
"docs": "Listen for bar placement changes, such as opening or rotating iPhone Duo.\nOnly fires on iOS 27.1 or later.",
|
|
310
|
+
"complexTypes": [
|
|
311
|
+
"PluginListenerHandle",
|
|
312
|
+
"BarPlacement"
|
|
313
|
+
],
|
|
314
|
+
"slug": "addlistenerbarplacementchange-"
|
|
315
|
+
}
|
|
316
|
+
],
|
|
317
|
+
"properties": []
|
|
318
|
+
},
|
|
319
|
+
"interfaces": [
|
|
320
|
+
{
|
|
321
|
+
"name": "FoldState",
|
|
322
|
+
"slug": "foldstate",
|
|
323
|
+
"docs": "",
|
|
324
|
+
"tags": [],
|
|
325
|
+
"methods": [],
|
|
326
|
+
"properties": [
|
|
327
|
+
{
|
|
328
|
+
"name": "state",
|
|
329
|
+
"tags": [
|
|
330
|
+
{
|
|
331
|
+
"text": "7.0.0",
|
|
332
|
+
"name": "since"
|
|
333
|
+
}
|
|
334
|
+
],
|
|
335
|
+
"docs": "Posture of the fold. `'closed'` is never reported today: a device shut on\nits cover display reports `'flat'`.",
|
|
336
|
+
"complexTypes": [],
|
|
337
|
+
"type": "'flat' | 'half-opened' | 'closed'"
|
|
338
|
+
},
|
|
339
|
+
{
|
|
340
|
+
"name": "isSeparating",
|
|
341
|
+
"tags": [
|
|
342
|
+
{
|
|
343
|
+
"text": "7.0.0",
|
|
344
|
+
"name": "since"
|
|
345
|
+
}
|
|
346
|
+
],
|
|
347
|
+
"docs": "Whether the fold splits the web view into two areas: `true` when\nhalf-opened, or when the hinge has a physical gap.",
|
|
348
|
+
"complexTypes": [],
|
|
349
|
+
"type": "boolean"
|
|
350
|
+
},
|
|
351
|
+
{
|
|
352
|
+
"name": "posture",
|
|
353
|
+
"tags": [
|
|
354
|
+
{
|
|
355
|
+
"text": "7.0.0",
|
|
356
|
+
"name": "since"
|
|
357
|
+
}
|
|
358
|
+
],
|
|
359
|
+
"docs": "How the device is held: `'tabletop'` when half-opened with a horizontal\nhinge, like a laptop, `'book'` when half-opened with a vertical hinge, and\n`'flat'` otherwise.",
|
|
360
|
+
"complexTypes": [],
|
|
361
|
+
"type": "'flat' | 'tabletop' | 'book'"
|
|
362
|
+
},
|
|
363
|
+
{
|
|
364
|
+
"name": "hingeOrientation",
|
|
365
|
+
"tags": [
|
|
366
|
+
{
|
|
367
|
+
"text": "7.0.0",
|
|
368
|
+
"name": "since"
|
|
369
|
+
}
|
|
370
|
+
],
|
|
371
|
+
"docs": "Direction of the hinge relative to the window, so it flips when the device\nrotates. Omitted when there is no fold.",
|
|
372
|
+
"complexTypes": [],
|
|
373
|
+
"type": "'horizontal' | 'vertical' | undefined"
|
|
374
|
+
},
|
|
375
|
+
{
|
|
376
|
+
"name": "hingeBounds",
|
|
377
|
+
"tags": [
|
|
378
|
+
{
|
|
379
|
+
"text": "7.0.0",
|
|
380
|
+
"name": "since"
|
|
381
|
+
}
|
|
382
|
+
],
|
|
383
|
+
"docs": "Position of the fold in CSS pixels, relative to the web view. Zero wide (or\nzero tall) on a seamless fold. Omitted when there is no fold.",
|
|
384
|
+
"complexTypes": [],
|
|
385
|
+
"type": "{ x: number; y: number; width: number; height: number; } | undefined"
|
|
386
|
+
},
|
|
387
|
+
{
|
|
388
|
+
"name": "occludedBounds",
|
|
389
|
+
"tags": [
|
|
390
|
+
{
|
|
391
|
+
"text": "7.0.0",
|
|
392
|
+
"name": "since"
|
|
393
|
+
}
|
|
394
|
+
],
|
|
395
|
+
"docs": "Area of the web view the hinge covers, in CSS pixels. Only present on\ndevices with a physical gap.",
|
|
396
|
+
"complexTypes": [],
|
|
397
|
+
"type": "{ x: number; y: number; width: number; height: number; } | undefined"
|
|
398
|
+
},
|
|
399
|
+
{
|
|
400
|
+
"name": "activeDisplay",
|
|
401
|
+
"tags": [
|
|
402
|
+
{
|
|
403
|
+
"text": "7.0.0",
|
|
404
|
+
"name": "since"
|
|
405
|
+
}
|
|
406
|
+
],
|
|
407
|
+
"docs": "Which display is showing the app, on a device with an inner and an outer\ndisplay such as iPhone Duo. Reported on iPhone Duo (iOS 27.1 or later) and\nomitted elsewhere.",
|
|
408
|
+
"complexTypes": [],
|
|
409
|
+
"type": "'inner' | 'outer' | undefined"
|
|
410
|
+
},
|
|
411
|
+
{
|
|
412
|
+
"name": "cameraBounds",
|
|
413
|
+
"tags": [
|
|
414
|
+
{
|
|
415
|
+
"text": "7.0.0",
|
|
416
|
+
"name": "since"
|
|
417
|
+
}
|
|
418
|
+
],
|
|
419
|
+
"docs": "Areas of the web view covered by a front-facing camera, in CSS pixels. On\nAndroid these are the display cutouts. On iPhone Duo they are the outer\ncamera and the under-display inner camera while it is in use. Omitted when\nthere are none.",
|
|
420
|
+
"complexTypes": [],
|
|
421
|
+
"type": "{ x: number; y: number; width: number; height: number; }[] | undefined"
|
|
422
|
+
}
|
|
423
|
+
]
|
|
424
|
+
},
|
|
425
|
+
{
|
|
426
|
+
"name": "SizeClass",
|
|
427
|
+
"slug": "sizeclass",
|
|
428
|
+
"docs": "",
|
|
429
|
+
"tags": [],
|
|
430
|
+
"methods": [],
|
|
431
|
+
"properties": [
|
|
432
|
+
{
|
|
433
|
+
"name": "horizontal",
|
|
434
|
+
"tags": [
|
|
435
|
+
{
|
|
436
|
+
"text": "7.0.0",
|
|
437
|
+
"name": "since"
|
|
438
|
+
}
|
|
439
|
+
],
|
|
440
|
+
"docs": "Width size class of the window: `'compact'` on a phone and on the outer\ndisplay of a foldable, `'regular'` on the inner display, tablets and wide\nwindows. On Android and web `'regular'` starts at 600 CSS pixels.",
|
|
441
|
+
"complexTypes": [],
|
|
442
|
+
"type": "'compact' | 'regular'"
|
|
443
|
+
},
|
|
444
|
+
{
|
|
445
|
+
"name": "vertical",
|
|
446
|
+
"tags": [
|
|
447
|
+
{
|
|
448
|
+
"text": "7.0.0",
|
|
449
|
+
"name": "since"
|
|
450
|
+
}
|
|
451
|
+
],
|
|
452
|
+
"docs": "Height size class of the window: `'compact'` on a phone in landscape. On\nAndroid and web `'regular'` starts at 480 CSS pixels.",
|
|
453
|
+
"complexTypes": [],
|
|
454
|
+
"type": "'compact' | 'regular'"
|
|
455
|
+
},
|
|
456
|
+
{
|
|
457
|
+
"name": "widthClass",
|
|
458
|
+
"tags": [
|
|
459
|
+
{
|
|
460
|
+
"text": "7.0.0",
|
|
461
|
+
"name": "since"
|
|
462
|
+
}
|
|
463
|
+
],
|
|
464
|
+
"docs": "Material window width class, from the window width in CSS pixels:\n`'compact'` below 600, `'medium'` below 840, `'expanded'` below 1200,\n`'large'` below 1600 and `'extraLarge'` from 1600.",
|
|
465
|
+
"complexTypes": [],
|
|
466
|
+
"type": "'compact' | 'medium' | 'expanded' | 'large' | 'extraLarge'"
|
|
467
|
+
},
|
|
468
|
+
{
|
|
469
|
+
"name": "heightClass",
|
|
470
|
+
"tags": [
|
|
471
|
+
{
|
|
472
|
+
"text": "7.0.0",
|
|
473
|
+
"name": "since"
|
|
474
|
+
}
|
|
475
|
+
],
|
|
476
|
+
"docs": "Material window height class, from the window height in CSS pixels:\n`'compact'` below 480, `'medium'` below 900 and `'expanded'` from 900.",
|
|
477
|
+
"complexTypes": [],
|
|
478
|
+
"type": "'compact' | 'medium' | 'expanded'"
|
|
479
|
+
}
|
|
480
|
+
]
|
|
481
|
+
},
|
|
482
|
+
{
|
|
483
|
+
"name": "DisplayModes",
|
|
484
|
+
"slug": "displaymodes",
|
|
485
|
+
"docs": "",
|
|
486
|
+
"tags": [],
|
|
487
|
+
"methods": [],
|
|
488
|
+
"properties": [
|
|
489
|
+
{
|
|
490
|
+
"name": "rearDisplay",
|
|
491
|
+
"tags": [
|
|
492
|
+
{
|
|
493
|
+
"text": "7.0.0",
|
|
494
|
+
"name": "since"
|
|
495
|
+
}
|
|
496
|
+
],
|
|
497
|
+
"docs": "Rear display mode moves the app to the outer display, so people can frame a\nphoto with the rear cameras. Only on Android foldables that offer it.",
|
|
498
|
+
"complexTypes": [
|
|
499
|
+
"DisplayModeStatus"
|
|
500
|
+
],
|
|
501
|
+
"type": "DisplayModeStatus"
|
|
502
|
+
},
|
|
503
|
+
{
|
|
504
|
+
"name": "dualScreen",
|
|
505
|
+
"tags": [
|
|
506
|
+
{
|
|
507
|
+
"text": "7.0.0",
|
|
508
|
+
"name": "since"
|
|
509
|
+
}
|
|
510
|
+
],
|
|
511
|
+
"docs": "Dual-screen mode shows a second page on the outer display while the app\nstays on the inner one. Only on Android foldables that offer it.",
|
|
512
|
+
"complexTypes": [
|
|
513
|
+
"DisplayModeStatus"
|
|
514
|
+
],
|
|
515
|
+
"type": "DisplayModeStatus"
|
|
516
|
+
}
|
|
517
|
+
]
|
|
518
|
+
},
|
|
519
|
+
{
|
|
520
|
+
"name": "BarPlacement",
|
|
521
|
+
"slug": "barplacement",
|
|
522
|
+
"docs": "",
|
|
523
|
+
"tags": [],
|
|
524
|
+
"methods": [],
|
|
525
|
+
"properties": [
|
|
526
|
+
{
|
|
527
|
+
"name": "verticalBarEdge",
|
|
528
|
+
"tags": [
|
|
529
|
+
{
|
|
530
|
+
"text": "7.0.0",
|
|
531
|
+
"name": "since"
|
|
532
|
+
}
|
|
533
|
+
],
|
|
534
|
+
"docs": "The edge iPhone Duo moves tab bars and toolbars to when it lays them out\nvertically: `'leading'` or `'trailing'` in the reading direction, so\n`'leading'` is the left edge in left-to-right languages. `null` when bars\nstay horizontal, and always on Android, web and iOS before 27.1.",
|
|
535
|
+
"complexTypes": [],
|
|
536
|
+
"type": "'leading' | 'trailing' | null"
|
|
537
|
+
}
|
|
538
|
+
]
|
|
539
|
+
},
|
|
540
|
+
{
|
|
541
|
+
"name": "PluginListenerHandle",
|
|
542
|
+
"slug": "pluginlistenerhandle",
|
|
543
|
+
"docs": "",
|
|
544
|
+
"tags": [],
|
|
545
|
+
"methods": [],
|
|
546
|
+
"properties": [
|
|
547
|
+
{
|
|
548
|
+
"name": "remove",
|
|
549
|
+
"tags": [],
|
|
550
|
+
"docs": "",
|
|
551
|
+
"complexTypes": [],
|
|
552
|
+
"type": "() => Promise<void>"
|
|
553
|
+
}
|
|
554
|
+
]
|
|
555
|
+
}
|
|
556
|
+
],
|
|
557
|
+
"enums": [],
|
|
558
|
+
"typeAliases": [
|
|
559
|
+
{
|
|
560
|
+
"name": "DisplayModeStatus",
|
|
561
|
+
"slug": "displaymodestatus",
|
|
562
|
+
"docs": "",
|
|
563
|
+
"types": [
|
|
564
|
+
{
|
|
565
|
+
"text": "'unsupported'",
|
|
566
|
+
"complexTypes": []
|
|
567
|
+
},
|
|
568
|
+
{
|
|
569
|
+
"text": "'unavailable'",
|
|
570
|
+
"complexTypes": []
|
|
571
|
+
},
|
|
572
|
+
{
|
|
573
|
+
"text": "'available'",
|
|
574
|
+
"complexTypes": []
|
|
575
|
+
},
|
|
576
|
+
{
|
|
577
|
+
"text": "'active'",
|
|
578
|
+
"complexTypes": []
|
|
579
|
+
}
|
|
580
|
+
]
|
|
581
|
+
}
|
|
582
|
+
],
|
|
583
|
+
"pluginConfigs": []
|
|
584
|
+
}
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import type { SegmentRect } from './segments';
|
|
2
|
+
export declare const CSS_CLASSES: string[];
|
|
3
|
+
export declare const BAR_CLASSES: string[];
|
|
4
|
+
export declare function barClassFor(edge: 'leading' | 'trailing' | null): string | null;
|
|
5
|
+
export declare function cssFor(segments: SegmentRect[], posture: 'continuous' | 'folded'): {
|
|
6
|
+
variables: Record<string, string>;
|
|
7
|
+
classes: string[];
|
|
8
|
+
};
|
package/dist/esm/css.js
ADDED
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
export const CSS_CLASSES = [
|
|
2
|
+
'horizontal-viewport-segments-2',
|
|
3
|
+
'vertical-viewport-segments-2',
|
|
4
|
+
'device-posture-continuous',
|
|
5
|
+
'device-posture-folded',
|
|
6
|
+
];
|
|
7
|
+
export const BAR_CLASSES = ['vertical-bars-leading', 'vertical-bars-trailing'];
|
|
8
|
+
export function barClassFor(edge) {
|
|
9
|
+
return edge ? `vertical-bars-${edge}` : null;
|
|
10
|
+
}
|
|
11
|
+
export function cssFor(segments, posture) {
|
|
12
|
+
const stacked = segments.length > 1 && segments[1].y > segments[0].y;
|
|
13
|
+
const variables = {};
|
|
14
|
+
segments.forEach((segment, index) => {
|
|
15
|
+
const suffix = stacked ? `0-${index}` : `${index}-0`;
|
|
16
|
+
variables[`--viewport-segment-top-${suffix}`] = `${segment.y}px`;
|
|
17
|
+
variables[`--viewport-segment-left-${suffix}`] = `${segment.x}px`;
|
|
18
|
+
variables[`--viewport-segment-bottom-${suffix}`] = `${segment.y + segment.height}px`;
|
|
19
|
+
variables[`--viewport-segment-right-${suffix}`] = `${segment.x + segment.width}px`;
|
|
20
|
+
variables[`--viewport-segment-width-${suffix}`] = `${segment.width}px`;
|
|
21
|
+
variables[`--viewport-segment-height-${suffix}`] = `${segment.height}px`;
|
|
22
|
+
});
|
|
23
|
+
const classes = [`device-posture-${posture}`];
|
|
24
|
+
if (segments.length > 1) {
|
|
25
|
+
classes.push(stacked ? 'vertical-viewport-segments-2' : 'horizontal-viewport-segments-2');
|
|
26
|
+
}
|
|
27
|
+
return { variables, classes };
|
|
28
|
+
}
|
|
29
|
+
//# sourceMappingURL=css.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"css.js","sourceRoot":"","sources":["../../src/css.ts"],"names":[],"mappings":"AAEA,MAAM,CAAC,MAAM,WAAW,GAAG;IACzB,gCAAgC;IAChC,8BAA8B;IAC9B,2BAA2B;IAC3B,uBAAuB;CACxB,CAAC;AAEF,MAAM,CAAC,MAAM,WAAW,GAAG,CAAC,uBAAuB,EAAE,wBAAwB,CAAC,CAAC;AAE/E,MAAM,UAAU,WAAW,CAAC,IAAmC;IAC7D,OAAO,IAAI,CAAC,CAAC,CAAC,iBAAiB,IAAI,EAAE,CAAC,CAAC,CAAC,IAAI,CAAC;AAC/C,CAAC;AAED,MAAM,UAAU,MAAM,CACpB,QAAuB,EACvB,OAAgC;IAEhC,MAAM,OAAO,GAAG,QAAQ,CAAC,MAAM,GAAG,CAAC,IAAI,QAAQ,CAAC,CAAC,CAAC,CAAC,CAAC,GAAG,QAAQ,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC;IACrE,MAAM,SAAS,GAA2B,EAAE,CAAC;IAE7C,QAAQ,CAAC,OAAO,CAAC,CAAC,OAAO,EAAE,KAAK,EAAE,EAAE;QAClC,MAAM,MAAM,GAAG,OAAO,CAAC,CAAC,CAAC,KAAK,KAAK,EAAE,CAAC,CAAC,CAAC,GAAG,KAAK,IAAI,CAAC;QACrD,SAAS,CAAC,0BAA0B,MAAM,EAAE,CAAC,GAAG,GAAG,OAAO,CAAC,CAAC,IAAI,CAAC;QACjE,SAAS,CAAC,2BAA2B,MAAM,EAAE,CAAC,GAAG,GAAG,OAAO,CAAC,CAAC,IAAI,CAAC;QAClE,SAAS,CAAC,6BAA6B,MAAM,EAAE,CAAC,GAAG,GAAG,OAAO,CAAC,CAAC,GAAG,OAAO,CAAC,MAAM,IAAI,CAAC;QACrF,SAAS,CAAC,4BAA4B,MAAM,EAAE,CAAC,GAAG,GAAG,OAAO,CAAC,CAAC,GAAG,OAAO,CAAC,KAAK,IAAI,CAAC;QACnF,SAAS,CAAC,4BAA4B,MAAM,EAAE,CAAC,GAAG,GAAG,OAAO,CAAC,KAAK,IAAI,CAAC;QACvE,SAAS,CAAC,6BAA6B,MAAM,EAAE,CAAC,GAAG,GAAG,OAAO,CAAC,MAAM,IAAI,CAAC;IAC3E,CAAC,CAAC,CAAC;IAEH,MAAM,OAAO,GAAG,CAAC,kBAAkB,OAAO,EAAE,CAAC,CAAC;IAC9C,IAAI,QAAQ,CAAC,MAAM,GAAG,CAAC,EAAE,CAAC;QACxB,OAAO,CAAC,IAAI,CAAC,OAAO,CAAC,CAAC,CAAC,8BAA8B,CAAC,CAAC,CAAC,gCAAgC,CAAC,CAAC;IAC5F,CAAC;IAED,OAAO,EAAE,SAAS,EAAE,OAAO,EAAE,CAAC;AAChC,CAAC","sourcesContent":["import type { SegmentRect } from './segments';\n\nexport const CSS_CLASSES = [\n 'horizontal-viewport-segments-2',\n 'vertical-viewport-segments-2',\n 'device-posture-continuous',\n 'device-posture-folded',\n];\n\nexport const BAR_CLASSES = ['vertical-bars-leading', 'vertical-bars-trailing'];\n\nexport function barClassFor(edge: 'leading' | 'trailing' | null): string | null {\n return edge ? `vertical-bars-${edge}` : null;\n}\n\nexport function cssFor(\n segments: SegmentRect[],\n posture: 'continuous' | 'folded',\n): { variables: Record<string, string>; classes: string[] } {\n const stacked = segments.length > 1 && segments[1].y > segments[0].y;\n const variables: Record<string, string> = {};\n\n segments.forEach((segment, index) => {\n const suffix = stacked ? `0-${index}` : `${index}-0`;\n variables[`--viewport-segment-top-${suffix}`] = `${segment.y}px`;\n variables[`--viewport-segment-left-${suffix}`] = `${segment.x}px`;\n variables[`--viewport-segment-bottom-${suffix}`] = `${segment.y + segment.height}px`;\n variables[`--viewport-segment-right-${suffix}`] = `${segment.x + segment.width}px`;\n variables[`--viewport-segment-width-${suffix}`] = `${segment.width}px`;\n variables[`--viewport-segment-height-${suffix}`] = `${segment.height}px`;\n });\n\n const classes = [`device-posture-${posture}`];\n if (segments.length > 1) {\n classes.push(stacked ? 'vertical-viewport-segments-2' : 'horizontal-viewport-segments-2');\n }\n\n return { variables, classes };\n}\n"]}
|