@erkamyaman/capacitor-foldable 8.4.0 → 8.4.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/README.md +26 -560
- package/dist/esm/polyfill.js +13 -2
- package/dist/esm/polyfill.js.map +1 -1
- package/dist/plugin.cjs.js +13 -2
- package/dist/plugin.cjs.js.map +1 -1
- package/dist/plugin.js +13 -2
- package/dist/plugin.js.map +1 -1
- package/ios/Sources/FoldablePlugin/FoldablePlugin.swift +22 -4
- package/package.json +2 -2
- package/skills/capacitor-foldable/references/ionic.md +11 -6
- package/skills/capacitor-foldable/references/iphone-duo.md +1 -1
- package/skills/capacitor-foldable/references/testing.md +2 -2
package/README.md
CHANGED
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
<p align="center"><img src="https://raw.githubusercontent.com/erkamyaman/capacitor-foldable/main/docs/images/logo/logo.svg" width="168" height="129" alt="Capacitor Foldable logo"></p>
|
|
1
2
|
<h1 align="center">Capacitor Foldable</h1>
|
|
2
3
|
<p align="center"><strong><code>@erkamyaman/capacitor-foldable</code></strong></p>
|
|
3
4
|
<p align="center">
|
|
@@ -11,58 +12,25 @@
|
|
|
11
12
|
Fold state, posture, hinge angle, size classes and bar placement for foldable phones such as Galaxy Z Fold and Flip, Pixel Fold and iPhone Duo, in Capacitor apps.
|
|
12
13
|
</p>
|
|
13
14
|
|
|
14
|
-
<p align="center">
|
|
15
|
-
<img height="240" alt="iPhone Duo closed, on the outer display" src="https://raw.githubusercontent.com/erkamyaman/capacitor-foldable/main/docs/images/iphone-duo-closed.png">
|
|
16
|
-
<img height="240" alt="iPhone Duo half-open in book posture" src="https://raw.githubusercontent.com/erkamyaman/capacitor-foldable/main/docs/images/iphone-duo-book.png">
|
|
17
|
-
<img height="240" alt="iPhone Duo fully open" src="https://raw.githubusercontent.com/erkamyaman/capacitor-foldable/main/docs/images/iphone-duo-open.png">
|
|
18
|
-
</p>
|
|
19
|
-
<p align="center">
|
|
20
|
-
<img height="300" alt="Pixel Fold in tabletop posture" src="https://raw.githubusercontent.com/erkamyaman/capacitor-foldable/main/docs/images/android-tabletop.jpg">
|
|
21
|
-
<img height="300" alt="Pixel Fold half-open in book posture" src="https://raw.githubusercontent.com/erkamyaman/capacitor-foldable/main/docs/images/android-book.jpg">
|
|
22
|
-
</p>
|
|
23
|
-
|
|
24
|
-
```typescript
|
|
25
|
-
const { state, hingeOrientation } = await Foldable.getFoldState();
|
|
26
|
-
// { state: 'half-opened', hingeOrientation: 'horizontal' }
|
|
27
|
-
```
|
|
28
|
-
|
|
29
|
-
### Versions
|
|
30
|
-
|
|
31
|
-
| Capacitor | Plugin | iOS |
|
|
32
|
-
| --------- | ------ | --- |
|
|
33
|
-
| v7.x | v7.x | Size classes only, build with Xcode 26 |
|
|
34
|
-
| v8.x | v8.x | Size classes, plus iPhone Duo on Capacitor 8.5+ |
|
|
35
|
-
|
|
36
|
-
### Supported Platforms
|
|
37
|
-
|
|
38
|
-
| Platform | Status | Minimum |
|
|
39
|
-
| -------- | ------ | ------- |
|
|
40
|
-
| Android | Supported | API 24, `compileSdk` 36 |
|
|
41
|
-
| iOS | Size classes everywhere; fold, hinge and bar placement on iPhone Duo with Capacitor 8.5+, Xcode 27.1+ and iOS 27.1+ | iOS 15 |
|
|
42
|
-
| Web | Stub, returns `flat` | |
|
|
43
|
-
|
|
44
|
-
## Do you need this plugin?
|
|
45
|
-
|
|
46
|
-
Web views already resize with the window, so a responsive layout that pads with every safe-area inset adapts to foldables without a plugin. Use this one when your app needs to know what CSS can't tell it:
|
|
47
|
-
|
|
48
|
-
- **Whether the device folds at all**, and whether it can stand half-open like a laptop.
|
|
49
|
-
- **Where the fold is**, and whether it splits the screen.
|
|
50
|
-
- **How the device is held**: flat, tabletop or book.
|
|
51
|
-
- **The hinge angle**, for effects and interactions.
|
|
52
|
-
- **Outer or inner display**, and Material window size classes.
|
|
53
|
-
- **Where iPhone Duo puts native bars**, so your HTML tab bar can follow. For Ionic's `ion-tabs` there's a ready-made stylesheet, plus a fix for the tab bar disappearing when you fold.
|
|
54
|
-
- **The outer display on Android foldables**: rear display and dual screen.
|
|
15
|
+
<p align="center"><a href="https://erkamyaman.github.io/capacitor-foldable/"><strong>Documentation</strong></a> · <a href="https://erkamyaman.github.io/capacitor-foldable/api.html">API</a> · <a href="https://erkamyaman.github.io/capacitor-foldable/iphone-duo.html">iPhone Duo guide</a> · <a href="https://github.com/erkamyaman/hinge-guess">Hinge Guess demo</a></p>
|
|
55
16
|
|
|
56
|
-
|
|
17
|
+
| Ionic tabs on iPhone Duo without the plugin | With the plugin |
|
|
18
|
+
| --- | --- |
|
|
19
|
+
| <img src="https://raw.githubusercontent.com/erkamyaman/capacitor-foldable/main/docs/images/ionic-before-book.png" width="360" alt="Ionic tab bar across the fold in book posture"> | <img src="https://raw.githubusercontent.com/erkamyaman/capacitor-foldable/main/docs/images/ionic-after-book.png" width="360" alt="Ionic tab bar moved to the side in book posture"> |
|
|
57
20
|
|
|
58
|
-
##
|
|
21
|
+
## Install
|
|
59
22
|
|
|
60
23
|
```bash
|
|
61
24
|
npm install @erkamyaman/capacitor-foldable
|
|
62
25
|
npx cap sync
|
|
63
26
|
```
|
|
64
27
|
|
|
65
|
-
|
|
28
|
+
| Capacitor | Plugin | iOS |
|
|
29
|
+
| --------- | ------ | --- |
|
|
30
|
+
| v8.x | v8.x | Size classes, plus iPhone Duo on Capacitor 8.5+ and iOS 27.1, built with any Xcode |
|
|
31
|
+
| v7.x | v7.x | Size classes only |
|
|
32
|
+
|
|
33
|
+
Android works on API 24+ with any foldable Jetpack WindowManager supports. The web build is a stub that reports `flat`.
|
|
66
34
|
|
|
67
35
|
## Usage
|
|
68
36
|
|
|
@@ -76,533 +44,31 @@ Foldable.addListener('foldStateChange', ({ posture }) => {
|
|
|
76
44
|
});
|
|
77
45
|
```
|
|
78
46
|
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
## Web standard APIs
|
|
82
|
-
|
|
83
|
-
Chrome ships the [Device Posture API](https://developer.mozilla.org/docs/Web/API/Device_Posture_API) and the [Viewport Segments API](https://developer.mozilla.org/docs/Web/API/Viewport_Segments_API), but Android's WebView turns both off. Safari 27.1 has them behind a feature flag that is off by default and belongs to Safari, so a `WKWebView` inside your app cannot switch it on. Neither works in a Capacitor app today. `installFoldablePolyfill()` fills them in from the native fold state, and mirrors the CSS features as classes and variables on `<html>`:
|
|
84
|
-
|
|
85
|
-
```typescript
|
|
86
|
-
import { installFoldablePolyfill } from '@erkamyaman/capacitor-foldable';
|
|
87
|
-
|
|
88
|
-
await installFoldablePolyfill();
|
|
89
|
-
|
|
90
|
-
navigator.devicePosture.type; // 'continuous' | 'folded'
|
|
91
|
-
window.viewport.segments; // two DOMRects when the fold splits the web view
|
|
92
|
-
```
|
|
93
|
-
|
|
94
|
-
| Standard CSS | With the polyfill |
|
|
95
|
-
| --- | --- |
|
|
96
|
-
| `@media (device-posture: folded)` | `.device-posture-folded` |
|
|
97
|
-
| `@media (horizontal-viewport-segments: 2)` | `.horizontal-viewport-segments-2` |
|
|
98
|
-
| `@media (vertical-viewport-segments: 2)` | `.vertical-viewport-segments-2` |
|
|
99
|
-
| `env(viewport-segment-width 0 0)` | `var(--viewport-segment-width-0-0)` |
|
|
100
|
-
| Native bars moved to the side (iPhone Duo) | `.vertical-bars-leading`, `.vertical-bars-trailing` |
|
|
101
|
-
| The phone is being folded right now | `.folding` |
|
|
102
|
-
|
|
103
|
-
The segment variables only exist while the device is half-open. To lay out along the fold whether it's flat or half-open, such as a game on one side and its controls on the other, the polyfill also sets the fold's position whenever there is one:
|
|
104
|
-
|
|
105
|
-
| Fold | With the polyfill |
|
|
106
|
-
| --- | --- |
|
|
107
|
-
| Direction | `.fold-vertical`, `.fold-horizontal` |
|
|
108
|
-
| Position and size | `var(--fold-left)`, `var(--fold-top)`, `var(--fold-width)`, `var(--fold-height)` |
|
|
109
|
-
|
|
110
|
-
```css
|
|
111
|
-
.fold-vertical .game { width: var(--fold-left); }
|
|
112
|
-
.fold-vertical .controls { left: calc(var(--fold-left) + var(--fold-width)); }
|
|
113
|
-
```
|
|
114
|
-
|
|
115
|
-
Using Ionic's `ion-tabs`? `import '@erkamyaman/capacitor-foldable/ionic-tabs.css'` moves it to the side the way native tab bars do on iPhone Duo. See [Ionic tabs](docs/iphone-duo.md#ionic-tabs).
|
|
116
|
-
|
|
117
|
-
| Ionic tabs without the plugin | With `ionic-tabs.css` |
|
|
118
|
-
| --- | --- |
|
|
119
|
-
| <img src="https://raw.githubusercontent.com/erkamyaman/capacitor-foldable/main/docs/images/ionic-before-book.png" width="300" alt="Ionic tab bar across the fold in book posture"> | <img src="https://raw.githubusercontent.com/erkamyaman/capacitor-foldable/main/docs/images/ionic-after-book.png" width="300" alt="Ionic tab bar as a pill on the side in book posture"> |
|
|
120
|
-
| <img src="https://raw.githubusercontent.com/erkamyaman/capacitor-foldable/main/docs/images/ionic-before-closed.png" width="220" alt="Ionic tab bar at the bottom of the closed iPhone Duo"> | <img src="https://raw.githubusercontent.com/erkamyaman/capacitor-foldable/main/docs/images/ionic-after-closed.png" width="220" alt="Ionic tab bar as a pill under the clock on the closed iPhone Duo"> |
|
|
121
|
-
|
|
122
|
-
## Apps built with it
|
|
123
|
-
|
|
124
|
-
- **[Hinge Guess](https://github.com/erkamyaman/hinge-guess)** is a small game: fold the phone to a target angle and score how close you got. Ionic Angular, native tabs, and the plugin behind the dial.
|
|
125
|
-
- **[examples](examples)** in this repo is a catalogue of one-file demos, one per API, laid out as two pages around the crease on iPhone Duo.
|
|
126
|
-
- **[example-app](example-app)** is the plain single-screen app that shows every value the plugin reports at once.
|
|
47
|
+
Prefer CSS? `installFoldablePolyfill()` fills in the Device Posture and Viewport Segments APIs that Capacitor's web views turn off, and sets `--fold-*` variables and classes on `<html>`. Using `ion-tabs`? `import '@erkamyaman/capacitor-foldable/ionic-tabs.css'`.
|
|
127
48
|
|
|
128
|
-
|
|
49
|
+
**Everything else is in the [documentation](https://erkamyaman.github.io/capacitor-foldable/).**
|
|
129
50
|
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
**iOS.** Public APIs only, UIKit and Capacitor, with no dynamic lookup or private symbols. It touches none of Apple's [required reason APIs](https://developer.apple.com/documentation/bundleresources/describing-use-of-required-reason-api), collects nothing and tracks nobody, and it ships a `PrivacyInfo.xcprivacy` saying exactly that, which Xcode folds into your app's privacy report. Nothing it uses needs a purpose string in `Info.plist`. The iOS 27.1 code is behind a compile-time SDK check, so any Xcode that Capacitor 8 supports builds fine.
|
|
133
|
-
|
|
134
|
-
**Android.** The plugin adds no permissions and no `uses-feature` to your app, so it changes nothing about which devices can install it. Its own manifest is empty; Jetpack WindowManager merges two optional `<uses-library>` entries, which are how it binds to the OEM window extensions and filter nothing. The hinge angle comes from `TYPE_HINGE_ANGLE`, which needs no permission, and rear display and dual screen go through `WindowAreaController`, also permission free. `minSdk` is 24, the same as Capacitor's own default, and `targetSdk` follows your project.
|
|
135
|
-
|
|
136
|
-
**Data safety and privacy labels.** Everything stays on the device: the plugin has no network code and stores nothing. There is no entry for it to add to Play's Data safety form or to your App Store privacy label.
|
|
51
|
+
## Guides
|
|
137
52
|
|
|
138
|
-
|
|
53
|
+
- [API reference](https://erkamyaman.github.io/capacitor-foldable/api.html)
|
|
54
|
+
- [iPhone Duo](https://erkamyaman.github.io/capacitor-foldable/iphone-duo.html)
|
|
55
|
+
- [Layout tips](https://erkamyaman.github.io/capacitor-foldable/layout-tips.html)
|
|
56
|
+
- [Examples](https://erkamyaman.github.io/capacitor-foldable/examples.html)
|
|
57
|
+
- [Testing on Android](https://erkamyaman.github.io/capacitor-foldable/testing-android.html)
|
|
58
|
+
- [Store review](https://erkamyaman.github.io/capacitor-foldable/store-review.html)
|
|
139
59
|
|
|
140
|
-
|
|
60
|
+
## Agent skill
|
|
141
61
|
|
|
142
62
|
```bash
|
|
143
63
|
npx skills add erkamyaman/capacitor-foldable@capacitor-foldable
|
|
144
64
|
```
|
|
145
65
|
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
The same skill is published on its own at [iphone-duo-capacitor-skills](https://github.com/erkamyaman/iphone-duo-capacitor-skills), which is where it sits next to the iPhone Duo skills for SwiftUI and UIKit.
|
|
149
|
-
|
|
150
|
-
## Guides
|
|
151
|
-
|
|
152
|
-
- [Examples](docs/examples.md)
|
|
153
|
-
- [Layout tips](docs/layout-tips.md)
|
|
154
|
-
- [Testing on Android](docs/testing-android.md)
|
|
155
|
-
- [iPhone Duo](docs/iphone-duo.md)
|
|
156
|
-
|
|
157
|
-
## API
|
|
158
|
-
|
|
159
|
-
<docgen-index>
|
|
160
|
-
|
|
161
|
-
* [`isDeviceFoldable()`](#isdevicefoldable)
|
|
162
|
-
* [`getFoldState()`](#getfoldstate)
|
|
163
|
-
* [`getHingeAngle()`](#gethingeangle)
|
|
164
|
-
* [`getReservedRegions()`](#getreservedregions)
|
|
165
|
-
* [`setVerticalBarBehavior(...)`](#setverticalbarbehavior)
|
|
166
|
-
* [`getSizeClass()`](#getsizeclass)
|
|
167
|
-
* [`getDisplayModes()`](#getdisplaymodes)
|
|
168
|
-
* [`getBarPlacement()`](#getbarplacement)
|
|
169
|
-
* [`startRearDisplay()`](#startreardisplay)
|
|
170
|
-
* [`stopRearDisplay()`](#stopreardisplay)
|
|
171
|
-
* [`startDualScreen(...)`](#startdualscreen)
|
|
172
|
-
* [`stopDualScreen()`](#stopdualscreen)
|
|
173
|
-
* [`addListener('foldStateChange', ...)`](#addlistenerfoldstatechange-)
|
|
174
|
-
* [`addListener('hingeAngleChange', ...)`](#addlistenerhingeanglechange-)
|
|
175
|
-
* [`addListener('sizeClassChange', ...)`](#addlistenersizeclasschange-)
|
|
176
|
-
* [`addListener('displayModeChange', ...)`](#addlistenerdisplaymodechange-)
|
|
177
|
-
* [`addListener('foldingChange', ...)`](#addlistenerfoldingchange-)
|
|
178
|
-
* [`addListener('barPlacementChange', ...)`](#addlistenerbarplacementchange-)
|
|
179
|
-
* [Interfaces](#interfaces)
|
|
180
|
-
* [Type Aliases](#type-aliases)
|
|
181
|
-
|
|
182
|
-
</docgen-index>
|
|
183
|
-
|
|
184
|
-
<docgen-api>
|
|
185
|
-
<!--Update the source file JSDoc comments and rerun docgen to update the docs below-->
|
|
186
|
-
|
|
187
|
-
### isDeviceFoldable()
|
|
188
|
-
|
|
189
|
-
```typescript
|
|
190
|
-
isDeviceFoldable() => Promise<{ foldable: boolean; supportsTabletop: boolean; }>
|
|
191
|
-
```
|
|
192
|
-
|
|
193
|
-
Whether the device has a fold at all, and whether it can be propped half
|
|
194
|
-
open like a laptop. Both `false` on web, and on iOS except on iPhone Duo
|
|
195
|
-
(iOS 27.1 or later).
|
|
196
|
-
|
|
197
|
-
**Returns:** <code>Promise<{ foldable: boolean; supportsTabletop: boolean; }></code>
|
|
198
|
-
|
|
199
|
-
**Since:** 7.0.0
|
|
200
|
-
|
|
201
|
-
--------------------
|
|
202
|
-
|
|
203
|
-
|
|
204
|
-
### getFoldState()
|
|
205
|
-
|
|
206
|
-
```typescript
|
|
207
|
-
getFoldState() => Promise<FoldState>
|
|
208
|
-
```
|
|
209
|
-
|
|
210
|
-
Read the current fold state. Resolves to
|
|
211
|
-
`{ state: 'flat', isSeparating: false, posture: 'flat' }` when there is no
|
|
212
|
-
fold information.
|
|
213
|
-
|
|
214
|
-
**Returns:** <code>Promise<<a href="#foldstate">FoldState</a>></code>
|
|
215
|
-
|
|
216
|
-
**Since:** 7.0.0
|
|
217
|
-
|
|
218
|
-
--------------------
|
|
219
|
-
|
|
220
|
-
|
|
221
|
-
### getHingeAngle()
|
|
222
|
-
|
|
223
|
-
```typescript
|
|
224
|
-
getHingeAngle() => Promise<{ angle: number | null; status: HingeStatus | null; }>
|
|
225
|
-
```
|
|
226
|
-
|
|
227
|
-
Read the angle between the two halves of the device, in degrees: `0` when
|
|
228
|
-
closed, `180` when flat. Resolves to `{ angle: null }` on devices without a
|
|
229
|
-
hinge angle sensor, on web, and on iOS before 27.1.
|
|
230
|
-
|
|
231
|
-
**Returns:** <code>Promise<{ angle: number | null; status: <a href="#hingestatus">HingeStatus</a> | null; }></code>
|
|
232
|
-
|
|
233
|
-
**Since:** 7.0.0
|
|
234
|
-
|
|
235
|
-
--------------------
|
|
236
|
-
|
|
237
|
-
|
|
238
|
-
### getReservedRegions()
|
|
239
|
-
|
|
240
|
-
```typescript
|
|
241
|
-
getReservedRegions() => Promise<{ regions: ReservedRegion[]; }>
|
|
242
|
-
```
|
|
243
|
-
|
|
244
|
-
Read every region the system reserves on this display: the fold and
|
|
245
|
-
anything covering the screen, active or not. iPhone Duo reports the fold,
|
|
246
|
-
the vertical status bar area and the under-display camera. Resolves to an
|
|
247
|
-
empty list on Android, on web and on iOS before 27.1.
|
|
248
|
-
|
|
249
|
-
**Returns:** <code>Promise<{ regions: ReservedRegion[]; }></code>
|
|
250
|
-
|
|
251
|
-
**Since:** 8.2.0
|
|
252
|
-
|
|
253
|
-
--------------------
|
|
254
|
-
|
|
255
|
-
|
|
256
|
-
### setVerticalBarBehavior(...)
|
|
257
|
-
|
|
258
|
-
```typescript
|
|
259
|
-
setVerticalBarBehavior(options: { behavior: 'automatic' | 'disabled'; }) => Promise<{ applied: boolean; }>
|
|
260
|
-
```
|
|
261
|
-
|
|
262
|
-
Choose whether iPhone Duo may move this app's bars to the side of the
|
|
263
|
-
display. `'disabled'` keeps everything horizontal, including the status
|
|
264
|
-
bar. Resolves to `{ applied: false }` when the app does not use
|
|
265
|
-
`FoldableBridgeViewController`, on Android, on web and on iOS before 27.1.
|
|
266
|
-
See the iPhone Duo guide for the one-line storyboard change.
|
|
267
|
-
|
|
268
|
-
| Param | Type |
|
|
269
|
-
| ------------- | ----------------------------------------------------- |
|
|
270
|
-
| **`options`** | <code>{ behavior: 'automatic' \| 'disabled'; }</code> |
|
|
271
|
-
|
|
272
|
-
**Returns:** <code>Promise<{ applied: boolean; }></code>
|
|
273
|
-
|
|
274
|
-
**Since:** 8.2.0
|
|
275
|
-
|
|
276
|
-
--------------------
|
|
277
|
-
|
|
278
|
-
|
|
279
|
-
### getSizeClass()
|
|
280
|
-
|
|
281
|
-
```typescript
|
|
282
|
-
getSizeClass() => Promise<SizeClass>
|
|
283
|
-
```
|
|
284
|
-
|
|
285
|
-
Read the window's size classes: Apple's compact and regular, the signal its
|
|
286
|
-
iPhone Duo guidelines recommend for telling the outer display from the inner
|
|
287
|
-
one, and Material's width and height classes. On iOS `horizontal` and
|
|
288
|
-
`vertical` are UIKit's size classes; everything else comes from the window
|
|
289
|
-
size.
|
|
290
|
-
|
|
291
|
-
**Returns:** <code>Promise<<a href="#sizeclass">SizeClass</a>></code>
|
|
292
|
-
|
|
293
|
-
**Since:** 7.0.0
|
|
294
|
-
|
|
295
|
-
--------------------
|
|
296
|
-
|
|
297
|
-
|
|
298
|
-
### getDisplayModes()
|
|
299
|
-
|
|
300
|
-
```typescript
|
|
301
|
-
getDisplayModes() => Promise<DisplayModes>
|
|
302
|
-
```
|
|
303
|
-
|
|
304
|
-
Read which of the foldable display modes the device offers right now. Both
|
|
305
|
-
are `'unsupported'` on iOS and web.
|
|
306
|
-
|
|
307
|
-
**Returns:** <code>Promise<<a href="#displaymodes">DisplayModes</a>></code>
|
|
308
|
-
|
|
309
|
-
**Since:** 7.0.0
|
|
310
|
-
|
|
311
|
-
--------------------
|
|
312
|
-
|
|
313
|
-
|
|
314
|
-
### getBarPlacement()
|
|
315
|
-
|
|
316
|
-
```typescript
|
|
317
|
-
getBarPlacement() => Promise<BarPlacement>
|
|
318
|
-
```
|
|
319
|
-
|
|
320
|
-
Read where native bars go. Native tab bars and toolbars move to the side of
|
|
321
|
-
the display on iPhone Duo, but HTML ones stay put, so use this to move your
|
|
322
|
-
own tab bar too.
|
|
323
|
-
|
|
324
|
-
**Returns:** <code>Promise<<a href="#barplacement">BarPlacement</a>></code>
|
|
325
|
-
|
|
326
|
-
**Since:** 7.0.0
|
|
327
|
-
|
|
328
|
-
--------------------
|
|
329
|
-
|
|
330
|
-
|
|
331
|
-
### startRearDisplay()
|
|
332
|
-
|
|
333
|
-
```typescript
|
|
334
|
-
startRearDisplay() => Promise<void>
|
|
335
|
-
```
|
|
336
|
-
|
|
337
|
-
Move the app to the outer display. Android asks the user to confirm first,
|
|
338
|
-
and the promise resolves once the app has moved. Rejects when rear display
|
|
339
|
-
mode is not `'available'`. Only on Android.
|
|
340
|
-
|
|
341
|
-
**Since:** 7.0.0
|
|
342
|
-
|
|
343
|
-
--------------------
|
|
344
|
-
|
|
345
|
-
|
|
346
|
-
### stopRearDisplay()
|
|
347
|
-
|
|
348
|
-
```typescript
|
|
349
|
-
stopRearDisplay() => Promise<void>
|
|
350
|
-
```
|
|
351
|
-
|
|
352
|
-
Move the app back to the inner display.
|
|
353
|
-
|
|
354
|
-
**Since:** 7.0.0
|
|
355
|
-
|
|
356
|
-
--------------------
|
|
357
|
-
|
|
358
|
-
|
|
359
|
-
### startDualScreen(...)
|
|
360
|
-
|
|
361
|
-
```typescript
|
|
362
|
-
startDualScreen(options: { url: string; }) => Promise<void>
|
|
363
|
-
```
|
|
364
|
-
|
|
365
|
-
Show a page on the outer display while the app stays on the inner one. A
|
|
366
|
-
relative `url` resolves against the app's own URL, so `'cover.html'` loads a
|
|
367
|
-
page bundled with the app. The page runs in its own web view without access
|
|
368
|
-
to Capacitor plugins. Calling this again while dual-screen mode is active
|
|
369
|
-
replaces the page. Only on Android.
|
|
370
|
-
|
|
371
|
-
| Param | Type |
|
|
372
|
-
| ------------- | ----------------------------- |
|
|
373
|
-
| **`options`** | <code>{ url: string; }</code> |
|
|
374
|
-
|
|
375
|
-
**Since:** 7.0.0
|
|
376
|
-
|
|
377
|
-
--------------------
|
|
378
|
-
|
|
379
|
-
|
|
380
|
-
### stopDualScreen()
|
|
381
|
-
|
|
382
|
-
```typescript
|
|
383
|
-
stopDualScreen() => Promise<void>
|
|
384
|
-
```
|
|
385
|
-
|
|
386
|
-
Close the page on the outer display.
|
|
387
|
-
|
|
388
|
-
**Since:** 7.0.0
|
|
389
|
-
|
|
390
|
-
--------------------
|
|
391
|
-
|
|
392
|
-
|
|
393
|
-
### addListener('foldStateChange', ...)
|
|
394
|
-
|
|
395
|
-
```typescript
|
|
396
|
-
addListener(eventName: 'foldStateChange', listenerFunc: (state: FoldState) => void) => Promise<PluginListenerHandle>
|
|
397
|
-
```
|
|
398
|
-
|
|
399
|
-
Listen for fold state changes. On a foldable this also fires when the
|
|
400
|
-
device rotates, because `hingeOrientation` and `hingeBounds` rotate with
|
|
401
|
-
the window.
|
|
402
|
-
|
|
403
|
-
| Param | Type |
|
|
404
|
-
| ------------------ | ------------------------------------------------------------------- |
|
|
405
|
-
| **`eventName`** | <code>'foldStateChange'</code> |
|
|
406
|
-
| **`listenerFunc`** | <code>(state: <a href="#foldstate">FoldState</a>) => void</code> |
|
|
407
|
-
|
|
408
|
-
**Returns:** <code>Promise<<a href="#pluginlistenerhandle">PluginListenerHandle</a>></code>
|
|
409
|
-
|
|
410
|
-
**Since:** 7.0.0
|
|
411
|
-
|
|
412
|
-
--------------------
|
|
413
|
-
|
|
414
|
-
|
|
415
|
-
### addListener('hingeAngleChange', ...)
|
|
416
|
-
|
|
417
|
-
```typescript
|
|
418
|
-
addListener(eventName: 'hingeAngleChange', listenerFunc: (event: { angle: number; }) => void) => Promise<PluginListenerHandle>
|
|
419
|
-
```
|
|
420
|
-
|
|
421
|
-
Listen for hinge angle changes. On Android the hinge sensor only runs while
|
|
422
|
-
at least one of these listeners is registered. On iOS it fires on iPhone
|
|
423
|
-
Duo (iOS 27.1 or later). Never fires on web.
|
|
424
|
-
|
|
425
|
-
| Param | Type |
|
|
426
|
-
| ------------------ | --------------------------------------------------- |
|
|
427
|
-
| **`eventName`** | <code>'hingeAngleChange'</code> |
|
|
428
|
-
| **`listenerFunc`** | <code>(event: { angle: number; }) => void</code> |
|
|
429
|
-
|
|
430
|
-
**Returns:** <code>Promise<<a href="#pluginlistenerhandle">PluginListenerHandle</a>></code>
|
|
431
|
-
|
|
432
|
-
**Since:** 7.0.0
|
|
433
|
-
|
|
434
|
-
--------------------
|
|
435
|
-
|
|
436
|
-
|
|
437
|
-
### addListener('sizeClassChange', ...)
|
|
438
|
-
|
|
439
|
-
```typescript
|
|
440
|
-
addListener(eventName: 'sizeClassChange', listenerFunc: (sizeClass: SizeClass) => void) => Promise<PluginListenerHandle>
|
|
441
|
-
```
|
|
442
|
-
|
|
443
|
-
Listen for size class changes, such as unfolding the device, rotating it or
|
|
444
|
-
resizing the window. On iOS this fires when UIKit's size classes change
|
|
445
|
-
(iOS 17 or later) or the device rotates, so a resize that keeps the same
|
|
446
|
-
size classes may not update `widthClass` and `heightClass` until then.
|
|
447
|
-
|
|
448
|
-
| Param | Type |
|
|
449
|
-
| ------------------ | ----------------------------------------------------------------------- |
|
|
450
|
-
| **`eventName`** | <code>'sizeClassChange'</code> |
|
|
451
|
-
| **`listenerFunc`** | <code>(sizeClass: <a href="#sizeclass">SizeClass</a>) => void</code> |
|
|
452
|
-
|
|
453
|
-
**Returns:** <code>Promise<<a href="#pluginlistenerhandle">PluginListenerHandle</a>></code>
|
|
454
|
-
|
|
455
|
-
**Since:** 7.0.0
|
|
456
|
-
|
|
457
|
-
--------------------
|
|
458
|
-
|
|
459
|
-
|
|
460
|
-
### addListener('displayModeChange', ...)
|
|
461
|
-
|
|
462
|
-
```typescript
|
|
463
|
-
addListener(eventName: 'displayModeChange', listenerFunc: (modes: DisplayModes) => void) => Promise<PluginListenerHandle>
|
|
464
|
-
```
|
|
465
|
-
|
|
466
|
-
Listen for changes to the display modes, including a mode ending because
|
|
467
|
-
the user folded or unfolded the device. Never fires on iOS and web.
|
|
468
|
-
|
|
469
|
-
| Param | Type |
|
|
470
|
-
| ------------------ | ------------------------------------------------------------------------- |
|
|
471
|
-
| **`eventName`** | <code>'displayModeChange'</code> |
|
|
472
|
-
| **`listenerFunc`** | <code>(modes: <a href="#displaymodes">DisplayModes</a>) => void</code> |
|
|
473
|
-
|
|
474
|
-
**Returns:** <code>Promise<<a href="#pluginlistenerhandle">PluginListenerHandle</a>></code>
|
|
475
|
-
|
|
476
|
-
**Since:** 7.0.0
|
|
477
|
-
|
|
478
|
-
--------------------
|
|
479
|
-
|
|
480
|
-
|
|
481
|
-
### addListener('foldingChange', ...)
|
|
482
|
-
|
|
483
|
-
```typescript
|
|
484
|
-
addListener(eventName: 'foldingChange', listenerFunc: (event: { folding: boolean; }) => void) => Promise<PluginListenerHandle>
|
|
485
|
-
```
|
|
486
|
-
|
|
487
|
-
Listen for the device being folded or unfolded. `folding` turns `true` as
|
|
488
|
-
soon as the hinge starts moving and `false` about half a second after it
|
|
489
|
-
stops, so an app can pause animations or heavy work while the screen is in
|
|
490
|
-
motion. Only fires where a hinge angle is available: Android foldables with
|
|
491
|
-
a hinge sensor, and iPhone Duo on iOS 27.1 or later.
|
|
492
|
-
|
|
493
|
-
| Param | Type |
|
|
494
|
-
| ------------------ | ------------------------------------------------------ |
|
|
495
|
-
| **`eventName`** | <code>'foldingChange'</code> |
|
|
496
|
-
| **`listenerFunc`** | <code>(event: { folding: boolean; }) => void</code> |
|
|
497
|
-
|
|
498
|
-
**Returns:** <code>Promise<<a href="#pluginlistenerhandle">PluginListenerHandle</a>></code>
|
|
499
|
-
|
|
500
|
-
**Since:** 8.2.0
|
|
501
|
-
|
|
502
|
-
--------------------
|
|
503
|
-
|
|
504
|
-
|
|
505
|
-
### addListener('barPlacementChange', ...)
|
|
506
|
-
|
|
507
|
-
```typescript
|
|
508
|
-
addListener(eventName: 'barPlacementChange', listenerFunc: (placement: BarPlacement) => void) => Promise<PluginListenerHandle>
|
|
509
|
-
```
|
|
510
|
-
|
|
511
|
-
Listen for bar placement changes, such as opening or rotating iPhone Duo.
|
|
512
|
-
Only fires on iOS 27.1 or later.
|
|
513
|
-
|
|
514
|
-
| Param | Type |
|
|
515
|
-
| ------------------ | ----------------------------------------------------------------------------- |
|
|
516
|
-
| **`eventName`** | <code>'barPlacementChange'</code> |
|
|
517
|
-
| **`listenerFunc`** | <code>(placement: <a href="#barplacement">BarPlacement</a>) => void</code> |
|
|
518
|
-
|
|
519
|
-
**Returns:** <code>Promise<<a href="#pluginlistenerhandle">PluginListenerHandle</a>></code>
|
|
520
|
-
|
|
521
|
-
**Since:** 7.0.0
|
|
522
|
-
|
|
523
|
-
--------------------
|
|
524
|
-
|
|
525
|
-
|
|
526
|
-
### Interfaces
|
|
527
|
-
|
|
528
|
-
|
|
529
|
-
#### FoldState
|
|
530
|
-
|
|
531
|
-
| Prop | Type | Description | Since |
|
|
532
|
-
| ---------------------- | -------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ----- |
|
|
533
|
-
| **`state`** | <code>'flat' \| 'half-opened' \| 'closed'</code> | Posture of the fold. `'closed'` is never reported today: a device shut on its cover display reports `'flat'`. | 7.0.0 |
|
|
534
|
-
| **`isSeparating`** | <code>boolean</code> | Whether the fold splits the web view into two areas: `true` when half-opened, or when the hinge has a physical gap. | 7.0.0 |
|
|
535
|
-
| **`posture`** | <code>'flat' \| 'tabletop' \| 'book'</code> | How the device is held: `'tabletop'` when half-opened with a horizontal hinge, like a laptop, `'book'` when half-opened with a vertical hinge, and `'flat'` otherwise. | 7.0.0 |
|
|
536
|
-
| **`hingeOrientation`** | <code>'horizontal' \| 'vertical'</code> | Direction of the hinge relative to the window, so it flips when the device rotates. Omitted when there is no fold. | 7.0.0 |
|
|
537
|
-
| **`hingeBounds`** | <code>{ x: number; y: number; width: number; height: number; }</code> | Position of the fold in CSS pixels, relative to the web view. Zero wide (or zero tall) on a seamless fold. Omitted when there is no fold. | 7.0.0 |
|
|
538
|
-
| **`occludedBounds`** | <code>{ x: number; y: number; width: number; height: number; }</code> | Area of the web view the hinge covers, in CSS pixels. Only present on devices with a physical gap. | 7.0.0 |
|
|
539
|
-
| **`activeDisplay`** | <code>'inner' \| 'outer'</code> | Which display is showing the app, on a device with an inner and an outer display such as iPhone Duo. Reported on iPhone Duo (iOS 27.1 or later) and omitted elsewhere. | 7.0.0 |
|
|
540
|
-
| **`cameraBounds`** | <code>{ x: number; y: number; width: number; height: number; }[]</code> | Areas of the web view something covers, in CSS pixels. On Android these are the display cutouts. On iPhone Duo these are the active occlusion regions: the camera in use, and the strip the system keeps for the vertical status bar. Use `getReservedRegions()` when you need to tell them apart. Omitted when there are none. | 7.0.0 |
|
|
541
|
-
| **`hingeMargins`** | <code>{ top: number; right: number; bottom: number; left: number; }</code> | Space the system asks you to keep clear around the fold, in CSS pixels. `hingeBounds` covers the crease plus these margins, so the crease itself is `hingeBounds` shrunk by them. iPhone Duo reports 20 on each side of a vertical fold. Omitted on Android and where there is no fold. | 8.2.0 |
|
|
542
|
-
|
|
543
|
-
|
|
544
|
-
#### ReservedRegion
|
|
545
|
-
|
|
546
|
-
| Prop | Type | Description | Since |
|
|
547
|
-
| -------------- | -------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------------------------------------------ | ----- |
|
|
548
|
-
| **`kind`** | <code>'division' \| 'occlusion'</code> | `'division'` is the fold itself. `'occlusion'` is something covering the display, such as a camera or the vertical status bar area. | 8.2.0 |
|
|
549
|
-
| **`isActive`** | <code>boolean</code> | Whether the region applies right now. An inactive division is a flat fold, and an inactive occlusion is a camera that is not in use. | 8.2.0 |
|
|
550
|
-
| **`x`** | <code>number</code> | | |
|
|
551
|
-
| **`y`** | <code>number</code> | | |
|
|
552
|
-
| **`width`** | <code>number</code> | | |
|
|
553
|
-
| **`height`** | <code>number</code> | | |
|
|
554
|
-
| **`margins`** | <code>{ top: number; right: number; bottom: number; left: number; }</code> | Space to keep clear around the region, in CSS pixels. | 8.2.0 |
|
|
555
|
-
|
|
556
|
-
|
|
557
|
-
#### SizeClass
|
|
558
|
-
|
|
559
|
-
| Prop | Type | Description | Since |
|
|
560
|
-
| ----------------- | --------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ----- |
|
|
561
|
-
| **`horizontal`** | <code>'compact' \| 'regular'</code> | Width size class of the window: `'compact'` on a phone and on the outer display of a foldable, `'regular'` on the inner display, tablets and wide windows. On Android and web `'regular'` starts at 600 CSS pixels. | 7.0.0 |
|
|
562
|
-
| **`vertical`** | <code>'compact' \| 'regular'</code> | Height size class of the window: `'compact'` on a phone in landscape. On Android and web `'regular'` starts at 480 CSS pixels. | 7.0.0 |
|
|
563
|
-
| **`widthClass`** | <code>'compact' \| 'medium' \| 'expanded' \| 'large' \| 'extraLarge'</code> | Material window width class, from the window width in CSS pixels: `'compact'` below 600, `'medium'` below 840, `'expanded'` below 1200, `'large'` below 1600 and `'extraLarge'` from 1600. | 7.0.0 |
|
|
564
|
-
| **`heightClass`** | <code>'compact' \| 'medium' \| 'expanded'</code> | Material window height class, from the window height in CSS pixels: `'compact'` below 480, `'medium'` below 900 and `'expanded'` from 900. | 7.0.0 |
|
|
565
|
-
|
|
566
|
-
|
|
567
|
-
#### DisplayModes
|
|
568
|
-
|
|
569
|
-
| Prop | Type | Description | Since |
|
|
570
|
-
| ----------------- | --------------------------------------------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------- | ----- |
|
|
571
|
-
| **`rearDisplay`** | <code><a href="#displaymodestatus">DisplayModeStatus</a></code> | Rear display mode moves the app to the outer display, so people can frame a photo with the rear cameras. Only on Android foldables that offer it. | 7.0.0 |
|
|
572
|
-
| **`dualScreen`** | <code><a href="#displaymodestatus">DisplayModeStatus</a></code> | Dual-screen mode shows a second page on the outer display while the app stays on the inner one. Only on Android foldables that offer it. | 7.0.0 |
|
|
573
|
-
|
|
574
|
-
|
|
575
|
-
#### BarPlacement
|
|
576
|
-
|
|
577
|
-
| Prop | Type | Description | Since |
|
|
578
|
-
| --------------------- | -------------------------------------------- | -------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ----- |
|
|
579
|
-
| **`verticalBarEdge`** | <code>'leading' \| 'trailing' \| null</code> | The edge iPhone Duo moves tab bars and toolbars to when it lays them out vertically: `'leading'` or `'trailing'` in the reading direction, so `'leading'` is the left edge in left-to-right languages. `null` when bars stay horizontal, and always on Android, web and iOS before 27.1. An app built with an older Xcode still gets the edge: it is inferred from the safe-area inset the bar leaves, since the trait that names it is missing. | 7.0.0 |
|
|
580
|
-
| **`inset`** | <code>number</code> | How much room the vertical bar takes on its edge, in points, rounded to whole points. It is the same value the web view reports as a safe-area inset, so `env(safe-area-inset-*)` already covers simple layouts. Read it when you place your own chrome and need the number itself, and do not assume it stays at 84: it differs when the bar is disabled, and Apple can change it. `0` when no vertical bar is reported, and always on Android and web. | 8.3.3 |
|
|
581
|
-
|
|
582
|
-
|
|
583
|
-
#### PluginListenerHandle
|
|
584
|
-
|
|
585
|
-
| Prop | Type |
|
|
586
|
-
| ------------ | ----------------------------------------- |
|
|
587
|
-
| **`remove`** | <code>() => Promise<void></code> |
|
|
588
|
-
|
|
589
|
-
|
|
590
|
-
### Type Aliases
|
|
591
|
-
|
|
592
|
-
|
|
593
|
-
#### HingeStatus
|
|
594
|
-
|
|
595
|
-
How far open the hinge is, as the system sees it. Note that it can lag the
|
|
596
|
-
angle: iOS keeps reporting `'closed'` for a moment after the phone opens.
|
|
597
|
-
|
|
598
|
-
<code>'closed' | 'partiallyOpen' | 'fullyOpen'</code>
|
|
599
|
-
|
|
600
|
-
|
|
601
|
-
#### DisplayModeStatus
|
|
66
|
+
Also ships in the npm package under [`skills/`](skills/capacitor-foldable), and on its own at [iphone-duo-capacitor-skills](https://github.com/erkamyaman/iphone-duo-capacitor-skills).
|
|
602
67
|
|
|
603
|
-
|
|
68
|
+
## Used by
|
|
604
69
|
|
|
605
|
-
|
|
70
|
+
- [Capacitor Native UI](https://github.com/rdlabo-dev/ionic-theme-ios27/tree/main/packages/capacitor-native-ui) and [Ionic Theme iOS 27](https://github.com/rdlabo-dev/ionic-theme-ios27) by rdlabo
|
|
71
|
+
- [Hinge Guess](https://github.com/erkamyaman/hinge-guess), a game where the phone's hinge is the controller
|
|
606
72
|
|
|
607
73
|
## Trademarks and licence
|
|
608
74
|
|
package/dist/esm/polyfill.js
CHANGED
|
@@ -72,8 +72,8 @@ async function run(plugin, options) {
|
|
|
72
72
|
root.style.setProperty('--vertical-tab-bar-bottom', `${verticalTabBarBottom((_a = fold === null || fold === void 0 ? void 0 : fold.cameraBounds) !== null && _a !== void 0 ? _a : [], window.innerHeight)}px`);
|
|
73
73
|
};
|
|
74
74
|
const apply = (next) => {
|
|
75
|
-
fold = next;
|
|
76
|
-
posture === null || posture === void 0 ? void 0 : posture.update(postureOf(
|
|
75
|
+
fold = next.activeDisplay === 'outer' ? null : next;
|
|
76
|
+
posture === null || posture === void 0 ? void 0 : posture.update(postureOf(fold));
|
|
77
77
|
applyCss();
|
|
78
78
|
// The web view can report the previous window size for a moment after the
|
|
79
79
|
// app moves between displays, so measure again once it has settled.
|
|
@@ -85,8 +85,19 @@ async function run(plugin, options) {
|
|
|
85
85
|
for (const name of BAR_CLASSES)
|
|
86
86
|
root.classList.toggle(name, name === active);
|
|
87
87
|
};
|
|
88
|
+
let measured = '';
|
|
89
|
+
const applyCssIfResized = () => {
|
|
90
|
+
const size = `${window.innerWidth}x${window.innerHeight}`;
|
|
91
|
+
if (size === measured)
|
|
92
|
+
return;
|
|
93
|
+
measured = size;
|
|
94
|
+
applyCss();
|
|
95
|
+
};
|
|
88
96
|
await plugin.addListener('foldingChange', ({ folding }) => root.classList.toggle('folding', folding));
|
|
89
97
|
window.addEventListener('resize', applyCss);
|
|
98
|
+
if (typeof ResizeObserver !== 'undefined')
|
|
99
|
+
new ResizeObserver(applyCssIfResized).observe(root);
|
|
100
|
+
document.addEventListener('visibilitychange', applyCssIfResized);
|
|
90
101
|
await plugin.addListener('foldStateChange', apply);
|
|
91
102
|
await plugin.addListener('barPlacementChange', applyBars);
|
|
92
103
|
apply(await plugin.getFoldState());
|
package/dist/esm/polyfill.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"polyfill.js","sourceRoot":"","sources":["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AAI,KAAK,QAAQ;YAAE,OAAO;QAC9B,QAAQ,GAAG,IAAI,CAAC;QAChB,QAAQ,EAAE,CAAC;IACb,CAAC,CAAC;IAEF,MAAM,MAAM,CAAC,WAAW,CAAC,eAAe,EAAE,CAAC,EAAE,OAAO,EAAE,EAAE,EAAE,CAAC,IAAI,CAAC,SAAS,CAAC,MAAM,CAAC,SAAS,EAAE,OAAO,CAAC,CAAC,CAAC;IACtG,MAAM,CAAC,gBAAgB,CAAC,QAAQ,EAAE,QAAQ,CAAC,CAAC;IAC5C,IAAI,OAAO,cAAc,KAAK,WAAW;QAAE,IAAI,cAAc,CAAC,iBAAiB,CAAC,CAAC,OAAO,CAAC,IAAI,CAAC,CAAC;IAC/F,QAAQ,CAAC,gBAAgB,CAAC,kBAAkB,EAAE,iBAAiB,CAAC,CAAC;IACjE,MAAM,MAAM,CAAC,WAAW,CAAC,iBAAiB,EAAE,KAAK,CAAC,CAAC;IACnD,MAAM,MAAM,CAAC,WAAW,CAAC,oBAAoB,EAAE,SAAS,CAAC,CAAC;IAC1D,KAAK,CAAC,MAAM,MAAM,CAAC,YAAY,EAAE,CAAC,CAAC;IACnC,SAAS,CAAC,MAAM,MAAM,CAAC,eAAe,EAAE,CAAC,CAAC;AAC5C,CAAC","sourcesContent":["import { Capacitor } from '@capacitor/core';\n\nimport {\n BAR_CLASSES,\n barClassFor,\n CSS_CLASSES,\n cssFor,\n FOLD_CLASSES,\n FOLD_VARIABLES,\n foldCssFor,\n verticalTabBarBottom,\n} from './css';\nimport type { BarPlacement, FoldablePlugin, FoldablePolyfillOptions, FoldState } from './definitions';\nimport { takeOverKeyboard } from './keyboard';\nimport { splitViewport } from './segments';\n\ntype DevicePostureType = 'continuous' | 'folded';\n\ndeclare global {\n interface DevicePosture extends EventTarget {\n readonly type: DevicePostureType;\n onchange: ((this: DevicePosture, event: Event) => unknown) | null;\n }\n\n interface Viewport {\n readonly segments: readonly DOMRect[];\n }\n\n interface Navigator {\n readonly devicePosture: DevicePosture;\n }\n\n interface Window {\n readonly viewport: Viewport;\n }\n}\n\nclass DevicePosturePolyfill extends EventTarget implements DevicePosture {\n onchange: ((this: DevicePosture, event: Event) => unknown) | null = null;\n\n private current: DevicePostureType = 'continuous';\n\n get type(): DevicePostureType {\n return this.current;\n }\n\n update(type: DevicePostureType): void {\n if (type === this.current) return;\n\n this.current = type;\n const event = new Event('change');\n this.onchange?.call(this, event);\n this.dispatchEvent(event);\n }\n}\n\nconst postureOf = (fold: FoldState | null): DevicePostureType =>\n fold?.state === 'half-opened' ? 'folded' : 'continuous';\n\nlet installation: Promise<void> | null = null;\n\nexport function install(plugin: FoldablePlugin, options: FoldablePolyfillOptions = {}): Promise<void> {\n if (!Capacitor.isNativePlatform()) return Promise.resolve();\n\n installation ??= run(plugin, options);\n return installation;\n}\n\nasync function run(plugin: FoldablePlugin, options: FoldablePolyfillOptions): Promise<void> {\n if (options.ionicKeyboard) takeOverKeyboard(window, document);\n\n let fold: FoldState | null = null;\n const currentSegments = () => splitViewport(fold, window.innerWidth, window.innerHeight);\n\n if (!('Viewport' in window)) {\n Object.defineProperty(window, 'viewport', {\n configurable: true,\n value: {\n get segments() {\n return Object.freeze(currentSegments().map((rect) => new DOMRect(rect.x, rect.y, rect.width, rect.height)));\n },\n },\n });\n }\n\n const posture = 'DevicePosture' in window ? null : new DevicePosturePolyfill();\n if (posture) {\n Object.defineProperty(navigator, 'devicePosture', { configurable: true, value: posture });\n }\n\n const root = document.documentElement;\n let variables: string[] = [];\n\n const applyCss = () => {\n const css = cssFor(currentSegments(), postureOf(fold));\n for (const name of variables) root.style.removeProperty(name);\n variables = Object.keys(css.variables);\n for (const name of variables) root.style.setProperty(name, css.variables[name]);\n for (const name of CSS_CLASSES) root.classList.toggle(name, css.classes.includes(name));\n const foldCss = foldCssFor(fold?.hingeBounds, fold?.hingeOrientation, fold?.hingeMargins);\n for (const name of FOLD_VARIABLES) {\n if (foldCss.variables[name]) root.style.setProperty(name, foldCss.variables[name]);\n else root.style.removeProperty(name);\n }\n for (const name of FOLD_CLASSES) root.classList.toggle(name, name === foldCss.className);\n root.style.setProperty(\n '--vertical-tab-bar-bottom',\n `${verticalTabBarBottom(fold?.cameraBounds ?? [], window.innerHeight)}px`,\n );\n };\n\n const apply = (next: FoldState) => {\n fold = next.activeDisplay === 'outer' ? null : next;\n posture?.update(postureOf(fold));\n applyCss();\n\n // The web view can report the previous window size for a moment after the\n // app moves between displays, so measure again once it has settled.\n requestAnimationFrame(applyCss);\n setTimeout(applyCss, 300);\n };\n\n const applyBars = ({ verticalBarEdge }: BarPlacement) => {\n const active = barClassFor(verticalBarEdge);\n for (const name of BAR_CLASSES) root.classList.toggle(name, name === active);\n };\n\n let measured = '';\n const applyCssIfResized = () => {\n const size = `${window.innerWidth}x${window.innerHeight}`;\n if (size === measured) return;\n measured = size;\n applyCss();\n };\n\n await plugin.addListener('foldingChange', ({ folding }) => root.classList.toggle('folding', folding));\n window.addEventListener('resize', applyCss);\n if (typeof ResizeObserver !== 'undefined') new ResizeObserver(applyCssIfResized).observe(root);\n document.addEventListener('visibilitychange', applyCssIfResized);\n await plugin.addListener('foldStateChange', apply);\n await plugin.addListener('barPlacementChange', applyBars);\n apply(await plugin.getFoldState());\n applyBars(await plugin.getBarPlacement());\n}\n"]}
|
package/dist/plugin.cjs.js
CHANGED
|
@@ -181,8 +181,8 @@ async function run(plugin, options) {
|
|
|
181
181
|
root.style.setProperty('--vertical-tab-bar-bottom', `${verticalTabBarBottom((_a = fold === null || fold === void 0 ? void 0 : fold.cameraBounds) !== null && _a !== void 0 ? _a : [], window.innerHeight)}px`);
|
|
182
182
|
};
|
|
183
183
|
const apply = (next) => {
|
|
184
|
-
fold = next;
|
|
185
|
-
posture === null || posture === void 0 ? void 0 : posture.update(postureOf(
|
|
184
|
+
fold = next.activeDisplay === 'outer' ? null : next;
|
|
185
|
+
posture === null || posture === void 0 ? void 0 : posture.update(postureOf(fold));
|
|
186
186
|
applyCss();
|
|
187
187
|
// The web view can report the previous window size for a moment after the
|
|
188
188
|
// app moves between displays, so measure again once it has settled.
|
|
@@ -194,8 +194,19 @@ async function run(plugin, options) {
|
|
|
194
194
|
for (const name of BAR_CLASSES)
|
|
195
195
|
root.classList.toggle(name, name === active);
|
|
196
196
|
};
|
|
197
|
+
let measured = '';
|
|
198
|
+
const applyCssIfResized = () => {
|
|
199
|
+
const size = `${window.innerWidth}x${window.innerHeight}`;
|
|
200
|
+
if (size === measured)
|
|
201
|
+
return;
|
|
202
|
+
measured = size;
|
|
203
|
+
applyCss();
|
|
204
|
+
};
|
|
197
205
|
await plugin.addListener('foldingChange', ({ folding }) => root.classList.toggle('folding', folding));
|
|
198
206
|
window.addEventListener('resize', applyCss);
|
|
207
|
+
if (typeof ResizeObserver !== 'undefined')
|
|
208
|
+
new ResizeObserver(applyCssIfResized).observe(root);
|
|
209
|
+
document.addEventListener('visibilitychange', applyCssIfResized);
|
|
199
210
|
await plugin.addListener('foldStateChange', apply);
|
|
200
211
|
await plugin.addListener('barPlacementChange', applyBars);
|
|
201
212
|
apply(await plugin.getFoldState());
|
package/dist/plugin.cjs.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"plugin.cjs.js","sources":["esm/css.js","esm/keyboard.js","esm/segments.js","esm/polyfill.js","esm/index.js","esm/size-class.js","esm/web.js"],"sourcesContent":["export const CSS_CLASSES = [\n 'horizontal-viewport-segments-2',\n 'vertical-viewport-segments-2',\n 'device-posture-continuous',\n 'device-posture-folded',\n];\nexport const BAR_CLASSES = ['vertical-bars-leading', 'vertical-bars-trailing'];\nexport const FOLD_CLASSES = ['fold-vertical', 'fold-horizontal'];\nexport const FOLD_VARIABLES = [\n '--fold-left',\n '--fold-top',\n '--fold-width',\n '--fold-height',\n '--fold-margin-top',\n '--fold-margin-right',\n '--fold-margin-bottom',\n '--fold-margin-left',\n];\nexport function foldCssFor(hingeBounds, hingeOrientation, hingeMargins) {\n if (!hingeBounds || !hingeOrientation)\n return { variables: {}, className: null };\n const margins = hingeMargins !== null && hingeMargins !== void 0 ? hingeMargins : { top: 0, right: 0, bottom: 0, left: 0 };\n return {\n variables: {\n '--fold-left': `${hingeBounds.x}px`,\n '--fold-top': `${hingeBounds.y}px`,\n '--fold-width': `${hingeBounds.width}px`,\n '--fold-height': `${hingeBounds.height}px`,\n '--fold-margin-top': `${margins.top}px`,\n '--fold-margin-right': `${margins.right}px`,\n '--fold-margin-bottom': `${margins.bottom}px`,\n '--fold-margin-left': `${margins.left}px`,\n },\n className: `fold-${hingeOrientation}`,\n };\n}\nexport function barClassFor(edge) {\n return edge ? `vertical-bars-${edge}` : null;\n}\nconst TAB_BAR_MARGIN = 24;\nconst CAMERA_GAP = 15;\nexport function verticalTabBarBottom(cameras, viewportHeight) {\n const below = cameras.filter((camera) => camera.y > viewportHeight / 2);\n const camera = below.sort((a, b) => a.width * a.height - b.width * b.height)[0];\n if (!camera)\n return TAB_BAR_MARGIN;\n return Math.max(TAB_BAR_MARGIN, Math.round(viewportHeight - camera.y + CAMERA_GAP));\n}\nexport function cssFor(segments, posture) {\n const stacked = segments.length > 1 && segments[1].y > segments[0].y;\n const variables = {};\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 const classes = [`device-posture-${posture}`];\n if (segments.length > 1) {\n classes.push(stacked ? 'vertical-viewport-segments-2' : 'horizontal-viewport-segments-2');\n }\n return { variables, classes };\n}\n//# sourceMappingURL=css.js.map","export const KEYBOARD_CLASS = 'foldable-keyboard-open';\nconst SHOW_EVENTS = ['keyboardWillShow', 'keyboardDidShow', 'ionKeyboardDidShow'];\nconst isEditing = (element) => !!element &&\n (element.isContentEditable || ['INPUT', 'TEXTAREA', 'SELECT'].includes(element.tagName));\nexport function takeOverKeyboard(target, doc) {\n const classes = doc.documentElement.classList;\n for (const name of SHOW_EVENTS) {\n target.addEventListener(name, (event) => {\n event.stopImmediatePropagation();\n if (isEditing(doc.activeElement))\n classes.add(KEYBOARD_CLASS);\n }, true);\n }\n target.addEventListener('keyboardWillHide', () => classes.remove(KEYBOARD_CLASS), true);\n}\n//# sourceMappingURL=keyboard.js.map","const EDGE_TOLERANCE = 1;\nexport function splitViewport(fold, width, height) {\n const whole = [{ x: 0, y: 0, width, height }];\n const hinge = fold === null || fold === void 0 ? void 0 : fold.hingeBounds;\n if (!(fold === null || fold === void 0 ? void 0 : fold.isSeparating) || !hinge)\n return whole;\n if (fold.hingeOrientation === 'vertical') {\n const right = hinge.x + hinge.width;\n const spansHeight = hinge.y <= EDGE_TOLERANCE && hinge.y + hinge.height >= height - EDGE_TOLERANCE;\n if (!spansHeight || hinge.x <= 0 || right >= width)\n return whole;\n return [\n { x: 0, y: 0, width: hinge.x, height },\n { x: right, y: 0, width: width - right, height },\n ];\n }\n const bottom = hinge.y + hinge.height;\n const spansWidth = hinge.x <= EDGE_TOLERANCE && hinge.x + hinge.width >= width - EDGE_TOLERANCE;\n if (!spansWidth || hinge.y <= 0 || bottom >= height)\n return whole;\n return [\n { x: 0, y: 0, width, height: hinge.y },\n { x: 0, y: bottom, width, height: height - bottom },\n ];\n}\n//# sourceMappingURL=segments.js.map","import { Capacitor } from '@capacitor/core';\nimport { BAR_CLASSES, barClassFor, CSS_CLASSES, cssFor, FOLD_CLASSES, FOLD_VARIABLES, foldCssFor, verticalTabBarBottom, } from './css';\nimport { takeOverKeyboard } from './keyboard';\nimport { splitViewport } from './segments';\nclass DevicePosturePolyfill extends EventTarget {\n constructor() {\n super(...arguments);\n this.onchange = null;\n this.current = 'continuous';\n }\n get type() {\n return this.current;\n }\n update(type) {\n var _a;\n if (type === this.current)\n return;\n this.current = type;\n const event = new Event('change');\n (_a = this.onchange) === null || _a === void 0 ? void 0 : _a.call(this, event);\n this.dispatchEvent(event);\n }\n}\nconst postureOf = (fold) => (fold === null || fold === void 0 ? void 0 : fold.state) === 'half-opened' ? 'folded' : 'continuous';\nlet installation = null;\nexport function install(plugin, options = {}) {\n if (!Capacitor.isNativePlatform())\n return Promise.resolve();\n installation !== null && installation !== void 0 ? installation : (installation = run(plugin, options));\n return installation;\n}\nasync function run(plugin, options) {\n if (options.ionicKeyboard)\n takeOverKeyboard(window, document);\n let fold = null;\n const currentSegments = () => splitViewport(fold, window.innerWidth, window.innerHeight);\n if (!('Viewport' in window)) {\n Object.defineProperty(window, 'viewport', {\n configurable: true,\n value: {\n get segments() {\n return Object.freeze(currentSegments().map((rect) => new DOMRect(rect.x, rect.y, rect.width, rect.height)));\n },\n },\n });\n }\n const posture = 'DevicePosture' in window ? null : new DevicePosturePolyfill();\n if (posture) {\n Object.defineProperty(navigator, 'devicePosture', { configurable: true, value: posture });\n }\n const root = document.documentElement;\n let variables = [];\n const applyCss = () => {\n var _a;\n const css = cssFor(currentSegments(), postureOf(fold));\n for (const name of variables)\n root.style.removeProperty(name);\n variables = Object.keys(css.variables);\n for (const name of variables)\n root.style.setProperty(name, css.variables[name]);\n for (const name of CSS_CLASSES)\n root.classList.toggle(name, css.classes.includes(name));\n const foldCss = foldCssFor(fold === null || fold === void 0 ? void 0 : fold.hingeBounds, fold === null || fold === void 0 ? void 0 : fold.hingeOrientation, fold === null || fold === void 0 ? void 0 : fold.hingeMargins);\n for (const name of FOLD_VARIABLES) {\n if (foldCss.variables[name])\n root.style.setProperty(name, foldCss.variables[name]);\n else\n root.style.removeProperty(name);\n }\n for (const name of FOLD_CLASSES)\n root.classList.toggle(name, name === foldCss.className);\n root.style.setProperty('--vertical-tab-bar-bottom', `${verticalTabBarBottom((_a = fold === null || fold === void 0 ? void 0 : fold.cameraBounds) !== null && _a !== void 0 ? _a : [], window.innerHeight)}px`);\n };\n const apply = (next) => {\n fold = next;\n posture === null || posture === void 0 ? void 0 : posture.update(postureOf(next));\n applyCss();\n // The web view can report the previous window size for a moment after the\n // app moves between displays, so measure again once it has settled.\n requestAnimationFrame(applyCss);\n setTimeout(applyCss, 300);\n };\n const applyBars = ({ verticalBarEdge }) => {\n const active = barClassFor(verticalBarEdge);\n for (const name of BAR_CLASSES)\n root.classList.toggle(name, name === active);\n };\n await plugin.addListener('foldingChange', ({ folding }) => root.classList.toggle('folding', folding));\n window.addEventListener('resize', applyCss);\n await plugin.addListener('foldStateChange', apply);\n await plugin.addListener('barPlacementChange', applyBars);\n apply(await plugin.getFoldState());\n applyBars(await plugin.getBarPlacement());\n}\n//# sourceMappingURL=polyfill.js.map","import { registerPlugin } from '@capacitor/core';\nimport { install } from './polyfill';\nconst Foldable = registerPlugin('Foldable', {\n web: () => import('./web').then((m) => new m.FoldableWeb()),\n});\nconst installFoldablePolyfill = (options) => install(Foldable, options);\nexport * from './definitions';\nexport { Foldable, installFoldablePolyfill };\n//# sourceMappingURL=index.js.map","const MEDIUM_WIDTH = 600;\nconst EXPANDED_WIDTH = 840;\nconst LARGE_WIDTH = 1200;\nconst EXTRA_LARGE_WIDTH = 1600;\nconst MEDIUM_HEIGHT = 480;\nconst EXPANDED_HEIGHT = 900;\nfunction widthClassOf(width) {\n if (width >= EXTRA_LARGE_WIDTH)\n return 'extraLarge';\n if (width >= LARGE_WIDTH)\n return 'large';\n if (width >= EXPANDED_WIDTH)\n return 'expanded';\n if (width >= MEDIUM_WIDTH)\n return 'medium';\n return 'compact';\n}\nfunction heightClassOf(height) {\n if (height >= EXPANDED_HEIGHT)\n return 'expanded';\n if (height >= MEDIUM_HEIGHT)\n return 'medium';\n return 'compact';\n}\nexport function sizeClassOf(width, height) {\n return {\n horizontal: width >= MEDIUM_WIDTH ? 'regular' : 'compact',\n vertical: height >= MEDIUM_HEIGHT ? 'regular' : 'compact',\n widthClass: widthClassOf(width),\n heightClass: heightClassOf(height),\n };\n}\n//# sourceMappingURL=size-class.js.map","import { WebPlugin } from '@capacitor/core';\nimport { sizeClassOf } from './size-class';\nexport class FoldableWeb extends WebPlugin {\n constructor() {\n super();\n this.sizeClass = sizeClassOf(window.innerWidth, window.innerHeight);\n window.addEventListener('resize', () => {\n const next = sizeClassOf(window.innerWidth, window.innerHeight);\n if (JSON.stringify(next) === JSON.stringify(this.sizeClass))\n return;\n this.sizeClass = next;\n this.notifyListeners('sizeClassChange', next);\n });\n }\n async isDeviceFoldable() {\n return { foldable: false, supportsTabletop: false };\n }\n async getFoldState() {\n return { state: 'flat', isSeparating: false, posture: 'flat' };\n }\n async setVerticalBarBehavior() {\n return { applied: false };\n }\n async getReservedRegions() {\n return { regions: [] };\n }\n async getHingeAngle() {\n return { angle: null, status: null };\n }\n async getSizeClass() {\n return sizeClassOf(window.innerWidth, window.innerHeight);\n }\n async getDisplayModes() {\n return { rearDisplay: 'unsupported', dualScreen: 'unsupported' };\n }\n async getBarPlacement() {\n return { verticalBarEdge: null, inset: 0 };\n }\n async startRearDisplay() {\n throw this.unavailable('Rear display mode is only available on Android.');\n }\n stopRearDisplay() {\n return Promise.resolve();\n }\n async startDualScreen() {\n throw this.unavailable('Dual-screen mode is only available on Android.');\n }\n stopDualScreen() {\n return Promise.resolve();\n }\n}\n//# sourceMappingURL=web.js.map"],"names":["Capacitor","registerPlugin","WebPlugin"],"mappings":";;;;AAAO,MAAM,WAAW,GAAG;AAC3B,IAAI,gCAAgC;AACpC,IAAI,8BAA8B;AAClC,IAAI,2BAA2B;AAC/B,IAAI,uBAAuB;AAC3B,CAAC;AACM,MAAM,WAAW,GAAG,CAAC,uBAAuB,EAAE,wBAAwB,CAAC;AACvE,MAAM,YAAY,GAAG,CAAC,eAAe,EAAE,iBAAiB,CAAC;AACzD,MAAM,cAAc,GAAG;AAC9B,IAAI,aAAa;AACjB,IAAI,YAAY;AAChB,IAAI,cAAc;AAClB,IAAI,eAAe;AACnB,IAAI,mB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AAE,IAAI,EAAE;AAC5C,IAAI;AACJ,IAAI,MAAM,YAAY,GAAG;AACzB,QAAQ,OAAO,WAAW,CAAC,MAAM,CAAC,UAAU,EAAE,MAAM,CAAC,WAAW,CAAC;AACjE,IAAI;AACJ,IAAI,MAAM,eAAe,GAAG;AAC5B,QAAQ,OAAO,EAAE,WAAW,EAAE,aAAa,EAAE,UAAU,EAAE,aAAa,EAAE;AACxE,IAAI;AACJ,IAAI,MAAM,eAAe,GAAG;AAC5B,QAAQ,OAAO,EAAE,eAAe,EAAE,IAAI,EAAE,KAAK,EAAE,CAAC,EAAE;AAClD,IAAI;AACJ,IAAI,MAAM,gBAAgB,GAAG;AAC7B,QAAQ,MAAM,IAAI,CAAC,WAAW,CAAC,iDAAiD,CAAC;AACjF,IAAI;AACJ,IAAI,eAAe,GAAG;AACtB,QAAQ,OAAO,OAAO,CAAC,OAAO,EAAE;AAChC,IAAI;AACJ,IAAI,MAAM,eAAe,GAAG;AAC5B,QAAQ,MAAM,IAAI,CAAC,WAAW,CAAC,gDAAgD,CAAC;AAChF,IAAI;AACJ,IAAI,cAAc,GAAG;AACrB,QAAQ,OAAO,OAAO,CAAC,OAAO,EAAE;AAChC,IAAI;AACJ;;;;;;;;"}
|
|
1
|
+
{"version":3,"file":"plugin.cjs.js","sources":["esm/css.js","esm/keyboard.js","esm/segments.js","esm/polyfill.js","esm/index.js","esm/size-class.js","esm/web.js"],"sourcesContent":["export const CSS_CLASSES = [\n 'horizontal-viewport-segments-2',\n 'vertical-viewport-segments-2',\n 'device-posture-continuous',\n 'device-posture-folded',\n];\nexport const BAR_CLASSES = ['vertical-bars-leading', 'vertical-bars-trailing'];\nexport const FOLD_CLASSES = ['fold-vertical', 'fold-horizontal'];\nexport const FOLD_VARIABLES = [\n '--fold-left',\n '--fold-top',\n '--fold-width',\n '--fold-height',\n '--fold-margin-top',\n '--fold-margin-right',\n '--fold-margin-bottom',\n '--fold-margin-left',\n];\nexport function foldCssFor(hingeBounds, hingeOrientation, hingeMargins) {\n if (!hingeBounds || !hingeOrientation)\n return { variables: {}, className: null };\n const margins = hingeMargins !== null && hingeMargins !== void 0 ? hingeMargins : { top: 0, right: 0, bottom: 0, left: 0 };\n return {\n variables: {\n '--fold-left': `${hingeBounds.x}px`,\n '--fold-top': `${hingeBounds.y}px`,\n '--fold-width': `${hingeBounds.width}px`,\n '--fold-height': `${hingeBounds.height}px`,\n '--fold-margin-top': `${margins.top}px`,\n '--fold-margin-right': `${margins.right}px`,\n '--fold-margin-bottom': `${margins.bottom}px`,\n '--fold-margin-left': `${margins.left}px`,\n },\n className: `fold-${hingeOrientation}`,\n };\n}\nexport function barClassFor(edge) {\n return edge ? `vertical-bars-${edge}` : null;\n}\nconst TAB_BAR_MARGIN = 24;\nconst CAMERA_GAP = 15;\nexport function verticalTabBarBottom(cameras, viewportHeight) {\n const below = cameras.filter((camera) => camera.y > viewportHeight / 2);\n const camera = below.sort((a, b) => a.width * a.height - b.width * b.height)[0];\n if (!camera)\n return TAB_BAR_MARGIN;\n return Math.max(TAB_BAR_MARGIN, Math.round(viewportHeight - camera.y + CAMERA_GAP));\n}\nexport function cssFor(segments, posture) {\n const stacked = segments.length > 1 && segments[1].y > segments[0].y;\n const variables = {};\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 const classes = [`device-posture-${posture}`];\n if (segments.length > 1) {\n classes.push(stacked ? 'vertical-viewport-segments-2' : 'horizontal-viewport-segments-2');\n }\n return { variables, classes };\n}\n//# sourceMappingURL=css.js.map","export const KEYBOARD_CLASS = 'foldable-keyboard-open';\nconst SHOW_EVENTS = ['keyboardWillShow', 'keyboardDidShow', 'ionKeyboardDidShow'];\nconst isEditing = (element) => !!element &&\n (element.isContentEditable || ['INPUT', 'TEXTAREA', 'SELECT'].includes(element.tagName));\nexport function takeOverKeyboard(target, doc) {\n const classes = doc.documentElement.classList;\n for (const name of SHOW_EVENTS) {\n target.addEventListener(name, (event) => {\n event.stopImmediatePropagation();\n if (isEditing(doc.activeElement))\n classes.add(KEYBOARD_CLASS);\n }, true);\n }\n target.addEventListener('keyboardWillHide', () => classes.remove(KEYBOARD_CLASS), true);\n}\n//# sourceMappingURL=keyboard.js.map","const EDGE_TOLERANCE = 1;\nexport function splitViewport(fold, width, height) {\n const whole = [{ x: 0, y: 0, width, height }];\n const hinge = fold === null || fold === void 0 ? void 0 : fold.hingeBounds;\n if (!(fold === null || fold === void 0 ? void 0 : fold.isSeparating) || !hinge)\n return whole;\n if (fold.hingeOrientation === 'vertical') {\n const right = hinge.x + hinge.width;\n const spansHeight = hinge.y <= EDGE_TOLERANCE && hinge.y + hinge.height >= height - EDGE_TOLERANCE;\n if (!spansHeight || hinge.x <= 0 || right >= width)\n return whole;\n return [\n { x: 0, y: 0, width: hinge.x, height },\n { x: right, y: 0, width: width - right, height },\n ];\n }\n const bottom = hinge.y + hinge.height;\n const spansWidth = hinge.x <= EDGE_TOLERANCE && hinge.x + hinge.width >= width - EDGE_TOLERANCE;\n if (!spansWidth || hinge.y <= 0 || bottom >= height)\n return whole;\n return [\n { x: 0, y: 0, width, height: hinge.y },\n { x: 0, y: bottom, width, height: height - bottom },\n ];\n}\n//# sourceMappingURL=segments.js.map","import { Capacitor } from '@capacitor/core';\nimport { BAR_CLASSES, barClassFor, CSS_CLASSES, cssFor, FOLD_CLASSES, FOLD_VARIABLES, foldCssFor, verticalTabBarBottom, } from './css';\nimport { takeOverKeyboard } from './keyboard';\nimport { splitViewport } from './segments';\nclass DevicePosturePolyfill extends EventTarget {\n constructor() {\n super(...arguments);\n this.onchange = null;\n this.current = 'continuous';\n }\n get type() {\n return this.current;\n }\n update(type) {\n var _a;\n if (type === this.current)\n return;\n this.current = type;\n const event = new Event('change');\n (_a = this.onchange) === null || _a === void 0 ? void 0 : _a.call(this, event);\n this.dispatchEvent(event);\n }\n}\nconst postureOf = (fold) => (fold === null || fold === void 0 ? void 0 : fold.state) === 'half-opened' ? 'folded' : 'continuous';\nlet installation = null;\nexport function install(plugin, options = {}) {\n if (!Capacitor.isNativePlatform())\n return Promise.resolve();\n installation !== null && installation !== void 0 ? installation : (installation = run(plugin, options));\n return installation;\n}\nasync function run(plugin, options) {\n if (options.ionicKeyboard)\n takeOverKeyboard(window, document);\n let fold = null;\n const currentSegments = () => splitViewport(fold, window.innerWidth, window.innerHeight);\n if (!('Viewport' in window)) {\n Object.defineProperty(window, 'viewport', {\n configurable: true,\n value: {\n get segments() {\n return Object.freeze(currentSegments().map((rect) => new DOMRect(rect.x, rect.y, rect.width, rect.height)));\n },\n },\n });\n }\n const posture = 'DevicePosture' in window ? null : new DevicePosturePolyfill();\n if (posture) {\n Object.defineProperty(navigator, 'devicePosture', { configurable: true, value: posture });\n }\n const root = document.documentElement;\n let variables = [];\n const applyCss = () => {\n var _a;\n const css = cssFor(currentSegments(), postureOf(fold));\n for (const name of variables)\n root.style.removeProperty(name);\n variables = Object.keys(css.variables);\n for (const name of variables)\n root.style.setProperty(name, css.variables[name]);\n for (const name of CSS_CLASSES)\n root.classList.toggle(name, css.classes.includes(name));\n const foldCss = foldCssFor(fold === null || fold === void 0 ? void 0 : fold.hingeBounds, fold === null || fold === void 0 ? void 0 : fold.hingeOrientation, fold === null || fold === void 0 ? void 0 : fold.hingeMargins);\n for (const name of FOLD_VARIABLES) {\n if (foldCss.variables[name])\n root.style.setProperty(name, foldCss.variables[name]);\n else\n root.style.removeProperty(name);\n }\n for (const name of FOLD_CLASSES)\n root.classList.toggle(name, name === foldCss.className);\n root.style.setProperty('--vertical-tab-bar-bottom', `${verticalTabBarBottom((_a = fold === null || fold === void 0 ? void 0 : fold.cameraBounds) !== null && _a !== void 0 ? _a : [], window.innerHeight)}px`);\n };\n const apply = (next) => {\n fold = next.activeDisplay === 'outer' ? null : next;\n posture === null || posture === void 0 ? void 0 : posture.update(postureOf(fold));\n applyCss();\n // The web view can report the previous window size for a moment after the\n // app moves between displays, so measure again once it has settled.\n requestAnimationFrame(applyCss);\n setTimeout(applyCss, 300);\n };\n const applyBars = ({ verticalBarEdge }) => {\n const active = barClassFor(verticalBarEdge);\n for (const name of BAR_CLASSES)\n root.classList.toggle(name, name === active);\n };\n let measured = '';\n const applyCssIfResized = () => {\n const size = `${window.innerWidth}x${window.innerHeight}`;\n if (size === measured)\n return;\n measured = size;\n applyCss();\n };\n await plugin.addListener('foldingChange', ({ folding }) => root.classList.toggle('folding', folding));\n window.addEventListener('resize', applyCss);\n if (typeof ResizeObserver !== 'undefined')\n new ResizeObserver(applyCssIfResized).observe(root);\n document.addEventListener('visibilitychange', applyCssIfResized);\n await plugin.addListener('foldStateChange', apply);\n await plugin.addListener('barPlacementChange', applyBars);\n apply(await plugin.getFoldState());\n applyBars(await plugin.getBarPlacement());\n}\n//# sourceMappingURL=polyfill.js.map","import { registerPlugin } from '@capacitor/core';\nimport { install } from './polyfill';\nconst Foldable = registerPlugin('Foldable', {\n web: () => import('./web').then((m) => new m.FoldableWeb()),\n});\nconst installFoldablePolyfill = (options) => install(Foldable, options);\nexport * from './definitions';\nexport { Foldable, installFoldablePolyfill };\n//# sourceMappingURL=index.js.map","const MEDIUM_WIDTH = 600;\nconst EXPANDED_WIDTH = 840;\nconst LARGE_WIDTH = 1200;\nconst EXTRA_LARGE_WIDTH = 1600;\nconst MEDIUM_HEIGHT = 480;\nconst EXPANDED_HEIGHT = 900;\nfunction widthClassOf(width) {\n if (width >= EXTRA_LARGE_WIDTH)\n return 'extraLarge';\n if (width >= LARGE_WIDTH)\n return 'large';\n if (width >= EXPANDED_WIDTH)\n return 'expanded';\n if (width >= MEDIUM_WIDTH)\n return 'medium';\n return 'compact';\n}\nfunction heightClassOf(height) {\n if (height >= EXPANDED_HEIGHT)\n return 'expanded';\n if (height >= MEDIUM_HEIGHT)\n return 'medium';\n return 'compact';\n}\nexport function sizeClassOf(width, height) {\n return {\n horizontal: width >= MEDIUM_WIDTH ? 'regular' : 'compact',\n vertical: height >= MEDIUM_HEIGHT ? 'regular' : 'compact',\n widthClass: widthClassOf(width),\n heightClass: heightClassOf(height),\n };\n}\n//# sourceMappingURL=size-class.js.map","import { WebPlugin } from '@capacitor/core';\nimport { sizeClassOf } from './size-class';\nexport class FoldableWeb extends WebPlugin {\n constructor() {\n super();\n this.sizeClass = sizeClassOf(window.innerWidth, window.innerHeight);\n window.addEventListener('resize', () => {\n const next = sizeClassOf(window.innerWidth, window.innerHeight);\n if (JSON.stringify(next) === JSON.stringify(this.sizeClass))\n return;\n this.sizeClass = next;\n this.notifyListeners('sizeClassChange', next);\n });\n }\n async isDeviceFoldable() {\n return { foldable: false, supportsTabletop: false };\n }\n async getFoldState() {\n return { state: 'flat', isSeparating: false, posture: 'flat' };\n }\n async setVerticalBarBehavior() {\n return { applied: false };\n }\n async getReservedRegions() {\n return { regions: [] };\n }\n async getHingeAngle() {\n return { angle: null, status: null };\n }\n async getSizeClass() {\n return sizeClassOf(window.innerWidth, window.innerHeight);\n }\n async getDisplayModes() {\n return { rearDisplay: 'unsupported', dualScreen: 'unsupported' };\n }\n async getBarPlacement() {\n return { verticalBarEdge: null, inset: 0 };\n }\n async startRearDisplay() {\n throw this.unavailable('Rear display mode is only available on Android.');\n }\n stopRearDisplay() {\n return Promise.resolve();\n }\n async startDualScreen() {\n throw this.unavailable('Dual-screen mode is only available on Android.');\n }\n stopDualScreen() {\n return Promise.resolve();\n }\n}\n//# sourceMappingURL=web.js.map"],"names":["Capacitor","registerPlugin","WebPlugin"],"mappings":";;;;AAAO,MAAM,WAAW,GAAG;AAC3B,IAAI,gCAAgC;AACpC,IAAI,8BAA8B;AAClC,IAAI,2BAA2B;AA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B,QAAQ,MAAM,IAAI,CAAC,WAAW,CAAC,iDAAiD,CAAC;AACjF,IAAI;AACJ,IAAI,eAAe,GAAG;AACtB,QAAQ,OAAO,OAAO,CAAC,OAAO,EAAE;AAChC,IAAI;AACJ,IAAI,MAAM,eAAe,GAAG;AAC5B,QAAQ,MAAM,IAAI,CAAC,WAAW,CAAC,gDAAgD,CAAC;AAChF,IAAI;AACJ,IAAI,cAAc,GAAG;AACrB,QAAQ,OAAO,OAAO,CAAC,OAAO,EAAE;AAChC,IAAI;AACJ;;;;;;;;"}
|
package/dist/plugin.js
CHANGED
|
@@ -180,8 +180,8 @@ var capacitorFoldable = (function (exports, core) {
|
|
|
180
180
|
root.style.setProperty('--vertical-tab-bar-bottom', `${verticalTabBarBottom((_a = fold === null || fold === void 0 ? void 0 : fold.cameraBounds) !== null && _a !== void 0 ? _a : [], window.innerHeight)}px`);
|
|
181
181
|
};
|
|
182
182
|
const apply = (next) => {
|
|
183
|
-
fold = next;
|
|
184
|
-
posture === null || posture === void 0 ? void 0 : posture.update(postureOf(
|
|
183
|
+
fold = next.activeDisplay === 'outer' ? null : next;
|
|
184
|
+
posture === null || posture === void 0 ? void 0 : posture.update(postureOf(fold));
|
|
185
185
|
applyCss();
|
|
186
186
|
// The web view can report the previous window size for a moment after the
|
|
187
187
|
// app moves between displays, so measure again once it has settled.
|
|
@@ -193,8 +193,19 @@ var capacitorFoldable = (function (exports, core) {
|
|
|
193
193
|
for (const name of BAR_CLASSES)
|
|
194
194
|
root.classList.toggle(name, name === active);
|
|
195
195
|
};
|
|
196
|
+
let measured = '';
|
|
197
|
+
const applyCssIfResized = () => {
|
|
198
|
+
const size = `${window.innerWidth}x${window.innerHeight}`;
|
|
199
|
+
if (size === measured)
|
|
200
|
+
return;
|
|
201
|
+
measured = size;
|
|
202
|
+
applyCss();
|
|
203
|
+
};
|
|
196
204
|
await plugin.addListener('foldingChange', ({ folding }) => root.classList.toggle('folding', folding));
|
|
197
205
|
window.addEventListener('resize', applyCss);
|
|
206
|
+
if (typeof ResizeObserver !== 'undefined')
|
|
207
|
+
new ResizeObserver(applyCssIfResized).observe(root);
|
|
208
|
+
document.addEventListener('visibilitychange', applyCssIfResized);
|
|
198
209
|
await plugin.addListener('foldStateChange', apply);
|
|
199
210
|
await plugin.addListener('barPlacementChange', applyBars);
|
|
200
211
|
apply(await plugin.getFoldState());
|
package/dist/plugin.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"plugin.js","sources":["esm/css.js","esm/keyboard.js","esm/segments.js","esm/polyfill.js","esm/index.js","esm/size-class.js","esm/web.js"],"sourcesContent":["export const CSS_CLASSES = [\n 'horizontal-viewport-segments-2',\n 'vertical-viewport-segments-2',\n 'device-posture-continuous',\n 'device-posture-folded',\n];\nexport const BAR_CLASSES = ['vertical-bars-leading', 'vertical-bars-trailing'];\nexport const FOLD_CLASSES = ['fold-vertical', 'fold-horizontal'];\nexport const FOLD_VARIABLES = [\n '--fold-left',\n '--fold-top',\n '--fold-width',\n '--fold-height',\n '--fold-margin-top',\n '--fold-margin-right',\n '--fold-margin-bottom',\n '--fold-margin-left',\n];\nexport function foldCssFor(hingeBounds, hingeOrientation, hingeMargins) {\n if (!hingeBounds || !hingeOrientation)\n return { variables: {}, className: null };\n const margins = hingeMargins !== null && hingeMargins !== void 0 ? hingeMargins : { top: 0, right: 0, bottom: 0, left: 0 };\n return {\n variables: {\n '--fold-left': `${hingeBounds.x}px`,\n '--fold-top': `${hingeBounds.y}px`,\n '--fold-width': `${hingeBounds.width}px`,\n '--fold-height': `${hingeBounds.height}px`,\n '--fold-margin-top': `${margins.top}px`,\n '--fold-margin-right': `${margins.right}px`,\n '--fold-margin-bottom': `${margins.bottom}px`,\n '--fold-margin-left': `${margins.left}px`,\n },\n className: `fold-${hingeOrientation}`,\n };\n}\nexport function barClassFor(edge) {\n return edge ? `vertical-bars-${edge}` : null;\n}\nconst TAB_BAR_MARGIN = 24;\nconst CAMERA_GAP = 15;\nexport function verticalTabBarBottom(cameras, viewportHeight) {\n const below = cameras.filter((camera) => camera.y > viewportHeight / 2);\n const camera = below.sort((a, b) => a.width * a.height - b.width * b.height)[0];\n if (!camera)\n return TAB_BAR_MARGIN;\n return Math.max(TAB_BAR_MARGIN, Math.round(viewportHeight - camera.y + CAMERA_GAP));\n}\nexport function cssFor(segments, posture) {\n const stacked = segments.length > 1 && segments[1].y > segments[0].y;\n const variables = {};\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 const classes = [`device-posture-${posture}`];\n if (segments.length > 1) {\n classes.push(stacked ? 'vertical-viewport-segments-2' : 'horizontal-viewport-segments-2');\n }\n return { variables, classes };\n}\n//# sourceMappingURL=css.js.map","export const KEYBOARD_CLASS = 'foldable-keyboard-open';\nconst SHOW_EVENTS = ['keyboardWillShow', 'keyboardDidShow', 'ionKeyboardDidShow'];\nconst isEditing = (element) => !!element &&\n (element.isContentEditable || ['INPUT', 'TEXTAREA', 'SELECT'].includes(element.tagName));\nexport function takeOverKeyboard(target, doc) {\n const classes = doc.documentElement.classList;\n for (const name of SHOW_EVENTS) {\n target.addEventListener(name, (event) => {\n event.stopImmediatePropagation();\n if (isEditing(doc.activeElement))\n classes.add(KEYBOARD_CLASS);\n }, true);\n }\n target.addEventListener('keyboardWillHide', () => classes.remove(KEYBOARD_CLASS), true);\n}\n//# sourceMappingURL=keyboard.js.map","const EDGE_TOLERANCE = 1;\nexport function splitViewport(fold, width, height) {\n const whole = [{ x: 0, y: 0, width, height }];\n const hinge = fold === null || fold === void 0 ? void 0 : fold.hingeBounds;\n if (!(fold === null || fold === void 0 ? void 0 : fold.isSeparating) || !hinge)\n return whole;\n if (fold.hingeOrientation === 'vertical') {\n const right = hinge.x + hinge.width;\n const spansHeight = hinge.y <= EDGE_TOLERANCE && hinge.y + hinge.height >= height - EDGE_TOLERANCE;\n if (!spansHeight || hinge.x <= 0 || right >= width)\n return whole;\n return [\n { x: 0, y: 0, width: hinge.x, height },\n { x: right, y: 0, width: width - right, height },\n ];\n }\n const bottom = hinge.y + hinge.height;\n const spansWidth = hinge.x <= EDGE_TOLERANCE && hinge.x + hinge.width >= width - EDGE_TOLERANCE;\n if (!spansWidth || hinge.y <= 0 || bottom >= height)\n return whole;\n return [\n { x: 0, y: 0, width, height: hinge.y },\n { x: 0, y: bottom, width, height: height - bottom },\n ];\n}\n//# sourceMappingURL=segments.js.map","import { Capacitor } from '@capacitor/core';\nimport { BAR_CLASSES, barClassFor, CSS_CLASSES, cssFor, FOLD_CLASSES, FOLD_VARIABLES, foldCssFor, verticalTabBarBottom, } from './css';\nimport { takeOverKeyboard } from './keyboard';\nimport { splitViewport } from './segments';\nclass DevicePosturePolyfill extends EventTarget {\n constructor() {\n super(...arguments);\n this.onchange = null;\n this.current = 'continuous';\n }\n get type() {\n return this.current;\n }\n update(type) {\n var _a;\n if (type === this.current)\n return;\n this.current = type;\n const event = new Event('change');\n (_a = this.onchange) === null || _a === void 0 ? void 0 : _a.call(this, event);\n this.dispatchEvent(event);\n }\n}\nconst postureOf = (fold) => (fold === null || fold === void 0 ? void 0 : fold.state) === 'half-opened' ? 'folded' : 'continuous';\nlet installation = null;\nexport function install(plugin, options = {}) {\n if (!Capacitor.isNativePlatform())\n return Promise.resolve();\n installation !== null && installation !== void 0 ? installation : (installation = run(plugin, options));\n return installation;\n}\nasync function run(plugin, options) {\n if (options.ionicKeyboard)\n takeOverKeyboard(window, document);\n let fold = null;\n const currentSegments = () => splitViewport(fold, window.innerWidth, window.innerHeight);\n if (!('Viewport' in window)) {\n Object.defineProperty(window, 'viewport', {\n configurable: true,\n value: {\n get segments() {\n return Object.freeze(currentSegments().map((rect) => new DOMRect(rect.x, rect.y, rect.width, rect.height)));\n },\n },\n });\n }\n const posture = 'DevicePosture' in window ? null : new DevicePosturePolyfill();\n if (posture) {\n Object.defineProperty(navigator, 'devicePosture', { configurable: true, value: posture });\n }\n const root = document.documentElement;\n let variables = [];\n const applyCss = () => {\n var _a;\n const css = cssFor(currentSegments(), postureOf(fold));\n for (const name of variables)\n root.style.removeProperty(name);\n variables = Object.keys(css.variables);\n for (const name of variables)\n root.style.setProperty(name, css.variables[name]);\n for (const name of CSS_CLASSES)\n root.classList.toggle(name, css.classes.includes(name));\n const foldCss = foldCssFor(fold === null || fold === void 0 ? void 0 : fold.hingeBounds, fold === null || fold === void 0 ? void 0 : fold.hingeOrientation, fold === null || fold === void 0 ? void 0 : fold.hingeMargins);\n for (const name of FOLD_VARIABLES) {\n if (foldCss.variables[name])\n root.style.setProperty(name, foldCss.variables[name]);\n else\n root.style.removeProperty(name);\n }\n for (const name of FOLD_CLASSES)\n root.classList.toggle(name, name === foldCss.className);\n root.style.setProperty('--vertical-tab-bar-bottom', `${verticalTabBarBottom((_a = fold === null || fold === void 0 ? void 0 : fold.cameraBounds) !== null && _a !== void 0 ? _a : [], window.innerHeight)}px`);\n };\n const apply = (next) => {\n fold = next;\n posture === null || posture === void 0 ? void 0 : posture.update(postureOf(next));\n applyCss();\n // The web view can report the previous window size for a moment after the\n // app moves between displays, so measure again once it has settled.\n requestAnimationFrame(applyCss);\n setTimeout(applyCss, 300);\n };\n const applyBars = ({ verticalBarEdge }) => {\n const active = barClassFor(verticalBarEdge);\n for (const name of BAR_CLASSES)\n root.classList.toggle(name, name === active);\n };\n await plugin.addListener('foldingChange', ({ folding }) => root.classList.toggle('folding', folding));\n window.addEventListener('resize', applyCss);\n await plugin.addListener('foldStateChange', apply);\n await plugin.addListener('barPlacementChange', applyBars);\n apply(await plugin.getFoldState());\n applyBars(await plugin.getBarPlacement());\n}\n//# sourceMappingURL=polyfill.js.map","import { registerPlugin } from '@capacitor/core';\nimport { install } from './polyfill';\nconst Foldable = registerPlugin('Foldable', {\n web: () => import('./web').then((m) => new m.FoldableWeb()),\n});\nconst installFoldablePolyfill = (options) => install(Foldable, options);\nexport * from './definitions';\nexport { Foldable, installFoldablePolyfill };\n//# sourceMappingURL=index.js.map","const MEDIUM_WIDTH = 600;\nconst EXPANDED_WIDTH = 840;\nconst LARGE_WIDTH = 1200;\nconst EXTRA_LARGE_WIDTH = 1600;\nconst MEDIUM_HEIGHT = 480;\nconst EXPANDED_HEIGHT = 900;\nfunction widthClassOf(width) {\n if (width >= EXTRA_LARGE_WIDTH)\n return 'extraLarge';\n if (width >= LARGE_WIDTH)\n return 'large';\n if (width >= EXPANDED_WIDTH)\n return 'expanded';\n if (width >= MEDIUM_WIDTH)\n return 'medium';\n return 'compact';\n}\nfunction heightClassOf(height) {\n if (height >= EXPANDED_HEIGHT)\n return 'expanded';\n if (height >= MEDIUM_HEIGHT)\n return 'medium';\n return 'compact';\n}\nexport function sizeClassOf(width, height) {\n return {\n horizontal: width >= MEDIUM_WIDTH ? 'regular' : 'compact',\n vertical: height >= MEDIUM_HEIGHT ? 'regular' : 'compact',\n widthClass: widthClassOf(width),\n heightClass: heightClassOf(height),\n };\n}\n//# sourceMappingURL=size-class.js.map","import { WebPlugin } from '@capacitor/core';\nimport { sizeClassOf } from './size-class';\nexport class FoldableWeb extends WebPlugin {\n constructor() {\n super();\n this.sizeClass = sizeClassOf(window.innerWidth, window.innerHeight);\n window.addEventListener('resize', () => {\n const next = sizeClassOf(window.innerWidth, window.innerHeight);\n if (JSON.stringify(next) === JSON.stringify(this.sizeClass))\n return;\n this.sizeClass = next;\n this.notifyListeners('sizeClassChange', next);\n });\n }\n async isDeviceFoldable() {\n return { foldable: false, supportsTabletop: false };\n }\n async getFoldState() {\n return { state: 'flat', isSeparating: false, posture: 'flat' };\n }\n async setVerticalBarBehavior() {\n return { applied: false };\n }\n async getReservedRegions() {\n return { regions: [] };\n }\n async getHingeAngle() {\n return { angle: null, status: null };\n }\n async getSizeClass() {\n return sizeClassOf(window.innerWidth, window.innerHeight);\n }\n async getDisplayModes() {\n return { rearDisplay: 'unsupported', dualScreen: 'unsupported' };\n }\n async getBarPlacement() {\n return { verticalBarEdge: null, inset: 0 };\n }\n async startRearDisplay() {\n throw this.unavailable('Rear display mode is only available on Android.');\n }\n stopRearDisplay() {\n return Promise.resolve();\n }\n async startDualScreen() {\n throw this.unavailable('Dual-screen mode is only available on Android.');\n }\n stopDualScreen() {\n return Promise.resolve();\n }\n}\n//# sourceMappingURL=web.js.map"],"names":["Capacitor","registerPlugin","WebPlugin"],"mappings":";;;IAAO,MAAM,WAAW,GAAG;IAC3B,IAAI,gCAAgC;IACpC,IAAI,8BAA8B;IAClC,IAAI,2BAA2B;IAC/B,IAAI,uBAAuB;IAC3B,CAAC;IACM,MAAM,WAAW,GAAG,CAAC,uBAAuB,EAAE,wBAAwB,CAAC;IACvE,MAAM,YAAY,GAAG,CAAC,eAAe,EAAE,iBAAiB,CAAC;IACzD,MAAM,cAAc,GAAG;IAC9B,IAAI,aAAa;IACjB,IAAI,YAAY;IAChB,IAAI,cAAc;IAClB,IAAI,eAAe;IACnB,IAAI,mBAAmB;IACvB,IAAI,qBAAqB;IACzB,IAAI,sBAAsB;IAC1B,IAAI,oBAAoB;IACxB,CAAC;IACM,SAAS,UAAU,CAAC,WAAW,EAAE,gBAAgB,EAAE,YAAY,EAAE;IACxE,IAAI,IAAI,CAAC,WAAW,IAAI,CAAC,gBAAgB;IACzC,QAAQ,OAAO,EAAE,SAAS,EAAE,EAAE,EAAE,SAAS,EAAE,IAAI,EAAE;IACjD,IAAI,MAAM,OAAO,GAAG,YAAY,KAAK,IAAI,IAAI,YAAY,KAAK,MAAM,GAAG,YAAY,GAAG,EAAE,GAAG,EAAE,CAAC,EAAE,KAAK,EAAE,CAAC,EAAE,MAAM,EAAE,CAAC,EAAE,IAAI,EAAE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AAC,WAAW,CAAC,iDAAiD,CAAC;IACjF,IAAI;IACJ,IAAI,eAAe,GAAG;IACtB,QAAQ,OAAO,OAAO,CAAC,OAAO,EAAE;IAChC,IAAI;IACJ,IAAI,MAAM,eAAe,GAAG;IAC5B,QAAQ,MAAM,IAAI,CAAC,WAAW,CAAC,gDAAgD,CAAC;IAChF,IAAI;IACJ,IAAI,cAAc,GAAG;IACrB,QAAQ,OAAO,OAAO,CAAC,OAAO,EAAE;IAChC,IAAI;IACJ;;;;;;;;;;;;"}
|
|
1
|
+
{"version":3,"file":"plugin.js","sources":["esm/css.js","esm/keyboard.js","esm/segments.js","esm/polyfill.js","esm/index.js","esm/size-class.js","esm/web.js"],"sourcesContent":["export const CSS_CLASSES = [\n 'horizontal-viewport-segments-2',\n 'vertical-viewport-segments-2',\n 'device-posture-continuous',\n 'device-posture-folded',\n];\nexport const BAR_CLASSES = ['vertical-bars-leading', 'vertical-bars-trailing'];\nexport const FOLD_CLASSES = ['fold-vertical', 'fold-horizontal'];\nexport const FOLD_VARIABLES = [\n '--fold-left',\n '--fold-top',\n '--fold-width',\n '--fold-height',\n '--fold-margin-top',\n '--fold-margin-right',\n '--fold-margin-bottom',\n '--fold-margin-left',\n];\nexport function foldCssFor(hingeBounds, hingeOrientation, hingeMargins) {\n if (!hingeBounds || !hingeOrientation)\n return { variables: {}, className: null };\n const margins = hingeMargins !== null && hingeMargins !== void 0 ? hingeMargins : { top: 0, right: 0, bottom: 0, left: 0 };\n return {\n variables: {\n '--fold-left': `${hingeBounds.x}px`,\n '--fold-top': `${hingeBounds.y}px`,\n '--fold-width': `${hingeBounds.width}px`,\n '--fold-height': `${hingeBounds.height}px`,\n '--fold-margin-top': `${margins.top}px`,\n '--fold-margin-right': `${margins.right}px`,\n '--fold-margin-bottom': `${margins.bottom}px`,\n '--fold-margin-left': `${margins.left}px`,\n },\n className: `fold-${hingeOrientation}`,\n };\n}\nexport function barClassFor(edge) {\n return edge ? `vertical-bars-${edge}` : null;\n}\nconst TAB_BAR_MARGIN = 24;\nconst CAMERA_GAP = 15;\nexport function verticalTabBarBottom(cameras, viewportHeight) {\n const below = cameras.filter((camera) => camera.y > viewportHeight / 2);\n const camera = below.sort((a, b) => a.width * a.height - b.width * b.height)[0];\n if (!camera)\n return TAB_BAR_MARGIN;\n return Math.max(TAB_BAR_MARGIN, Math.round(viewportHeight - camera.y + CAMERA_GAP));\n}\nexport function cssFor(segments, posture) {\n const stacked = segments.length > 1 && segments[1].y > segments[0].y;\n const variables = {};\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 const classes = [`device-posture-${posture}`];\n if (segments.length > 1) {\n classes.push(stacked ? 'vertical-viewport-segments-2' : 'horizontal-viewport-segments-2');\n }\n return { variables, classes };\n}\n//# sourceMappingURL=css.js.map","export const KEYBOARD_CLASS = 'foldable-keyboard-open';\nconst SHOW_EVENTS = ['keyboardWillShow', 'keyboardDidShow', 'ionKeyboardDidShow'];\nconst isEditing = (element) => !!element &&\n (element.isContentEditable || ['INPUT', 'TEXTAREA', 'SELECT'].includes(element.tagName));\nexport function takeOverKeyboard(target, doc) {\n const classes = doc.documentElement.classList;\n for (const name of SHOW_EVENTS) {\n target.addEventListener(name, (event) => {\n event.stopImmediatePropagation();\n if (isEditing(doc.activeElement))\n classes.add(KEYBOARD_CLASS);\n }, true);\n }\n target.addEventListener('keyboardWillHide', () => classes.remove(KEYBOARD_CLASS), true);\n}\n//# sourceMappingURL=keyboard.js.map","const EDGE_TOLERANCE = 1;\nexport function splitViewport(fold, width, height) {\n const whole = [{ x: 0, y: 0, width, height }];\n const hinge = fold === null || fold === void 0 ? void 0 : fold.hingeBounds;\n if (!(fold === null || fold === void 0 ? void 0 : fold.isSeparating) || !hinge)\n return whole;\n if (fold.hingeOrientation === 'vertical') {\n const right = hinge.x + hinge.width;\n const spansHeight = hinge.y <= EDGE_TOLERANCE && hinge.y + hinge.height >= height - EDGE_TOLERANCE;\n if (!spansHeight || hinge.x <= 0 || right >= width)\n return whole;\n return [\n { x: 0, y: 0, width: hinge.x, height },\n { x: right, y: 0, width: width - right, height },\n ];\n }\n const bottom = hinge.y + hinge.height;\n const spansWidth = hinge.x <= EDGE_TOLERANCE && hinge.x + hinge.width >= width - EDGE_TOLERANCE;\n if (!spansWidth || hinge.y <= 0 || bottom >= height)\n return whole;\n return [\n { x: 0, y: 0, width, height: hinge.y },\n { x: 0, y: bottom, width, height: height - bottom },\n ];\n}\n//# sourceMappingURL=segments.js.map","import { Capacitor } from '@capacitor/core';\nimport { BAR_CLASSES, barClassFor, CSS_CLASSES, cssFor, FOLD_CLASSES, FOLD_VARIABLES, foldCssFor, verticalTabBarBottom, } from './css';\nimport { takeOverKeyboard } from './keyboard';\nimport { splitViewport } from './segments';\nclass DevicePosturePolyfill extends EventTarget {\n constructor() {\n super(...arguments);\n this.onchange = null;\n this.current = 'continuous';\n }\n get type() {\n return this.current;\n }\n update(type) {\n var _a;\n if (type === this.current)\n return;\n this.current = type;\n const event = new Event('change');\n (_a = this.onchange) === null || _a === void 0 ? void 0 : _a.call(this, event);\n this.dispatchEvent(event);\n }\n}\nconst postureOf = (fold) => (fold === null || fold === void 0 ? void 0 : fold.state) === 'half-opened' ? 'folded' : 'continuous';\nlet installation = null;\nexport function install(plugin, options = {}) {\n if (!Capacitor.isNativePlatform())\n return Promise.resolve();\n installation !== null && installation !== void 0 ? installation : (installation = run(plugin, options));\n return installation;\n}\nasync function run(plugin, options) {\n if (options.ionicKeyboard)\n takeOverKeyboard(window, document);\n let fold = null;\n const currentSegments = () => splitViewport(fold, window.innerWidth, window.innerHeight);\n if (!('Viewport' in window)) {\n Object.defineProperty(window, 'viewport', {\n configurable: true,\n value: {\n get segments() {\n return Object.freeze(currentSegments().map((rect) => new DOMRect(rect.x, rect.y, rect.width, rect.height)));\n },\n },\n });\n }\n const posture = 'DevicePosture' in window ? null : new DevicePosturePolyfill();\n if (posture) {\n Object.defineProperty(navigator, 'devicePosture', { configurable: true, value: posture });\n }\n const root = document.documentElement;\n let variables = [];\n const applyCss = () => {\n var _a;\n const css = cssFor(currentSegments(), postureOf(fold));\n for (const name of variables)\n root.style.removeProperty(name);\n variables = Object.keys(css.variables);\n for (const name of variables)\n root.style.setProperty(name, css.variables[name]);\n for (const name of CSS_CLASSES)\n root.classList.toggle(name, css.classes.includes(name));\n const foldCss = foldCssFor(fold === null || fold === void 0 ? void 0 : fold.hingeBounds, fold === null || fold === void 0 ? void 0 : fold.hingeOrientation, fold === null || fold === void 0 ? void 0 : fold.hingeMargins);\n for (const name of FOLD_VARIABLES) {\n if (foldCss.variables[name])\n root.style.setProperty(name, foldCss.variables[name]);\n else\n root.style.removeProperty(name);\n }\n for (const name of FOLD_CLASSES)\n root.classList.toggle(name, name === foldCss.className);\n root.style.setProperty('--vertical-tab-bar-bottom', `${verticalTabBarBottom((_a = fold === null || fold === void 0 ? void 0 : fold.cameraBounds) !== null && _a !== void 0 ? _a : [], window.innerHeight)}px`);\n };\n const apply = (next) => {\n fold = next.activeDisplay === 'outer' ? null : next;\n posture === null || posture === void 0 ? void 0 : posture.update(postureOf(fold));\n applyCss();\n // The web view can report the previous window size for a moment after the\n // app moves between displays, so measure again once it has settled.\n requestAnimationFrame(applyCss);\n setTimeout(applyCss, 300);\n };\n const applyBars = ({ verticalBarEdge }) => {\n const active = barClassFor(verticalBarEdge);\n for (const name of BAR_CLASSES)\n root.classList.toggle(name, name === active);\n };\n let measured = '';\n const applyCssIfResized = () => {\n const size = `${window.innerWidth}x${window.innerHeight}`;\n if (size === measured)\n return;\n measured = size;\n applyCss();\n };\n await plugin.addListener('foldingChange', ({ folding }) => root.classList.toggle('folding', folding));\n window.addEventListener('resize', applyCss);\n if (typeof ResizeObserver !== 'undefined')\n new ResizeObserver(applyCssIfResized).observe(root);\n document.addEventListener('visibilitychange', applyCssIfResized);\n await plugin.addListener('foldStateChange', apply);\n await plugin.addListener('barPlacementChange', applyBars);\n apply(await plugin.getFoldState());\n applyBars(await plugin.getBarPlacement());\n}\n//# sourceMappingURL=polyfill.js.map","import { registerPlugin } from '@capacitor/core';\nimport { install } from './polyfill';\nconst Foldable = registerPlugin('Foldable', {\n web: () => import('./web').then((m) => new m.FoldableWeb()),\n});\nconst installFoldablePolyfill = (options) => install(Foldable, options);\nexport * from './definitions';\nexport { Foldable, installFoldablePolyfill };\n//# sourceMappingURL=index.js.map","const MEDIUM_WIDTH = 600;\nconst EXPANDED_WIDTH = 840;\nconst LARGE_WIDTH = 1200;\nconst EXTRA_LARGE_WIDTH = 1600;\nconst MEDIUM_HEIGHT = 480;\nconst EXPANDED_HEIGHT = 900;\nfunction widthClassOf(width) {\n if (width >= EXTRA_LARGE_WIDTH)\n return 'extraLarge';\n if (width >= LARGE_WIDTH)\n return 'large';\n if (width >= EXPANDED_WIDTH)\n return 'expanded';\n if (width >= MEDIUM_WIDTH)\n return 'medium';\n return 'compact';\n}\nfunction heightClassOf(height) {\n if (height >= EXPANDED_HEIGHT)\n return 'expanded';\n if (height >= MEDIUM_HEIGHT)\n return 'medium';\n return 'compact';\n}\nexport function sizeClassOf(width, height) {\n return {\n horizontal: width >= MEDIUM_WIDTH ? 'regular' : 'compact',\n vertical: height >= MEDIUM_HEIGHT ? 'regular' : 'compact',\n widthClass: widthClassOf(width),\n heightClass: heightClassOf(height),\n };\n}\n//# sourceMappingURL=size-class.js.map","import { WebPlugin } from '@capacitor/core';\nimport { sizeClassOf } from './size-class';\nexport class FoldableWeb extends WebPlugin {\n constructor() {\n super();\n this.sizeClass = sizeClassOf(window.innerWidth, window.innerHeight);\n window.addEventListener('resize', () => {\n const next = sizeClassOf(window.innerWidth, window.innerHeight);\n if (JSON.stringify(next) === JSON.stringify(this.sizeClass))\n return;\n this.sizeClass = next;\n this.notifyListeners('sizeClassChange', next);\n });\n }\n async isDeviceFoldable() {\n return { foldable: false, supportsTabletop: false };\n }\n async getFoldState() {\n return { state: 'flat', isSeparating: false, posture: 'flat' };\n }\n async setVerticalBarBehavior() {\n return { applied: false };\n }\n async getReservedRegions() {\n return { regions: [] };\n }\n async getHingeAngle() {\n return { angle: null, status: null };\n }\n async getSizeClass() {\n return sizeClassOf(window.innerWidth, window.innerHeight);\n }\n async getDisplayModes() {\n return { rearDisplay: 'unsupported', dualScreen: 'unsupported' };\n }\n async getBarPlacement() {\n return { verticalBarEdge: null, inset: 0 };\n }\n async startRearDisplay() {\n throw this.unavailable('Rear display mode is only available on Android.');\n }\n stopRearDisplay() {\n return Promise.resolve();\n }\n async startDualScreen() {\n throw this.unavailable('Dual-screen mode is only available on Android.');\n }\n stopDualScreen() {\n return Promise.resolve();\n }\n}\n//# sourceMappingURL=web.js.map"],"names":["Capacitor","registerPlugin","WebPlugin"],"mappings":";;;IAAO,MAAM,WAAW,GAAG;IAC3B,IAAI,gCAAgC;IACpC,IAAI,8BAA8B;IAClC,IAAI,2BAA2B;IAC/B,IAAI,uBAAuB;IAC3B,CAAC;IACM,MAAM,WAAW,GAAG,CAAC,uBAAuB,EAAE,wBAAwB,CAAC;IACvE,MAAM,YAAY,GAAG,CAAC,eAAe,EAAE,iBAAiB,CAAC;IACzD,MAAM,cAAc,GAAG;IAC9B,IAAI,aAAa;IACjB,IAAI,YAAY;IAChB,IAAI,cAAc;IAClB,IAAI,eAAe;IACnB,IAAI,mBAAmB;IACvB,IAAI,qBAAqB;IACzB,IAAI,sBAAsB;IAC1B,IAAI,oBAAoB;IACxB,CAAC;IACM,SAAS,UAAU,CAAC,WAAW,EAAE,gBAAgB,EAAE,YAAY,EAAE;IACxE,IAAI,IAAI,CAAC,WAAW,IAAI,CAAC,gBA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|
32
32
|
private var isFolding = false
|
|
33
33
|
private var foldingWorkItem: DispatchWorkItem?
|
|
34
|
+
private var barPlacementWorkItems: [DispatchWorkItem] = []
|
|
35
|
+
private var barPlacementNeedsResend = false
|
|
34
36
|
private var orientationObserver: NSObjectProtocol?
|
|
35
37
|
|
|
36
38
|
@objc override public func load() {
|
|
@@ -103,7 +105,12 @@ public class FoldablePlugin: CAPPlugin, CAPBridgedPlugin {
|
|
|
103
105
|
@objc func getBarPlacement(_ call: CAPPluginCall) {
|
|
104
106
|
DispatchQueue.main.async { [weak self] in
|
|
105
107
|
guard let self = self else { return }
|
|
106
|
-
|
|
108
|
+
let placement = self.currentBarPlacement()
|
|
109
|
+
if let last = self.lastBarPlacement, !(last as NSDictionary).isEqual(to: placement) {
|
|
110
|
+
self.barPlacementNeedsResend = true
|
|
111
|
+
self.notifyBarPlacementAfterSettling()
|
|
112
|
+
}
|
|
113
|
+
call.resolve(placement)
|
|
107
114
|
}
|
|
108
115
|
}
|
|
109
116
|
|
|
@@ -153,6 +160,7 @@ public class FoldablePlugin: CAPPlugin, CAPBridgedPlugin {
|
|
|
153
160
|
implementation.observeChanges(in: view) { [weak self] in
|
|
154
161
|
self?.notifyFoldStateNowAndAfterSettling()
|
|
155
162
|
self?.notifyHingeAngleIfChanged()
|
|
163
|
+
self?.notifyBarPlacementAfterSettling()
|
|
156
164
|
}
|
|
157
165
|
|
|
158
166
|
UIDevice.current.beginGeneratingDeviceOrientationNotifications()
|
|
@@ -163,7 +171,7 @@ public class FoldablePlugin: CAPPlugin, CAPBridgedPlugin {
|
|
|
163
171
|
) { [weak self] _ in
|
|
164
172
|
self?.notifyFoldStateNowAndAfterSettling()
|
|
165
173
|
self?.notifySizeClassIfChanged()
|
|
166
|
-
self?.
|
|
174
|
+
self?.notifyBarPlacementAfterSettling()
|
|
167
175
|
}
|
|
168
176
|
|
|
169
177
|
guard #available(iOS 17.0, *) else { return }
|
|
@@ -179,7 +187,7 @@ public class FoldablePlugin: CAPPlugin, CAPBridgedPlugin {
|
|
|
179
187
|
_ = view.registerForTraitChanges(traits) { [weak self] (_: UIView, _: UITraitCollection) in
|
|
180
188
|
self?.notifySizeClassIfChanged()
|
|
181
189
|
self?.notifyFoldStateNowAndAfterSettling()
|
|
182
|
-
self?.
|
|
190
|
+
self?.notifyBarPlacementAfterSettling()
|
|
183
191
|
}
|
|
184
192
|
}
|
|
185
193
|
}
|
|
@@ -211,12 +219,22 @@ public class FoldablePlugin: CAPPlugin, CAPBridgedPlugin {
|
|
|
211
219
|
|
|
212
220
|
private func notifyBarPlacementIfChanged() {
|
|
213
221
|
let placement = currentBarPlacement()
|
|
214
|
-
if let last = lastBarPlacement, (last as NSDictionary).isEqual(to: placement) { return }
|
|
222
|
+
if !barPlacementNeedsResend, let last = lastBarPlacement, (last as NSDictionary).isEqual(to: placement) { return }
|
|
215
223
|
|
|
224
|
+
barPlacementNeedsResend = false
|
|
216
225
|
lastBarPlacement = placement
|
|
217
226
|
notifyListeners("barPlacementChange", data: placement)
|
|
218
227
|
}
|
|
219
228
|
|
|
229
|
+
private func notifyBarPlacementAfterSettling() {
|
|
230
|
+
barPlacementWorkItems.forEach { $0.cancel() }
|
|
231
|
+
barPlacementWorkItems = [0.25, 0.8].map { delay in
|
|
232
|
+
let check = DispatchWorkItem { [weak self] in self?.notifyBarPlacementIfChanged() }
|
|
233
|
+
DispatchQueue.main.asyncAfter(deadline: .now() + delay, execute: check)
|
|
234
|
+
return check
|
|
235
|
+
}
|
|
236
|
+
}
|
|
237
|
+
|
|
220
238
|
private func notifyFoldStateNowAndAfterSettling() {
|
|
221
239
|
notifyFoldStateIfChanged()
|
|
222
240
|
DispatchQueue.main.asyncAfter(deadline: .now() + 0.3) { [weak self] in
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@erkamyaman/capacitor-foldable",
|
|
3
|
-
"version": "8.4.
|
|
3
|
+
"version": "8.4.2",
|
|
4
4
|
"description": "Fold-state and dual-display APIs for foldable devices in Capacitor apps",
|
|
5
5
|
"main": "dist/plugin.cjs.js",
|
|
6
6
|
"module": "dist/esm/index.js",
|
|
@@ -75,7 +75,7 @@
|
|
|
75
75
|
"eslint": "eslint . --ext ts",
|
|
76
76
|
"prettier": "prettier \"**/*.{css,html,ts,js,java}\" --plugin=prettier-plugin-java",
|
|
77
77
|
"swiftlint": "node-swiftlint",
|
|
78
|
-
"docgen": "docgen --api FoldablePlugin --output-readme
|
|
78
|
+
"docgen": "node scripts/docs-api.mjs open && docgen --api FoldablePlugin --output-readme docs/api.md --output-json dist/docs.json && node scripts/docs-api.mjs close",
|
|
79
79
|
"build": "npm run clean && npm run docgen && tsc && rollup -c rollup.config.mjs",
|
|
80
80
|
"clean": "rimraf ./dist",
|
|
81
81
|
"watch": "tsc --watch",
|
|
@@ -23,16 +23,21 @@ React and Vue import it from the entry file as usual, since their bundlers ship
|
|
|
23
23
|
|
|
24
24
|
## Projecting Ionic controls into native UI
|
|
25
25
|
|
|
26
|
-
Moving the tab bar with CSS is one answer. The other is [`@rdlabo/
|
|
26
|
+
Moving the tab bar with CSS is one answer. The other is [`@rdlabo/capacitor-native-ui`](https://github.com/rdlabo-dev/ionic-theme-ios27/tree/main/packages/capacitor-native-ui), which renders existing `ion-back-button`, `ion-buttons`, `ion-button`, `ion-tab-bar` and segment controls with UIKit and SwiftUI while the original elements, state and handlers stay in the WebView. It can put them in the system's vertical rail on iPhone Duo, and it works with an app's existing theme. The optional [`@rdlabo/ionic-theme-ios27`](https://github.com/rdlabo-dev/ionic-theme-ios27) adds iOS 27 styling on top.
|
|
27
27
|
|
|
28
|
-
The split is clean: this plugin provides device state, the theme handles
|
|
28
|
+
The split is clean: this plugin provides device state, Native UI projects the controls, and the theme handles Web styling. Both rdlabo packages list this plugin in their standard setup, installed by the app as a direct dependency:
|
|
29
29
|
|
|
30
|
-
|
|
30
|
+
```sh
|
|
31
|
+
npm install @rdlabo/capacitor-native-ui @erkamyaman/capacitor-foldable
|
|
32
|
+
```
|
|
33
|
+
|
|
34
|
+
For setup, send the reader to rdlabo's own documentation rather than duplicating it here:
|
|
31
35
|
|
|
32
|
-
- [
|
|
33
|
-
- [Vertical Bars
|
|
36
|
+
- [Native UI guide](https://github.com/rdlabo-dev/ionic-theme-ios27/tree/main/packages/capacitor-native-ui)
|
|
37
|
+
- [Vertical Bars with an existing Ionic theme](https://github.com/rdlabo-dev/ionic-theme-ios27/blob/main/packages/capacitor-native-ui/docs/ionic-vertical-bars.md)
|
|
38
|
+
- [Migrating from theme 1.2.x](https://github.com/rdlabo-dev/ionic-theme-ios27/blob/main/packages/capacitor-native-ui/docs/migration.md), where the native APIs were still bundled in the theme
|
|
34
39
|
|
|
35
|
-
Use the CSS stylesheet above when you want Ionic's own tab bar moved, and
|
|
40
|
+
Use the CSS stylesheet above when you want Ionic's own tab bar moved, and Native UI when you want the controls rendered natively.
|
|
36
41
|
|
|
37
42
|
## A fold fires a keyboard event
|
|
38
43
|
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
# iPhone Duo
|
|
2
2
|
|
|
3
|
-
Needs iOS 27.1
|
|
3
|
+
Needs iOS 27.1 on the device. Any Xcode builds: against the 27.1 SDK the plugin uses the typed APIs, and against an older one it reaches the same APIs through the Objective-C runtime, so the fold is reported either way.
|
|
4
4
|
|
|
5
5
|
## Measured geometry
|
|
6
6
|
|
|
@@ -2,14 +2,14 @@
|
|
|
2
2
|
|
|
3
3
|
## iPhone Duo simulator
|
|
4
4
|
|
|
5
|
-
Needs the iOS 27.1 runtime, which the device type refuses to go below
|
|
5
|
+
Needs the iOS 27.1 runtime, which the device type refuses to go below. Any Xcode builds and the fold is reported either way, since the plugin falls back to the Objective-C runtime when the SDK predates 27.1. The SDK still decides the window: against 27.1 the app fills the inner display, against 27.0 it leaves gaps, and against anything older it runs in compatibility mode inside a black border. In Xcode 27 the simulator lives inside **DeviceHub.app**, not `Simulator.app`.
|
|
6
6
|
|
|
7
7
|
```bash
|
|
8
8
|
open "$(dirname "$(xcode-select -p)")/Applications/DeviceHub.app"
|
|
9
9
|
npx cap run ios # pick the iPhone Duo
|
|
10
10
|
```
|
|
11
11
|
|
|
12
|
-
If several Xcodes are installed, check `xcode-select -p` first, or set `DEVELOPER_DIR` to the 27.1 one
|
|
12
|
+
If several Xcodes are installed, check `xcode-select -p` first, or set `DEVELOPER_DIR` to the 27.1 one, so the app fills the display properly. The fold is reported from either SDK.
|
|
13
13
|
|
|
14
14
|
Fold it with the hinge slider in DeviceHub; hold Option for finer control. The inner and outer displays are separate windows.
|
|
15
15
|
|